summaryrefslogtreecommitdiffstats
path: root/src/drivers/net/efi/snponly.c
diff options
context:
space:
mode:
authorMichael Brown2024-03-22 16:30:45 +0100
committerMichael Brown2024-03-25 18:58:33 +0100
commitdcad73ca5ad3e1fe011c52a24036f67ad69fadc1 (patch)
treeecb05e55a634d6d63cc46f6f3a02eb3930e30eb6 /src/drivers/net/efi/snponly.c
parent[efi] Allow for drivers to be located via child handles (diff)
downloadipxe-dcad73ca5ad3e1fe011c52a24036f67ad69fadc1.tar.gz
ipxe-dcad73ca5ad3e1fe011c52a24036f67ad69fadc1.tar.xz
ipxe-dcad73ca5ad3e1fe011c52a24036f67ad69fadc1.zip
[efi] Add support for driving EFI_MANAGED_NETWORK_PROTOCOL devices
We want exclusive access to the network device, both for performance reasons and because we perform operations such as EAPoL that affect the entire link. We currently drive the network card via either a native hardware driver or via the SNP or NII/UNDI interfaces, both of which grant us this exclusive access. Add an alternative driver that drives the network card non-exclusively via the EFI_MANAGED_NETWORK_PROTOCOL interface. This can function as a fallback for situations where neither SNP nor NII/UNDI interfaces are functional, and also opens up the possibility of non-destructively installing a temporary network device over which to download the autoexec.ipxe script. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/net/efi/snponly.c')
-rw-r--r--src/drivers/net/efi/snponly.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/drivers/net/efi/snponly.c b/src/drivers/net/efi/snponly.c
index 16370463..6786f3e8 100644
--- a/src/drivers/net/efi/snponly.c
+++ b/src/drivers/net/efi/snponly.c
@@ -32,6 +32,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/efi/Protocol/SimpleNetwork.h>
#include <ipxe/efi/Protocol/NetworkInterfaceIdentifier.h>
#include "snpnet.h"
+#include "mnpnet.h"
#include "nii.h"
/** @file
@@ -74,6 +75,11 @@ static struct chained_protocol chained_nii = {
.protocol = &efi_nii31_protocol_guid,
};
+/** Chainloaded MNP protocol */
+static struct chained_protocol chained_mnp = {
+ .protocol = &efi_managed_network_service_binding_protocol_guid,
+};
+
/**
* Locate chainloaded protocol
*
@@ -208,6 +214,17 @@ static int niionly_supported ( EFI_HANDLE device ) {
return chained_supported ( device, &chained_nii );
}
+/**
+ * Check to see if driver supports a device
+ *
+ * @v device EFI device handle
+ * @ret rc Return status code
+ */
+static int mnponly_supported ( EFI_HANDLE device ) {
+
+ return chained_supported ( device, &chained_mnp );
+}
+
/** EFI SNP chainloading-device-only driver */
struct efi_driver snponly_driver __efi_driver ( EFI_DRIVER_NORMAL ) = {
.name = "SNPONLY",
@@ -224,6 +241,14 @@ struct efi_driver niionly_driver __efi_driver ( EFI_DRIVER_NORMAL ) = {
.stop = nii_stop,
};
+/** EFI MNP chainloading-device-only driver */
+struct efi_driver mnponly_driver __efi_driver ( EFI_DRIVER_NORMAL ) = {
+ .name = "MNPONLY",
+ .supported = mnponly_supported,
+ .start = mnpnet_start,
+ .stop = mnpnet_stop,
+};
+
/**
* Initialise EFI chainloaded-device-only driver
*
@@ -232,6 +257,7 @@ static void chained_init ( void ) {
chained_locate ( &chained_snp );
chained_locate ( &chained_nii );
+ chained_locate ( &chained_mnp );
}
/** EFI chainloaded-device-only initialisation function */