typedef struct{ UINT16 Class; UINT16 SubClass; UINT16 Key; SETUP_ITEM_CALLBACK_HANDLER *UpdateItem; } SETUP_ITEM_CALLBACK; Ex. ELINK Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS, 0, DPTF_SADEVICE_KEY, PlatformSetupCallback)," Parent = "SetupItemCallbacks" InvokeOrder = AfterParent End
When modify value will trigger this action. Always get modify previous value when get browser data.
When modify value will trigger this action. Always get modify value when get browser data.
When entry to Setup menu and will trigger this action.
When leave to Setup menu will trigger this action.
typedef EFI_STATUS (SETUP_ITEM_CALLBACK_HANDLER)( EFI_HII_HANDLE HiiHandle, UINT16 Class, UINT16 SubClass, UINT16 Key)
讀取和寫入目前記憶體中的設定值, 並不會影響到 Flash part,除非做了 save 動作。 第一次進 SETUP 時,會將所有資料寫到 MEMORY buffer。 HiiLibGetBrowserData(&Size, &FlashUpdateControl, &guidReFlash, L"Setup"); HiiLibSetBrowserData(Size, &FlashUpdateControl, &guidReFlash, L"Setup");
1. Proclaim “INTERACTIVE” and “questionid” in Setup Item oneof varid = SETUP_DATA.EnableDptf, questionid = AUTO_ID(DPTF_ENABLE_KEY), prompt = STRING_TOKEN(STR_ENABLE_DPTF_PROMPT), help = STRING_TOKEN(STR_ENABLE_DPTF_HELP), option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED | INTERACTIVE; option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = RESET_REQUIRED | INTERACTIVE; endoneof; ****** 記得要加入 INTERACTIVE ****** 2.Create Callback Function 3.Add SetupItemCallbacks ELINK ELINK Name = "ITEM_CALLBACK(ADVANCED_FORM_SET_CLASS,0,DPTF_SADEVICE_KEY,PlatformSetupCallback)," Parent = "SetupItemCallbacks" InvokeOrder = AfterParent End
Ex1: EFI_STATUS PushButtonResetSetupCallbackFunction( EFI_HII_HANDLE HiiHandle, UINT16 Class, UINT16 SubClass, UINT16 Key ) { EFI_STATUS Status = EFI_SUCCESS; AMI_PUSH_BUTTON_RESET_PROTOCOL *AmiPushButtonResetProtocol = NULL; CALLBACK_PARAMETERS *Callback = NULL; TRACE((TRACE_ALWAYS, "PushButtonReset: Callback function invoked.\n")); Callback = GetCallbackParameters(); if(Callback==NULL) { Status=EFI_INVALID_PARAMETER; return Status; } if(Callback->Action != EFI_BROWSER_ACTION_CHANGING) { Status=EFI_INVALID_PARAMETER; return Status; } if(Key == PUSH_BUTTON_RESET_TRIGGER_KEY) { TRACE((TRACE_ALWAYS, "PushButtonReset: Try to call the loader\n")); Status = pBS->LocateProtocol (&gAmiPushButtonResetProtocolGuid, NULL, &AmiPushButtonResetProtocol) ; if(EFI_ERROR(Status)) { TRACE((TRACE_ALWAYS, "Error in locate protocol %r\n",Status)); return Status; } Status = AmiPushButtonResetProtocol->InvokeLoader(); if(EFI_ERROR(Status)) TRACE((TRACE_ALWAYS, "Error in invoke loader\n")); return Status; } return Status; } Ex2 : EFI_STATUS JumplessMeTemporarityDisabledTrigger( EFI_HII_HANDLE HiiHandle, UINT16 Class, UINT16 SubClass, UINT16 Key ) { EFI_STATUS Status = EFI_SUCCESS; UINT8 Value; CALLBACK_PARAMETERS *Callback = NULL; TRACE((TRACE_ALWAYS, "JumplessMeTemporarityDisabledTrigger: Callback function invoked.\n")); Callback = GetCallbackParameters(); if(Callback==NULL) { Status=EFI_INVALID_PARAMETER; return Status; } if(Callback->Action != EFI_BROWSER_ACTION_CHANGING) { Status=EFI_INVALID_PARAMETER; return Status; } if(Key == JPLS_ME_TEMPDIS_TRIGGER_KEY) { IoWrite8(0x4E, 0x87); IoWrite8(0x4E, 0x87); IoWrite8(0x4E, 0x27); Value = IoRead8(0x4F); Value = Value & 0xF2 | 0x00; IoWrite8(0x4F, Value); IoWrite8(0x4E, 0x2C); Value = IoRead8(0x4F); Value = Value & 0xEF | 0x10; IoWrite8(0x4F, Value); IoWrite8(0x4E, 0x07); Value = IoRead8(0x4F); Value = Value & 0x00 | 0x06; IoWrite8(0x4F, Value); IoWrite8(0x4E, 0xF0); Value = IoRead8(0x4F); Value = Value & 0xEF | 0x10; IoWrite8(0x4F, Value); IoWrite8(0x4E, 0xF1); Value = IoRead8(0x4F); Value = Value & 0xEF | 0x00; IoWrite8(0x4F, Value); IoWrite8(0x4E, 0xF3); Value = IoRead8(0x4F); Value = Value & 0xEF | 0x10; IoWrite8(0x4F, Value); IoWrite8(0x4E, 0xAA); IoWrite8(0xCF9, 0x0E); } return Status; }
Shift state
Toggle state
EFI Scan codes