mirror of
https://github.com/ipxe/ipxe
synced 2025-12-09 20:09:53 +03:00
[efi] Avoid unnecessarily passing pointers to EFI_HANDLEs
efi_file_install() and efi_download_install() are both used to install onto existing handles. There is therefore no need to allow for each of their calls to InstallMultipleProtocolInterfaces() to create a new handle. By passing the handle directly (rather than a pointer to the handle), we avoid potential confusion (and erroneous debug message colours). Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -157,14 +157,14 @@ static int efi_image_exec ( struct image *image ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Install file I/O protocols */
|
/* Install file I/O protocols */
|
||||||
if ( ( rc = efi_file_install ( &snpdev->handle ) ) != 0 ) {
|
if ( ( rc = efi_file_install ( snpdev->handle ) ) != 0 ) {
|
||||||
DBGC ( image, "EFIIMAGE %p could not install file protocol: "
|
DBGC ( image, "EFIIMAGE %p could not install file protocol: "
|
||||||
"%s\n", image, strerror ( rc ) );
|
"%s\n", image, strerror ( rc ) );
|
||||||
goto err_file_install;
|
goto err_file_install;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Install iPXE download protocol */
|
/* Install iPXE download protocol */
|
||||||
if ( ( rc = efi_download_install ( &snpdev->handle ) ) != 0 ) {
|
if ( ( rc = efi_download_install ( snpdev->handle ) ) != 0 ) {
|
||||||
DBGC ( image, "EFIIMAGE %p could not install iPXE download "
|
DBGC ( image, "EFIIMAGE %p could not install iPXE download "
|
||||||
"protocol: %s\n", image, strerror ( rc ) );
|
"protocol: %s\n", image, strerror ( rc ) );
|
||||||
goto err_download_install;
|
goto err_download_install;
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ struct _IPXE_DOWNLOAD_PROTOCOL {
|
|||||||
0x3eaeaebd, 0xdecf, 0x493b, { 0x9b, 0xd1, 0xcd, 0xb2, 0xde, 0xca, 0xe7, 0x19 } \
|
0x3eaeaebd, 0xdecf, 0x493b, { 0x9b, 0xd1, 0xcd, 0xb2, 0xde, 0xca, 0xe7, 0x19 } \
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int efi_download_install ( EFI_HANDLE *device );
|
extern int efi_download_install ( EFI_HANDLE handle );
|
||||||
extern void efi_download_uninstall ( EFI_HANDLE device );
|
extern void efi_download_uninstall ( EFI_HANDLE handle );
|
||||||
|
|
||||||
#endif /* _IPXE_DOWNLOAD_H */
|
#endif /* _IPXE_DOWNLOAD_H */
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int efi_file_install ( EFI_HANDLE *handle );
|
extern int efi_file_install ( EFI_HANDLE handle );
|
||||||
extern void efi_file_uninstall ( EFI_HANDLE handle );
|
extern void efi_file_uninstall ( EFI_HANDLE handle );
|
||||||
|
|
||||||
#endif /* _IPXE_EFI_FILE_H */
|
#endif /* _IPXE_EFI_FILE_H */
|
||||||
|
|||||||
@@ -205,13 +205,13 @@ static IPXE_DOWNLOAD_PROTOCOL ipxe_download_protocol_interface = {
|
|||||||
* @v handle EFI handle
|
* @v handle EFI handle
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
int efi_download_install ( EFI_HANDLE *handle ) {
|
int efi_download_install ( EFI_HANDLE handle ) {
|
||||||
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
|
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
|
||||||
EFI_STATUS efirc;
|
EFI_STATUS efirc;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
efirc = bs->InstallMultipleProtocolInterfaces (
|
efirc = bs->InstallMultipleProtocolInterfaces (
|
||||||
handle,
|
&handle,
|
||||||
&ipxe_download_protocol_guid,
|
&ipxe_download_protocol_guid,
|
||||||
&ipxe_download_protocol_interface,
|
&ipxe_download_protocol_interface,
|
||||||
NULL );
|
NULL );
|
||||||
|
|||||||
@@ -575,7 +575,7 @@ static EFI_DISK_IO_PROTOCOL efi_disk_io_protocol = {
|
|||||||
* @v handle EFI handle
|
* @v handle EFI handle
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
int efi_file_install ( EFI_HANDLE *handle ) {
|
int efi_file_install ( EFI_HANDLE handle ) {
|
||||||
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
|
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
|
||||||
union {
|
union {
|
||||||
EFI_DISK_IO_PROTOCOL *diskio;
|
EFI_DISK_IO_PROTOCOL *diskio;
|
||||||
@@ -592,7 +592,7 @@ int efi_file_install ( EFI_HANDLE *handle ) {
|
|||||||
* handle just to keep things looking normal.
|
* handle just to keep things looking normal.
|
||||||
*/
|
*/
|
||||||
if ( ( efirc = bs->InstallMultipleProtocolInterfaces (
|
if ( ( efirc = bs->InstallMultipleProtocolInterfaces (
|
||||||
handle,
|
&handle,
|
||||||
&efi_block_io_protocol_guid,
|
&efi_block_io_protocol_guid,
|
||||||
&efi_block_io_protocol,
|
&efi_block_io_protocol,
|
||||||
&efi_disk_io_protocol_guid,
|
&efi_disk_io_protocol_guid,
|
||||||
@@ -624,9 +624,9 @@ int efi_file_install ( EFI_HANDLE *handle ) {
|
|||||||
* of calls to our DRIVER_STOP method when starting the EFI
|
* of calls to our DRIVER_STOP method when starting the EFI
|
||||||
* shell. I have no idea why this is.
|
* shell. I have no idea why this is.
|
||||||
*/
|
*/
|
||||||
if ( ( efirc = bs->OpenProtocol ( *handle, &efi_disk_io_protocol_guid,
|
if ( ( efirc = bs->OpenProtocol ( handle, &efi_disk_io_protocol_guid,
|
||||||
&diskio.interface, efi_image_handle,
|
&diskio.interface, efi_image_handle,
|
||||||
*handle,
|
handle,
|
||||||
EFI_OPEN_PROTOCOL_BY_DRIVER ) ) != 0){
|
EFI_OPEN_PROTOCOL_BY_DRIVER ) ) != 0){
|
||||||
rc = -EEFI ( efirc );
|
rc = -EEFI ( efirc );
|
||||||
DBGC ( handle, "Could not open disk I/O protocol: %s\n",
|
DBGC ( handle, "Could not open disk I/O protocol: %s\n",
|
||||||
@@ -637,11 +637,11 @@ int efi_file_install ( EFI_HANDLE *handle ) {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
bs->CloseProtocol ( *handle, &efi_disk_io_protocol_guid,
|
bs->CloseProtocol ( handle, &efi_disk_io_protocol_guid,
|
||||||
efi_image_handle, *handle );
|
efi_image_handle, handle );
|
||||||
err_open:
|
err_open:
|
||||||
bs->UninstallMultipleProtocolInterfaces (
|
bs->UninstallMultipleProtocolInterfaces (
|
||||||
*handle,
|
handle,
|
||||||
&efi_simple_file_system_protocol_guid,
|
&efi_simple_file_system_protocol_guid,
|
||||||
&efi_simple_file_system_protocol,
|
&efi_simple_file_system_protocol,
|
||||||
&efi_disk_io_protocol_guid,
|
&efi_disk_io_protocol_guid,
|
||||||
|
|||||||
Reference in New Issue
Block a user