Enable Windows 10 IoT Core on i.MX6 and i.MX7
Subsystems (7)
cover Enable Windows 10 IoT Core on i.MX6 and i.MX7
From: Henry Beberman <[email protected]>
This patch series is a collaboration between Microsoft and NXP to enable Windows 10 IoT Core on NXP's iMX6 and iMX7 platforms.
The series contains reference configurations to enable Windows boot on the following
platforms: mx6sabresd, mx7dsabresd, mx6cuboxi, udoo_neo, and cl-som-imx7
These patches enable the following Windows boot flow:
1) U-Boot SPL loads from the MMC into on-chip RAM.
2) SPL loads a Flat Image Tree containing the OP-TEE runtime and U-Boot Proper.
3) SPL disables caches/interrupts and jumps into OP-TEE.
4) OP-TEE initializes then returns to the entry point of U-Boot
Proper in normal mode. OP-TEE is later used as a runtime for Trusted Applications from within Windows.
5) U-Boot Proper initializes the platform bypassing several actions
that would require secure world access.
6) The U-Boot Proper bootcmd loads a UEFI firmware binary from the
first FAT partition of the MMC into memory.
7) An overridden go command will stash the platform MAC address
from the U-Boot env into a page of memory that is preserved for UEFI.
8) The overridden go command will disable caches and interrupts then
jump into UEFI.
9) UEFI initializes the platform further and boots Windows from MMC.
Henry Beberman (11):
imx: Add bootcmd to load and run UEFI from mmc
arm: Allow U-Boot Proper to run in normal world
spl: Add FIT boot into OP-TEE then U-Boot proper
spl: imx: Add optional lds to keep SPL entirely in on-chip RAM
mx6sabresd: nt: Add Windows boot support for iMX6 Sabre
mx7dsabresd: Add Windows boot support for iMX7 Sabre
mx6cuboxi: Add Windows boot support for mx6cuboxi
udoo_neo: Add Windows boot support for UDOO Neo
cl-som-imx7: Add Windows boot support for cl-som-imx7
imx: Reserve a global page in memory to pass configuration to UEFI
imx: Add MAC addresses to global page to pass MAC into UEFI
Cc: Stefano Babic <[email protected]> Cc: Fabio Estevam <[email protected]> Cc: Tom Rini <[email protected]> Cc: Robert Solomon <[email protected]> Cc: Chirag Shah <[email protected]> Cc: Robert Oshana <[email protected]> Cc: Patrick Stilwell <[email protected]>
arch/arm/cpu/armv7/Kconfig | 7 ++ arch/arm/cpu/armv7/Makefile | 1 + arch/arm/cpu/armv7/optee_jump.S | 31 +++++++++ arch/arm/cpu/armv7/start.S | 11 ++-- arch/arm/dts/Makefile | 4 ++ arch/arm/dts/imx6qdl-mx6cuboxi.dts | 8 +++ arch/arm/dts/imx6qdl-sdb.dts | 8 +++ arch/arm/dts/imx6sx-udoo-neo.dts | 8 +++ arch/arm/dts/imx7d-cl-som-imx7.dts | 8 +++ arch/arm/lib/spl.c | 16 +++++ arch/arm/mach-imx/Kconfig | 23 +++++++ arch/arm/mach-imx/Makefile | 2 + arch/arm/mach-imx/boot.c | 25 ++++++++ arch/arm/mach-imx/global_page.c | 52 +++++++++++++++ arch/arm/mach-imx/mx7/Kconfig | 1 + arch/arm/mach-imx/mx7/soc.c | 7 +- arch/arm/mach-imx/syscounter.c | 2 + arch/arm/mach-imx/u-boot-spl-sram.lds | 59 +++++++++++++++++ board/compulab/cl-som-imx7/MAINTAINERS | 2 + board/compulab/cl-som-imx7/cl-som-imx7.c | 47 +++++++++++++- board/compulab/cl-som-imx7/spl.c | 7 ++ board/freescale/mx6sabresd/MAINTAINERS | 2 + board/freescale/mx6sabresd/mx6sabresd.c | 9 ++- board/freescale/mx7dsabresd/MAINTAINERS | 1 + board/freescale/mx7dsabresd/mx7dsabresd.c | 79 +++++++++++++++++++++++ board/solidrun/mx6cuboxi/MAINTAINERS | 2 + board/solidrun/mx6cuboxi/mx6cuboxi.c | 7 ++ board/udoo/neo/MAINTAINERS | 2 + board/udoo/neo/neo.c | 7 ++ common/Kconfig | 17 +++++ common/spl/Kconfig | 9 +++ common/spl/spl.c | 6 ++ configs/cl-som-imx7_nt_defconfig | 82 ++++++++++++++++++++++++ configs/mx6cuboxi_nt_defconfig | 64 +++++++++++++++++++ configs/mx6sabresd_nt_defconfig | 60 ++++++++++++++++++ configs/mx7dsabresd_nt_defconfig | 102 ++++++++++++++++++++++++++++++ configs/udoo_neo_nt_defconfig | 57 +++++++++++++++++ drivers/gpio/Makefile | 3 + drivers/pinctrl/nxp/pinctrl-imx7.c | 4 +- include/config_uefi_bootcmd.h | 29 +++++++++ include/configs/cl-som-imx7.h | 18 +++++- include/configs/imx6_spl.h | 2 + include/configs/imx7_spl.h | 2 + include/configs/mx6_common.h | 16 +++++ include/configs/mx6cuboxi.h | 8 +++ include/configs/mx6sabre_common.h | 10 +++ include/configs/mx7_common.h | 10 +++ include/configs/mx7dsabresd.h | 10 +++ include/configs/udoo_neo.h | 8 +++ include/global_page.h | 32 ++++++++++ include/spl.h | 21 ++++++ 51 files changed, 995 insertions(+), 13 deletions(-) create mode 100644 arch/arm/cpu/armv7/optee_jump.S create mode 100644 arch/arm/dts/imx6qdl-mx6cuboxi.dts create mode 100644 arch/arm/dts/imx6qdl-sdb.dts create mode 100644 arch/arm/dts/imx6sx-udoo-neo.dts create mode 100644 arch/arm/dts/imx7d-cl-som-imx7.dts create mode 100644 arch/arm/mach-imx/boot.c create mode 100644 arch/arm/mach-imx/global_page.c create mode 100644 arch/arm/mach-imx/u-boot-spl-sram.lds create mode 100644 configs/cl-som-imx7_nt_defconfig create mode 100644 configs/mx6cuboxi_nt_defconfig create mode 100644 configs/mx6sabresd_nt_defconfig create mode 100644 configs/mx7dsabresd_nt_defconfig create mode 100644 configs/udoo_neo_nt_defconfig create mode 100644 include/config_uefi_bootcmd.h create mode 100644 include/global_page.h
Signature · 1 line
2.16.2.gvfs.1.33.gf5370f1
PATCH 1/11 imx: Add bootcmd to load and run UEFI from mmc
From: Henry Beberman <[email protected]>
This patch enables i.MX platforms to easily add a boot script to their U-Boot Proper environment to automatically load and execute an EFI firmware from the first FAT partition of an MMC device.
This is a portion of enabling the Windows 10 IoT Core boot path.
The go command is overridden when CONFIG_UEFI_BOOT is specified. This new go will perform a cache flush/disable, disable interrupts, then jump to the address where UEFI was loaded.
This patch adds two new Kconfig options:CONFIG_UEFI_BOOT: Selects the UEFI bootcmd and overrides go to flush caches and disable interrupts.CONFIG_UEFI_LOAD_ADDR: Specifies the load address for the UEFI image
--- arch/arm/mach-imx/Makefile | 1 + arch/arm/mach-imx/boot.c | 19 +++++++++++++++++++ common/Kconfig | 17 +++++++++++++++++ include/config_uefi_bootcmd.h | 29 +++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 arch/arm/mach-imx/boot.c create mode 100644 include/config_uefi_bootcmd.h
arch/arm/mach-imx/Makefile +1 -0
@@ -42,6 +42,7 @@ endif obj-$(CONFIG_SATA) += sata.o obj-$(CONFIG_SECURE_BOOT) += hab.o obj-$(CONFIG_SYSCOUNTER_TIMER) += syscounter.o +obj-$(CONFIG_UEFI_BOOT) += boot.o endif ifeq ($(SOC),$(filter $(SOC),mx7ulp)) obj-y += cache.o
arch/arm/mach-imx/boot.c new file +19 -0
@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2018 Microsoft Corporation +*/ + +#include <common.h> +#include <command.h> + +DECLARE_GLOBAL_DATA_PTR ; + +#if defined(CONFIG_UEFI_BOOT ) +unsigned long do_go_exec (ulong (*entry)(int ,char *const []),int argc, +char *const argv[]) +{ +cleanup_before_linux (); + +return entry (argc, argv); +} +#endif /* CONFIG_UEFI_BOOT */
common/Kconfig +17 -0
@@ -217,6 +217,23 @@ config BOOTCOMMAND This is the string of commands that will be used as bootcmd and if AUTOBOOT is set, automatically run. +config UEFI_BOOT + bool "Boot a UEFI firmware loaded from the first FAT partition on the mmc" + default n + help + Override the CONFIG_BOOTCOMMAND to load a UEFI firmware image from the + first FAT partition on the mmc. Override the go command to make it disable + interrupts and flush the cache before jumping to the specified address. + +config UEFI_LOAD_ADDR + hex "Load address for the UEFI image" + depends on UEFI_BOOT + help + CONFIG_UEFI_BOOT uses this as the address to load the UEFI image. + The uefi_bootcmd script in the environment will fatload efi from the mmc + to this location, then use an overridden go command to disable caches and + interrupts then jump to this location. + menu "Console" config MENU
include/config_uefi_bootcmd.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2018 Microsoft Corporation +*/ + +#ifndef _CONFIG_UEFI_BOOTCMD_H +#define _CONFIG_UEFI_BOOTCMD_H + +#define BOOTENV \ + "uefi_image_name=imxboard_efi.fd\0" \ + "uefi_addr=" __stringify(CONFIG_UEFI_LOAD_ADDR) "\0" \ + "uefi_bootcmd=" \ + "part list mmc ${mmcdev} -bootable devplist; " \ + "env exists devplist || setenv devplist 1; " \ + "for bootpart in ${devplist}; do " \ + "if fatload mmc ${mmcdev}:${bootpart} " \ + "${uefi_addr} ${uefi_image_name}; then " \ + "echo \"Jumping to ${uefi_image_name} at " \ + "${uefi_addr}\"; " \ + "go ${uefi_addr}; " \ + "fi; " \ + "done; " \ + "echo \"Could not find ${uefi_image_name} on mmc ${mmcdev}\";\0" + +#ifdef CONFIG_UEFI_BOOT +#define CONFIG_BOOTCOMMAND "run uefi_bootcmd" +#endif + +#endif /* _CONFIG_UEFI_BOOTCMD_H */
Signature · 1 line
2.16.2.gvfs.1.33.gf5370f1
PATCH 1/11 imx: Add bootcmd to load and run UEFI from mmc
Quoted 5 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch enables i.MX platforms to easily add a boot script to their U-Boot Proper environment to automatically load and execute an EFI firmware from the first FAT partition of an MMC device.
Is there a reason to force the first partition instead of using the EFI partition code to select which partition to boot?
I also wonder, on a Linux system, is there a reason the EFI partition must use FAT?
PATCH 1/11 imx: Add bootcmd to load and run UEFI from mmc
Hi Trent,
Quoted 16 lines
-----Original Message-----
From: Trent Piepho <[email protected]>
Sent: Monday, July 16, 2018 10:17 AM
To: Henry Beberman <[email protected]>; u-
boot at lists.denx.de
Cc: trini at konsulko.com; fabio.estevam at nxp.com
Subject: Re: [U-Boot] [PATCH 01/11] imx: Add bootcmd to load and run UEFI from mmcQuoted 5 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch enables i.MX platforms to easily add a boot script to their U-Boot Proper environment to automatically load and execute an EFI firmware from the first FAT partition of an MMC device.
Quoted 5 lines
Is there a reason to force the first partition instead of using the EFI partition code to select which partition to boot?
I also wonder, on a Linux system, is there a reason the EFI partition must use FAT?
I need to revise the commit message for this patch. The script is not fixed to the first partition of the selected MMC, it scans the disk for partitions marked bootable, then checks each one of those until it finds the imxboard_efi.fd binary.
We could switch over to using the generic load from CONFIG_CMD_FS_GENERIC if there's demand for non-FAT filesystems. We're currently using fatload because the EFI partitions in our Windows images are always FAT formatted.
Thanks,
Henry
PATCH 1/11 imx: Add bootcmd to load and run UEFI from mmc
Quoted 18 lines · Henry Beberman
Hi Trent,
Quoted 16 lines
-----Original Message-----
From: Trent Piepho <[email protected]>
Sent: Monday, July 16, 2018 10:17 AM
To: Henry Beberman <[email protected]>; u-
boot at lists.denx.de
Cc: trini at konsulko.com; fabio.estevam at nxp.com
Subject: Re: [U-Boot] [PATCH 01/11] imx: Add bootcmd to load and run UEFI from mmcQuoted 5 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch enables i.MX platforms to easily add a boot script to their U-Boot Proper environment to automatically load and execute an EFI firmware from the first FAT partition of an MMC device.
Quoted 7 lines
Quoted 5 lines
Is there a reason to force the first partition instead of using the EFI partition code to select which partition to boot?
I also wonder, on a Linux system, is there a reason the EFI partition must use FAT?
I need to revise the commit message for this patch. The script is not fixed to the first partition of the selected MMC, it scans the disk for partitions marked bootable, then checks each one of those until it finds the imxboard_efi.fd binary.
That is indeed very different from first FAT partition. Does bootable only apply legacy MBR partition tables? I didn't think bootable was typically used with GPT tables. There is a bit, but it's not used to mark EFI partitions.
Which brings me back to the partition type. Isn't that the right way to find the EFI?
Quoted 1 line
We could switch over to using the generic load from
CONFIG_CMD_FS_GENERICif there's demand for non-FAT filesystems. We're currently using fatload because the EFI partitions in our Windows images are always FAT formatted.
You're original search method required the partition be FAT.
PATCH 1/11 imx: Add bootcmd to load and run UEFI from mmc
Quoted 39 lines
-----Original Message-----
From: Trent Piepho <[email protected]>
Sent: Monday, July 16, 2018 3:45 PM
To: Henry Beberman <[email protected]>; u-
boot at lists.denx.de
Cc: trini at konsulko.com; fabio.estevam at nxp.com
Subject: Re: [U-Boot] [PATCH 01/11] imx: Add bootcmd to load and run UEFI from mmcQuoted 18 lines · Henry Beberman
Hi Trent,
Quoted 16 lines
-----Original Message-----
From: Trent Piepho <[email protected]>
Sent: Monday, July 16, 2018 10:17 AM
To: Henry Beberman <[email protected]>; u- boot at lists.denx.de
Cc: trini at konsulko.com; fabio.estevam at nxp.com
Subject: Re: [U-Boot] [PATCH 01/11] imx: Add bootcmd to load and run UEFI from mmcQuoted 5 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch enables i.MX platforms to easily add a boot script to their U-Boot Proper environment to automatically load and execute an EFI firmware from the first FAT partition of an MMC device.
Quoted 7 lines
Quoted 5 lines
Is there a reason to force the first partition instead of using the EFI partition code to select which partition to boot?
I also wonder, on a Linux system, is there a reason the EFI partition must use FAT?
I need to revise the commit message for this patch. The script is not fixed
to the first partition of the selected MMC, it scans the disk for partitions marked bootable, then checks each one of those until it finds the imxboard_efi.fd binary.
Quoted 6 lines
That is indeed very different from first FAT partition. Does bootable only apply legacy MBR partition tables? I didn't think bootable was typically used with GPT tables. There is a bit, but it's not used to mark EFI partitions.
Which brings me back to the partition type. Isn't that the right way to find the EFI?
The is_bootable function in disk/part_efi.c marks a partition as bootable if the partition_type_guid on disk matches the EFI PARTITION_SYSTEM_GUID. The part command with the -bootable flag will return the EFI partition on both GPT and MBR partition schemes. This method is also used by config_distro_bootcmd.h
Quoted 7 lines
Quoted 2 lines
We could switch over to using the generic load from
CONFIG_CMD_FS_GENERICif there's demand for non-FAT filesystems. We're currently using fatload because the EFI partitions in our Windows images are always FAT formatted.You're original search method required the partition be FAT.
I'm happy to switch from the fatload command over to the load command if it will make CONFIG_UEFI_BOOT more widely useful.
PATCH 1/11 imx: Add bootcmd to load and run UEFI from mmc
Quoted 12 lines · Henry Beberman
Quoted 12 lines
Quoted 3 lines
I need to revise the commit message for this patch. The script is not fixed
to the first partition of the selected MMC, it scans the disk for partitions marked bootable, then checks each one of those until it finds the imxboard_efi.fd binary.
That is indeed very different from first FAT partition. Does bootable only apply legacy MBR partition tables? I didn't think bootable was typically used with GPT tables. There is a bit, but it's not used to mark EFI partitions.
Quoted 5 lines
Quoted 2 lines
Which brings me back to the partition type. Isn't that the right way to find the EFI?
The
is_bootablefunction indisk/part_efi.cmarks a partition as bootable if thepartition_type_guidon disk matches the EFIPARTITION_SYSTEM_GUID. The part command with the -bootable flag will return the EFI partition on both GPT and MBR partition schemes. This method is also used byconfig_distro_bootcmd.h
But it also finds any partitions with the legacy bios bootable flag set in a GPT table or the active partition bit set in a MBR table, or any future reason a partition might be considered bootable. Someone trying to add a new type of bootable partition to distro bootcmd will be forced to deal with your windows nt boot command as it tries to boot any bootable partition, even ones it can't boot.
The distro boot command is designed to boot anything, so it searches for partitions beyond EFI. But what you've done is just for EFI. That's why it's different.
Quoted 9 lines
Quoted 7 lines
Quoted 1 line
We could switch over to using the generic load from
CONFIG_CMD_FS_GENERICif there's demand for non-FAT filesystems. We're currently using fatload because the EFI partitions in our Windows images are always FAT formatted.You're original search method required the partition be FAT.
I'm happy to switch from the fatload command over to the load command if it will make
CONFIG_UEFI_BOOTmore widely useful.
My comment was addressing the incorrect commit message that indicated boot partition selection was linked to the FAT filesystem. I don't know if loading EFI from non-FAT partitions will be useful. I'm not planning on using EFI but I like to avoid FAT in my products. If you had linked the boot partition selection to FAT, it would cut off future options.
PATCH 1/11 imx: Add bootcmd to load and run UEFI from mmc
Quoted 40 lines
-----Original Message-----
From: Trent Piepho <[email protected]>
Sent: Tuesday, July 17, 2018 10:24 AM
To: Henry Beberman <[email protected]>; u-
boot at lists.denx.de
Cc: trini at konsulko.com; fabio.estevam at nxp.com
Subject: Re: [U-Boot] [PATCH 01/11] imx: Add bootcmd to load and run UEFI from mmcQuoted 5 lines · Henry Beberman
Quoted 5 lines
Quoted 4 lines
I need to revise the commit message for this patch. The script is not fixed
Quoted 7 lines
Quoted 7 lines
to the first partition of the selected MMC, it scans the disk for partitions marked bootable, then checks each one of those until it finds the imxboard_efi.fd binary.
That is indeed very different from first FAT partition. Does bootable only apply legacy MBR partition tables? I didn't think bootable was typically used with GPT tables. There is a bit, but it's not
used to mark EFI partitions.
Quoted 5 lines
Quoted 3 lines
Which brings me back to the partition type. Isn't that the right way to find the EFI?
The
is_bootablefunction indisk/part_efi.cmarks a partition as bootable ifthe
partition_type_guidon disk matches the EFIPARTITION_SYSTEM_GUID.Quoted 3 lines
The part command with the -bootable flag will return the EFI partition on both GPT and MBR partition schemes. This method is also used by
config_distro_bootcmd.hBut it also finds any partitions with the legacy bios bootable flag set in a GPT table or the active partition bit set in a MBR table, or any future reason a partition might be considered bootable. Someone trying to add a new type of bootable partition to distro bootcmd will be forced to deal with your windows nt boot command as it tries to boot any bootable partition, even ones it can't boot.
Quoted 3 lines
The distro boot command is designed to boot anything, so it searches for partitions beyond EFI. But what you've done is just for EFI. That's why it's different.
It doesn’t matter if someone adds a new type of bootable partition in the future, the UEFI boot command will fail to find the imxboard_efi.fd binary then move along to check the next bootable partition.
Adding this boot command will not increase maintenance on config_distro_bootcmd.h. The UEFI boot command is only used when the defconfig selects CONFIG_UEFI_BOOT, and the board's include/configs header has been modified to include config_uefi_bootcmd.h instead of config_distro_bootcmd.h when the config is set.
Fabio Estevam
maintainerPATCH 1/11 imx: Add bootcmd to load and run UEFI from mmc
In reply to Trent PiephoHi Henry,
Quoted 6 lines · Trent Piepho
Quoted 5 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch enables i.MX platforms to easily add a boot script to their U-Boot Proper environment to automatically load and execute an EFI firmware from the first FAT partition of an MMC device.
Have you subscribed to the U-Boot list?
I don't see this series in the list archives, only on my NXP account.
PATCH 1/11 imx: Add bootcmd to load and run UEFI from mmc
Hi Fabio,
Quoted 15 lines
-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: Tuesday, July 17, 2018 10:09 AM
To: Trent Piepho <[email protected]>
Cc: Henry Beberman <[email protected]>; u-
boot at lists.denx.de; fabio.estevam at nxp.com; trini at konsulko.com
Subject: Re: [U-Boot] [PATCH 01/11] imx: Add bootcmd to load and run UEFI from mmcHi Henry,
Quoted 3 lines · Trent Piepho
Quoted 2 lines · Henry Beberman
From: Henry Beberman <[email protected]>
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
This patch enables i.MX platforms to easily add a boot script to their U-Boot Proper environment to automatically load and execute an EFI firmware from the first FAT partition of an MMC device.
Have you subscribed to the U-Boot list?
I don't see this series in the list archives, only on my NXP account.
I'm subscribed to the U-Boot list and I included the mailing list when sending out the series, but I got a notice that they were held until moderator approval. I saw the patches in the archive here https://lists.denx.de/pipermail/u-boot/2018-July/thread.html#334680 and on the patch tracker so I assumed they went out successfully.
Thanks,
Henry
PATCH 1/11 imx: Add bootcmd to load and run UEFI from mmc
In reply to Henry BebermanHi Henry,
Quoted 21 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch enables i.MX platforms to easily add a boot script to their U-Boot Proper environment to automatically load and execute an EFI firmware from the first FAT partition of an MMC device.
This is a portion of enabling the Windows 10 IoT Core boot path.
The go command is overridden when
CONFIG_UEFI_BOOTis specified. This new go will perform a cache flush/disable, disable interrupts, then jump to the address where UEFI was loaded.This patch adds two new
Kconfigoptions:CONFIG_UEFI_BOOT: Selects the UEFI bootcmd and overrides go to flush caches and disable interrupts.CONFIG_UEFI_LOAD_ADDR: Specifies the load address for the UEFI imageSigned-off-by Henry Beberman <[email protected]>Cc Stefano Babic <[email protected]>Cc Fabio Estevam <[email protected]>Cc Tom Rini <[email protected]>
Quoted 9 lines
--- arch/arm/mach-imx/Makefile | 1 + arch/arm/mach-imx/boot.c | 19 +++++++++++++++++++ common/Kconfig | 17 +++++++++++++++++ include/config_uefi_bootcmd.h | 29 +++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 arch/arm/mach-imx/boot.c create mode 100644 include/config_uefi_bootcmd.h
I am really missing why we need this specially for i.MX. There is nothing special to i.MX, and if this command is necessary, we should put it in common code.
Anyway, should we not try to merge it with the general support for UEFI in U-Boot ? We have already a "bootefi" command (aarch64 and x86, currently).
Quoted 91 lines
arch/arm/mach-imx/Makefile +1
-0@@ -42,6 +42,7 @@ endif obj-$(CONFIG_SATA) += sata.o obj-$(CONFIG_SECURE_BOOT) += hab.o obj-$(CONFIG_SYSCOUNTER_TIMER) += syscounter.o +obj-$(CONFIG_UEFI_BOOT) += boot.o endif ifeq ($(SOC),$(filter $(SOC),mx7ulp)) obj-y += cache.oarch/arm/mach-imx/boot.c new file +19
-0@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2018 Microsoft Corporation +*/ + +#include <common.h> +#include <command.h> + +DECLARE_GLOBAL_DATA_PTR ; + +#if defined(CONFIG_UEFI_BOOT ) +unsigned long do_go_exec (ulong (*entry)(int ,char *const []),int argc, +char *const argv[]) +{ +cleanup_before_linux (); + +return entry (argc, argv); +} +#endif /* CONFIG_UEFI_BOOT */ common/Kconfig +17
-0@@ -217,6 +217,23 @@ config BOOTCOMMAND This is the string of commands that will be used as bootcmd and if AUTOBOOT is set, automatically run. +config UEFI_BOOT + bool "Boot a UEFI firmware loaded from the first FAT partition on the mmc" + default n + help + Override the CONFIG_BOOTCOMMAND to load a UEFI firmware image from the + first FAT partition on the mmc. Override the go command to make it disable + interrupts and flush the cache before jumping to the specified address. + +config UEFI_LOAD_ADDR + hex "Load address for the UEFI image" + depends on UEFI_BOOT + help + CONFIG_UEFI_BOOT uses this as the address to load the UEFI image. + The uefi_bootcmd script in the environment will fatload efi from the mmc + to this location, then use an overridden go command to disable caches and + interrupts then jump to this location. + menu "Console" config MENUinclude/config_uefi_bootcmd.h new file +19
-0@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2018 Microsoft Corporation +*/ + +#ifndef _CONFIG_UEFI_BOOTCMD_H +#define _CONFIG_UEFI_BOOTCMD_H + +#define BOOTENV \ + "uefi_image_name=imxboard_efi.fd\0" \ + "uefi_addr=" __stringify(CONFIG_UEFI_LOAD_ADDR) "\0" \ + "uefi_bootcmd=" \ + "part list mmc ${mmcdev} -bootable devplist; " \ + "env exists devplist || setenv devplist 1; " \ + "for bootpart in ${devplist}; do " \ + "if fatload mmc ${mmcdev}:${bootpart} " \ + "${uefi_addr} ${uefi_image_name}; then " \ + "echo \"Jumping to ${uefi_image_name} at " \ + "${uefi_addr}\"; " \
include/config_uefi_bootcmd.h line 29
Quoted 10 lines
include/config_uefi_bootcmd.h new file +10
-0+"go ${uefi_addr}; " \ +"fi; " \ +"done; " \ + "echo \"Could not find ${uefi_image_name} on mmc ${mmcdev}\";\0" + +#ifdef CONFIG_UEFI_BOOT +#define CONFIG_BOOTCOMMAND "run uefi_bootcmd" +#endif + +#endif /* _CONFIG_UEFI_BOOTCMD_H */
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 1/11 imx: Add bootcmd to load and run UEFI from mmc
Quoted 34 lines · Stefano Babic
Hi Henry,
Quoted 21 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch enables i.MX platforms to easily add a boot script to their U-Boot Proper environment to automatically load and execute an EFI firmware from the first FAT partition of an MMC device.
This is a portion of enabling the Windows 10 IoT Core boot path.
The go command is overridden when
CONFIG_UEFI_BOOTis specified. This new go will perform a cache flush/disable, disable interrupts, then jump to the address where UEFI was loaded.This patch adds two new
Kconfigoptions:CONFIG_UEFI_BOOT: Selects the UEFI bootcmd and overrides go to flush caches and disable interrupts.CONFIG_UEFI_LOAD_ADDR: Specifies the load address for the UEFI imageSigned-off-by Henry Beberman <[email protected]>Cc Stefano Babic <[email protected]>Cc Fabio Estevam <[email protected]>Cc Tom Rini <[email protected]>Quoted 9 lines
--- arch/arm/mach-imx/Makefile | 1 + arch/arm/mach-imx/boot.c | 19 +++++++++++++++++++ common/Kconfig | 17 +++++++++++++++++ include/config_uefi_bootcmd.h | 29 +++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 arch/arm/mach-imx/boot.c create mode 100644 include/config_uefi_bootcmd.h
Quoted 7 lines
I am really missing why we need this specially for i.MX. There is nothing special to i.MX, and if this command is necessary, we should put it in common code.
Anyway, should we not try to merge it with the general support for UEFI in U-Boot ? We have already a "bootefi" command (aarch64 and x86, currently).
Agreed, this should be folded in with our existing UEFI support, thanks!
Quoted 112 lines
Quoted 92 lines
arch/arm/mach-imx/Makefile +1
-0@@ -42,6 +42,7 @@ endif obj-$(CONFIG_SATA) += sata.o obj-$(CONFIG_SECURE_BOOT) += hab.o obj-$(CONFIG_SYSCOUNTER_TIMER) += syscounter.o +obj-$(CONFIG_UEFI_BOOT) += boot.o endif ifeq ($(SOC),$(filter $(SOC),mx7ulp)) obj-y += cache.oarch/arm/mach-imx/boot.c new file +19
-0@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2018 Microsoft Corporation +*/ + +#include <common.h> +#include <command.h> + +DECLARE_GLOBAL_DATA_PTR ; + +#if defined(CONFIG_UEFI_BOOT ) +unsigned long do_go_exec (ulong (*entry)(int ,char *const []),int argc, +char *const argv[]) +{ +cleanup_before_linux (); + +return entry (argc, argv); +} +#endif /* CONFIG_UEFI_BOOT */ common/Kconfig +17
-0@@ -217,6 +217,23 @@ config BOOTCOMMAND This is the string of commands that will be used as bootcmd and if AUTOBOOT is set, automatically run. +config UEFI_BOOT + bool "Boot a UEFI firmware loaded from the first FAT partition on the mmc" + default n + help + Override the CONFIG_BOOTCOMMAND to load a UEFI firmware image from the + first FAT partition on the mmc. Override the go command to make it disable + interrupts and flush the cache before jumping to the specified address. + +config UEFI_LOAD_ADDR + hex "Load address for the UEFI image" + depends on UEFI_BOOT + help + CONFIG_UEFI_BOOT uses this as the address to load the UEFI image. + The uefi_bootcmd script in the environment will fatload efi from the mmc + to this location, then use an overridden go command to disable caches and + interrupts then jump to this location. + menu "Console" config MENUinclude/config_uefi_bootcmd.h new file +19
-0@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2018 Microsoft Corporation +*/ + +#ifndef _CONFIG_UEFI_BOOTCMD_H +#define _CONFIG_UEFI_BOOTCMD_H + +#define BOOTENV \ + "uefi_image_name=imxboard_efi.fd\0" \ + "uefi_addr=" __stringify(CONFIG_UEFI_LOAD_ADDR) "\0" \ + "uefi_bootcmd=" \ + "part list mmc ${mmcdev} -bootable devplist; " \ + "env exists devplist || setenv devplist 1; " \ + "for bootpart in ${devplist}; do " \ + "if fatload mmc ${mmcdev}:${bootpart} " \ + "${uefi_addr} ${uefi_image_name}; then " \ + "echo \"Jumping to ${uefi_image_name} at " \ + "${uefi_addr}\"; " \include/config_uefi_bootcmd.h line 29
Quoted 10 lines
include/config_uefi_bootcmd.h new file +10
-0+"go ${uefi_addr}; " \ +"fi; " \ +"done; " \ + "echo \"Could not find ${uefi_image_name} on mmc ${mmcdev}\";\0" + +#ifdef CONFIG_UEFI_BOOT +#define CONFIG_BOOTCOMMAND "run uefi_bootcmd" +#endif + +#endif /* _CONFIG_UEFI_BOOTCMD_H */ Best regards,
Stefano BabicSignature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180807/0fe1d02b/attachment.sig>
PATCH 1/11 imx: Add bootcmd to load and run UEFI from mmc
Quoted 43 lines
Am 07.08.2018 um 12:16 schrieb Tom Rini <[email protected]>:
Quoted 39 lines · Stefano Babic
Hi Henry,
Quoted 22 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch enables i.MX platforms to easily add a boot script to their U-Boot Proper environment to automatically load and execute an EFI firmware from the first FAT partition of an MMC device.
This is a portion of enabling the Windows 10 IoT Core boot path.
The go command is overridden when
CONFIG_UEFI_BOOTis specified. This new go will perform a cache flush/disable, disable interrupts, then jump to the address where UEFI was loaded.This patch adds two new
Kconfigoptions:CONFIG_UEFI_BOOT: Selects the UEFI bootcmd and overrides go to flush caches and disable interrupts.CONFIG_UEFI_LOAD_ADDR: Specifies the load address for the UEFI imageSigned-off-by Henry Beberman <[email protected]>Cc Stefano Babic <[email protected]>Cc Fabio Estevam <[email protected]>Cc Tom Rini <[email protected]>Quoted 9 lines
---
arch/arm/mach-imx/Makefile | 1 + arch/arm/mach-imx/boot.c | 19 +++++++++++++++++++ common/Kconfig | 17 +++++++++++++++++ include/config_uefi_bootcmd.h | 29 +++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+)create mode 100644
arch/arm/mach-imx/boot.c
create mode 100644include/config_uefi_bootcmd.hI am really missing why we need this specially for i.MX. There is nothing special to i.MX, and if this command is necessary, we should put it in common code.
Quoted 5 lines
Quoted 3 lines
Anyway, should we not try to merge it with the general support for UEFI in U-Boot ? We have already a "bootefi" command (aarch64 and x86, currently).
Agreed, this should be folded in with our existing UEFI support, thanks!
Yes, please just use distro boot. Bootefi (which distro boot calls) already supports running UEFI binaries for real even on armv7.
Alex
PATCH 1/11 imx: Add bootcmd to load and run UEFI from mmc
Quoted 62 lines
-----Original Message-----
From: Alexander Graf <[email protected]>
Sent: Tuesday, August 7, 2018 6:46 AM
To: Tom Rini <[email protected]>
Cc: Stefano Babic <[email protected]>; Henry Beberman <[email protected]>; u-boot at lists.denx.de; Fabio Estevam <[email protected]>
Subject: Re: [PATCH 01/11] imx: Add bootcmd to load and run UEFI from mmcQuoted 20 lines
Am 07.08.2018 um 12:16 schrieb Tom Rini <[email protected]>:
Quoted 18 lines · Stefano Babic
Hi Henry,
Quoted 15 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch enables i.MX platforms to easily add a boot script to their U-Boot Proper environment to automatically load and execute an EFI firmware from the first FAT partition of an MMC device.
This is a portion of enabling the Windows 10 IoT Core boot path.
The go command is overridden when
CONFIG_UEFI_BOOTis specified. This new go will perform a cache flush/disable, disable interrupts, then jump to the address where UEFI was loaded.This patch adds two new
Kconfigoptions:CONFIG_UEFI_BOOT: Selects the UEFI bootcmd and overrides go toflush
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
caches and disable interrupts.
CONFIG_UEFI_LOAD_ADDR: Specifies the load address for the UEFIimage
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Signed-off-by Henry Beberman <[email protected]>Cc Stefano Babic <[email protected]>Cc Fabio Estevam <[email protected]>Cc Tom Rini <[email protected]>---
arch/arm/mach-imx/Makefile | 1 + arch/arm/mach-imx/boot.c | 19 +++++++++++++++++++ common/Kconfig | 17 +++++++++++++++++ include/config_uefi_bootcmd.h | 29+++++++++++++++++++++++++++++
Quoted 13 lines
Quoted 12 lines
Quoted 4 lines
4 files changed, 66 insertions(+)create mode 100644
arch/arm/mach-imx/boot.ccreate mode 100644include/config_uefi_bootcmd.hI am really missing why we need this specially for i.MX. There is nothing special to i.MX, and if this command is necessary, we should put it in common code.
Anyway, should we not try to merge it with the general support for UEFI in U-Boot ? We have already a "bootefi" command (aarch64 and x86, currently).
Quoted 8 lines
Quoted 1 line
Agreed, this should be folded in with our existing UEFI support, thanks!
Yes, please just use distro boot. Bootefi (which distro boot calls) already supports running UEFI binaries for real even on armv7.
Alex
Running Windows directly on U-Boot through bootefi is definitely appealing, but we're dependent on a number of features provided by our full UEFI firmware.
* Several ACPI tables that are unimplemented in U-Boot: CSRT, DBG2, SPCR, TPM2, GTDT
* Some DSDT elements that require the Microsoft ASL compiler (for now)
* UEFI Authenticated Variables that are writeable at runtime.
* UEFI Secure Boot
* Launching and communicating with a Firmware TPM running as an OP-TEE Trusted Application
I'd be happy to break down this patch's changes into more generic steps rather than creating confusion by adding CONFIG_UEFI_BOOT.
I can move the UEFI binary into our FIT to eliminate the custom binary load script. How should I cleanly add an alternate CONFIG_BOOTCOMMAND to an existing board.h file? Where is the best place to define an alternate do_go_exec that calls cleanup_before_linux() before jumping?
Thanks,
Henry
PATCH 1/11 imx: Add bootcmd to load and run UEFI from mmc
Quoted 74 lines · Henry Beberman
Quoted 58 lines
-----Original Message-----
From: Alexander Graf <[email protected]>
Sent: Tuesday, August 7, 2018 6:46 AM
To: Tom Rini <[email protected]>
Cc: Stefano Babic <[email protected]>; Henry Beberman <[email protected]>; u-boot at lists.denx.de; Fabio Estevam <[email protected]>
Subject: Re: [PATCH 01/11] imx: Add bootcmd to load and run UEFI from mmcQuoted 20 lines
Am 07.08.2018 um 12:16 schrieb Tom Rini <[email protected]>:
Quoted 18 lines · Stefano Babic
Hi Henry,
Quoted 15 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch enables i.MX platforms to easily add a boot script to their U-Boot Proper environment to automatically load and execute an EFI firmware from the first FAT partition of an MMC device.
This is a portion of enabling the Windows 10 IoT Core boot path.
The go command is overridden when
CONFIG_UEFI_BOOTis specified. This new go will perform a cache flush/disable, disable interrupts, then jump to the address where UEFI was loaded.This patch adds two new
Kconfigoptions:CONFIG_UEFI_BOOT: Selects the UEFI bootcmd and overrides go toflush
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
caches and disable interrupts.
CONFIG_UEFI_LOAD_ADDR: Specifies the load address for the UEFIimage
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Signed-off-by Henry Beberman <[email protected]>Cc Stefano Babic <[email protected]>Cc Fabio Estevam <[email protected]>Cc Tom Rini <[email protected]>---
arch/arm/mach-imx/Makefile | 1 + arch/arm/mach-imx/boot.c | 19 +++++++++++++++++++ common/Kconfig | 17 +++++++++++++++++ include/config_uefi_bootcmd.h | 29+++++++++++++++++++++++++++++
Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
4 files changed, 66 insertions(+)create mode 100644
arch/arm/mach-imx/boot.ccreate mode 100644include/config_uefi_bootcmd.hI am really missing why we need this specially for i.MX. There is nothing special to i.MX, and if this command is necessary, we should put it in common code.
Anyway, should we not try to merge it with the general support for UEFI in U-Boot ? We have already a "bootefi" command (aarch64 and x86, currently).
Quoted 7 lines
Quoted 1 line
Agreed, this should be folded in with our existing UEFI support, thanks!
Yes, please just use distro boot. Bootefi (which distro boot calls) already supports running UEFI binaries for real even on armv7.
Alex
Running Windows directly on U-Boot through bootefi is definitely appealing, but we're dependent on a number of features provided by our full UEFI firmware.
* Several ACPI tables that are unimplemented in U-Boot: CSRT, DBG2, SPCR, TPM2, GTDT
* Some DSDT elements that require the Microsoft ASL compiler (for now)
* UEFI Authenticated Variables that are writeable at runtime.
* UEFI Secure Boot
* Launching and communicating with a Firmware TPM running as an OP-TEE Trusted Application
Quoted 5 lines
I'd be happy to break down this patch's changes into more generic steps rather than creating confusion by adding
CONFIG_UEFI_BOOT.I can move the UEFI binary into our FIT to eliminate the custom binary load script. How should I cleanly add an alternate
CONFIG_BOOTCOMMANDto an existingboard.hfile?
I think ideally you just integrate into whatever distro boot supports. It already gives you plenty options such as extboot, boot.scr and real generic bootefi support. I'm sure your specially crafted FIT image can by loaded by at least one of the existing mechanisms.
Quoted 2 lines
Where is the best place to define an alternate
do_go_execthat callscleanup_before_linux()before jumping?
Do you really really need that? The ARM calling convention for bootz is trivial and sounds like pretty much what you need already, no?
Alex
PATCH 2/11 arm: Allow U-Boot Proper to run in normal world
In reply to Henry BebermanFrom: Henry Beberman <[email protected]>
In order to minimize the surface area of secure world code, the i.MX Windows 10 IoT Core boot flow uses SPL to jump into OP-TEE as soon as possible. Once OP-TEE has locked down resources it returns into the entry point U-Boot Proper in normal world.
The CONFIG_SYS_NORMAL_WORLD Kconfig option has been added so that segments of code with a dependency on secure world are built into SPL and selectively omitted from the U-Boot Proper built for normal world. This is only enabled when the CONFIG_SPL_OPTEE_BOOT Kconfig option is set. CONFIG_SPL_OPTEE_BOOT is added in the next patch in this series.
--- arch/arm/cpu/armv7/Kconfig | 7 +++++++ arch/arm/cpu/armv7/start.S | 11 ++++++----- arch/arm/mach-imx/mx7/soc.c | 7 +++++-- arch/arm/mach-imx/syscounter.c | 2 ++ include/configs/mx6_common.h | 5 +++++ include/configs/mx7_common.h | 5 +++++ 6 files changed, 30 insertions(+), 7 deletions(-)
arch/arm/cpu/armv7/Kconfig +7 -0
@@ -58,4 +58,11 @@ config ARMV7_LPAE Say Y here to use the long descriptor page table format. This is required if U-Boot runs in HYP mode. +config SYS_NORMAL_WORLD + bool "An internal build option that tells code that it is running in normal world" + default n + help + This option is set internally by headers if the code being + compiled must run in normal world. + endif
arch/arm/cpu/armv7/start.S +6 -5
@@ -168,30 +168,31 @@ ENTRY(cpu_init_cp15) mcr p15, 0, r0, c1, c0, 0 @ write system control register #endif -#if (defined(CONFIG_ARM_ERRATA_742230) || defined(CONFIG_ARM_ERRATA_794072)) +#if (defined(CONFIG_ARM_ERRATA_742230) || defined(CONFIG_ARM_ERRATA_794072)) \ + && !defined(CONFIG_SYS_NORMAL_WORLD) mrc p15, 0, r0, c15, c0, 1 @ read diagnostic register orr r0, r0, #1 << 4 @ set bit #4 mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register #endif -#ifdef CONFIG_ARM_ERRATA_743622 +#if defined(CONFIG_ARM_ERRATA_743622) && !defined(CONFIG_SYS_NORMAL_WORLD) mrc p15, 0, r0, c15, c0, 1 @ read diagnostic register orr r0, r0, #1 << 6 @ set bit #6 mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register #endif -#ifdef CONFIG_ARM_ERRATA_751472 +#if defined(CONFIG_ARM_ERRATA_751472) && !defined(CONFIG_SYS_NORMAL_WORLD) mrc p15, 0, r0, c15, c0, 1 @ read diagnostic register orr r0, r0, #1 << 11 @ set bit #11 mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register #endif -#ifdef CONFIG_ARM_ERRATA_761320 +#if defined(CONFIG_ARM_ERRATA_761320) && !defined(CONFIG_SYS_NORMAL_WORLD) mrc p15, 0, r0, c15, c0, 1 @ read diagnostic register orr r0, r0, #1 << 21 @ set bit #21 mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register #endif -#ifdef CONFIG_ARM_ERRATA_845369 +#if defined(CONFIG_ARM_ERRATA_845369) && !defined(CONFIG_SYS_NORMAL_WORLD) mrc p15, 0, r0, c15, c0, 1 @ read diagnostic register orr r0, r0, #1 << 22 @ set bit #22 mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register
arch/arm/mach-imx/mx7/soc.c +5 -2
@@ -135,7 +135,7 @@ u32 __weak get_board_rev(void)#endif /* enable all periherial can be accessed in nosec mode */ -static void init_csu (void ) +static void __maybe_unused init_csu (void ) {int i =0 ;for (i =0 ; i <CSU_NUM_REGS ; i++)
@@ -164,7 +164,10 @@ int arch_cpu_init(void) {init_aips (); +#ifndef CONFIG_SYS_NORMAL_WORLD init_csu (); +#endif +/* Disable PDE bit of WMCR register */ imx_wdog_disable_powerdown ();
@@ -194,7 +197,7 @@ int arch_misc_init(void)env_set ("soc" ,"imx7s" );#endif -#ifdef CONFIG_FSL_CAAM +#if defined(CONFIG_FSL_CAAM ) && !defined(CONFIG_SYS_NORMAL_WORLD )sec_init ();#endif
arch/arm/mach-imx/syscounter.c +2 -0
@@ -57,6 +57,7 @@ static inline unsigned long long us_to_tick(unsigned long long usec)int timer_init (void ) { +#if !defined(CONFIG_SYS_NORMAL_WORLD )struct sctr_regs *sctr = (struct sctr_regs *)SCTR_BASE_ADDR ;unsigned long val, freq;
@@ -70,6 +71,7 @@ int timer_init(void) val &= ~(SC_CNTCR_FREQ0 |SC_CNTCR_FREQ1 ); val |=SC_CNTCR_FREQ0 |SC_CNTCR_ENABLE |SC_CNTCR_HDBG ;writel (val, &sctr->cntcr); +#endif gd->arch.tbl =0 ; gd->arch.tbu =0 ;
include/configs/mx6_common.h +5 -0
@@ -69,4 +69,9 @@#endif #endif +/* If OPTEE boot is enabled, u-boot proper runs in normal world */ +#if !defined(CONFIG_SPL_BUILD ) && defined(CONFIG_SPL_OPTEE_BOOT ) +#define CONFIG_SYS_NORMAL_WORLD +#endif +#endif
include/configs/mx7_common.h +5 -0
@@ -58,4 +58,9 @@#endif #endif +/* If OPTEE boot is enabled, u-boot proper runs in normal world */ +#if !defined(CONFIG_SPL_BUILD ) && defined(CONFIG_SPL_OPTEE_BOOT ) +#define CONFIG_SYS_NORMAL_WORLD +#endif +#endif
Signature · 1 line
2.16.2.gvfs.1.33.gf5370f1
PATCH 3/11 spl: Add FIT boot into OP-TEE then U-Boot proper
In reply to Henry BebermanFrom: Henry Beberman <[email protected]>
This patch is a part of the i.MX Windows 10 IoT Core boot flow.
It adds an entry path for OP-TEE when loaded from a FIT blob when loadable has the OS type IH_OS_TEE. This booth path flushes and disables caches, disables interrupts, and jumps into OP-TEE passing the entry point for U-Boot Proper in one of the registers.
The CONFIG_SPL_OPTEE_BOOT option enables this boot path, and is also used to automatically set the CONFIG_SYS_NORMAL_WORLD Kconfig option while building U-Boot proper. This is because when OP-TEE returns to U-Boot proper's entry point, it will be in normal mode, so several secure world only initializations need to be omitted.
New Kconfig option:CONFIG_SPL_OPTEE_BOOT - Enables SPL FIT to boot in to OP-TEE, and will set the CONFIG_SYS_NORMAL_WORLD in U-Boot Proper to omit secure world only code.
--- arch/arm/cpu/armv7/Makefile | 1 + arch/arm/cpu/armv7/optee_jump.S | 31 +++++++++++++++++++++++++++++++ arch/arm/lib/spl.c | 16 ++++++++++++++++ common/spl/Kconfig | 9 +++++++++ common/spl/spl.c | 6 ++++++ include/spl.h | 21 +++++++++++++++++++++ 6 files changed, 84 insertions(+) create mode 100644 arch/arm/cpu/armv7/optee_jump.S
arch/arm/cpu/armv7/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_ARMV7_PSCI) += psci.o psci-common.o obj-$(CONFIG_IPROC) += iproc-common/ obj-$(CONFIG_KONA) += kona-common/ obj-$(CONFIG_SYS_ARCH_TIMER) += arch_timer.o +obj-$(CONFIG_SPL_OPTEE_BOOT) += optee_jump.o ifneq (,$(filter s5pc1xx exynos,$(SOC))) obj-y += s5p-common/
arch/arm/cpu/armv7/optee_jump.S new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2018 Microsoft Corporation + */ + +#include <asm-offsets.h> +#include <config.h> +#include <asm/system.h> +#include <linux/linkage.h> + +#ifdef CONFIG_SPL_OPTEE_BOOT + + .globl arch_jump_to_image_optee + +/* + void __noreturn arch_jump_to_image_optee( + u32 optee_entry_point, + u32 pageable_part, + u32 uboot_entry_point + ); +*/ +ENTRY(arch_jump_to_image_optee) + + mov r3, r0 + mov r0, r1 + mov lr, r2 + + bx r3 + +ENDPROC(arch_jump_to_image_optee) +#endif
arch/arm/lib/spl.c +16 -0
@@ -73,3 +73,19 @@ void __noreturn jump_to_image_linux(struct spl_image_info *spl_image) }#endif /* CONFIG_ARM64 */ #endif + +#ifdef CONFIG_SPL_OPTEE_BOOT +void __noreturn arch_jump_to_image_optee (u32 optee_entry_point, +u32 pageable_part, +u32 uboot_entry_point); + +void __noreturn jump_to_image_optee (struct spl_image_info *spl_image) +{ +/* flush and turn off caches before jumping to OPTEE */ +cleanup_before_linux (); + +arch_jump_to_image_optee (spl_image->entry_point, +0 , +CONFIG_SYS_TEXT_BASE ); +} +#endif
common/spl/Kconfig +9 -0
@@ -792,6 +792,15 @@ config SPL_ATF_NO_PLATFORM_PARAM If your ATF is affected, say Y. +config SPL_OPTEE_BOOT + depends on SPL + bool "Enable support for loading OPTEE and jumping to it from SPL" + default n + help + Configure SPL to boot OPTEE. SPL passes the U-Boot proper entry + point as the return address when it jumps to OPTEE, allowing OPTEE + to start U-Boot proper in normal mode when it returns. + config SPL_AM33XX_ENABLE_RTC32K_OSC bool "Enable the RTC32K OSC on AM33xx based platforms" default y if AM33XX
common/spl/spl.c +6 -0
@@ -519,6 +519,12 @@ void board_init_r(gd_t *dummy1, ulong dummy2)spl_invoke_atf (&spl_image);break ;#endif +#ifdef CONFIG_SPL_OPTEE_BOOT +case IH_OS_TEE : +debug ("Jumping to OPTEE\n" ); +jump_to_image_optee (&spl_image); +break ; +#endif #ifdef CONFIG_SPL_OS_BOOT case IH_OS_LINUX :debug ("Jumping to Linux\n" );
include/spl.h +21 -0
@@ -125,6 +125,19 @@ int spl_board_ubi_load_image(u32 boot_device);*/ void __noreturn jump_to_image_linux (struct spl_image_info *spl_image); +#ifdef CONFIG_SPL_OPTEE_BOOT +/** +* jump_to_image_optee() - Jump to OP-TEE from SPL +* +* This jumps into OP-TEE using the information in @spl_image, passing +* it the entry point of U-Boot Proper so it can return there +* in non-secure mode +* +* @spl_image: Image description to set up +*/ +void __noreturn jump_to_image_optee (struct spl_image_info *spl_image); +#endif +/** * spl_start_uboot() - Check if SPL should start the kernel or U-Boot *
@@ -296,4 +309,12 @@ void spl_invoke_atf(struct spl_image_info *spl_image);* can implement 'board_return_to_bootrom'. */ void board_return_to_bootrom (void ); + +#ifdef CONFIG_SPL_OPTEE_BOOT +#include <tee/optee.h> + +struct optee_image_info { +struct optee_header header; +}; +#endif #endif
Signature · 1 line
2.16.2.gvfs.1.33.gf5370f1
PATCH 4/11 spl: imx: Add optional lds to keep SPL entirely in on-chip RAM
In reply to Henry BebermanFrom: Henry Beberman <[email protected]>
This patch is part of the i.MX Windows 10 IoT Core boot flow.
It adds a modified linker script for SPL to keep all segments in on-chip ram. This is to harden the device against potential leaks of device secrets by keeping them out of DRAM.
Additionally if CONFIG_SYS_SPL_MALLOC_START is defined, it will override the CONFIG_SPL_SYS_MALLOC_SIMPLE and allocate space in DRAM instead of on-chip ram. This patch prevents the definition of those values for i.MX6 and i.MX7 SPL if CONFIG_OPTEE_SPL_BOOT is selected.
--- arch/arm/mach-imx/u-boot-spl-sram.lds | 59 +++++++++++++++++++++++++++++++++++ include/configs/imx6_spl.h | 2 ++ include/configs/imx7_spl.h | 2 ++ 3 files changed, 63 insertions(+) create mode 100644 arch/arm/mach-imx/u-boot-spl-sram.lds
arch/arm/mach-imx/u-boot-spl-sram.lds new file +59 -0
@@ -0,0 +1,59 @@ +/* + * (C) Copyright 2002 + * Gary Jennejohn, DENX Software Engineering, <[email protected]> + * + * (C) Copyright 2010 + * Texas Instruments, <www.ti.com> + * Aneesh V <[email protected]> + * + * (C) Copyright 2018 Microsoft Corporation + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\ + LENGTH = CONFIG_SPL_MAX_SIZE } + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(_start) +SECTIONS +{ + .text : + { + __start = .; + *(.vectors) + arch/arm/cpu/armv7/start.o (.text*) + *(.text*) + } >.sram + + . = ALIGN(4); + .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram + + . = ALIGN(4); + .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram + + . = ALIGN(4); + .u_boot_list : { + KEEP(*(SORT(.u_boot_list*))); + } >.sram + + . = ALIGN(4); + __image_copy_end = .; + + .end : + { + *(.__end) + } + + _image_binary_end = .; + + .bss : + { + . = ALIGN(4); + __bss_start = .; + *(.bss*) + . = ALIGN(4); + __bss_end = .; + } >.sram +}
include/configs/imx6_spl.h +2 -0
@@ -51,6 +51,7 @@# endif #endif +#ifndef CONFIG_OPTEE_SPL_BOOT #if defined(CONFIG_MX6SX ) || defined(CONFIG_MX6SL ) || \ defined(CONFIG_MX6UL ) || defined(CONFIG_MX6ULL )#define CONFIG_SPL_BSS_START_ADDR 0x88200000
@@ -63,6 +64,7 @@#define CONFIG_SYS_SPL_MALLOC_START 0x18300000#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000/* 1 MB */ #endif +#endif /* !CONFIG_OPTEE_SPL_BOOT */ #endif #endif
include/configs/imx7_spl.h +2 -0
@@ -46,10 +46,12 @@# endif #endif +#ifndef CONFIG_OPTEE_SPL_BOOT #define CONFIG_SPL_BSS_START_ADDR 0x88200000#define CONFIG_SPL_BSS_MAX_SIZE 0x100000/* 1 MB */ #define CONFIG_SYS_SPL_MALLOC_START 0x88300000#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000/* 1 MB */ +#endif /* !CONFIG_OPTEE_SPL_BOOT */ #endif /* CONFIG_SPL */
Signature · 1 line
2.16.2.gvfs.1.33.gf5370f1
PATCH 4/11 spl: imx: Add optional lds to keep SPL entirely in on-chip RAM
Quoted 4 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch is part of the i.MX Windows 10 IoT Core boot flow.
Quoted 8 lines
It adds a modified linker script for SPL to keep all segments in on-chip ram. This is to harden the device against potential leaks of device secrets by keeping them out of DRAM.
Additionally if
CONFIG_SYS_SPL_MALLOC_STARTis defined, it will override theCONFIG_SPL_SYS_MALLOC_SIMPLEand allocate space in DRAM instead of on-chip ram. This patch prevents the definition of those values for i.MX6 and i.MX7 SPL ifCONFIG_OPTEE_SPL_BOOTis selected.
Is booting SPL from entirely from SRAM only useful in concert with OPTEE?
For instance, if I'm building a device that doesn't use OPTEE and yet want it to be secure, would I want to keep the SPL entirely in SRAM?
PATCH 4/11 spl: imx: Add optional lds to keep SPL entirely in on-chip RAM
Hi Trent,
Quoted 20 lines
-----Original Message-----
From: Trent Piepho <[email protected]>
Sent: Monday, July 16, 2018 10:33 AM
To: Henry Beberman <[email protected]>; u-
boot at lists.denx.de
Cc: fabio.estevam at nxp.com
Subject: Re: [U-Boot] [PATCH 04/11] spl: imx: Add optional lds to keep SPL entirely in on-chip RAMQuoted 10 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch is part of the i.MX Windows 10 IoT Core boot flow.
It adds a modified linker script for SPL to keep all segments in on-chip ram. This is to harden the device against potential leaks of device secrets by keeping them out of DRAM.
Additionally if
CONFIG_SYS_SPL_MALLOC_STARTis defined, it will override theCONFIG_SPL_SYS_MALLOC_SIMPLEand allocate space in
Quoted 8 lines
DRAM
Quoted 2 lines
instead of on-chip ram. This patch prevents the definition of those values for i.MX6 and i.MX7 SPL if
CONFIG_OPTEE_SPL_BOOTis selected.Is booting SPL from entirely from SRAM only useful in concert with OPTEE?
For instance, if I'm building a device that doesn't use OPTEE and yet want it to be secure, would I want to keep the SPL entirely in SRAM?
We're adding this in anticipation of implementing the Trusted Computing Group's Device Identifier Composition Engine (DICE). The reason we're adding it now is to ensure that the SPL we're building fits within the size limitations imposed by SRAM.
The switch to SRAM is primarily to protect the Unique Device Secret (UDS), which is a device specific identifier that must only be readable by DICE. The UDS must not be visible in DRAM at any point. You can find more information on the DICE requirements in the "Hardware Requirements for a Device Identifier Composition Engine" specification. (https://trustedcomputinggroup.org/resource/hardware-requirements-for-a-device-identifier-composition-engine/)
There's value in other devices keeping SPL entirely in SDRAM as an additional layer of security, but it’s a tradeoff against image size and stack/malloc space.
Thanks,
Henry
PATCH 4/11 spl: imx: Add optional lds to keep SPL entirely in on-chip RAM
In reply to Henry BebermanHi Henry,
Quoted 4 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch is part of the i.MX Windows 10 IoT Core boot flow.
Quoted 9 lines
It adds a modified linker script for SPL to keep all segments in on-chip ram. This is to harden the device against potential leaks of device secrets by keeping them out of DRAM.
Additionally if
CONFIG_SYS_SPL_MALLOC_STARTis defined, it will override theCONFIG_SPL_SYS_MALLOC_SIMPLEand allocate space in DRAM instead of on-chip ram. This patch prevents the definition of those values for i.MX6 and i.MX7 SPL ifCONFIG_OPTEE_SPL_BOOTis selected.
I guess there should be some kind of restrictions to be set according to the i.MX6 variant. I have already had some projects where I get rid of all space available on OCRAM. The smaller i.MX6 has just 64KB of RAM - have you tested also on them ? I wonder if there is enough space for all i.MX variants, specially if some other options are enabled.
Quoted 65 lines
Signed-off-by Henry Beberman <[email protected]>Cc Stefano Babic <[email protected]>Cc Fabio Estevam <[email protected]>--- arch/arm/mach-imx/u-boot-spl-sram.lds | 59 +++++++++++++++++++++++++++++++++++ include/configs/imx6_spl.h | 2 ++ include/configs/imx7_spl.h | 2 ++ 3 files changed, 63 insertions(+) create mode 100644 arch/arm/mach-imx/u-boot-spl-sram.ldsarch/arm/mach-imx/u-boot-spl-sram.lds new file +49
-0@@ -0,0 +1,59 @@ +/* + * (C) Copyright 2002 + * Gary Jennejohn, DENX Software Engineering, <[email protected]> + * + * (C) Copyright 2010 + * Texas Instruments, <www.ti.com> + * Aneesh V <[email protected]> + * + * (C) Copyright 2018 Microsoft Corporation + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\ + LENGTH = CONFIG_SPL_MAX_SIZE } + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(_start) +SECTIONS +{ + .text : + { + __start = .; + *(.vectors) + arch/arm/cpu/armv7/start.o (.text*) + *(.text*) + } >.sram + + . = ALIGN(4); + .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram + + . = ALIGN(4); + .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram + + . = ALIGN(4); + .u_boot_list : { + KEEP(*(SORT(.u_boot_list*))); + } >.sram + + . = ALIGN(4); + __image_copy_end = .; + + .end : + { + *(.__end) + } + + _image_binary_end = .;
arch/arm/mach-imx/u-boot-spl-sram.lds line 59
Quoted 10 lines
arch/arm/mach-imx/u-boot-spl-sram.lds new file +10
-0+ + .bss : + { + . = ALIGN(4); + __bss_start = .; + *(.bss*) + . = ALIGN(4); + __bss_end = .; + } >.sram +}
This is more or less a copy of the armv8 version + bss in sram instead of sdram. In any case, mach-imx is not the right place because it is quite SOC independent. The whole i.MX do not use own lds but they are using the general scripts from ARM 32bit.
Quoted 26 lines
include/configs/imx6_spl.h +2
-0@@ -51,6 +51,7 @@# endif #endif +#ifndef CONFIG_OPTEE_SPL_BOOT #if defined(CONFIG_MX6SX ) || defined(CONFIG_MX6SL ) || \ defined(CONFIG_MX6UL ) || defined(CONFIG_MX6ULL )#define CONFIG_SPL_BSS_START_ADDR 0x88200000@@ -63,6 +64,7 @@#define CONFIG_SYS_SPL_MALLOC_START 0x18300000#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000/* 1 MB */ #endif +#endif /* !CONFIG_OPTEE_SPL_BOOT */ #endif #endif include/configs/imx7_spl.h +0
-0@@ -46,10 +46,12 @@# endif
include/configs/imx7_spl.h line 56
Quoted 10 lines
include/configs/imx7_spl.h +2
-0#endif +#ifndef CONFIG_OPTEE_SPL_BOOT #define CONFIG_SPL_BSS_START_ADDR 0x88200000#define CONFIG_SPL_BSS_MAX_SIZE 0x100000/* 1 MB */ #define CONFIG_SYS_SPL_MALLOC_START 0x88300000#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000/* 1 MB */ +#endif /* !CONFIG_OPTEE_SPL_BOOT */ #endif /* CONFIG_SPL */
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 4/11 spl: imx: Add optional lds to keep SPL entirely in on-chip RAM
Hi Stefano,
Quoted 28 lines
-----Original Message-----
From: Stefano Babic <[email protected]>
Sent: Tuesday, August 7, 2018 5:17 AM
To: Henry Beberman <[email protected]>; u-
boot at lists.denx.de
Cc: Stefano Babic <[email protected]>; Fabio Estevam <[email protected]>
Subject: Re: [PATCH 04/11] spl: imx: Add optional lds to keep SPL entirely in on-chip RAMHi Henry,
Quoted 10 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch is part of the i.MX Windows 10 IoT Core boot flow.
It adds a modified linker script for SPL to keep all segments in on-chip ram. This is to harden the device against potential leaks of device secrets by keeping them out of DRAM.
Additionally if
CONFIG_SYS_SPL_MALLOC_STARTis defined, it will override theCONFIG_SPL_SYS_MALLOC_SIMPLEand allocate space inDRAM
Quoted 3 lines
instead of on-chip ram. This patch prevents the definition of those values for i.MX6 and i.MX7 SPL if
CONFIG_OPTEE_SPL_BOOTis selected.
Quoted 5 lines
I guess there should be some kind of restrictions to be set according to the i.MX6 variant. I have already had some projects where I get rid of all space available on OCRAM. The smaller i.MX6 has just 64KB of RAM - have you tested also on them ? I wonder if there is enough space for all i.MX variants, specially if some other options are enabled.
As configured now our SPL binary is only about 32KB. We haven’t run it on any i.MX6 platforms with 64KB of OCRAM, so I'm not sure if we're bypassing 64KB at runtime.
Which i.MX6 configurations have 64KB of OCRAM?
Quoted 81 lines
Quoted 6 lines
Signed-off-by Henry Beberman <[email protected]>Cc Stefano Babic <[email protected]>Cc Fabio Estevam <[email protected]>--- arch/arm/mach-imx/u-boot-spl-sram.lds | 59+++++++++++++++++++++++++++++++++++
Quoted 12 lines
include/configs/imx6_spl.h | 2 ++ include/configs/imx7_spl.h | 2 ++ 3 files changed, 63 insertions(+) create mode 100644 arch/arm/mach-imx/u-boot-spl-sram.ldsarch/arm/mach-imx/u-boot-spl-sram.lds new file +0
-0arch/arm/mach-imx/u-boot-spl-sram.lds line 6
Quoted 6 lines
arch/arm/mach-imx/u-boot-spl-sram.lds new file +6
-0@@ -0,0 +1,59 @@ +/* + * (C) Copyright 2002 + * Gary Jennejohn, DENX Software Engineering, <[email protected]> + * + * (C) Copyright 2010 + * Texas Instruments,<https://na01.safelinks.protection.outlook.com/?url=www.ti.com&dat
a=02%7C01%7CHenry.Beberman%40microsoft.com%7Cd96d8086ca0a4fd87d 5308d5fc5fb1db%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C6366 92410300862003&sdata=RFzlv9uQ5%2BBDtudKWw4aacKgE4B%2Bn1ENE xvM9v2ANew%3D&reserved=0>Quoted 51 lines
arch/arm/mach-imx/u-boot-spl-sram.lds new file +51
-0+ * Aneesh V <[email protected]> + * + * (C) Copyright 2018 Microsoft Corporation + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\ + LENGTH = CONFIG_SPL_MAX_SIZE } + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", +"elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(_start) +SECTIONS +{ + .text : + { + __start = .; + *(.vectors) + arch/arm/cpu/armv7/start.o (.text*) + *(.text*) + } >.sram + + . = ALIGN(4); + .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram + + . = ALIGN(4); + .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram + + . = ALIGN(4); + .u_boot_list : { + KEEP(*(SORT(.u_boot_list*))); + } >.sram + + . = ALIGN(4); + __image_copy_end = .; + + .end : + { + *(.__end) + } + + _image_binary_end = .; + + .bss : + { + . = ALIGN(4); + __bss_start = .; + *(.bss*) + . = ALIGN(4);
Quoted 8 lines
arch/arm/mach-imx/u-boot-spl-sram.lds line 59
Quoted 3 lines
arch/arm/mach-imx/u-boot-spl-sram.lds new file +3
-0+ __bss_end = .; + } >.sram +}This is more or less a copy of the armv8 version + bss in sram instead of sdram. In any case, mach-imx is not the right place because it is quite SOC independent. The whole i.MX do not use own lds but they are using the general scripts from ARM 32bit.
I agree that this isn’t i.MX specific. I took a look at the general ARM32 lds and since it's not splitting the bss into a different region it looks like I just need to set CONFIG_SPL_TEXT_BASE correctly. I'll check with my team to see why we added this lds in the first place, but hopefully I can just get rid of it.
Thanks,
Henry
Quoted 50 lines
Quoted 26 lines
include/configs/imx6_spl.h +2
-0@@ -51,6 +51,7 @@# endif #endif +#ifndef CONFIG_OPTEE_SPL_BOOT #if defined(CONFIG_MX6SX ) || defined(CONFIG_MX6SL ) || \ defined(CONFIG_MX6UL ) || defined(CONFIG_MX6ULL )#define CONFIG_SPL_BSS_START_ADDR 0x88200000@@ -63,6 +64,7 @@#define CONFIG_SYS_SPL_MALLOC_START 0x18300000#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000/* 1 MB */ #endif +#endif /* !CONFIG_OPTEE_SPL_BOOT */ #endif #endif include/configs/imx7_spl.h +0
-0include/configs/imx7_spl.h line 53
Quoted 8 lines
include/configs/imx7_spl.h +1
-0@@ -46,10 +46,12 @@# endif #endif +#ifndef CONFIG_OPTEE_SPL_BOOT #define CONFIG_SPL_BSS_START_ADDR 0x88200000#define CONFIG_SPL_BSS_MAX_SIZE 0x100000/* 1 MB */ #define CONFIG_SYS_SPL_MALLOC_START 0x88300000#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000/* 1 MB */
include/configs/imx7_spl.h line 56
Quoted 3 lines
include/configs/imx7_spl.h +1
-0+#endif /* !CONFIG_OPTEE_SPL_BOOT */ #endif /* CONFIG_SPL */ Best regards,
Stefano Babic--
==========================================================
===========
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
==========================================================
===========
PATCH 5/11 mx6sabresd: Add Windows boot support for iMX6 Sabre
In reply to Henry BebermanFrom: Henry Beberman <[email protected]>
This patch adds a new bootable configuration for Windows 10 IoT Core on the i.MX6 Quad Sabre board.
Add a new device tree sources file for imx6qdl-sdb. This is not required by Windows or UEFI but the build system requires a device tree when building SPL with flat image tree support.
--- arch/arm/dts/Makefile | 1 + arch/arm/dts/imx6qdl-sdb.dts | 8 +++++ board/freescale/mx6sabresd/MAINTAINERS | 2 ++ board/freescale/mx6sabresd/mx6sabresd.c | 9 ++++- configs/mx6sabresd_nt_defconfig | 58 +++++++++++++++++++++++++++++++++ include/configs/mx6sabre_common.h | 10 ++++++ 6 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/imx6qdl-sdb.dts create mode 100644 configs/mx6sabresd_nt_defconfig
arch/arm/dts/Makefile +1 -0
@@ -410,6 +410,7 @@ dtb-$(CONFIG_MX6QDL) += \ imx6dl-icore-mipi.dtb \ imx6dl-icore-rqs.dtb \ imx6dl-mamoj.dtb \ + imx6qdl-sdb.dtb \ imx6q-cm-fx6.dtb \ imx6q-icore.dtb \ imx6q-icore-mipi.dtb \
arch/arm/dts/imx6qdl-sdb.dts new file +8 -0
@@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Microsoft Corporation + */ + +/dts-v1/; + +#include "imx6q.dtsi"
board/freescale/mx6sabresd/MAINTAINERS +2 -0
@@ -4,3 +4,5 @@ S: Maintained F: board/freescale/mx6sabresd/ F: include/configs/mx6sabresd.h F: configs/mx6sabresd_defconfig +F: configs/mx6sabresd_nt_defconfig +F: arch/arm/dts/imx6qdl-sdb.dts
board/freescale/mx6sabresd/mx6sabresd.c +8 -1
@@ -229,7 +229,14 @@ static struct i2c_pads_info mx6dl_i2c_pad_info1 = { } }; -static void setup_spi (void ) +#if defined(CONFIG_MULTI_DTB_FIT ) || defined(CONFIG_SPL_LOAD_FIT ) +int board_fit_config_name_match (const char *name) +{ +return 0 ; +} +#endif + +static void __maybe_unused setup_spi (void ) {SETUP_IOMUX_PADS (ecspi1_pads); }
configs/mx6sabresd_nt_defconfig new file +58 -0
59 lines not on this page · raw message
include/configs/mx6sabre_common.h +10 -0
@@ -56,6 +56,15 @@#define EMMC_ENV ""#endif +#ifdef CONFIG_UEFI_BOOT +#include <config_uefi_bootcmd.h> + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "mmcdev=1\0" \ + BOOTENV + +#else +#define CONFIG_EXTRA_ENV_SETTINGS \ "script=boot.scr\0" \ "image=zImage\0" \
@@ -166,6 +175,7 @@"fi; " \"fi; " \ "else run netboot; fi" +#endif /* CONFIG_UEFI_BOOT */ #define CONFIG_ARP_TIMEOUT 200UL
Signature · 1 line
2.16.2.gvfs.1.33.gf5370f1
PATCH 6/11 mx7dsabresd: Add Windows boot support for iMX7 Sabre
In reply to Henry BebermanFrom: Henry Beberman <[email protected]>
This patch adds a new bootable configuration for Windows 10 IoT Core on the i.MX7 Dual Sabre board.
It enables SPL on the i.MX7 Sabre in order to support the FIT load of OP-TEE and U-Boot proper.
--- arch/arm/mach-imx/mx7/Kconfig | 1 + board/freescale/mx7dsabresd/MAINTAINERS | 1 + board/freescale/mx7dsabresd/mx7dsabresd.c | 79 +++++++++++++++++++++++ configs/mx7dsabresd_nt_defconfig | 102 ++++++++++++++++++++++++++++++ drivers/gpio/Makefile | 3 + drivers/pinctrl/nxp/pinctrl-imx7.c | 4 +- include/configs/mx7dsabresd.h | 10 +++ 7 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 configs/mx7dsabresd_nt_defconfig
arch/arm/mach-imx/mx7/Kconfig +1 -0
@@ -33,6 +33,7 @@ config TARGET_MX7DSABRESD select MX7D select DM select DM_THERMAL + select SUPPORT_SPL config TARGET_PICO_IMX7D bool "pico-imx7d"
board/freescale/mx7dsabresd/MAINTAINERS +1 -0
@@ -4,3 +4,4 @@ S: Maintained F: board/freescale/mx7dsabresd F: include/configs/mx7dsabresd.h F: configs/mx7dsabresd_defconfig +F: configs/mx7dsabresd_nt_defconfig
board/freescale/mx7dsabresd/mx7dsabresd.c +79 -0
94 lines not on this page · raw message
configs/mx7dsabresd_nt_defconfig new file +102 -0
103 lines not on this page · raw message
drivers/gpio/Makefile +3 -0
@@ -7,10 +7,13 @@ ifndef CONFIG_SPL_BUILD obj-$(CONFIG_DWAPB_GPIO) += dwapb_gpio.o obj-$(CONFIG_AXP_GPIO) += axp_gpio.o endif + +ifeq ($(CONFIG_$(SPL_TPL_)DM),y) obj-$(CONFIG_DM_GPIO) += gpio-uclass.o obj-$(CONFIG_DM_PCA953X) += pca953x_gpio.o obj-$(CONFIG_DM_74X164) += 74x164_gpio.o +endif obj-$(CONFIG_AT91_GPIO) += at91_gpio.o obj-$(CONFIG_ATMEL_PIO4) += atmel_pio4.o
drivers/pinctrl/nxp/pinctrl-imx7.c +3 -1
@@ -9,7 +9,9 @@#include "pinctrl-imx.h" -static struct imx_pinctrl_soc_info imx7_pinctrl_soc_info; +static struct imx_pinctrl_soc_info imx7_pinctrl_soc_info = { + .flags =ZERO_OFFSET_VALID , +};static struct imx_pinctrl_soc_info imx7_lpsr_pinctrl_soc_info = { .flags =ZERO_OFFSET_VALID ,
include/configs/mx7dsabresd.h +10 -0
@@ -9,6 +9,7 @@#define __MX7D_SABRESD_CONFIG_H#include "mx7_common.h" +#include "imx7_spl.h" #define CONFIG_DBG_MONITOR #define PHYS_SDRAM_SIZE SZ_1G
@@ -65,6 +66,14 @@#define UPDATE_M4_ENV ""#endif +#ifdef CONFIG_UEFI_BOOT +#include <config_uefi_bootcmd.h> + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "mmcdev=0\0" \ + "console=ttymxc0\0" \ + BOOTENV +#else #define CONFIG_MFG_ENV_SETTINGS \ "mfgtool_args=setenv bootargs console=${console},${baudrate} " \ "rdinit=/linuxrc " \
@@ -161,6 +170,7 @@"fi; " \"fi; " \ "else run netboot; fi" +#endif /* CONFIG_UEFI_BOOT */ #define CONFIG_SYS_MEMTEST_START 0x80000000#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 0x20000000)
Signature · 1 line
2.16.2.gvfs.1.33.gf5370f1
PATCH 6/11 mx7dsabresd: Add Windows boot support for iMX7 Sabre
Quoted 14 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch adds a new bootable configuration for Windows 10 IoT Core on the i.MX7 Dual Sabre board.
It enables SPL on the i.MX7 Sabre in order to support the FIT load of OP-TEE and U-Boot proper.
drivers/gpio/Makefile +0
-0
drivers/gpio/Makefile ifndef CONFIG_SPL_BUILD · line 16
Quoted 10 lines
drivers/gpio/Makefile +3
-0@@ -7,10 +7,13 @@ ifndef CONFIG_SPL_BUILD obj-$(CONFIG_DWAPB_GPIO) += dwapb_gpio.o obj-$(CONFIG_AXP_GPIO) += axp_gpio.o endif + +ifeq ($(CONFIG_$(SPL_TPL_)DM),y) obj-$(CONFIG_DM_GPIO) += gpio-uclass.o obj-$(CONFIG_DM_PCA953X) += pca953x_gpio.o obj-$(CONFIG_DM_74X164) += 74x164_gpio.o +endif
It doesn't look like this patch is specific to mx7 or Windows. Perhaps it should be in a different commit?
Also, the help text for SPL_DM says it turns on basic DM support in SPL. But not any specific hardware drivers. Those all have additional config options to turn them on. It doesn't seems right to bundle a selection of GPIO drivers along with CONFIG_SPL_DM.
PATCH 6/11 mx7dsabresd: Add Windows boot support for iMX7 Sabre
Quoted 31 lines
-----Original Message-----
From: Trent Piepho <[email protected]>
Sent: Monday, July 16, 2018 11:22 AM
To: Henry Beberman <[email protected]>; u- boot at lists.denx.de
Cc: fabio.estevam at nxp.com; adrian.alonso at nxp.com
Subject: Re: [U-Boot] [PATCH 06/11] mx7dsabresd: Add Windows boot support for iMX7 SabreQuoted 21 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch adds a new bootable configuration for Windows 10 IoT Core on the i.MX7 Dual Sabre board.
It enables SPL on the i.MX7 Sabre in order to support the FIT load of OP-TEE and U-Boot proper.
drivers/gpio/Makefile index renamed from drivers/gpio/Makefile +0
-0
f186120684..3fb9b72703100644drivers/gpio/Makefile +2
-0@@ -7,10 +7,13 @@ ifndef CONFIG_SPL_BUILD obj-$(CONFIG_DWAPB_GPIO) += dwapb_gpio.o obj-$(CONFIG_AXP_GPIO) += axp_gpio.o endif + +ifeq ($(CONFIG_$(SPL_TPL_)DM),y) obj-$(CONFIG_DM_GPIO) += gpio-uclass.o
Quoted 6 lines
drivers/gpio/Makefile ifndef CONFIG_SPL_BUILD · line 16
Quoted 3 lines
drivers/gpio/Makefile +1
-0obj-$(CONFIG_DM_PCA953X) += pca953x_gpio.o obj-$(CONFIG_DM_74X164) += 74x164_gpio.o +endifIt doesn't look like this patch is specific to mx7 or Windows. Perhaps it should be in a different commit?
I agree that this change probably belongs in its own patch.
I've left it in this patch so far because it's required to build the new mx7dsabresd_nt_defconfig.
Quoted 4 lines
Also, the help text for
SPL_DMsays it turns on basic DM support in SPL. But not any specific hardware drivers. Those all have additional config options to turn them on. It doesn't seems right to bundle a selection of GPIO drivers along withCONFIG_SPL_DM.
This issue has cropped up because this patch adds SPL support to mx7dsabresd, but intentionally does not enable SPL_DM.
The defconfig contains CONFIG_DM_74X164 for use in U-Boot Proper, but because drivers/gpio/Makefile also runs during the SPL portion of the build that config still pulls in the 74X164 driver which fails to build due to missing dependencies.
Wrapping the DM objects in CONFIG_$(SPL_TPL_)DM ensures that DM is actually enabled for the current portion of the build when deciding to build the DM drivers.
Thanks,
Henry
PATCH 6/11 mx7dsabresd: Add Windows boot support for iMX7 Sabre
Quoted 37 lines · Henry Beberman
Quoted 30 lines
-----Original Message-----
From: Trent Piepho <[email protected]>
Sent: Monday, July 16, 2018 11:22 AM
To: Henry Beberman <[email protected]>; u- boot at lists.denx.de
Cc: fabio.estevam at nxp.com; adrian.alonso at nxp.com
Subject: Re: [U-Boot] [PATCH 06/11] mx7dsabresd: Add Windows boot support for iMX7 SabreQuoted 20 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch adds a new bootable configuration for Windows 10 IoT Core on the i.MX7 Dual Sabre board.
It enables SPL on the i.MX7 Sabre in order to support the FIT load of OP-TEE and U-Boot proper.
drivers/gpio/Makefile index renamed from drivers/gpio/Makefile +0
-0
f186120684..3fb9b72703100644drivers/gpio/Makefile +2
-0@@ -7,10 +7,13 @@ ifndef CONFIG_SPL_BUILD obj-$(CONFIG_DWAPB_GPIO) += dwapb_gpio.o obj-$(CONFIG_AXP_GPIO) += axp_gpio.o endif + +ifeq ($(CONFIG_$(SPL_TPL_)DM),y) obj-$(CONFIG_DM_GPIO) += gpio-uclass.oQuoted 6 lines
drivers/gpio/Makefile ifndef CONFIG_SPL_BUILD · line 16
Quoted 3 lines
drivers/gpio/Makefile +1
-0obj-$(CONFIG_DM_PCA953X) += pca953x_gpio.o obj-$(CONFIG_DM_74X164) += 74x164_gpio.o +endifIt doesn't look like this patch is specific to mx7 or Windows. Perhaps it should be in a different commit?
Quoted 2 lines
I agree that this change probably belongs in its own patch.
I've left it in this patch so far because it's required to build the newmx7dsabresd_nt_defconfig.
Easy enough to split out and put first. The person on different hardware trying to figure out the u-boot build spaghetti it's helped much knowing the person who added it was working on windows 10 support, but nothing about the reason for this change.
Quoted 9 lines
Quoted 4 lines
Also, the help text for
SPL_DMsays it turns on basic DM support in SPL. But not any specific hardware drivers. Those all have additional config options to turn them on. It doesn't seems right to bundle a selection of GPIO drivers along withCONFIG_SPL_DM.This issue has cropped up because this patch adds SPL support to mx7dsabresd, but intentionally does not enable
SPL_DM.
The defconfig containsCONFIG_DM_74X164for use in U-Boot Proper, but becausedrivers/gpio/Makefilealso runs during the SPL portion of the build that config still pulls in the 74X164 driver which fails to build due to missing dependencies.Wrapping the DM objects in CONFIG_$(SPL_TPL_)DM ensures that DM is actually enabled for the current portion of the build when deciding to build the DM drivers.
But isn't it odd that not a single other driver is wrapped this way? What's special here?
I think the underlying flaw is the the kbuild system doesn't support the concept of building multiple times in different modes, e.g. main, SPL, TPL. And rather than design something, one gets layers of board specific hacks.
PATCH 6/11 mx7dsabresd: Add Windows boot support for iMX7 Sabre
Quoted 72 lines
-----Original Message-----
From: Trent Piepho <[email protected]>
Sent: Tuesday, July 17, 2018 10:03 AM
To: Henry Beberman <[email protected]>; u- boot at lists.denx.de
Cc: fabio.estevam at nxp.com; adrian.alonso at nxp.com
Subject: Re: [U-Boot] [PATCH 06/11] mx7dsabresd: Add Windows boot support for iMX7 SabreQuoted 37 lines · Henry Beberman
Quoted 30 lines
-----Original Message-----
From: Trent Piepho <[email protected]>
Sent: Monday, July 16, 2018 11:22 AM
To: Henry Beberman <[email protected]>; u- boot at lists.denx.de
Cc: fabio.estevam at nxp.com; adrian.alonso at nxp.com
Subject: Re: [U-Boot] [PATCH 06/11] mx7dsabresd: Add Windows boot support for iMX7 SabreQuoted 20 lines · Henry Beberman
From: Henry Beberman <[email protected]>
This patch adds a new bootable configuration for Windows 10 IoT Core on the i.MX7 Dual Sabre board.
It enables SPL on the i.MX7 Sabre in order to support the FIT load of OP-TEE and U-Boot proper.
drivers/gpio/Makefile index renamed from drivers/gpio/Makefile +0
-0
f186120684..3fb9b72703100644drivers/gpio/Makefile +2
-0@@ -7,10 +7,13 @@ ifndef CONFIG_SPL_BUILD obj-$(CONFIG_DWAPB_GPIO) += dwapb_gpio.o obj-$(CONFIG_AXP_GPIO) += axp_gpio.o endif + +ifeq ($(CONFIG_$(SPL_TPL_)DM),y) obj-$(CONFIG_DM_GPIO) += gpio-uclass.oQuoted 6 lines
drivers/gpio/Makefile ifndef CONFIG_SPL_BUILD · line 16
Quoted 3 lines
drivers/gpio/Makefile +1
-0obj-$(CONFIG_DM_PCA953X) += pca953x_gpio.o obj-$(CONFIG_DM_74X164) += 74x164_gpio.o +endifIt doesn't look like this patch is specific to mx7 or Windows. Perhaps it should be in a different commit?
Quoted 2 lines
I agree that this change probably belongs in its own patch. I've left it in this patch so far because it's required to build the new
mx7dsabresd_nt_defconfig.Easy enough to split out and put first. The person on different hardware trying to figure out the u-boot build spaghetti it's helped much knowing the person who added it was working on windows 10 support, but nothing about the reason for this change.
Quoted 6 lines
Quoted 4 lines
Also, the help text for
SPL_DMsays it turns on basic DM support in SPL. But not any specific hardware drivers. Those all have additional config options to turn them on. It doesn't seems right to bundle a selection of GPIO drivers along withCONFIG_SPL_DM.This issue has cropped up because this patch adds SPL support to
mx7dsabresd, but intentionally does not enable
SPL_DM.Quoted 1 line
The defconfig contains
CONFIG_DM_74X164for use in U-Boot Proper, butbecause
drivers/gpio/Makefilealso runs during the SPL portion of the build that config still pulls in the 74X164 driver which fails to build due to missing dependencies.Quoted 2 lines
Wrapping the DM objects in CONFIG_$(SPL_TPL_)DM ensures that DM is
actually enabled for the current portion of the build when deciding to build the DM drivers.
Quoted 6 lines
But isn't it odd that not a single other driver is wrapped this way? What's special here?
I think the underlying flaw is the the kbuild system doesn't support the concept of building multiple times in different modes, e.g. main, SPL, TPL. And rather than design something, one gets layers of board specific hacks.
There are a few other instances of omitting DM drivers from SPL due to size concerns, see drivers/power/regulator/Makefile (commit a35332f) and drivers/mmc/Makefile (commit c4d660d)
However instead of wrapping the block in CONFIG_$(SPL_TPL_)DM, the intended way is to include $(SPL_) in line with the driver you need to disable for SPL.
- obj-$(CONFIG_DM_74X164) += 74x164_gpio.o
+ obj-$(CONFIG_$(SPL_)DM_74X164) += 74x164_gpio.o
I'll switch to this in-line method and split out this change into a separate patch so the commit message explains it in isolation.
Thanks,
Henry
PATCH 7/11 mx6cuboxi: Add Windows boot support for mx6cuboxi
In reply to Henry BebermanFrom: Henry Beberman <[email protected]>
This patch adds a new bootable configuration for Windows 10 IoT Core on the i.MX6 Quad HummingBoard.
It also adds a new device tree sources file for imx6qdl-mx6cuboxi.dts. This is not required by Windows or UEFI but the build system requires a device tree when building SPL with flat image tree support.
--- arch/arm/dts/Makefile | 1 + arch/arm/dts/imx6qdl-mx6cuboxi.dts | 8 +++++ board/solidrun/mx6cuboxi/MAINTAINERS | 2 ++ board/solidrun/mx6cuboxi/mx6cuboxi.c | 7 ++++ configs/mx6cuboxi_nt_defconfig | 62 ++++++++++++++++++++++++++++++++++++ include/configs/mx6cuboxi.h | 8 +++++ 6 files changed, 88 insertions(+) create mode 100644 arch/arm/dts/imx6qdl-mx6cuboxi.dts create mode 100644 configs/mx6cuboxi_nt_defconfig
arch/arm/dts/Makefile +1 -0
@@ -411,6 +411,7 @@ dtb-$(CONFIG_MX6QDL) += \ imx6dl-icore-rqs.dtb \ imx6dl-mamoj.dtb \ imx6qdl-sdb.dtb \ + imx6qdl-mx6cuboxi.dtb \ imx6q-cm-fx6.dtb \ imx6q-icore.dtb \ imx6q-icore-mipi.dtb \
arch/arm/dts/imx6qdl-mx6cuboxi.dts new file +8 -0
@@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Microsoft Corporation + */ + +/dts-v1/; + +#include "imx6q.dtsi"
board/solidrun/mx6cuboxi/MAINTAINERS +2 -0
@@ -4,3 +4,5 @@ S: Maintained F: board/solidrun/mx6cuboxi/ F: include/configs/mx6cuboxi.h F: configs/mx6cuboxi_defconfig +F: configs/mx6cuboxi_nt_defconfig +F: arch/arm/dts/imx6qdl-mx6cuboxi.dts
board/solidrun/mx6cuboxi/mx6cuboxi.c +7 -0
@@ -143,6 +143,13 @@ static iomux_v3_cfg_t const usb_pads[] = { IOMUX_PADS(PAD_GPIO_0__GPIO1_IO00 | MUX_PAD_CTRL(NO_PAD_CTRL)), }; +#if defined(CONFIG_MULTI_DTB_FIT ) || defined(CONFIG_SPL_LOAD_FIT ) +int board_fit_config_name_match (const char *name) +{ +return 0 ; +} +#endif +static void setup_iomux_uart (void ) {SETUP_IOMUX_PADS (uart1_pads);
configs/mx6cuboxi_nt_defconfig new file +62 -0
63 lines not on this page · raw message
include/configs/mx6cuboxi.h +8 -0
@@ -71,6 +71,13 @@#define CONFIG_SYS_MMC_ENV_DEV 0/* SDHC2 */ #ifndef CONFIG_SPL_BUILD +#ifdef CONFIG_UEFI_BOOT +#include <config_uefi_bootcmd.h> + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "mmcdev=0\0" \ + BOOTENV +#else #define CONFIG_EXTRA_ENV_SETTINGS \ "fdtfile=undefined\0" \ "fdt_addr_r=0x18000000\0" \
@@ -125,6 +132,7 @@ func(DHCP, dhcp, na)#include <config_distro_bootcmd.h> +#endif /* CONFIG_UEFI_BOOT */ #else #define CONFIG_EXTRA_ENV_SETTINGS
Signature · 1 line
2.16.2.gvfs.1.33.gf5370f1
PATCH 8/11 udoo_neo: Add Windows boot support for UDOO Neo
In reply to Henry BebermanFrom: Henry Beberman <[email protected]>
This patch adds a new bootable configuration for Windows 10 IoT Core on the i.MX6 SoloX UDOO Neo.
It also adds a new device tree sources file for imx6sx-udoo-neo.dts. This is not required by Windows or UEFI but the build system requires a device tree when building SPL with flat image tree support.
--- arch/arm/dts/Makefile | 1 + arch/arm/dts/imx6sx-udoo-neo.dts | 8 ++++++ board/udoo/neo/MAINTAINERS | 2 ++ board/udoo/neo/neo.c | 7 +++++ configs/udoo_neo_nt_defconfig | 55 ++++++++++++++++++++++++++++++++++++++++ include/configs/udoo_neo.h | 8 ++++++ 6 files changed, 81 insertions(+) create mode 100644 arch/arm/dts/imx6sx-udoo-neo.dts create mode 100644 configs/udoo_neo_nt_defconfig
arch/arm/dts/Makefile +1 -0
@@ -424,6 +424,7 @@ dtb-$(CONFIG_MX6SL) += imx6sll-evk.dtb dtb-$(CONFIG_MX6SX) += \ imx6sx-sabreauto.dtb \ + imx6sx-udoo-neo.dtb \ imx6sx-sdb.dtb dtb-$(CONFIG_MX6UL) += \
arch/arm/dts/imx6sx-udoo-neo.dts new file +8 -0
@@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Microsoft Corporation + */ + +/dts-v1/; + +#include "imx6sx.dtsi"
board/udoo/neo/MAINTAINERS +2 -0
@@ -5,3 +5,5 @@ S: Maintained F: board/udoo/neo/ F: include/configs/udoo_neo.h F: configs/udoo_neo_defconfig +F: configs/udoo_neo_nt_defconfig +F: arch/arm/dts/imx6sx-udoo-neo.dts
board/udoo/neo/neo.c +7 -0
@@ -593,3 +593,10 @@ void board_init_f(ulong dummy) }#endif + +#if defined(CONFIG_MULTI_DTB_FIT ) || defined(CONFIG_SPL_LOAD_FIT ) +int board_fit_config_name_match (const char *name) +{ +return 0 ; +} +#endif
configs/udoo_neo_nt_defconfig new file +55 -0
56 lines not on this page · raw message
include/configs/udoo_neo.h +8 -0
@@ -25,6 +25,13 @@#define CONFIG_MXC_UART_BASE UART1_BASE#define CONFIG_SYS_MMC_ENV_DEV 0/*USDHC2*/ +#ifdef CONFIG_UEFI_BOOT +#include <config_uefi_bootcmd.h> + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "mmcdev=0\0" \ + BOOTENV +#else /* Linux only */ #define CONFIG_EXTRA_ENV_SETTINGS \ "console=ttymxc0,115200\0" \
@@ -58,6 +65,7 @@ func(DHCP, dhcp, na)#include <config_distro_bootcmd.h> +#endif /* CONFIG_UEFI_BOOT */ /* Miscellaneous configurable options */ #define CONFIG_SYS_MEMTEST_START 0x80000000
Signature · 1 line
2.16.2.gvfs.1.33.gf5370f1
PATCH 9/11 cl-som-imx7: Add Windows boot support for cl-som-imx7
In reply to Henry BebermanFrom: Henry Beberman <[email protected]>
This patch adds a new bootable configuration for Windows 10 IoT Core on the Compulab CL-SOM-iMX7.
It also adds a new device tree sources file for imx7d-cl-som-imx7.dts. This is not required by Windows or UEFI but the build system requires a device tree when building SPL with flat image tree support.
Baseboard I2C is required for display initialization. This commit patch doesn't use display during U-Boot, but it needs to setup and MUX the baseboard I2C for use in UEFI when the GOP driver initializes.
--- arch/arm/dts/Makefile | 1 + arch/arm/dts/imx7d-cl-som-imx7.dts | 8 ++++ board/compulab/cl-som-imx7/MAINTAINERS | 2 + board/compulab/cl-som-imx7/cl-som-imx7.c | 47 +++++++++++++++++-- board/compulab/cl-som-imx7/spl.c | 7 +++ configs/cl-som-imx7_nt_defconfig | 80 ++++++++++++++++++++++++++++++++ include/configs/cl-som-imx7.h | 18 ++++++- 7 files changed, 159 insertions(+), 4 deletions(-) create mode 100644 arch/arm/dts/imx7d-cl-som-imx7.dts create mode 100644 configs/cl-som-imx7_nt_defconfig
arch/arm/dts/Makefile +1 -0
@@ -436,6 +436,7 @@ dtb-$(CONFIG_MX6UL) += \ dtb-$(CONFIG_MX6ULL) += imx6ull-14x14-evk.dtb dtb-$(CONFIG_MX7) += imx7-colibri.dtb \ + imx7d-cl-som-imx7.dtb \ imx7d-sdb.dtb dtb-$(CONFIG_ARCH_MX7ULP) += imx7ulp-evk.dtb
arch/arm/dts/imx7d-cl-som-imx7.dts new file +8 -0
@@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Microsoft Corporation + */ + +/dts-v1/; + +#include "imx7d.dtsi"
board/compulab/cl-som-imx7/MAINTAINERS +2 -0
@@ -4,3 +4,5 @@ S: Maintained F: board/compulab/cl-som-imx7 F: include/configs/cl-som-imx7.h F: configs/cl-som-imx7_defconfig +F: configs/cl-som-imx7_nt_defconfig +F: arch/arm/dts/imx7d-cl-som-imx7.dts
board/compulab/cl-som-imx7/cl-som-imx7.c +44 -3
71 lines not on this page · raw message
board/compulab/cl-som-imx7/spl.c +7 -0
@@ -208,3 +208,10 @@ void board_boot_order(u32 *spl_boot_list)break ; } } + +#if defined(CONFIG_MULTI_DTB_FIT ) || defined(CONFIG_SPL_LOAD_FIT ) +int board_fit_config_name_match (const char *name) +{ +return 0 ; +} +#endif
configs/cl-som-imx7_nt_defconfig new file +80 -0
80 lines not on this page · raw message
include/configs/cl-som-imx7.h +17 -1
@@ -19,9 +19,13 @@#define CONFIG_BOARD_LATE_INIT +#ifndef CONFIG_SECURE_BOOT +#ifndef CONFIG_CSF_SIZE +#define CONFIG_CSF_SIZE 0x4000 +#endif +#endif /* CONFIG_SECURE_BOOT */ /* Uncomment to enable secure boot support */ /* #define CONFIG_SECURE_BOOT */ -#define CONFIG_CSF_SIZE 0x4000/* Network */ #define CONFIG_FEC_MXC
@@ -63,6 +67,16 @@#undef CONFIG_SYS_AUTOLOAD#undef CONFIG_EXTRA_ENV_SETTINGS + +#ifdef CONFIG_UEFI_BOOT +#include <config_uefi_bootcmd.h> + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "mmcdev=0\0" \ + "displaytype=dvi\0" \ + "baseboard_i2c_enable=true\0" \ + BOOTENV +#else #undef CONFIG_BOOTCOMMAND#undef CONFIG_BOOTDELAY
@@ -126,6 +140,8 @@"echo eMMC boot attempt ...; run emmcbootscript; run emmcboot; " \ "echo USB boot attempt ...; run usbbootscript; " +#endif /* CONFIG_UEFI_BOOT */ +#define CONFIG_SYS_MEMTEST_START 0x80000000#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 0x20000000)
Signature · 1 line
2.16.2.gvfs.1.33.gf5370f1
PATCH 10/11 imx: Reserve a global page in memory to pass configuration to UEFI
In reply to Henry BebermanFrom: Henry Beberman <[email protected]>
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.
--- 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
arch/arm/mach-imx/Kconfig +7 -0
@@ -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.
arch/arm/mach-imx/Makefile +1 -0
@@ -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
arch/arm/mach-imx/boot.c +6 -0
@@ -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);
arch/arm/mach-imx/global_page.c new file +28 -0
@@ -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 ) +{ +}
include/configs/mx6_common.h +11 -0
@@ -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
include/configs/mx7_common.h +5 -0
@@ -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
include/global_page.h new file +24 -0
@@ -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
Signature · 1 line
2.16.2.gvfs.1.33.gf5370f1
PATCH 11/11 imx: Add MAC addresses to global page to pass MAC into UEFI
In reply to Henry BebermanFrom: Henry Beberman <[email protected]>
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.
--- 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(-)
arch/arm/mach-imx/Kconfig +16 -0
@@ -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.
arch/arm/mach-imx/global_page.c +25 -1
@@ -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 ); }
configs/cl-som-imx7_nt_defconfig +2 -0
@@ -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
configs/mx6cuboxi_nt_defconfig +2 -0
@@ -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
configs/mx6sabresd_nt_defconfig +2 -0
@@ -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
configs/udoo_neo_nt_defconfig +2 -0
@@ -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
include/global_page.h +8 -0
@@ -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
Signature · 1 line
2.16.2.gvfs.1.33.gf5370f1