From: srs5694 Date: Fri, 9 May 2014 00:33:35 +0000 (-0400) Subject: BIOS-mode boot support now works when compiled with GNU-EFI X-Git-Url: https://code.delx.au/refind/commitdiff_plain/11fa7da805c3e263f8b05339f1900baa73a2ffd4 BIOS-mode boot support now works when compiled with GNU-EFI --- diff --git a/EfiLib/BdsHelper.c b/EfiLib/BdsHelper.c index 40f4483..b595858 100644 --- a/EfiLib/BdsHelper.c +++ b/EfiLib/BdsHelper.c @@ -8,6 +8,7 @@ #include "BdsHelper.h" #include "legacy.h" #include "../refind/screen.h" +#include "refit_call_wrapper.h" EFI_GUID gEfiLegacyBootProtocolGuid = { 0xdb9a1e3d, 0x45cb, 0x4abb, { 0x85, 0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d }}; @@ -38,13 +39,13 @@ VOID UpdateBbsTable (BDS_COMMON_OPTION *Option) { BBS_BBS_DEVICE_PATH *OptionBBS; CHAR16 Desc[100]; - Status = gBS->LocateProtocol (&gEfiLegacyBootProtocolGuid, NULL, (VOID **) &LegacyBios); + Status = refit_call3_wrapper(gBS->LocateProtocol, &gEfiLegacyBootProtocolGuid, NULL, (VOID **) &LegacyBios); if (EFI_ERROR (Status) || (Option == NULL)) { return; } OptionBBS = (BBS_BBS_DEVICE_PATH *) Option->DevicePath; - Status = LegacyBios->GetBbsInfo (LegacyBios, &HddCount, &HddInfo, &BbsCount, &LocalBbsTable); + Status = refit_call5_wrapper(LegacyBios->GetBbsInfo, LegacyBios, &HddCount, &HddInfo, &BbsCount, &LocalBbsTable); // Print (L"\n"); // Print (L" NO Prio bb/dd/ff cl/sc Type Stat segm:offs\n"); @@ -108,13 +109,13 @@ BdsLibDoLegacyBoot ( EFI_STATUS Status; EFI_LEGACY_BIOS_PROTOCOL *LegacyBios; - Status = gBS->LocateProtocol (&gEfiLegacyBootProtocolGuid, NULL, (VOID **) &LegacyBios); + Status = refit_call3_wrapper(gBS->LocateProtocol, &gEfiLegacyBootProtocolGuid, NULL, (VOID **) &LegacyBios); if (EFI_ERROR (Status)) { return EFI_UNSUPPORTED; } UpdateBbsTable(Option); - return LegacyBios->LegacyBoot(LegacyBios, (BBS_BBS_DEVICE_PATH *) Option->DevicePath, + return refit_call4_wrapper(LegacyBios->LegacyBoot, LegacyBios, (BBS_BBS_DEVICE_PATH *) Option->DevicePath, Option->LoadOptionsSize, Option->LoadOptions); } diff --git a/EfiLib/BdsHelper.h b/EfiLib/BdsHelper.h index 2324032..b8395af 100644 --- a/EfiLib/BdsHelper.h +++ b/EfiLib/BdsHelper.h @@ -4,7 +4,12 @@ * */ +#ifdef __MAKEWITH_TIANO #include "../include/tiano_includes.h" +#else +#include "gnuefi-helper.h" +#include "GenericBdsLib.h" +#endif #ifndef _BDS_HELPER_H_ #define _BDS_HELPER_H_ diff --git a/EfiLib/BdsTianoCore.c b/EfiLib/BdsTianoCore.c index 2163b99..7c7d214 100644 --- a/EfiLib/BdsTianoCore.c +++ b/EfiLib/BdsTianoCore.c @@ -12,7 +12,139 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ +#ifdef __MAKEWITH_TIANO #include "../include/tiano_includes.h" +#else +#include "BdsHelper.h" +#include "gnuefi-helper.h" +#endif +#include "refit_call_wrapper.h" + +EFI_GUID EfiDevicePathProtocolGuid = { 0x09576E91, 0x6D3F, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }}; + +/** + This function will create all handles associate with every device + path node. If the handle associate with one device path node can not + be created success, then still give one chance to do the dispatch, + which load the missing drivers if possible. + + @param DevicePathToConnect The device path which will be connected, it can be + a multi-instance device path + + @retval EFI_SUCCESS All handles associate with every device path node + have been created + @retval EFI_OUT_OF_RESOURCES There is no resource to create new handles + @retval EFI_NOT_FOUND Create the handle associate with one device path + node failed + +**/ +EFI_STATUS +BdsLibConnectDevicePath ( + IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect + ) +{ + EFI_STATUS Status; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + EFI_DEVICE_PATH_PROTOCOL *CopyOfDevicePath; + EFI_DEVICE_PATH_PROTOCOL *Instance; + EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath; + EFI_DEVICE_PATH_PROTOCOL *Next; + EFI_HANDLE Handle; + EFI_HANDLE PreviousHandle; + UINTN Size; + + if (DevicePathToConnect == NULL) { + return EFI_SUCCESS; + } + + DevicePath = DuplicateDevicePath (DevicePathToConnect); + if (DevicePath == NULL) { + return EFI_OUT_OF_RESOURCES; + } + CopyOfDevicePath = DevicePath; + + do { + // + // The outer loop handles multi instance device paths. + // Only console variables contain multiple instance device paths. + // + // After this call DevicePath points to the next Instance + // + Instance = GetNextDevicePathInstance (&DevicePath, &Size); + if (Instance == NULL) { + FreePool (CopyOfDevicePath); + return EFI_OUT_OF_RESOURCES; + } + + Next = Instance; + while (!IsDevicePathEndType (Next)) { + Next = NextDevicePathNode (Next); + } + + SetDevicePathEndNode (Next); + + // + // Start the real work of connect with RemainingDevicePath + // + PreviousHandle = NULL; + do { + // + // Find the handle that best matches the Device Path. If it is only a + // partial match the remaining part of the device path is returned in + // RemainingDevicePath. + // + RemainingDevicePath = Instance; + Status = refit_call3_wrapper(gBS->LocateDevicePath, &EfiDevicePathProtocolGuid, &RemainingDevicePath, &Handle); + + if (!EFI_ERROR (Status)) { +#ifdef __MAKEWITH_TIANO + if (Handle == PreviousHandle) { + // + // If no forward progress is made try invoking the Dispatcher. + // A new FV may have been added to the system an new drivers + // may now be found. + // Status == EFI_SUCCESS means a driver was dispatched + // Status == EFI_NOT_FOUND means no new drivers were dispatched + // + Status = gDS->Dispatch (); + } +#endif + + if (!EFI_ERROR (Status)) { + PreviousHandle = Handle; + // + // Connect all drivers that apply to Handle and RemainingDevicePath, + // the Recursive flag is FALSE so only one level will be expanded. + // + // Do not check the connect status here, if the connect controller fail, + // then still give the chance to do dispatch, because partial + // RemainingDevicepath may be in the new FV + // + // 1. If the connect fail, RemainingDevicepath and handle will not + // change, so next time will do the dispatch, then dispatch's status + // will take effect + // 2. If the connect success, the RemainingDevicepath and handle will + // change, then avoid the dispatch, we have chance to continue the + // next connection + // + refit_call4_wrapper(gBS->ConnectController, Handle, NULL, RemainingDevicePath, FALSE); + } + } + // + // Loop until RemainingDevicePath is an empty device path + // + } while (!EFI_ERROR (Status) && !IsDevicePathEnd (RemainingDevicePath)); + + } while (DevicePath != NULL); + + if (CopyOfDevicePath != NULL) { + FreePool (CopyOfDevicePath); + } + // + // All handle with DevicePath exists in the handle database + // + return Status; +} /** Build the boot#### or driver#### option from the VariableName, the @@ -28,7 +160,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ BDS_COMMON_OPTION * -EFIAPI BdsLibVariableToOption ( IN OUT LIST_ENTRY *BdsCommonOptionList, IN CHAR16 *VariableName @@ -160,7 +291,6 @@ BdsLibVariableToOption ( **/ VOID * -EFIAPI BdsLibGetVariableAndSize ( IN CHAR16 *Name, IN EFI_GUID *VendorGuid, @@ -177,7 +307,7 @@ BdsLibGetVariableAndSize ( // Pass in a zero size buffer to find the required buffer size. // BufferSize = 0; - Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer); + Status = refit_call5_wrapper(gRT->GetVariable, Name, VendorGuid, NULL, &BufferSize, Buffer); if (Status == EFI_BUFFER_TOO_SMALL) { // // Allocate the buffer to return @@ -189,7 +319,7 @@ BdsLibGetVariableAndSize ( // // Read variable into the allocated buffer. // - Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer); + Status = refit_call5_wrapper(gRT->GetVariable, Name, VendorGuid, NULL, &BufferSize, Buffer); if (EFI_ERROR (Status)) { BufferSize = 0; } diff --git a/EfiLib/BmLib.c b/EfiLib/BmLib.c index a8b4dc5..4feddd5 100644 --- a/EfiLib/BmLib.c +++ b/EfiLib/BmLib.c @@ -12,7 +12,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ +#ifdef __MAKEWITH_TIANO #include "Platform.h" +#else +#include "gnuefi-helper.h" +#endif +#include "refit_call_wrapper.h" + /** Find the first instance of this Protocol @@ -35,7 +41,7 @@ EfiLibLocateProtocol ( { EFI_STATUS Status; - Status = gBS->LocateProtocol ( + Status = refit_call3_wrapper(gBS->LocateProtocol, ProtocolGuid, NULL, (VOID **) Interface @@ -66,7 +72,7 @@ EfiLibOpenRoot ( // // File the file system interface to the device // - Status = gBS->HandleProtocol ( + Status = refit_call3_wrapper(gBS->HandleProtocol, DeviceHandle, &gEfiSimpleFileSystemProtocolGuid, (VOID **) &Volume @@ -87,36 +93,6 @@ EfiLibOpenRoot ( return EFI_ERROR (Status) ? NULL : File; } -/** - - Function gets the file system information from an open file descriptor, - and stores it in a buffer allocated from pool. - - - @param FHand The file handle. - - @return A pointer to a buffer with file information. - @retval NULL is returned if failed to get Volume Label Info. - -**/ -EFI_FILE_SYSTEM_VOLUME_LABEL * -EfiLibFileSystemVolumeLabelInfo ( - IN EFI_FILE_HANDLE FHand - ) -{ - EFI_STATUS Status; - EFI_FILE_SYSTEM_VOLUME_LABEL *VolumeInfo = NULL; - UINTN Size = 0; - - Status = FHand->GetInfo (FHand, &gEfiFileSystemVolumeLabelInfoIdGuid, &Size, VolumeInfo); - if (Status == EFI_BUFFER_TOO_SMALL) { - VolumeInfo = AllocateZeroPool (Size); - Status = FHand->GetInfo (FHand, &gEfiFileSystemVolumeLabelInfoIdGuid, &Size, VolumeInfo); - } - - return EFI_ERROR(Status)?NULL:VolumeInfo; -} - /** Duplicate a string. @@ -136,13 +112,13 @@ EfiStrDuplicate ( Size = StrSize (Src); //at least 2bytes Dest = AllocateZeroPool (Size); -// ASSERT (Dest != NULL); if (Dest != NULL) { CopyMem (Dest, Src, Size); } return Dest; } + //Compare strings case insensitive INTN EFIAPI @@ -159,7 +135,6 @@ StriCmp ( return *FirstString - *SecondString; } - /** Function gets the file information from an open file descriptor, and stores it @@ -196,41 +171,14 @@ EfiLibFileSystemInfo ( EFI_STATUS Status; EFI_FILE_SYSTEM_INFO *FileSystemInfo = NULL; UINTN Size = 0; - + Status = FHand->GetInfo (FHand, &gEfiFileSystemInfoGuid, &Size, FileSystemInfo); if (Status == EFI_BUFFER_TOO_SMALL) { FileSystemInfo = AllocateZeroPool (Size); Status = FHand->GetInfo (FHand, &gEfiFileSystemInfoGuid, &Size, FileSystemInfo); } - - return EFI_ERROR(Status)?NULL:FileSystemInfo; -} - -/** - Function is used to determine the number of device path instances - that exist in a device path. - - - @param DevicePath A pointer to a device path data structure. - - @return This function counts and returns the number of device path instances - in DevicePath. - -**/ -UINTN -EfiDevicePathInstanceCount ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath - ) -{ - UINTN Count; - UINTN Size; - - Count = 0; - while (GetNextDevicePathInstance (&DevicePath, &Size) != NULL) { - Count += 1; - } - return Count; + return EFI_ERROR(Status)?NULL:FileSystemInfo; } /** @@ -269,57 +217,3 @@ EfiReallocatePool ( return NewPool; } - -/** - Compare two EFI_TIME data. - - - @param FirstTime - A pointer to the first EFI_TIME data. - @param SecondTime - A pointer to the second EFI_TIME data. - - @retval TRUE The FirstTime is not later than the SecondTime. - @retval FALSE The FirstTime is later than the SecondTime. - -**/ -BOOLEAN -TimeCompare ( - IN EFI_TIME *FirstTime, - IN EFI_TIME *SecondTime - ) -{ - if (FirstTime->Year != SecondTime->Year) { - return (BOOLEAN) (FirstTime->Year < SecondTime->Year); - } else if (FirstTime->Month != SecondTime->Month) { - return (BOOLEAN) (FirstTime->Month < SecondTime->Month); - } else if (FirstTime->Day != SecondTime->Day) { - return (BOOLEAN) (FirstTime->Day < SecondTime->Day); - } else if (FirstTime->Hour != SecondTime->Hour) { - return (BOOLEAN) (FirstTime->Hour < SecondTime->Hour); - } else if (FirstTime->Minute != SecondTime->Minute) { - return (BOOLEAN) (FirstTime->Minute < FirstTime->Minute); - } else if (FirstTime->Second != SecondTime->Second) { - return (BOOLEAN) (FirstTime->Second < SecondTime->Second); - } - - return (BOOLEAN) (FirstTime->Nanosecond <= SecondTime->Nanosecond); -} - -/** - Get a string from the Data Hub record based on - a device path. - - @param DevPath The device Path. - - @return A string located from the Data Hub records based on - the device path. - @retval NULL If failed to get the String from Data Hub. - -**/ -/* -UINT16 * -EfiLibStrFromDatahub ( - IN EFI_DEVICE_PATH_PROTOCOL *DevPath - ) -{ - return NULL; -}*/ diff --git a/EfiLib/GenericBdsLib.h b/EfiLib/GenericBdsLib.h index b4c9225..d4958c4 100644 --- a/EfiLib/GenericBdsLib.h +++ b/EfiLib/GenericBdsLib.h @@ -18,7 +18,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #ifndef _GENERIC_BDS_LIB_H_ #define _GENERIC_BDS_LIB_H_ -#include +#ifdef __MAKEWITH_GNUEFI +#include "gnuefi-helper.h" +#endif + +//#include /// /// Constants which are variable names used to access variables. @@ -70,7 +74,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // // This data structure is the part of BDS_CONNECT_ENTRY // +#ifdef __MAKEWITH_TIANO #define BDS_LOAD_OPTION_SIGNATURE SIGNATURE_32 ('B', 'd', 'C', 'O') +#else +#define BDS_LOAD_OPTION_SIGNATURE EFI_SIGNATURE_32 ('B', 'd', 'C', 'O') +#endif typedef struct { @@ -290,7 +298,6 @@ BdsLibBuildOptionFromVar ( **/ VOID * -EFIAPI BdsLibGetVariableAndSize ( IN CHAR16 *Name, IN EFI_GUID *VendorGuid, @@ -309,12 +316,12 @@ BdsLibGetVariableAndSize ( @retval EFI_STATUS Return the status of the ConOut->OutputString (). **/ -EFI_STATUS -EFIAPI -BdsLibOutputStrings ( - IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut, - ... - ); +// EFI_STATUS +// EFIAPI +// BdsLibOutputStrings ( +// IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut, +// ... +// ); /** Build the boot#### or driver#### option from the VariableName. The @@ -330,60 +337,11 @@ BdsLibOutputStrings ( **/ BDS_COMMON_OPTION * -EFIAPI BdsLibVariableToOption ( IN OUT LIST_ENTRY *BdsCommonOptionList, IN CHAR16 *VariableName ); -/** - This function registers the new boot#### or driver#### option based on - the VariableName. The new registered boot#### or driver#### will be linked - to BdsOptionList and also update to the VariableName. After the boot#### or - driver#### updated, the BootOrder or DriverOrder will also be updated. - - @param BdsOptionList The header of the boot#### or driver#### link list. - @param DevicePath The device path that the boot#### or driver#### - option present. - @param String The description of the boot#### or driver####. - @param VariableName Indicate if the boot#### or driver#### option. - - @retval EFI_SUCCESS The boot#### or driver#### have been successfully - registered. - @retval EFI_STATUS Return the status of gRS->SetVariable (). - -**/ -EFI_STATUS -EFIAPI -BdsLibRegisterNewOption ( - IN LIST_ENTRY *BdsOptionList, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, - IN CHAR16 *String, - IN CHAR16 *VariableName - ); - -// -// Bds connect and disconnect driver lib funcions -// -/** - This function connects all system drivers with the corresponding controllers. - -**/ -VOID -EFIAPI -BdsLibConnectAllDriversToAllControllers ( - VOID - ); - -/** - This function connects all system drivers to controllers. - -**/ -VOID -EFIAPI -BdsLibConnectAll ( - VOID - ); /** This function creates all handles associated with the given device @@ -400,55 +358,10 @@ BdsLibConnectAll ( **/ EFI_STATUS -EFIAPI BdsLibConnectDevicePath ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect ); -/** - This function will connect all current system handles recursively. - gBS->ConnectController() service is invoked for each handle exist in system handler buffer. - If the handle is bus type handler, all childrens also will be connected recursively by gBS->ConnectController(). - - @retval EFI_SUCCESS All handles and child handles have been - connected. - @retval EFI_STATUS Return the status of gBS->LocateHandleBuffer(). -**/ -EFI_STATUS -EFIAPI -BdsLibConnectAllEfi ( - VOID - ); - -/** - This function will disconnect all current system handles. - gBS->DisconnectController() is invoked for each handle exists in system handle buffer. - If handle is a bus type handle, all childrens also are disconnected recursively by gBS->DisconnectController(). - - @retval EFI_SUCCESS All handles have been disconnected. - @retval EFI_STATUS Error status returned by of gBS->LocateHandleBuffer(). - -**/ -EFI_STATUS -EFIAPI -BdsLibDisconnectAllEfi ( - VOID - ); - -// -// Bds console related lib functions -// -/** - This function will search every simpletxt device in the current system, - and make every simpletxt device a potential console device. - -**/ -VOID -EFIAPI -BdsLibConnectAllConsoles ( - VOID - ); - /** This function will connect console device based on the console @@ -568,6 +481,7 @@ DevicePathToStr ( IN EFI_DEVICE_PATH_PROTOCOL *DevPath ); +#ifdef __MAKEWITH_TIANO // // Internal definitions // @@ -576,6 +490,7 @@ typedef struct { UINTN Len; UINTN Maxlen; } POOL_PRINT; +#endif typedef VOID @@ -627,7 +542,6 @@ typedef struct { **/ EFI_STATUS -EFIAPI BdsDeleteAllInvalidLegacyBootOptions ( VOID ); @@ -642,7 +556,6 @@ BdsDeleteAllInvalidLegacyBootOptions ( @return Other value LegacyBoot options are not added. **/ EFI_STATUS -EFIAPI BdsAddNonExistingLegacyBootOptions ( VOID ); @@ -691,7 +604,6 @@ BdsRefreshBbsTableForBoot ( @retval EFI_NOT_FOUND The Boot Option Variable was not found. **/ EFI_STATUS -EFIAPI BdsDeleteBootOption ( IN UINTN OptionNumber, IN OUT UINT16 *BootOrder, @@ -964,11 +876,11 @@ BdsLibSaveMemoryTypeInformation ( @retval EFI_ACCESS_DENIED The user was not successfully identified. **/ -EFI_STATUS -EFIAPI -BdsLibUserIdentify ( - OUT EFI_USER_PROFILE_HANDLE *User - ); +// EFI_STATUS +// EFIAPI +// BdsLibUserIdentify ( +// OUT EFI_USER_PROFILE_HANDLE *User +// ); /** This function checks if a Fv file device path is valid, according to a file GUID. If it is invalid, diff --git a/EfiLib/Make.tiano b/EfiLib/Make.tiano index 5c44d75..03b2e0d 100644 --- a/EfiLib/Make.tiano +++ b/EfiLib/Make.tiano @@ -5,7 +5,7 @@ include ../Make.tiano -SOURCE_NAMES = legacy BdsConnect BmLib Console DevicePath BdsHelper BdsTianoCore +SOURCE_NAMES = legacy BmLib DevicePath BdsHelper BdsTianoCore OBJS = $(SOURCE_NAMES:=.obj) #DRIVERNAME = ext2 #BUILDME = $(DRIVERNAME)_$(FILENAME_CODE).efi diff --git a/EfiLib/Makefile b/EfiLib/Makefile index 8487805..ad63f0e 100644 --- a/EfiLib/Makefile +++ b/EfiLib/Makefile @@ -2,5 +2,18 @@ # EfiLib/Makefile # +SRCDIR = . + +VPATH = $(SRCDIR) + +LOCAL_CPPFLAGS = -I$(SRCDIR) -I$(SRCDIR)/../include + +OBJS = gnuefi-helper.o legacy.o BdsHelper.o BdsTianoCore.o +TARGET = libEfiLib.a + +all: $(TARGET) + +include $(SRCDIR)/../Make.common + clean: - rm -f *.o *.obj *~ *.lib + rm -f *.o *.obj *~ *.lib *.a diff --git a/EfiLib/legacy.c b/EfiLib/legacy.c index 4578da0..5824297 100644 --- a/EfiLib/legacy.c +++ b/EfiLib/legacy.c @@ -15,8 +15,20 @@ * */ -#include "../include/tiano_includes.h" +#ifdef __MAKEWITH_GNUEFI +#include "efi.h" +#include "efilib.h" +#include "gnuefi-helper.h" +#define EFI_DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH +#define EfiReallocatePool ReallocatePool +#define EfiLibLocateProtocol LibLocateProtocol +#else +#include "tiano_includes.h" +#endif #include "legacy.h" +#include "GenericBdsLib.h" +#include "../refind/global.h" +#include "../include/refit_call_wrapper.h" BOOT_OPTION_BBS_MAPPING *mBootOptionBbsMapping = NULL; UINTN mBootOptionBbsMappingCount = 0; @@ -244,7 +256,7 @@ BdsFindLegacyBootOptionByDevTypeAndName ( ) { UINTN Index; - CHAR16 BootOption[9]; + CHAR16 BootOption[10]; UINTN BootOptionSize; UINT8 *BootOptionVar; BBS_TABLE *BbsEntry; @@ -268,7 +280,7 @@ BdsFindLegacyBootOptionByDevTypeAndName ( &BootOptionSize ); if (NULL == BootOptionVar) { - continue; + continue; } // @@ -448,7 +460,7 @@ BdsCreateLegacyBootOption ( Ptr += sizeof (BBS_TABLE); *((UINT16 *) Ptr) = (UINT16) Index; - Status = gRT->SetVariable ( + Status = refit_call5_wrapper(gRT->SetVariable, BootString, &gEfiGlobalVariableGuid, VAR_FLAG, @@ -646,7 +658,7 @@ EfiLibGetVariable ( @param VarName A Null-terminated Unicode string that is the name of the vendor's variable. - + @param VarGuid A unique identifier for the vendor. @retval EFI_SUCCESS The variable was found and removed @@ -671,7 +683,7 @@ EfiLibDeleteVariable ( // // Delete variable from Storage // - Status = gRT->SetVariable (VarName, VarGuid, VAR_FLAG, 0, NULL); + Status = refit_call5_wrapper(gRT->SetVariable, VarName, VarGuid, VAR_FLAG, 0, NULL); ASSERT (!EFI_ERROR (Status)); FreePool (VarBuf); } @@ -689,7 +701,6 @@ EfiLibDeleteVariable ( @return Other value LegacyBoot options are not added. **/ EFI_STATUS -EFIAPI BdsAddNonExistingLegacyBootOptions ( VOID ) @@ -726,7 +737,7 @@ BdsAddNonExistingLegacyBootOptions ( mBootOptionBbsMappingCount = 0; } - LegacyBios->GetBbsInfo ( + refit_call5_wrapper(LegacyBios->GetBbsInfo, LegacyBios, &HddCount, &LocalHddInfo, @@ -783,10 +794,10 @@ BdsAddNonExistingLegacyBootOptions ( // // Save the BbsIndex // - mBootOptionBbsMapping = ReallocatePool ( + mBootOptionBbsMapping = EfiReallocatePool ( + mBootOptionBbsMapping, mBootOptionBbsMappingCount * sizeof (BOOT_OPTION_BBS_MAPPING), - (mBootOptionBbsMappingCount + 1) * sizeof (BOOT_OPTION_BBS_MAPPING), - mBootOptionBbsMapping + (mBootOptionBbsMappingCount + 1) * sizeof (BOOT_OPTION_BBS_MAPPING) ); ASSERT (mBootOptionBbsMapping != NULL); mBootOptionBbsMapping[mBootOptionBbsMappingCount].BootOptionNumber = OptionNumber; @@ -804,7 +815,7 @@ BdsAddNonExistingLegacyBootOptions ( ); if (BootOrderSize > 0) { - Status = gRT->SetVariable ( + Status = refit_call5_wrapper(gRT->SetVariable, L"BootOrder", &gEfiGlobalVariableGuid, VAR_FLAG, @@ -835,7 +846,6 @@ BdsAddNonExistingLegacyBootOptions ( @retval EFI_NOT_FOUND The Boot Option Variable was not found **/ EFI_STATUS -EFIAPI BdsDeleteBootOption ( IN UINTN OptionNumber, IN OUT UINT16 *BootOrder, @@ -885,7 +895,6 @@ BdsDeleteBootOption ( @retval EFI_NOT_FOUND Fail to retrive variable of boot order. **/ EFI_STATUS -EFIAPI BdsDeleteAllInvalidLegacyBootOptions ( VOID ) @@ -921,7 +930,7 @@ BdsDeleteAllInvalidLegacyBootOptions ( return Status; } - LegacyBios->GetBbsInfo ( + refit_call5_wrapper(LegacyBios->GetBbsInfo, LegacyBios, &HddCount, &LocalHddInfo, @@ -948,7 +957,7 @@ BdsDeleteAllInvalidLegacyBootOptions ( ); if (NULL == BootOptionVar) { BootOptionSize = 0; - Status = gRT->GetVariable ( + Status = refit_call5_wrapper(gRT->GetVariable, BootOption, &gEfiGlobalVariableGuid, NULL, @@ -1024,7 +1033,7 @@ BdsDeleteAllInvalidLegacyBootOptions ( // Adjust the number of boot options. // if (BootOrderSize != 0) { - Status = gRT->SetVariable ( + Status = refit_call5_wrapper(gRT->SetVariable, L"BootOrder", &gEfiGlobalVariableGuid, VAR_FLAG, @@ -1078,130 +1087,3 @@ BdsFillDevOrderBuf ( return Buf; } - -/** - Create the device order buffer. - - @param BbsTable The BBS table. - @param BbsCount The BBS Count. - - @retval EFI_SUCCES The buffer is created and the EFI variable named - VAR_LEGACY_DEV_ORDER and gEfiLegacyDevOrderVariableGuid is - set correctly. - @retval EFI_OUT_OF_RESOURCES Memmory or storage is not enough. - @retval EFI_DEVICE_ERROR Fail to add the device order into EFI variable fail - because of hardware error. -**/ -EFI_STATUS -BdsCreateDevOrder ( - IN BBS_TABLE *BbsTable, - IN UINT16 BbsCount - ) -{ - UINTN Index; - UINTN FDCount; - UINTN HDCount; - UINTN CDCount; - UINTN NETCount; - UINTN BEVCount; - UINTN TotalSize; - UINTN HeaderSize; - LEGACY_DEV_ORDER_ENTRY *DevOrder; - LEGACY_DEV_ORDER_ENTRY *DevOrderPtr; - EFI_STATUS Status; - - FDCount = 0; - HDCount = 0; - CDCount = 0; - NETCount = 0; - BEVCount = 0; - TotalSize = 0; - HeaderSize = sizeof (BBS_TYPE) + sizeof (UINT16); - DevOrder = NULL; - Status = EFI_SUCCESS; - - // - // Count all boot devices - // - for (Index = 0; Index < BbsCount; Index++) { - if (BbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) { - continue; - } - - switch (BbsTable[Index].DeviceType) { - case BBS_FLOPPY: - FDCount++; - break; - - case BBS_HARDDISK: - HDCount++; - break; - - case BBS_CDROM: - CDCount++; - break; - - case BBS_EMBED_NETWORK: - NETCount++; - break; - - case BBS_BEV_DEVICE: - BEVCount++; - break; - - default: - break; - } - } - - TotalSize += (HeaderSize + sizeof (UINT16) * FDCount); - TotalSize += (HeaderSize + sizeof (UINT16) * HDCount); - TotalSize += (HeaderSize + sizeof (UINT16) * CDCount); - TotalSize += (HeaderSize + sizeof (UINT16) * NETCount); - TotalSize += (HeaderSize + sizeof (UINT16) * BEVCount); - - // - // Create buffer to hold all boot device order - // - DevOrder = AllocateZeroPool (TotalSize); - if (NULL == DevOrder) { - return EFI_OUT_OF_RESOURCES; - } - DevOrderPtr = DevOrder; - - DevOrderPtr->BbsType = BBS_FLOPPY; - DevOrderPtr->Length = (UINT16) (sizeof (DevOrderPtr->Length) + FDCount * sizeof (UINT16)); - DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *) BdsFillDevOrderBuf (BbsTable, BBS_FLOPPY, BbsCount, DevOrderPtr->Data); - - DevOrderPtr->BbsType = BBS_HARDDISK; - DevOrderPtr->Length = (UINT16) (sizeof (UINT16) + HDCount * sizeof (UINT16)); - DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *) BdsFillDevOrderBuf (BbsTable, BBS_HARDDISK, BbsCount, DevOrderPtr->Data); - - DevOrderPtr->BbsType = BBS_CDROM; - DevOrderPtr->Length = (UINT16) (sizeof (UINT16) + CDCount * sizeof (UINT16)); - DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *) BdsFillDevOrderBuf (BbsTable, BBS_CDROM, BbsCount, DevOrderPtr->Data); - - DevOrderPtr->BbsType = BBS_EMBED_NETWORK; - DevOrderPtr->Length = (UINT16) (sizeof (UINT16) + NETCount * sizeof (UINT16)); - DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *) BdsFillDevOrderBuf (BbsTable, BBS_EMBED_NETWORK, BbsCount, DevOrderPtr->Data); - - DevOrderPtr->BbsType = BBS_BEV_DEVICE; - DevOrderPtr->Length = (UINT16) (sizeof (UINT16) + BEVCount * sizeof (UINT16)); - DevOrderPtr = (LEGACY_DEV_ORDER_ENTRY *) BdsFillDevOrderBuf (BbsTable, BBS_BEV_DEVICE, BbsCount, DevOrderPtr->Data); - - ASSERT (TotalSize == (UINTN) ((UINT8 *) DevOrderPtr - (UINT8 *) DevOrder)); - - // - // Save device order for legacy boot device to variable. - // - Status = gRT->SetVariable ( - VAR_LEGACY_DEV_ORDER, - &gEfiLegacyDevOrderVariableGuid, - VAR_FLAG, - TotalSize, - DevOrder - ); - FreePool (DevOrder); - - return Status; -} diff --git a/EfiLib/legacy.h b/EfiLib/legacy.h index 0c6ca06..3384f48 100644 --- a/EfiLib/legacy.h +++ b/EfiLib/legacy.h @@ -15,6 +15,8 @@ * */ +#include "LegacyBios.h" + #ifndef __LEGACY_H_ #define __LEGACY_H_ @@ -49,7 +51,6 @@ typedef struct { #pragma pack() EFI_STATUS -EFIAPI BdsAddNonExistingLegacyBootOptions ( VOID ); @@ -62,7 +63,6 @@ BdsAddNonExistingLegacyBootOptions ( @retval EFI_NOT_FOUND Fail to retrive variable of boot order. **/ EFI_STATUS -EFIAPI BdsDeleteAllInvalidLegacyBootOptions ( VOID ); diff --git a/Make.tiano b/Make.tiano index 5ed907b..5bfb158 100644 --- a/Make.tiano +++ b/Make.tiano @@ -44,6 +44,7 @@ INCLUDE_DIRS = -I $(EDK2BASE)/MdePkg \ -I .. \ -I ../refind \ -I ../libeg \ + -I ../include \ -I ../mok OPTIMFLAGS = -fno-strict-aliasing -mno-red-zone -Wno-address -Os diff --git a/Makefile b/Makefile index a84ca25..c2616e8 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ all: tiano gnuefi: +make -C $(LIBEG_DIR) +make -C $(MOK_DIR) + +make -C $(EFILIB_DIR) +make -C $(LOADER_DIR) +make -C $(GPTSYNC_DIR) gnuefi # +make -C $(FS_DIR) all_gnuefi diff --git a/NEWS.txt b/NEWS.txt index cb27b89..53c8398 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,3 +1,18 @@ +0.8.1 (5/??/2014): +------------------ + +- Reversed order of search for icons by extension: rEFInd now searches + for PNG files before ICNS files, rather than the other way around. This + makes it possible to override a volume icon for rEFInd by giving it the + name .VolumeIcon.png, even when a .VolumeIcon.icns file exists on the + volume and is used by OS X. + +- Fixed bug that caused .VolumeIcon.icns to take higher-than-intended + precedence in icon setting for OS X. + +- Chainloading to BIOS-mode boot loaders now works on UEFI-based PCs when + rEFInd is built with GNU-EFI, not just when built with Tianocore. + 0.8.0 (5/4/2014): ----------------- diff --git a/gptsync/os_efi.c b/gptsync/os_efi.c index e40037f..fa48733 100644 --- a/gptsync/os_efi.c +++ b/gptsync/os_efi.c @@ -149,8 +149,6 @@ UINTN input_boolean(CHARN *prompt, BOOLEAN *bool_out) #ifdef __MAKEWITH_TIANO -extern EFI_DXE_SERVICES *gDS; - // EFI_GUID gEfiDxeServicesTableGuid = { 0x05AD34BA, 0x6F02, 0x4214, { 0x95, 0x2E, 0x4D, 0xA0, 0x39, 0x8E, 0x2B, 0xB9 }}; // Minimal initialization function @@ -160,7 +158,6 @@ static VOID InitializeLib(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *System gBS = SystemTable->BootServices; // gRS = SystemTable->RuntimeServices; gRT = SystemTable->RuntimeServices; // Some BDS functions need gRT to be set -// EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &gDS); // InitializeConsoleSim(); } diff --git a/include/Handle.h b/include/Handle.h index 50dff48..9d3a082 100644 --- a/include/Handle.h +++ b/include/Handle.h @@ -43,36 +43,6 @@ EfiLibFileSystemInfo ( IN EFI_FILE_HANDLE FHand ); -/*EFI_FILE_SYSTEM_VOLUME_LABEL_INFO * -LibFileSystemVolumeLabelInfo ( - IN EFI_FILE_HANDLE FHand - ); - -EFI_STATUS -LibScanHandleDatabase ( - EFI_HANDLE DriverBindingHandle, OPTIONAL - UINT32 *DriverBindingHandleIndex, OPTIONAL - EFI_HANDLE ControllerHandle, OPTIONAL - UINT32 *ControllerHandleIndex, OPTIONAL - UINTN *HandleCount, - EFI_HANDLE **HandleBuffer, - UINT32 **HandleType - ); - -EFI_STATUS -LibGetManagingDriverBindingHandles ( - EFI_HANDLE ControllerHandle, - UINTN *DriverBindingHandleCount, - EFI_HANDLE **DriverBindingHandleBuffer - ); - -EFI_STATUS -LibGetParentControllerHandles ( - EFI_HANDLE ControllerHandle, - UINTN *ParentControllerHandleCount, - EFI_HANDLE **ParentControllerHandleBuffer - ); -*/ EFI_STATUS LibGetManagedChildControllerHandles ( EFI_HANDLE DriverBindingHandle, diff --git a/include/tiano_includes.h b/include/tiano_includes.h index 86b7b6d..6785138 100644 --- a/include/tiano_includes.h +++ b/include/tiano_includes.h @@ -143,10 +143,6 @@ INTN EFIAPI StriCmp ( extern EFI_FILE_INFO * EfiLibFileInfo (IN EFI_FILE_HANDLE FHand); extern EFI_FILE_SYSTEM_INFO * EfiLibFileSystemInfo (IN EFI_FILE_HANDLE Root); -extern UINTN -EfiDevicePathInstanceCount ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath -); extern VOID * EfiReallocatePool ( @@ -155,12 +151,6 @@ EfiReallocatePool ( IN UINTN NewSize ); -extern BOOLEAN -TimeCompare ( - IN EFI_TIME *FirstTime, - IN EFI_TIME *SecondTime -); - #define PoolPrint(...) CatSPrint(NULL, __VA_ARGS__) #endif \ No newline at end of file diff --git a/libeg/libeg.h b/libeg/libeg.h index e94f1eb..5f55422 100644 --- a/libeg/libeg.h +++ b/libeg/libeg.h @@ -71,7 +71,7 @@ typedef struct { #define EG_EICOMPMODE_RLE (1) #define EG_EICOMPMODE_EFICOMPRESS (2) -#define ICON_EXTENSIONS L"icns,png" +#define ICON_EXTENSIONS L"png,icns" typedef struct { UINTN Width; diff --git a/libeg/screen.c b/libeg/screen.c index c6f2303..9fa999b 100644 --- a/libeg/screen.c +++ b/libeg/screen.c @@ -47,6 +47,7 @@ #include "../refind/lib.h" #include "../include/refit_call_wrapper.h" #include "libeg.h" +#include "Handle.h" #include #include diff --git a/refind/Makefile b/refind/Makefile index ba39980..b03dfef 100644 --- a/refind/Makefile +++ b/refind/Makefile @@ -22,8 +22,8 @@ ifeq ($(ARCH),x86_64) endif LOCAL_CPPFLAGS = -I$(SRCDIR) -I$(SRCDIR)/../include -I$(SRCDIR)/../libeg -I$(SRCDIR)/../mok -LOCAL_LDFLAGS = -L$(SRCDIR)/../libeg/ -L$(SRCDIR)/../mok/ -LOCAL_LIBS = -leg -lmok +LOCAL_LDFLAGS = -L$(SRCDIR)/../libeg/ -L$(SRCDIR)/../mok/ -L$(SRCDIR)/../EfiLib/ +LOCAL_LIBS = -leg -lmok -lEfiLib OBJS = main.o config.o menu.o screen.o icns.o gpt.o crc32.o lib.o driver_support.o #OBJS = main.o config.o menu.o screen.o icns.o lib.o mok.o driver_support.o variables.o sha256.o pecoff.o simple_file.o security_policy.o guid.o diff --git a/refind/global.h b/refind/global.h index 7395192..f857553 100644 --- a/refind/global.h +++ b/refind/global.h @@ -50,8 +50,8 @@ #include #else #include "../include/tiano_includes.h" -#include "../EfiLib/GenericBdsLib.h" #endif +#include "../EfiLib/GenericBdsLib.h" #include "libeg.h" @@ -236,9 +236,9 @@ typedef struct { typedef struct { REFIT_MENU_ENTRY me; REFIT_VOLUME *Volume; -#ifndef __MAKEWITH_GNUEFI +//#ifndef __MAKEWITH_GNUEFI BDS_COMMON_OPTION *BdsOption; -#endif +//#endif CHAR16 *LoadOptions; BOOLEAN Enabled; } LEGACY_ENTRY; diff --git a/refind/main.c b/refind/main.c index 5df0aeb..7ea5571 100644 --- a/refind/main.c +++ b/refind/main.c @@ -60,13 +60,15 @@ #ifndef EFI_SECURITY_VIOLATION #define EFI_SECURITY_VIOLATION EFIERR (26) #endif -#else +#endif +//#else #include "../EfiLib/BdsHelper.h" #include "../EfiLib/legacy.h" -#endif // __MAKEWITH_GNUEFI #ifndef EFI_OS_INDICATIONS_BOOT_TO_FW_UI #define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001ULL +#else +#define LibLocateHandle gBS->LocateHandleBuffer #endif // @@ -164,7 +166,7 @@ static VOID AboutrEFInd(VOID) if (AboutMenu.EntryCount == 0) { AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT); - AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.8.0"); + AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.8.0.3"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer"); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2014 Roderick W. Smith"); @@ -907,10 +909,12 @@ VOID SetLoaderDefaults(LOADER_ENTRY *Entry, CHAR16 *LoaderPath, REFIT_VOLUME *Vo // locate a custom icon for the loader // Anything found here takes precedence over the "hints" in the OSIconName variable - if (!Entry->me.Image) + if (!Entry->me.Image) { Entry->me.Image = egLoadIconAnyType(Volume->RootDir, PathOnly, NoExtension, GlobalConfig.IconSizes[ICON_SIZE_BIG]); - if (!Entry->me.Image) + } + if (!Entry->me.Image) { Entry->me.Image = egCopyImage(Volume->VolIconImage); + } // Begin creating icon "hints" by using last part of directory path leading // to the loader @@ -960,9 +964,6 @@ VOID SetLoaderDefaults(LOADER_ENTRY *Entry, CHAR16 *LoaderPath, REFIT_VOLUME *Vo Entry->OSType = 'R'; ShortcutLetter = 'R'; } else if (StriCmp(LoaderPath, MACOSX_LOADER_PATH) == 0) { - if (Volume->VolIconImage != NULL) { // custom icon file found - Entry->me.Image = Volume->VolIconImage; - } MergeStrings(&OSIconName, L"mac", L','); Entry->OSType = 'M'; ShortcutLetter = 'M'; @@ -1650,7 +1651,6 @@ static VOID StartLegacy(IN LEGACY_ENTRY *Entry) } /* static VOID StartLegacy() */ // Start a device on a non-Mac using the EFI_LEGACY_BIOS_PROTOCOL -#ifdef __MAKEWITH_TIANO static VOID StartLegacyUEFI(LEGACY_ENTRY *Entry) { BeginExternalScreen(TRUE, L"Booting Legacy OS (UEFI mode)"); @@ -1663,7 +1663,6 @@ static VOID StartLegacyUEFI(LEGACY_ENTRY *Entry) PauseForKey(); FinishExternalScreen(); } // static VOID StartLegacyUEFI() -#endif // __MAKEWITH_TIANO static LEGACY_ENTRY * AddLegacyEntry(IN CHAR16 *LoaderTitle, IN REFIT_VOLUME *Volume) { @@ -1734,9 +1733,9 @@ static LEGACY_ENTRY * AddLegacyEntry(IN CHAR16 *LoaderTitle, IN REFIT_VOLUME *Vo } /* static LEGACY_ENTRY * AddLegacyEntry() */ -#ifdef __MAKEWITH_GNUEFI -static VOID ScanLegacyUEFI(IN UINTN DiskType){} -#else +// #ifdef __MAKEWITH_GNUEFI +// static VOID ScanLegacyUEFI(IN UINTN DiskType){} +// #else // default volume badge icon based on disk kind static EG_IMAGE * GetDiskBadge(IN UINTN DiskType) { EG_IMAGE * Badge = NULL; @@ -1833,9 +1832,9 @@ static VOID ScanLegacyUEFI(IN UINTN DiskType) // If LegacyBios protocol is not implemented on this platform, then //we do not support this type of legacy boot on this machine. - Status = gBS->LocateProtocol(&gEfiLegacyBootProtocolGuid, NULL, (VOID **) &LegacyBios); + Status = refit_call3_wrapper(gBS->LocateProtocol, &gEfiLegacyBootProtocolGuid, NULL, (VOID **) &LegacyBios); if (EFI_ERROR (Status)) - return; + return; // EFI calls USB drives BBS_HARDDRIVE, but we want to distinguish them, // so we set DiskType inappropriately elsewhere in the program and @@ -1883,7 +1882,7 @@ static VOID ScanLegacyUEFI(IN UINTN DiskType) Index++; } // while } /* static VOID ScanLegacyUEFI() */ -#endif // __MAKEWITH_GNUEFI +//#endif // __MAKEWITH_GNUEFI static VOID ScanLegacyVolume(REFIT_VOLUME *Volume, UINTN VolumeIndex) { UINTN VolumeIndex2; @@ -2039,7 +2038,6 @@ static UINTN ScanDriverDir(IN CHAR16 *Path) return (NumFound); } -#ifdef __MAKEWITH_GNUEFI static EFI_STATUS ConnectAllDriversToAllControllers(VOID) { EFI_STATUS Status; @@ -2107,12 +2105,6 @@ Done: MyFreePool (AllHandleBuffer); return Status; } /* EFI_STATUS ConnectAllDriversToAllControllers() */ -#else -static EFI_STATUS ConnectAllDriversToAllControllers(VOID) { - BdsLibConnectAllDriversToAllControllers(); - return 0; -} -#endif // Load all EFI drivers from rEFInd's "drivers" subdirectory and from the // directories specified by the user in the "scan_driver_dirs" configuration @@ -2151,20 +2143,16 @@ static VOID LoadDrivers(VOID) // Determine what (if any) type of legacy (BIOS) boot support is available static VOID FindLegacyBootType(VOID) { -#ifdef __MAKEWITH_TIANO EFI_STATUS Status; EFI_LEGACY_BIOS_PROTOCOL *LegacyBios; -#endif GlobalConfig.LegacyType = LEGACY_TYPE_NONE; // UEFI-style legacy BIOS support is available only with the TianoCore EDK2 // build environment, and then only with some EFI implementations.... -#ifdef __MAKEWITH_TIANO - Status = gBS->LocateProtocol (&gEfiLegacyBootProtocolGuid, NULL, (VOID **) &LegacyBios); + Status = refit_call3_wrapper(gBS->LocateProtocol, &gEfiLegacyBootProtocolGuid, NULL, (VOID **) &LegacyBios); if (!EFI_ERROR (Status)) GlobalConfig.LegacyType = LEGACY_TYPE_UEFI; -#endif // Macs have their own system. If the firmware vendor code contains the // string "Apple", assume it's available. Note that this overrides the @@ -2189,16 +2177,8 @@ static VOID WarnIfLegacyProblems() { } while ((i < NUM_SCAN_OPTIONS) && (!found)); if (found) { Print(L"NOTE: refind.conf's 'scanfor' line specifies scanning for one or more legacy\n"); - Print(L"(BIOS) boot options; however, this is not possible because "); -#ifdef __MAKEWITH_TIANO - Print(L"your computer lacks\n"); + Print(L"(BIOS) boot options; however, this is not possible because your computer lacks\n"); Print(L"the necessary Compatibility Support Module (CSM) support.\n"); -#else - Print(L"this program was\n"); - Print(L"compiled without the necessary support. Please visit\n"); - Print(L"http://www.rodsbooks.com/refind/getting.html and download and install a rEFInd\n"); - Print(L"binary built with the TianoCore EDK2 to enable legacy boot support.\n"); -#endif PauseForKey(); } // if (found) } // if no legacy support @@ -2207,7 +2187,6 @@ static VOID WarnIfLegacyProblems() { // Locates boot loaders. NOTE: This assumes that GlobalConfig.LegacyType is set correctly. static VOID ScanForBootloaders(VOID) { UINTN i; -#ifdef __MAKEWITH_TIANO CHAR8 s; BOOLEAN ScanForLegacy = FALSE; @@ -2223,7 +2202,6 @@ static VOID ScanForBootloaders(VOID) { BdsDeleteAllInvalidLegacyBootOptions(); BdsAddNonExistingLegacyBootOptions(); } // if -#endif // scan for loaders and tools, add them to the menu for (i = 0; i < NUM_SCAN_OPTIONS; i++) { @@ -2445,7 +2423,7 @@ static VOID InitializeLib(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *System gRT = SystemTable->RuntimeServices; // Some BDS functions need gRT to be set EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &gDS); - InitializeConsoleSim(); +// InitializeConsoleSim(); } #endif @@ -2611,11 +2589,9 @@ efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) StartLegacy((LEGACY_ENTRY *)ChosenEntry); break; -#ifdef __MAKEWITH_TIANO case TAG_LEGACY_UEFI: // Boot a legacy OS on a non-Mac StartLegacyUEFI((LEGACY_ENTRY *)ChosenEntry); break; -#endif case TAG_TOOL: // Start a EFI tool StartTool((LOADER_ENTRY *)ChosenEntry);