aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2021-09-08 14:29:36 +0100
committerMichael Brown <mcb30@ipxe.org>2021-09-09 12:56:02 +0100
commit05a76acc6dc68bd962c12436ac9f48de1288fad2 (patch)
tree42bcac955f93a44198b979efabcdf3d998f09ff9
parent91e147213c58c4c841416830122a0e44d69f69ad (diff)
downloadipxe-05a76acc6dc68bd962c12436ac9f48de1288fad2.zip
ipxe-05a76acc6dc68bd962c12436ac9f48de1288fad2.tar.gz
ipxe-05a76acc6dc68bd962c12436ac9f48de1288fad2.tar.bz2
[ecm] Use ACPI-provided system-specific MAC address if present
Use the "system MAC address" provided within the DSDT/SSDT if such an address is available and has not already been assigned to a network device. Tested-by: Andreas Hammarskjöld <junior@2PintSoftware.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/drivers/net/ecm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/drivers/net/ecm.c b/src/drivers/net/ecm.c
index f531b04..826b3b1 100644
--- a/src/drivers/net/ecm.c
+++ b/src/drivers/net/ecm.c
@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/if_ether.h>
#include <ipxe/base16.h>
#include <ipxe/profile.h>
+#include <ipxe/acpimac.h>
#include <ipxe/usb.h>
#include "ecm.h"
@@ -93,6 +94,14 @@ int ecm_fetch_mac ( struct usb_function *func,
int len;
int rc;
+ /* Use system-specific MAC address, if present and not already used */
+ if ( ( ( rc = acpi_mac ( hw_addr ) ) == 0 ) &&
+ ! find_netdev_by_ll_addr ( &ethernet_protocol, hw_addr ) ) {
+ DBGC ( usb, "USB %s using system-specific MAC %s\n",
+ func->name, eth_ntoa ( hw_addr ) );
+ return 0;
+ }
+
/* Fetch MAC address string */
len = usb_get_string_descriptor ( usb, desc->mac, 0, buf,
sizeof ( buf ) );