From 86318e713d1a2ec5a8165a8964d570e4c5a90dd8 Mon Sep 17 00:00:00 2001 From: raywu Date: Fri, 14 Sep 2018 08:31:46 +0800 Subject: BIOS Custom Done --- Board/SB/SB.sdl | 2 +- CRB/CSP.sdl | 25 ++++++ Chipset/SB/SBGeneric.c | 11 ++- .../EfiOsBootOptionNames/EfiOsBootOptionNames.sd | 8 ++ .../EfiOsBootOptionNames/EfiOsBootOptionNames.uni | Bin 6122 -> 6248 bytes Core/EM/EfiOsBootOptionNames/EfiOsBootOrder.c | 92 ++++++++++++--------- EDK/MiniSetup/BootOnly/postmgmtext.c | 3 +- EDK/MiniSetup/TseLite/callback.c | 2 +- SharkBayDT.veb | 4 +- 9 files changed, 100 insertions(+), 47 deletions(-) diff --git a/Board/SB/SB.sdl b/Board/SB/SB.sdl index 9c0fe11..3931349 100644 --- a/Board/SB/SB.sdl +++ b/Board/SB/SB.sdl @@ -5320,7 +5320,7 @@ End ELINK Name = "SBIsDefaultConfigMode," - Parent = "IsDefaultConfigMode" + Parent = "IsResetConfigMode" InvokeOrder = AfterParent End diff --git a/CRB/CSP.sdl b/CRB/CSP.sdl index c9fb820..2846d6f 100644 --- a/CRB/CSP.sdl +++ b/CRB/CSP.sdl @@ -1633,3 +1633,28 @@ TOKEN TokenType = Expression TargetEQU = Yes End + +TOKEN + Name = "BBS_USB_DEVICE_TYPE_SUPPORT" + Value = "1" + Help = "Treat USB devices as a separate BBS device type" + TokenType = Boolean + TargetH = Yes +End + +TOKEN + Name = "RemoveLegacyGptHddDevice" + Value = "1" + Help = "On. Filter GPT Format Hard disk of Legacy device." + TokenType = Boolean + TargetMAK = Yes + TargetH = Yes +End + +TOKEN + Name = "BOOT_FLOW_NORMAL_LAUNCH_DEFAULT_BOOTIMAGE" + Value = "0" + Help = "Support for UEFI specification v 2.3.1 section 3.4.1.1 and 3.4.1.2 to load the default boot image (efi\boot\boot####.efi) from any of the available file system if no boot option found. 1 = Enabling default image boot and 0 = Disabling default image boot." + TokenType = Boolean + TargetH = Yes +End \ No newline at end of file diff --git a/Chipset/SB/SBGeneric.c b/Chipset/SB/SBGeneric.c index 097ce6f..7edb117 100644 --- a/Chipset/SB/SBGeneric.c +++ b/Chipset/SB/SBGeneric.c @@ -1561,9 +1561,18 @@ BOOLEAN SBIsDefaultConfigMode ( IN EFI_PEI_READ_ONLY_VARIABLE2_PPI *ReadVariablePpi ) { UINT8 Buffer8; + UINT8 CmosDiagnosticSts = FALSE; Buffer8 = READ_PCI8_SB(SB_REG_GEN_PMCON_3); // 0xA4 - return (Buffer8 & 4) ? TRUE : FALSE; +// return (Buffer8 & 4) ? TRUE : FALSE; + + IoWrite8(0x70, 0x0E); + CmosDiagnosticSts = IoRead8(0x71) & (BIT6 + BIT7); + + if( Buffer8 & 4 || CmosDiagnosticSts ) { + return TRUE; + } + return FALSE; } #if SB_STALL_PPI_SUPPORT 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 diff --git a/EDK/MiniSetup/BootOnly/postmgmtext.c b/EDK/MiniSetup/BootOnly/postmgmtext.c index 530be2a..1daeb48 100644 --- a/EDK/MiniSetup/BootOnly/postmgmtext.c +++ b/EDK/MiniSetup/BootOnly/postmgmtext.c @@ -554,7 +554,8 @@ UINT32 CheckSystemPassword(UINT32 EmptyPasswordType, UINTN *NoOfRetries, UINTN * (!(PasswordInstalled & AMI_PASSWORD_USER ))&& (EmptyPasswordType & AMI_PASSWORD_USER) ) - PasswordCheck = AMI_PASSWORD_USER; + //PasswordCheck = AMI_PASSWORD_USER; + PasswordCheck = AMI_PASSWORD_NONE; if( (!(PasswordInstalled & AMI_PASSWORD_ADMIN ))&& (EmptyPasswordType & AMI_PASSWORD_ADMIN) diff --git a/EDK/MiniSetup/TseLite/callback.c b/EDK/MiniSetup/TseLite/callback.c index 1bd6f91..572ac4c 100644 --- a/EDK/MiniSetup/TseLite/callback.c +++ b/EDK/MiniSetup/TseLite/callback.c @@ -607,7 +607,7 @@ VOID _LoadDefaults( NVRAM_VARIABLE *defaults, UINTN data ) ( controlInfo->ControlVariable == VARIABLE_ID_LEGACY_GROUP_INFO) || ( controlInfo->ControlVariable == VARIABLE_ID_ADD_DRIVER_OPTION) || //EIP70421 & 70422 Support for driver order (controlInfo->ControlVariable == VARIABLE_ID_DEL_DRIVER_OPTION) || - ( (TSEDonotLoadPasswordOnDefaults()) && (controlInfo->ControlVariable == VARIABLE_ID_AMITSESETUP) ) ) //EIP 93881 & 93873 : Save pwd to nvram and not loading empty pwd on loading defaults. + ( (TSEDonotLoadPasswordOnDefaults()) && (controlInfo->ControlVariable == VARIABLE_ID_AMITSESETUP && (controlInfo->ControlType == CONTROL_TYPE_PASSWORD) ) ) ) //EIP 93881 & 93873 : Save pwd to nvram and not loading empty pwd on loading defaults. continue; else if( ((defaults[controlInfo->ControlVariable].Buffer != NULL) && (defaults[controlInfo->ControlVariable].Size)) &&((VARIABLE_ID_BOOT_ORDER == controlInfo->ControlVariable) || (VARIABLE_ID_DRIVER_ORDER == controlInfo->ControlVariable)) diff --git a/SharkBayDT.veb b/SharkBayDT.veb index 648abc8..3845b63 100644 --- a/SharkBayDT.veb +++ b/SharkBayDT.veb @@ -799,9 +799,7 @@ "Core\EM\AMIDebugRx\binaries\LIBS\DbgrUsbCableSelectLib.cif"= "SS: Alaska;$/Alaska/BIN/Modules/AMIDebugRx\binaries/LIBS;4.6.2_AMIDebugRx_2.04.0074" "Core\EM\AMIDebugRx\binaries\LIBS\DbgrX64Lib\DbgrX64Lib.cif"= "SS: Alaska;$/Alaska/BIN/Modules/AMIDebugRx\binaries/LIBS/DbgrX64Lib;4.6.2_AMIDebugRx_2.04.0074" "Core\EM\AMIDebugRx\binaries\LIBS\DebuggerLib\DebuggerLib.cif"= "SS: Alaska;$/Alaska/BIN/Modules/AMIDebugRx\binaries/LIBS/DebuggerLib;4.6.2_AMIDebugRx_2.04.0074" -"FixedBootOrder.cif"= "SS: ALASKA;$/Alaska/BIN/Modules/Template/FixedBootOrder Demo;4.6.5.1_FixedBootOrder_17" -"Board\EM\FixedBootOrder\DefaultFixedBootOrder\DefaultFixedBootOrder.cif"= "SS: ALASKA;$/Alaska/BIN/Modules/Template/FixedBootOrder Demo\Board/em/FixedBootOrder;4.6.5.1_FixedBootOrder_17" -"Board\EM\FixedBootOrder\FixedBootOrderStyle\FixedBootOrderStyle.cif"= "SS: ALASKA;$/Alaska/BIN/Modules/Template/FixedBootOrder Demo\Board/em/FixedBootOrder;4.6.5.1_FixedBootOrder_17" + "Board\Board.cif"= "SS: Alaska;$/Alaska/BIN/Board;4.6.5.4_Board_31" "Board\em\Setup\Setup.cif"= "SS: Alaska;$/Alaska/BIN/Board\Setup;4.6.5.4_Board_31" "Include\Protocol\AmiSetupProtocol.cif"= "SS: ALASKA;$/Alaska/BIN/Board\Setup;4.6.5.4_Board_31" -- cgit v1.2.3