diff options
author | raywu <raywu@aaeon.com.tw> | 2018-09-14 08:31:46 +0800 |
---|---|---|
committer | raywu <raywu@aaeon.com.tw> | 2018-09-14 08:31:46 +0800 |
commit | 86318e713d1a2ec5a8165a8964d570e4c5a90dd8 (patch) | |
tree | c507aaba039b70236b53bd8bbff8c5709a7697ae /Core/EM | |
parent | 31bb486c913795c8b67d1c4dbaae2bdec4943fc9 (diff) | |
download | zprj-86318e713d1a2ec5a8165a8964d570e4c5a90dd8.tar.xz |
BIOS Custom Done
Diffstat (limited to 'Core/EM')
-rw-r--r-- | Core/EM/EfiOsBootOptionNames/EfiOsBootOptionNames.sd | 8 | ||||
-rw-r--r-- | Core/EM/EfiOsBootOptionNames/EfiOsBootOptionNames.uni | bin | 6122 -> 6248 bytes | |||
-rw-r--r-- | Core/EM/EfiOsBootOptionNames/EfiOsBootOrder.c | 92 |
3 files changed, 60 insertions, 40 deletions
diff --git a/Core/EM/EfiOsBootOptionNames/EfiOsBootOptionNames.sd b/Core/EM/EfiOsBootOptionNames/EfiOsBootOptionNames.sd index 8f99071..f966552 100644 --- a/Core/EM/EfiOsBootOptionNames/EfiOsBootOptionNames.sd +++ b/Core/EM/EfiOsBootOptionNames/EfiOsBootOptionNames.sd @@ -50,6 +50,7 @@ /* These definitions will be converted by the build process /* to a definitions of SETUP_DATA fields. /***********************************************************/ + UINT8 OnlyBootHDD ; #endif #if defined(VFRCOMPILE) && !defined(CONTROLS_ARE_DEFINED) @@ -99,6 +100,13 @@ EOBON_ONEOF_NEW_OPTION_POLICY + SEPARATOR + oneof varid = SETUP_DATA.OnlyBootHDD, + prompt = STRING_TOKEN(STR_ONLY_BOOT_HDD), + help = STRING_TOKEN(STR_ONLY_BOOT_HDD), + option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED, key = 0; + option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = 0, key = 0; + endoneof; #endif //#ifdef FORM_SET_FORM #endif //#ifdef BOOT_FORM_SET diff --git a/Core/EM/EfiOsBootOptionNames/EfiOsBootOptionNames.uni b/Core/EM/EfiOsBootOptionNames/EfiOsBootOptionNames.uni Binary files differindex 28afbd9..ce31c2c 100644 --- a/Core/EM/EfiOsBootOptionNames/EfiOsBootOptionNames.uni +++ b/Core/EM/EfiOsBootOptionNames/EfiOsBootOptionNames.uni diff --git a/Core/EM/EfiOsBootOptionNames/EfiOsBootOrder.c b/Core/EM/EfiOsBootOptionNames/EfiOsBootOrder.c index 32087f9..df5ef53 100644 --- a/Core/EM/EfiOsBootOptionNames/EfiOsBootOrder.c +++ b/Core/EM/EfiOsBootOptionNames/EfiOsBootOrder.c @@ -181,6 +181,8 @@ #include "EfiOsNamesFilePathMaps.h" #include <Protocol\PDiskinfo.h> #include <Token.h> +#include <AmiDxeLib.h> +#include <Setup.h> #if DISPLAY_FULL_OPTION_NAME_WITH_FBO #include "Board\em\FixedBootOrder\FixedBootOrder.h" @@ -1378,49 +1380,59 @@ VOID AdjustEfiOsBootOrder(VOID) //---------------------------------------------------------------------------- //<AMI_PHDR_END> BOOLEAN RemoveLegacyGptHdd(BOOT_DEVICE *Device){ - EFI_BLOCK_IO_PROTOCOL *BlkIo; - EFI_STATUS Status; - UINT8 *Buffer = NULL; - UINTN index; - PARTITION_ENTRY *pEntries; - - if ( Device->DeviceHandle == INVALID_HANDLE - || Device->BbsEntry == NULL - ) return FALSE; - - if( Device->BbsEntry->DeviceType != BBS_HARDDISK ) return FALSE; - - Status=pBS->HandleProtocol( - Device->DeviceHandle, &gEfiBlockIoProtocolGuid, &BlkIo - ); +// EFI_BLOCK_IO_PROTOCOL *BlkIo; +// EFI_STATUS Status; +// UINT8 *Buffer = NULL; +// UINTN index; +// PARTITION_ENTRY *pEntries; +// +// if ( Device->DeviceHandle == INVALID_HANDLE +// || Device->BbsEntry == NULL +// ) return FALSE; +// +// if( Device->BbsEntry->DeviceType != BBS_HARDDISK ) return FALSE; +// +// Status=pBS->HandleProtocol( +// Device->DeviceHandle, &gEfiBlockIoProtocolGuid, &BlkIo +// ); +// +// if (EFI_ERROR(Status) || BlkIo->Media->RemovableMedia) return FALSE; //USB device? +// +// Status = pBS->AllocatePool( EfiBootServicesData, BlkIo->Media->BlockSize, &Buffer ); +// if( Buffer == NULL ) return FALSE; +// +// // read the first sector +// BlkIo->ReadBlocks ( BlkIo, +// BlkIo->Media->MediaId, +// 0, +// BlkIo->Media->BlockSize, +// (VOID*)Buffer); +// +// if(Buffer[0x1fe]==(UINT8)0x55 && Buffer[0x1ff]==(UINT8)0xaa) //MBR Signature +// { +// pEntries=(PARTITION_ENTRY *)(Buffer+0x1be); +// +// for(index=0;index<4;index++) +// { +// if( pEntries[index].PartitionType==0xee) //Check GPT Partition? +// { +// pBS->FreePool( Buffer ); +// return TRUE; //Set Can't Boot. +// } +// } //for(index=0;index<4;index++) +// }//if(Buffer[0x1fe]==0x55 && Buffer[0x1ff]==0xaa) +// +// pBS->FreePool( Buffer ); +// return FALSE; - if (EFI_ERROR(Status) || BlkIo->Media->RemovableMedia) return FALSE; //USB device? - - Status = pBS->AllocatePool( EfiBootServicesData, BlkIo->Media->BlockSize, &Buffer ); - if( Buffer == NULL ) return FALSE; - - // read the first sector - BlkIo->ReadBlocks ( BlkIo, - BlkIo->Media->MediaId, - 0, - BlkIo->Media->BlockSize, - (VOID*)Buffer); - - if(Buffer[0x1fe]==(UINT8)0x55 && Buffer[0x1ff]==(UINT8)0xaa) //MBR Signature - { - pEntries=(PARTITION_ENTRY *)(Buffer+0x1be); + EFI_STATUS Status; + SETUP_DATA SetupData; + UINTN Size = sizeof(SETUP_DATA); + EFI_GUID SetupGuid = SETUP_GUID; - for(index=0;index<4;index++) - { - if( pEntries[index].PartitionType==0xee) //Check GPT Partition? - { - pBS->FreePool( Buffer ); - return TRUE; //Set Can't Boot. - } - } //for(index=0;index<4;index++) - }//if(Buffer[0x1fe]==0x55 && Buffer[0x1ff]==0xaa) + Status = pRS->GetVariable(L"Setup", &SetupGuid, NULL, &Size, &SetupData); - pBS->FreePool( Buffer ); + if( Device->BbsEntry->DeviceType != BBS_HARDDISK && SetupData.OnlyBootHDD == 1 ) return TRUE; return FALSE; } #endif |