From 81df95e8aebffeae11a0ae6b7099e402da1c08c3 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 19 May 2014 20:29:01 +0100 Subject: [PATCH] [efi] Make EFI_HII_DATABASE_PROTOCOL optional Some UEFI systems (observed with a Mac Pro) do not provide EFI_HII_DATABASE_PROTOCOL. We can continue to function without providing access to network device settings via HII, so make this protocol optional and fall back to simply not providing any HII protocols. Reported-by: Matt Woodward Tested-by: Matt Woodward Signed-off-by: Michael Brown --- src/interface/efi/efi_snp_hii.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/interface/efi/efi_snp_hii.c b/src/interface/efi/efi_snp_hii.c index c272527c..797a6d83 100644 --- a/src/interface/efi/efi_snp_hii.c +++ b/src/interface/efi/efi_snp_hii.c @@ -75,7 +75,7 @@ static EFI_GUID efi_hii_ibm_ucm_compliant_formset_guid /** EFI HII database protocol */ static EFI_HII_DATABASE_PROTOCOL *efihii; -EFI_REQUIRE_PROTOCOL ( EFI_HII_DATABASE_PROTOCOL, &efihii ); +EFI_REQUEST_PROTOCOL ( EFI_HII_DATABASE_PROTOCOL, &efihii ); /** * Identify settings to be exposed via HII @@ -649,6 +649,10 @@ int efi_snp_hii_install ( struct efi_snp_device *snpdev ) { int efirc; int rc; + /* Do nothing if HII database protocol is not supported */ + if ( ! efihii ) + return 0; + /* Initialise HII protocol */ memcpy ( &snpdev->hii, &efi_snp_device_hii, sizeof ( snpdev->hii ) ); @@ -705,6 +709,11 @@ int efi_snp_hii_install ( struct efi_snp_device *snpdev ) { void efi_snp_hii_uninstall ( struct efi_snp_device *snpdev ) { EFI_BOOT_SERVICES *bs = efi_systab->BootServices; + /* Do nothing if HII database protocol is not supported */ + if ( ! efihii ) + return; + + /* Uninstall protocols and remove package list */ bs->UninstallMultipleProtocolInterfaces ( snpdev->handle, &efi_hii_config_access_protocol_guid, &snpdev->hii,