diff options
68 files changed, 753 insertions, 239 deletions
@@ -1681,7 +1681,14 @@ The following options need to be configured: to generate and write the Backup GUID Partition Table.) This occurs when the specified "partition name" on the "fastboot flash" command line matches this value. - Default is GPT_ENTRY_NAME (currently "gpt") if undefined. + The default is "gpt" if undefined. + + CONFIG_FASTBOOT_MBR_NAME + The fastboot "flash" command supports writing the downloaded + image to DOS MBR. + This occurs when the "partition name" specified on the + "fastboot flash" command line matches this value. + If not defined the default value "mbr" is used. - Journaling Flash filesystem support: CONFIG_JFFS2_NAND, CONFIG_JFFS2_NAND_OFF, CONFIG_JFFS2_NAND_SIZE, diff --git a/arch/Kconfig b/arch/Kconfig index d718a68171..ffc7b45379 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -62,6 +62,7 @@ config SANDBOX bool "Sandbox" select SUPPORT_OF_CONTROL select DM + select DM_KEYBOARD select DM_SPI_FLASH select DM_SERIAL select DM_I2C @@ -83,6 +84,7 @@ config X86 select HAVE_PRIVATE_LIBGCC select SUPPORT_OF_CONTROL select DM + select DM_KEYBOARD select DM_SERIAL select DM_GPIO select DM_SPI diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 382a73f73e..f55d5b2cd7 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -335,38 +335,6 @@ config TARGET_BRPPT1 select CPU_V7 select SUPPORT_SPL -config TARGET_CM_T335 - bool "Support cm_t335" - select CPU_V7 - select SUPPORT_SPL - select DM - select DM_SERIAL - select DM_GPIO - -config TARGET_PEPPER - bool "Support pepper" - select CPU_V7 - select SUPPORT_SPL - select DM - select DM_SERIAL - select DM_GPIO - -config TARGET_AM335X_IGEP0033 - bool "Support am335x_igep0033" - select CPU_V7 - select SUPPORT_SPL - select DM - select DM_SERIAL - select DM_GPIO - -config TARGET_PCM051 - bool "Support pcm051" - select CPU_V7 - select SUPPORT_SPL - select DM - select DM_SERIAL - select DM_GPIO - config TARGET_DRACO bool "Support draco" select CPU_V7 @@ -415,62 +383,6 @@ config TARGET_RUT select DM_SERIAL select DM_GPIO -config TARGET_PENGWYN - bool "Support pengwyn" - select CPU_V7 - select SUPPORT_SPL - select DM - select DM_SERIAL - select DM_GPIO - -config TARGET_AM335X_BALTOS - bool "Support am335x_baltos" - select CPU_V7 - select SUPPORT_SPL - select DM - select DM_SERIAL - select DM_GPIO - -config TARGET_AM335X_EVM - bool "Support am335x_evm" - select CPU_V7 - select SUPPORT_SPL - select DM - select DM_SERIAL - select DM_GPIO - select TI_I2C_BOARD_DETECT - -config TARGET_AM335X_SHC - bool "Support am335x based shc board from bosch" - select CPU_V7 - select SUPPORT_SPL - select DM - select DM_SERIAL - select DM_GPIO - -config TARGET_AM335X_SL50 - bool "Support am335x_sl50" - select CPU_V7 - select SUPPORT_SPL - select DM - select DM_GPIO - select DM_SERIAL - -config TARGET_BAV335X - bool "Support bav335x" - select CPU_V7 - select SUPPORT_SPL - select DM - select DM_SERIAL - help - The BAV335x OEM Network Processor integrates all the functions of an - embedded network computer in a small, easy to use SODIMM module which - incorporates the popular Texas Instruments Sitara 32bit ARM Coretex-A8 - processor, with fast DDR3 512MB SDRAM, 4GB of embedded MMC and a Gigabit - ethernet with simple connection to external connectors. - - For more information, visit: http://birdland.com/oem - config TARGET_TI814X_EVM bool "Support ti814x_evm" select CPU_V7 @@ -600,6 +512,17 @@ config AM43XX protocols, dual camera support, optional 3D graphics and an optional customer programmable secure boot. +config AM33XX + bool "AM33XX SoC" + select CPU_V7 + select SUPPORT_SPL + help + Support for AM335x SOC from Texas Instruments. + The AM335x high performance SOC features a Cortex-A8 + ARM core, a dual core PRU-ICSS for industrial Ethernet + protocols, optional 3D graphics and an optional customer + programmable secure boot. + config ARCH_RMOBILE bool "Renesas ARM SoCs" select DM diff --git a/arch/arm/cpu/armv7/am33xx/Kconfig b/arch/arm/cpu/armv7/am33xx/Kconfig index 2d7d1fc4f1..8fd32c2a46 100644 --- a/arch/arm/cpu/armv7/am33xx/Kconfig +++ b/arch/arm/cpu/armv7/am33xx/Kconfig @@ -1,3 +1,88 @@ +if AM33XX + +choice + prompt "AM33xx board select" + optional + +config TARGET_AM335X_EVM + bool "Support am335x_evm" + select DM + select DM_SERIAL + select DM_GPIO + select TI_I2C_BOARD_DETECT + help + This option specifies support for the AM335x + GP and HS EVM development platforms. The AM335x + GP EVM is a standalone test, development, and + evaluation module system that enables developers + to write software and develop hardware around + an AM335x processor subsystem. + +config TARGET_AM335X_BALTOS + bool "Support am335x_baltos" + select DM + select DM_SERIAL + select DM_GPIO + +config TARGET_AM335X_IGEP0033 + bool "Support am335x_igep0033" + select DM + select DM_SERIAL + select DM_GPIO + +config TARGET_AM335X_SHC + bool "Support am335x based shc board from bosch" + select DM + select DM_SERIAL + select DM_GPIO + +config TARGET_AM335X_SL50 + bool "Support am335x_sl50" + select DM + select DM_SERIAL + select DM_GPIO + +config TARGET_BAV335X + bool "Support bav335x" + select DM + select DM_SERIAL + help + The BAV335x OEM Network Processor integrates all the functions of an + embedded network computer in a small, easy to use SODIMM module which + incorporates the popular Texas Instruments Sitara 32bit ARM Coretex-A8 + processor, with fast DDR3 512MB SDRAM, 4GB of embedded MMC and a Gigabit + ethernet with simple connection to external connectors. + + For more information, visit: http://birdland.com/oem + +config TARGET_CM_T335 + bool "Support cm_t335" + select DM + select DM_SERIAL + select DM_GPIO + +config TARGET_PCM051 + bool "Support pcm051" + select DM + select DM_SERIAL + select DM_GPIO + +config TARGET_PENGWYN + bool "Support pengwyn" + select DM + select DM_SERIAL + select DM_GPIO + +config TARGET_PEPPER + bool "Support pepper" + select DM + select DM_SERIAL + select DM_GPIO + +endchoice + +endif + if AM43XX config SPL_EXT_SUPPORT @@ -19,7 +104,9 @@ config TARGET_AM43XX_EVM evaluation module system that enables developers to write software and develop hardware around an AM43xx processor subsystem. +endif +if AM43XX || AM33XX config ISW_ENTRY_ADDR hex "Address in memory or XIP flash of bootloader entry point" help diff --git a/arch/arm/cpu/armv7/am33xx/config.mk b/arch/arm/cpu/armv7/am33xx/config.mk index d4eb21ca14..87b76d96a8 100644 --- a/arch/arm/cpu/armv7/am33xx/config.mk +++ b/arch/arm/cpu/armv7/am33xx/config.mk @@ -12,16 +12,32 @@ ifeq ($(CONFIG_TI_SECURE_DEVICE),y) # For booting from SPI use # u-boot-spl_HS_SPI_X-LOADER to program flash # -# For booting spl from all other media -# use u-boot-spl_HS_ISSW +# On AM43XX: +# +# For booting spl from all other media use +# u-boot-spl_HS_ISSW +# +# On AM33XX: +# +# For booting spl from NAND flash use +# u-boot-spl_HS_X-LOADER +# +# For booting spl from SD/MMC/eMMC media use +# u-boot-spl_HS_MLO +# +# For booting spl over UART, USB, or Ethernet use +# u-boot-spl_HS_2ND # # Refer to README.ti-secure for more info # ALL-y += u-boot-spl_HS_ISSW -ALL-$(CONFIG_SPL_SPI_SUPPORT) += u-boot-spl_HS_SPI_X-LOADER +ALL-y += u-boot-spl_HS_SPI_X-LOADER +ALL-y += u-boot-spl_HS_X-LOADER +ALL-y += u-boot-spl_HS_MLO +ALL-y += u-boot-spl_HS_2ND else ALL-y += MLO -ALL-$(CONFIG_SPL_SPI_SUPPORT) += MLO.byteswap +ALL-y += MLO.byteswap endif else ifeq ($(CONFIG_TI_SECURE_DEVICE),y) diff --git a/arch/arm/cpu/armv7/omap-common/Kconfig b/arch/arm/cpu/armv7/omap-common/Kconfig index 7b39506ae8..4daccd93ff 100644 --- a/arch/arm/cpu/armv7/omap-common/Kconfig +++ b/arch/arm/cpu/armv7/omap-common/Kconfig @@ -1,6 +1,6 @@ config TI_SECURE_DEVICE bool "HS Device Type Support" - depends on OMAP54XX || AM43XX + depends on OMAP54XX || AM43XX || AM33XX help If a high secure (HS) device type is being used, this config must be set. This option impacts various aspects of the diff --git a/arch/arm/cpu/armv7/omap-common/emif-common.c b/arch/arm/cpu/armv7/omap-common/emif-common.c index 2b790105b0..b26984e26c 100644 --- a/arch/arm/cpu/armv7/omap-common/emif-common.c +++ b/arch/arm/cpu/armv7/omap-common/emif-common.c @@ -14,6 +14,7 @@ #include <asm/arch/clock.h> #include <asm/arch/sys_proto.h> #include <asm/omap_common.h> +#include <asm/omap_sec_common.h> #include <asm/utils.h> #include <linux/compiler.h> @@ -1477,6 +1478,20 @@ void sdram_init(void) debug("get_ram_size() successful"); } +#if defined(CONFIG_TI_SECURE_DEVICE) + /* + * On HS devices, do static EMIF firewall configuration + * but only do it if not already running in SDRAM + */ + if (!in_sdram) + if (0 != secure_emif_reserve()) + hang(); + + /* On HS devices, ensure static EMIF firewall APIs are locked */ + if (0 != secure_emif_firewall_lock()) + hang(); +#endif + if (sdram_type == EMIF_SDRAM_TYPE_DDR3 && (!in_sdram && !warm_reset()) && (!is_dra7xx())) { if (emif1_enabled) diff --git a/arch/arm/cpu/armv7/omap5/Kconfig b/arch/arm/cpu/armv7/omap5/Kconfig index ef68c535df..a947ba4d98 100644 --- a/arch/arm/cpu/armv7/omap5/Kconfig +++ b/arch/arm/cpu/armv7/omap5/Kconfig @@ -57,6 +57,32 @@ endchoice config SYS_SOC default "omap5" +config TI_SECURE_EMIF_REGION_START + hex "Reserved EMIF region start address" + depends on TI_SECURE_DEVICE + default 0x0 + help + Reserved EMIF region start address. Set to "0" to auto-select + to be at the end of the external memory region. + +config TI_SECURE_EMIF_TOTAL_REGION_SIZE + hex "Reserved EMIF region size" + depends on TI_SECURE_DEVICE + default 0x0 + help + Total reserved EMIF region size. Default is 0, which means no reserved EMIF + region on secure devices. + +config TI_SECURE_EMIF_PROTECTED_REGION_SIZE + hex "Size of protected region within reserved EMIF region" + depends on TI_SECURE_DEVICE + default 0x0 + help + This config option is used to specify the size of the portion of the total + reserved EMIF region set aside for secure OS needs that will be protected + using hardware memory firewalls. This value must be smaller than the + TI_SECURE_EMIF_TOTAL_REGION_SIZE value. + source "board/compulab/cm_t54/Kconfig" source "board/ti/omap5_uevm/Kconfig" source "board/ti/dra7xx/Kconfig" diff --git a/arch/arm/cpu/armv7/omap5/Makefile b/arch/arm/cpu/armv7/omap5/Makefile index 3caba86791..0212df73c1 100644 --- a/arch/arm/cpu/armv7/omap5/Makefile +++ b/arch/arm/cpu/armv7/omap5/Makefile @@ -14,3 +14,4 @@ obj-y += hw_data.o obj-y += abb.o obj-y += fdt.o obj-$(CONFIG_IODELAY_RECALIBRATION) += dra7xx_iodelay.o +obj-$(CONFIG_TI_SECURE_DEVICE) += sec-fxns.o diff --git a/arch/arm/cpu/armv7/omap5/fdt.c b/arch/arm/cpu/armv7/omap5/fdt.c index 0493cd1eab..da8d59bb59 100644 --- a/arch/arm/cpu/armv7/omap5/fdt.c +++ b/arch/arm/cpu/armv7/omap5/fdt.c @@ -153,13 +153,73 @@ static int ft_hs_fixup_sram(void *fdt, bd_t *bd) static int ft_hs_fixup_sram(void *fdt, bd_t *bd) { return 0; } #endif +#if (CONFIG_TI_SECURE_EMIF_TOTAL_REGION_SIZE != 0) +static int ft_hs_fixup_dram(void *fdt, bd_t *bd) +{ + const char *path, *subpath; + int offs; + u32 sec_mem_start = CONFIG_TI_SECURE_EMIF_REGION_START; + u32 sec_mem_size = CONFIG_TI_SECURE_EMIF_TOTAL_REGION_SIZE; + fdt64_t temp[2]; + + /* If start address is zero, place at end of DRAM */ + if (0 == sec_mem_start) + sec_mem_start = + (CONFIG_SYS_SDRAM_BASE + + (omap_sdram_size() - sec_mem_size)); + + /* Delete any original secure_reserved node */ + path = "/reserved-memory/secure_reserved"; + offs = fdt_path_offset(fdt, path); + if (offs >= 0) + fdt_del_node(fdt, offs); + + /* Add new secure_reserved node */ + path = "/reserved-memory"; + offs = fdt_path_offset(fdt, path); + if (offs < 0) { + debug("Node %s not found\n", path); + path = "/"; + subpath = "reserved-memory"; + fdt_path_offset(fdt, path); + offs = fdt_add_subnode(fdt, offs, subpath); + if (offs < 0) { + printf("Could not create %s%s node.\n", path, subpath); + return 1; + } + path = "/reserved-memory"; + offs = fdt_path_offset(fdt, path); + } + + subpath = "secure_reserved"; + offs = fdt_add_subnode(fdt, offs, subpath); + if (offs < 0) { + printf("Could not create %s%s node.\n", path, subpath); + return 1; + } + + temp[0] = cpu_to_fdt64(((u64)sec_mem_start)); + temp[1] = cpu_to_fdt64(((u64)sec_mem_size)); + fdt_setprop_string(fdt, offs, "compatible", + "ti,dra7-secure-memory"); + fdt_setprop_string(fdt, offs, "status", "okay"); + fdt_setprop(fdt, offs, "no-map", NULL, 0); + fdt_setprop(fdt, offs, "reg", temp, sizeof(temp)); + + return 0; +} +#else +static int ft_hs_fixup_dram(void *fdt, bd_t *bd) { return 0; } +#endif + static void ft_hs_fixups(void *fdt, bd_t *bd) { /* Check we are running on an HS/EMU device type */ if (GP_DEVICE != get_device_type()) { if ((ft_hs_fixup_crossbar(fdt, bd) == 0) && (ft_hs_disable_rng(fdt, bd) == 0) && - (ft_hs_fixup_sram(fdt, bd) == 0)) + (ft_hs_fixup_sram(fdt, bd) == 0) && + (ft_hs_fixup_dram(fdt, bd) == 0)) return; } else { printf("ERROR: Incorrect device type (GP) detected!"); @@ -171,7 +231,7 @@ static void ft_hs_fixups(void *fdt, bd_t *bd) static void ft_hs_fixups(void *fdt, bd_t *bd) { } -#endif +#endif /* #ifdef CONFIG_TI_SECURE_DEVICE */ /* * Place for general cpu/SoC FDT fixups. Board specific diff --git a/arch/arm/cpu/armv7/omap5/sec-fxns.c b/arch/arm/cpu/armv7/omap5/sec-fxns.c new file mode 100644 index 0000000000..33d4ea4eac --- /dev/null +++ b/arch/arm/cpu/armv7/omap5/sec-fxns.c @@ -0,0 +1,126 @@ +/* + * + * Security related functions for OMAP5 class devices + * + * (C) Copyright 2016 + * Texas Instruments, <www.ti.com> + * + * Daniel Allred <d-allred@ti.com> + * Harinarayan Bhatta <harinarayan@ti.com> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> +#include <stdarg.h> + +#include <asm/arch/sys_proto.h> +#include <asm/omap_common.h> +#include <asm/omap_sec_common.h> +#include <asm/spl.h> +#include <spl.h> + +/* Index for signature PPA-based TI HAL APIs */ +#define PPA_HAL_SERVICES_START_INDEX (0x200) +#define PPA_SERV_HAL_SETUP_SEC_RESVD_REGION (PPA_HAL_SERVICES_START_INDEX + 25) +#define PPA_SERV_HAL_SETUP_EMIF_FW_REGION (PPA_HAL_SERVICES_START_INDEX + 26) +#define PPA_SERV_HAL_LOCK_EMIF_FW (PPA_HAL_SERVICES_START_INDEX + 27) + +static u32 get_sec_mem_start(void) +{ + u32 sec_mem_start = CONFIG_TI_SECURE_EMIF_REGION_START; + u32 sec_mem_size = CONFIG_TI_SECURE_EMIF_TOTAL_REGION_SIZE; + /* + * Total reserved region is all contiguous with protected + * region coming first, followed by the non-secure region. + * If 0x0 start address is given, we simply put the reserved + * region at the end of the external DRAM. + */ + if (sec_mem_start == 0) + sec_mem_start = + (CONFIG_SYS_SDRAM_BASE + + (omap_sdram_size() - sec_mem_size)); + return sec_mem_start; +} + +int secure_emif_firewall_setup(uint8_t region_num, uint32_t start_addr, + uint32_t size, uint32_t access_perm, + uint32_t initiator_perm) +{ + int result = 1; + + /* + * Call PPA HAL API to do any other general firewall + * configuration for regions 1-6 of the EMIF firewall. + */ + debug("%s: regionNum = %x, startAddr = %x, size = %x", __func__, + region_num, start_addr, size); + + result = secure_rom_call( + PPA_SERV_HAL_SETUP_EMIF_FW_REGION, 0, 0, 4, + (start_addr & 0xFFFFFFF0) | (region_num & 0x0F), + size, access_perm, initiator_perm); + + if (result != 0) { + puts("Secure EMIF Firewall Setup failed!\n"); + debug("Return Value = %x\n", result); + } + + return result; +} + +#if (CONFIG_TI_SECURE_EMIF_TOTAL_REGION_SIZE < \ + CONFIG_TI_SECURE_EMIF_PROTECTED_REGION_SIZE) +#error "TI Secure EMIF: Protected size cannot be larger than total size." +#endif +int secure_emif_reserve(void) +{ + int result = 1; + u32 sec_mem_start = get_sec_mem_start(); + u32 sec_prot_size = CONFIG_TI_SECURE_EMIF_PROTECTED_REGION_SIZE; + + /* If there is no protected region, there is no reservation to make */ + if (sec_prot_size == 0) + return 0; + + /* + * Call PPA HAL API to reserve a chunk of EMIF SDRAM + * for secure world use. This region should be carved out + * from use by any public code. EMIF firewall region 7 + * will be used to protect this block of memory. + */ + result = secure_rom_call( + PPA_SERV_HAL_SETUP_SEC_RESVD_REGION, + 0, 0, 2, sec_mem_start, sec_prot_size); + + if (result != 0) { + puts("SDRAM Firewall: Secure memory reservation failed!\n"); + debug("Return Value = %x\n", result); + } + + return result; +} + +int secure_emif_firewall_lock(void) +{ + int result = 1; + + /* + * Call PPA HAL API to lock the EMIF firewall configurations. + * After this API is called, none of the PPA HAL APIs for + * configuring the EMIF firewalls will be usable again (that + * is, calls to those APIs will return failure and have no + * effect). + */ + + result = secure_rom_call( + PPA_SERV_HAL_LOCK_EMIF_FW, + 0, 0, 0); + + if (result != 0) { + puts("Secure EMIF Firewall Lock failed!\n"); + debug("Return Value = %x\n", result); + } + + return result; +} diff --git a/arch/arm/include/asm/omap_sec_common.h b/arch/arm/include/asm/omap_sec_common.h index 842f2af8d1..4bde93f804 100644 --- a/arch/arm/include/asm/omap_sec_common.h +++ b/arch/arm/include/asm/omap_sec_common.h @@ -27,4 +27,28 @@ u32 secure_rom_call(u32 service, u32 proc_id, u32 flag, ...); */ int secure_boot_verify_image(void **p_image, size_t *p_size); +/* + * Invoke a secure HAL API that allows configuration of the external memory + * firewall regions. + */ +int secure_emif_firewall_setup(uint8_t region_num, uint32_t start_addr, + uint32_t size, uint32_t access_perm, + uint32_t initiator_perm); + +/* + * Invoke a secure HAL API on high-secure (HS) device variants that reserves a + * region of external memory for secure world use, and protects it using memory + * firewalls that prevent public world access. This API is intended to setaside + * memory that will be used for a secure world OS/TEE. + */ +int secure_emif_reserve(void); + +/* + * Invoke a secure HAL API to lock the external memory firewall configurations. + * After this API is called, none of the HAL APIs for configuring the that + * firewall will be usable (calls to those APIs will return failure and have + * no effect). + */ +int secure_emif_firewall_lock(void); + #endif /* _OMAP_SEC_COMMON_H_ */ diff --git a/arch/arm/mach-keystone/cmd_mon.c b/arch/arm/mach-keystone/cmd_mon.c index 6a9bdc9601..591e75826b 100644 --- a/arch/arm/mach-keystone/cmd_mon.c +++ b/arch/arm/mach-keystone/cmd_mon.c @@ -9,14 +9,16 @@ #include <common.h> #include <command.h> +#include <image.h> #include <mach/mon.h> asm(".arch_extension sec\n\t"); static int do_mon_install(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - u32 addr, dpsc_base = 0x1E80000, freq; + u32 addr, dpsc_base = 0x1E80000, freq, load_addr, size; int rcode = 0; + struct image_header *header; if (argc < 2) return CMD_RET_USAGE; @@ -25,9 +27,21 @@ static int do_mon_install(cmd_tbl_t *cmdtp, int flag, int argc, addr = simple_strtoul(argv[1], NULL, 16); - rcode = mon_install(addr, dpsc_base, freq); - printf("## installed monitor, freq [%d], status %d\n", - freq, rcode); + header = (struct image_header *)addr; + + if (image_get_magic(header) != IH_MAGIC) { + printf("## Please update monitor image\n"); + return -EFAULT; + } + + load_addr = image_get_load(header); + size = image_get_data_size(header); + memcpy((void *)load_addr, (void *)(addr + sizeof(struct image_header)), + size); + + rcode = mon_install(load_addr, dpsc_base, freq); + printf("## installed monitor @ 0x%x, freq [%d], status %d\n", + load_addr, freq, rcode); return 0; } diff --git a/arch/arm/mach-keystone/ddr3.c b/arch/arm/mach-keystone/ddr3.c index 34606f4b2f..6b92530e42 100644 --- a/arch/arm/mach-keystone/ddr3.c +++ b/arch/arm/mach-keystone/ddr3.c @@ -65,9 +65,8 @@ void ddr3_init_ddrphy(u32 base, struct ddr3_phy_config *phy_cfg) while ((__raw_readl(base + KS2_DDRPHY_PGSR0_OFFSET) & 0x1) != 0x1) ; - /* Disable ECC for K2G */ if (cpu_is_k2g()) { - clrbits_le32(base + KS2_DDRPHY_DATX8_4_OFFSET, 0x1); + setbits_le32(base + KS2_DDRPHY_DATX8_4_OFFSET, 0x1); clrbits_le32(base + KS2_DDRPHY_DATX8_5_OFFSET, 0x1); clrbits_le32(base + KS2_DDRPHY_DATX8_6_OFFSET, 0x1); clrbits_le32(base + KS2_DDRPHY_DATX8_7_OFFSET, 0x1); diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index d4c1ee0662..c931c0b437 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -25,7 +25,4 @@ config PCI used on some devices to allow the CPU to communicate with its peripherals. -config DM_KEYBOARD - default y - endmenu diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 5193ee7159..ac2d598d66 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -546,12 +546,6 @@ config I8254_TIMER Intel 8254 timer contains three counters which have fixed uses. Include this to have U-Boot set up the timer correctly. -config I8042_KEYB - default y - -config DM_KEYBOARD - default y - config SEABIOS bool "Support booting SeaBIOS" help diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 56f4984f47..0ed16ca15a 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -25,6 +25,7 @@ #include <asm/io.h> #include <asm/emif.h> #include <asm/gpio.h> +#include <asm/omap_sec_common.h> #include <i2c.h> #include <miiphy.h> #include <cpsw.h> @@ -775,3 +776,10 @@ int board_fit_config_name_match(const char *name) return -1; } #endif + +#ifdef CONFIG_TI_SECURE_DEVICE +void board_fit_image_post_process(void **p_image, size_t *p_size) +{ + secure_boot_verify_image(p_image, p_size); +} +#endif diff --git a/board/ti/ks2_evm/board.c b/board/ti/ks2_evm/board.c index 1de7df00b4..03254e1497 100644 --- a/board/ti/ks2_evm/board.c +++ b/board/ti/ks2_evm/board.c @@ -50,6 +50,9 @@ int dram_init(void) if (ddr3_size) ddr3_init_ecc(KS2_DDR3A_EMIF_CTRL_BASE, ddr3_size); + else + ddr3_init_ecc(KS2_DDR3A_EMIF_CTRL_BASE, gd->ram_size >> 30); + return 0; } diff --git a/cmd/fastboot/Kconfig b/cmd/fastboot/Kconfig index a93d1c09e7..5d2facc298 100644 --- a/cmd/fastboot/Kconfig +++ b/cmd/fastboot/Kconfig @@ -50,11 +50,35 @@ config FASTBOOT_FLASH config FASTBOOT_FLASH_MMC_DEV int "Define FASTBOOT MMC FLASH default device" + depends on FASTBOOT_FLASH help The fastboot "flash" command requires additional information regarding the non-volatile storage device. Define this to the eMMC device that fastboot should use to store the image. +config FASTBOOT_GPT_NAME + string "Target name for updating GPT" + depends on FASTBOOT_FLASH + default "gpt" + help + The fastboot "flash" command supports writing the downloaded + image to the Protective MBR and the Primary GUID Partition + Table. (Additionally, this downloaded image is post-processed + to generate and write the Backup GUID Partition Table.) + This occurs when the specified "partition name" on the + "fastboot flash" command line matches the value defined here. + The default target name for updating GPT is "gpt". + +config FASTBOOT_MBR_NAME + string "Target name for updating MBR" + depends on FASTBOOT_FLASH + default "mbr" + help + The fastboot "flash" command allows to write the downloaded image + to the Master Boot Record. This occurs when the "partition name" + specified on the "fastboot flash" command line matches the value + defined here. The default target name for updating MBR is "mbr". + endif # USB_FUNCTION_FASTBOOT endmenu diff --git a/common/bootm.c b/common/bootm.c index a4d22a6ec4..b2c09126ce 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -619,10 +619,8 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], if (!ret && (states & BOOTM_STATE_FINDOS)) ret = bootm_find_os(cmdtp, flag, argc, argv); - if (!ret && (states & BOOTM_STATE_FINDOTHER)) { + if (!ret && (states & BOOTM_STATE_FINDOTHER)) ret = bootm_find_other(cmdtp, flag, argc, argv); - argc = 0; /* consume the args */ - } /* Load the OS */ if (!ret && (states & BOOTM_STATE_LOADOS)) { diff --git a/common/fb_mmc.c b/common/fb_mmc.c index 8d0524da78..81a3bd0633 100644 --- a/common/fb_mmc.c +++ b/common/fb_mmc.c @@ -14,20 +14,29 @@ #include <mmc.h> #include <div64.h> +/* + * FIXME: Ensure we always set these names via Kconfig once xxx_PARTITION is + * migrated + */ #ifndef CONFIG_FASTBOOT_GPT_NAME -#define CONFIG_FASTBOOT_GPT_NAME GPT_ENTRY_NAME +#define CONFIG_FASTBOOT_GPT_NAME "gpt" +#endif + + +#ifndef CONFIG_FASTBOOT_MBR_NAME +#define CONFIG_FASTBOOT_MBR_NAME "mbr" #endif struct fb_mmc_sparse { struct blk_desc *dev_desc; }; -static int part_get_info_efi_by_name_or_alias(struct blk_desc *dev_desc, +static int part_get_info_by_name_or_alias(struct blk_desc *dev_desc, const char *name, disk_partition_t *info) { int ret; - ret = part_get_info_efi_by_name(dev_desc, name, info); + ret = part_get_info_by_name(dev_desc, name, info); if (ret) { /* strlen("fastboot_partition_alias_") + 32(part_name) + 1 */ char env_alias_name[25 + 32 + 1]; @@ -38,7 +47,7 @@ static int part_get_info_efi_by_name_or_alias(struct blk_desc *dev_desc, strncat(env_alias_name, name, 32); aliased_part_name = getenv(env_alias_name); if (aliased_part_name != NULL) - ret = part_get_info_efi_by_name(dev_desc, + ret = part_get_info_by_name(dev_desc, aliased_part_name, info); } return ret; @@ -103,6 +112,7 @@ void fb_mmc_flash_write(const char *cmd, void *download_buffer, return; } +#ifdef CONFIG_EFI_PARTITION if (strcmp(cmd, CONFIG_FASTBOOT_GPT_NAME) == 0) { printf("%s: updating MBR, Primary and Backup GPT(s)\n", __func__); @@ -114,14 +124,36 @@ void fb_mmc_flash_write(const char *cmd, void *download_buffer, } if (write_mbr_and_gpt_partitions(dev_desc, download_buffer)) { printf("%s: writing GPT partitions failed\n", __func__); - fastboot_fail( - "writing GPT partitions failed"); + fastboot_fail("writing GPT partitions failed"); return; } printf("........ success\n"); fastboot_okay(""); return; - } else if (part_get_info_efi_by_name_or_alias(dev_desc, cmd, &info)) { + } +#endif + +#ifdef CONFIG_DOS_PARTITION + if (strcmp(cmd, CONFIG_FASTBOOT_MBR_NAME) == 0) { + printf("%s: updating MBR\n", __func__); + if (is_valid_dos_buf(download_buffer)) { + printf("%s: invalid MBR - refusing to write to flash\n", + __func__); + fastboot_fail("invalid MBR partition"); + return; + } + if (write_mbr_partition(dev_desc, download_buffer)) { + printf("%s: writing MBR partition failed\n", __func__); + fastboot_fail("writing MBR partition failed"); + return; + } + printf("........ success\n"); + fastboot_okay(""); + return; + } +#endif + + if (part_get_info_by_name_or_alias(dev_desc, cmd, &info)) { error("cannot find partition: '%s'\n", cmd); fastboot_fail("cannot find partition"); return; @@ -172,7 +204,7 @@ void fb_mmc_erase(const char *cmd) return; } - ret = part_get_info_efi_by_name_or_alias(dev_desc, cmd, &info); + ret = part_get_info_by_name_or_alias(dev_desc, cmd, &info); if (ret) { error("cannot find partition: '%s'", cmd); fastboot_fail("cannot find partition"); diff --git a/configs/am335x_baltos_defconfig b/configs/am335x_baltos_defconfig index 16cdea10a4..79af348546 100644 --- a/configs/am335x_baltos_defconfig +++ b/configs/am335x_baltos_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_AM335X_BALTOS=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/configs/am335x_boneblack_defconfig b/configs/am335x_boneblack_defconfig index 2ef1aff0ec..1049a6de73 100644 --- a/configs/am335x_boneblack_defconfig +++ b/configs/am335x_boneblack_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_AM335X_EVM=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_SPL_STACK_R_ADDR=0x82000000 diff --git a/configs/am335x_boneblack_vboot_defconfig b/configs/am335x_boneblack_vboot_defconfig index 15b33a4ae6..e0110d1e50 100644 --- a/configs/am335x_boneblack_vboot_defconfig +++ b/configs/am335x_boneblack_vboot_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_AM335X_EVM=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_SPL_STACK_R_ADDR=0x82000000 diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig index 67c458fa2b..a2cfef37da 100644 --- a/configs/am335x_evm_defconfig +++ b/configs/am335x_evm_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_AM335X_EVM=y CONFIG_SPL_STACK_R_ADDR=0x82000000 CONFIG_DEFAULT_DEVICE_TREE="am335x-evm" diff --git a/configs/am335x_evm_nor_defconfig b/configs/am335x_evm_nor_defconfig index 38662b9e66..1f12facc39 100644 --- a/configs/am335x_evm_nor_defconfig +++ b/configs/am335x_evm_nor_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_AM335X_EVM=y CONFIG_SPL_STACK_R_ADDR=0x82000000 CONFIG_NOR=y diff --git a/configs/am335x_evm_norboot_defconfig b/configs/am335x_evm_norboot_defconfig index 7546033e59..26c9329455 100644 --- a/configs/am335x_evm_norboot_defconfig +++ b/configs/am335x_evm_norboot_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_AM335X_EVM=y CONFIG_NOR=y CONFIG_FIT=y diff --git a/configs/am335x_evm_spiboot_defconfig b/configs/am335x_evm_spiboot_defconfig index 4a0770ec11..8acebb53e7 100644 --- a/configs/am335x_evm_spiboot_defconfig +++ b/configs/am335x_evm_spiboot_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_AM335X_EVM=y # CONFIG_SPL_NAND_SUPPORT is not set CONFIG_SPL_SPI_FLASH_SUPPORT=y diff --git a/configs/am335x_evm_usbspl_defconfig b/configs/am335x_evm_usbspl_defconfig index 006d58a6a4..1c3e04d733 100644 --- a/configs/am335x_evm_usbspl_defconfig +++ b/configs/am335x_evm_usbspl_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_AM335X_EVM=y CONFIG_SPL_STACK_R_ADDR=0x82000000 CONFIG_FIT=y diff --git a/configs/am335x_igep0033_defconfig b/configs/am335x_igep0033_defconfig index 20888966c3..bfba30525a 100644 --- a/configs/am335x_igep0033_defconfig +++ b/configs/am335x_igep0033_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_AM335X_IGEP0033=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/configs/am335x_shc_defconfig b/configs/am335x_shc_defconfig index 0c241e002c..5eabd99e16 100644 --- a/configs/am335x_shc_defconfig +++ b/configs/am335x_shc_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_AM335X_SHC=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/configs/am335x_shc_ict_defconfig b/configs/am335x_shc_ict_defconfig index 084cc2824c..93bbf313ab 100644 --- a/configs/am335x_shc_ict_defconfig +++ b/configs/am335x_shc_ict_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_AM335X_SHC=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/configs/am335x_shc_netboot_defconfig b/configs/am335x_shc_netboot_defconfig index 8cc40c80e5..6e8a9bf29d 100644 --- a/configs/am335x_shc_netboot_defconfig +++ b/configs/am335x_shc_netboot_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_AM335X_SHC=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/configs/am335x_shc_prompt_defconfig b/configs/am335x_shc_prompt_defconfig index caa004a55b..1ce8700d37 100644 --- a/configs/am335x_shc_prompt_defconfig +++ b/configs/am335x_shc_prompt_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_AM335X_SHC=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/configs/am335x_shc_sdboot_defconfig b/configs/am335x_shc_sdboot_defconfig index 83041d9e1d..ee8ed06b20 100644 --- a/configs/am335x_shc_sdboot_defconfig +++ b/configs/am335x_shc_sdboot_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_AM335X_SHC=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/configs/am335x_shc_sdboot_prompt_defconfig b/configs/am335x_shc_sdboot_prompt_defconfig index 83041d9e1d..ee8ed06b20 100644 --- a/configs/am335x_shc_sdboot_prompt_defconfig +++ b/configs/am335x_shc_sdboot_prompt_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_AM335X_SHC=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/configs/am335x_sl50_defconfig b/configs/am335x_sl50_defconfig index 92b5dc077c..9dba3f01f8 100644 --- a/configs/am335x_sl50_defconfig +++ b/configs/am335x_sl50_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_AM335X_SL50=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/configs/birdland_bav335a_defconfig b/configs/birdland_bav335a_defconfig index 3e72b9b5ec..d87c342979 100644 --- a/configs/birdland_bav335a_defconfig +++ b/configs/birdland_bav335a_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_BAV335X=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/configs/birdland_bav335b_defconfig b/configs/birdland_bav335b_defconfig index 28a27821b6..f4bc68706b 100644 --- a/configs/birdland_bav335b_defconfig +++ b/configs/birdland_bav335b_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_BAV335X=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/configs/cm_t335_defconfig b/configs/cm_t335_defconfig index 40fe8619ee..f1353537e8 100644 --- a/configs/cm_t335_defconfig +++ b/configs/cm_t335_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_CM_T335=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/configs/pcm051_rev1_defconfig b/configs/pcm051_rev1_defconfig index d55e4fe92c..dfe9da3a4c 100644 --- a/configs/pcm051_rev1_defconfig +++ b/configs/pcm051_rev1_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_PCM051=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/configs/pcm051_rev3_defconfig b/configs/pcm051_rev3_defconfig index cc824e6cd4..61102e02df 100644 --- a/configs/pcm051_rev3_defconfig +++ b/configs/pcm051_rev3_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_PCM051=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/configs/pengwyn_defconfig b/configs/pengwyn_defconfig index 135a40f453..feec566c3e 100644 --- a/configs/pengwyn_defconfig +++ b/configs/pengwyn_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_PENGWYN=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/configs/pepper_defconfig b/configs/pepper_defconfig index 17cd66fb30..a6f00c6657 100644 --- a/configs/pepper_defconfig +++ b/configs/pepper_defconfig @@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_AM33XX=y CONFIG_TARGET_PEPPER=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y diff --git a/disk/part.c b/disk/part.c index 6a1c02d9fa..9f51a07676 100644 --- a/disk/part.c +++ b/disk/part.c @@ -615,3 +615,61 @@ cleanup: free(dup_str); return ret; } + +int part_get_info_by_name(struct blk_desc *dev_desc, const char *name, + disk_partition_t *info) +{ + struct part_driver *first_drv = + ll_entry_start(struct part_driver, part_driver); + const int n_drvs = ll_entry_count(struct part_driver, part_driver); + struct part_driver *part_drv; + + for (part_drv = first_drv; part_drv != first_drv + n_drvs; part_drv++) { + int ret; + int i; + for (i = 1; i < part_drv->max_entries; i++) { + ret = part_drv->get_info(dev_desc, i, info); + if (ret != 0) { + /* no more entries in table */ + break; + } + if (strcmp(name, (const char *)info->name) == 0) { + /* matched */ + return 0; + } + } + } + return -1; +} + +void part_set_generic_name(const struct blk_desc *dev_desc, + int part_num, char *name) +{ + char *devtype; + + switch (dev_desc->if_type) { + case IF_TYPE_IDE: + case IF_TYPE_SATA: + case IF_TYPE_ATAPI: + devtype = "hd"; + break; + case IF_TYPE_SCSI: + devtype = "sd"; + break; + case IF_TYPE_USB: + devtype = "usbd"; + break; + case IF_TYPE_DOC: + devtype = "docd"; + break; + case IF_TYPE_MMC: + case IF_TYPE_SD: + devtype = "mmcsd"; + break; + default: + devtype = "xx"; + break; + } + + sprintf(name, "%s%c%d", devtype, 'a' + dev_desc->devnum, part_num); +} diff --git a/disk/part_amiga.c b/disk/part_amiga.c index d4316b858c..25fe56ce42 100644 --- a/disk/part_amiga.c +++ b/disk/part_amiga.c @@ -381,6 +381,7 @@ static void part_print_amiga(struct blk_desc *dev_desc) U_BOOT_PART_TYPE(amiga) = { .name = "AMIGA", .part_type = PART_TYPE_AMIGA, + .max_entries = AMIGA_ENTRY_NUMBERS, .get_info = part_get_info_amiga, .print = part_print_amiga, .test = part_test_amiga, diff --git a/disk/part_dos.c b/disk/part_dos.c index 511917a444..ed78334a9d 100644 --- a/disk/part_dos.c +++ b/disk/part_dos.c @@ -209,35 +209,8 @@ static int part_get_info_extended(struct blk_desc *dev_desc, info->start = (lbaint_t)(ext_part_sector + le32_to_int(pt->start4)); info->size = (lbaint_t)le32_to_int(pt->size4); - switch(dev_desc->if_type) { - case IF_TYPE_IDE: - case IF_TYPE_SATA: - case IF_TYPE_ATAPI: - sprintf((char *)info->name, "hd%c%d", - 'a' + dev_desc->devnum, - part_num); - break; - case IF_TYPE_SCSI: - sprintf((char *)info->name, "sd%c%d", - 'a' + dev_desc->devnum, - part_num); - break; - case IF_TYPE_USB: - sprintf((char *)info->name, "usbd%c%d", - 'a' + dev_desc->devnum, - part_num); - break; - case IF_TYPE_DOC: - sprintf((char *)info->name, "docd%c%d", - 'a' + dev_desc->devnum, - part_num); - break; - default: - sprintf((char *)info->name, "xx%c%d", - 'a' + dev_desc->devnum, - part_num); - break; - } + part_set_generic_name(dev_desc, part_num, + (char *)info->name); /* sprintf(info->type, "%d, pt->sys_ind); */ strcpy((char *)info->type, "U-Boot"); info->bootable = is_bootable(pt); @@ -297,9 +270,30 @@ int part_get_info_dos(struct blk_desc *dev_desc, int part, return part_get_info_extended(dev_desc, 0, 0, 1, part, info, 0); } +int is_valid_dos_buf(void *buf) +{ + return test_block_type(buf) == DOS_MBR ? 0 : -1; +} + +int write_mbr_partition(struct blk_desc *dev_desc, void *buf) +{ + if (is_valid_dos_buf(buf)) + return -1; + + /* write MBR */ + if (blk_dwrite(dev_desc, 0, 1, buf) != 1) { + printf("%s: failed writing '%s' (1 blks at 0x0)\n", + __func__, "MBR"); + return 1; + } + + return 0; +} + U_BOOT_PART_TYPE(dos) = { .name = "DOS", .part_type = PART_TYPE_DOS, + .max_entries = DOS_ENTRY_NUMBERS, .get_info = part_get_info_ptr(part_get_info_dos), .print = part_print_ptr(part_print_dos), .test = part_test_dos, diff --git a/disk/part_efi.c b/disk/part_efi.c index 8d67c09a43..19243380da 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -296,25 +296,6 @@ int part_get_info_efi(struct blk_desc *dev_desc, int part, return 0; } -int part_get_info_efi_by_name(struct blk_desc *dev_desc, - const char *name, disk_partition_t *info) -{ - int ret; - int i; - for (i = 1; i < GPT_ENTRY_NUMBERS; i++) { - ret = part_get_info_efi(dev_desc, i, info); - if (ret != 0) { - /* no more entries in table */ - return -1; - } - if (strcmp(name, (const char *)info->name) == 0) { - /* matched */ - return 0; - } - } - return -2; -} - static int part_test_efi(struct blk_desc *dev_desc) { ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, legacymbr, 1, dev_desc->blksz); @@ -958,6 +939,7 @@ static int is_pte_valid(gpt_entry * pte) U_BOOT_PART_TYPE(a_efi) = { .name = "EFI", .part_type = PART_TYPE_EFI, + .max_entries = GPT_ENTRY_NUMBERS, .get_info = part_get_info_ptr(part_get_info_efi), .print = part_print_ptr(part_print_efi), .test = part_test_efi, diff --git a/disk/part_iso.c b/disk/part_iso.c index f9a741d297..bb8ed658f2 100644 --- a/disk/part_iso.c +++ b/disk/part_iso.c @@ -137,30 +137,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num, entry_num=1; offset=0x20; strcpy((char *)info->type, "U-Boot"); - switch(dev_desc->if_type) { - case IF_TYPE_IDE: - case IF_TYPE_SATA: - case IF_TYPE_ATAPI: - sprintf ((char *)info->name, "hd%c%d", - 'a' + dev_desc->devnum, part_num); - break; - case IF_TYPE_SCSI: - sprintf ((char *)info->name, "sd%c%d", - 'a' + dev_desc->devnum, part_num); - break; - case IF_TYPE_USB: - sprintf ((char *)info->name, "usbd%c%d", - 'a' + dev_desc->devnum, part_num); - break; - case IF_TYPE_DOC: - sprintf ((char *)info->name, "docd%c%d", - 'a' + dev_desc->devnum, part_num); - break; - default: - sprintf ((char *)info->name, "xx%c%d", - 'a' + dev_desc->devnum, part_num); - break; - } + part_set_generic_name(dev_desc, part_num, (char *)info->name); /* the bootcatalog (including validation Entry) is limited to 2048Bytes * (63 boot entries + validation entry) */ while(offset<2048) { @@ -257,6 +234,7 @@ static int part_test_iso(struct blk_desc *dev_desc) U_BOOT_PART_TYPE(iso) = { .name = "ISO", .part_type = PART_TYPE_ISO, + .max_entries = ISO_ENTRY_NUMBERS, .get_info = part_get_info_iso, .print = part_print_iso, .test = part_test_iso, diff --git a/disk/part_mac.c b/disk/part_mac.c index 3952b8d379..b6c082e7e1 100644 --- a/disk/part_mac.c +++ b/disk/part_mac.c @@ -239,6 +239,7 @@ static int part_get_info_mac(struct blk_desc *dev_desc, int part, U_BOOT_PART_TYPE(mac) = { .name = "MAC", .part_type = PART_TYPE_MAC, + .max_entries = MAC_ENTRY_NUMBERS, .get_info = part_get_info_mac, .print = part_print_mac, .test = part_test_mac, diff --git a/doc/README.android-fastboot b/doc/README.android-fastboot index ce12bc594f..b8afa15762 100644 --- a/doc/README.android-fastboot +++ b/doc/README.android-fastboot @@ -59,6 +59,44 @@ To define a partition alias add an environment variable similar to: fastboot_partition_alias_<alias partition name>=<actual partition name> Example: fastboot_partition_alias_boot=LNX +Partition Names +=============== +The Fastboot implementation in U-boot allows to write images into disk +partitions (currently on eMMC). Target partitions are referred on the host +computer by their names. + +For GPT/EFI the respective partition name is used. + +For MBR the partitions are referred by generic names according to the +following schema: + + <device type> <device index letter> <partition index> + +Example: hda3, sdb1, usbda1 + +The device type is as follows: + + * IDE, ATAPI and SATA disks: hd + * SCSI disks: sd + * USB media: usbd + * MMC and SD cards: mmcsd + * Disk on chip: docd + * other: xx + +The device index starts from 'a' and refers to the interface (e.g. USB +controller, SD/MMC controller) or disk index. The partition index starts +from 1 and describes the partition number on the particular device. + +Writing Partition Table +======================= +Fastboot also allows to write the partition table to the media. This can be +done by writing the respective partition table image to a special target +"gpt" or "mbr". These names can be customized by defining the following +configuration options: + +CONFIG_FASTBOOT_GPT_NAME +CONFIG_FASTBOOT_MBR_NAME + In Action ========= Enter into fastboot by executing the fastboot command in u-boot and you diff --git a/doc/README.ti-secure b/doc/README.ti-secure index 54c996d8f6..9b0fbf9732 100644 --- a/doc/README.ti-secure +++ b/doc/README.ti-secure @@ -43,6 +43,38 @@ Booting of U-Boot SPL The script is basically the only required interface to the TI SECDEV package for creating a bootable SPL image for secure TI devices. + Invoking the script for AM33xx Secure Devices + ============================================= + + create-boot-image.sh \ + <IMAGE_FLAG> <INPUT_FILE> <OUTPUT_FILE> <SPL_LOAD_ADDR> + + <IMAGE_FLAG> is a value that specifies the type of the image to + generate OR the action the image generation tool will take. Valid + values are: + SPI_X-LOADER - Generates an image for SPI flash (byte swapped) + X-LOADER - Generates an image for non-XIP flash + MLO - Generates an image for SD/MMC/eMMC media + 2ND - Generates an image for USB, UART and Ethernet + XIP_X-LOADER - Generates a single stage u-boot for NOR/QSPI XiP + + <INPUT_FILE> is the full path and filename of the public world boot + loaderbinary file (depending on the boot media, this is usually + either u-boot-spl.bin or u-boot.bin). + + <OUTPUT_FILE> is the full path and filename of the final secure + image. The output binary images should be used in place of the standard + non-secure binary images (see the platform-specific user's guides and + releases notes for how the non-secure images are typically used) + u-boot-spl_HS_SPI_X-LOADER - byte swapped boot image for SPI flash + u-boot-spl_HS_X-LOADER - boot image for NAND or SD/MMC/eMMC rawmode + u-boot-spl_HS_MLO - boot image for SD/MMC/eMMC media + u-boot-spl_HS_2ND - boot image for USB, UART and Ethernet + u-boot_HS_XIP_X-LOADER - boot image for NOR or QSPI Xip flash + + <SPL_LOAD_ADDR> is the address at which SOC ROM should load the + <INPUT_FILE> + Invoking the script for AM43xx Secure Devices ============================================= diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig index d560328be0..b3873c140d 100644 --- a/drivers/input/Kconfig +++ b/drivers/input/Kconfig @@ -17,6 +17,7 @@ config CROS_EC_KEYB config I8042_KEYB bool "Enable Intel i8042 keyboard support" depends on DM_KEYBOARD + default X86 help This adds a driver for the i8042 keyboard controller, allowing the keyboard to be used on devices which support this controller. The diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 8c1774e6a9..01527f7fc7 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -251,33 +251,35 @@ int macb_miiphy_write(struct mii_dev *bus, int phy_adr, int devad, int reg, static inline void macb_invalidate_ring_desc(struct macb_device *macb, bool rx) { if (rx) - invalidate_dcache_range(macb->rx_ring_dma, macb->rx_ring_dma + - MACB_RX_DMA_DESC_SIZE); + invalidate_dcache_range(macb->rx_ring_dma, + ALIGN(macb->rx_ring_dma + MACB_RX_DMA_DESC_SIZE, + PKTALIGN)); else - invalidate_dcache_range(macb->tx_ring_dma, macb->tx_ring_dma + - MACB_TX_DMA_DESC_SIZE); + invalidate_dcache_range(macb->tx_ring_dma, + ALIGN(macb->tx_ring_dma + MACB_TX_DMA_DESC_SIZE, + PKTALIGN)); } static inline void macb_flush_ring_desc(struct macb_device *macb, bool rx) { if (rx) flush_dcache_range(macb->rx_ring_dma, macb->rx_ring_dma + - MACB_RX_DMA_DESC_SIZE); + ALIGN(MACB_RX_DMA_DESC_SIZE, PKTALIGN)); else flush_dcache_range(macb->tx_ring_dma, macb->tx_ring_dma + - MACB_TX_DMA_DESC_SIZE); + ALIGN(MACB_TX_DMA_DESC_SIZE, PKTALIGN)); } static inline void macb_flush_rx_buffer(struct macb_device *macb) { flush_dcache_range(macb->rx_buffer_dma, macb->rx_buffer_dma + - MACB_RX_BUFFER_SIZE); + ALIGN(MACB_RX_BUFFER_SIZE, PKTALIGN)); } static inline void macb_invalidate_rx_buffer(struct macb_device *macb) { invalidate_dcache_range(macb->rx_buffer_dma, macb->rx_buffer_dma + - MACB_RX_BUFFER_SIZE); + ALIGN(MACB_RX_BUFFER_SIZE, PKTALIGN)); } #if defined(CONFIG_CMD_NET) @@ -596,7 +598,7 @@ static int gmac_init_multi_queues(struct macb_device *macb) macb->dummy_desc->ctrl = TXBUF_USED; macb->dummy_desc->addr = 0; flush_dcache_range(macb->dummy_desc_dma, macb->dummy_desc_dma + - MACB_TX_DUMMY_DMA_DESC_SIZE); + ALIGN(MACB_TX_DUMMY_DMA_DESC_SIZE, PKTALIGN)); for (i = 1; i < num_queues; i++) gem_writel_queue_TBQP(macb, macb->dummy_desc_dma, i - 1); diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index 2959befeb4..272c71b76b 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -297,8 +297,6 @@ #define CONFIG_FASTBOOT_BUF_ADDR CONFIG_SYS_LOAD_ADDR #define CONFIG_FASTBOOT_BUF_SIZE 0x07000000 -/* To support eMMC booting */ -#define CONFIG_STORAGE_EMMC #define CONFIG_FASTBOOT_FLASH_MMC_DEV 1 #endif diff --git a/include/configs/am335x_shc.h b/include/configs/am335x_shc.h index db518a5823..553aaa38a8 100644 --- a/include/configs/am335x_shc.h +++ b/include/configs/am335x_shc.h @@ -283,8 +283,6 @@ #define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/am33xx/u-boot-spl.lds" #ifndef CONFIG_SPL_USBETH_SUPPORT -/* To support eMMC booting */ -#define CONFIG_STORAGE_EMMC #define CONFIG_FASTBOOT_FLASH_MMC_DEV 1 #endif diff --git a/include/configs/am335x_sl50.h b/include/configs/am335x_sl50.h index 833c5c4659..9795d4112b 100644 --- a/include/configs/am335x_sl50.h +++ b/include/configs/am335x_sl50.h @@ -89,8 +89,6 @@ #define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/am33xx/u-boot-spl.lds" #ifndef CONFIG_SPL_USBETH_SUPPORT -/* To support eMMC booting */ -#define CONFIG_STORAGE_EMMC #define CONFIG_FASTBOOT_FLASH_MMC_DEV 1 #endif diff --git a/include/configs/bav335x.h b/include/configs/bav335x.h index 0eb0c0308f..f1ae1a6c19 100644 --- a/include/configs/bav335x.h +++ b/include/configs/bav335x.h @@ -447,8 +447,6 @@ DEFAULT_LINUX_BOOT_ENV \ #define CONFIG_FASTBOOT_BUF_ADDR CONFIG_SYS_LOAD_ADDR #define CONFIG_FASTBOOT_BUF_SIZE 0x07000000 -/* To support eMMC booting */ -#define CONFIG_STORAGE_EMMC #define CONFIG_FASTBOOT_FLASH_MMC_DEV 1 #endif diff --git a/include/configs/k2e_evm.h b/include/configs/k2e_evm.h index 7eaab875f2..8d6471ae88 100644 --- a/include/configs/k2e_evm.h +++ b/include/configs/k2e_evm.h @@ -18,7 +18,6 @@ #define CONFIG_EXTRA_ENV_KS2_BOARD_SETTINGS \ DEFAULT_FW_INITRAMFS_BOOT_ENV \ "boot=ubi\0" \ - "addr_mon=0x0c140000\0" \ "args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs " \ "root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,2048\0" \ "name_fdt=keystone-k2e-evm.dtb\0" \ diff --git a/include/configs/k2g_evm.h b/include/configs/k2g_evm.h index 71b00378ff..a14544526c 100644 --- a/include/configs/k2g_evm.h +++ b/include/configs/k2g_evm.h @@ -18,12 +18,12 @@ #define CONFIG_EXTRA_ENV_KS2_BOARD_SETTINGS \ DEFAULT_MMC_TI_ARGS \ DEFAULT_PMMC_BOOT_ENV \ + DEFAULT_FW_INITRAMFS_BOOT_ENV \ "boot=mmc\0" \ "console=ttyS0,115200n8\0" \ "bootpart=0:2\0" \ "bootdir=/boot\0" \ "rd_spec=-\0" \ - "addr_mon=0x0c040000\0" \ "args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs " \ "root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,2048\0" \ "name_fdt=keystone-k2g-evm.dtb\0" \ @@ -31,6 +31,8 @@ "name_ubi=k2g-evm-ubifs.ubi\0" \ "name_uboot=u-boot-spi-k2g-evm.gph\0" \ "init_mmc=run args_all args_mmc\0" \ + "init_fw_rd_mmc=load mmc ${bootpart} ${rdaddr} " \ + "${bootdir}/${name_fw_rd}; run set_rd_spec\0" \ "soc_variant=k2g\0" \ "get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${name_fdt}\0"\ "get_kern_mmc=load mmc ${bootpart} ${loadaddr} " \ @@ -40,9 +42,9 @@ #define CONFIG_BOOTCOMMAND \ "run envboot; " \ - "run set_name_pmmc init_${boot} get_pmmc_${boot} run_pmmc " \ - "get_fdt_${boot} get_mon_${boot} get_kern_${boot} " \ - "run_mon run_kern" + "run set_name_pmmc init_${boot} init_fw_rd_${boot} " \ + "get_pmmc_${boot} run_pmmc get_mon_${boot} run_mon " \ + "get_fdt_${boot} get_kern_${boot} run_kern" #include <configs/ti_armv7_keystone2.h> diff --git a/include/configs/k2hk_evm.h b/include/configs/k2hk_evm.h index 0256f0e567..913d4545b8 100644 --- a/include/configs/k2hk_evm.h +++ b/include/configs/k2hk_evm.h @@ -18,7 +18,6 @@ #define CONFIG_EXTRA_ENV_KS2_BOARD_SETTINGS \ DEFAULT_FW_INITRAMFS_BOOT_ENV \ "boot=ubi\0" \ - "addr_mon=0x0c5f0000\0" \ "args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs " \ "root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,2048\0" \ "name_fdt=keystone-k2hk-evm.dtb\0" \ diff --git a/include/configs/k2l_evm.h b/include/configs/k2l_evm.h index 2322ab288d..395e61c21d 100644 --- a/include/configs/k2l_evm.h +++ b/include/configs/k2l_evm.h @@ -18,7 +18,6 @@ #define CONFIG_EXTRA_ENV_KS2_BOARD_SETTINGS \ DEFAULT_FW_INITRAMFS_BOOT_ENV \ "boot=ubi\0" \ - "addr_mon=0x0c140000\0" \ "args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs " \ "root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,4096\0" \ "name_fdt=keystone-k2l-evm.dtb\0" \ diff --git a/include/configs/ti_am335x_common.h b/include/configs/ti_am335x_common.h index 6b63fd29d3..d841b3f7b6 100644 --- a/include/configs/ti_am335x_common.h +++ b/include/configs/ti_am335x_common.h @@ -12,7 +12,6 @@ #ifndef __CONFIG_TI_AM335X_COMMON_H__ #define __CONFIG_TI_AM335X_COMMON_H__ -#define CONFIG_AM33XX #define CONFIG_ARCH_CPU_INIT #define CONFIG_MAX_RAM_BANK_SIZE (1024 << 20) /* 1GB */ #define CONFIG_SYS_TIMERBASE 0x48040000 /* Use Timer2 */ diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h index f039df51af..f5602b8c3e 100644 --- a/include/configs/ti_armv7_common.h +++ b/include/configs/ti_armv7_common.h @@ -193,16 +193,21 @@ /* * Our platforms make use of SPL to initalize the hardware (primarily - * memory) enough for full U-Boot to be loaded. We also support Falcon - * Mode so that the Linux kernel can be booted directly from SPL - * instead, if desired. We make use of the general SPL framework found - * under common/spl/. Given our generally common memory map, we set a - * number of related defaults and sizes here. + * memory) enough for full U-Boot to be loaded. We make use of the general + * SPL framework found under common/spl/. Given our generally common memory + * map, we set a number of related defaults and sizes here. */ #if !defined(CONFIG_NOR_BOOT) && \ !(defined(CONFIG_QSPI_BOOT) && defined(CONFIG_AM43XX)) #define CONFIG_SPL_FRAMEWORK + +/* + * We also support Falcon Mode so that the Linux kernel can be booted + * directly from SPL. This is not currently available on HS devices. + */ +#if !defined(CONFIG_TI_SECURE_DEVICE) #define CONFIG_SPL_OS_BOOT +#endif /* * Place the image at the start of the ROM defined image space (per diff --git a/include/configs/ti_armv7_keystone2.h b/include/configs/ti_armv7_keystone2.h index 9c0614e566..c42dedbbd1 100644 --- a/include/configs/ti_armv7_keystone2.h +++ b/include/configs/ti_armv7_keystone2.h @@ -247,6 +247,7 @@ "addr_ubi=0x82000000\0" \ "addr_secdb_key=0xc000000\0" \ "name_kern=zImage\0" \ + "addr_mon=0x87000000\0" \ "run_mon=mon_install ${addr_mon}\0" \ "run_kern=bootz ${loadaddr} ${rd_spec} ${fdtaddr}\0" \ "init_net=run args_all args_net\0" \ @@ -291,8 +292,8 @@ #ifndef CONFIG_BOOTCOMMAND #define CONFIG_BOOTCOMMAND \ - "run init_${boot} init_fw_rd_${boot} get_fdt_${boot} " \ - "get_mon_${boot} get_kern_${boot} run_mon run_kern" + "run init_${boot} get_mon_${boot} run_mon init_fw_rd_${boot} " \ + "get_fdt_${boot} get_kern_${boot} run_kern" #endif #define CONFIG_BOOTARGS \ diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h index ea11226620..a483850d19 100644 --- a/include/configs/ti_omap5_common.h +++ b/include/configs/ti_omap5_common.h @@ -144,6 +144,14 @@ */ #define TI_OMAP5_SECURE_BOOT_RESV_SRAM_SZ 0x1000 #define CONFIG_SPL_TEXT_BASE 0x40301350 +/* If no specific start address is specified then the secure EMIF + * region will be placed at the end of the DDR space. In order to prevent + * the main u-boot relocation from clobbering that memory and causing a + * firewall violation, we tell u-boot that memory is protected RAM (PRAM) + */ +#if (CONFIG_TI_SECURE_EMIF_REGION_START == 0) +#define CONFIG_PRAM (CONFIG_TI_SECURE_EMIF_TOTAL_REGION_SIZE) >> 10 +#endif #else /* * For all booting on GP parts, the flash loader image is diff --git a/include/part.h b/include/part.h index 226b5be9df..09790059d0 100644 --- a/include/part.h +++ b/include/part.h @@ -28,6 +28,11 @@ struct block_drvr { #define PART_TYPE_AMIGA 0x04 #define PART_TYPE_EFI 0x05 +/* maximum number of partition entries supported by search */ +#define DOS_ENTRY_NUMBERS 8 +#define ISO_ENTRY_NUMBERS 64 +#define MAC_ENTRY_NUMBERS 64 +#define AMIGA_ENTRY_NUMBERS 8 /* * Type string for U-Boot bootable partitions */ @@ -146,6 +151,34 @@ int blk_get_device_by_str(const char *ifname, const char *dev_str, int blk_get_device_part_str(const char *ifname, const char *dev_part_str, struct blk_desc **dev_desc, disk_partition_t *info, int allow_whole_dev); + +/** + * part_get_info_by_name() - Search for a partition by name + * among all available registered partitions + * + * @param dev_desc - block device descriptor + * @param gpt_name - the specified table entry name + * @param info - returns the disk partition info + * + * @return - '0' on match, '-1' on no match, otherwise error + */ +int part_get_info_by_name(struct blk_desc *dev_desc, + const char *name, disk_partition_t *info); + +/** + * part_set_generic_name() - create generic partition like hda1 or sdb2 + * + * Helper function for partition tables, which don't hold partition names + * (DOS, ISO). Generates partition name out of the device type and partition + * number. + * + * @dev_desc: pointer to the block device + * @part_num: partition number for which the name is generated + * @name: buffer where the name is written + */ +void part_set_generic_name(const struct blk_desc *dev_desc, + int part_num, char *name); + extern const struct block_drvr block_drvr[]; #else static inline struct blk_desc *blk_get_dev(const char *ifname, int dev) @@ -189,6 +222,7 @@ static inline int blk_get_device_part_str(const char *ifname, struct part_driver { const char *name; int part_type; + const int max_entries; /* maximum number of entries to search */ /** * get_info() - Get information about a partition @@ -225,18 +259,6 @@ struct part_driver { #include <part_efi.h> /* disk/part_efi.c */ /** - * part_get_info_efi_by_name() - Find the specified GPT partition table entry - * - * @param dev_desc - block device descriptor - * @param gpt_name - the specified table entry name - * @param info - returns the disk partition info - * - * @return - '0' on match, '-1' on no match, otherwise error - */ -int part_get_info_efi_by_name(struct blk_desc *dev_desc, - const char *name, disk_partition_t *info); - -/** * write_gpt_table() - Write the GUID Partition Table to disk * * @param dev_desc - block device descriptor @@ -343,4 +365,27 @@ int gpt_verify_partitions(struct blk_desc *dev_desc, gpt_header *gpt_head, gpt_entry **gpt_pte); #endif +#ifdef CONFIG_DOS_PARTITION +/** + * is_valid_dos_buf() - Ensure that a DOS MBR image is valid + * + * @param buf - buffer which contains the MBR + * + * @return - '0' on success, otherwise error + */ +int is_valid_dos_buf(void *buf); + +/** + * write_mbr_partition() - write DOS MBR + * + * @param dev_desc - block device descriptor + * @param buf - buffer which contains the MBR + * + * @return - '0' on success, otherwise error + */ +int write_mbr_partition(struct blk_desc *dev_desc, void *buf); + +#endif + + #endif /* _PART_H */ diff --git a/include/part_efi.h b/include/part_efi.h index c8fc8738f9..317c044795 100644 --- a/include/part_efi.h +++ b/include/part_efi.h @@ -27,7 +27,6 @@ #define GPT_HEADER_SIGNATURE 0x5452415020494645ULL #define GPT_HEADER_REVISION_V1 0x00010000 #define GPT_PRIMARY_PARTITION_TABLE_LBA 1ULL -#define GPT_ENTRY_NAME "gpt" #define GPT_ENTRY_NUMBERS 128 #define GPT_ENTRY_SIZE 128 |