From: Henry Beberman <Henry.Beberman@microsoft.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 10/11] imx: Reserve a global page in memory to pass configuration to UEFI
Date: Sat, 14 Jul 2018 00:11:53 +0000 [thread overview]
Message-ID: <20180714001117.14584-11-hebeberm@microsoft.com> (raw)
In-Reply-To: <20180714001117.14584-1-hebeberm@microsoft.com>
From: Henry Beberman <henry.beberman@microsoft.com>
This patch is to enable U-Boot to pass configuration information
available during U-Boot Proper into a subsequent OS. This is required
for Windows because it lacks device tree support.
When CONFIG_GLOBAL_PAGE and CONFIG_UEFI_BOOT are set on an i.MX6 or
i.MX7 platform the go command will initialize a 4k page at a hardcoded
offset to zero. Then it will set a signature and revision number at the
start of the page so the consumer of the configuration can verify that
the page has been initialized to the expected format.
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 | 7 +++++++
arch/arm/mach-imx/Makefile | 1 +
arch/arm/mach-imx/boot.c | 6 ++++++
arch/arm/mach-imx/global_page.c | 28 ++++++++++++++++++++++++++++
include/configs/mx6_common.h | 11 +++++++++++
include/configs/mx7_common.h | 5 +++++
include/global_page.h | 24 ++++++++++++++++++++++++
7 files changed, 82 insertions(+)
create mode 100644 arch/arm/mach-imx/global_page.c
create mode 100644 include/global_page.h
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 3aec89d440..c88fa2ca1b 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -78,3 +78,10 @@ config NXP_BOARD_REVISION
NXP boards based on i.MX6/7 contain the board revision information
stored in the fuses. Select this option if you want to be able to
retrieve the board revision information.
+
+config GLOBAL_PAGE
+ bool "Enable global 4K page for configuration sharing"
+ default n
+ help
+ This option creates a global 4K page to store U-Boot environment data
+ to pass to another environment such as UEFI or Windows.
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index a81af51f03..be095d71a2 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -43,6 +43,7 @@ obj-$(CONFIG_SATA) += sata.o
obj-$(CONFIG_SECURE_BOOT) += hab.o
obj-$(CONFIG_SYSCOUNTER_TIMER) += syscounter.o
obj-$(CONFIG_UEFI_BOOT) += boot.o
+obj-$(CONFIG_GLOBAL_PAGE) += global_page.o
endif
ifeq ($(SOC),$(filter $(SOC),mx7ulp))
obj-y += cache.o
diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index 457a323fa2..2dbde8d8ee 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <global_page.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -12,6 +13,11 @@ DECLARE_GLOBAL_DATA_PTR;
unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
char * const argv[])
{
+#ifdef CONFIG_GLOBAL_PAGE
+ init_global_page();
+ publish_to_global_page();
+#endif
+
cleanup_before_linux();
return entry(argc, argv);
diff --git a/arch/arm/mach-imx/global_page.c b/arch/arm/mach-imx/global_page.c
new file mode 100644
index 0000000000..139e18f4bc
--- /dev/null
+++ b/arch/arm/mach-imx/global_page.c
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Microsoft Corporation
+ */
+
+#include <global_page.h>
+#include <environment.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct imx_global_page *global_page =
+ (struct imx_global_page *)GLOBAL_PAGE_BASE_ADDRESS;
+
+void init_global_page(void)
+{
+ /* Clear global page */
+ memset(global_page, 0, 0x1000);
+
+ /* Set signature to 'GLBL' */
+ global_page->header.signature = 0x474c424c;
+
+ /* Set revision */
+ global_page->header.revision = 0;
+}
+
+void publish_to_global_page(void)
+{
+}
diff --git a/include/configs/mx6_common.h b/include/configs/mx6_common.h
index 756db4da61..6571787e50 100644
--- a/include/configs/mx6_common.h
+++ b/include/configs/mx6_common.h
@@ -74,4 +74,15 @@
#define CONFIG_SYS_NORMAL_WORLD
#endif
+/* Define global page address */
+#if defined(CONFIG_GLOBAL_PAGE)
+#if defined(CONFIG_MX6SL) || defined(CONFIG_MX6SLL) || \
+ defined(CONFIG_MX6SX) || \
+ defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)
+#define GLOBAL_PAGE_BASE_ADDRESS 0x82003000
+#else
+#define GLOBAL_PAGE_BASE_ADDRESS 0x10817000
+#endif
+#endif
+
#endif
diff --git a/include/configs/mx7_common.h b/include/configs/mx7_common.h
index 4864df5108..a26805e93c 100644
--- a/include/configs/mx7_common.h
+++ b/include/configs/mx7_common.h
@@ -63,4 +63,9 @@
#define CONFIG_SYS_NORMAL_WORLD
#endif
+/* Define global page address */
+#if defined(CONFIG_GLOBAL_PAGE)
+#define GLOBAL_PAGE_BASE_ADDRESS 0x82003000
+#endif
+
#endif
diff --git a/include/global_page.h b/include/global_page.h
new file mode 100644
index 0000000000..a9ee6b67ad
--- /dev/null
+++ b/include/global_page.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0+*/
+/*
+ * Copyright (C) 2018 Microsoft Corporation
+ */
+
+#ifndef _GLOBAL_PAGE_H
+#define _GLOBAL_PAGE_H
+
+#include <common.h>
+
+struct global_page_header {
+ u32 signature;
+ u8 revision;
+ u8 reserved[3];
+} __packed;
+
+struct imx_global_page {
+ struct global_page_header header;
+} __packed;
+
+void init_global_page(void);
+void publish_to_global_page(void);
+
+#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 07/11] mx6cuboxi: Add Windows boot support for mx6cuboxi 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 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 11/11] imx: Add MAC addresses to global page to pass MAC into 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-11-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.