使用者工具

網站工具


uefi_ami_bios

UEFI AMI BIOS 研究

AMI Utility

MMTOOL

  • Module Management Tool
    1. Manage the Firmware file modules (Modules, Option ROM, CPU microcode Patch, ROM holes) that are contained in the Aptio firmware image.
    2. The MMTOOL Module Management Utility offers the following features:
      • Insert
      • Replace
      • Delete
      • Displays

AMIBCP

  • AMI BIOS Configuration Program
    • Provides easy customization of some Aptio features in a ROM file without using source code
      1. BIOS setup options – Change default values, hide questions
      2. BIOS strings – Displayed at boot or in BIOS setup
      3. PCI IRQ Routing Table
      4. APTIO DMI Tables – Change static data
      5. Boot Order Grouping
      6. BIOS Features
  • AMI ChangeLogo Tool allows you to replace the logo inside the APTIO Firmware file or Capsule file with a new one
  • The Change Logo Tool supports the following image formats outlined below
    1. BMP files
    2. JPEG files
    3. GIF files
    4. PCX files
    5. PNG files

AMISLP

  • AMISLP (AMI System Lock Preinstallation)
    1. Used by OEMs to pre-activate Microsoft Windows
    2. Display OEM IDs
    3. Amislp /D ROMfilename

AMISDE

  • Provides an easy way to extract setup questions and its related information from the given APTIO ROM Image.

AMISCE

DMIEdit

  • Desktop Management Interface Edit.
  • Read or write data associated with SMBIOS tables.
  • The following SMBIOS tables could be modified by DMIEdit:
    1. Bios Information (Type 0)
    2. System (Type 1)
    3. Base Board (Type 2)
    4. Chassis (Type 3)
    5. Processor Information(Type 4)
    6. OEM String (Type 11)
    7. System Configuration Options (Type 12)
    8. Portable Battery (Type 22)
    9. System Power Supply (Type 39)

AFU

  • AMI Firmware Update
    1. Update system
      1. Main BIOS
      2. Boot Block
      3. NVRAM
    2. Embedded Controller
    3. Intel ME
    4. OEM Activation file (OA 3.0 for Window8)
  • AFU Secure Flash
    1. Security OFBD
    2. Capsule
    3. Recovery

AMIUCP

  • Utility Configuration Program
    • Customize AMIBIOS ROM Utility’s capabilities for specific product or user. This is an utility to configure default settings/behaviors of certain compatible utilities
  • This utility offers following features:
    1. Display Utility Identification Information
    2. Insert
    3. Delete
    4. Extract
    5. Replace
    6. Insert ROM image
    7. Exchange ROM image
    8. Insert Default Command String
    9. Exchange Default Command String
    10. Edit OEM Version
    11. Change Command Default Status

Setup

VFR flag

  • DEFAULT: Set default option.
  • MANUFACTURING: Manufacturing mode default value.
  • INTERACTIVE: Item can use callback function.
  • RESET_REQUIRED: Reset system when you change and save this item.

Setup token Explain

  • LOGO_FILE_NAME: Set full screen mode logo file.
  • DEFAULT_QUIET_BOOT : Set Default value of the Quiet Boot option.
  • SUPPORT_ZERO_BOOT_TIMEOUT : Enables or disables possibility to set boot timeout to 0.
  • DEFAULT_BOOT_TIMEOUT : Number of seconds that the firmware will wait before initiating.
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 
  

SetupItem Callbacks action explain

  • EFI_BROWSER_ACTION_CHANGING

When modify value will trigger this action. Always get modify previous value when get browser data.

  • EFI_BROWSER_ACTION_CHANGED

When modify value will trigger this action. Always get modify value when get browser data.

  • EFI_BROWSER_ACTION_FORM_OPEN

When entry to Setup menu and will trigger this action.

  • EFI_BROWSER_ACTION_FORM_CLOSE

When leave to Setup menu will trigger this action.

Callback Function Prototype define

typedef EFI_STATUS (SETUP_ITEM_CALLBACK_HANDLER)( 
    EFI_HII_HANDLE HiiHandle, UINT16 Class, UINT16 SubClass, UINT16 Key) 

Hii Get/Set Setup data buffer

讀取和寫入目前記憶體中的設定值, 並不會影響到 Flash part,除非做了 save 動作。
第一次進 SETUP 時,會將所有資料寫到 MEMORY buffer。

HiiLibGetBrowserData(&Size, &FlashUpdateControl, &guidReFlash, L"Setup"); 
HiiLibSetBrowserData(Size, &FlashUpdateControl, &guidReFlash, L"Setup"); 

SetupItem Callbacks Create

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 

Callback Function Example

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;
}

Setup Class Hook

  • LoadedUserDefaultsHook
  • SavedConfigChangesHook
  • LoadedConfigDefaultsHook
  • PreSystemResetHookHook

Setup instruction

  • Grayoutif 的作用是设定某一个 item 跟随另一个 item 的变化而被设置为灰色无法修改。
  • Suppressif 的作用是设定某一个 item 跟随另一个 item 的变化而被自动隐藏 。

HotKey Class Hook

  1. CheckForKeyHook
    • 在POST過程中,會有很多地方都加入此HOOK,如果插入在此HOOK則很多地方都會檢查並執行。
  2. OemKey1Hook
  3. OemKey2Hook
  4. OemKey3Hook
  5. OemKey4Hook
    • 一般給OEM使用,如RECOVERY,按了按鍵,則做對應動作。

OemKey1-4 Token

  1. SETUP_OEM_KEY1_ENABLE
  2. SETUP_OEM_KEY1_UNICODE
    • 使用方式像 F1, F2, F3 …等HOTKEY
  3. SETUP_OEM_KEY1_SCAN
    • 使用方式像 A, B, C …等HOTKEY
  4. SETUP_OEM_KEY1_SHIFT
    • 檢查是否有按下 CTRL/SHIFT/ALT/Windows Modifier Key
  5. SETUP_OEM_KEY1_TOGGLE
    • 檢查是否有按下 CAPS LOCK/ NUMBER LOCK

OemKey Shift and Toggle state

Shift state

  • #define EFI_SHIFT_STATE_VALID 0x80000000
  • #define EFI_RIGHT_SHIFT_PRESSED 0x00000001
  • #define EFI_LEFT_SHIFT_PRESSED 0x00000002
  • #define EFI_RIGHT_CONTROL_PRESSED 0x00000004
  • #define EFI_LEFT_CONTROL_PRESSED 0x00000008
  • #define EFI_RIGHT_ALT_PRESSED 0x00000010
  • #define EFI_LEFT_ALT_PRESSED 0x00000020
  • #define EFI_RIGHT_LOGO_PRESSED 0x00000040
  • #define EFI_LEFT_LOGO_PRESSED 0x00000080
  • #define EFI_MENU_KEY_PRESSED 0x00000100
  • #define EFI_SYS_REQ_PRESSED 0x00000200

Toggle state

  • #define EFI_TOGGLE_STATE_VALID 0x80
  • #define EFI_KEY_STATE_EXPOSED 0x40
  • #define EFI_SCROLL_LOCK_ACTIVE 0x01
  • #define EFI_NUM_LOCK_ACTIVE 0x02
  • #define EFI_CAPS_LOCK_ACTIVE 0x04

EFI Scan codes

  • #define SCAN_F11 0x0015
  • #define SCAN_F12 0x0016
  • #define SCAN_PAUSE 0x0048
  • #define SCAN_F13 0x0068
  • #define SCAN_F14 0x0069
  • #define SCAN_F15 0x006A
  • #define SCAN_F16 0x006B
  • #define SCAN_F17 0x006C
  • #define SCAN_F18 0x006D
  • #define SCAN_F19 0x006E
  • #define SCAN_F20 0x006F
  • #define SCAN_F21 0x0070
  • #define SCAN_F22 0x0071
  • #define SCAN_F23 0x0072
  • #define SCAN_F24 0x0073
  • #define SCAN_MUTE 0x007F
  • #define SCAN_VOLUME_UP 0x0080
  • #define SCAN_VOLUME_DOWN 0x0081
  • #define SCAN_BRIGHTNESS_UP 0x0100
  • #define SCAN_BRIGHTNESS_DOWN 0x0101
  • #define SCAN_SUSPEND 0x0102
  • #define SCAN_HIBERNATE 0x0103
  • #define SCAN_TOGGLE_DISPLAY 0x0104
  • #define SCAN_RECOVERY 0x0105
  • #define SCAN_EJECT 0x0106
uefi_ami_bios.txt · 上一次變更: 2024/05/16 14:18 由 don