]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Disambiguate errors returned by ConnectController
authorMichael Brown <mcb30@ipxe.org>
Sat, 14 Mar 2020 09:49:49 +0000 (09:49 +0000)
committerMichael Brown <mcb30@ipxe.org>
Sat, 14 Mar 2020 09:49:49 +0000 (09:49 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/efi/efi_driver.c

index 7be2e585d6edb54da69b3b673ae332576f1c5a77..f6038e56b66c04fb7695454971e03ffb77fa645a 100644 (file)
@@ -39,6 +39,20 @@ FILE_LICENCE ( GPL2_OR_LATER );
  *
  */
 
+/* Disambiguate the various error causes */
+#define EINFO_EEFI_CONNECT                                             \
+       __einfo_uniqify ( EINFO_EPLATFORM, 0x01,                        \
+                         "Could not connect controllers" )
+#define EINFO_EEFI_CONNECT_PROHIBITED                                  \
+       __einfo_platformify ( EINFO_EEFI_CONNECT,                       \
+                             EFI_SECURITY_VIOLATION,                   \
+                             "Connecting controllers prohibited by "   \
+                             "security policy" )
+#define EEFI_CONNECT_PROHIBITED                                                \
+       __einfo_error ( EINFO_EEFI_CONNECT_PROHIBITED )
+#define EEFI_CONNECT( efirc ) EPLATFORM ( EINFO_EEFI_CONNECT, efirc,   \
+                                         EEFI_CONNECT_PROHIBITED )
+
 static EFI_DRIVER_BINDING_PROTOCOL efi_driver_binding;
 
 /** List of controlled EFI devices */
@@ -457,7 +471,7 @@ static int efi_driver_connect ( EFI_HANDLE device ) {
               efi_handle_name ( device ) );
        if ( ( efirc = bs->ConnectController ( device, drivers, NULL,
                                               FALSE ) ) != 0 ) {
-               rc = -EEFI ( efirc );
+               rc = -EEFI_CONNECT ( efirc );
                DBGC ( device, "EFIDRV %s could not connect new drivers: "
                       "%s\n", efi_handle_name ( device ), strerror ( rc ) );
                return rc;