From 6ca3056aca9ce090d2f0f7cbf32cdf2323252abf Mon Sep 17 00:00:00 2001 From: srs5694 Date: Thu, 6 Oct 2016 15:29:29 -0400 Subject: [PATCH 1/1] Changed names in ComponentName.h, included from TianoCore, and matching changes in fsw_efi.c. This is done to work around problems compiling with recent versions of GNU-EFI, which provide SOME of the features of that file. --- Makefile | 2 +- filesystems/edk2/ComponentName.h | 39 +++++++++++++++++++++----------- filesystems/fsw_efi.c | 14 +++++++----- 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 99b14ce..04b0ca7 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ MOK_DIR=mok GPTSYNC_DIR=gptsync EFILIB_DIR=EfiLib export EDK2BASE=/usr/local/UDK2014/MyWorkSpace -export REFIND_VERSION='L"0.10.3.1"' +export REFIND_VERSION='L"0.10.3.2"' # The "all" target builds with the TianoCore library if possible, but falls # back on the more easily-installed GNU-EFI library if TianoCore isn't diff --git a/filesystems/edk2/ComponentName.h b/filesystems/edk2/ComponentName.h index a4c3749..7fcc6f7 100644 --- a/filesystems/edk2/ComponentName.h +++ b/filesystems/edk2/ComponentName.h @@ -14,24 +14,37 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#ifndef __EFI_COMPONENT_NAME_H__ -#define __EFI_COMPONENT_NAME_H__ +/* + * rEFInd NOTE: This file is included only when compiling with GNU-EFI, + * which has not traditionally provided the definitions supplied here. + * Unfortunately, recent (ca. 3.0.4) versions of GNU-EFI have added + * SOME of these functions to an existing header file, creating problems + * when trying to maintain compatibility with multiple GNU-EFI versions. + * I've therefore renamed the relevant defines, types, and functions, + * both here and in fsw_efi.c; and included a define to match the only + * used name (REFIND_EFI_COMPONENT_NAME_PROTOCOL) to the traditional + * name (EFI_COMPONENT_NAME_PROTOCOL) in fsw_efi.c for compiling with + * TianoCore. + */ + +#ifndef __REFIND_EFI_COMPONENT_NAME_H__ +#define __REFIND_EFI_COMPONENT_NAME_H__ /// /// The global ID for the Component Name Protocol. /// -#define EFI_COMPONENT_NAME_PROTOCOL_GUID \ +#define REFIND_EFI_COMPONENT_NAME_PROTOCOL_GUID \ { \ 0x107a772c, 0xd5e1, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ } -typedef struct _EFI_COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME_PROTOCOL; +typedef struct _REFIND_EFI_COMPONENT_NAME_PROTOCOL REFIND_EFI_COMPONENT_NAME_PROTOCOL; /** Retrieves a Unicode string that is the user-readable name of the EFI Driver. - @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance. + @param This A pointer to the REFIND_EFI_COMPONENT_NAME_PROTOCOL instance. @param Language A pointer to a three-character ISO 639-2 language identifier. This is the language of the driver name that that the caller is requesting, and it must match one of the languages specified @@ -52,8 +65,8 @@ typedef struct _EFI_COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME_PROTOCOL; **/ typedef EFI_STATUS -(EFI_FUNCTION EFIAPI *EFI_COMPONENT_NAME_GET_DRIVER_NAME)( - IN EFI_COMPONENT_NAME_PROTOCOL *This, +(EFI_FUNCTION EFIAPI *REFIND_EFI_COMPONENT_NAME_GET_DRIVER_NAME)( + IN REFIND_EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName ); @@ -63,7 +76,7 @@ EFI_STATUS Retrieves a Unicode string that is the user readable name of the controller that is being managed by an EFI Driver. - @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance. + @param This A pointer to the REFIND_EFI_COMPONENT_NAME_PROTOCOL instance. @param ControllerHandle The handle of a controller that the driver specified by This is managing. This handle specifies the controller whose name is to be returned. @@ -101,8 +114,8 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFI_FUNCTION EFIAPI *EFI_COMPONENT_NAME_GET_CONTROLLER_NAME)( - IN EFI_COMPONENT_NAME_PROTOCOL *This, +(EFI_FUNCTION EFIAPI *REFIND_EFI_COMPONENT_NAME_GET_CONTROLLER_NAME)( + IN REFIND_EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, @@ -113,9 +126,9 @@ EFI_STATUS /// This protocol is used to retrieve user readable names of drivers /// and controllers managed by UEFI Drivers. /// -struct _EFI_COMPONENT_NAME_PROTOCOL { - EFI_COMPONENT_NAME_GET_DRIVER_NAME GetDriverName; - EFI_COMPONENT_NAME_GET_CONTROLLER_NAME GetControllerName; +struct _REFIND_EFI_COMPONENT_NAME_PROTOCOL { + REFIND_EFI_COMPONENT_NAME_GET_DRIVER_NAME GetDriverName; + REFIND_EFI_COMPONENT_NAME_GET_CONTROLLER_NAME GetControllerName; /// /// A Null-terminated ASCII string that contains one or more /// ISO 639-2 language codes. This is the list of language codes diff --git a/filesystems/fsw_efi.c b/filesystems/fsw_efi.c index 3ec6494..5ef49be 100644 --- a/filesystems/fsw_efi.c +++ b/filesystems/fsw_efi.c @@ -43,6 +43,8 @@ #ifdef __MAKEWITH_GNUEFI #include "edk2/DriverBinding.h" #include "edk2/ComponentName.h" +#else +#define REFIND_EFI_COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME_PROTOCOL #endif #include "../include/refit_call_wrapper.h" @@ -66,7 +68,7 @@ } EFI_GUID gEfiDriverBindingProtocolGuid = EFI_DRIVER_BINDING_PROTOCOL_GUID; -EFI_GUID gEfiComponentNameProtocolGuid = EFI_COMPONENT_NAME_PROTOCOL_GUID; +EFI_GUID gEfiComponentNameProtocolGuid = REFIND_EFI_COMPONENT_NAME_PROTOCOL_GUID; EFI_GUID gEfiDiskIoProtocolGuid = EFI_DISK_IO_PROTOCOL_GUID; EFI_GUID gEfiBlockIoProtocolGuid = EFI_BLOCK_IO_PROTOCOL_GUID; EFI_GUID gEfiFileInfoGuid = EFI_FILE_INFO_ID; @@ -93,10 +95,10 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Stop(IN EFI_DRIVER_BINDING_PROTOCOL *T IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer); -EFI_STATUS EFIAPI fsw_efi_ComponentName_GetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, +EFI_STATUS EFIAPI fsw_efi_ComponentName_GetDriverName(IN REFIND_EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName); -EFI_STATUS EFIAPI fsw_efi_ComponentName_GetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL *This, +EFI_STATUS EFIAPI fsw_efi_ComponentName_GetControllerName(IN REFIND_EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, @@ -175,7 +177,7 @@ EFI_DRIVER_BINDING_PROTOCOL fsw_efi_DriverBinding_table = { * Interface structure for the EFI Component Name protocol. */ -EFI_COMPONENT_NAME_PROTOCOL fsw_efi_ComponentName_table = { +REFIND_EFI_COMPONENT_NAME_PROTOCOL fsw_efi_ComponentName_table = { fsw_efi_ComponentName_GetDriverName, fsw_efi_ComponentName_GetControllerName, (CHAR8*) "eng" @@ -465,7 +467,7 @@ EFI_STATUS EFIAPI fsw_efi_DriverBinding_Stop(IN EFI_DRIVER_BINDING_PROTOCOL *T * based on the file system type actually used in compilation. */ -EFI_STATUS EFIAPI fsw_efi_ComponentName_GetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, +EFI_STATUS EFIAPI fsw_efi_ComponentName_GetDriverName(IN REFIND_EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName) { @@ -484,7 +486,7 @@ EFI_STATUS EFIAPI fsw_efi_ComponentName_GetDriverName(IN EFI_COMPONENT_NAME_PRO * because this is not a "bus" driver in the sense of the EFI Driver Model. */ -EFI_STATUS EFIAPI fsw_efi_ComponentName_GetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL *This, +EFI_STATUS EFIAPI fsw_efi_ComponentName_GetControllerName(IN REFIND_EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, -- 2.39.2