mirror of
https://github.com/ipxe/ipxe
synced 2026-02-12 21:29:39 +03:00
[efi] Allow for custom methods for disconnecting existing drivers
Allow for greater control over the process used to disconnect existing drivers from a device handle, by converting the "exclude" field from a simple protocol GUID to a per-driver method. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -1257,6 +1257,26 @@ static struct net_device_operations nii_operations = {
|
||||
.poll = nii_poll,
|
||||
};
|
||||
|
||||
/**
|
||||
* Exclude existing drivers
|
||||
*
|
||||
* @v device EFI device handle
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
int nii_exclude ( EFI_HANDLE device ) {
|
||||
EFI_GUID *protocol = &efi_nii31_protocol_guid;
|
||||
int rc;
|
||||
|
||||
/* Exclude existing NII protocol drivers */
|
||||
if ( ( rc = efi_driver_exclude ( device, protocol ) ) != 0 ) {
|
||||
DBGC ( device, "NII %s could not exclude drivers: %s\n",
|
||||
efi_handle_name ( device ), strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach driver to device
|
||||
*
|
||||
|
||||
@@ -11,6 +11,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
struct efi_device;
|
||||
|
||||
extern int nii_exclude ( EFI_HANDLE device );
|
||||
extern int nii_start ( struct efi_device *efidev );
|
||||
extern void nii_stop ( struct efi_device *efidev );
|
||||
|
||||
|
||||
@@ -59,8 +59,8 @@ static int nii_supported ( EFI_HANDLE device ) {
|
||||
/** EFI SNP driver */
|
||||
struct efi_driver snp_driver __efi_driver ( EFI_DRIVER_SNP ) = {
|
||||
.name = "SNP",
|
||||
.exclude = &efi_simple_network_protocol_guid,
|
||||
.supported = snp_supported,
|
||||
.exclude = snpnet_exclude,
|
||||
.start = snpnet_start,
|
||||
.stop = snpnet_stop,
|
||||
};
|
||||
@@ -68,8 +68,8 @@ struct efi_driver snp_driver __efi_driver ( EFI_DRIVER_SNP ) = {
|
||||
/** EFI NII driver */
|
||||
struct efi_driver nii_driver __efi_driver ( EFI_DRIVER_NII ) = {
|
||||
.name = "NII",
|
||||
.exclude = &efi_nii31_protocol_guid,
|
||||
.supported = nii_supported,
|
||||
.exclude = nii_exclude,
|
||||
.start = nii_start,
|
||||
.stop = nii_stop,
|
||||
};
|
||||
|
||||
@@ -528,6 +528,26 @@ int snpnet_supported ( EFI_HANDLE device, EFI_GUID *protocol ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude existing drivers
|
||||
*
|
||||
* @v device EFI device handle
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
int snpnet_exclude ( EFI_HANDLE device ) {
|
||||
EFI_GUID *protocol = &efi_simple_network_protocol_guid;
|
||||
int rc;
|
||||
|
||||
/* Exclude existing SNP drivers */
|
||||
if ( ( rc = efi_driver_exclude ( device, protocol ) ) != 0 ) {
|
||||
DBGC ( device, "SNP %s could not exclude drivers: %s\n",
|
||||
efi_handle_name ( device ), strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach driver to device
|
||||
*
|
||||
|
||||
@@ -12,6 +12,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||
struct efi_device;
|
||||
|
||||
extern int snpnet_supported ( EFI_HANDLE device, EFI_GUID *protocol );
|
||||
extern int snpnet_exclude ( EFI_HANDLE device );
|
||||
extern int snpnet_start ( struct efi_device *efidev );
|
||||
extern void snpnet_stop ( struct efi_device *efidev );
|
||||
|
||||
|
||||
@@ -209,8 +209,8 @@ static int mnponly_supported ( EFI_HANDLE device ) {
|
||||
/** EFI SNP chainloading-device-only driver */
|
||||
struct efi_driver snponly_driver __efi_driver ( EFI_DRIVER_SNP ) = {
|
||||
.name = "SNPONLY",
|
||||
.exclude = &efi_simple_network_protocol_guid,
|
||||
.supported = snponly_supported,
|
||||
.exclude = snpnet_exclude,
|
||||
.start = snpnet_start,
|
||||
.stop = snpnet_stop,
|
||||
};
|
||||
@@ -218,8 +218,8 @@ struct efi_driver snponly_driver __efi_driver ( EFI_DRIVER_SNP ) = {
|
||||
/** EFI NII chainloading-device-only driver */
|
||||
struct efi_driver niionly_driver __efi_driver ( EFI_DRIVER_NII ) = {
|
||||
.name = "NIIONLY",
|
||||
.exclude = &efi_nii31_protocol_guid,
|
||||
.supported = niionly_supported,
|
||||
.exclude = nii_exclude,
|
||||
.start = nii_start,
|
||||
.stop = nii_stop,
|
||||
};
|
||||
|
||||
@@ -1542,6 +1542,26 @@ static int usbio_interfaces ( struct usbio_device *usbio ) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude existing drivers
|
||||
*
|
||||
* @v device EFI device handle
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
static int usbio_exclude ( EFI_HANDLE device ) {
|
||||
EFI_GUID *protocol = &efi_usb_io_protocol_guid;
|
||||
int rc;
|
||||
|
||||
/* Exclude existing USB I/O protocol drivers */
|
||||
if ( ( rc = efi_driver_exclude ( device, protocol ) ) != 0 ) {
|
||||
DBGC ( device, "USBIO %s could not exclude drivers: %s\n",
|
||||
efi_handle_name ( device ), strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach driver to device
|
||||
*
|
||||
@@ -1651,8 +1671,8 @@ static void usbio_stop ( struct efi_device *efidev ) {
|
||||
/** EFI USB I/O driver */
|
||||
struct efi_driver usbio_driver __efi_driver ( EFI_DRIVER_HARDWARE ) = {
|
||||
.name = "USBIO",
|
||||
.exclude = &efi_usb_io_protocol_guid,
|
||||
.supported = usbio_supported,
|
||||
.exclude = usbio_exclude,
|
||||
.start = usbio_start,
|
||||
.stop = usbio_stop,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user