From 86318e713d1a2ec5a8165a8964d570e4c5a90dd8 Mon Sep 17 00:00:00 2001 From: raywu Date: Fri, 14 Sep 2018 08:31:46 +0800 Subject: BIOS Custom Done --- .../EfiOsBootOptionNames/EfiOsBootOptionNames.sd | 8 ++ .../EfiOsBootOptionNames/EfiOsBootOptionNames.uni | Bin 6122 -> 6248 bytes Core/EM/EfiOsBootOptionNames/EfiOsBootOrder.c | 92 ++++++++++++--------- 3 files changed, 60 insertions(+), 40 deletions(-) (limited to 'Core') 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 index 28afbd9..ce31c2c 100644 Binary files a/Core/EM/EfiOsBootOptionNames/EfiOsBootOptionNames.uni and b/Core/EM/EfiOsBootOptionNames/EfiOsBootOptionNames.uni differ 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 #include +#include +#include #if DISPLAY_FULL_OPTION_NAME_WITH_FBO #include "Board\em\FixedBootOrder\FixedBootOrder.h" @@ -1378,49 +1380,59 @@ VOID AdjustEfiOsBootOrder(VOID) //---------------------------------------------------------------------------- // 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 -- cgit v1.2.3