From: Henry Beberman <Henry.Beberman@microsoft.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 11/11] imx: Add MAC addresses to global page to pass MAC into UEFI
Date: Sat, 14 Jul 2018 00:11:53 +0000 [thread overview]
Message-ID: <20180714001117.14584-12-hebeberm@microsoft.com> (raw)
In-Reply-To: <20180714001117.14584-1-hebeberm@microsoft.com>
From: Henry Beberman <henry.beberman@microsoft.com>
U-Boot already has logic for determining the platform MAC address on
many i.MX platforms, such as pulling it from fuses or SPI flash. This
configuration option saves the MAC address from the ethaddr (and
potentially ethaddr1) into the global page and marks it as valid. This
value is then picked up in UEFI which will configure the LAN driver in
Windows with the correct MAC address.
Signed-off-by: Henry Beberman <henry.beberman@microsoft.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
---
arch/arm/mach-imx/Kconfig | 16 ++++++++++++++++
arch/arm/mach-imx/global_page.c | 26 +++++++++++++++++++++++++-
configs/cl-som-imx7_nt_defconfig | 2 ++
configs/mx6cuboxi_nt_defconfig | 2 ++
configs/mx6sabresd_nt_defconfig | 2 ++
configs/udoo_neo_nt_defconfig | 2 ++
include/global_page.h | 8 ++++++++
7 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index c88fa2ca1b..9bc0294d0c 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -85,3 +85,19 @@ config GLOBAL_PAGE
help
This option creates a global 4K page to store U-Boot environment data
to pass to another environment such as UEFI or Windows.
+
+config STORE_MAC_IN_GLOBAL
+ bool "Store MAC address information in global page"
+ depends on GLOBAL_PAGE
+ default n
+ help
+ This option informs U-Boot to read the ethaddr environment
+ variable and store it in the global page for UEFI to use.
+
+config ETH1ADDR_IN_GLOBAL
+ bool "Store MAC Address for 2nd ethernet in global page"
+ depends on STORE_MAC_IN_GLOBAL
+ default n
+ help
+ This option informs U-Boot to read the eth1addr environment
+ variable and store it in the global page for UEFI to use.
diff --git a/arch/arm/mach-imx/global_page.c b/arch/arm/mach-imx/global_page.c
index 139e18f4bc..c753452ad6 100644
--- a/arch/arm/mach-imx/global_page.c
+++ b/arch/arm/mach-imx/global_page.c
@@ -20,9 +20,33 @@ void init_global_page(void)
global_page->header.signature = 0x474c424c;
/* Set revision */
- global_page->header.revision = 0;
+ global_page->header.revision = 1;
}
void publish_to_global_page(void)
{
+#ifdef CONFIG_STORE_MAC_IN_GLOBAL
+ publish_mac_to_global_page("ethaddr", 0);
+#endif /* CONFIG_STORE_MAC_IN_GLOBAL */
+
+#ifdef CONFIG_ETH1ADDR_IN_GLOBAL
+ publish_mac_to_global_page("eth1addr", 1);
+#endif /* CONFIG_ETH1ADDR_IN_GLOBAL */
+}
+
+void publish_mac_to_global_page(const char *env_var, int mac)
+{
+ uchar mac_id[6];
+
+ if (mac > 1)
+ return;
+
+ if (!(strcmp(env_var, "ethaddr") || strcmp(env_var, "eth1addr")))
+ return;
+
+ eth_env_get_enetaddr(env_var, mac_id);
+
+ global_page->mac_entry[mac].enet_id = mac;
+ global_page->mac_entry[mac].valid = 1;
+ memcpy(global_page->mac_entry[mac].mac, mac_id, 6);
}
diff --git a/configs/cl-som-imx7_nt_defconfig b/configs/cl-som-imx7_nt_defconfig
index 4fe8233f0f..048621874c 100644
--- a/configs/cl-som-imx7_nt_defconfig
+++ b/configs/cl-som-imx7_nt_defconfig
@@ -77,4 +77,6 @@ CONFIG_MXC_USB_OTG_HACTIVE=y
CONFIG_USB_STORAGE=y
CONFIG_USB_GADGET=y
CONFIG_CI_UDC=y
+CONFIG_GLOBAL_PAGE=y
+CONFIG_STORE_MAC_IN_GLOBAL=y
CONFIG_OF_LIBFDT=y
diff --git a/configs/mx6cuboxi_nt_defconfig b/configs/mx6cuboxi_nt_defconfig
index 087569d2e9..b29084012f 100644
--- a/configs/mx6cuboxi_nt_defconfig
+++ b/configs/mx6cuboxi_nt_defconfig
@@ -59,4 +59,6 @@ CONFIG_USB_STORAGE=y
CONFIG_USB=y
CONFIG_USE_TINY_PRINTF=y
CONFIG_VIDEO=y
+CONFIG_GLOBAL_PAGE=y
+CONFIG_STORE_MAC_IN_GLOBAL=y
CONFIG_OF_LIBFDT=y
\ No newline at end of file
diff --git a/configs/mx6sabresd_nt_defconfig b/configs/mx6sabresd_nt_defconfig
index 9d858a4418..47c6568e60 100644
--- a/configs/mx6sabresd_nt_defconfig
+++ b/configs/mx6sabresd_nt_defconfig
@@ -55,4 +55,6 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_USB=y
CONFIG_USE_TINY_PRINTF=y
CONFIG_VIDEO=y
+CONFIG_GLOBAL_PAGE=y
+CONFIG_STORE_MAC_IN_GLOBAL=y
CONFIG_OF_LIBFDT=y
\ No newline at end of file
diff --git a/configs/udoo_neo_nt_defconfig b/configs/udoo_neo_nt_defconfig
index d5123369ca..1be3180382 100644
--- a/configs/udoo_neo_nt_defconfig
+++ b/configs/udoo_neo_nt_defconfig
@@ -52,4 +52,6 @@ CONFIG_SYS_L2CACHE_OFF=y
CONFIG_SYS_MALLOC_F_LEN=0x800
CONFIG_USE_TINY_PRINTF=y
CONFIG_PHY_MICREL=y
+CONFIG_GLOBAL_PAGE=y
+CONFIG_STORE_MAC_IN_GLOBAL=y
CONFIG_OF_LIBFDT=y
\ No newline at end of file
diff --git a/include/global_page.h b/include/global_page.h
index a9ee6b67ad..2ba291019a 100644
--- a/include/global_page.h
+++ b/include/global_page.h
@@ -14,11 +14,19 @@ struct global_page_header {
u8 reserved[3];
} __packed;
+struct global_mac_entry {
+ u8 enet_id;
+ u8 valid;
+ u8 mac[6];
+} __packed;
+
struct imx_global_page {
struct global_page_header header;
+ struct global_mac_entry mac_entry[2];
} __packed;
void init_global_page(void);
void publish_to_global_page(void);
+void publish_mac_to_global_page(const char *env_var, int mac);
#endif
--
2.16.2.gvfs.1.33.gf5370f1
prev parent reply other threads:[~2018-07-14 0:11 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-14 0:11 [U-Boot] [PATCH 00/11] Enable Windows 10 IoT Core on i.MX6 and i.MX7 Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 01/11] imx: Add bootcmd to load and run UEFI from mmc Henry Beberman
2018-07-16 17:16 ` Trent Piepho
2018-07-16 22:28 ` Henry Beberman
2018-07-16 22:45 ` Trent Piepho
2018-07-16 23:56 ` Henry Beberman
2018-07-17 17:24 ` Trent Piepho
2018-07-18 0:52 ` Henry Beberman
2018-07-17 17:09 ` Fabio Estevam
2018-07-17 17:20 ` Henry Beberman
2018-08-07 11:11 ` Stefano Babic
2018-08-07 11:16 ` Tom Rini
2018-08-07 13:45 ` Alexander Graf
2018-08-08 2:24 ` Henry Beberman
2018-08-15 14:46 ` Alexander Graf
2018-07-14 0:11 ` [U-Boot] [PATCH 02/11] arm: Allow U-Boot Proper to run in normal world Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 03/11] spl: Add FIT boot into OP-TEE then U-Boot proper Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 04/11] spl: imx: Add optional lds to keep SPL entirely in on-chip RAM Henry Beberman
2018-07-16 17:32 ` Trent Piepho
2018-07-16 22:48 ` Henry Beberman
2018-08-07 12:17 ` Stefano Babic
2018-08-08 3:22 ` Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 05/11] mx6sabresd: Add Windows boot support for iMX6 Sabre Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 06/11] mx7dsabresd: Add Windows boot support for iMX7 Sabre Henry Beberman
2018-07-16 18:22 ` Trent Piepho
2018-07-17 1:41 ` Henry Beberman
2018-07-17 17:02 ` Trent Piepho
2018-07-17 21:31 ` Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 07/11] mx6cuboxi: Add Windows boot support for mx6cuboxi Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 08/11] udoo_neo: Add Windows boot support for UDOO Neo Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 09/11] cl-som-imx7: Add Windows boot support for cl-som-imx7 Henry Beberman
2018-07-14 0:11 ` [U-Boot] [PATCH 10/11] imx: Reserve a global page in memory to pass configuration to UEFI Henry Beberman
2018-07-14 0:11 ` Henry Beberman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180714001117.14584-12-hebeberm@microsoft.com \
--to=henry.beberman@microsoft.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox