Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[efi] Remove raw EFI_HANDLE values from debug messages
The raw EFI_HANDLE value is almost never useful to know, and simply
adds noise to the already verbose debug messages.  Improve the
legibility of debug messages by using only the name generated by
efi_handle_name().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Aug 27, 2015
1 parent 0e40737 commit 9501eaf
Show file tree
Hide file tree
Showing 11 changed files with 200 additions and 214 deletions.
4 changes: 2 additions & 2 deletions src/drivers/net/efi/nii.c
Expand Up @@ -1125,8 +1125,8 @@ int nii_start ( struct efi_device *efidev ) {
/* Register network device */
if ( ( rc = register_netdev ( netdev ) ) != 0 )
goto err_register_netdev;
DBGC ( nii, "NII %s registered as %s for %p %s\n", nii->dev.name,
netdev->name, device, efi_handle_name ( device ) );
DBGC ( nii, "NII %s registered as %s for %s\n", nii->dev.name,
netdev->name, efi_handle_name ( device ) );

/* Set initial link state (if media detection is not supported) */
if ( ! nii->media )
Expand Down
24 changes: 12 additions & 12 deletions src/drivers/net/efi/snp.c
Expand Up @@ -48,8 +48,8 @@ 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_name ( device ) );
DBGCP ( device, "SNP %s is provided by this binary\n",
efi_handle_name ( device ) );
return -ENOTTY;
}

Expand All @@ -58,12 +58,12 @@ static int snp_supported ( EFI_HANDLE device ) {
&efi_simple_network_protocol_guid,
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_name ( device ) );
DBGCP ( device, "SNP %s is not an SNP device\n",
efi_handle_name ( device ) );
return -EEFI ( efirc );
}
DBGC ( device, "SNP %p %s is an SNP device\n",
device, efi_handle_name ( device ) );
DBGC ( device, "SNP %s is an SNP device\n",
efi_handle_name ( device ) );

return 0;
}
Expand All @@ -80,8 +80,8 @@ static int nii_supported ( EFI_HANDLE device ) {

/* Check that this is not a device we are providing ourselves */
if ( find_snpdev ( device ) != NULL ) {
DBGCP ( device, "NII %p %s is provided by this binary\n",
device, efi_handle_name ( device ) );
DBGCP ( device, "NII %s is provided by this binary\n",
efi_handle_name ( device ) );
return -ENOTTY;
}

Expand All @@ -90,12 +90,12 @@ static int nii_supported ( EFI_HANDLE device ) {
&efi_nii31_protocol_guid,
NULL, efi_image_handle, device,
EFI_OPEN_PROTOCOL_TEST_PROTOCOL))!=0){
DBGCP ( device, "NII %p %s is not an NII device\n",
device, efi_handle_name ( device ) );
DBGCP ( device, "NII %s is not an NII device\n",
efi_handle_name ( device ) );
return -EEFI ( efirc );
}
DBGC ( device, "NII %p %s is an NII device\n",
device, efi_handle_name ( device ) );
DBGC ( device, "NII %s is an NII device\n",
efi_handle_name ( device ) );

return 0;
}
Expand Down
24 changes: 11 additions & 13 deletions src/drivers/net/efi/snpnet.c
Expand Up @@ -431,8 +431,8 @@ int snpnet_start ( struct efi_device *efidev ) {
( EFI_OPEN_PROTOCOL_BY_DRIVER |
EFI_OPEN_PROTOCOL_EXCLUSIVE )))!=0){
rc = -EEFI ( efirc );
DBGC ( device, "SNP %p %s cannot open SNP protocol: %s\n",
device, efi_handle_name ( device ), strerror ( rc ) );
DBGC ( device, "SNP %s cannot open SNP protocol: %s\n",
efi_handle_name ( device ), strerror ( rc ) );
DBGC_EFI_OPENERS ( device, device,
&efi_simple_network_protocol_guid );
goto err_open_protocol;
Expand Down Expand Up @@ -463,32 +463,30 @@ int snpnet_start ( struct efi_device *efidev ) {
if ( ( mode->State == EfiSimpleNetworkStopped ) &&
( ( efirc = snp->snp->Start ( snp->snp ) ) != 0 ) ) {
rc = -EEFI ( efirc );
DBGC ( device, "SNP %p %s could not start: %s\n", device,
DBGC ( device, "SNP %s could not start: %s\n",
efi_handle_name ( device ), strerror ( rc ) );
goto err_start;
}
if ( ( mode->State == EfiSimpleNetworkInitialized ) &&
( ( efirc = snp->snp->Shutdown ( snp->snp ) ) != 0 ) ) {
rc = -EEFI ( efirc );
DBGC ( device, "SNP %p %s could not shut down: %s\n", device,
DBGC ( device, "SNP %s could not shut down: %s\n",
efi_handle_name ( device ), strerror ( rc ) );
goto err_shutdown;
}

/* Populate network device parameters */
if ( mode->HwAddressSize != netdev->ll_protocol->hw_addr_len ) {
DBGC ( device, "SNP %p %s has invalid hardware address "
"length %d\n", device, efi_handle_name ( device ),
mode->HwAddressSize );
DBGC ( device, "SNP %s has invalid hardware address length "
"%d\n", efi_handle_name ( device ), mode->HwAddressSize);
rc = -ENOTSUP;
goto err_hw_addr_len;
}
memcpy ( netdev->hw_addr, &mode->PermanentAddress,
netdev->ll_protocol->hw_addr_len );
if ( mode->HwAddressSize != netdev->ll_protocol->ll_addr_len ) {
DBGC ( device, "SNP %p %s has invalid link-layer address "
"length %d\n", device, efi_handle_name ( device ),
mode->HwAddressSize );
DBGC ( device, "SNP %s has invalid link-layer address length "
"%d\n", efi_handle_name ( device ), mode->HwAddressSize);
rc = -ENOTSUP;
goto err_ll_addr_len;
}
Expand All @@ -500,8 +498,8 @@ int snpnet_start ( struct efi_device *efidev ) {
/* Register network device */
if ( ( rc = register_netdev ( netdev ) ) != 0 )
goto err_register_netdev;
DBGC ( device, "SNP %p %s registered as %s\n",
device, efi_handle_name ( device ), netdev->name );
DBGC ( device, "SNP %s registered as %s\n",
efi_handle_name ( device ), netdev->name );

/* Set initial link state */
if ( snp->snp->Mode->MediaPresentSupported ) {
Expand Down Expand Up @@ -547,7 +545,7 @@ void snpnet_stop ( struct efi_device *efidev ) {
/* Stop SNP protocol */
if ( ( efirc = snp->snp->Stop ( snp->snp ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( device, "SNP %p %s could not stop: %s\n", device,
DBGC ( device, "SNP %s could not stop: %s\n",
efi_handle_name ( device ), strerror ( rc ) );
/* Nothing we can do about this */
}
Expand Down
32 changes: 16 additions & 16 deletions src/drivers/net/efi/snponly.c
Expand Up @@ -81,26 +81,26 @@ static int chained_locate ( struct chained_protocol *chained ) {
/* Locate handle supporting this protocol */
if ( ( rc = efi_locate_device ( device, chained->protocol,
&parent ) ) != 0 ) {
DBGC ( device, "CHAINED %p %s does not support %s: %s\n",
device, efi_handle_name ( device ),
DBGC ( device, "CHAINED %s does not support %s: %s\n",
efi_handle_name ( device ),
efi_guid_ntoa ( chained->protocol ), strerror ( rc ) );
goto err_locate_device;
}
DBGC ( device, "CHAINED %p %s found %s on ", device,
efi_handle_name ( device ), efi_guid_ntoa ( chained->protocol ));
DBGC ( device, "%p %s\n", parent, efi_handle_name ( parent ) );
DBGC ( device, "CHAINED %s found %s on ", efi_handle_name ( device ),
efi_guid_ntoa ( chained->protocol ) );
DBGC ( device, "%s\n", efi_handle_name ( parent ) );

/* Get protocol instance */
if ( ( efirc = bs->OpenProtocol ( parent, chained->protocol,
&chained->interface, efi_image_handle,
device,
EFI_OPEN_PROTOCOL_GET_PROTOCOL ))!=0){
rc = -EEFI ( efirc );
DBGC ( device, "CHAINED %p %s could not open %s on ",
device, efi_handle_name ( device ),
DBGC ( device, "CHAINED %s could not open %s on ",
efi_handle_name ( device ),
efi_guid_ntoa ( chained->protocol ) );
DBGC ( device, "%p %s: %s\n",
parent, efi_handle_name ( parent ), strerror ( rc ) );
DBGC ( device, "%s: %s\n",
efi_handle_name ( parent ), strerror ( rc ) );
goto err_open_protocol;
}

Expand Down Expand Up @@ -130,25 +130,25 @@ static int chained_supported ( EFI_HANDLE device,
efi_image_handle, device,
EFI_OPEN_PROTOCOL_GET_PROTOCOL ))!=0){
rc = -EEFI ( efirc );
DBGCP ( device, "CHAINED %p %s is not a %s device\n",
device, efi_handle_name ( device ),
DBGCP ( device, "CHAINED %s is not a %s device\n",
efi_handle_name ( device ),
efi_guid_ntoa ( chained->protocol ) );
goto err_open_protocol;
}

/* Test for a match against the chainloading device */
if ( interface != chained->interface ) {
DBGC ( device, "CHAINED %p %s %p is not the chainloaded "
"%s\n", device, efi_handle_name ( device ),
interface, efi_guid_ntoa ( chained->protocol ) );
DBGC ( device, "CHAINED %s %p is not the chainloaded %s\n",
efi_handle_name ( device ), interface,
efi_guid_ntoa ( chained->protocol ) );
rc = -ENOTTY;
goto err_no_match;
}

/* Success */
rc = 0;
DBGC ( device, "CHAINED %p %s %p is the chainloaded %s\n",
device, efi_handle_name ( device ), interface,
DBGC ( device, "CHAINED %s %p is the chainloaded %s\n",
efi_handle_name ( device ), interface,
efi_guid_ntoa ( chained->protocol ) );

err_no_match:
Expand Down
67 changes: 33 additions & 34 deletions src/interface/efi/efi_bofm.c
Expand Up @@ -178,17 +178,17 @@ 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_name ( device ) );
DBGCP ( device, "EFIBOFM %s has no driver\n",
efi_handle_name ( device ) );
return rc;
}

/* Locate BOFM protocol */
if ( ( efirc = bs->LocateProtocol ( &bofm1_protocol_guid, NULL,
&bofm1.interface ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( device, "EFIBOFM %p %s cannot find BOFM protocol\n",
device, efi_handle_name ( device ) );
DBGC ( device, "EFIBOFM %s cannot find BOFM protocol\n",
efi_handle_name ( device ) );
return rc;
}

Expand All @@ -198,13 +198,13 @@ static int efi_bofm_supported ( EFI_HANDLE device ) {
0x00 /* No iSCSI */,
0x02 /* Version */ ))!=0){
rc = -EEFI ( efirc );
DBGC ( device, "EFIBOFM %p %s could not register support: %s\n",
device, efi_handle_name ( device ), strerror ( rc ) );
DBGC ( device, "EFIBOFM %s could not register support: %s\n",
efi_handle_name ( device ), strerror ( rc ) );
return rc;
}

DBGC ( device, "EFIBOFM %p %s has driver \"%s\"\n",
device, efi_handle_name ( device ), pci.id->name );
DBGC ( device, "EFIBOFM %s has driver \"%s\"\n",
efi_handle_name ( device ), pci.id->name );
return 0;
}

Expand Down Expand Up @@ -241,49 +241,48 @@ static int efi_bofm_start ( struct efi_device *efidev ) {
if ( ( efirc = bs->LocateProtocol ( &bofm1_protocol_guid, NULL,
&bofm1.interface ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( device, "EFIBOFM %p %s cannot find BOFM protocol\n",
device, efi_handle_name ( device ) );
DBGC ( device, "EFIBOFM %s cannot find BOFM protocol\n",
efi_handle_name ( device ) );
goto err_locate_bofm;
}
bofmtab = &bofm1.bofm1->BofmTable;
DBGC ( device, "EFIBOFM %p %s found version 1 BOFM table at %p+%04x\n",
device, efi_handle_name ( device ), bofmtab,
bofmtab->Parameters.Length );
DBGC ( device, "EFIBOFM %s found version 1 BOFM table at %p+%04x\n",
efi_handle_name ( device ), bofmtab, bofmtab->Parameters.Length);

/* Locate BOFM2 protocol, if available */
if ( ( efirc = bs->LocateProtocol ( &bofm2_protocol_guid, NULL,
&bofm2.interface ) ) == 0 ) {
bofmtab2 = &bofm2.bofm2->BofmTable;
DBGC ( device, "EFIBOFM %p %s found version 2 BOFM table at "
"%p+%04x\n", device, efi_handle_name ( device ),
bofmtab2, bofmtab2->Parameters.Length );
DBGC ( device, "EFIBOFM %s found version 2 BOFM table at "
"%p+%04x\n", efi_handle_name ( device ), bofmtab2,
bofmtab2->Parameters.Length );
assert ( bofm2.bofm2->RegisterSupport ==
bofm1.bofm1->RegisterSupport );
} else {
DBGC ( device, "EFIBOFM %p %s cannot find BOFM2 protocol\n",
device, efi_handle_name ( device ) );
DBGC ( device, "EFIBOFM %s cannot find BOFM2 protocol\n",
efi_handle_name ( device ) );
/* Not a fatal error; may be a BOFM1-only system */
bofmtab2 = NULL;
}

/* Process BOFM table */
DBGC2 ( device, "EFIBOFM %p %s version 1 before processing:\n",
device, efi_handle_name ( device ) );
DBGC2 ( device, "EFIBOFM %s version 1 before processing:\n",
efi_handle_name ( device ) );
DBGC2_HD ( device, bofmtab, bofmtab->Parameters.Length );
if ( bofmtab2 ) {
DBGC2 ( device, "EFIBOFM %p %s version 2 before processing:\n",
device, efi_handle_name ( device ) );
DBGC2 ( device, "EFIBOFM %s version 2 before processing:\n",
efi_handle_name ( device ) );
DBGC2_HD ( device, bofmtab2, bofmtab2->Parameters.Length );
}
bofmrc = bofm ( virt_to_user ( bofmtab2 ? bofmtab2 : bofmtab ), &pci );
DBGC ( device, "EFIBOFM %p %s status %08x\n",
device, efi_handle_name ( device ), bofmrc );
DBGC2 ( device, "EFIBOFM %p %s version 1 after processing:\n",
device, efi_handle_name ( device ) );
DBGC ( device, "EFIBOFM %s status %08x\n",
efi_handle_name ( device ), bofmrc );
DBGC2 ( device, "EFIBOFM %s version 1 after processing:\n",
efi_handle_name ( device ) );
DBGC2_HD ( device, bofmtab, bofmtab->Parameters.Length );
if ( bofmtab2 ) {
DBGC2 ( device, "EFIBOFM %p %s version 2 after processing:\n",
device, efi_handle_name ( device ) );
DBGC2 ( device, "EFIBOFM %s version 2 after processing:\n",
efi_handle_name ( device ) );
DBGC2_HD ( device, bofmtab2, bofmtab2->Parameters.Length );
}

Expand All @@ -292,18 +291,18 @@ static int efi_bofm_start ( struct efi_device *efidev ) {
if ( ( efirc = bofm2.bofm2->SetStatus ( bofm2.bofm2, device,
FALSE, bofmrc ) ) != 0){
rc = -EEFI ( efirc );
DBGC ( device, "EFIBOFM %p %s could not set BOFM2 "
"status: %s\n", device,
efi_handle_name ( device ), strerror ( rc ) );
DBGC ( device, "EFIBOFM %s could not set BOFM2 "
"status: %s\n", efi_handle_name ( device ),
strerror ( rc ) );
goto err_set_status;
}
} else {
if ( ( efirc = bofm1.bofm1->SetStatus ( bofm1.bofm1, device,
FALSE, bofmrc ) ) != 0){
rc = -EEFI ( efirc );
DBGC ( device, "EFIBOFM %p %s could not set BOFM "
"status: %s\n", device,
efi_handle_name ( device ), strerror ( rc ) );
DBGC ( device, "EFIBOFM %s could not set BOFM "
"status: %s\n", efi_handle_name ( device ),
strerror ( rc ) );
goto err_set_status;
}
}
Expand Down

0 comments on commit 9501eaf

Please sign in to comment.