mirror of https://github.com/ipxe/ipxe.git
[efi] Use efi_handle_name() instead of efi_handle_devpath_text()
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/20/merge
parent
736fcf60d1
commit
2e0821b9ed
|
@ -49,7 +49,7 @@ static int snp_supported ( EFI_HANDLE device ) {
|
|||
/* Check that this is not a device we are providing ourselves */
|
||||
if ( find_snpdev ( device ) != NULL ) {
|
||||
DBGCP ( device, "SNP %p %s is provided by this binary\n",
|
||||
device, efi_handle_devpath_text ( device ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
return -ENOTTY;
|
||||
}
|
||||
|
||||
|
@ -59,11 +59,11 @@ static int snp_supported ( EFI_HANDLE device ) {
|
|||
NULL, efi_image_handle, device,
|
||||
EFI_OPEN_PROTOCOL_TEST_PROTOCOL))!=0){
|
||||
DBGCP ( device, "SNP %p %s is not an SNP device\n",
|
||||
device, efi_handle_devpath_text ( device ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
return -EEFI ( efirc );
|
||||
}
|
||||
DBGC ( device, "SNP %p %s is an SNP device\n",
|
||||
device, efi_handle_devpath_text ( device ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ static int snponly_supported ( EFI_HANDLE device ) {
|
|||
return -ENOTTY;
|
||||
|
||||
DBGC ( device, "SNP %p %s is the SNP chainloading device\n",
|
||||
device, efi_handle_devpath_text ( device ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -150,7 +150,6 @@ extern EFI_SYSTEM_TABLE *efi_systab;
|
|||
|
||||
extern const char * efi_guid_ntoa ( EFI_GUID *guid );
|
||||
extern const char * efi_devpath_text ( EFI_DEVICE_PATH_PROTOCOL *path );
|
||||
extern const char * efi_handle_devpath_text ( EFI_HANDLE handle );
|
||||
extern const char * efi_handle_name ( EFI_HANDLE handle );
|
||||
|
||||
extern void dbg_efi_openers ( EFI_HANDLE handle, EFI_GUID *protocol );
|
||||
|
|
|
@ -175,7 +175,7 @@ static int efi_bofm_supported ( EFI_HANDLE device ) {
|
|||
/* Look for a BOFM driver */
|
||||
if ( ( rc = bofm_find_driver ( &pci ) ) != 0 ) {
|
||||
DBGCP ( device, "EFIBOFM %p %s has no driver\n",
|
||||
device, efi_handle_devpath_text ( device ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ static int efi_bofm_supported ( EFI_HANDLE device ) {
|
|||
&bofm1.interface ) ) != 0 ) {
|
||||
rc = -EEFI ( efirc );
|
||||
DBGC ( device, "EFIBOFM %p %s cannot find BOFM protocol\n",
|
||||
device, efi_handle_devpath_text ( device ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -195,13 +195,12 @@ static int efi_bofm_supported ( EFI_HANDLE device ) {
|
|||
0x02 /* Version */ ))!=0){
|
||||
rc = -EEFI ( efirc );
|
||||
DBGC ( device, "EFIBOFM %p %s could not register support: %s\n",
|
||||
device, efi_handle_devpath_text ( device ),
|
||||
strerror ( rc ) );
|
||||
device, efi_handle_name ( device ), strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
DBGC ( device, "EFIBOFM %p %s has driver \"%s\"\n",
|
||||
device, efi_handle_devpath_text ( device ), pci.id->name );
|
||||
device, efi_handle_name ( device ), pci.id->name );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -550,37 +550,3 @@ const char * efi_handle_name ( EFI_HANDLE handle ) {
|
|||
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get textual representation of device path for a handle
|
||||
*
|
||||
* @v handle EFI handle
|
||||
* @ret text Textual representation of device path, or NULL
|
||||
*/
|
||||
const char * efi_handle_devpath_text ( EFI_HANDLE handle ) {
|
||||
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
|
||||
union {
|
||||
EFI_DEVICE_PATH_PROTOCOL *path;
|
||||
void *interface;
|
||||
} path;
|
||||
const char *text;
|
||||
EFI_STATUS efirc;
|
||||
|
||||
/* Obtain device path, if any */
|
||||
if ( ( efirc = bs->OpenProtocol ( handle,
|
||||
&efi_device_path_protocol_guid,
|
||||
&path.interface, efi_image_handle,
|
||||
handle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL ))!=0){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Format device path */
|
||||
text = efi_devpath_text ( path.path );
|
||||
|
||||
/* Close device path */
|
||||
bs->CloseProtocol ( handle, &efi_device_path_protocol_guid,
|
||||
efi_image_handle, handle );
|
||||
|
||||
return text;
|
||||
}
|
||||
|
|
|
@ -134,16 +134,15 @@ int efidev_child_add ( struct efi_device *efidev, EFI_HANDLE device ) {
|
|||
) ) != 0 ) {
|
||||
rc = -EEFI ( efirc );
|
||||
DBGC ( efidev->device, "EFIDRV %p %s could not add child",
|
||||
efidev->device, efi_devpath_text ( efidev->path ) );
|
||||
efidev->device, efi_handle_name ( efidev->device ) );
|
||||
DBGC ( efidev->device, " %p %s: %s\n", device,
|
||||
efi_handle_devpath_text ( device ), strerror ( rc ) );
|
||||
efi_handle_name ( device ), strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
DBGC2 ( efidev->device, "EFIDRV %p %s added child",
|
||||
efidev->device, efi_devpath_text ( efidev->path ) );
|
||||
DBGC2 ( efidev->device, " %p %s\n",
|
||||
device, efi_handle_devpath_text ( device ) );
|
||||
efidev->device, efi_handle_name ( efidev->device ) );
|
||||
DBGC2 ( efidev->device, " %p %s\n", device, efi_handle_name ( device ));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -161,9 +160,9 @@ void efidev_child_del ( struct efi_device *efidev, EFI_HANDLE device ) {
|
|||
&efi_device_path_protocol_guid,
|
||||
efi_image_handle, device );
|
||||
DBGC2 ( efidev->device, "EFIDRV %p %s removed child",
|
||||
efidev->device, efi_devpath_text ( efidev->path ) );
|
||||
efidev->device, efi_handle_name ( efidev->device ) );
|
||||
DBGC2 ( efidev->device, " %p %s\n",
|
||||
device, efi_handle_devpath_text ( device ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -181,7 +180,7 @@ efi_driver_supported ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
|
|||
int rc;
|
||||
|
||||
DBGCP ( device, "EFIDRV %p %s DRIVER_SUPPORTED",
|
||||
device, efi_handle_devpath_text ( device ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
if ( child )
|
||||
DBGCP ( device, " (child %s)", efi_devpath_text ( child ) );
|
||||
DBGCP ( device, "\n" );
|
||||
|
@ -189,7 +188,7 @@ efi_driver_supported ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
|
|||
/* Do nothing if we are already driving this device */
|
||||
if ( efidev_find ( device ) != NULL ) {
|
||||
DBGCP ( device, "EFIDRV %p %s is already started\n",
|
||||
device, efi_handle_devpath_text ( device ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
|
||||
|
@ -197,13 +196,13 @@ efi_driver_supported ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
|
|||
for_each_table_entry ( efidrv, EFI_DRIVERS ) {
|
||||
if ( ( rc = efidrv->supported ( device ) ) == 0 ) {
|
||||
DBGC ( device, "EFIDRV %p %s has driver \"%s\"\n",
|
||||
device, efi_handle_devpath_text ( device ),
|
||||
device, efi_handle_name ( device ),
|
||||
efidrv->name );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
DBGCP ( device, "EFIDRV %p %s has no driver\n",
|
||||
device, efi_handle_devpath_text ( device ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
@ -230,7 +229,7 @@ efi_driver_start ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
|
|||
int rc;
|
||||
|
||||
DBGC ( device, "EFIDRV %p %s DRIVER_START",
|
||||
device, efi_handle_devpath_text ( device ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
if ( child )
|
||||
DBGC ( device, " (child %s)", efi_devpath_text ( child ) );
|
||||
DBGC ( device, "\n" );
|
||||
|
@ -239,7 +238,7 @@ efi_driver_start ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
|
|||
efidev = efidev_find ( device );
|
||||
if ( efidev ) {
|
||||
DBGCP ( device, "EFIDRV %p %s is already started\n",
|
||||
device, efi_devpath_text ( efidev->path ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
efirc = EFI_ALREADY_STARTED;
|
||||
goto err_already_started;
|
||||
}
|
||||
|
@ -263,7 +262,7 @@ efi_driver_start ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
|
|||
EFI_OPEN_PROTOCOL_BY_DRIVER ) ) != 0){
|
||||
rc = -EEFI ( efirc );
|
||||
DBGC ( device, "EFIDRV %p %s could not open device path: %s\n",
|
||||
device, efi_handle_devpath_text ( device ),
|
||||
device, efi_handle_name ( device ),
|
||||
strerror ( rc ) );
|
||||
goto err_no_device_path;
|
||||
}
|
||||
|
@ -273,20 +272,20 @@ efi_driver_start ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
|
|||
for_each_table_entry ( efidrv, EFI_DRIVERS ) {
|
||||
if ( ( rc = efidrv->supported ( device ) ) != 0 ) {
|
||||
DBGC ( device, "EFIDEV %p %s is not supported by "
|
||||
"driver \"%s\": %s\n",
|
||||
device, efi_devpath_text ( efidev->path ),
|
||||
efidrv->name, strerror ( rc ) );
|
||||
"driver \"%s\": %s\n", device,
|
||||
efi_handle_name ( device ), efidrv->name,
|
||||
strerror ( rc ) );
|
||||
continue;
|
||||
}
|
||||
if ( ( rc = efidrv->start ( efidev ) ) == 0 ) {
|
||||
efidev->driver = efidrv;
|
||||
DBGC ( device, "EFIDRV %p %s using driver \"%s\"\n",
|
||||
device, efi_devpath_text ( efidev->path ),
|
||||
device, efi_handle_name ( device ),
|
||||
efidev->driver->name );
|
||||
return 0;
|
||||
}
|
||||
DBGC ( device, "EFIDRV %p %s could not start driver \"%s\": "
|
||||
"%s\n", device, efi_devpath_text ( efidev->path ),
|
||||
"%s\n", device, efi_handle_name ( device ),
|
||||
efidrv->name, strerror ( rc ) );
|
||||
}
|
||||
efirc = EFI_UNSUPPORTED;
|
||||
|
@ -321,10 +320,10 @@ efi_driver_stop ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
|
|||
UINTN i;
|
||||
|
||||
DBGC ( device, "EFIDRV %p %s DRIVER_STOP",
|
||||
device, efi_handle_devpath_text ( device ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
for ( i = 0 ; i < num_children ; i++ ) {
|
||||
DBGC ( device, "%s%p %s", ( i ? ", " : " child " ),
|
||||
children[i], efi_handle_devpath_text ( children[i] ) );
|
||||
children[i], efi_handle_name ( children[i] ) );
|
||||
}
|
||||
DBGC ( device, "\n" );
|
||||
|
||||
|
@ -332,7 +331,7 @@ efi_driver_stop ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
|
|||
efidev = efidev_find ( device );
|
||||
if ( ! efidev ) {
|
||||
DBGCP ( device, "EFIDRV %p %s is not started\n",
|
||||
device, efi_devpath_text ( efidev->path ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -488,17 +487,17 @@ static int efi_driver_connect ( EFI_HANDLE device ) {
|
|||
|
||||
/* Disconnect any existing drivers */
|
||||
DBGC ( device, "EFIDRV %p %s disconnecting existing drivers\n",
|
||||
device, efi_handle_devpath_text ( device ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
bs->DisconnectController ( device, NULL, NULL );
|
||||
|
||||
/* Connect our driver */
|
||||
DBGC ( device, "EFIDRV %p %s connecting new drivers\n",
|
||||
device, efi_handle_devpath_text ( device ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
if ( ( efirc = bs->ConnectController ( device, drivers, NULL,
|
||||
FALSE ) ) != 0 ) {
|
||||
rc = -EEFI ( efirc );
|
||||
DBGC ( device, "EFIDRV %p %s could not connect new drivers: "
|
||||
"%s\n", device, efi_handle_devpath_text ( device ),
|
||||
"%s\n", device, efi_handle_name ( device ),
|
||||
strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -149,8 +149,7 @@ int efipci_open ( EFI_HANDLE device, UINT32 attributes,
|
|||
device, attributes ) ) != 0 ) {
|
||||
rc = -EEFI_PCI ( efirc );
|
||||
DBGCP ( device, "EFIPCI %p %s cannot open PCI protocols: %s\n",
|
||||
device, efi_handle_devpath_text ( device ),
|
||||
strerror ( rc ) );
|
||||
device, efi_handle_name ( device ), strerror ( rc ) );
|
||||
goto err_open_protocol;
|
||||
}
|
||||
|
||||
|
@ -160,14 +159,13 @@ int efipci_open ( EFI_HANDLE device, UINT32 attributes,
|
|||
&pci_fn ) ) != 0 ) {
|
||||
rc = -EEFI ( efirc );
|
||||
DBGC ( device, "EFIPCI %p %s could not get PCI location: %s\n",
|
||||
device, efi_handle_devpath_text ( device ),
|
||||
strerror ( rc ) );
|
||||
device, efi_handle_name ( device ), strerror ( rc ) );
|
||||
goto err_get_location;
|
||||
}
|
||||
DBGC2 ( device, "EFIPCI %p %s is PCI %04lx:%02lx:%02lx.%lx\n",
|
||||
device, efi_handle_devpath_text ( device ),
|
||||
( ( unsigned long ) pci_segment ), ( ( unsigned long ) pci_bus),
|
||||
( ( unsigned long ) pci_dev ), ( ( unsigned long ) pci_fn ) );
|
||||
DBGC2 ( device, "EFIPCI %p %s is PCI %04lx:%02lx:%02lx.%lx\n", device,
|
||||
efi_handle_name ( device ), ( ( unsigned long ) pci_segment ),
|
||||
( ( unsigned long ) pci_bus ), ( ( unsigned long ) pci_dev ),
|
||||
( ( unsigned long ) pci_fn ) );
|
||||
|
||||
/* Try to enable I/O cycles, memory cycles, and bus mastering.
|
||||
* Some platforms will 'helpfully' report errors if these bits
|
||||
|
@ -189,7 +187,7 @@ int efipci_open ( EFI_HANDLE device, UINT32 attributes,
|
|||
pci_init ( pci, PCI_BUSDEVFN ( pci_bus, pci_dev, pci_fn ) );
|
||||
if ( ( rc = pci_read_config ( pci ) ) != 0 ) {
|
||||
DBGC ( device, "EFIPCI %p %s cannot read PCI configuration: "
|
||||
"%s\n", device, efi_handle_devpath_text ( device ),
|
||||
"%s\n", device, efi_handle_name ( device ),
|
||||
strerror ( rc ) );
|
||||
goto err_pci_read_config;
|
||||
}
|
||||
|
@ -261,11 +259,11 @@ static int efipci_supported ( EFI_HANDLE device ) {
|
|||
/* Look for a driver */
|
||||
if ( ( rc = pci_find_driver ( &pci ) ) != 0 ) {
|
||||
DBGCP ( device, "EFIPCI %p %s has no driver\n",
|
||||
device, efi_handle_devpath_text ( device ) );
|
||||
device, efi_handle_name ( device ) );
|
||||
return rc;
|
||||
}
|
||||
DBGC ( device, "EFIPCI %p %s has driver \"%s\"\n",
|
||||
device, efi_handle_devpath_text ( device ), pci.id->name );
|
||||
device, efi_handle_name ( device ), pci.id->name );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ efi_handle_protocol_wrapper ( EFI_HANDLE handle, EFI_GUID *protocol,
|
|||
EFI_STATUS efirc;
|
||||
|
||||
DBGC ( colour, "HandleProtocol ( %p %s, %s, ... ) ", handle,
|
||||
efi_handle_devpath_text ( handle ), efi_guid_ntoa ( protocol ) );
|
||||
efi_handle_name ( handle ), efi_guid_ntoa ( protocol ) );
|
||||
efirc = bs->HandleProtocol ( handle, protocol, interface );
|
||||
DBGC ( colour, "= %s ( %p ) -> %p\n",
|
||||
efi_status ( efirc ), *interface, retaddr );
|
||||
|
@ -153,7 +153,7 @@ efi_locate_device_path_wrapper ( EFI_GUID *protocol,
|
|||
DBGC ( colour, "= %s ( %p, ",
|
||||
efi_status ( efirc ), efi_devpath_text ( *device_path ) );
|
||||
DBGC ( colour, "%p %s ) -> %p\n",
|
||||
*device, efi_handle_devpath_text ( *device ), retaddr );
|
||||
*device, efi_handle_name ( *device ), retaddr );
|
||||
return efirc;
|
||||
}
|
||||
|
||||
|
@ -170,11 +170,11 @@ efi_open_protocol_wrapper ( EFI_HANDLE handle, EFI_GUID *protocol,
|
|||
EFI_STATUS efirc;
|
||||
|
||||
DBGC ( colour, "OpenProtocol ( %p %s, %s, ..., ", handle,
|
||||
efi_handle_devpath_text ( handle ), efi_guid_ntoa ( protocol ) );
|
||||
efi_handle_name ( handle ), efi_guid_ntoa ( protocol ) );
|
||||
DBGC ( colour, "%p %s, ", agent_handle,
|
||||
efi_handle_devpath_text ( agent_handle ) );
|
||||
efi_handle_name ( agent_handle ) );
|
||||
DBGC ( colour, "%p %s, %#x ) ", controller_handle,
|
||||
efi_handle_devpath_text ( controller_handle ), attributes );
|
||||
efi_handle_name ( controller_handle ), attributes );
|
||||
efirc = bs->OpenProtocol ( handle, protocol, interface, agent_handle,
|
||||
controller_handle, attributes );
|
||||
DBGC ( colour, "= %s ( %p ) -> %p\n",
|
||||
|
@ -228,12 +228,12 @@ void efi_wrap ( EFI_HANDLE handle, EFI_LOADED_IMAGE_PROTOCOL *loaded ) {
|
|||
/* Provide system table wrapper to image */
|
||||
loaded->SystemTable = &efi_systab_wrapper;
|
||||
DBGC ( colour, "Wrapped image %p %s at base %p has protocols:\n",
|
||||
handle, efi_handle_devpath_text ( handle ), loaded->ImageBase );
|
||||
handle, efi_handle_name ( handle ), loaded->ImageBase );
|
||||
DBGC_EFI_PROTOCOLS ( colour, handle );
|
||||
DBGC ( colour, "Parent image %p %s\n", loaded->ParentHandle,
|
||||
efi_handle_devpath_text ( loaded->ParentHandle ) );
|
||||
efi_handle_name ( loaded->ParentHandle ) );
|
||||
DBGC ( colour, "Device %p %s ", loaded->DeviceHandle,
|
||||
efi_handle_devpath_text ( loaded->DeviceHandle ) );
|
||||
efi_handle_name ( loaded->DeviceHandle ) );
|
||||
DBGC ( colour, "file %p %s\n", loaded->FilePath,
|
||||
efi_devpath_text ( loaded->FilePath ) );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue