Merge git://git.denx.de/u-boot-rockchip
authorTom Rini <trini@konsulko.com>
Mon, 3 Oct 2016 13:09:29 +0000 (09:09 -0400)
committerTom Rini <trini@konsulko.com>
Mon, 3 Oct 2016 13:09:29 +0000 (09:09 -0400)
68 files changed:
README
arch/Kconfig
arch/arm/Kconfig
arch/arm/cpu/armv7/am33xx/Kconfig
arch/arm/cpu/armv7/am33xx/config.mk
arch/arm/cpu/armv7/omap-common/Kconfig
arch/arm/cpu/armv7/omap-common/emif-common.c
arch/arm/cpu/armv7/omap5/Kconfig
arch/arm/cpu/armv7/omap5/Makefile
arch/arm/cpu/armv7/omap5/fdt.c
arch/arm/cpu/armv7/omap5/sec-fxns.c [new file with mode: 0644]
arch/arm/include/asm/omap_sec_common.h
arch/arm/mach-keystone/cmd_mon.c
arch/arm/mach-keystone/ddr3.c
arch/sandbox/Kconfig
arch/x86/Kconfig
board/ti/am335x/board.c
board/ti/ks2_evm/board.c
cmd/fastboot/Kconfig
common/bootm.c
common/fb_mmc.c
configs/am335x_baltos_defconfig
configs/am335x_boneblack_defconfig
configs/am335x_boneblack_vboot_defconfig
configs/am335x_evm_defconfig
configs/am335x_evm_nor_defconfig
configs/am335x_evm_norboot_defconfig
configs/am335x_evm_spiboot_defconfig
configs/am335x_evm_usbspl_defconfig
configs/am335x_igep0033_defconfig
configs/am335x_shc_defconfig
configs/am335x_shc_ict_defconfig
configs/am335x_shc_netboot_defconfig
configs/am335x_shc_prompt_defconfig
configs/am335x_shc_sdboot_defconfig
configs/am335x_shc_sdboot_prompt_defconfig
configs/am335x_sl50_defconfig
configs/birdland_bav335a_defconfig
configs/birdland_bav335b_defconfig
configs/cm_t335_defconfig
configs/pcm051_rev1_defconfig
configs/pcm051_rev3_defconfig
configs/pengwyn_defconfig
configs/pepper_defconfig
disk/part.c
disk/part_amiga.c
disk/part_dos.c
disk/part_efi.c
disk/part_iso.c
disk/part_mac.c
doc/README.android-fastboot
doc/README.ti-secure
drivers/input/Kconfig
drivers/net/macb.c
include/configs/am335x_evm.h
include/configs/am335x_shc.h
include/configs/am335x_sl50.h
include/configs/bav335x.h
include/configs/k2e_evm.h
include/configs/k2g_evm.h
include/configs/k2hk_evm.h
include/configs/k2l_evm.h
include/configs/ti_am335x_common.h
include/configs/ti_armv7_common.h
include/configs/ti_armv7_keystone2.h
include/configs/ti_omap5_common.h
include/part.h
include/part_efi.h

diff --git a/README b/README
index bc626dc7a83d9f2712c523ee0722eca7a0fa4739..f29bf50ad0b14040339559c3cb794f01ff32516f 100644 (file)
--- a/README
+++ b/README
@@ -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,
index d718a68171286f0216c463adf834a03333ec39b5..ffc7b45379401da5e9f339fd82ad14f85d392c36 100644 (file)
@@ -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
index 382a73f73e8a49bade2ec2a27b38fe73dc391253..f55d5b2cd743841ec7d291b29880d4c6c63c10fa 100644 (file)
@@ -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
index 2d7d1fc4f1ad95323d1df8e06f2bffcd5cee06a1..8fd32c2a46dfe8993323f8c07589fbf0e04fa5e6 100644 (file)
@@ -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
index d4eb21ca14e19f68cebf9a6a863076af13e8890e..87b76d96a83937030455a9062b88d29429051fea 100644 (file)
@@ -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)
index 7b39506ae84648a6be91981452d3c8e303486daf..4daccd93ffc7227c47681f693568dae3c00bf2c1 100644 (file)
@@ -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
index 2b790105b0bb51036a6e38d849121342b0e65e63..b26984e26c5e8648598a36380d991fb34d1dd3df 100644 (file)
@@ -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)
index ef68c535df560f8da770af06c20d89da0adbe788..a947ba4d98c735c6daecc355a14709d2fb28f5cf 100644 (file)
@@ -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"
index 3caba86791498c6e7ce5d2543930ad424e6e22fb..0212df73c154d90a265736a74de076f8b7053bf6 100644 (file)
@@ -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
index 0493cd1eab39bdafa27b7bbbda5da3b9a9624b92..da8d59bb59f617712d3d0f6691fb8d1bbce88ba2 100644 (file)
@@ -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 (file)
index 0000000..33d4ea4
--- /dev/null
@@ -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;
+}
index 842f2af8d121af42d306a14613507fbac156b41f..4bde93f804d30a7c0b1b217a92b6ebb35b8ec688 100644 (file)
@@ -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_ */
index 6a9bdc96017bae56f2539dd63c0a2e0cbeb9c1e1..591e75826b02a75707dc019f90f8b56c779688a3 100644 (file)
@@ -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;
 }
index 34606f4b2f77380dedbd58a874f2f14b497c8d82..6b92530e42101b6d0efa17ca02a3cf974155e28c 100644 (file)
@@ -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);
index d4c1ee0662c57f74e3b7acb35418a2789d2b90ac..c931c0b43755c12fcf3e07256ed15f131244caae 100644 (file)
@@ -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
index 5193ee7159171dffc691ac00733be67e170bfcff..ac2d598d6635a9d1164e92c0ca4afc756ed3307f 100644 (file)
@@ -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
index 56f4984f479cafb90deeb74eb11ca540a5bc4b2d..0ed16ca15ae79d696a49e4e23e3830a3f2a25210 100644 (file)
@@ -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
index 1de7df00b478ceedb5dd27cf95a1c689a94ba3dc..03254e1497684e263d175f7558c80de5b4389d5f 100644 (file)
@@ -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;
 }
 
index a93d1c09e714117c4b668267d93a79bc66a5c116..5d2facc298de5a1e6b1127087bf1a202c2b5d9ec 100644 (file)
@@ -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
index a4d22a6ec4903d9b2bf9c9e8e96b296a28c7f132..b2c09126cecd380d914483de00c0e147c513928c 100644 (file)
@@ -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)) {
index 8d0524da78f39c5b829bc71813c7549007482ccb..81a3bd063341b32c5cad132bad5dd1d6787c26fa 100644 (file)
 #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");
index 16cdea10a4472d3ba26b43943b594422d07d71ce..79af34854687a30c24c0188bd6bee12ec359e58e 100644 (file)
@@ -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
index 2ef1aff0ec31a38e3e3bf8cda2626ce7b01ae58f..1049a6de732e1efec2fbac7876e84aab8e2ecdab 100644 (file)
@@ -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
index 15b33a4ae6df387178d87c4a7c356c01b226db89..e0110d1e50f8a4dc4a69d850446a22c800571b06 100644 (file)
@@ -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
index 67c458fa2ba1924e311b9a7b0ee0970f7f486e9d..a2cfef37dac6ed3e70dc4089ce45b6cde4cdb3b2 100644 (file)
@@ -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"
index 38662b9e6675e87644aa8b44276216bedcf9a0d3..1f12facc398c318e55e3ca4d9a2423682530e55a 100644 (file)
@@ -1,4 +1,5 @@
 CONFIG_ARM=y
+CONFIG_AM33XX=y
 CONFIG_TARGET_AM335X_EVM=y
 CONFIG_SPL_STACK_R_ADDR=0x82000000
 CONFIG_NOR=y
index 7546033e590663a2aae7664c4cfb56a2480025db..26c932945591353f64ac3b6c3d891c3a3854495d 100644 (file)
@@ -1,4 +1,5 @@
 CONFIG_ARM=y
+CONFIG_AM33XX=y
 CONFIG_TARGET_AM335X_EVM=y
 CONFIG_NOR=y
 CONFIG_FIT=y
index 4a0770ec11b2c5b8126d90974739250181315739..8acebb53e734ddb5db00e08645b342f5df1fffd7 100644 (file)
@@ -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
index 006d58a6a4541172590c4f5a3f5c3afd8eeb1327..1c3e04d7331e95c1b01ef5f7287c1ab895c71f44 100644 (file)
@@ -1,4 +1,5 @@
 CONFIG_ARM=y
+CONFIG_AM33XX=y
 CONFIG_TARGET_AM335X_EVM=y
 CONFIG_SPL_STACK_R_ADDR=0x82000000
 CONFIG_FIT=y
index 20888966c33af175a1a1b09e8eeefcdf0d6f9b65..bfba30525a1ab3f0bed84459eebee8fd06953ae4 100644 (file)
@@ -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
index 0c241e002c5f1c03cf00833e293774f2ddaa8811..5eabd99e16d2b6939c343a421f6e74610283f649 100644 (file)
@@ -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
index 084cc2824c2d9258d4090af0cad7abf5b2034842..93bbf313ab053cd4587973eb4723f54f9f80f28f 100644 (file)
@@ -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
index 8cc40c80e5420d1156b74893cebbf26cd1c72cfa..6e8a9bf29d8feb2d9cd2d49c64d3406f8fa81e28 100644 (file)
@@ -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
index caa004a55bf2c49ea526567c35ee66b911952f8e..1ce8700d37b23e116a735051a5c3a9eda28b3cf7 100644 (file)
@@ -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
index 83041d9e1dcff89b231213110454d9acf07cde02..ee8ed06b2068b6a23698670df684bd02745ddf4b 100644 (file)
@@ -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
index 83041d9e1dcff89b231213110454d9acf07cde02..ee8ed06b2068b6a23698670df684bd02745ddf4b 100644 (file)
@@ -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
index 92b5dc077c275410c62687d4b88bd0b87db69047..9dba3f01f8bc7fc3737cf7f8215de49773cf1e20 100644 (file)
@@ -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
index 3e72b9b5ec365d67d4896fc34a5713d9bffa6c26..d87c34297905a8f66201f40d0b511ce522ee92f8 100644 (file)
@@ -1,4 +1,5 @@
 CONFIG_ARM=y
+CONFIG_AM33XX=y
 CONFIG_TARGET_BAV335X=y
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
index 28a27821b62cf3ce9b4cd22a54db0f7efb6982b5..f4bc68706bd50a0a60150ca4a8f54d74c686e25c 100644 (file)
@@ -1,4 +1,5 @@
 CONFIG_ARM=y
+CONFIG_AM33XX=y
 CONFIG_TARGET_BAV335X=y
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
index 40fe8619eea0d7227ca306aeda2c705d827f34c3..f1353537e859ba865d943bc61a5c672193042328 100644 (file)
@@ -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
index d55e4fe92c5731f6c8743bdada7ed2b5ebf2ab4f..dfe9da3a4cc31e3efd642cb1ce81e92ad61385a7 100644 (file)
@@ -1,4 +1,5 @@
 CONFIG_ARM=y
+CONFIG_AM33XX=y
 CONFIG_TARGET_PCM051=y
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
index cc824e6cd4ea719b092ef7b908457651829969b8..61102e02df11f23a1dec1c75d75cfc43f3d087e1 100644 (file)
@@ -1,4 +1,5 @@
 CONFIG_ARM=y
+CONFIG_AM33XX=y
 CONFIG_TARGET_PCM051=y
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
index 135a40f453fe560f8a139e5fb1c460241dd21c25..feec566c3ed2491f508064dff939c10fd1df4ae1 100644 (file)
@@ -1,4 +1,5 @@
 CONFIG_ARM=y
+CONFIG_AM33XX=y
 CONFIG_TARGET_PENGWYN=y
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
index 17cd66fb3000e8891bc4e2d249214ac3d9004be3..a6f00c6657fd8b097e01135346ce6b2ebd880160 100644 (file)
@@ -1,4 +1,5 @@
 CONFIG_ARM=y
+CONFIG_AM33XX=y
 CONFIG_TARGET_PEPPER=y
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
index 6a1c02d9fada7410c953cd144c2ea6968fb3a200..9f51a0767690120c9340f078efd626b0662f5cdd 100644 (file)
@@ -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);
+}
index d4316b858c1ab45bd6a8077e1ac0b9d818ee8408..25fe56ce4242a8e6e48f42ce3b4e1839253d7bbb 100644 (file)
@@ -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,
index 511917a44491e039a396f606da6806d2f4cbe7ac..ed78334a9dd85059c81dc744692fa6dd34308853 100644 (file)
@@ -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,
index 8d67c09a43a22669af9e702114dc90f4a0d51fad..19243380da75a201beba837918dbacb6fc51ec1e 100644 (file)
@@ -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,
index f9a741d2973ba896932753142c3354b27db8f553..bb8ed658f22538a64dfd1643cd37ed821313dc99 100644 (file)
@@ -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,
index 3952b8d37932cb9d894e475590ed20e097151a75..b6c082e7e16d71eb33038d9b185f0e78eead7280 100644 (file)
@@ -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,
index ce12bc594fc339c336cf640b450b6d3f0aa50aab..b8afa157624499054cd4771cc6d0a15e30380910 100644 (file)
@@ -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
index 54c996d8f6ad0969e275248083a7d189f558d4db..9b0fbf97323381a093b89c78c73c8304fcb707e9 100644 (file)
@@ -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
        =============================================
 
index d560328be025acf827234dd34b59942227a20a2f..b3873c140d054a680d1bb3d39f8f09a5d3ff4fb6 100644 (file)
@@ -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
index 8c1774e6a9b4175040bac1f8d04d9a898c6e7171..01527f7fc7cecd0fb6c700b72693e927062f22b5 100644 (file)
@@ -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);
index 2959befeb49e9c924736c75cc5bde65b47854ccd..272c71b76b6a73fe1e35bb5a5b2b307b2e2d2971 100644 (file)
 #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
 
index db518a5823d33ead32a9aae6ca2109d6e4f73f83..553aaa38a8cc75557b1aab42df3eb8038a75016f 100644 (file)
 #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
 
index 833c5c46598890893ee4a89ebb0b8a9e67425171..9795d4112baaf231c0a1736456b863f036004fe7 100644 (file)
@@ -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
 
index 0eb0c0308ffa7285c6fd87424f6527480e71c225..f1ae1a6c19d198f9303faa4b0ab487763a3759b5 100644 (file)
@@ -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
 
index 7eaab875f28d0b9365094164be9582f1e5a86595..8d6471ae886546969a1fa3fb62d5b7b7985935cc 100644 (file)
@@ -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"                               \
index 71b00378ffb6f15edc03466384521a0b0a696b9a..a14544526c71757b2e1bfcda9cd5f7b03ffc1042 100644 (file)
 #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>
 
index 0256f0e56780cbf5f84855335f57efa9d265e380..913d4545b81f73f8e2d124c7969e2cee33325c57 100644 (file)
@@ -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"                              \
index 2322ab288d99fa461a75de720d320c10fc821356..395e61c21d55bf94f30f446ec7b9c26d9fe58bb7 100644 (file)
@@ -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"                               \
index 6b63fd29d3ceccf79c2f7c2551fdb82808c865a6..d841b3f7b622b42545385d1be0de50556fd6faa5 100644 (file)
@@ -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 */
index f039df51af9e65961997df47c00ba3561f801075..f5602b8c3ee448de9723667f25689af4a6e3b61a 100644 (file)
 
 /*
  * 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
index 9c0614e56692a073372971157979397429ae5e74..c42dedbbd1951b749fc38b82231f607a4f060829 100644 (file)
        "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"                              \
 
 #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                                                        \
index ea11226620d482cc903b8e7e17d4bf541266e921..a483850d190763d62b2678add9bb2e96d33decb2 100644 (file)
  */
 #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
index 226b5be9df26384818e0299fde0d5f0e9d782646..09790059d085461191bc480bc060c3dba166012c 100644 (file)
@@ -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
@@ -224,18 +258,6 @@ struct part_driver {
 #ifdef CONFIG_EFI_PARTITION
 #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
  *
@@ -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 */
index c8fc8738f96a91846cfe781ac1a8488d01ccdb8f..317c044795caf68081aee879dc20c40835091256 100644 (file)
@@ -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