variables:
windows_vm: vs2015-win2012r2
ubuntu_vm: ubuntu-18.04
- ci_runner_image: trini/u-boot-gitlab-ci-runner:bionic-20191202-10Jan2020
+ ci_runner_image: trini/u-boot-gitlab-ci-runner:bionic-20200112-17Jan2020
# Add '-u 0' options for Azure pipelines, otherwise we get "permission
# denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
# since our $(ci_runner_image) user is not root.
# Grab our configured image. The source for this is found at:
# https://gitlab.denx.de/u-boot/gitlab-ci-runner
-image: trini/u-boot-gitlab-ci-runner:bionic-20191202-10Jan2020
+image: trini/u-boot-gitlab-ci-runner:bionic-20200112-17Jan2020
# We run some tests in different order, to catch some failures quicker.
stages:
Enable this to support the pss padding algorithm as described
in the rfc8017 (https://tools.ietf.org/html/rfc8017).
+config FIT_CIPHER
+ bool "Enable ciphering data in a FIT uImages"
+ depends on DM
+ select AES
+ help
+ Enable the feature of data ciphering/unciphering in the tool mkimage
+ and in the u-boot support of the FIT image.
+
config FIT_VERBOSE
bool "Show verbose messages when FIT images fail"
help
libs-y += common/
libs-y += env/
libs-$(CONFIG_API) += api/
-libs-$(CONFIG_HAS_POST) += post/
+ifdef CONFIG_POST
+libs-y += post/
+endif
libs-$(CONFIG_UNIT_TEST) += test/ test/dm/
libs-$(CONFIG_UT_ENV) += test/env/
libs-$(CONFIG_UT_OPTEE) += test/optee/
Configuration Settings:
-----------------------
-- CONFIG_SYS_SUPPORT_64BIT_DATA: Defined automatically if compiled as 64-bit.
+- MEM_SUPPORT_64BIT_DATA: Defined automatically if compiled as 64-bit.
Optionally it can be defined to support 64-bit memory commands.
- CONFIG_SYS_LONGHELP: Defined when you want long help messages included;
If this macro is defined, then CONFIG_SYS_CCSRBAR_PHYS will be
forced to a value that ensures that CCSR is not relocated.
-- Floppy Disk Support:
- CONFIG_SYS_FDC_DRIVE_NUMBER
-
- the default drive number (default value 0)
-
- CONFIG_SYS_ISA_IO_STRIDE
-
- defines the spacing between FDC chipset registers
- (default value 1)
-
- CONFIG_SYS_ISA_IO_OFFSET
-
- defines the offset of register from address. It
- depends on which part of the data bus is connected to
- the FDC chipset. (default value 0)
-
- If CONFIG_SYS_ISA_IO_STRIDE CONFIG_SYS_ISA_IO_OFFSET and
- CONFIG_SYS_FDC_DRIVE_NUMBER are undefined, they take their
- default value.
-
- if CONFIG_SYS_FDC_HW_INIT is defined, then the function
- fdc_hw_init() is called at the beginning of the FDC
- setup. fdc_hw_init() must be provided by the board
- source code. It is used to make hardware-dependent
- initializations.
-
- CONFIG_IDE_AHB:
Most IDE controllers were designed to be connected with PCI
interface. Only few of them were designed for AHB interface.
#include <command.h>
#include <common.h>
+#include <cpu_func.h>
__weak void reset_cpu(ulong addr)
{
*/
#include <common.h>
+#include <clock_legacy.h>
#include <div64.h>
#include <asm/io.h>
#include <linux/errno.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/arch/ep93xx.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <time.h>
#if defined (CONFIG_IMX)
* This function is derived from PowerPC code (timebase clock frequency).
* On ARM it returns the number of timer ticks per second.
*/
-ulong get_tbclk (void)
+ulong get_tbclk(void)
{
return CONFIG_SYS_HZ;
}
/*
* Reset the cpu by setting up the watchdog timer and let him time out
*/
-void reset_cpu (ulong ignored)
+void reset_cpu(ulong ignored)
{
/* Disable watchdog and set Time-Out field to 0 */
WCR = 0x00000000;
*/
#include <common.h>
+#include <cpu_func.h>
#include <time.h>
#include <asm/arch/cpu.h>
#include <asm/arch/armada100.h>
* 2. Write key value to TMP_WSAR reg.
* 3. Perform write operation.
*/
-void reset_cpu (unsigned long ignored)
+void reset_cpu(unsigned long ignored)
{
struct armd1mpmu_registers *mpmu =
(struct armd1mpmu_registers *) ARMD1_MPMU_BASE;
* This function is derived from PowerPC code (timebase clock frequency).
* On ARM it returns the number of timer ticks per second.
*/
-ulong get_tbclk (void)
+ulong get_tbclk(void)
{
return (ulong)CONFIG_SYS_HZ;
}
*/
#include <common.h>
+#include <clock_legacy.h>
#include <div64.h>
#include <asm/arch/cpu.h>
#include <asm/arch/clk.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <div64.h>
#include <netdev.h>
#include <vsprintf.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
*/
#include <common.h>
+#include <cpu_func.h>
+#include <hang.h>
#include <linux/errno.h>
#include <asm/io.h>
#include <asm/arch/clock.h>
#include <common.h>
#include <config.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/sys_proto.h>
#include <common.h>
#include <config.h>
+#include <hang.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/hardware.h>
#include <asm/arch/spr_syscntl.h>
#include <cpu_func.h>
#include <env.h>
#include <i2c.h>
+#include <init.h>
#include <net.h>
#include <linux/mtd/st_smi.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/sysmap.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#define CRMU_MAIL_BOX1 0x03024028
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#define CRU_RESET_OFFSET 0x1803F184
*/
#include <common.h>
+#include <clock_legacy.h>
#include <asm/io.h>
#include <asm/arch/immap_ls102xa.h>
#include <asm/arch/clock.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <linux/libfdt.h>
#include <fdt_support.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/stv0991_wdru.h>
void reset_cpu(ulong ignored)
*/
#include <common.h>
+#include <clock_legacy.h>
#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
#include <common.h>
#include <cpu_func.h>
+#include <hang.h>
#include <asm/system.h>
#include <asm/armv8/mmu.h>
#include <cpu_func.h>
#include <env.h>
#include <fsl_ddr_sdram.h>
+#include <init.h>
+#include <hang.h>
#include <vsprintf.h>
#include <asm/io.h>
#include <linux/errno.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <efi_loader.h>
#include <linux/libfdt.h>
#include <fdt_support.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <cpu_func.h>
#include <linux/compiler.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <cpu_func.h>
#include <linux/compiler.h>
#include <fsl_ifc.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <env.h>
#include <fsl_immap.h>
#include <fsl_ifc.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <cpu_func.h>
#include <env.h>
#include <spl.h>
*/
#include <common.h>
+#include <clock_legacy.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/clock.h>
* This function is derived from PowerPC code (timebase clock frequency).
* On ARM it returns the number of timer ticks per second.
*/
-ulong get_tbclk (void)
+ulong get_tbclk(void)
{
return CONFIG_SYS_HZ;
}
#ifndef _ASM_ARMV8_MMU_H_
#define _ASM_ARMV8_MMU_H_
+#include <hang.h>
#include <linux/const.h>
/*
extern ulong _datarelro_start_ofs;
extern ulong IRQ_STACK_START_IN; /* 8 bytes in IRQ stack */
+void s_init(void);
+
/* cpu/.../cpu.c */
int cleanup_before_linux(void);
void do_irq(struct pt_regs *pt_regswq);
#endif
+void reset_misc(void);
+
#endif /* __ASSEMBLY__ */
#endif /* _U_BOOT_ARM_H_ */
#include <command.h>
#include <cpu_func.h>
#include <dm.h>
+#include <hang.h>
#include <dm/root.h>
#include <env.h>
#include <image.h>
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
+#include <hang.h>
+
/* Replacement (=dummy) for GNU/Linux division-by zero handler */
void __div0 (void)
{
- extern void hang (void);
-
hang();
}
*/
#include <common.h>
+#include <cpu_func.h>
#include <efi_loader.h>
#include <irq_func.h>
#include <asm/proc-armv/ptrace.h>
void bad_mode (void)
{
panic ("Resetting CPU ...\n");
- reset_cpu (0);
+ reset_cpu(0);
}
static void show_efi_loaded_images(struct pt_regs *regs)
*/
#include <common.h>
+#include <cpu_func.h>
#include <irq_func.h>
/*
#include <asm/macro.h>
/*
- * void relocate_code (addr_moni)
+ * void relocate_code(addr_moni)
*
* This function relocates the monitor code.
* x0 holds the destination address.
*/
#include <common.h>
+#include <cpu_func.h>
#include <irq_func.h>
__weak void reset_misc(void)
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/hardware.h>
#include <asm/arch/at91_st.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/hardware.h>
#include <asm/arch/at91_rstc.h>
*/
#include <common.h>
+#include <time.h>
#include <asm/io.h>
#include <asm/arch/hardware.h>
#include <asm/arch/at91_pit.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/hardware.h>
#include <asm/arch/at91_rstc.h>
*/
#include <common.h>
+#include <time.h>
#include <asm/io.h>
#include <asm/arch/hardware.h>
#include <asm/arch/at91_pit.h>
*/
#include <common.h>
+#include <hang.h>
#include <asm/io.h>
#include <asm/arch/at91_common.h>
#include <asm/arch/at91_wdt.h>
*/
#include <common.h>
+#include <hang.h>
#include <asm/io.h>
#include <asm/arch/at91_common.h>
#include <asm/arch/at91sam9_matrix.h>
*/
#include <common.h>
+#include <hang.h>
#include <asm/io.h>
#include <asm/arch/at91_common.h>
#include <asm/arch/at91_pit.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/base.h>
#include <asm/arch/wdog.h>
#include <common.h>
#include <env.h>
#include <i2c.h>
+#include <init.h>
#include <net.h>
#include <asm/arch/hardware.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/timer_defs.h>
#include <asm/arch/hardware.h>
*/
#include <common.h>
#include <config.h>
+#include <hang.h>
#include <spl.h>
#include <asm/u-boot.h>
#include <asm/utils.h>
#include <cpu.h>
#include <cpu_func.h>
#include <dm.h>
+#include <init.h>
#include <dm/device-internal.h>
#include <dm/lists.h>
#include <dm/uclass.h>
*/
#include <common.h>
+#include <init.h>
DECLARE_GLOBAL_DATA_PTR;
*/
#include <common.h>
+#include <hang.h>
#include <linux/types.h>
#include <asm/arch/clock.h>
#include <asm/arch/mx6-ddr.h>
* Copyright (C) 2016 Grinn
*/
+#include <init.h>
#include <asm/arch/clock.h>
#include <asm/arch/iomux.h>
#include <asm/arch/imx-regs.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <div64.h>
#include <asm/io.h>
#include <linux/errno.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <div64.h>
#include <asm/io.h>
#include <errno.h>
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
*/
+#include <cpu_func.h>
#include <init.h>
#include <asm/io.h>
#include <asm/arch/clock.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/clock.h>
*/
#include <common.h>
+#include <hang.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/sys_proto.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <spl.h>
#include "common.h"
#include <dm.h>
#include <common.h>
#include <dm.h>
+#include <hang.h>
#include <linux/soc/ti/ti_sci_protocol.h>
#include <mach/spl.h>
#include <spl.h>
* Texas Instruments Incorporated, <www.ti.com>
*/
+#include <cpu_func.h>
#include <asm/io.h>
#include <common.h>
#include <asm/arch/msmc.h>
* Copyright (C) 2012-2019 Texas Instruments Incorporated - http://www.ti.com/
*/
+#include <hang.h>
#include <asm/unaligned.h>
#include <common.h>
#include <command.h>
#include <common.h>
#include <command.h>
+#include <cpu_func.h>
#include <env.h>
#include <netdev.h>
#include <asm/cache.h>
*/
#include <common.h>
+#include <init.h>
#include <linux/io.h>
#include <linux/sizes.h>
#include <asm/arch/misc.h>
#include <clk.h>
#include <common.h>
+#include <cpu_func.h>
#include <dm.h>
#include <fdtdec.h>
#include <ram.h>
#include <clk.h>
#include <common.h>
+#include <cpu_func.h>
#include <dm.h>
#include <fdtdec.h>
#include <ram.h>
#include <clk.h>
#include <common.h>
+#include <hang.h>
#include <spl.h>
#include "init.h"
*/
#include <common.h>
+#include <init.h>
#include <asm/arch/boot.h>
#include <asm/arch/eth.h>
#include <asm/arch/axg.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <init.h>
#include <asm/arch/boot.h>
#include <env.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/arch/boot.h>
#include <asm/arch/eth.h>
#include <asm/arch/g12a.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/arch/boot.h>
#include <asm/arch/eth.h>
#include <asm/arch/gx.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <dm.h>
#include <fdtdec.h>
#include <linux/libfdt.h>
#include <config.h>
#include <common.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/arch/cpu.h>
#include <asm/arch/soc.h>
#include <dm.h>
#include <debug_uart.h>
#include <fdtdec.h>
+#include <hang.h>
#include <spl.h>
#include <asm/io.h>
#include <asm/arch/cpu.h>
#include <dm.h>
#include <debug_uart.h>
#include <errno.h>
+#include <init.h>
#include <ns16550.h>
#include <spl.h>
#include <asm/arch/cpu.h>
* Copyright (C) 2013, Texas Instruments, Incorporated - http://www.ti.com/
*/
#include <common.h>
+#include <hang.h>
#include <asm/arch/cpu.h>
#include <asm/arch/clock.h>
#include <asm/arch/hardware.h>
*/
#include <common.h>
+#include <hang.h>
#include <linux/libfdt.h>
#include <fdt_support.h>
#include <malloc.h>
* Rajendra Nayak <rnayak@ti.com>
*/
#include <common.h>
+#include <hang.h>
#include <i2c.h>
#include <asm/omap_common.h>
#include <asm/gpio.h>
*/
#include <common.h>
+#include <hang.h>
+#include <init.h>
+#include <net.h>
#include <asm/emif.h>
#include <asm/arch/clock.h>
#include <asm/arch/sys_proto.h>
*/
#include <common.h>
+#include <hang.h>
#include <asm/utils.h>
#include <asm/arch/dra7xx_iodelay.h>
#include <asm/arch/omap.h>
*/
#include <common.h>
+#include <hang.h>
#include <linux/libfdt.h>
#include <fdt_support.h>
#include <malloc.h>
* Sricharan <r.sricharan@ti.com>
*/
#include <common.h>
+#include <cpu_func.h>
#include <palmas.h>
#include <asm/armv7.h>
#include <asm/arch/cpu.h>
* Sricharan R <r.sricharan@ti.com>
*/
#include <config.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/cpu.h>
#include <linux/compiler.h>
#include <common.h>
#include <cpu_func.h>
+#include <hang.h>
+#include <init.h>
#include <stdarg.h>
#include <asm/arch/sys_proto.h>
#include <common.h>
#include <config.h>
+#include <init.h>
#include <asm/arch/cpu.h>
DECLARE_GLOBAL_DATA_PTR;
* This function is derived from PowerPC code (timebase clock frequency).
* On ARM it returns the number of timer ticks per second.
*/
-ulong get_tbclk (void)
+ulong get_tbclk(void)
{
return (ulong)CONFIG_SYS_HZ;
}
*/
#include <common.h>
+#include <hang.h>
#include <asm/arch-rockchip/bootrom.h>
#include <asm/arch-rockchip/boot_mode.h>
#include <asm/io.h>
*/
#include <common.h>
#include <dm.h>
+#include <hang.h>
#include <syscon.h>
#include <asm/io.h>
#include <asm/arch-rockchip/bootrom.h>
#include <common.h>
#include <debug_uart.h>
#include <dm.h>
+#include <hang.h>
#include <ram.h>
#include <spl.h>
#include <asm/arch-rockchip/bootrom.h>
#include <common.h>
#include <debug_uart.h>
#include <dm.h>
+#include <hang.h>
#include <ram.h>
#include <spl.h>
#include <version.h>
*/
#include <common.h>
+#include <hang.h>
#include <wait_bit.h>
#include <asm/io.h>
#include <asm/arch/mailbox_s10.h>
#include <common.h>
#include <cpu_func.h>
+#include <hang.h>
#include <asm/io.h>
#include <errno.h>
#include <fdtdec.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <env.h>
#include <errno.h>
#include <common.h>
#include <cpu_func.h>
+#include <hang.h>
#include <asm/io.h>
#include <asm/pl310.h>
#include <asm/u-boot.h>
#include <asm/u-boot.h>
#include <asm/utils.h>
#include <common.h>
+#include <hang.h>
#include <image.h>
#include <spl.h>
#include <asm/arch/clock_manager.h>
*/
#include <common.h>
+#include <hang.h>
#include <asm/io.h>
#include <asm/u-boot.h>
#include <asm/utils.h>
*
*/
+#include <hang.h>
#include <asm/io.h>
#include <asm/u-boot.h>
#include <asm/utils.h>
#include <common.h>
#include <dm.h>
+#include <hang.h>
#include <spl.h>
#include <asm/io.h>
#include <asm/arch/sys_proto.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/arch/clock.h>
#include <asm/arch/dram.h>
#include <common.h>
#include <cpu_func.h>
#include <dm.h>
+#include <init.h>
#include <ns16550.h>
#include <spl.h>
#include <asm/io.h>
#include <env.h>
#include <fdt_support.h>
#include <fdtdec.h>
+#include <hang.h>
#include <stdlib.h>
#include <string.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <irq_func.h>
#include <asm/arch/tegra.h>
#include <asm/arch-tegra/pmc.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <linux/arm-smccc.h>
/**
* Sign a block of data, putting the result into dst.
*
- * \param key Input AES key, length AES_KEY_LENGTH
+ * \param key Input AES key, length AES128_KEY_LENGTH
* \param key_schedule Expanded key to use
* \param src Source data of length 'num_aes_blocks' blocks
- * \param dst Destination buffer, length AES_KEY_LENGTH
+ * \param dst Destination buffer, length AES128_KEY_LENGTH
* \param num_aes_blocks Number of AES blocks to encrypt
*/
static void sign_object(u8 *key, u8 *key_schedule, u8 *src, u8 *dst,
u32 num_aes_blocks)
{
- u8 tmp_data[AES_KEY_LENGTH];
- u8 iv[AES_KEY_LENGTH] = {0};
- u8 left[AES_KEY_LENGTH];
- u8 k1[AES_KEY_LENGTH];
+ u8 tmp_data[AES128_KEY_LENGTH];
+ u8 iv[AES128_KEY_LENGTH] = {0};
+ u8 left[AES128_KEY_LENGTH];
+ u8 k1[AES128_KEY_LENGTH];
u8 *cbc_chain_data;
unsigned i;
cbc_chain_data = zero_key; /* Convenient array of 0's for IV */
/* compute K1 constant needed by AES-CMAC calculation */
- for (i = 0; i < AES_KEY_LENGTH; i++)
+ for (i = 0; i < AES128_KEY_LENGTH; i++)
tmp_data[i] = 0;
- aes_cbc_encrypt_blocks(key_schedule, iv, tmp_data, left, 1);
+ aes_cbc_encrypt_blocks(AES128_KEY_LENGTH, key_schedule, iv,
+ tmp_data, left, 1);
left_shift_vector(left, k1, sizeof(left));
if ((left[0] >> 7) != 0) /* get MSB of L */
- k1[AES_KEY_LENGTH-1] ^= AES_CMAC_CONST_RB;
+ k1[AES128_KEY_LENGTH - 1] ^= AES_CMAC_CONST_RB;
/* compute the AES-CMAC value */
for (i = 0; i < num_aes_blocks; i++) {
aes_apply_cbc_chain_data(tmp_data, k1, tmp_data);
/* encrypt the AES block */
- aes_encrypt(tmp_data, key_schedule, dst);
+ aes_encrypt(AES128_KEY_LENGTH, tmp_data,
+ key_schedule, dst);
debug("sign_obj: block %d of %d\n", i, num_aes_blocks);
/* Update pointers for next loop. */
cbc_chain_data = dst;
- src += AES_KEY_LENGTH;
+ src += AES128_KEY_LENGTH;
}
}
/**
* Encrypt and sign a block of data (depending on security mode).
*
- * \param key Input AES key, length AES_KEY_LENGTH
+ * \param key Input AES key, length AES128_KEY_LENGTH
* \param oper Security operations mask to perform (enum security_op)
* \param src Source data
* \param length Size of source data
- * \param sig_dst Destination address for signature, AES_KEY_LENGTH bytes
+ * \param sig_dst Destination address for signature, AES128_KEY_LENGTH bytes
*/
static int encrypt_and_sign(u8 *key, enum security_op oper, u8 *src,
u32 length, u8 *sig_dst)
{
u32 num_aes_blocks;
- u8 key_schedule[AES_EXPAND_KEY_LENGTH];
- u8 iv[AES_KEY_LENGTH] = {0};
+ u8 key_schedule[AES128_EXPAND_KEY_LENGTH];
+ u8 iv[AES128_KEY_LENGTH] = {0};
debug("encrypt_and_sign: length = %d\n", length);
* The only need for a key is for signing/checksum purposes, so
* if not encrypting, expand a key of 0s.
*/
- aes_expand_key(oper & SECURITY_ENCRYPT ? key : zero_key, key_schedule);
+ aes_expand_key(oper & SECURITY_ENCRYPT ? key : zero_key,
+ AES128_KEY_LENGTH, key_schedule);
- num_aes_blocks = (length + AES_KEY_LENGTH - 1) / AES_KEY_LENGTH;
+ num_aes_blocks = (length + AES128_KEY_LENGTH - 1) / AES128_KEY_LENGTH;
if (oper & SECURITY_ENCRYPT) {
/* Perform this in place, resulting in src being encrypted. */
debug("encrypt_and_sign: begin encryption\n");
- aes_cbc_encrypt_blocks(key_schedule, iv, src, src,
- num_aes_blocks);
+ aes_cbc_encrypt_blocks(AES128_KEY_LENGTH, key_schedule, iv, src,
+ src, num_aes_blocks);
debug("encrypt_and_sign: end encryption\n");
}
*/
#include <common.h>
+#include <cpu_func.h>
#include <linux/io.h>
#include <asm/secure.h>
#include <common.h>
#include <debug_uart.h>
+#include <hang.h>
#include <spl.h>
#include "init.h"
*/
#include <common.h>
+#include <time.h>
DECLARE_GLOBAL_DATA_PTR;
*/
#include <common.h>
#include <debug_uart.h>
+#include <hang.h>
#include <spl.h>
#include <asm/io.h>
#include <common.h>
#include <div64.h>
#include <dm.h>
+#include <time.h>
#include <asm/io.h>
#include <asm/arch/hardware.h>
#include <asm/arch/clk.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/armv7_mpu.h>
DECLARE_GLOBAL_DATA_PTR;
*/
#include <common.h>
+#include <time.h>
#include <asm/arch/clk.h>
#include <asm/arch/hardware.h>
#include <asm/arch/sys_proto.h>
*/
#include <common.h>
+#include <time.h>
#include <asm/arch/hardware.h>
#include <asm/arch/sys_proto.h>
#include <asm/armv8/mmu.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <asm/processor.h>
#include <asm/immap.h>
/******************************************************************************/
/*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
*
* This "function" does not return, instead it continues in RAM
* after relocating the monitor code.
*/
#include <common.h>
+#include <clock_legacy.h>
#include <asm/processor.h>
#include <asm/immap.h>
/******************************************************************************/
/*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
*
* This "function" does not return, instead it continues in RAM
* after relocating the monitor code.
*/
#include <common.h>
+#include <clock_legacy.h>
#include <asm/processor.h>
#include <asm/immap.h>
#include <asm/io.h>
DECLARE_GLOBAL_DATA_PTR;
/* get_clocks() fills in gd->cpu_clock and gd->bus_clk */
-int get_clocks (void)
+int get_clocks(void)
{
#if defined(CONFIG_M5208)
pll_t *pll = (pll_t *) MMAP_PLL;
/******************************************************************************/
/*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
*
* This "function" does not return, instead it continues in RAM
* after relocating the monitor code.
*/
#include <common.h>
+#include <clock_legacy.h>
#include <asm/processor.h>
#include <asm/immap.h>
/******************************************************************************/
/*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
*
* This "function" does not return, instead it continues in RAM
* after relocating the monitor code.
*/
#include <common.h>
+#include <clock_legacy.h>
#include <asm/processor.h>
#include <asm/immap.h>
/******************************************************************************/
/*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
*
* This "function" does not return, instead it continues in RAM
* after relocating the monitor code.
*/
#include <common.h>
+#include <clock_legacy.h>
#include <asm/processor.h>
#include <asm/immap.h>
/******************************************************************************/
/*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
*
* This "function" does not return, instead it continues in RAM
* after relocating the monitor code.
*/
#include <common.h>
+#include <clock_legacy.h>
#include <asm/processor.h>
#include <asm/immap.h>
/******************************************************************************/
/*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
*
* This "function" does not return, instead it continues in RAM
* after relocating the monitor code.
*/
#include <common.h>
+#include <hang.h>
#include <asm/asm.h>
void _hw_exception_handler (void)
#include <cpu_func.h>
#include <env.h>
#include <fdt_support.h>
+#include <hang.h>
#include <image.h>
#include <u-boot/zlib.h>
#include <asm/byteorder.h>
*/
#include <common.h>
+#include <time.h>
#include <asm/mipsregs.h>
unsigned long notrace timer_read_counter(void)
#include <common.h>
#include <cpu_func.h>
+#include <init.h>
#include <asm/relocs.h>
#include <asm/sections.h>
#include <common.h>
#include <cpu_func.h>
+#include <hang.h>
#include <init.h>
#include <asm/mipsregs.h>
#include <asm/addrspace.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <asm/io.h>
#include <asm/addrspace.h>
#include <asm/types.h>
*/
#include <common.h>
+#include <clock_legacy.h>
+#include <hang.h>
#include <asm/io.h>
#include <asm/addrspace.h>
#include <asm/types.h>
*/
#include <common.h>
+#include <init.h>
#include <linux/sizes.h>
#include <asm/addrspace.h>
#include <mach/ddr.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <asm/io.h>
#include <asm/addrspace.h>
#include <asm/types.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <asm/io.h>
#include <asm/addrspace.h>
#include <asm/types.h>
#include <config.h>
#include <common.h>
#include <cpu_func.h>
+#include <hang.h>
#include <init.h>
#include <asm/io.h>
#include <asm/sections.h>
*/
#include <common.h>
+#include <hang.h>
#include <asm/io.h>
#include <mach/jz4780.h>
#include <mach/jz4780_dram.h>
#include <common.h>
#include <dm.h>
+#include <init.h>
#include <ram.h>
#include <wdt.h>
#include <asm/io.h>
j board_init_f ! jump to board_init_f() in lib/board.c
/*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
*
* This "function" does not return, instead it continues in RAM
* after relocating the monitor code.
#include <common.h>
#include <command.h>
#include <env.h>
+#include <hang.h>
#include <image.h>
#include <u-boot/zlib.h>
#include <asm/byteorder.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <irq_func.h>
#include <asm/ptrace.h>
#include <asm/system.h>
* We'll call the board_init_r from here since this isn't
* supposed to return.
*
- * void relocate_code (ulong sp, gd_t *global_data,
+ * void relocate_code(ulong sp, gd_t *global_data,
* ulong reloc_addr)
* __attribute__ ((noreturn));
*/
* Scott McNutt <smcnutt@psyent.com>
*/
-#include <asm/ptrace.h>
#include <common.h>
+#include <hang.h>
+#include <asm/ptrace.h>
void trap_handler (struct pt_regs *regs)
{
*/
printf ("\n\n*** ERROR: unimplemented instruction @ %08x\n",
regs->reg[29] - 4);
- hang ();
+ hang();
}
#include <common.h>
#include <cpu_func.h>
#include <irq_func.h>
+#include <time.h>
#include <vsprintf.h>
#include <watchdog.h>
#include <command.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <linux/libfdt.h>
#include <fdt_support.h>
#include <asm/processor.h>
#include <common.h>
#include <cpu_func.h>
+#include <time.h>
#include <vsprintf.h>
#include <asm/processor.h>
#include <asm/io.h>
#ifndef CONFIG_CLK_MPC83XX
#include <common.h>
+#include <clock_legacy.h>
#include <mpc83xx.h>
#include <command.h>
#include <vsprintf.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <mpc83xx.h>
+#include <time.h>
#include "lblaw/lblaw.h"
#include "elbc/elbc.h"
/*-------------------------------------------------------------------*/
/*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
*
* This "function" does not return, instead it continues in RAM
* after relocating the monitor code.
#include <common.h>
#include <cpu_func.h>
#include <irq_func.h>
+#include <time.h>
#include <vsprintf.h>
#include <watchdog.h>
#include <command.h>
#ifndef CONFIG_SYS_FSL_TBCLK_DIV
#define CONFIG_SYS_FSL_TBCLK_DIV 8
#endif
-__weak unsigned long get_tbclk (void)
+__weak unsigned long get_tbclk(void)
{
unsigned long tbclk_div = CONFIG_SYS_FSL_TBCLK_DIV;
*/
#include <common.h>
+#include <clock_legacy.h>
#include <env.h>
+#include <time.h>
#include <linux/libfdt.h>
#include <fdt_support.h>
#include <asm/processor.h>
#include <common.h>
#include <irq_func.h>
+#include <time.h>
#include <watchdog.h>
#include <command.h>
#include <asm/processor.h>
#endif
}
-
-int get_clocks (void)
+int get_clocks(void)
{
sys_info_t sys_info;
#ifdef CONFIG_ARCH_MPC8544
* get_bus_freq
* return system bus freq in Hz
*********************************************/
-ulong get_bus_freq (ulong dummy)
+ulong get_bus_freq(ulong dummy)
{
return gd->bus_clk;
}
blr
/*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
*
* This "function" does not return, instead it continues in RAM
* after relocating the monitor code.
#include <common.h>
#include <command.h>
+#include <init.h>
#include <irq_func.h>
#include <kgdb.h>
#include <asm/processor.h>
#include <common.h>
#include <cpu_func.h>
+#include <time.h>
#include <vsprintf.h>
#include <watchdog.h>
#include <command.h>
#include <irq_func.h>
#include <mpc86xx.h>
#include <command.h>
+#include <time.h>
#include <asm/processor.h>
#ifdef CONFIG_POST
#include <post.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <mpc86xx.h>
#include <asm/processor.h>
#include <asm/io.h>
blr
/*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
*
* This "function" does not return, instead it continues in RAM
* after relocating the monitor code.
#include <common.h>
#include <command.h>
+#include <init.h>
#include <kgdb.h>
#include <asm/processor.h>
#include <common.h>
#include <cpu_func.h>
+#include <time.h>
#include <vsprintf.h>
#include <watchdog.h>
#include <command.h>
*/
#include <common.h>
+#include <time.h>
#include <linux/libfdt.h>
#include <fdt_support.h>
#include <irq_func.h>
#include <mpc8xx.h>
#include <mpc8xx_irq.h>
+#include <time.h>
#include <asm/cpm_8xx.h>
#include <asm/processor.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <mpc8xx.h>
#include <asm/processor.h>
#include <asm/io.h>
/*------------------------------------------------------------------------------*/
/*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
*
* This "function" does not return, instead it continues in RAM
* after relocating the monitor code.
*/
#include <common.h>
+#include <hang.h>
#include <asm/fsl_lbc.h>
#ifdef CONFIG_MPC83xx
void interrupt_init_cpu(unsigned *);
void timer_interrupt_cpu(struct pt_regs *);
unsigned long search_exception_table(unsigned long addr);
+void upmconfig(uint upm, uint *table, uint size);
#endif /* !__ASSEMBLY__ */
#include <common.h>
#include <cpu_func.h>
#include <env.h>
+#include <init.h>
#include <watchdog.h>
#include <command.h>
#include <image.h>
#endif
/*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
*
* This "function" does not return, instead it continues in RAM
* after relocating the monitor code.
#include <common.h>
#include <command.h>
#include <dm.h>
+#include <fdt_support.h>
+#include <hang.h>
#include <dm/root.h>
#include <image.h>
#include <asm/byteorder.h>
*/
#include <common.h>
+#include <hang.h>
#include <irq_func.h>
#include <asm/ptrace.h>
#include <asm/system.h>
#include <common.h>
#include <command.h>
+#include <hang.h>
int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
*/
#include <common.h>
#include <cpu_func.h>
+#include <hang.h>
#include <spl.h>
#include <asm/smp.h>
#include <common.h>
#include <dm.h>
+#include <hang.h>
#include <os.h>
#include <spl.h>
#include <asm/spl.h>
int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
disable_interrupts();
- reset_cpu (0);
+ reset_cpu(0);
return 0;
}
// SPDX-License-Identifier: GPL-2.0+
#include <common.h>
+#include <cpu_func.h>
#include <asm/processor.h>
#include <asm/system.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <init.h>
DECLARE_GLOBAL_DATA_PTR;
#include <common.h>
#include <cpu.h>
#include <dm.h>
+#include <init.h>
#include <pci.h>
#include <asm/cpu.h>
#include <asm/cpu_x86.h>
*/
#include <common.h>
+#include <init.h>
#include <mmc.h>
#include <pci_ids.h>
#include <asm/irq.h>
#include <cpu_func.h>
#include <dm.h>
#include <errno.h>
+#include <init.h>
#include <malloc.h>
#include <syscon.h>
#include <asm/acpi.h>
#include <common.h>
#include <cpu_func.h>
+#include <init.h>
#include <malloc.h>
#include <spl.h>
#include <asm/control_regs.h>
#include <common.h>
#include <dm.h>
#include <efi_loader.h>
+#include <hang.h>
+#include <init.h>
#include <irq_func.h>
#include <asm/control_regs.h>
#include <asm/i8259.h>
*/
#include <common.h>
+#include <hang.h>
#include <asm/arch/device.h>
#include <asm/arch/mrc.h>
#include <asm/arch/msg_port.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/e820.h>
#include <asm/global_data.h>
#include <asm/sfi.h>
#include <common.h>
#include <command.h>
+#include <hang.h>
#include <dm/device.h>
#include <dm/root.h>
#include <errno.h>
#include <cpu_func.h>
#include <debug_uart.h>
#include <dm.h>
+#include <hang.h>
#include <irq_func.h>
#include <malloc.h>
#include <spl.h>
#include <common.h>
#include <debug_uart.h>
#include <dm.h>
+#include <hang.h>
#include <spl.h>
#include <asm/cpu.h>
#include <asm/mtrr.h>
ill
/*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_sp, gd, addr_moni)
*
* This "function" does not return, instead it continues in RAM
* after relocating the monitor code.
* Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
*/
+#include <init.h>
#include <asm/mach-types.h>
#include <common.h>
#if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
*/
#include <common.h>
+#include <init.h>
#if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
#include <netdev.h>
#endif
*/
#include <common.h>
+#include <init.h>
#if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
#include <netdev.h>
#endif
*/
#include <common.h>
+#include <clock_legacy.h>
#include <console.h>
#include <env.h>
#include <env_internal.h>
+#include <init.h>
#include <ns16550.h>
#include <malloc.h>
#include <mmc.h>
*/
#include <common.h>
+#include <init.h>
#include <ns16550.h>
#include <asm/io.h>
#include <nand.h>
*
*/
#include <common.h>
+#include <cpu_func.h>
+#include <hang.h>
#include <spl.h>
#include <dm.h>
#include <miiphy.h>
#include "asm/m5282.h"
#include <bmp_layout.h>
#include <env.h>
+#include <init.h>
#include <status_led.h>
#include <bus_vcxk.h>
}
#if defined(CONFIG_SYS_DRAM_TEST)
-int testdram (void)
+int testdram(void)
{
uint *pstart = (uint *) CONFIG_SYS_MEMTEST_START;
uint *pend = (uint *) CONFIG_SYS_MEMTEST_END;
*/
#include <common.h>
+#include <init.h>
#include <asm/io.h>
#include <env.h>
#include <linux/errno.h>
#include <common.h>
#include <miiphy.h>
+#include <net.h>
#include <asm/arch/orion5x.h>
#include "../common/common.h"
#include <spl.h>
#include <command.h>
#include <env.h>
#include <i2c.h>
+#include <net.h>
#include <asm/mach-types.h>
#include <asm/arch/cpu.h>
#include <asm/arch/soc.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <net.h>
#include <asm/mach-types.h>
#include <asm/arch/cpu.h>
#include <asm/arch/soc.h>
// SPDX-License-Identifier: GPL-2.0+
#include <common.h>
+#include <net.h>
#include <linux/io.h>
#include <miiphy.h>
#include <netdev.h>
#include <common.h>
#include <miiphy.h>
+#include <net.h>
#include <asm/arch/cpu.h>
#include <asm/arch/soc.h>
#include <asm/arch/mpp.h>
#include <common.h>
#include <miiphy.h>
+#include <net.h>
#include <asm/mach-types.h>
#include <asm/arch/cpu.h>
#include <asm/arch/soc.h>
#include <common.h>
#include <miiphy.h>
+#include <net.h>
#include <asm/mach-types.h>
#include <asm/arch/cpu.h>
#include <asm/arch/soc.h>
#include <common.h>
#include <miiphy.h>
+#include <net.h>
#include <asm/mach-types.h>
#include <asm/arch/cpu.h>
#include <asm/arch/soc.h>
#include <common.h>
#include <miiphy.h>
+#include <net.h>
#include <asm/arch/soc.h>
#include <asm/arch/mpp.h>
#include <asm/arch/cpu.h>
#include <common.h>
#include <miiphy.h>
+#include <net.h>
#include <asm/mach-types.h>
#include <asm/arch/soc.h>
#include <asm/arch/mpp.h>
#include <common.h>
#include <miiphy.h>
+#include <net.h>
#include <asm/mach-types.h>
#include <asm/arch/soc.h>
#include <asm/arch/mpp.h>
#include <common.h>
#include <miiphy.h>
+#include <net.h>
#include <asm/setup.h>
#include <asm/arch/cpu.h>
#include <asm/arch/soc.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <netdev.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <errno.h>
#include <linux/libfdt.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <net.h>
#include <linux/io.h>
#include <miiphy.h>
#include <netdev.h>
#include <common.h>
#include <miiphy.h>
+#include <net.h>
#include <netdev.h>
#include <led.h>
#include <linux/io.h>
*/
#include <common.h>
+#include <hang.h>
#include <init.h>
#include <jffs2/jffs2.h>
#include <nand.h>
#include <cpu_func.h>
#include <dm.h>
#include <env.h>
+#include <init.h>
#include <netdev.h>
#include <asm/io.h>
#include <dm/platform_data/serial_pl01x.h>
* Return the timebase clock frequency
* i.e. how often the timer decrements
*/
-ulong get_tbclk (void)
+ulong get_tbclk(void)
{
unsigned long long tmp = CONFIG_SYS_HZ_CLOCK;
*/
#include <common.h>
#include <cpu_func.h>
+#include <init.h>
#include <malloc.h>
#include <errno.h>
#include <netdev.h>
* Sharma Bhupesh <bhupesh.sharma@freescale.com>
*/
#include <common.h>
+#include <cpu_func.h>
#include <dm.h>
#include <malloc.h>
#include <errno.h>
*/
#include <common.h>
+#include <init.h>
#include <serial.h>
#include <watchdog.h>
#include <command.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <init.h>
#include <malloc.h>
#include <asm/processor.h>
*/
#include <common.h>
+#include <init.h>
#include <netdev.h>
#include <asm/mach-types.h>
#include <asm/arch/hardware.h>
#include <common.h>
#include <debug_uart.h>
+#include <init.h>
+#include <net.h>
#include <asm/io.h>
#include <asm/arch/at91sam9260_matrix.h>
#include <asm/arch/at91sam9_smc.h>
#include <common.h>
#include <debug_uart.h>
+#include <init.h>
#include <vsprintf.h>
#include <asm/io.h>
#include <asm/arch/at91sam9261.h>
#include <common.h>
#include <debug_uart.h>
+#include <init.h>
+#include <net.h>
#include <vsprintf.h>
#include <linux/sizes.h>
#include <asm/arch/at91sam9263.h>
#include <common.h>
#include <debug_uart.h>
+#include <init.h>
+#include <net.h>
#include <vsprintf.h>
#include <asm/io.h>
#include <asm/arch/clk.h>
*/
#include <common.h>
+#include <init.h>
#include <vsprintf.h>
#include <asm/io.h>
#include <asm/arch/at91sam9x5_matrix.h>
#include <common.h>
#include <debug_uart.h>
+#include <init.h>
#include <vsprintf.h>
#include <asm/io.h>
#include <asm/mach-types.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/arch/at91sam9_smc.h>
#include <asm/arch/at91_common.h>
#include <common.h>
#include <debug_uart.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/arch/at91_common.h>
#include <asm/arch/atmel_pio4.h>
*/
#include <common.h>
+#include <init.h>
#include <mmc.h>
#include <fsl_esdhc_imx.h>
#include <miiphy.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/arch/clock.h>
#include <asm/arch/imx-regs.h>
#include <common.h>
#include <dm.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/gpio.h>
#include <asm/mach-types.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <env.h>
#include <errno.h>
#include <init.h>
*/
#include <common.h>
+#include <hang.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/hardware.h>
#include <asm/arch/mux.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/mach-types.h>
#include <env.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/mach-types.h>
#include <env.h>
#include <common.h>
#include <cpu_func.h>
+#include <init.h>
#include <asm/io.h>
#include <config.h>
#include <netdev.h>
* (C) Copyright 2016 Broadcom Ltd.
*/
#include <common.h>
+#include <cpu_func.h>
+#include <init.h>
#include <asm/system.h>
#include <asm/armv8/mmu.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/arch/at91sam9_smc.h>
#include <asm/arch/at91_common.h>
#include <asm/arch/at91_matrix.h>
**/
#include <common.h>
+#include <cpu_func.h>
#include <dm.h>
#include <init.h>
#include <malloc.h>
#include <common.h>
#include <miiphy.h>
+#include <net.h>
#include <asm/arch/cpu.h>
#include <asm/arch/soc.h>
#include <asm/arch/mpp.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/immap.h>
DECLARE_GLOBAL_DATA_PTR;
return 0;
};
-int testdram (void)
+int testdram(void)
{
/* TODO: XXX XXX XXX */
printf ("DRAM test not implemented!\n");
*/
#include <common.h>
+#include <hang.h>
+#include <init.h>
#include <spl.h>
#include <fsl_esdhc_imx.h>
#include <asm/mach-imx/iomux-v3.h>
*/
#include <common.h>
+#include <clock_legacy.h>
+#include <hang.h>
+#include <init.h>
#include <spl.h>
#include <asm/io.h>
#include <asm/gpio.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <errno.h>
+#include <init.h>
#include <asm/arch/ddr_defs.h>
#include <asm/arch/clock.h>
*/
#include <common.h>
+#include <hang.h>
+#include <init.h>
#include <spl.h>
#include <i2c.h>
#include <asm/arch/clock.h>
#include <common.h>
#include <miiphy.h>
+#include <net.h>
#include <netdev.h>
#include <asm/arch/cpu.h>
#include <asm/arch/soc.h>
*/
#include <common.h>
+#include <init.h>
#include <net.h>
#include <netdev.h>
#include <miiphy.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <hang.h>
#include <init.h>
#include <mmc.h>
#include <asm/arch/clock.h>
#include <common.h>
#include <env.h>
+#include <init.h>
#include <serial.h>
#include <vsprintf.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <fdt_support.h>
+#include <init.h>
#include <ioports.h>
#include <mpc83xx.h>
#include <asm/mpc8349_pci.h>
*/
#include <common.h>
+#include <hang.h>
#ifdef CONFIG_SPL_BUILD
static int setup_led(void)
#include <common.h>
#include <command.h>
#include <env.h>
+#include <fdt_support.h>
#include <i2c.h>
#include <init.h>
#include <irq_func.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <console.h>
#include <env.h>
#include <env_internal.h>
+#include <init.h>
#include <asm/spl.h>
#include <malloc.h>
#include <ns16550.h>
*/
#include <common.h>
+#include <init.h>
#include <vsprintf.h>
#include <asm/mmu.h>
#include <asm/immap_85xx.h>
*/
#include <common.h>
+#include <init.h>
#include <ns16550.h>
#include <asm/io.h>
#include <nand.h>
*/
#include <common.h>
+#include <init.h>
#include <ns16550.h>
#include <asm/io.h>
#include <nand.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <console.h>
#include <env_internal.h>
+#include <init.h>
#include <ns16550.h>
#include <malloc.h>
#include <mmc.h>
*/
#include <common.h>
+#include <init.h>
#include <mpc85xx.h>
#include <asm/io.h>
#include <ns16550.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <fdt_support.h>
#include <init.h>
#include <netdev.h>
#include <linux/compiler.h>
*/
#include <common.h>
+#include <cpu_func.h>
+#include <hang.h>
#include <spl.h>
#include <asm/io.h>
#include <asm/mach-imx/iomux-v3.h>
*/
#include <common.h>
+#include <cpu_func.h>
+#include <hang.h>
#include <spl.h>
#include <asm/io.h>
#include <asm/mach-imx/iomux-v3.h>
*/
#include <common.h>
+#include <cpu_func.h>
+#include <hang.h>
#include <spl.h>
#include <asm/io.h>
#include <errno.h>
*/
#include <common.h>
+#include <hang.h>
#include <asm/io.h>
#include <errno.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <env.h>
#include <errno.h>
#include <init.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <env.h>
#include <errno.h>
#include <init.h>
#include <common.h>
#include <dm.h>
+#include <net.h>
#include <asm/io.h>
#include <netdev.h>
#include <fm_eth.h>
*/
#include <common.h>
+#include <fdt_support.h>
#include <i2c.h>
#include <asm/io.h>
#include <asm/arch/clock.h>
#include <common.h>
#include <dm.h>
+#include <net.h>
#include <asm/io.h>
#include <netdev.h>
#include <fm_eth.h>
*/
#include <common.h>
+#include <fdt_support.h>
+#include <hang.h>
#include <i2c.h>
#include <asm/io.h>
#include <asm/arch/clock.h>
*/
#include <common.h>
+#include <clock_legacy.h>
+#include <fdt_support.h>
#include <init.h>
#include <asm/arch/immap_ls102xa.h>
#include <asm/arch/clock.h>
*/
#include <common.h>
+#include <clock_legacy.h>
+#include <fdt_support.h>
#include <i2c.h>
#include <init.h>
#include <asm/io.h>
/* Copyright 2016-2019 NXP Semiconductors
*/
#include <common.h>
+#include <clock_legacy.h>
+#include <fdt_support.h>
#include <init.h>
#include <asm/arch-ls102xa/ls102xa_soc.h>
#include <asm/arch/ls102xa_devdis.h>
*/
#include <common.h>
+#include <clock_legacy.h>
+#include <fdt_support.h>
#include <i2c.h>
#include <init.h>
#include <asm/io.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <net.h>
#include <netdev.h>
#include <asm/io.h>
#include <asm/arch/fsl_serdes.h>
#include <common.h>
#include <command.h>
+#include <net.h>
#include <netdev.h>
#include <malloc.h>
#include <fsl_mdio.h>
#include <common.h>
#include <malloc.h>
#include <errno.h>
+#include <net.h>
#include <netdev.h>
#include <fsl_ifc.h>
#include <fsl_ddr.h>
#include <common.h>
#include <env.h>
+#include <net.h>
#include <netdev.h>
#include <asm/io.h>
#include <asm/arch/fsl_serdes.h>
#include <common.h>
#include <command.h>
+#include <net.h>
#include <netdev.h>
#include <malloc.h>
#include <fsl_mdio.h>
#include <env.h>
#include <hwconfig.h>
#include <command.h>
+#include <net.h>
#include <netdev.h>
#include <malloc.h>
#include <fsl_mdio.h>
#include <common.h>
#include <command.h>
+#include <net.h>
#include <netdev.h>
#include <malloc.h>
#include <fsl_mdio.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <dm.h>
#include <dm/platform_data/serial_pl01x.h>
#include <i2c.h>
#include <config.h>
#include <common.h>
+#include <init.h>
#include <asm/immap.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/immap.h>
#include <asm/io.h>
#include <config.h>
#include <common.h>
+#include <init.h>
#include <asm/immap.h>
#include <asm/io.h>
#include <common.h>
#include <command.h>
+#include <init.h>
#include <malloc.h>
#include <asm/immap.h>
};
-int testdram (void) {
+int testdram(void)
+{
/* TODO: XXX XXX XXX */
printf ("DRAM test not implemented!\n");
*/
#include <common.h>
+#include <init.h>
#include <asm/immap.h>
#include <netdev.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/immap.h>
#include <asm/io.h>
return 0;
};
-int testdram (void) {
+int testdram(void)
+{
/* TODO: XXX XXX XXX */
printf ("DRAM test not implemented!\n");
*/
#include <common.h>
+#include <init.h>
#include <asm/immap.h>
#include <asm/io.h>
#include <config.h>
#include <common.h>
+#include <init.h>
#include <asm/immap.h>
#include <asm/io.h>
#include <config.h>
#include <common.h>
+#include <init.h>
#include <asm/immap.h>
#include <asm/io.h>
#include <config.h>
#include <common.h>
+#include <init.h>
#include <asm/immap.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <init.h>
#include <spi.h>
#include <asm/io.h>
#include <asm/immap.h>
*/
#include <common.h>
+#include <init.h>
#include <spi.h>
#include <asm/immap.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <init.h>
#include <mpc83xx.h>
#include <asm/bitops.h>
*/
#include <common.h>
+#include <clock_legacy.h>
+#include <fdt_support.h>
#include <init.h>
#if defined(CONFIG_OF_LIBFDT)
#include <linux/libfdt.h>
#include <common.h>
#include <eeprom.h>
#include <env.h>
+#include <fdt_support.h>
#include <init.h>
#include <ioports.h>
#include <mpc83xx.h>
*/
#include <common.h>
+#include <fdt_support.h>
#include <init.h>
#include <ioports.h>
#include <mpc83xx.h>
*/
#include <common.h>
+#include <fdt_support.h>
#include <ioports.h>
#include <mpc83xx.h>
#include <asm/mpc8349_pci.h>
*/
#include <common.h>
+#include <fdt_support.h>
#include <ioports.h>
#include <mpc83xx.h>
#include <i2c.h>
#include <env.h>
#include <hwconfig.h>
#include <i2c.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/fsl_mpc83xx_serdes.h>
#include <fdt_support.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <command.h>
#include <asm/io.h>
#include <fsl_diu_fb.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/sys_proto.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/sys_proto.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/iomux.h>
#include <asm/arch/clock.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <console.h>
#include <env.h>
#include <env_internal.h>
+#include <init.h>
#include <ns16550.h>
#include <malloc.h>
#include <mmc.h>
* Copyright 2011 Freescale Semiconductor, Inc.
*/
#include <common.h>
+#include <init.h>
#include <mpc85xx.h>
#include <asm/io.h>
#include <ns16550.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <command.h>
#include <linux/ctype.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <console.h>
#include <env.h>
#include <env_internal.h>
+#include <init.h>
#include <ns16550.h>
#include <malloc.h>
#include <mmc.h>
*/
#include <common.h>
+#include <init.h>
#include <ns16550.h>
#include <asm/io.h>
#include <nand.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <hang.h>
#include <hwconfig.h>
#include <init.h>
#include <pci.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <console.h>
#include <env.h>
#include <env_internal.h>
+#include <init.h>
#include <ns16550.h>
#include <malloc.h>
#include <mmc.h>
*/
#include <common.h>
+#include <init.h>
#include <ns16550.h>
#include <asm/io.h>
#include <nand.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <fdt_support.h>
#include <init.h>
#include <netdev.h>
#include <linux/compiler.h>
#include <env.h>
#include <init.h>
#include <pci.h>
+#include <time.h>
#include <asm/processor.h>
#include <asm/mmu.h>
#include <asm/fsl_pci.h>
sys_info->freq_processor[0] = freq;
}
-int get_clocks (void)
+int get_clocks(void)
{
sys_info_t sys_info;
return 0;
}
-unsigned long get_tbclk (void)
+unsigned long get_tbclk(void)
{
void *fdt = get_fdt_virt();
int cpus_node = fdt_path_offset(fdt, "/cpus");
* get_bus_freq
* return system bus freq in Hz
*********************************************/
-ulong get_bus_freq (ulong dummy)
+ulong get_bus_freq(ulong dummy)
{
sys_info_t sys_info;
get_sys_info(&sys_info);
*/
#include <common.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/siul.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <console.h>
#include <env_internal.h>
+#include <init.h>
#include <malloc.h>
#include <ns16550.h>
#include <nand.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <fdt_support.h>
#include <i2c.h>
#include <init.h>
#include <netdev.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <console.h>
#include <env_internal.h>
+#include <init.h>
#include <malloc.h>
#include <ns16550.h>
#include <nand.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <fdt_support.h>
#include <i2c.h>
#include <init.h>
#include <netdev.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <command.h>
#include <linux/ctype.h>
#include <asm/io.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <fdt_support.h>
#include <i2c.h>
#include <init.h>
#include <netdev.h>
* Author: Priyanka Jain <Priyanka.Jain@freescale.com>
*/
+#include <clock_legacy.h>
#include <asm/io.h>
#include <common.h>
#include <command.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <console.h>
#include <env_internal.h>
+#include <init.h>
#include <malloc.h>
#include <ns16550.h>
#include <nand.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <fdt_support.h>
#include <hwconfig.h>
#include <init.h>
#include <netdev.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <console.h>
#include <env_internal.h>
+#include <init.h>
#include <malloc.h>
#include <ns16550.h>
#include <nand.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <fdt_support.h>
#include <i2c.h>
#include <init.h>
#include <netdev.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <console.h>
#include <env_internal.h>
+#include <init.h>
#include <malloc.h>
#include <ns16550.h>
#include <nand.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <fdt_support.h>
#include <i2c.h>
#include <init.h>
#include <netdev.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <console.h>
#include <env_internal.h>
+#include <init.h>
#include <asm/spl.h>
#include <malloc.h>
#include <ns16550.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <fdt_support.h>
#include <i2c.h>
#include <init.h>
#include <netdev.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <fdt_support.h>
#include <i2c.h>
#include <init.h>
#include <irq_func.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <console.h>
#include <env_internal.h>
+#include <init.h>
#include <asm/spl.h>
#include <malloc.h>
#include <ns16550.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <fdt_support.h>
#include <i2c.h>
#include <init.h>
#include <netdev.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/iomux-vf610.h>
#include <common.h>
#include <env.h>
+#include <hang.h>
#include <asm/io.h>
#include <asm/arch/crm_regs.h>
#include <asm/arch/mx6-ddr.h>
#ifndef CONFIG_MPC83XX_SDRAM
#include <common.h>
+#include <init.h>
#include <mpc83xx.h>
#include <spd_sdram.h>
#include <command.h>
#include <dm.h>
#include <env.h>
+#include <hang.h>
#include <malloc.h>
#include <fs.h>
#include <i2c.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <command.h>
#include <linux/ctype.h>
#include <asm/io.h>
* Peter Griffin <peter.griffin@linaro.org>
*/
#include <common.h>
+#include <cpu_func.h>
#include <dm.h>
+#include <fdt_support.h>
#include <dm/platform_data/serial_pl01x.h>
#include <errno.h>
#include <malloc.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <dm.h>
#include <errno.h>
#include <asm/io.h>
* Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
*/
+#include <cpu_func.h>
#include <dm.h>
#include <common.h>
+#include <init.h>
#include <asm/io.h>
#include <dm/platform_data/serial_pl01x.h>
#include <asm/arch/hi3798cv200.h>
*/
#include <common.h>
+#include <fdt_support.h>
+#include <init.h>
#include <mpc83xx.h>
#include <spi.h>
#include <linux/libfdt.h>
#include <common.h>
#include <command.h>
+#include <fs.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/sys_proto.h>
#include <common.h>
#include <env.h>
+#include <fdt_support.h>
#include <init.h>
#include <ioports.h>
#include <mpc83xx.h>
#include <i2c.h>
#include <init.h>
#include <nand.h>
+#include <net.h>
#include <netdev.h>
#include <miiphy.h>
#include <spi.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <fdt_support.h>
#include <init.h>
#include <netdev.h>
#include <linux/compiler.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/sys_proto.h>
#include <asm/gpio.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <init.h>
#include <asm/io.h>
#include <asm/arch/clock.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/arch/at91_common.h>
#include <asm/arch/at91_pmc.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/arch/at91sam9x5_matrix.h>
#include <asm/arch/at91sam9_smc.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <env.h>
#include <serial.h>
#include <spl.h>
*/
#include <common.h>
+#include <init.h>
#include <vsprintf.h>
#include <asm/io.h>
#include <asm/arch/clk.h>
*/
#include <common.h>
+#include <init.h>
#include <mpc83xx.h>
#include <asm/bitops.h>
* Copyright (C) 2015-2016 Stefan Roese <sr@denx.de>
*/
+#include <init.h>
#include <asm/arch/clock.h>
#include <asm/arch/crm_regs.h>
#include <asm/arch/mx6-pins.h>
*/
#include <common.h>
+#include <init.h>
#include <spl.h>
#include <asm/arch/cpu.h>
#include <asm/arch/ddr_defs.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/armv8/mmu.h>
#include <asm/system.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <dm.h>
#include <env.h>
#include <init.h>
* (C) Copyright 2017 Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
*/
+#include <cpu_func.h>
#include <asm/arch/sysmap-apq8096.h>
#include <env.h>
#include <linux/arm-smccc.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <env.h>
+#include <hang.h>
#include <malloc.h>
#include <dm.h>
#include <dm/platform_data/serial_sh.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <malloc.h>
#include <dm/platform_data/serial_sh.h>
#include <asm/processor.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/arch/mmc.h>
#include <asm/arch/rcar-mstp.h>
#include <asm/arch/rmobile.h>
*/
#include <common.h>
+#include <cpu_func.h>
+#include <hang.h>
#include <asm/processor.h>
#include <asm/mach-types.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <cpu_func.h>
+#include <hang.h>
#include <malloc.h>
#include <netdev.h>
#include <dm.h>
*/
#include <common.h>
+#include <cpu_func.h>
+#include <hang.h>
#include <malloc.h>
#include <netdev.h>
#include <dm.h>
*/
#include <common.h>
+#include <cpu_func.h>
+#include <hang.h>
#include <malloc.h>
#include <netdev.h>
#include <dm.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <env.h>
+#include <hang.h>
#include <malloc.h>
#include <dm.h>
#include <dm/platform_data/serial_sh.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <malloc.h>
#include <dm/platform_data/serial_sh.h>
#include <asm/processor.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/sys_proto.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <env.h>
+#include <hang.h>
#include <malloc.h>
#include <dm.h>
#include <dm/platform_data/serial_sh.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <malloc.h>
#include <dm/platform_data/serial_sh.h>
#include <asm/processor.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <env.h>
#include <env_internal.h>
+#include <hang.h>
#include <malloc.h>
#include <netdev.h>
#include <dm.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <malloc.h>
#include <dm/platform_data/serial_sh.h>
#include <asm/processor.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <env.h>
+#include <hang.h>
#include <malloc.h>
#include <dm.h>
#include <dm/platform_data/serial_sh.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <malloc.h>
#include <dm/platform_data/serial_sh.h>
#include <asm/processor.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <spl.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <malloc.h>
#include <netdev.h>
#include <dm.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <env.h>
+#include <hang.h>
#include <malloc.h>
#include <dm.h>
#include <dm/platform_data/serial_sh.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <malloc.h>
#include <dm/platform_data/serial_sh.h>
#include <asm/processor.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/gpio.h>
#include "cpld.h"
*/
#include <common.h>
+#include <cpu_func.h>
#include <malloc.h>
#include <dm/platform_data/serial_sh.h>
#include <asm/processor.h>
*/
#include <common.h>
+#include <init.h>
#include <vsprintf.h>
#include <linux/sizes.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <init.h>
#include <linux/sizes.h>
#include <asm/io.h>
#include <asm/gpio.h>
*/
#include <common.h>
+#include <init.h>
#include <linux/sizes.h>
#include <asm/io.h>
#include <asm/gpio.h>
#include <common.h>
#include <cpu_func.h>
+#include <init.h>
#include <usb.h>
#include <asm/gpio.h>
#include <asm/arch/pinmux.h>
#include <cros_ec.h>
#include <errno.h>
#include <fdtdec.h>
+#include <hang.h>
#include <init.h>
#include <spi.h>
#include <tmu.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/gpio.h>
#include <asm/io.h>
#include <asm/arch/sromc.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/gpio.h>
#include <asm/io.h>
#include <netdev.h>
*/
#include <common.h>
+#include <fdt_support.h>
#include <ioports.h>
#include <mpc83xx.h>
#include <asm/mpc8349_pci.h>
}
#if defined(CONFIG_SYS_DRAM_TEST)
-int testdram (void)
+int testdram(void)
{
uint *pstart = (uint *) CONFIG_SYS_MEMTEST_START;
uint *pend = (uint *) CONFIG_SYS_MEMTEST_END;
* Modified by: Boris Brezillon <boris.brezillon@free-electrons.com>
*/
+#include <init.h>
#include <asm/arch/clock.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/iomux.h>
#include <common.h>
#include <dm.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/arch/at91sam9g45_matrix.h>
#include <asm/arch/at91sam9_smc.h>
#include <common.h>
#include <dm.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/arch/at91sam9_sdramc.h>
#include <asm/arch/at91sam9260_matrix.h>
#include <common.h>
#include <dm.h>
#include <env.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/arch/at91sam9260_matrix.h>
#include <asm/arch/at91sam9_smc.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/processor.h>
#include <asm/immap_85xx.h>
#include <fsl_ddr_sdram.h>
#endif
#if defined(CONFIG_SYS_DRAM_TEST)
-int testdram (void)
+int testdram(void)
{
uint *pstart = (uint *) CONFIG_SYS_MEMTEST_START;
uint *pend = (uint *) CONFIG_SYS_MEMTEST_END;
*/
#include <common.h>
+#include <clock_legacy.h>
#include <env.h>
#include <pci.h>
#include <asm/processor.h>
/* Init UPMA for FPGA access */
out_be32 (&lbc->mamr, 0x44440); /* Use a customer-supplied value */
- upmconfig (UPMA, (uint *)UPMTableA, sizeof(UPMTableA)/sizeof(int));
+ upmconfig(UPMA, (uint *)UPMTableA, sizeof(UPMTableA) / sizeof(int));
/* Init UPMB for Lime controller access */
out_be32 (&lbc->mbmr, 0x444440); /* Use a customer-supplied value */
- upmconfig (UPMB, (uint *)UPMTableB, sizeof(UPMTableB)/sizeof(int));
+ upmconfig(UPMB, (uint *)UPMTableB, sizeof(UPMTableB) / sizeof(int));
}
#ifdef CONFIG_BOARD_EARLY_INIT_R
#include <env_internal.h>
#include <g_dnl.h>
#include <generic-phy.h>
+#include <hang.h>
#include <i2c.h>
#include <init.h>
#include <led.h>
#include <common.h>
#include <dm.h>
#include <env.h>
+#include <hang.h>
+#include <init.h>
#include <mmc.h>
#include <axp_pmic.h>
#include <generic-phy.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <dwmmc.h>
#include <malloc.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <malloc.h>
#include <dwmmc.h>
#include <linux/libfdt.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/immap.h>
#include <asm/io.h>
#include <dm.h>
*/
#include <common.h>
+#include <init.h>
#include <spi.h>
#include <asm/io.h>
#include <asm/immap.h>
// SPDX-License-Identifier: GPL-2.0+
+#include <common.h>
+#include <cpu_func.h>
+#include <hang.h>
+#include <init.h>
#include <asm/arch/clock.h>
#include <asm/arch/iomux.h>
#include <asm/arch/imx-regs.h>
* Author: Richard Hu <richard.hu@technexion.com>
*/
+#include <cpu_func.h>
#include <asm/arch/clock.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/crm_regs.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/io.h>
#include <asm/gpio.h>
#include <asm/arch/imx-regs.h>
#include <common.h>
#include <eeprom.h>
#include <env.h>
+#include <fdt_support.h>
#include <i2c.h>
#include <init.h>
#include <linux/errno.h>
#include <common.h>
#include <env.h>
+#include <fdt_support.h>
#include <init.h>
#include <palmas.h>
#include <sata.h>
*/
#include <common.h>
#include <env.h>
+#include <fdt_support.h>
#include <init.h>
#include <palmas.h>
#include <sata.h>
#include <common.h>
#include "board.h"
#include <env.h>
+#include <hang.h>
+#include <init.h>
#include <spl.h>
#include <exports.h>
#include <fdt_support.h>
#include <common.h>
#include <eeprom.h>
#include <env.h>
+#include <hang.h>
#include <init.h>
#include <asm/arch/clock.h>
#include <asm/ti-common/keystone_net.h>
*/
#include <common.h>
+#include <hang.h>
#include <asm/io.h>
#include <asm/arch/mux-k2g.h>
#include <asm/arch/hardware.h>
*/
#include <common.h>
+#include <init.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/clk.h>
#include <asm/arch/cpu.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <init.h>
#include <asm/arch/clock.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <dm.h>
#include <init.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <init.h>
#include <asm/arch/clock.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <dm.h>
#include <env.h>
#include <init.h>
* Copyright (C) 2016-2018 Toradex AG
*/
+#include <common.h>
+#include <cpu_func.h>
+#include <init.h>
#include <asm/arch/clock.h>
#include <asm/arch/crm_regs.h>
#include <asm/arch/imx-regs.h>
*/
#include <common.h>
+#include <fdt_support.h>
+#include <init.h>
#include <ioports.h>
#include <mpc83xx.h>
#include <asm/mpc8349_pci.h>
* Copyright (C) 2018 Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
*/
+#include <cpu_func.h>
#include <linux/arm-smccc.h>
#include <linux/psci.h>
#include <common.h>
#include <common.h>
#include <command.h>
#include <env.h>
+#include <fdt_support.h>
#include <init.h>
#include <netdev.h>
#include <linux/compiler.h>
*/
#include <common.h>
+#include <fdt_support.h>
#include <init.h>
#include <linux/libfdt.h>
#include <pci.h>
/* now check the real size */
disable_addr_trans ();
- msize = get_ram_size (CONFIG_SYS_SDRAM_BASE, msize);
+ msize = get_ram_size(CONFIG_SYS_SDRAM_BASE, msize);
enable_addr_trans ();
#endif
*/
#include <common.h>
+#include <init.h>
#include <asm/io.h>
#include <linux/errno.h>
#include <asm/arch/imx-regs.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <fdtdec.h>
#include <init.h>
#include <malloc.h>
#include <common.h>
#include <miiphy.h>
+#include <net.h>
#include <asm/arch/cpu.h>
#include <asm/arch/soc.h>
#include <asm/arch/mpp.h>
See doc/android/fastboot.txt for more information.
-config CMD_FDC
- bool "fdcboot - Boot from floppy device"
- help
- The 'fdtboot' command allows booting an image from a floppy disk.
-
config CMD_FLASH
bool "flinfo, erase, protect"
default y
obj-$(CONFIG_CMD_EXT4) += ext4.o
obj-$(CONFIG_CMD_EXT2) += ext2.o
obj-$(CONFIG_CMD_FAT) += fat.o
-obj-$(CONFIG_CMD_FDC) += fdc.o
obj-$(CONFIG_CMD_FDT) += fdt.o
obj-$(CONFIG_CMD_FITUPD) += fitupd.o
obj-$(CONFIG_CMD_FLASH) += flash.o
/*
* Copyright (C) 2014 Marek Vasut <marex@denx.de>
*
- * Command for en/de-crypting block of memory with AES-128-CBC cipher.
+ * Command for en/de-crypting block of memory with AES-[128/192/256]-CBC cipher.
*/
#include <common.h>
#include <linux/compiler.h>
#include <mapmem.h>
+u32 aes_get_key_len(char *command)
+{
+ u32 key_len = AES128_KEY_LENGTH;
+
+ if (!strcmp(command, "aes.192"))
+ key_len = AES192_KEY_LENGTH;
+ else if (!strcmp(command, "aes.256"))
+ key_len = AES256_KEY_LENGTH;
+
+ return key_len;
+}
+
/**
* do_aes() - Handle the "aes" command-line command
* @cmdtp: Command data struct pointer
{
uint32_t key_addr, iv_addr, src_addr, dst_addr, len;
uint8_t *key_ptr, *iv_ptr, *src_ptr, *dst_ptr;
- uint8_t key_exp[AES_EXPAND_KEY_LENGTH];
- uint32_t aes_blocks;
+ u8 key_exp[AES256_EXPAND_KEY_LENGTH];
+ u32 aes_blocks, key_len;
int enc;
if (argc != 7)
return CMD_RET_USAGE;
+ key_len = aes_get_key_len(argv[0]);
+
if (!strncmp(argv[1], "enc", 3))
enc = 1;
else if (!strncmp(argv[1], "dec", 3))
dst_addr = simple_strtoul(argv[5], NULL, 16);
len = simple_strtoul(argv[6], NULL, 16);
- key_ptr = (uint8_t *)map_sysmem(key_addr, 128 / 8);
+ key_ptr = (uint8_t *)map_sysmem(key_addr, key_len);
iv_ptr = (uint8_t *)map_sysmem(iv_addr, 128 / 8);
src_ptr = (uint8_t *)map_sysmem(src_addr, len);
dst_ptr = (uint8_t *)map_sysmem(dst_addr, len);
/* First we expand the key. */
- aes_expand_key(key_ptr, key_exp);
+ aes_expand_key(key_ptr, key_len, key_exp);
/* Calculate the number of AES blocks to encrypt. */
- aes_blocks = DIV_ROUND_UP(len, AES_KEY_LENGTH);
+ aes_blocks = DIV_ROUND_UP(len, AES_BLOCK_LENGTH);
if (enc)
- aes_cbc_encrypt_blocks(key_exp, iv_ptr, src_ptr, dst_ptr,
- aes_blocks);
+ aes_cbc_encrypt_blocks(key_len, key_exp, iv_ptr, src_ptr,
+ dst_ptr, aes_blocks);
else
- aes_cbc_decrypt_blocks(key_exp, iv_ptr, src_ptr, dst_ptr,
- aes_blocks);
+ aes_cbc_decrypt_blocks(key_len, key_exp, iv_ptr, src_ptr,
+ dst_ptr, aes_blocks);
unmap_sysmem(key_ptr);
unmap_sysmem(iv_ptr);
/***************************************************/
#ifdef CONFIG_SYS_LONGHELP
static char aes_help_text[] =
- "enc key iv src dst len - Encrypt block of data $len bytes long\n"
+ "[.128,.192,.256] enc key iv src dst len - Encrypt block of data $len bytes long\n"
" at address $src using a key at address\n"
" $key with initialization vector at address\n"
" $iv. Store the result at address $dst.\n"
" The $len size must be multiple of 16 bytes.\n"
" The $key and $iv must be 16 bytes long.\n"
- "aes dec key iv src dst len - Decrypt block of data $len bytes long\n"
+ "aes [.128,.192,.256] dec key iv src dst len - Decrypt block of data $len bytes long\n"
" at address $src using a key at address\n"
" $key with initialization vector at address\n"
" $iv. Store the result at address $dst.\n"
U_BOOT_CMD(
aes, 7, 1, do_aes,
- "AES 128 CBC encryption",
+ "AES 128/192/256 CBC encryption",
aes_help_text
);
#include <command.h>
#include <dm.h>
#include <gzip.h>
+#include <image.h>
#include <lcd.h>
#include <malloc.h>
#include <mapmem.h>
ulong addr;
switch (argc) {
- case 1: /* use load_addr as default address */
- addr = load_addr;
+ case 1: /* use image_load_addr as default address */
+ addr = image_load_addr;
break;
case 2: /* use argument */
addr = simple_strtoul(argv[1], NULL, 16);
splash_get_pos(&x, &y);
switch (argc) {
- case 1: /* use load_addr as default address */
- addr = load_addr;
+ case 1: /* use image_load_addr as default address */
+ addr = image_load_addr;
break;
case 2: /* use argument */
addr = simple_strtoul(argv[1], NULL, 16);
/* Setup Linux kernel Image entry point */
if (!argc) {
- ld = load_addr;
+ ld = image_load_addr;
debug("* kernel: default image load address = 0x%08lx\n",
- load_addr);
+ image_load_addr);
} else {
ld = simple_strtoul(argv[0], NULL, 16);
debug("* kernel: cmdline image address = 0x%08lx\n", ld);
char *local_args[2];
local_args[0] = (char *)cmd;
local_args[1] = NULL;
- printf("Automatic boot of image at addr 0x%08lX ...\n", load_addr);
+ printf("Automatic boot of image at addr 0x%08lX ...\n",
+ image_load_addr);
return do_bootm(cmdtp, 0, 1, local_args);
}
int rcode = 0;
if (argc < 2) {
- return image_info(load_addr);
+ return image_info(image_load_addr);
}
for (arg = 1; arg < argc; ++arg) {
#include <common.h>
#include <bootm.h>
#include <command.h>
+#include <image.h>
#include <irq_func.h>
#include <lmb.h>
#include <linux/compiler.h>
/* Setup Linux kernel zImage entry point */
if (!argc) {
- images->ep = load_addr;
+ images->ep = image_load_addr;
debug("* kernel: default image load address = 0x%08lx\n",
- load_addr);
+ image_load_addr);
} else {
images->ep = simple_strtoul(argv[0], NULL, 16);
debug("* kernel: cmdline image address = 0x%08lx\n",
#include <common.h>
#include <command.h>
#include <env.h>
+#include <image.h>
#include <malloc.h>
#include <mapmem.h>
#include <linux/list.h>
{
char *filename;
int size;
- ulong offset = load_addr;
+ ulong offset = image_load_addr;
char *offset_virt;
struct part_info part;
}
if (argc == 3) {
offset = simple_strtoul(argv[1], NULL, 0);
- load_addr = offset;
+ image_load_addr = offset;
filename = argv[2];
}
#include <common.h>
#include <command.h>
#include <cpu_func.h>
+#include <image.h>
#include <part.h>
int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
flush_cache(addr, (cnt+1)*info.blksz);
/* Loading ok, update default load address */
- load_addr = addr;
+ image_load_addr = addr;
return bootm_maybe_autostart(cmdtp, argv[0]);
}
#include <cpu_func.h>
#include <elf.h>
#include <env.h>
+#include <image.h>
#include <net.h>
#include <vxworks.h>
#ifdef CONFIG_X86
/* Consume address */
argc--; argv++;
} else
- addr = load_addr;
+ addr = image_load_addr;
if (!valid_elf_image(addr))
return 1;
* If we don't know where the image is then we're done.
*/
if (argc < 2)
- addr = load_addr;
+ addr = image_load_addr;
else
addr = simple_strtoul(argv[1], NULL, 16);
" and determine its size."
);
-int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_fat_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
return do_load(cmdtp, flag, argc, argv, FS_TYPE_FAT);
}
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2001
- * Denis Peter, MPL AG, d.peter@mpl.ch.
- */
-/*
- * Floppy Disk support
- */
-
-#include <common.h>
-#include <config.h>
-#include <command.h>
-#include <image.h>
-#include <irq_func.h>
-
-
-#undef FDC_DEBUG
-
-#ifdef FDC_DEBUG
-#define PRINTF(fmt,args...) printf (fmt ,##args)
-#else
-#define PRINTF(fmt,args...)
-#endif
-
-/*#if defined(CONFIG_CMD_DATE) */
-/*#include <rtc.h> */
-/*#endif */
-
-typedef struct {
- int flags; /* connected drives ect */
- unsigned long blnr; /* Logical block nr */
- uchar drive; /* drive no */
- uchar cmdlen; /* cmd length */
- uchar cmd[16]; /* cmd desc */
- uchar dma; /* if > 0 dma enabled */
- uchar result[11]; /* status information */
- uchar resultlen; /* lenght of result */
-} FDC_COMMAND_STRUCT;
-
-/* flags: only the lower 8bit used:
- * bit 0 if set drive 0 is present
- * bit 1 if set drive 1 is present
- * bit 2 if set drive 2 is present
- * bit 3 if set drive 3 is present
- * bit 4 if set disk in drive 0 is inserted
- * bit 5 if set disk in drive 1 is inserted
- * bit 6 if set disk in drive 2 is inserted
- * bit 7 if set disk in drive 4 is inserted
- */
-
-/* cmd indexes */
-#define COMMAND 0
-#define DRIVE 1
-#define CONFIG0 1
-#define SPEC_HUTSRT 1
-#define TRACK 2
-#define CONFIG1 2
-#define SPEC_HLT 2
-#define HEAD 3
-#define CONFIG2 3
-#define SECTOR 4
-#define SECTOR_SIZE 5
-#define LAST_TRACK 6
-#define GAP 7
-#define DTL 8
-/* result indexes */
-#define STATUS_0 0
-#define STATUS_PCN 1
-#define STATUS_1 1
-#define STATUS_2 2
-#define STATUS_TRACK 3
-#define STATUS_HEAD 4
-#define STATUS_SECT 5
-#define STATUS_SECT_SIZE 6
-
-
-/* Register addresses */
-#define FDC_BASE 0x3F0
-#define FDC_SRA FDC_BASE + 0 /* Status Register A */
-#define FDC_SRB FDC_BASE + 1 /* Status Register B */
-#define FDC_DOR FDC_BASE + 2 /* Digital Output Register */
-#define FDC_TDR FDC_BASE + 3 /* Tape Drive Register */
-#define FDC_DSR FDC_BASE + 4 /* Data rate Register */
-#define FDC_MSR FDC_BASE + 4 /* Main Status Register */
-#define FDC_FIFO FDC_BASE + 5 /* FIFO */
-#define FDC_DIR FDC_BASE + 6 /* Digital Input Register */
-#define FDC_CCR FDC_BASE + 7 /* Configuration Control */
-/* Commands */
-#define FDC_CMD_SENSE_INT 0x08
-#define FDC_CMD_CONFIGURE 0x13
-#define FDC_CMD_SPECIFY 0x03
-#define FDC_CMD_RECALIBRATE 0x07
-#define FDC_CMD_READ 0x06
-#define FDC_CMD_READ_TRACK 0x02
-#define FDC_CMD_READ_ID 0x0A
-#define FDC_CMD_DUMP_REG 0x0E
-#define FDC_CMD_SEEK 0x0F
-
-#define FDC_CMD_SENSE_INT_LEN 0x01
-#define FDC_CMD_CONFIGURE_LEN 0x04
-#define FDC_CMD_SPECIFY_LEN 0x03
-#define FDC_CMD_RECALIBRATE_LEN 0x02
-#define FDC_CMD_READ_LEN 0x09
-#define FDC_CMD_READ_TRACK_LEN 0x09
-#define FDC_CMD_READ_ID_LEN 0x02
-#define FDC_CMD_DUMP_REG_LEN 0x01
-#define FDC_CMD_SEEK_LEN 0x03
-
-#define FDC_FIFO_THR 0x0C
-#define FDC_FIFO_DIS 0x00
-#define FDC_IMPLIED_SEEK 0x01
-#define FDC_POLL_DIS 0x00
-#define FDC_PRE_TRK 0x00
-#define FDC_CONFIGURE FDC_FIFO_THR | (FDC_POLL_DIS<<4) | (FDC_FIFO_DIS<<5) | (FDC_IMPLIED_SEEK << 6)
-#define FDC_MFM_MODE 0x01 /* MFM enable */
-#define FDC_SKIP_MODE 0x00 /* skip enable */
-
-#define FDC_TIME_OUT 100000 /* time out */
-#define FDC_RW_RETRIES 3 /* read write retries */
-#define FDC_CAL_RETRIES 3 /* calibration and seek retries */
-
-
-/* Disk structure */
-typedef struct {
- unsigned int size; /* nr of sectors total */
- unsigned int sect; /* sectors per track */
- unsigned int head; /* nr of heads */
- unsigned int track; /* nr of tracks */
- unsigned int stretch; /* !=0 means double track steps */
- unsigned char gap; /* gap1 size */
- unsigned char rate; /* data rate. |= 0x40 for perpendicular */
- unsigned char spec1; /* stepping rate, head unload time */
- unsigned char fmt_gap;/* gap2 size */
- unsigned char hlt; /* head load time */
- unsigned char sect_code;/* Sector Size code */
- const char * name; /* used only for predefined formats */
-} FD_GEO_STRUCT;
-
-
-/* supported Floppy types (currently only one) */
-const static FD_GEO_STRUCT floppy_type[2] = {
- { 2880,18,2,80,0,0x1B,0x00,0xCF,0x6C,16,2,"H1440" }, /* 7 1.44MB 3.5" */
- { 0, 0,0, 0,0,0x00,0x00,0x00,0x00, 0,0,NULL }, /* end of table */
-};
-
-static FDC_COMMAND_STRUCT cmd; /* global command struct */
-
-/* If the boot drive number is undefined, we assume it's drive 0 */
-#ifndef CONFIG_SYS_FDC_DRIVE_NUMBER
-#define CONFIG_SYS_FDC_DRIVE_NUMBER 0
-#endif
-
-/* Hardware access */
-#ifndef CONFIG_SYS_ISA_IO_STRIDE
-#define CONFIG_SYS_ISA_IO_STRIDE 1
-#endif
-
-#ifndef CONFIG_SYS_ISA_IO_OFFSET
-#define CONFIG_SYS_ISA_IO_OFFSET 0
-#endif
-
-/* Supporting Functions */
-/* reads a Register of the FDC */
-unsigned char read_fdc_reg(unsigned int addr)
-{
- volatile unsigned char *val =
- (volatile unsigned char *)(CONFIG_SYS_ISA_IO_BASE_ADDRESS +
- (addr * CONFIG_SYS_ISA_IO_STRIDE) +
- CONFIG_SYS_ISA_IO_OFFSET);
-
- return val [0];
-}
-
-/* writes a Register of the FDC */
-void write_fdc_reg(unsigned int addr, unsigned char val)
-{
- volatile unsigned char *tmp =
- (volatile unsigned char *)(CONFIG_SYS_ISA_IO_BASE_ADDRESS +
- (addr * CONFIG_SYS_ISA_IO_STRIDE) +
- CONFIG_SYS_ISA_IO_OFFSET);
- tmp[0]=val;
-}
-
-/* waits for an interrupt (polling) */
-int wait_for_fdc_int(void)
-{
- unsigned long timeout;
- timeout = FDC_TIME_OUT;
- while((read_fdc_reg(FDC_SRA)&0x80)==0) {
- timeout--;
- udelay(10);
- if(timeout==0) /* timeout occurred */
- return false;
- }
- return true;
-}
-
-/* reads a byte from the FIFO of the FDC and checks direction and RQM bit
- of the MSR. returns -1 if timeout, or byte if ok */
-int read_fdc_byte(void)
-{
- unsigned long timeout;
- timeout = FDC_TIME_OUT;
- while((read_fdc_reg(FDC_MSR)&0xC0)!=0xC0) {
- /* direction out and ready */
- udelay(10);
- timeout--;
- if(timeout==0) /* timeout occurred */
- return -1;
- }
- return read_fdc_reg(FDC_FIFO);
-}
-
-/* if the direction of the FIFO is wrong, this routine is used to
- empty the FIFO. Should _not_ be used */
-int fdc_need_more_output(void)
-{
- unsigned char c;
- while((read_fdc_reg(FDC_MSR)&0xC0)==0xC0) {
- c=(unsigned char)read_fdc_byte();
- printf("Error: more output: %x\n",c);
- }
- return true;
-}
-
-
-/* writes a byte to the FIFO of the FDC and checks direction and RQM bit
- of the MSR */
-int write_fdc_byte(unsigned char val)
-{
- unsigned long timeout;
- timeout = FDC_TIME_OUT;
- while((read_fdc_reg(FDC_MSR)&0xC0)!=0x80) {
- /* direction in and ready for byte */
- timeout--;
- udelay(10);
- fdc_need_more_output();
- if(timeout==0) /* timeout occurred */
- return false;
- }
- write_fdc_reg(FDC_FIFO,val);
- return true;
-}
-
-/* sets up all FDC commands and issues it to the FDC. If
- the command causes direct results (no Execution Phase)
- the result is be read as well. */
-
-int fdc_issue_cmd(FDC_COMMAND_STRUCT *pCMD,FD_GEO_STRUCT *pFG)
-{
- int i;
- unsigned long head,track,sect,timeout;
- track = pCMD->blnr / (pFG->sect * pFG->head); /* track nr */
- sect = pCMD->blnr % (pFG->sect * pFG->head); /* remaining blocks */
- head = sect / pFG->sect; /* head nr */
- sect = sect % pFG->sect; /* remaining blocks */
- sect++; /* sectors are 1 based */
- PRINTF("Cmd 0x%02x Track %ld, Head %ld, Sector %ld, Drive %d (blnr %ld)\n",
- pCMD->cmd[0],track,head,sect,pCMD->drive,pCMD->blnr);
-
- if(head|=0) { /* max heads = 2 */
- pCMD->cmd[DRIVE]=pCMD->drive | 0x04; /* head 1 */
- pCMD->cmd[HEAD]=(unsigned char) head; /* head register */
- }
- else {
- pCMD->cmd[DRIVE]=pCMD->drive; /* head 0 */
- pCMD->cmd[HEAD]=(unsigned char) head; /* head register */
- }
- pCMD->cmd[TRACK]=(unsigned char) track; /* track */
- switch (pCMD->cmd[COMMAND]) {
- case FDC_CMD_READ:
- pCMD->cmd[SECTOR]=(unsigned char) sect; /* sector */
- pCMD->cmd[SECTOR_SIZE]=pFG->sect_code; /* sector size code */
- pCMD->cmd[LAST_TRACK]=pFG->sect; /* End of track */
- pCMD->cmd[GAP]=pFG->gap; /* gap */
- pCMD->cmd[DTL]=0xFF; /* DTL */
- pCMD->cmdlen=FDC_CMD_READ_LEN;
- pCMD->cmd[COMMAND]|=(FDC_MFM_MODE<<6); /* set MFM bit */
- pCMD->cmd[COMMAND]|=(FDC_SKIP_MODE<<5); /* set Skip bit */
- pCMD->resultlen=0; /* result only after execution */
- break;
- case FDC_CMD_SEEK:
- pCMD->cmdlen=FDC_CMD_SEEK_LEN;
- pCMD->resultlen=0; /* no result */
- break;
- case FDC_CMD_CONFIGURE:
- pCMD->cmd[CONFIG0]=0;
- pCMD->cmd[CONFIG1]=FDC_CONFIGURE; /* FIFO Threshold, Poll, Enable FIFO */
- pCMD->cmd[CONFIG2]=FDC_PRE_TRK; /* Precompensation Track */
- pCMD->cmdlen=FDC_CMD_CONFIGURE_LEN;
- pCMD->resultlen=0; /* no result */
- break;
- case FDC_CMD_SPECIFY:
- pCMD->cmd[SPEC_HUTSRT]=pFG->spec1;
- pCMD->cmd[SPEC_HLT]=(pFG->hlt)<<1; /* head load time */
- if(pCMD->dma==0)
- pCMD->cmd[SPEC_HLT]|=0x1; /* no dma */
- pCMD->cmdlen=FDC_CMD_SPECIFY_LEN;
- pCMD->resultlen=0; /* no result */
- break;
- case FDC_CMD_DUMP_REG:
- pCMD->cmdlen=FDC_CMD_DUMP_REG_LEN;
- pCMD->resultlen=10; /* 10 byte result */
- break;
- case FDC_CMD_READ_ID:
- pCMD->cmd[COMMAND]|=(FDC_MFM_MODE<<6); /* set MFM bit */
- pCMD->cmdlen=FDC_CMD_READ_ID_LEN;
- pCMD->resultlen=7; /* 7 byte result */
- break;
- case FDC_CMD_RECALIBRATE:
- pCMD->cmd[DRIVE]&=0x03; /* don't set the head bit */
- pCMD->cmdlen=FDC_CMD_RECALIBRATE_LEN;
- pCMD->resultlen=0; /* no result */
- break;
- break;
- case FDC_CMD_SENSE_INT:
- pCMD->cmdlen=FDC_CMD_SENSE_INT_LEN;
- pCMD->resultlen=2;
- break;
- }
- for(i=0;i<pCMD->cmdlen;i++) {
- /* PRINTF("write cmd%d = 0x%02X\n",i,pCMD->cmd[i]); */
- if (write_fdc_byte(pCMD->cmd[i]) == false) {
- PRINTF("Error: timeout while issue cmd%d\n",i);
- return false;
- }
- }
- timeout=FDC_TIME_OUT;
- for(i=0;i<pCMD->resultlen;i++) {
- while((read_fdc_reg(FDC_MSR)&0xC0)!=0xC0) {
- timeout--;
- if(timeout==0) {
- PRINTF(" timeout while reading result%d MSR=0x%02X\n",i,read_fdc_reg(FDC_MSR));
- return false;
- }
- }
- pCMD->result[i]=(unsigned char)read_fdc_byte();
- }
- return true;
-}
-
-/* selects the drive assigned in the cmd structur and
- switches on the Motor */
-void select_fdc_drive(FDC_COMMAND_STRUCT *pCMD)
-{
- unsigned char val;
-
- val=(1<<(4+pCMD->drive))|pCMD->drive|0xC; /* set reset, dma gate and motor bits */
- if((read_fdc_reg(FDC_DOR)&val)!=val) {
- write_fdc_reg(FDC_DOR,val);
- for(val=0;val<255;val++)
- udelay(500); /* wait some time to start motor */
- }
-}
-
-/* switches off the Motor of the specified drive */
-void stop_fdc_drive(FDC_COMMAND_STRUCT *pCMD)
-{
- unsigned char val;
-
- val=(1<<(4+pCMD->drive))|pCMD->drive; /* sets motor bits */
- write_fdc_reg(FDC_DOR,(read_fdc_reg(FDC_DOR)&~val));
-}
-
-/* issues a recalibrate command, waits for interrupt and
- * issues a sense_interrupt */
-int fdc_recalibrate(FDC_COMMAND_STRUCT *pCMD,FD_GEO_STRUCT *pFG)
-{
- pCMD->cmd[COMMAND]=FDC_CMD_RECALIBRATE;
- if (fdc_issue_cmd(pCMD, pFG) == false)
- return false;
- while (wait_for_fdc_int() != true);
-
- pCMD->cmd[COMMAND]=FDC_CMD_SENSE_INT;
- return(fdc_issue_cmd(pCMD,pFG));
-}
-
-/* issues a recalibrate command, waits for interrupt and
- * issues a sense_interrupt */
-int fdc_seek(FDC_COMMAND_STRUCT *pCMD,FD_GEO_STRUCT *pFG)
-{
- pCMD->cmd[COMMAND]=FDC_CMD_SEEK;
- if (fdc_issue_cmd(pCMD, pFG) == false)
- return false;
- while (wait_for_fdc_int() != true);
-
- pCMD->cmd[COMMAND]=FDC_CMD_SENSE_INT;
- return(fdc_issue_cmd(pCMD,pFG));
-}
-
-/* terminates current command, by not servicing the FIFO
- * waits for interrupt and fills in the result bytes */
-int fdc_terminate(FDC_COMMAND_STRUCT *pCMD)
-{
- int i;
- for(i=0;i<100;i++)
- udelay(500); /* wait 500usec for fifo overrun */
- while((read_fdc_reg(FDC_SRA)&0x80)==0x00); /* wait as long as no int has occurred */
- for(i=0;i<7;i++) {
- pCMD->result[i]=(unsigned char)read_fdc_byte();
- }
- return true;
-}
-
-/* reads data from FDC, seek commands are issued automatic */
-int fdc_read_data(unsigned char *buffer, unsigned long blocks,FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG)
-{
- /* first seek to start address */
- unsigned long len,readblk,i,timeout,ii,offset;
- unsigned char c,retriesrw,retriescal;
- unsigned char *bufferw; /* working buffer */
- int sect_size;
- int flags;
-
- flags=disable_interrupts(); /* switch off all Interrupts */
- select_fdc_drive(pCMD); /* switch on drive */
- sect_size=0x080<<pFG->sect_code;
- retriesrw=0;
- retriescal=0;
- offset=0;
- if (fdc_seek(pCMD, pFG) == false) {
- stop_fdc_drive(pCMD);
- if (flags)
- enable_interrupts();
- return false;
- }
- if((pCMD->result[STATUS_0]&0x20)!=0x20) {
- printf("Seek error Status: %02X\n",pCMD->result[STATUS_0]);
- stop_fdc_drive(pCMD);
- if (flags)
- enable_interrupts();
- return false;
- }
- /* now determine the next seek point */
- /* lastblk=pCMD->blnr + blocks; */
- /* readblk=(pFG->head*pFG->sect)-(pCMD->blnr%(pFG->head*pFG->sect)); */
- readblk=pFG->sect-(pCMD->blnr%pFG->sect);
- PRINTF("1st nr of block possible read %ld start %ld\n",readblk,pCMD->blnr);
- if(readblk>blocks) /* is end within 1st track */
- readblk=blocks; /* yes, correct it */
- PRINTF("we read %ld blocks start %ld\n",readblk,pCMD->blnr);
- bufferw = &buffer[0]; /* setup working buffer */
- do {
-retryrw:
- len=sect_size * readblk;
- pCMD->cmd[COMMAND]=FDC_CMD_READ;
- if (fdc_issue_cmd(pCMD, pFG) == false) {
- stop_fdc_drive(pCMD);
- if (flags)
- enable_interrupts();
- return false;
- }
- for (i=0;i<len;i++) {
- timeout=FDC_TIME_OUT;
- do {
- c=read_fdc_reg(FDC_MSR);
- if((c&0xC0)==0xC0) {
- bufferw[i]=read_fdc_reg(FDC_FIFO);
- break;
- }
- if((c&0xC0)==0x80) { /* output */
- PRINTF("Transfer error transferred: at %ld, MSR=%02X\n",i,c);
- if(i>6) {
- for(ii=0;ii<7;ii++) {
- pCMD->result[ii]=bufferw[(i-7+ii)];
- } /* for */
- }
- if(retriesrw++>FDC_RW_RETRIES) {
- if (retriescal++>FDC_CAL_RETRIES) {
- stop_fdc_drive(pCMD);
- if (flags)
- enable_interrupts();
- return false;
- }
- else {
- PRINTF(" trying to recalibrate Try %d\n",retriescal);
- if (fdc_recalibrate(pCMD, pFG) == false) {
- stop_fdc_drive(pCMD);
- if (flags)
- enable_interrupts();
- return false;
- }
- retriesrw=0;
- goto retrycal;
- } /* else >FDC_CAL_RETRIES */
- }
- else {
- PRINTF("Read retry %d\n",retriesrw);
- goto retryrw;
- } /* else >FDC_RW_RETRIES */
- }/* if output */
- timeout--;
- } while (true);
- } /* for len */
- /* the last sector of a track or all data has been read,
- * we need to get the results */
- fdc_terminate(pCMD);
- offset+=(sect_size*readblk); /* set up buffer pointer */
- bufferw = &buffer[offset];
- pCMD->blnr+=readblk; /* update current block nr */
- blocks-=readblk; /* update blocks */
- if(blocks==0)
- break; /* we are finish */
- /* setup new read blocks */
- /* readblk=pFG->head*pFG->sect; */
- readblk=pFG->sect;
- if(readblk>blocks)
- readblk=blocks;
-retrycal:
- /* a seek is necessary */
- if (fdc_seek(pCMD, pFG) == false) {
- stop_fdc_drive(pCMD);
- if (flags)
- enable_interrupts();
- return false;
- }
- if((pCMD->result[STATUS_0]&0x20)!=0x20) {
- PRINTF("Seek error Status: %02X\n",pCMD->result[STATUS_0]);
- stop_fdc_drive(pCMD);
- return false;
- }
- } while (true); /* start over */
- stop_fdc_drive(pCMD); /* switch off drive */
- if (flags)
- enable_interrupts();
- return true;
-}
-
-/* Scan all drives and check if drive is present and disk is inserted */
-int fdc_check_drive(FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG)
-{
- int i,drives,state;
- /* OK procedure of data book is satisfied.
- * trying to get some information over the drives */
- state=0; /* no drives, no disks */
- for(drives=0;drives<4;drives++) {
- pCMD->drive=drives;
- select_fdc_drive(pCMD);
- pCMD->blnr=0; /* set to the 1st block */
- if (fdc_recalibrate(pCMD, pFG) == false)
- continue;
- if((pCMD->result[STATUS_0]&0x10)==0x10)
- continue;
- /* ok drive connected check for disk */
- state|=(1<<drives);
- pCMD->blnr=pFG->size; /* set to the last block */
- if (fdc_seek(pCMD, pFG) == false)
- continue;
- pCMD->blnr=0; /* set to the 1st block */
- if (fdc_recalibrate(pCMD, pFG) == false)
- continue;
- pCMD->cmd[COMMAND]=FDC_CMD_READ_ID;
- if (fdc_issue_cmd(pCMD, pFG) == false)
- continue;
- state|=(0x10<<drives);
- }
- stop_fdc_drive(pCMD);
- for(i=0;i<4;i++) {
- PRINTF("Floppy Drive %d %sconnected %sDisk inserted %s\n",i,
- ((state&(1<<i))==(1<<i)) ? "":"not ",
- ((state&(0x10<<i))==(0x10<<i)) ? "":"no ",
- ((state&(0x10<<i))==(0x10<<i)) ? pFG->name : "");
- }
- pCMD->flags=state;
- return true;
-}
-
-
-/**************************************************************************
-* int fdc_setup
-* setup the fdc according the datasheet
-* assuming in PS2 Mode
-*/
-int fdc_setup(int drive, FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG)
-{
- int i;
-
-#ifdef CONFIG_SYS_FDC_HW_INIT
- fdc_hw_init ();
-#endif
- /* first, we reset the FDC via the DOR */
- write_fdc_reg(FDC_DOR,0x00);
- for(i=0; i<255; i++) /* then we wait some time */
- udelay(500);
- /* then, we clear the reset in the DOR */
- pCMD->drive=drive;
- select_fdc_drive(pCMD);
- /* initialize the CCR */
- write_fdc_reg(FDC_CCR,pFG->rate);
- /* then initialize the DSR */
- write_fdc_reg(FDC_DSR,pFG->rate);
- if (wait_for_fdc_int() == false) {
- PRINTF("Time Out after writing CCR\n");
- return false;
- }
- /* now issue sense Interrupt and status command
- * assuming only one drive present (drive 0) */
- pCMD->dma=0; /* we don't use any dma at all */
- for(i=0;i<4;i++) {
- /* issue sense interrupt for all 4 possible drives */
- pCMD->cmd[COMMAND]=FDC_CMD_SENSE_INT;
- if (fdc_issue_cmd(pCMD, pFG) == false) {
- PRINTF("Sense Interrupt for drive %d failed\n",i);
- }
- }
- /* issue the configure command */
- pCMD->drive=drive;
- select_fdc_drive(pCMD);
- pCMD->cmd[COMMAND]=FDC_CMD_CONFIGURE;
- if (fdc_issue_cmd(pCMD, pFG) == false) {
- PRINTF(" configure timeout\n");
- stop_fdc_drive(pCMD);
- return false;
- }
- /* issue specify command */
- pCMD->cmd[COMMAND]=FDC_CMD_SPECIFY;
- if (fdc_issue_cmd(pCMD, pFG) == false) {
- PRINTF(" specify timeout\n");
- stop_fdc_drive(pCMD);
- return false;
-
- }
- /* then, we clear the reset in the DOR */
- /* fdc_check_drive(pCMD,pFG); */
- /* write_fdc_reg(FDC_DOR,0x04); */
-
- return true;
-}
-
-/****************************************************************************
- * main routine do_fdcboot
- */
-int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
- FD_GEO_STRUCT *pFG = (FD_GEO_STRUCT *)floppy_type;
- FDC_COMMAND_STRUCT *pCMD = &cmd;
- unsigned long addr,imsize;
-#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
- image_header_t *hdr; /* used for fdc boot */
-#endif
- unsigned char boot_drive;
- int i,nrofblk;
-#if defined(CONFIG_FIT)
- const void *fit_hdr = NULL;
-#endif
-
- switch (argc) {
- case 1:
- addr = CONFIG_SYS_LOAD_ADDR;
- boot_drive=CONFIG_SYS_FDC_DRIVE_NUMBER;
- break;
- case 2:
- addr = simple_strtoul(argv[1], NULL, 16);
- boot_drive=CONFIG_SYS_FDC_DRIVE_NUMBER;
- break;
- case 3:
- addr = simple_strtoul(argv[1], NULL, 16);
- boot_drive=simple_strtoul(argv[2], NULL, 10);
- break;
- default:
- return CMD_RET_USAGE;
- }
- /* setup FDC and scan for drives */
- if (fdc_setup(boot_drive, pCMD, pFG) == false) {
- printf("\n** Error in setup FDC **\n");
- return 1;
- }
- if (fdc_check_drive(pCMD, pFG) == false) {
- printf("\n** Error in check_drives **\n");
- return 1;
- }
- if((pCMD->flags&(1<<boot_drive))==0) {
- /* drive not available */
- printf("\n** Drive %d not availabe **\n",boot_drive);
- return 1;
- }
- if((pCMD->flags&(0x10<<boot_drive))==0) {
- /* no disk inserted */
- printf("\n** No disk inserted in drive %d **\n",boot_drive);
- return 1;
- }
- /* ok, we have a valid source */
- pCMD->drive=boot_drive;
- /* read first block */
- pCMD->blnr=0;
- if (fdc_read_data((unsigned char *)addr, 1, pCMD, pFG) == false) {
- printf("\nRead error:");
- for(i=0;i<7;i++)
- printf("result%d: 0x%02X\n",i,pCMD->result[i]);
- return 1;
- }
-
- switch (genimg_get_format ((void *)addr)) {
-#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
- case IMAGE_FORMAT_LEGACY:
- hdr = (image_header_t *)addr;
- image_print_contents (hdr);
-
- imsize = image_get_image_size (hdr);
- break;
-#endif
-#if defined(CONFIG_FIT)
- case IMAGE_FORMAT_FIT:
- fit_hdr = (const void *)addr;
- puts ("Fit image detected...\n");
-
- imsize = fit_get_size (fit_hdr);
- break;
-#endif
- default:
- puts ("** Unknown image type\n");
- return 1;
- }
-
- nrofblk=imsize/512;
- if((imsize%512)>0)
- nrofblk++;
- printf("Loading %ld Bytes (%d blocks) at 0x%08lx..\n",imsize,nrofblk,addr);
- pCMD->blnr=0;
- if (fdc_read_data((unsigned char *)addr, nrofblk, pCMD, pFG) == false) {
- /* read image block */
- printf("\nRead error:");
- for(i=0;i<7;i++)
- printf("result%d: 0x%02X\n",i,pCMD->result[i]);
- return 1;
- }
- printf("OK %ld Bytes loaded.\n",imsize);
-
- flush_cache (addr, imsize);
-
-#if defined(CONFIG_FIT)
- /* This cannot be done earlier, we need complete FIT image in RAM first */
- if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
- if (!fit_check_format (fit_hdr)) {
- puts ("** Bad FIT image format\n");
- return 1;
- }
- fit_print_contents (fit_hdr);
- }
-#endif
-
- /* Loading ok, update default load address */
- load_addr = addr;
-
- return bootm_maybe_autostart(cmdtp, argv[0]);
-}
-
-U_BOOT_CMD(
- fdcboot, 3, 1, do_fdcboot,
- "boot from floppy device",
- "loadAddr drive"
-);
#include <common.h>
#include <command.h>
#include <env.h>
+#include <image.h>
#include <malloc.h>
#include <jffs2/jffs2.h>
#include <linux/list.h>
char *filename;
int size;
struct part_info *part;
- ulong offset = load_addr;
+ ulong offset = image_load_addr;
/* pre-set Boot file name */
filename = env_get("bootfile");
}
if (argc == 3) {
offset = simple_strtoul(argv[1], NULL, 16);
- load_addr = offset;
+ image_load_addr = offset;
filename = argv[2];
}
#include <console.h>
#include <cpu_func.h>
#include <env.h>
+#include <flash.h>
+#include <image.h>
#include <s_record.h>
#include <net.h>
#include <exports.h>
rcode = 1;
} else {
printf("## Start Addr = 0x%08lX\n", addr);
- load_addr = addr;
+ image_load_addr = addr;
}
#ifdef CONFIG_SYS_LOADS_BAUD_CHANGE
addr = load_serial_bin(offset);
if (addr == ~0) {
- load_addr = 0;
+ image_load_addr = 0;
printf("## Binary (kermit) download aborted\n");
rcode = 1;
} else {
printf("## Start Addr = 0x%08lX\n", addr);
- load_addr = addr;
+ image_load_addr = addr;
}
}
if (load_baudrate != current_baudrate) {
rc = flash_write((char *) ymodemBuf,
store_addr, res);
if (rc != 0) {
- flash_perror (rc);
+ flash_perror(rc);
return (~0);
}
} else
#include <cli.h>
#include <command.h>
#include <console.h>
+#include <flash.h>
#include <hash.h>
#include <mapmem.h>
#include <watchdog.h>
static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
u64 writeval;
#else
ulong writeval;
/* Get the value to write.
*/
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
writeval = simple_strtoull(argv[2], NULL, 16);
#else
writeval = simple_strtoul(argv[2], NULL, 16);
while (count-- > 0) {
if (size == 4)
*((u32 *)buf) = (u32)writeval;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
else if (size == 8)
*((u64 *)buf) = (u64)writeval;
#endif
int rcode = 0;
const char *type;
const void *buf1, *buf2, *base;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
u64 word1, word2;
#else
ulong word1, word2;
if (size == 4) {
word1 = *(u32 *)buf1;
word2 = *(u32 *)buf2;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
} else if (size == 8) {
word1 = *(u64 *)buf1;
word2 = *(u64 *)buf2;
}
if (word1 != word2) {
ulong offset = buf1 - base;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
printf("%s at 0x%p (%#0*llx) != %s at 0x%p (%#0*llx)\n",
type, (void *)(addr1 + offset), size, word1,
type, (void *)(addr2 + offset), size, word2);
rc = flash_write((char *)src, (ulong)dst, count * size);
if (rc != 0) {
- flash_perror (rc);
+ flash_perror(rc);
unmap_sysmem(src);
unmap_sysmem(dst);
return (1);
{
ulong addr, length, i, bytes;
int size;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
volatile u64 *llp;
#endif
volatile u32 *longp;
* If we have only one object, just run infinite loops.
*/
if (length == 1) {
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
if (size == 8) {
llp = (u64 *)buf;
for (;;)
i = *cp;
}
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
if (size == 8) {
for (;;) {
llp = (u64 *)buf;
{
ulong addr, length, i, bytes;
int size;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
volatile u64 *llp;
u64 data;
#else
length = simple_strtoul(argv[2], NULL, 16);
/* data to write */
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
data = simple_strtoull(argv[3], NULL, 16);
#else
data = simple_strtoul(argv[3], NULL, 16);
* If we have only one object, just run infinite loops.
*/
if (length == 1) {
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
if (size == 8) {
llp = (u64 *)buf;
for (;;)
*cp = data;
}
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
if (size == 8) {
for (;;) {
llp = (u64 *)buf;
mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
{
ulong addr;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
u64 i;
#else
ulong i;
printf("%08lx:", addr);
if (size == 4)
printf(" %08x", *((u32 *)ptr));
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
else if (size == 8)
printf(" %016llx", *((u64 *)ptr));
#endif
#endif
else {
char *endp;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
i = simple_strtoull(console_buffer, &endp, 16);
#else
i = simple_strtoul(console_buffer, &endp, 16);
bootretry_reset_cmd_timeout();
if (size == 4)
*((u32 *)ptr) = i;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
else if (size == 8)
*((u64 *)ptr) = i;
#endif
U_BOOT_CMD(
md, 3, 1, do_mem_md,
"memory display",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] address [# of objects]"
#else
"[.b, .w, .l] address [# of objects]"
U_BOOT_CMD(
mm, 2, 1, do_mem_mm,
"memory modify (auto-incrementing address)",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] address"
#else
"[.b, .w, .l] address"
U_BOOT_CMD(
nm, 2, 1, do_mem_nm,
"memory modify (constant address)",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] address"
#else
"[.b, .w, .l] address"
U_BOOT_CMD(
mw, 4, 1, do_mem_mw,
"memory write (fill)",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] address value [count]"
#else
"[.b, .w, .l] address value [count]"
U_BOOT_CMD(
cp, 4, 1, do_mem_cp,
"memory copy",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] source target count"
#else
"[.b, .w, .l] source target count"
U_BOOT_CMD(
cmp, 4, 1, do_mem_cmp,
"memory compare",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] addr1 addr2 count"
#else
"[.b, .w, .l] addr1 addr2 count"
U_BOOT_CMD(
loop, 3, 1, do_mem_loop,
"infinite loop on address range",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] address number_of_objects"
#else
"[.b, .w, .l] address number_of_objects"
U_BOOT_CMD(
loopw, 4, 1, do_mem_loopw,
"infinite write loop on address range",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] address number_of_objects data_to_write"
#else
"[.b, .w, .l] address number_of_objects data_to_write"
U_BOOT_CMD(
mdc, 4, 1, do_mem_mdc,
"memory display cyclic",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] address count delay(ms)"
#else
"[.b, .w, .l] address count delay(ms)"
U_BOOT_CMD(
mwc, 4, 1, do_mem_mwc,
"memory write cyclic",
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
"[.b, .w, .l, .q] address value delay(ms)"
#else
"[.b, .w, .l] address value delay(ms)"
#include <common.h>
#include <command.h>
#include <env.h>
+#include <image.h>
#include <vsprintf.h>
#include <errno.h>
#include <dm.h>
#ifdef CONFIG_CMD_NET
static size_t tftp_read_file(const char *file_name)
{
- /* update global variable load_addr before tftp file from network */
- load_addr = get_load_addr();
+ /*
+ * update global variable image_load_addr before tftp file from network
+ */
+ image_load_addr = get_load_addr();
return net_loop(TFTPGET);
}
*/
#include <common.h>
+#include <image.h>
#include <linux/mtd/mtd.h>
#include <command.h>
#include <console.h>
/* Loading ok, update default load address */
- load_addr = addr;
+ image_load_addr = addr;
return bootm_maybe_autostart(cmdtp, cmd);
}
#include <common.h>
#include <command.h>
#include <env.h>
+#include <image.h>
#include <net.h>
static int netboot_common(enum proto_t, cmd_tbl_t *, int, char * const []);
net_boot_file_name_explicit = false;
- /* pre-set load_addr */
+ /* pre-set image_load_addr */
s = env_get("loadaddr");
if (s != NULL)
- load_addr = simple_strtoul(s, NULL, 16);
+ image_load_addr = simple_strtoul(s, NULL, 16);
switch (argc) {
case 1:
*/
addr = simple_strtoul(argv[1], &end, 16);
if (end == (argv[1] + strlen(argv[1]))) {
- load_addr = addr;
+ image_load_addr = addr;
/* refresh bootfile name from env */
copy_filename(net_boot_file_name, env_get("bootfile"),
sizeof(net_boot_file_name));
break;
case 3:
- load_addr = simple_strtoul(argv[1], NULL, 16);
+ image_load_addr = simple_strtoul(argv[1], NULL, 16);
net_boot_file_name_explicit = true;
copy_filename(net_boot_file_name, argv[2],
sizeof(net_boot_file_name));
#ifdef CONFIG_CMD_TFTPPUT
case 4:
- if (strict_strtoul(argv[1], 16, &save_addr) < 0 ||
- strict_strtoul(argv[2], 16, &save_size) < 0) {
+ if (strict_strtoul(argv[1], 16, &image_save_addr) < 0 ||
+ strict_strtoul(argv[2], 16, &image_save_size) < 0) {
printf("Invalid address/size\n");
return CMD_RET_USAGE;
}
#include <common.h>
#include <command.h>
+#include <fs.h>
+#include <net.h>
#include "pxe_utils.h"
#include <common.h>
#include <env.h>
+#include <image.h>
#include <malloc.h>
#include <mapmem.h>
#include <lcd.h>
#ifdef CONFIG_CMD_BMP
/* display BMP if available */
if (cfg->bmp) {
- if (get_relfile(cmdtp, cfg->bmp, load_addr)) {
+ if (get_relfile(cmdtp, cfg->bmp, image_load_addr)) {
run_command("cls", 0);
- bmp_display(load_addr,
+ bmp_display(image_load_addr,
BMP_ALIGN_CENTER, BMP_ALIGN_CENTER);
} else {
printf("Skipping background bmp %s for failure\n",
}
/* Loading ok, update default load address */
- load_addr = addr;
+ image_load_addr = addr;
printf ("\n%ld bytes read\n", filelen);
env_set_hex("filesize", filelen);
}
#endif
-int
-source (ulong addr, const char *fit_uname)
+int image_source_script(ulong addr, const char *fit_uname)
{
ulong len;
#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
addr = CONFIG_SYS_LOAD_ADDR;
debug ("* source: default load address = 0x%08lx\n", addr);
#if defined(CONFIG_FIT)
- } else if (fit_parse_subimage (argv[1], load_addr, &addr, &fit_uname)) {
+ } else if (fit_parse_subimage(argv[1], image_load_addr, &addr,
+ &fit_uname)) {
debug ("* source: subimage '%s' from FIT image at 0x%08lx\n",
fit_uname, addr);
#endif
}
printf ("## Executing script at %08lx\n", addr);
- rcode = source (addr, fit_uname);
+ rcode = image_source_script(addr, fit_uname);
return rcode;
}
*/
#include <cpu_func.h>
+#include <init.h>
#include <asm/arch/hardware.h>
#include <asm/cache.h>
#include <asm/emif.h>
#include <common.h>
#include <command.h>
+#include <cpu_func.h>
#include <tpm-v1.h>
#include "tpm-user-utils.h"
static int
do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
{
- ulong addr = load_addr;
+ ulong addr = image_load_addr;
ulong dest = 0;
ulong data, len;
int verify;
zfs_close(&zfile);
/* Loading ok, update default load address */
- load_addr = addr;
+ image_load_addr = addr;
printf("%llu bytes read\n", zfile.size);
env_set_hex("filesize", zfile.size);
obj-$(CONFIG_$(SPL_TPL_)FIT) += image-fit.o
obj-$(CONFIG_$(SPL_)MULTI_DTB_FIT) += boot_fit.o common_fit.o
obj-$(CONFIG_$(SPL_TPL_)FIT_SIGNATURE) += image-sig.o
+obj-$(CONFIG_$(SPL_TPL_)FIT_CIPHER) += image-cipher.o
obj-$(CONFIG_IO_TRACE) += iotrace.o
obj-y += memsize.o
obj-y += stdio.o
#include <common.h>
#include <bloblist.h>
+#include <clock_legacy.h>
#include <console.h>
#include <cpu.h>
#include <cpu_func.h>
#include <env_internal.h>
#include <fdtdec.h>
#include <fs.h>
+#include <hang.h>
#include <i2c.h>
#include <init.h>
#include <initcall.h>
#include <common.h>
#include <api.h>
#include <cpu_func.h>
+#include <exports.h>
+#include <hang.h>
+#include <image.h>
#include <irq_func.h>
+#include <net.h>
#include <u-boot/crc.h>
/* TODO: can we just include all these headers whether needed or not? */
#if defined(CONFIG_CMD_BEDBUG)
#include <env_internal.h>
#include <fdtdec.h>
#include <ide.h>
+#include <init.h>
#include <initcall.h>
#if defined(CONFIG_CMD_KGDB)
#include <kgdb.h>
#endif
/* Initialize from environment */
- load_addr = env_get_ulong("loadaddr", 16, load_addr);
+ image_load_addr = env_get_ulong("loadaddr", 16, image_load_addr);
return 0;
}
*/
#include <common.h>
+#include <hang.h>
#include <malloc.h>
#include <sort.h>
#include <spl.h>
#include <console.h>
#include <env.h>
#include <fdtdec.h>
+#include <hang.h>
#include <malloc.h>
DECLARE_GLOBAL_DATA_PTR;
return 2;
case 'l':
return 4;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
case 'q':
return 8;
#endif
/*-----------------------------------------------------------------------
*/
-void flash_perror (int err)
+void flash_perror(int err)
{
switch (err) {
case ERR_OK:
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2019, Softathome
+ */
+
+#ifdef USE_HOSTCC
+#include "mkimage.h"
+#include <time.h>
+#else
+#include <common.h>
+#include <malloc.h>
+DECLARE_GLOBAL_DATA_PTR;
+#endif /* !USE_HOSTCC*/
+#include <image.h>
+#include <uboot_aes.h>
+#include <u-boot/aes.h>
+
+struct cipher_algo cipher_algos[] = {
+ {
+ .name = "aes128",
+ .key_len = AES128_KEY_LENGTH,
+ .iv_len = AES_BLOCK_LENGTH,
+#if IMAGE_ENABLE_ENCRYPT
+ .calculate_type = EVP_aes_128_cbc,
+#endif
+ .encrypt = image_aes_encrypt,
+ .decrypt = image_aes_decrypt,
+ .add_cipher_data = image_aes_add_cipher_data
+ },
+ {
+ .name = "aes192",
+ .key_len = AES192_KEY_LENGTH,
+ .iv_len = AES_BLOCK_LENGTH,
+#if IMAGE_ENABLE_ENCRYPT
+ .calculate_type = EVP_aes_192_cbc,
+#endif
+ .encrypt = image_aes_encrypt,
+ .decrypt = image_aes_decrypt,
+ .add_cipher_data = image_aes_add_cipher_data
+ },
+ {
+ .name = "aes256",
+ .key_len = AES256_KEY_LENGTH,
+ .iv_len = AES_BLOCK_LENGTH,
+#if IMAGE_ENABLE_ENCRYPT
+ .calculate_type = EVP_aes_256_cbc,
+#endif
+ .encrypt = image_aes_encrypt,
+ .decrypt = image_aes_decrypt,
+ .add_cipher_data = image_aes_add_cipher_data
+ }
+};
+
+struct cipher_algo *image_get_cipher_algo(const char *full_name)
+{
+ int i;
+ const char *name;
+
+ for (i = 0; i < ARRAY_SIZE(cipher_algos); i++) {
+ name = cipher_algos[i].name;
+ if (!strncmp(name, full_name, strlen(name)))
+ return &cipher_algos[i];
+ }
+
+ return NULL;
+}
+
+static int fit_image_setup_decrypt(struct image_cipher_info *info,
+ const void *fit, int image_noffset,
+ int cipher_noffset)
+{
+ const void *fdt = gd_fdt_blob();
+ const char *node_name;
+ char node_path[128];
+ int noffset;
+ char *algo_name;
+ int ret;
+
+ node_name = fit_get_name(fit, image_noffset, NULL);
+ if (!node_name) {
+ printf("Can't get node name\n");
+ return -1;
+ }
+
+ if (fit_image_cipher_get_algo(fit, cipher_noffset, &algo_name)) {
+ printf("Can't get algo name for cipher '%s' in image '%s'\n",
+ node_name, node_name);
+ return -1;
+ }
+
+ info->keyname = fdt_getprop(fit, cipher_noffset, "key-name-hint", NULL);
+ if (!info->keyname) {
+ printf("Can't get key name\n");
+ return -1;
+ }
+
+ info->ivname = fdt_getprop(fit, cipher_noffset, "iv-name-hint", NULL);
+ if (!info->ivname) {
+ printf("Can't get IV name\n");
+ return -1;
+ }
+
+ info->fit = fit;
+ info->node_noffset = image_noffset;
+ info->name = algo_name;
+ info->cipher = image_get_cipher_algo(algo_name);
+ if (!info->cipher) {
+ printf("Can't get cipher\n");
+ return -1;
+ }
+
+ ret = fit_image_get_data_size_unciphered(fit, image_noffset,
+ &info->size_unciphered);
+ if (ret) {
+ printf("Can't get size of unciphered data\n");
+ return -1;
+ }
+
+ /*
+ * Search the cipher node in the u-boot fdt
+ * the path should be: /cipher/key-<algo>-<key>-<iv>
+ */
+ snprintf(node_path, sizeof(node_path), "/%s/key-%s-%s-%s",
+ FIT_CIPHER_NODENAME, algo_name, info->keyname, info->ivname);
+
+ noffset = fdt_path_offset(fdt, node_path);
+ if (noffset < 0) {
+ printf("Can't found cipher node offset\n");
+ return -1;
+ }
+
+ /* read key */
+ info->key = fdt_getprop(fdt, noffset, "key", NULL);
+ if (!info->key) {
+ printf("Can't get key in cipher node '%s'\n", node_path);
+ return -1;
+ }
+
+ /* read iv */
+ info->iv = fdt_getprop(fdt, noffset, "iv", NULL);
+ if (!info->iv) {
+ printf("Can't get IV in cipher node '%s'\n", node_path);
+ return -1;
+ }
+
+ return 0;
+}
+
+int fit_image_decrypt_data(const void *fit,
+ int image_noffset, int cipher_noffset,
+ const void *data_ciphered, size_t size_ciphered,
+ void **data_unciphered, size_t *size_unciphered)
+{
+ struct image_cipher_info info;
+ int ret;
+
+ ret = fit_image_setup_decrypt(&info, fit, image_noffset,
+ cipher_noffset);
+ if (ret < 0)
+ goto out;
+
+ ret = info.cipher->decrypt(&info, data_ciphered, size_ciphered,
+ data_unciphered, size_unciphered);
+
+ out:
+ return ret;
+}
*of_flat_tree = NULL;
*of_size = 0;
- img_addr = (argc == 0) ? load_addr : simple_strtoul(argv[0], NULL, 16);
+ img_addr = (argc == 0) ? image_load_addr :
+ simple_strtoul(argv[0], NULL, 16);
buf = map_sysmem(img_addr, 0);
if (argc > 2)
else if (images->fit_uname_os)
default_addr = (ulong)images->fit_hdr_os;
else
- default_addr = load_addr;
+ default_addr = image_load_addr;
if (fit_parse_conf(select, default_addr,
&fdt_addr, &fit_uname_config)) {
return 0;
}
+/**
+ * Get 'data-size-unciphered' property from a given image node.
+ *
+ * @fit: pointer to the FIT image header
+ * @noffset: component image node offset
+ * @data_size: holds the data-size property
+ *
+ * returns:
+ * 0, on success
+ * -ENOENT if the property could not be found
+ */
+int fit_image_get_data_size_unciphered(const void *fit, int noffset,
+ size_t *data_size)
+{
+ const fdt32_t *val;
+
+ val = fdt_getprop(fit, noffset, "data-size-unciphered", NULL);
+ if (!val)
+ return -ENOENT;
+
+ *data_size = (size_t)fdt32_to_cpu(*val);
+
+ return 0;
+}
+
/**
* fit_image_get_data_and_size - get data and its size including
* both embedded and external data
return 0;
}
+/**
+ * fit_image_cipher_get_algo - get cipher algorithm name
+ * @fit: pointer to the FIT format image header
+ * @noffset: cipher node offset
+ * @algo: double pointer to char, will hold pointer to the algorithm name
+ *
+ * fit_image_cipher_get_algo() finds cipher algorithm property in a given
+ * cipher node. If the property is found its data start address is returned
+ * to the caller.
+ *
+ * returns:
+ * 0, on success
+ * -1, on failure
+ */
+int fit_image_cipher_get_algo(const void *fit, int noffset, char **algo)
+{
+ int len;
+
+ *algo = (char *)fdt_getprop(fit, noffset, FIT_ALGO_PROP, &len);
+ if (!*algo) {
+ fit_get_debug(fit, noffset, FIT_ALGO_PROP, len);
+ return -1;
+ }
+
+ return 0;
+}
+
ulong fit_get_end(const void *fit)
{
return map_to_sysmem((void *)(fit + fdt_totalsize(fit)));
return 1;
}
+#ifdef CONFIG_FIT_CIPHER
+static int fit_image_uncipher(const void *fit, int image_noffset,
+ void **data, size_t *size)
+{
+ int cipher_noffset, ret;
+ void *dst;
+ size_t size_dst;
+
+ cipher_noffset = fdt_subnode_offset(fit, image_noffset,
+ FIT_CIPHER_NODENAME);
+ if (cipher_noffset < 0)
+ return 0;
+
+ ret = fit_image_decrypt_data(fit, image_noffset, cipher_noffset,
+ *data, *size, &dst, &size_dst);
+ if (ret)
+ goto out;
+
+ *data = dst;
+ *size = size_dst;
+
+ out:
+ return ret;
+}
+#endif /* CONFIG_FIT_CIPHER */
+
/**
* fit_image_check_os - check whether image node is of a given os type
* @fit: pointer to the FIT format image header
return -ENOENT;
}
+#ifdef CONFIG_FIT_CIPHER
+ /* Decrypt data before uncompress/move */
+ if (IMAGE_ENABLE_DECRYPT) {
+ puts(" Decrypting Data ... ");
+ if (fit_image_uncipher(fit, noffset, &buf, &size)) {
+ puts("Error\n");
+ return -EACCES;
+ }
+ puts("OK\n");
+ }
+#endif
+
#if !defined(USE_HOSTCC) && defined(CONFIG_FIT_IMAGE_POST_PROCESS)
/* perform any post-processing on the image data */
board_fit_image_post_process(&buf, &size);
/* Shared dual-format routines */
/*****************************************************************************/
#ifndef USE_HOSTCC
-ulong load_addr = CONFIG_SYS_LOAD_ADDR; /* Default Load Address */
-ulong save_addr; /* Default Save Address */
-ulong save_size; /* Default Save Size (in bytes) */
+ulong image_load_addr = CONFIG_SYS_LOAD_ADDR; /* Default Load Address */
+ulong image_save_addr; /* Default Save Address */
+ulong image_save_size; /* Default Save Size (in bytes) */
static int on_loadaddr(const char *name, const char *value, enum env_op op,
int flags)
switch (op) {
case env_op_create:
case env_op_overwrite:
- load_addr = simple_strtoul(value, NULL, 16);
+ image_load_addr = simple_strtoul(value, NULL, 16);
break;
default:
break;
/* find out kernel image address */
if (!img_addr) {
- kernel_addr = load_addr;
+ kernel_addr = image_load_addr;
debug("* kernel: default image load address = 0x%08lx\n",
- load_addr);
+ image_load_addr);
#if CONFIG_IS_ENABLED(FIT)
- } else if (fit_parse_conf(img_addr, load_addr, &kernel_addr,
+ } else if (fit_parse_conf(img_addr, image_load_addr, &kernel_addr,
fit_uname_config)) {
debug("* kernel: config '%s' from image at 0x%08lx\n",
*fit_uname_config, kernel_addr);
- } else if (fit_parse_subimage(img_addr, load_addr, &kernel_addr,
+ } else if (fit_parse_subimage(img_addr, image_load_addr, &kernel_addr,
fit_uname_kernel)) {
debug("* kernel: subimage '%s' from image at 0x%08lx\n",
*fit_uname_kernel, kernel_addr);
if (images->fit_uname_os)
default_addr = (ulong)images->fit_hdr_os;
else
- default_addr = load_addr;
+ default_addr = image_load_addr;
if (fit_parse_conf(select, default_addr,
&rd_addr, &fit_uname_config)) {
#include <command.h>
#include <console.h>
#include <env.h>
+#include <init.h>
#include <version.h>
/*
*/
#include <common.h>
+#include <init.h>
DECLARE_GLOBAL_DATA_PTR;
#include <binman_sym.h>
#include <dm.h>
#include <handoff.h>
+#include <hang.h>
#include <irq_func.h>
#include <serial.h>
#include <spl.h>
{
debug("%s: sector %lx, count %lx, buf %lx\n",
__func__, sector, count, (ulong)buf);
- memcpy(buf, (void *)(load_addr + sector), count);
+ memcpy(buf, (void *)(image_load_addr + sector), count);
return count;
}
static int spl_net_load_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
- struct image_header *header = (struct image_header *)load_addr;
+ struct image_header *header = (struct image_header *)image_load_addr;
int rv;
env_init();
#include <common.h>
#include <cpu_func.h>
#include <errno.h>
+#include <hang.h>
#include <spl.h>
#include <asm/smp.h>
#include <opensbi.h>
#include <common.h>
#include <cpu_func.h>
+#include <image.h>
#if !(defined(CONFIG_FIT) && defined(CONFIG_OF_LIBFDT))
#error "CONFIG_FIT and CONFIG_OF_LIBFDT are required for auto-update feature"
extern ulong tftp_timeout_ms;
extern int tftp_timeout_count_max;
-extern ulong load_addr;
#ifdef CONFIG_MTD_NOR_FLASH
extern flash_info_t flash_info[];
static uchar *saved_prot_info;
env_set("netretry", "no");
/* download the update file */
- load_addr = addr;
+ image_load_addr = addr;
copy_filename(net_boot_file_name, filename, sizeof(net_boot_file_name));
size = net_loop(TFTPGET);
*
*/
#include <dm.h>
+#include <hang.h>
#include <wait_bit.h>
#include <asm/io.h>
#include <command.h>
#include <cache.h>
#include <dm.h>
+#include <hang.h>
#include <asm/io.h>
#include <dm/ofnode.h>
#include <clk-uclass.h>
#include <dm.h>
#include <div64.h>
+#include <time.h>
#include <wait_bit.h>
#include <dm/lists.h>
#include <asm/io.h>
#include <common.h>
#include <clk-uclass.h>
+#include <clock_legacy.h>
#include <dm.h>
#include <vsprintf.h>
#include <dm/lists.h>
#include <errno.h>
#include <div64.h>
#include <fdtdec.h>
+#include <hang.h>
#include <ram.h>
#include <reset.h>
#include "sdram_soc64.h"
#include <dm.h>
#include <errno.h>
#include <div64.h>
+#include <init.h>
#include <ram.h>
#include <reset.h>
#include <watchdog.h>
#include <errno.h>
#include <div64.h>
#include <fdtdec.h>
+#include <hang.h>
+#include <init.h>
#include <ram.h>
#include <reset.h>
#include "sdram_s10.h"
#include <errno.h>
#include <div64.h>
#include <fdtdec.h>
+#include <hang.h>
#include <ram.h>
#include <reset.h>
#include "sdram_soc64.h"
#include "ddr3_init.h"
#include "mv_ddr_regs.h"
#include "ddr_training_ip_db.h"
+#include <image.h>
#define PATTERN_1 0x55555555
#define PATTERN_2 0xaaaaaaaa
MASK_ALL_BITS));
}
- CHECK_STATUS(ddr3_tip_if_write
- (dev_num, access_type, if_id,
- ODPG_DATA_BUFFER_OFFS_REG, load_addr, MASK_ALL_BITS));
+ CHECK_STATUS(ddr3_tip_if_write(dev_num, access_type, if_id,
+ ODPG_DATA_BUFFER_OFFS_REG,
+ image_load_addr, MASK_ALL_BITS));
return MV_OK;
}
obj-$(CONFIG_MPC83XX_SERDES) += mpc83xx_serdes.o
obj-$(CONFIG_MXC_OCOTP) += mxc_ocotp.o
obj-$(CONFIG_MXS_OCOTP) += mxs_ocotp.o
-obj-$(CONFIG_NS87308) += ns87308.o
obj-$(CONFIG_NUVOTON_NCT6102D) += nuvoton_nct6102d.o
obj-$(CONFIG_P2SB) += p2sb-uclass.o
obj-$(CONFIG_PCA9551_LED) += pca9551_led.o
*/
#include <common.h>
+#include <hang.h>
#include <asm/io.h>
#include <dm.h>
#include <asm/arch/sci/sci.h>
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2000
- * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
- */
-
-#include <config.h>
-
-#include <ns87308.h>
-
-void initialise_ns87308 (void)
-{
-#ifdef CONFIG_SYS_NS87308_PS2MOD
- unsigned char data;
-
- /*
- * Switch floppy drive to PS/2 mode.
- */
- read_pnp_config(SUPOERIO_CONF1, &data);
- data &= 0xFB;
- write_pnp_config(SUPOERIO_CONF1, data);
-#endif
-
-#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_KBC1)
- PNP_SET_DEVICE_BASE(LDEV_KBC1, CONFIG_SYS_NS87308_KBC1_BASE);
- write_pnp_config(LUN_CONFIG_REG, 0);
- write_pnp_config(CBASE_HIGH, 0x00);
- write_pnp_config(CBASE_LOW, 0x64);
-#endif
-
-#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_MOUSE)
- PNP_ACTIVATE_DEVICE(LDEV_MOUSE);
-#endif
-
-#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_RTC_APC)
- PNP_SET_DEVICE_BASE(LDEV_RTC_APC, CONFIG_SYS_NS87308_RTC_BASE);
-#endif
-
-#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_FDC)
- PNP_SET_DEVICE_BASE(LDEV_FDC, CONFIG_SYS_NS87308_FDC_BASE);
- write_pnp_config(LUN_CONFIG_REG, 0x40);
-#endif
-
-#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_RARP)
- PNP_SET_DEVICE_BASE(LDEV_PARP, CONFIG_SYS_NS87308_LPT_BASE);
-#endif
-
-#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_UART1)
- PNP_SET_DEVICE_BASE(LDEV_UART1, CONFIG_SYS_NS87308_UART1_BASE);
-#endif
-
-#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_UART2)
- PNP_SET_DEVICE_BASE(LDEV_UART2, CONFIG_SYS_NS87308_UART2_BASE);
-#endif
-
-#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_GPIO)
- PNP_SET_DEVICE_BASE(LDEV_GPIO, CONFIG_SYS_NS87308_GPIO_BASE);
-#endif
-
-#if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_POWRMAN)
-#ifndef CONFIG_SYS_NS87308_PWMAN_BASE
- PNP_ACTIVATE_DEVICE(LDEV_POWRMAN);
-#else
- PNP_SET_DEVICE_BASE(LDEV_POWRMAN, CONFIG_SYS_NS87308_PWMAN_BASE);
-
- /*
- * Enable all units
- */
- write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_FER1, 0x7d);
- write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_FER2, 0x87);
-
-#ifdef CONFIG_SYS_NS87308_PMC1
- write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC1, CONFIG_SYS_NS87308_PMC1);
-#endif
-
-#ifdef CONFIG_SYS_NS87308_PMC2
- write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC2, CONFIG_SYS_NS87308_PMC2);
-#endif
-
-#ifdef CONFIG_SYS_NS87308_PMC3
- write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC3, CONFIG_SYS_NS87308_PMC3);
-#endif
-#endif
-#endif
-
-#ifdef CONFIG_SYS_NS87308_CS0_BASE
- PNP_PGCS_CSLINE_BASE(0, CONFIG_SYS_NS87308_CS0_BASE);
- PNP_PGCS_CSLINE_CONF(0, CONFIG_SYS_NS87308_CS0_CONF);
-#endif
-
-#ifdef CONFIG_SYS_NS87308_CS1_BASE
- PNP_PGCS_CSLINE_BASE(1, CONFIG_SYS_NS87308_CS1_BASE);
- PNP_PGCS_CSLINE_CONF(1, CONFIG_SYS_NS87308_CS1_CONF);
-#endif
-
-#ifdef CONFIG_SYS_NS87308_CS2_BASE
- PNP_PGCS_CSLINE_BASE(2, CONFIG_SYS_NS87308_CS2_BASE);
- PNP_PGCS_CSLINE_CONF(2, CONFIG_SYS_NS87308_CS2_CONF);
-#endif
-}
#include <common.h>
#include <cpu_func.h>
+#include <hang.h>
#include <mmc.h>
#include <malloc.h>
*/
#include <common.h>
+#include <hang.h>
#include <nand.h>
#include <asm/arch/imx-regs.h>
#include <asm/io.h>
#include <common.h>
#include <cpu_func.h>
+#include <hang.h>
#include <spi_flash.h>
#include <malloc.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <cpu_func.h>
#include <dm.h>
#include <errno.h>
#include <common.h>
#include <env.h>
+#include <hang.h>
#include <malloc.h>
#include <command.h>
#include <config.h>
#include <common.h>
#include <env.h>
+#include <hang.h>
#include <malloc.h>
#include <command.h>
#include <net.h>
#include <common.h>
#include <command.h>
+#include <hang.h>
#include <malloc.h>
#include <net.h>
#include <netdev.h>
#include <bios_emul.h>
#include <dm.h>
#include <errno.h>
+#include <init.h>
#include <malloc.h>
#include <pci.h>
#include <pci_rom.h>
#include <common.h>
#include <dm.h>
#include <errno.h>
+#include <init.h>
#include <ram.h>
#include <asm/io.h>
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <hang.h>
#include <ram.h>
#include <asm/io.h>
#include <power-domain.h>
#include <common.h>
#include <dm.h>
+#include <init.h>
#include <ram.h>
#include <dt-bindings/memory/mpc83xx-sdram.h>
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <hang.h>
#include <dt-bindings/memory/rk3368-dmc.h>
#include <dt-structs.h>
#include <ram.h>
#include <dm.h>
#include <dt-structs.h>
#include <errno.h>
+#include <hang.h>
#include <ram.h>
#include <regmap.h>
#include <syscon.h>
#include <dm.h>
#include <dt-structs.h>
#include <errno.h>
+#include <hang.h>
#include <ram.h>
#include <regmap.h>
#include <syscon.h>
#include <common.h>
#include <clk.h>
#include <dm.h>
+#include <init.h>
#include <ram.h>
#include <regmap.h>
#include <syscon.h>
*/
#include <common.h>
#include <console.h>
+#include <init.h>
#include <watchdog.h>
#include <asm/io.h>
#include <linux/log2.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <dm.h>
#include <serial.h>
#include <dm/platform_data/lpc32xx_hsuart.h>
* modified to use CONFIG_SYS_ISA_MEM and new defines
*/
+#include <clock_legacy.h>
#include <common.h>
#include <clk.h>
#include <dm.h>
#include <common.h>
#include <env_internal.h>
+#include <hang.h>
#include <serial.h>
#include <stdio_dev.h>
#include <post.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <dm.h>
#include <div64.h>
#include <errno.h>
*/
#include <common.h>
-#include <linux/compiler.h>
-
+#include <clock_legacy.h>
#include <ns16550.h>
-#ifdef CONFIG_NS87308
-#include <ns87308.h>
-#endif
-
#include <serial.h>
+#include <linux/compiler.h>
#ifndef CONFIG_NS16550_MIN_FUNCTIONS
*/
#include <common.h>
+#include <hang.h>
#include <asm/arch/pxa-regs.h>
#include <asm/arch/regs-uart.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <clock_legacy.h>
#include <spi.h>
#include <dm.h>
#include <div64.h>
#define LOG_CATEGORY UCLASS_SYSRESET
#include <common.h>
+#include <cpu_func.h>
+#include <hang.h>
#include <sysreset.h>
#include <dm.h>
#include <errno.h>
jump_to_image_no_args(&spl_image);
#else
/* In U-Boot, allow jumps to scripts */
- source(sdp_func->jmp_address, "script@1");
+ image_source_script(sdp_func->jmp_address, "script@1");
#endif
}
*/
#include <common.h>
+#include <hang.h>
#include <serial.h>
#include <usbdevice.h>
#include <usb/udc.h>
*/
#include <common.h>
+#include <hang.h>
#include <asm/io.h>
#include "../gadget/dwc2_udc_otg_priv.h"
#include <common.h>
#include <bios_emul.h>
#include <dm.h>
+#include <init.h>
#include <vbe.h>
#include <video.h>
#include <asm/cpu.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <dm.h>
+#include <hang.h>
#include <asm/io.h>
#include <wdt.h>
#include <watchdog.h>
#include <common.h>
#include <dm.h>
+#include <hang.h>
#include <wdt.h>
#include <asm/io.h>
*/
#include <common.h>
+#include <cpu_func.h>
#include <asm/io.h>
#include <asm/arch/imx-regs.h>
#include <common.h>
#include <dm.h>
#include <errno.h>
+#include <hang.h>
#include <wdt.h>
#include <dm/device-internal.h>
#include <dm/lists.h>
#include <command.h>
#include <env.h>
#include <env_internal.h>
+#include <flash.h>
#include <linux/stddef.h>
#include <malloc.h>
#include <search.h>
*/
#include <common.h>
+#include <hang.h>
#include <linux/types.h>
#include <api_public.h>
return NULL;
}
-void hang (void)
+void hang(void)
{
while (1) ;
}
--- /dev/null
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2000-2009
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ */
+
+#ifndef __CLOCK_LEGACY_H
+#define __CLOCK_LEGACY_H
+
+int get_clocks(void);
+unsigned long get_bus_freq(unsigned long dummy);
+int get_serial_clock(void);
+
+#endif
/*
* Common header file for U-Boot
*
- * This file still includes quite a bit of stuff that should be in separate
- * headers. Please think before adding more things.
- * Patches to remove things are welcome.
+ * This file still includes quite a few headers that should be included
+ * individually as needed. Patches to remove things are welcome.
*
* (C) Copyright 2000-2009
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#define __COMMON_H_ 1
#ifndef __ASSEMBLY__ /* put C only stuff in this section */
-
-typedef volatile unsigned long vu_long;
-typedef volatile unsigned short vu_short;
-typedef volatile unsigned char vu_char;
-
#include <config.h>
#include <errno.h>
#include <time.h>
#include <stdarg.h>
#include <stdio.h>
#include <linux/kernel.h>
-
#include <part.h>
#include <flash.h>
#include <image.h>
-
-#ifdef __LP64__
-#define CONFIG_SYS_SUPPORT_64BIT_DATA
-#endif
-
#include <log.h>
-
#include <asm/u-boot.h> /* boot information for Linux kernel */
#include <asm/global_data.h> /* global data used for startup functions */
-
-/* startup functions, used in:
- * common/board_f.c
- * common/init/board_init.c
- * common/board_r.c
- * common/board_info.c
- */
#include <init.h>
-
-/*
- * Function Prototypes
- */
-void hang (void) __attribute__ ((noreturn));
-
#include <display_options.h>
-
-/* common/main.c */
-void main_loop (void);
-
-int checkflash(void);
-int checkdram(void);
-extern u8 __dtb_dt_begin[]; /* embedded device tree blob */
-extern u8 __dtb_dt_spl_begin[]; /* embedded device tree blob for SPL/TPL */
-int mdm_init(void);
-
-/**
- * arch_fixup_fdt() - Write arch-specific information to fdt
- *
- * Defined in arch/$(ARCH)/lib/bootm-fdt.c
- *
- * @blob: FDT blob to write to
- * @return 0 if ok, or -ve FDT_ERR_... on failure
- */
-int arch_fixup_fdt(void *blob);
-
-/* common/flash.c */
-void flash_perror (int);
-
-/* common/cmd_source.c */
-int source (ulong addr, const char *fit_uname);
-
-extern ulong load_addr; /* Default Load Address */
-extern ulong save_addr; /* Default Save Address */
-extern ulong save_size; /* Default Save Size */
-
-/* common/cmd_net.c */
-int do_tftpb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-
-/* common/cmd_fat.c */
-int do_fat_fsload(cmd_tbl_t *, int, int, char * const []);
-
-/* common/cmd_ext2.c */
-int do_ext2load(cmd_tbl_t *, int, int, char * const []);
-
-/* common/exports.c */
-void jumptable_init(void);
-
-/* common/kallsysm.c */
-const char *symbol_lookup(unsigned long addr, unsigned long *caddr);
-
-/* common/memsize.c */
-long get_ram_size (long *, long);
-phys_size_t get_effective_memsize(void);
-
-/* $(BOARD)/$(BOARD).c */
-void reset_phy (void);
-void fdc_hw_init (void);
-
-#if !defined(CONFIG_ENV_EEPROM_IS_ON_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
-# define CONFIG_SYS_DEF_EEPROM_ADDR CONFIG_SYS_I2C_EEPROM_ADDR
-#endif
-
-#if defined(CONFIG_SYS_DRAM_TEST)
-int testdram(void);
-#endif /* CONFIG_SYS_DRAM_TEST */
-
-#if defined(CONFIG_ARM)
-void relocate_code(ulong);
-#else
-void relocate_code(ulong, gd_t *, ulong) __attribute__ ((noreturn));
-#endif
-
-void s_init(void);
-
-void upmconfig (unsigned int, unsigned int *, unsigned int);
-ulong get_tbclk (void);
-void reset_misc (void);
-void reset_cpu (ulong addr);
-void ft_cpu_setup(void *blob, bd_t *bd);
-void ft_pci_setup(void *blob, bd_t *bd);
-
-/* $(CPU)/speed.c */
-int get_clocks (void);
-ulong get_bus_freq (ulong);
-int get_serial_clock(void);
-
-/* lib/uuid.c */
#include <uuid.h>
-
-/* lib/vsprintf.c */
#include <vsprintf.h>
-
-/* lib/net_utils.c */
#include <net.h>
-
#include <bootstage.h>
-
-#else /* __ASSEMBLY__ */
-
#endif /* __ASSEMBLY__ */
-/* Put only stuff here that the assembler can digest */
-
-#ifdef CONFIG_POST
-#define CONFIG_HAS_POST
-#ifndef CONFIG_POST_ALT_LIST
-#define CONFIG_POST_STD_LIST
-#endif
-#endif
-
-#define ROUND(a,b) (((a) + (b) - 1) & ~((b) - 1))
-
-/*
- * check_member() - Check the offset of a structure member
- *
- * @structure: Name of structure (e.g. global_data)
- * @member: Name of member (e.g. baudrate)
- * @offset: Expected offset in bytes
- */
-#define check_member(structure, member, offset) _Static_assert( \
- offsetof(struct structure, member) == offset, \
- "`struct " #structure "` offset for `" #member "` is not " #offset)
-
-/* Avoid using CONFIG_EFI_STUB directly as we may boot from other loaders */
-#ifdef CONFIG_EFI_STUB
-#define ll_boot_init() false
-#else
-#define ll_boot_init() true
-#endif
-
/* Pull in stuff for the build system */
#ifdef DO_DEPS_ONLY
# include <env_internal.h>
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
+#ifdef __LP64__
+#define MEM_SUPPORT_64BIT_DATA
+#endif
+
#endif
* @param flags Flags to control what is done
*/
int cleanup_before_linux_select(int flags);
+
+void reset_cpu(ulong addr);
;
#endif
#define eeprom_write(dev_addr, offset, buffer, cnt) ((void)-ENOSYS)
#endif
+#if !defined(CONFIG_ENV_EEPROM_IS_ON_I2C) && defined(CONFIG_SYS_I2C_EEPROM_ADDR)
+# define CONFIG_SYS_DEF_EEPROM_ADDR CONFIG_SYS_I2C_EEPROM_ADDR
+#endif
+
#endif
struct spi_slave;
+/* Set up the jump table for use by the API */
+void jumptable_init(void);
+
/* These are declarations of exported functions available in C code */
unsigned long get_version(void);
int getc(void);
#include <asm/u-boot.h>
#include <linux/libfdt.h>
+/**
+ * arch_fixup_fdt() - Write arch-specific information to fdt
+ *
+ * Defined in arch/$(ARCH)/lib/bootm-fdt.c
+ *
+ * @blob: FDT blob to write to
+ * @return 0 if ok, or -ve FDT_ERR_... on failure
+ */
+int arch_fixup_fdt(void *blob);
+
+void ft_cpu_setup(void *blob, bd_t *bd);
+
+void ft_pci_setup(void *blob, bd_t *bd);
+
u32 fdt_getprop_u32_default_node(const void *fdt, int off, int cell,
const char *prop, const u32 dflt);
u32 fdt_getprop_u32_default(const void *fdt, const char *path,
u32 phys_lo;
};
+extern u8 __dtb_dt_begin[]; /* embedded device tree blob */
+extern u8 __dtb_dt_spl_begin[]; /* embedded device tree blob for SPL/TPL */
+
/**
* Compute the size of a resource.
*
#define CFI_CMDSET_AMD_LEGACY 0xFFF0
#endif
+/**
+ * flash_perror() - Print a flash error
+ *
+ * @err: Error number of message to print (ERR_... as below)
+ */
+void flash_perror(int err);
+
/*-----------------------------------------------------------------------
* return codes from flash_write():
*/
#define FS_TYPE_UBIFS 4
#define FS_TYPE_BTRFS 5
+/**
+ * do_fat_fsload - Run the fatload command
+ *
+ * @cmdtp: Command information for fatload
+ * @flag: Command flags (CMD_FLAG_...)
+ * @argc: Number of arguments
+ * @argv: List of arguments
+ * @return result (see enum command_ret_t)
+ */
+int do_fat_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
+
+/**
+ * do_ext2load - Run the ext2load command
+ *
+ * @cmdtp: Command information for ext2load
+ * @flag: Command flags (CMD_FLAG_...)
+ * @argc: Number of arguments
+ * @argv: List of arguments
+ * @return result (see enum command_ret_t)
+ */
+int do_ext2load(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
+
/*
* Tell the fs layer which block device an partition to use for future
* commands. This also internally identifies the filesystem that is present
--- /dev/null
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2000-2009
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ */
+
+#ifndef __HANG_H
+#define __HANG_H
+
+#ifndef __ASSEMBLY__
+/**
+ * hang() - Print a message and stop execution
+ *
+ * This shows a 'hang' message where possible and then goes into an infinite
+ * loop. This is called by panic() if CONFIG_PANIC_HANG is enabled.
+ *
+ * This function does not return.
+ */
+void hang(void) __attribute__ ((noreturn));
+#endif
+
+#endif
# define IMAGE_OF_SYSTEM_SETUP 0
#endif
+extern ulong image_load_addr; /* Default Load Address */
+extern ulong image_save_addr; /* Default Save Address */
+extern ulong image_save_size; /* Default Save Size */
+
enum ih_category {
IH_ARCH,
IH_COMP,
int arch, int image_type, int bootstage_id,
enum fit_load_op load_op, ulong *datap, ulong *lenp);
+/**
+ * image_source_script() - Execute a script
+ *
+ * Executes a U-Boot script at a particular address in memory. The script should
+ * have a header (FIT or legacy) with the script type (IH_TYPE_SCRIPT).
+ *
+ * @addr: Address of script
+ * @fit_uname: FIT subimage name
+ * @return result code (enum command_ret_t)
+ */
+int image_source_script(ulong addr, const char *fit_uname);
+
#ifndef USE_HOSTCC
/**
* fit_get_node_from_config() - Look up an image a FIT by type
#define FIT_IGNORE_PROP "uboot-ignore"
#define FIT_SIG_NODENAME "signature"
+/* cipher node */
+#define FIT_CIPHER_NODENAME "cipher"
+#define FIT_ALGO_PROP "algo"
+
/* image node */
#define FIT_DATA_PROP "data"
#define FIT_DATA_POSITION_PROP "data-position"
int fit_image_get_data_position(const void *fit, int noffset,
int *data_position);
int fit_image_get_data_size(const void *fit, int noffset, int *data_size);
+int fit_image_get_data_size_unciphered(const void *fit, int noffset,
+ size_t *data_size);
int fit_image_get_data_and_size(const void *fit, int noffset,
const void **data, size_t *size);
int fit_set_timestamp(void *fit, int noffset, time_t timestamp);
+int fit_cipher_data(const char *keydir, void *keydest, void *fit,
+ const char *comment, int require_keys,
+ const char *engine_id, const char *cmdname);
+
/**
* fit_add_verification_data() - add verification data to FIT image nodes
*
int fit_image_verify(const void *fit, int noffset);
int fit_config_verify(const void *fit, int conf_noffset);
int fit_all_image_verify(const void *fit);
+int fit_config_decrypt(const void *fit, int conf_noffset);
int fit_image_check_os(const void *fit, int noffset, uint8_t os);
int fit_image_check_arch(const void *fit, int noffset, uint8_t arch);
int fit_image_check_type(const void *fit, int noffset, uint8_t type);
const char *require_keys; /* Value for 'required' property */
const char *engine_id; /* Engine to use for signing */
};
+
#endif /* Allow struct image_region to always be defined for rsa.h */
/* A part of an image, used for hashing */
int fit_image_check_sig(const void *fit, int noffset, const void *data,
size_t size, int required_keynode, char **err_msgp);
+int fit_image_decrypt_data(const void *fit,
+ int image_noffset, int cipher_noffset,
+ const void *data, size_t size,
+ void **data_unciphered, size_t *size_unciphered);
+
/**
* fit_region_make_list() - Make a list of regions to hash
*
#endif
}
+/*
+ * At present we only support ciphering on the host, and unciphering on the
+ * device
+ */
+#if defined(USE_HOSTCC)
+# if defined(CONFIG_FIT_CIPHER)
+# define IMAGE_ENABLE_ENCRYPT 1
+# define IMAGE_ENABLE_DECRYPT 1
+# include <openssl/evp.h>
+# else
+# define IMAGE_ENABLE_ENCRYPT 0
+# define IMAGE_ENABLE_DECRYPT 0
+# endif
+#else
+# define IMAGE_ENABLE_ENCRYPT 0
+# define IMAGE_ENABLE_DECRYPT CONFIG_IS_ENABLED(FIT_CIPHER)
+#endif
+
+/* Information passed to the ciphering routines */
+struct image_cipher_info {
+ const char *keydir; /* Directory containing keys */
+ const char *keyname; /* Name of key to use */
+ const char *ivname; /* Name of IV to use */
+ const void *fit; /* Pointer to FIT blob */
+ int node_noffset; /* Offset of the cipher node */
+ const char *name; /* Algorithm name */
+ struct cipher_algo *cipher; /* Cipher algorithm information */
+ const void *fdt_blob; /* FDT containing key and IV */
+ const void *key; /* Value of the key */
+ const void *iv; /* Value of the IV */
+ size_t size_unciphered; /* Size of the unciphered data */
+};
+
+struct cipher_algo {
+ const char *name; /* Name of algorithm */
+ int key_len; /* Length of the key */
+ int iv_len; /* Length of the IV */
+
+#if IMAGE_ENABLE_ENCRYPT
+ const EVP_CIPHER * (*calculate_type)(void);
+#endif
+
+ int (*encrypt)(struct image_cipher_info *info,
+ const unsigned char *data, int data_len,
+ unsigned char **cipher, int *cipher_len);
+
+ int (*add_cipher_data)(struct image_cipher_info *info,
+ void *keydest);
+
+ int (*decrypt)(struct image_cipher_info *info,
+ const void *cipher, size_t cipher_len,
+ void **data, size_t *data_len);
+};
+
+int fit_image_cipher_get_algo(const void *fit, int noffset, char **algo);
+
+struct cipher_algo *image_get_cipher_algo(const char *full_name);
+
#ifdef CONFIG_FIT_VERBOSE
#define fit_unsupported(msg) printf("! %s:%d " \
"FIT images not supported for '%s'\n", \
#include <linux/types.h>
+struct global_data;
+
#ifndef __ASSEMBLY__ /* put C only stuff in this section */
+/* Avoid using CONFIG_EFI_STUB directly as we may boot from other loaders */
+#ifdef CONFIG_EFI_STUB
+#define ll_boot_init() false
+#else
+#define ll_boot_init() true
+#endif
+
/*
* Function Prototypes
*/
*/
int dram_init_banksize(void);
+long get_ram_size(long *base, long size);
+phys_size_t get_effective_memsize(void);
+
+int testdram(void);
+
/**
* arch_reserve_stacks() - Reserve all necessary stacks
*
void trap_init(unsigned long reloc_addr);
+/**
+ * main_loop() - Enter the main loop of U-Boot
+ *
+ * This normally runs the command line.
+ */
+void main_loop(void);
+
+#if defined(CONFIG_ARM)
+void relocate_code(ulong addr_moni);
+#else
+void relocate_code(ulong start_addr_sp, struct global_data *new_gd,
+ ulong relocaddr)
+ __attribute__ ((noreturn));
+#endif
+
#endif /* __ASSEMBLY__ */
/* Put only stuff here that the assembler can digest */
#define DIV_ROUND_UP_ULL(ll, d) DIV_ROUND_DOWN_ULL((ll) + (d) - 1, (d))
+#define ROUND(a, b) (((a) + (b) - 1) & ~((b) - 1))
+
#if BITS_PER_LONG == 32
# define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP_ULL(ll, d)
#else
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
+/*
+ * check_member() - Check the offset of a structure member
+ *
+ * @structure: Name of structure (e.g. global_data)
+ * @member: Name of member (e.g. baudrate)
+ * @offset: Expected offset in bytes
+ */
+#define check_member(structure, member, offset) _Static_assert( \
+ offsetof(struct structure, member) == (offset), \
+ "`struct " #structure "` offset for `" #member "` is not " #offset)
+
#endif
#define DECLARE_BITMAP(name, bits) \
unsigned long name[BITS_TO_LONGS(bits)]
+typedef volatile unsigned long vu_long;
+typedef volatile unsigned short vu_short;
+typedef volatile unsigned char vu_char;
+
#endif /* _LINUX_TYPES_H */
__be32 s_addr;
};
+/**
+ * do_tftpb - Run the tftpboot command
+ *
+ * @cmdtp: Command information for tftpboot
+ * @flag: Command flags (CMD_FLAG_...)
+ * @argc: Number of arguments
+ * @argv: List of arguments
+ * @return result (see enum command_ret_t)
+ */
+int do_tftpb(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
+
/**
* An incoming packet handler.
* @param pkt pointer to the application packet
{
return string_to_ip(env_get(var));
}
+
+/**
+ * reset_phy() - Reset the Ethernet PHY
+ *
+ * This should be implemented by boards if CONFIG_RESET_PHY_R is enabled
+ */
+void reset_phy(void);
+
#endif /* __NET_H__ */
+++ /dev/null
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * (C) Copyright 2000
- * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
- */
-
-#ifndef _NS87308_H_
-#define _NS87308_H_
-
-#include <asm/pci_io.h>
-
-/* Note: I couldn't find a full data sheet for the ns87308, but the ns87307 seems to be pretty
- functionally- (and pin-) equivalent to the 87308, but the 308 has better ir support. */
-
-void initialise_ns87308(void);
-
-/*
- * The following struct represents the GPIO registers on the NS87308/NS97307
- */
-struct GPIO
-{
- unsigned char dta1; /* 0 data port 1 */
- unsigned char dir1; /* 1 direction port 1 */
- unsigned char out1; /* 2 output type port 1 */
- unsigned char puc1; /* 3 pull-up control port 1 */
- unsigned char dta2; /* 4 data port 2 */
- unsigned char dir2; /* 5 direction port 2 */
- unsigned char out2; /* 6 output type port 2 */
- unsigned char puc2; /* 7 pull-up control port 2 */
-};
-
-/*
- * The following represents the power management registers on the NS87308/NS97307
- */
-#define PWM_FER1 0 /* 0 function enable reg. 1 */
-#define PWM_FER2 1 /* 1 function enable reg. 2 */
-#define PWM_PMC1 2 /* 2 power mgmt. control 1 */
-#define PWM_PMC2 3 /* 3 power mgmt. control 2 */
-#define PWM_PMC3 4 /* 4 power mgmt. control 3 */
-#define PWM_WDTO 5 /* 5 watchdog time-out */
-#define PWM_WDCF 6 /* 6 watchdog config. */
-#define PWM_WDST 7 /* 7 watchdog status */
-
-/*PNP config registers:
- * these depend on the stated of BADDR1 and BADDR0 on startup
- * so there's three versions here with the last two digits indicating
- * for which configuration their valid
- * the 1st of the two digits indicates the state of BADDR1
- * the 2st of the two digits indicates the state of BADDR0
- */
-
-
-#define IO_INDEX_OFFSET_0x 0x0279 /* full PnP isa Mode */
-#define IO_INDEX_OFFSET_10 0x015C /* PnP motherboard mode */
-#define IO_INDEX_OFFSET_11 0x002E /* PnP motherboard mode */
-#define IO_DATA_OFFSET_0x 0x0A79 /* full PnP isa Mode */
-#define IO_DATA_OFFSET_10 0x015D /* PnP motherboard mode */
-#define IO_DATA_OFFSET_11 0x002F /* PnP motherboard mode */
-
-#if defined(CONFIG_SYS_NS87308_BADDR_0x)
-#define IO_INDEX (CONFIG_SYS_ISA_IO + IO_INDEX_OFFSET_0x)
-#define IO_DATA (CONFIG_SYS_ISA_IO + IO_DATA_OFFSET_0x)
-#elif defined(CONFIG_SYS_NS87308_BADDR_10)
-#define IO_INDEX (CONFIG_SYS_ISA_IO + IO_INDEX_OFFSET_10)
-#define IO_DATA (CONFIG_SYS_ISA_IO + IO_DATA_OFFSET_10)
-#elif defined(CONFIG_SYS_NS87308_BADDR_11)
-#define IO_INDEX (CONFIG_SYS_ISA_IO + IO_INDEX_OFFSET_11)
-#define IO_DATA (CONFIG_SYS_ISA_IO + IO_DATA_OFFSET_11)
-#endif
-
-/* PnP register definitions */
-
-#define SET_RD_DATA_PORT 0x00
-#define SERIAL_ISOLATION 0x01
-#define CONFIG_CONTROL 0x02
-#define WAKE_CSN 0x03
-#define RES_DATA 0x04
-#define STATUS 0x05
-#define SET_CSN 0x06
-#define LOGICAL_DEVICE 0x07
-
-/*vendor defined values */
-#define SID_REG 0x20
-#define SUPOERIO_CONF1 0x21
-#define SUPOERIO_CONF2 0x22
-#define PGCS_INDEX 0x23
-#define PGCS_DATA 0x24
-
-/* values above 30 are different for each logical device
- but I can't be arsed to enter them all. the ones here
- are pretty consistent between all logical devices
- feel free to correct the situation if you want.. ;)
- */
-#define ACTIVATE 0x30
-#define ACTIVATE_OFF 0x00
-#define ACTIVATE_ON 0x01
-
-#define BASE_ADDR_HIGH 0x60
-#define BASE_ADDR_LOW 0x61
-#define LUN_CONFIG_REG 0xF0
-#define DBASE_HIGH 0x60 /* SIO KBC data base address, 15:8 */
-#define DBASE_LOW 0x61 /* SIO KBC data base address, 7:0 */
-#define CBASE_HIGH 0x62 /* SIO KBC command base addr, 15:8 */
-#define CBASE_LOW 0x63 /* SIO KBC command base addr, 7:0 */
-
-/* the logical devices*/
-#define LDEV_KBC1 0x00 /* 2 devices for keyboard and mouse controller*/
-#define LDEV_KBC2 0x01
-#define LDEV_MOUSE 0x01
-#define LDEV_RTC_APC 0x02 /*Real Time Clock and Advanced Power Control*/
-#define LDEV_FDC 0x03 /*floppy disk controller*/
-#define LDEV_PARP 0x04 /*Parallel port*/
-#define LDEV_UART2 0x05
-#define LDEV_UART1 0x06
-#define LDEV_GPIO 0x07 /*General Purpose IO and chip select output signals*/
-#define LDEV_POWRMAN 0x08 /*Power Managment*/
-
-#define CONFIG_SYS_NS87308_KBC1 (1 << LDEV_KBC1)
-#define CONFIG_SYS_NS87308_KBC2 (1 << LDEV_KBC2)
-#define CONFIG_SYS_NS87308_MOUSE (1 << LDEV_MOUSE)
-#define CONFIG_SYS_NS87308_RTC_APC (1 << LDEV_RTC_APC)
-#define CONFIG_SYS_NS87308_FDC (1 << LDEV_FDC)
-#define CONFIG_SYS_NS87308_PARP (1 << LDEV_PARP)
-#define CONFIG_SYS_NS87308_UART2 (1 << LDEV_UART2)
-#define CONFIG_SYS_NS87308_UART1 (1 << LDEV_UART1)
-#define CONFIG_SYS_NS87308_GPIO (1 << LDEV_GPIO)
-#define CONFIG_SYS_NS87308_POWRMAN (1 << LDEV_POWRMAN)
-
-/*some functions and macro's for doing configuration */
-
-static inline void read_pnp_config(unsigned char index, unsigned char *data)
-{
- pci_writeb(index,IO_INDEX);
- pci_readb(IO_DATA, *data);
-}
-
-static inline void write_pnp_config(unsigned char index, unsigned char data)
-{
- pci_writeb(index,IO_INDEX);
- pci_writeb(data, IO_DATA);
-}
-
-static inline void pnp_set_device(unsigned char dev)
-{
- write_pnp_config(LOGICAL_DEVICE, dev);
-}
-
-static inline void write_pm_reg(unsigned short base, unsigned char index, unsigned char data)
-{
- pci_writeb(index, CONFIG_SYS_ISA_IO + base);
- eieio();
- pci_writeb(data, CONFIG_SYS_ISA_IO + base + 1);
-}
-
-/*void write_pnp_config(unsigned char index, unsigned char data);
-void pnp_set_device(unsigned char dev);
-*/
-
-#define PNP_SET_DEVICE_BASE(dev,base) \
- pnp_set_device(dev); \
- write_pnp_config(ACTIVATE, ACTIVATE_OFF); \
- write_pnp_config(BASE_ADDR_HIGH, ((base) >> 8) & 0xff ); \
- write_pnp_config(BASE_ADDR_LOW, (base) &0xff); \
- write_pnp_config(ACTIVATE, ACTIVATE_ON);
-
-#define PNP_ACTIVATE_DEVICE(dev) \
- pnp_set_device(dev); \
- write_pnp_config(ACTIVATE, ACTIVATE_ON);
-
-#define PNP_DEACTIVATE_DEVICE(dev) \
- pnp_set_device(dev); \
- write_pnp_config(ACTIVATE, ACTIVATE_OFF);
-
-
-static inline void write_pgcs_config(unsigned char index, unsigned char data)
-{
- write_pnp_config(PGCS_INDEX, index);
- write_pnp_config(PGCS_DATA, data);
-}
-
-/* these macrose configure the 3 CS lines
- on the sandpoint board these controll NVRAM
- CS0 is connected to NVRAMCS
- CS1 is connected to NVRAMAS0
- CS2 is connected to NVRAMAS1
- */
-#define PGCS_CS_ASSERT_ON_WRITE 0x10
-#define PGCS_CS_ASSERT_ON_READ 0x20
-
-#define PNP_PGCS_CSLINE_BASE(cs, base) \
- write_pgcs_config((cs) << 2, ((base) >> 8) & 0xff ); \
- write_pgcs_config(((cs) << 2) + 1, (base) & 0xff );
-
-#define PNP_PGCS_CSLINE_CONF(cs, conf) \
- write_pgcs_config(((cs) << 2) + 2, (conf) );
-
-
-/* The following sections are for 87308 extensions to the standard compoents it emulates */
-
-/* extensions to 16550*/
-
-#define MCR_MDSL_MSK 0xe0 /*mode select mask*/
-#define MCR_MDSL_UART 0x00 /*uart, default*/
-#define MCR_MDSL_SHRPIR 0x02 /*Sharp IR*/
-#define MCR_MDSL_SIR 0x03 /*SIR*/
-#define MCR_MDSL_CIR 0x06 /*Consumer IR*/
-
-#define FCR_TXFTH0 0x10 /* these bits control threshod of data level in fifo */
-#define FCR_TXFTH1 0x20 /* for interrupt trigger */
-
-/*
- * Default NS87308 configuration
- */
-#ifndef CONFIG_SYS_NS87308_KBC1_BASE
-#define CONFIG_SYS_NS87308_KBC1_BASE 0x0060
-#endif
-#ifndef CONFIG_SYS_NS87308_RTC_BASE
-#define CONFIG_SYS_NS87308_RTC_BASE 0x0070
-#endif
-#ifndef CONFIG_SYS_NS87308_FDC_BASE
-#define CONFIG_SYS_NS87308_FDC_BASE 0x03F0
-#endif
-#ifndef CONFIG_SYS_NS87308_LPT_BASE
-#define CONFIG_SYS_NS87308_LPT_BASE 0x0278
-#endif
-#ifndef CONFIG_SYS_NS87308_UART1_BASE
-#define CONFIG_SYS_NS87308_UART1_BASE 0x03F8
-#endif
-#ifndef CONFIG_SYS_NS87308_UART2_BASE
-#define CONFIG_SYS_NS87308_UART2_BASE 0x02F8
-#endif
-
-#endif /*_NS87308_H_*/
#include <linux/typecheck.h>
#include <linux/types.h>
+ulong get_tbclk(void);
+
unsigned long get_timer(unsigned long base);
/*
--- /dev/null
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2019, Softathome
+ */
+
+#ifndef _AES_H
+#define _AES_H
+
+#include <errno.h>
+#include <image.h>
+
+#if IMAGE_ENABLE_ENCRYPT
+int image_aes_encrypt(struct image_cipher_info *info,
+ const unsigned char *data, int size,
+ unsigned char **cipher, int *cipher_len);
+int image_aes_add_cipher_data(struct image_cipher_info *info, void *keydest);
+#else
+int image_aes_encrypt(struct image_cipher_info *info,
+ const unsigned char *data, int size,
+ unsigned char **cipher, int *cipher_len)
+{
+ return -ENXIO;
+}
+
+int image_aes_add_cipher_data(struct image_cipher_info *info, void *keydest)
+{
+ return -ENXIO;
+}
+#endif /* IMAGE_ENABLE_ENCRYPT */
+
+#if IMAGE_ENABLE_DECRYPT
+int image_aes_decrypt(struct image_cipher_info *info,
+ const void *cipher, size_t cipher_len,
+ void **data, size_t *size);
+#else
+int image_aes_decrypt(struct image_cipher_info *info,
+ const void *cipher, size_t cipher_len,
+ void **data, size_t *size)
+{
+ return -ENXIO;
+}
+#endif /* IMAGE_ENABLE_DECRYPT */
+
+#endif
* AES encryption library, with small code size, supporting only 128-bit AES
*
* AES is a stream cipher which works a block at a time, with each block
- * in this case being AES_KEY_LENGTH bytes.
+ * in this case being AES_BLOCK_LENGTH bytes.
*/
enum {
AES_STATECOLS = 4, /* columns in the state & expanded key */
- AES_KEYCOLS = 4, /* columns in a key */
- AES_ROUNDS = 10, /* rounds in encryption */
-
- AES_KEY_LENGTH = 128 / 8,
- AES_EXPAND_KEY_LENGTH = 4 * AES_STATECOLS * (AES_ROUNDS + 1),
+ AES128_KEYCOLS = 4, /* columns in a key for aes128 */
+ AES192_KEYCOLS = 6, /* columns in a key for aes128 */
+ AES256_KEYCOLS = 8, /* columns in a key for aes128 */
+ AES128_ROUNDS = 10, /* rounds in encryption for aes128 */
+ AES192_ROUNDS = 12, /* rounds in encryption for aes192 */
+ AES256_ROUNDS = 14, /* rounds in encryption for aes256 */
+ AES128_KEY_LENGTH = 128 / 8,
+ AES192_KEY_LENGTH = 192 / 8,
+ AES256_KEY_LENGTH = 256 / 8,
+ AES128_EXPAND_KEY_LENGTH = 4 * AES_STATECOLS * (AES128_ROUNDS + 1),
+ AES192_EXPAND_KEY_LENGTH = 4 * AES_STATECOLS * (AES192_ROUNDS + 1),
+ AES256_EXPAND_KEY_LENGTH = 4 * AES_STATECOLS * (AES256_ROUNDS + 1),
+ AES_BLOCK_LENGTH = 128 / 8,
};
/**
* Expand a key into a key schedule, which is then used for the other
* operations.
*
- * @key Key, of length AES_KEY_LENGTH bytes
+ * @key Key
+ * @key_size Size of the key (in bits)
* @expkey Buffer to place expanded key, AES_EXPAND_KEY_LENGTH
*/
-void aes_expand_key(u8 *key, u8 *expkey);
+void aes_expand_key(u8 *key, u32 key_size, u8 *expkey);
/**
* aes_encrypt() - Encrypt single block of data with AES 128
*
+ * @key_size Size of the aes key (in bits)
* @in Input data
* @expkey Expanded key to use for encryption (from aes_expand_key())
* @out Output data
*/
-void aes_encrypt(u8 *in, u8 *expkey, u8 *out);
+void aes_encrypt(u32 key_size, u8 *in, u8 *expkey, u8 *out);
/**
* aes_decrypt() - Decrypt single block of data with AES 128
*
+ * @key_size Size of the aes key (in bits)
* @in Input data
* @expkey Expanded key to use for decryption (from aes_expand_key())
* @out Output data
*/
-void aes_decrypt(u8 *in, u8 *expkey, u8 *out);
+void aes_decrypt(u32 key_size, u8 *in, u8 *expkey, u8 *out);
/**
* Apply chain data to the destination using EOR
*
- * Each array is of length AES_KEY_LENGTH.
+ * Each array is of length AES_BLOCK_LENGTH.
*
* @cbc_chain_data Chain data
* @src Source data
/**
* aes_cbc_encrypt_blocks() - Encrypt multiple blocks of data with AES CBC.
*
+ * @key_size Size of the aes key (in bits)
* @key_exp Expanded key to use
* @iv Initialization vector
* @src Source data to encrypt
* @dst Destination buffer
* @num_aes_blocks Number of AES blocks to encrypt
*/
-void aes_cbc_encrypt_blocks(u8 *key_exp, u8 *iv, u8 *src, u8 *dst,
+void aes_cbc_encrypt_blocks(u32 key_size, u8 *key_exp, u8 *iv, u8 *src, u8 *dst,
u32 num_aes_blocks);
/**
* Decrypt multiple blocks of data with AES CBC.
*
+ * @key_size Size of the aes key (in bits)
* @key_exp Expanded key to use
* @iv Initialization vector
* @src Source data to decrypt
* @dst Destination buffer
* @num_aes_blocks Number of AES blocks to decrypt
*/
-void aes_cbc_decrypt_blocks(u8 *key_exp, u8 *iv, u8 *src, u8 *dst,
+void aes_cbc_decrypt_blocks(u32 key_size, u8 *key_exp, u8 *iv, u8 *src, u8 *dst,
u32 num_aes_blocks);
#endif /* _AES_REF_H_ */
obj-y += crypto/
obj-$(CONFIG_AES) += aes.o
+obj-$(CONFIG_AES) += aes/
obj-$(CONFIG_$(SPL_TPL_)BINMAN_FDT) += binman.o
ifndef API_BUILD
0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36
};
+static u32 aes_get_rounds(u32 key_len)
+{
+ u32 rounds = AES128_ROUNDS;
+
+ if (key_len == AES192_KEY_LENGTH)
+ rounds = AES192_ROUNDS;
+ else if (key_len == AES256_KEY_LENGTH)
+ rounds = AES256_ROUNDS;
+
+ return rounds;
+}
+
+static u32 aes_get_keycols(u32 key_len)
+{
+ u32 keycols = AES128_KEYCOLS;
+
+ if (key_len == AES192_KEY_LENGTH)
+ keycols = AES192_KEYCOLS;
+ else if (key_len == AES256_KEY_LENGTH)
+ keycols = AES256_KEYCOLS;
+
+ return keycols;
+}
+
/* produce AES_STATECOLS bytes for each round */
-void aes_expand_key(u8 *key, u8 *expkey)
+void aes_expand_key(u8 *key, u32 key_len, u8 *expkey)
{
u8 tmp0, tmp1, tmp2, tmp3, tmp4;
- u32 idx;
+ u32 idx, aes_rounds, aes_keycols;
- memcpy(expkey, key, AES_KEYCOLS * 4);
+ aes_rounds = aes_get_rounds(key_len);
+ aes_keycols = aes_get_keycols(key_len);
- for (idx = AES_KEYCOLS; idx < AES_STATECOLS * (AES_ROUNDS + 1); idx++) {
+ memcpy(expkey, key, key_len);
+
+ for (idx = aes_keycols; idx < AES_STATECOLS * (aes_rounds + 1); idx++) {
tmp0 = expkey[4*idx - 4];
tmp1 = expkey[4*idx - 3];
tmp2 = expkey[4*idx - 2];
tmp3 = expkey[4*idx - 1];
- if (!(idx % AES_KEYCOLS)) {
+ if (!(idx % aes_keycols)) {
tmp4 = tmp3;
tmp3 = sbox[tmp0];
- tmp0 = sbox[tmp1] ^ rcon[idx / AES_KEYCOLS];
+ tmp0 = sbox[tmp1] ^ rcon[idx / aes_keycols];
tmp1 = sbox[tmp2];
tmp2 = sbox[tmp4];
- } else if ((AES_KEYCOLS > 6) && (idx % AES_KEYCOLS == 4)) {
+ } else if ((aes_keycols > 6) && (idx % aes_keycols == 4)) {
tmp0 = sbox[tmp0];
tmp1 = sbox[tmp1];
tmp2 = sbox[tmp2];
tmp3 = sbox[tmp3];
}
- expkey[4*idx+0] = expkey[4*idx - 4*AES_KEYCOLS + 0] ^ tmp0;
- expkey[4*idx+1] = expkey[4*idx - 4*AES_KEYCOLS + 1] ^ tmp1;
- expkey[4*idx+2] = expkey[4*idx - 4*AES_KEYCOLS + 2] ^ tmp2;
- expkey[4*idx+3] = expkey[4*idx - 4*AES_KEYCOLS + 3] ^ tmp3;
+ expkey[4*idx+0] = expkey[4*idx - 4*aes_keycols + 0] ^ tmp0;
+ expkey[4*idx+1] = expkey[4*idx - 4*aes_keycols + 1] ^ tmp1;
+ expkey[4*idx+2] = expkey[4*idx - 4*aes_keycols + 2] ^ tmp2;
+ expkey[4*idx+3] = expkey[4*idx - 4*aes_keycols + 3] ^ tmp3;
}
}
/* encrypt one 128 bit block */
-void aes_encrypt(u8 *in, u8 *expkey, u8 *out)
+void aes_encrypt(u32 key_len, u8 *in, u8 *expkey, u8 *out)
{
u8 state[AES_STATECOLS * 4];
- u32 round;
+ u32 round, aes_rounds;
+
+ aes_rounds = aes_get_rounds(key_len);
memcpy(state, in, AES_STATECOLS * 4);
add_round_key((u32 *)state, (u32 *)expkey);
- for (round = 1; round < AES_ROUNDS + 1; round++) {
- if (round < AES_ROUNDS)
+ for (round = 1; round < aes_rounds + 1; round++) {
+ if (round < aes_rounds)
mix_sub_columns(state);
else
shift_rows(state);
memcpy(out, state, sizeof(state));
}
-void aes_decrypt(u8 *in, u8 *expkey, u8 *out)
+void aes_decrypt(u32 key_len, u8 *in, u8 *expkey, u8 *out)
{
u8 state[AES_STATECOLS * 4];
- int round;
+ int round, aes_rounds;
+
+ aes_rounds = aes_get_rounds(key_len);
memcpy(state, in, sizeof(state));
add_round_key((u32 *)state,
- (u32 *)expkey + AES_ROUNDS * AES_STATECOLS);
+ (u32 *)expkey + aes_rounds * AES_STATECOLS);
inv_shift_rows(state);
- for (round = AES_ROUNDS; round--; ) {
+ for (round = aes_rounds; round--; ) {
add_round_key((u32 *)state,
(u32 *)expkey + round * AES_STATECOLS);
if (round)
{
int i;
- for (i = 0; i < AES_KEY_LENGTH; i++)
+ for (i = 0; i < AES_BLOCK_LENGTH; i++)
*dst++ = *src++ ^ *cbc_chain_data++;
}
-void aes_cbc_encrypt_blocks(u8 *key_exp, u8 *iv, u8 *src, u8 *dst,
+void aes_cbc_encrypt_blocks(u32 key_len, u8 *key_exp, u8 *iv, u8 *src, u8 *dst,
u32 num_aes_blocks)
{
- u8 tmp_data[AES_KEY_LENGTH];
+ u8 tmp_data[AES_BLOCK_LENGTH];
u8 *cbc_chain_data = iv;
u32 i;
for (i = 0; i < num_aes_blocks; i++) {
debug("encrypt_object: block %d of %d\n", i, num_aes_blocks);
- debug_print_vector("AES Src", AES_KEY_LENGTH, src);
+ debug_print_vector("AES Src", AES_BLOCK_LENGTH, src);
/* Apply the chain data */
aes_apply_cbc_chain_data(cbc_chain_data, src, tmp_data);
- debug_print_vector("AES Xor", AES_KEY_LENGTH, tmp_data);
+ debug_print_vector("AES Xor", AES_BLOCK_LENGTH, tmp_data);
/* Encrypt the AES block */
- aes_encrypt(tmp_data, key_exp, dst);
- debug_print_vector("AES Dst", AES_KEY_LENGTH, dst);
+ aes_encrypt(key_len, tmp_data, key_exp, dst);
+ debug_print_vector("AES Dst", AES_BLOCK_LENGTH, dst);
/* Update pointers for next loop. */
cbc_chain_data = dst;
- src += AES_KEY_LENGTH;
- dst += AES_KEY_LENGTH;
+ src += AES_BLOCK_LENGTH;
+ dst += AES_BLOCK_LENGTH;
}
}
-void aes_cbc_decrypt_blocks(u8 *key_exp, u8 *iv, u8 *src, u8 *dst,
+void aes_cbc_decrypt_blocks(u32 key_len, u8 *key_exp, u8 *iv, u8 *src, u8 *dst,
u32 num_aes_blocks)
{
- u8 tmp_data[AES_KEY_LENGTH], tmp_block[AES_KEY_LENGTH];
+ u8 tmp_data[AES_BLOCK_LENGTH], tmp_block[AES_BLOCK_LENGTH];
/* Convenient array of 0's for IV */
- u8 cbc_chain_data[AES_KEY_LENGTH];
+ u8 cbc_chain_data[AES_BLOCK_LENGTH];
u32 i;
- memcpy(cbc_chain_data, iv, AES_KEY_LENGTH);
+ memcpy(cbc_chain_data, iv, AES_BLOCK_LENGTH);
for (i = 0; i < num_aes_blocks; i++) {
debug("encrypt_object: block %d of %d\n", i, num_aes_blocks);
- debug_print_vector("AES Src", AES_KEY_LENGTH, src);
+ debug_print_vector("AES Src", AES_BLOCK_LENGTH, src);
- memcpy(tmp_block, src, AES_KEY_LENGTH);
+ memcpy(tmp_block, src, AES_BLOCK_LENGTH);
/* Decrypt the AES block */
- aes_decrypt(src, key_exp, tmp_data);
- debug_print_vector("AES Xor", AES_KEY_LENGTH, tmp_data);
+ aes_decrypt(key_len, src, key_exp, tmp_data);
+ debug_print_vector("AES Xor", AES_BLOCK_LENGTH, tmp_data);
/* Apply the chain data */
aes_apply_cbc_chain_data(cbc_chain_data, tmp_data, dst);
- debug_print_vector("AES Dst", AES_KEY_LENGTH, dst);
+ debug_print_vector("AES Dst", AES_BLOCK_LENGTH, dst);
/* Update pointers for next loop. */
- memcpy(cbc_chain_data, tmp_block, AES_KEY_LENGTH);
- src += AES_KEY_LENGTH;
- dst += AES_KEY_LENGTH;
+ memcpy(cbc_chain_data, tmp_block, AES_BLOCK_LENGTH);
+ src += AES_BLOCK_LENGTH;
+ dst += AES_BLOCK_LENGTH;
}
}
--- /dev/null
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (c) 2019, Softathome
+
+obj-$(CONFIG_$(SPL_)FIT_CIPHER) += aes-decrypt.o
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2019, softathome
+ */
+
+#ifndef USE_HOSTCC
+#include <common.h>
+#include <malloc.h>
+#endif
+#include <image.h>
+#include <uboot_aes.h>
+
+int image_aes_decrypt(struct image_cipher_info *info,
+ const void *cipher, size_t cipher_len,
+ void **data, size_t *size)
+{
+#ifndef USE_HOSTCC
+ unsigned char key_exp[AES256_EXPAND_KEY_LENGTH];
+ unsigned int aes_blocks, key_len = info->cipher->key_len;
+
+ *data = malloc(cipher_len);
+ if (!*data) {
+ printf("Can't allocate memory to decrypt\n");
+ return -ENOMEM;
+ }
+ *size = info->size_unciphered;
+
+ memcpy(&key_exp[0], info->key, key_len);
+
+ /* First we expand the key. */
+ aes_expand_key((u8 *)info->key, key_len, key_exp);
+
+ /* Calculate the number of AES blocks to encrypt. */
+ aes_blocks = DIV_ROUND_UP(cipher_len, AES_BLOCK_LENGTH);
+
+ aes_cbc_decrypt_blocks(key_len, key_exp, (u8 *)info->iv,
+ (u8 *)cipher, *data, aes_blocks);
+#endif
+
+ return 0;
+}
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2019,Softathome
+ */
+#include "mkimage.h"
+#include <stdio.h>
+#include <string.h>
+#include <image.h>
+#include <time.h>
+#include <openssl/bn.h>
+#include <openssl/rsa.h>
+#include <openssl/pem.h>
+#include <openssl/err.h>
+#include <openssl/ssl.h>
+#include <openssl/evp.h>
+#include <openssl/engine.h>
+#include <uboot_aes.h>
+
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+#define HAVE_ERR_REMOVE_THREAD_STATE
+#endif
+
+int image_aes_encrypt(struct image_cipher_info *info,
+ unsigned char *data, int size,
+ unsigned char **cipher, int *cipher_len)
+{
+ EVP_CIPHER_CTX *ctx;
+ unsigned char *buf = NULL;
+ int buf_len, len, ret = 0;
+
+ /* create and initialise the context */
+ ctx = EVP_CIPHER_CTX_new();
+ if (!ctx) {
+ printf("Can't create context\n");
+ return -1;
+ }
+
+ /* allocate a buffer for the result */
+ buf = malloc(size + AES_BLOCK_LENGTH);
+ if (!buf) {
+ printf("Can't allocate memory to encrypt\n");
+ ret = -1;
+ goto out;
+ }
+
+ if (EVP_EncryptInit_ex(ctx, info->cipher->calculate_type(),
+ NULL, info->key, info->iv) != 1) {
+ printf("Can't init encryption\n");
+ ret = -1;
+ goto out;
+ }
+
+ if (EVP_EncryptUpdate(ctx, buf, &len, data, size) != 1) {
+ printf("Can't encrypt data\n");
+ ret = -1;
+ goto out;
+ }
+
+ buf_len = len;
+
+ if (EVP_EncryptFinal_ex(ctx, buf + len, &len) != 1) {
+ printf("Can't finalise the encryption\n");
+ ret = -1;
+ goto out;
+ }
+
+ buf_len += len;
+
+ *cipher = buf;
+ *cipher_len = buf_len;
+
+ out:
+ EVP_CIPHER_CTX_free(ctx);
+ return ret;
+}
+
+int image_aes_add_cipher_data(struct image_cipher_info *info, void *keydest)
+{
+ int parent, node;
+ char name[128];
+ int ret = 0;
+
+ /* Either create or overwrite the named cipher node */
+ parent = fdt_subnode_offset(keydest, 0, FIT_CIPHER_NODENAME);
+ if (parent == -FDT_ERR_NOTFOUND) {
+ parent = fdt_add_subnode(keydest, 0, FIT_CIPHER_NODENAME);
+ if (parent < 0) {
+ ret = parent;
+ if (ret != -FDT_ERR_NOSPACE) {
+ fprintf(stderr,
+ "Couldn't create cipher node: %s\n",
+ fdt_strerror(parent));
+ }
+ }
+ }
+ if (ret)
+ goto done;
+
+ /* Either create or overwrite the named key node */
+ snprintf(name, sizeof(name), "key-%s-%s-%s",
+ info->name, info->keyname, info->ivname);
+ node = fdt_subnode_offset(keydest, parent, name);
+ if (node == -FDT_ERR_NOTFOUND) {
+ node = fdt_add_subnode(keydest, parent, name);
+ if (node < 0) {
+ ret = node;
+ if (ret != -FDT_ERR_NOSPACE) {
+ fprintf(stderr,
+ "Could not create key subnode: %s\n",
+ fdt_strerror(node));
+ }
+ }
+ } else if (node < 0) {
+ fprintf(stderr, "Cannot select keys parent: %s\n",
+ fdt_strerror(node));
+ ret = node;
+ }
+
+ if (!ret)
+ ret = fdt_setprop(keydest, node, "iv",
+ info->iv, info->cipher->iv_len);
+
+ if (!ret)
+ ret = fdt_setprop(keydest, node, "key",
+ info->key, info->cipher->key_len);
+
+ if (!ret)
+ ret = fdt_setprop_u32(keydest, node, "key-len",
+ info->cipher->key_len);
+
+done:
+ if (ret)
+ ret = ret == -FDT_ERR_NOSPACE ? -ENOSPC : -EIO;
+
+ return ret;
+}
{
/* linebuf as a union causes proper alignment */
union linebuf {
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
uint64_t uq[MAX_LINE_LENGTH_BYTES/sizeof(uint64_t) + 1];
#endif
uint32_t ui[MAX_LINE_LENGTH_BYTES/sizeof(uint32_t) + 1];
uint8_t uc[MAX_LINE_LENGTH_BYTES/sizeof(uint8_t) + 1];
} lb;
int i;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
uint64_t __maybe_unused x;
#else
uint32_t __maybe_unused x;
for (i = 0; i < thislinelen; i++) {
if (width == 4)
x = lb.ui[i] = *(volatile uint32_t *)data;
-#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
+#ifdef MEM_SUPPORT_64BIT_DATA
else if (width == 8)
x = lb.uq[i] = *(volatile uint64_t *)data;
#endif
x = lb.uc[i] = *(volatile uint8_t *)data;
#if defined(CONFIG_SPL_BUILD)
printf(" %x", (uint)x);
-#elif defined(CONFIG_SYS_SUPPORT_64BIT_DATA)
+#elif defined(MEM_SUPPORT_64BIT_DATA)
printf(" %0*llx", width * 2, (long long)x);
#else
printf(" %0*x", width * 2, x);
*/
#include <common.h>
+#include <cpu_func.h>
#include <debug_uart.h>
#include <dm.h>
#include <errno.h>
#include <common.h>
#include <boot_fit.h>
#include <dm.h>
+#include <hang.h>
+#include <init.h>
#include <dm/of_extra.h>
#include <env.h>
#include <errno.h>
#include <common.h>
#include <bootstage.h>
+#include <hang.h>
#include <os.h>
/**
* Copyright (C) 2016 The Android Open Source Project
*/
+#include <hang.h>
#include <stdarg.h>
#include <stdlib.h>
*/
#include <common.h>
+#include <image.h>
#include <malloc.h>
#include <linux/libfdt.h>
#include <tee/optee.h>
*/
#include <common.h>
+#include <hang.h>
#if !defined(CONFIG_PANIC_HANG)
#include <command.h>
#endif
/* @(#) $Id$ */
#include "zutil.h"
+#include <hang.h>
#ifndef NO_DUMMY_DECL
struct internal_state {int dummy;}; /* for buggy compilers */
char *m;
{
fprintf(stderr, "%s\n", m);
- hang ();
+ hang();
}
#endif
#include <env.h>
#include <env_internal.h>
#include <errno.h>
+#include <image.h>
#include <net.h>
#include <net/fastboot.h>
#include <net/tftp.h>
printf("Bytes transferred = %d (%x hex)\n",
net_boot_file_size, net_boot_file_size);
env_set_hex("filesize", net_boot_file_size);
- env_set_hex("fileaddr", load_addr);
+ env_set_hex("fileaddr", image_load_addr);
}
if (protocol != NETCONS)
eth_halt();
#include <common.h>
#include <command.h>
+#include <flash.h>
+#include <image.h>
#include <net.h>
#include <malloc.h>
#include <mapmem.h>
for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) {
/* start address in flash? */
- if (load_addr + offset >= flash_info[i].start[0]) {
+ if (image_load_addr + offset >= flash_info[i].start[0]) {
rc = 1;
break;
}
}
if (rc) { /* Flash is destination for this packet */
- rc = flash_write((uchar *)src, (ulong)(load_addr+offset), len);
+ rc = flash_write((uchar *)src, (ulong)image_load_addr + offset,
+ len);
if (rc) {
flash_perror(rc);
return -1;
} else
#endif /* CONFIG_SYS_DIRECT_FLASH_NFS */
{
- void *ptr = map_sysmem(load_addr + offset, len);
+ void *ptr = map_sysmem(image_load_addr + offset, len);
memcpy(ptr, src, len);
unmap_sysmem(ptr);
net_boot_file_expected_size_in_blocks << 9);
print_size(net_boot_file_expected_size_in_blocks << 9, "");
}
- printf("\nLoad address: 0x%lx\nLoading: *\b", load_addr);
+ printf("\nLoad address: 0x%lx\nLoading: *\b", image_load_addr);
net_set_timeout_handler(nfs_timeout, nfs_timeout_handler);
net_set_udp_handler(nfs_handler);
#include <command.h>
#include <efi_loader.h>
#include <env.h>
+#include <image.h>
#include <mapmem.h>
#include <net.h>
#include <net/tftp.h>
ulong tosend = len;
tosend = min(net_boot_file_size - offset, tosend);
- (void)memcpy(dst, (void *)(save_addr + offset), tosend);
+ (void)memcpy(dst, (void *)(image_save_addr + offset), tosend);
debug("%s: block=%d, offset=%ld, len=%d, tosend=%ld\n", __func__,
block, offset, len, tosend);
return tosend;
}
}
-/* Initialize tftp_load_addr and tftp_load_size from load_addr and lmb */
+/* Initialize tftp_load_addr and tftp_load_size from image_load_addr and lmb */
static int tftp_init_load_addr(void)
{
#ifdef CONFIG_LMB
lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob);
- max_size = lmb_get_free_size(&lmb, load_addr);
+ max_size = lmb_get_free_size(&lmb, image_load_addr);
if (!max_size)
return -1;
tftp_load_size = max_size;
#endif
- tftp_load_addr = load_addr;
+ tftp_load_addr = image_load_addr;
return 0;
}
#ifdef CONFIG_CMD_TFTPPUT
tftp_put_active = (protocol == TFTPPUT);
if (tftp_put_active) {
- printf("Save address: 0x%lx\n", save_addr);
- printf("Save size: 0x%lx\n", save_size);
- net_boot_file_size = save_size;
+ printf("Save address: 0x%lx\n", image_save_addr);
+ printf("Save size: 0x%lx\n", image_save_size);
+ net_boot_file_size = image_save_size;
puts("Saving: *\b");
tftp_state = STATE_SEND_WRQ;
new_transfer();
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
obj-y += post.o
-obj-$(CONFIG_POST_STD_LIST) += tests.o
+obj-y += tests.o
obj-y += drivers/
obj-$(CONFIG_PPC) += lib_powerpc/
CONFIG_NR_DRAM_POPULATED
CONFIG_NS16550_MIN_FUNCTIONS
CONFIG_NS8382X
-CONFIG_NS87308
CONFIG_NUM_DSP_CPUS
CONFIG_NUM_PAMU
CONFIG_ODROID_REV_AIN
CONFIG_PM_SLEEP
CONFIG_POST
CONFIG_POSTBOOTMENU
-CONFIG_POST_ALT_LIST
CONFIG_POST_BSPEC1
CONFIG_POST_BSPEC2
CONFIG_POST_BSPEC3
CONFIG_POST_BSPEC5
CONFIG_POST_EXTERNAL_WORD_FUNCS
CONFIG_POST_SKIP_ENV_FLAGS
-CONFIG_POST_STD_LIST
CONFIG_POST_UART
CONFIG_POST_WATCHDOG
CONFIG_POWER
CONFIG_SYS_FAULT_ECHO_LINK_DOWN
CONFIG_SYS_FAULT_MII_ADDR
CONFIG_SYS_FCC_PSMR
-CONFIG_SYS_FDC_DRIVE_NUMBER
-CONFIG_SYS_FDC_HW_INIT
CONFIG_SYS_FDT_BASE
CONFIG_SYS_FDT_LOAD_ADDR
CONFIG_SYS_FDT_PAD
CONFIG_SYS_ISA_BASE
CONFIG_SYS_ISA_IO
CONFIG_SYS_ISA_IO_BASE_ADDRESS
-CONFIG_SYS_ISA_IO_OFFSET
-CONFIG_SYS_ISA_IO_STRIDE
CONFIG_SYS_ISA_MEM
CONFIG_SYS_JFFS2_FIRST_BANK
CONFIG_SYS_JFFS2_FIRST_SECTOR
CONFIG_SYS_NS16550_PORT_MAPPED
CONFIG_SYS_NS16550_REG_SIZE
CONFIG_SYS_NS16550_SERIAL
-CONFIG_SYS_NS87308_CS0_BASE
-CONFIG_SYS_NS87308_CS0_CONF
-CONFIG_SYS_NS87308_CS1_BASE
-CONFIG_SYS_NS87308_CS1_CONF
-CONFIG_SYS_NS87308_CS2_BASE
-CONFIG_SYS_NS87308_CS2_CONF
-CONFIG_SYS_NS87308_FDC
-CONFIG_SYS_NS87308_FDC_BASE
-CONFIG_SYS_NS87308_GPIO
-CONFIG_SYS_NS87308_GPIO_BASE
-CONFIG_SYS_NS87308_KBC1
-CONFIG_SYS_NS87308_KBC1_BASE
-CONFIG_SYS_NS87308_KBC2
-CONFIG_SYS_NS87308_LPT_BASE
-CONFIG_SYS_NS87308_MOUSE
-CONFIG_SYS_NS87308_PARP
-CONFIG_SYS_NS87308_PMC1
-CONFIG_SYS_NS87308_PMC2
-CONFIG_SYS_NS87308_PMC3
-CONFIG_SYS_NS87308_POWRMAN
-CONFIG_SYS_NS87308_PS2MOD
-CONFIG_SYS_NS87308_PWMAN_BASE
-CONFIG_SYS_NS87308_RARP
-CONFIG_SYS_NS87308_RTC_APC
-CONFIG_SYS_NS87308_RTC_BASE
-CONFIG_SYS_NS87308_UART1
-CONFIG_SYS_NS87308_UART1_BASE
-CONFIG_SYS_NS87308_UART2
-CONFIG_SYS_NS87308_UART2_BASE
CONFIG_SYS_NUM_ADDR_MAP
CONFIG_SYS_NUM_CPC
CONFIG_SYS_NUM_FM1_10GEC
CONFIG_SYS_STATUS_C
CONFIG_SYS_STATUS_OK
CONFIG_SYS_STMICRO_BOOT
-CONFIG_SYS_SUPPORT_64BIT_DATA
CONFIG_SYS_SXCNFG_VAL
CONFIG_SYS_TBIPA_VALUE
CONFIG_SYS_TCLK
obj-y += string.o
obj-$(CONFIG_ERRNO_STR) += test_errno_str.o
obj-$(CONFIG_UT_LIB_ASN1) += asn1.o
+obj-$(CONFIG_AES) += test_aes.o
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2019 Philippe Reynes <philippe.reynes@softathome.com>
+ *
+ * Unit tests for aes functions
+ */
+
+#include <common.h>
+#include <command.h>
+#include <hexdump.h>
+#include <uboot_aes.h>
+#include <test/lib.h>
+#include <test/test.h>
+#include <test/ut.h>
+
+#define TEST_AES_ONE_BLOCK 0
+#define TEST_AES_CBC_CHAIN 1
+
+struct test_aes_s {
+ int key_len;
+ int key_exp_len;
+ int type;
+ int num_block;
+};
+
+static struct test_aes_s test_aes[] = {
+ { AES128_KEY_LENGTH, AES128_EXPAND_KEY_LENGTH, TEST_AES_ONE_BLOCK, 1 },
+ { AES128_KEY_LENGTH, AES128_EXPAND_KEY_LENGTH, TEST_AES_CBC_CHAIN, 16 },
+ { AES192_KEY_LENGTH, AES192_EXPAND_KEY_LENGTH, TEST_AES_ONE_BLOCK, 1 },
+ { AES192_KEY_LENGTH, AES192_EXPAND_KEY_LENGTH, TEST_AES_CBC_CHAIN, 16 },
+ { AES256_KEY_LENGTH, AES256_EXPAND_KEY_LENGTH, TEST_AES_ONE_BLOCK, 1 },
+ { AES256_KEY_LENGTH, AES256_EXPAND_KEY_LENGTH, TEST_AES_CBC_CHAIN, 16 },
+};
+
+static void rand_buf(u8 *buf, int size)
+{
+ int i;
+
+ for (i = 0; i < size; i++)
+ buf[i] = rand() & 0xff;
+}
+
+static int lib_test_aes_one_block(struct unit_test_state *uts, int key_len,
+ u8 *key_exp, u8 *iv, int num_block,
+ u8 *nocipher, u8 *ciphered, u8 *uncipher)
+{
+ aes_encrypt(key_len, nocipher, key_exp, ciphered);
+ aes_decrypt(key_len, ciphered, key_exp, uncipher);
+
+ ut_asserteq_mem(nocipher, uncipher, AES_BLOCK_LENGTH);
+
+ /* corrupt the expanded key */
+ key_exp[0]++;
+ aes_decrypt(key_len, ciphered, key_exp, uncipher);
+ ut_assertf(memcmp(nocipher, uncipher, AES_BLOCK_LENGTH),
+ "nocipher and uncipher should be different\n");
+
+ return 0;
+}
+
+static int lib_test_aes_cbc_chain(struct unit_test_state *uts, int key_len,
+ u8 *key_exp, u8 *iv, int num_block,
+ u8 *nocipher, u8 *ciphered, u8 *uncipher)
+{
+ aes_cbc_encrypt_blocks(key_len, key_exp, iv,
+ nocipher, ciphered, num_block);
+ aes_cbc_decrypt_blocks(key_len, key_exp, iv,
+ ciphered, uncipher, num_block);
+
+ ut_asserteq_mem(nocipher, uncipher, num_block * AES_BLOCK_LENGTH);
+
+ /* corrupt the expanded key */
+ key_exp[0]++;
+ aes_cbc_decrypt_blocks(key_len, key_exp, iv,
+ ciphered, uncipher, num_block);
+ ut_assertf(memcmp(nocipher, uncipher, num_block * AES_BLOCK_LENGTH),
+ "nocipher and uncipher should be different\n");
+
+ return 0;
+}
+
+static int _lib_test_aes_run(struct unit_test_state *uts, int key_len,
+ int key_exp_len, int type, int num_block)
+{
+ u8 *key, *key_exp, *iv;
+ u8 *nocipher, *ciphered, *uncipher;
+ int ret;
+
+ /* Allocate all the buffer */
+ key = malloc(key_len);
+ ut_assertnonnull(key);
+ key_exp = malloc(key_exp_len);
+ ut_assertnonnull(key_exp);
+ iv = malloc(AES_BLOCK_LENGTH);
+ ut_assertnonnull(iv);
+ nocipher = malloc(num_block * AES_BLOCK_LENGTH);
+ ut_assertnonnull(nocipher);
+ ciphered = malloc((num_block + 1) * AES_BLOCK_LENGTH);
+ ut_assertnonnull(ciphered);
+ uncipher = malloc((num_block + 1) * AES_BLOCK_LENGTH);
+ ut_assertnonnull(uncipher);
+
+ /* Initialize all buffer */
+ rand_buf(key, key_len);
+ rand_buf(iv, AES_BLOCK_LENGTH);
+ rand_buf(nocipher, num_block * AES_BLOCK_LENGTH);
+ memset(ciphered, 0, (num_block + 1) * AES_BLOCK_LENGTH);
+ memset(uncipher, 0, (num_block + 1) * AES_BLOCK_LENGTH);
+
+ /* Expand the key */
+ aes_expand_key(key, key_len, key_exp);
+
+ /* Encrypt and decrypt */
+ switch (type) {
+ case TEST_AES_ONE_BLOCK:
+ ret = lib_test_aes_one_block(uts, key_len, key_exp, iv,
+ num_block, nocipher,
+ ciphered, uncipher);
+ break;
+ case TEST_AES_CBC_CHAIN:
+ ret = lib_test_aes_cbc_chain(uts, key_len, key_exp, iv,
+ num_block, nocipher,
+ ciphered, uncipher);
+ break;
+ default:
+ printf("%s: unknown type (type=%d)\n", __func__, type);
+ ret = -1;
+ };
+
+ /* Free all the data */
+ free(key);
+ free(key_exp);
+ free(iv);
+ free(nocipher);
+ free(ciphered);
+ free(uncipher);
+
+ return ret;
+}
+
+static int lib_test_aes_run(struct unit_test_state *uts,
+ struct test_aes_s *test)
+{
+ int key_len = test->key_len;
+ int key_exp_len = test->key_exp_len;
+ int type = test->type;
+ int num_block = test->num_block;
+
+ return _lib_test_aes_run(uts, key_len, key_exp_len,
+ type, num_block);
+}
+
+static int lib_test_aes(struct unit_test_state *uts)
+{
+ int i, ret = 0;
+
+ for (i = 0; i < ARRAY_SIZE(test_aes); i++) {
+ ret = lib_test_aes_run(uts, &test_aes[i]);
+ if (ret)
+ break;
+ }
+
+ return ret;
+}
+
+LIB_TEST(lib_test_aes, 0);
FIT_OBJS-$(CONFIG_FIT) := fit_common.o fit_image.o image-host.o common/image-fit.o
FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o
+FIT_CIPHER_OBJS-$(CONFIG_FIT_CIPHER) := common/image-cipher.o
# The following files are synced with upstream DTC.
# Use synced versions from scripts/dtc/libfdt/.
rsa-sign.o rsa-verify.o rsa-checksum.o \
rsa-mod-exp.o)
+AES_OBJS-$(CONFIG_FIT_CIPHER) := $(addprefix lib/aes/, \
+ aes-encrypt.o aes-decrypt.o)
+
ROCKCHIP_OBS = lib/rc4.o rkcommon.o rkimage.o rksd.o rkspi.o
# common objs for dumpimage and mkimage
atmelimage.o \
$(FIT_OBJS-y) \
$(FIT_SIG_OBJS-y) \
+ $(FIT_CIPHER_OBJS-y) \
common/bootm.o \
lib/crc32.o \
default_image.o \
gpimage.o \
gpimage-common.o \
mtk_image.o \
- $(RSA_OBJS-y)
+ $(RSA_OBJS-y) \
+ $(AES_OBJS-y)
dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o
mkimage-objs := $(dumpimage-mkimage-objs) mkimage.o
HOST_EXTRACFLAGS += -DCONFIG_FIT_SIGNATURE_MAX_SIZE=$(CONFIG_FIT_SIGNATURE_MAX_SIZE)
endif
+ifdef CONFIG_FIT_CIPHER
+# This affects include/image.h, but including the board config file
+# is tricky, so manually define this options here.
+HOST_EXTRACFLAGS += -DCONFIG_FIT_CIPHER
+endif
+
ifdef CONFIG_SYS_U_BOOT_OFFS
HOSTCFLAGS_kwbimage.o += -DCONFIG_SYS_U_BOOT_OFFS=$(CONFIG_SYS_U_BOOT_OFFS)
endif
ret = fit_set_timestamp(ptr, 0, time);
}
+ if (!ret) {
+ ret = fit_cipher_data(params->keydir, dest_blob, ptr,
+ params->comment,
+ params->require_keys,
+ params->engine_id,
+ params->cmdname);
+ }
+
if (!ret) {
ret = fit_add_verification_data(params->keydir, dest_blob, ptr,
params->comment,
err_keydest:
munmap(ptr, sbuf.st_size);
close(tfd);
-
return ret;
}
return ret;
}
+static int copyfile(const char *src, const char *dst)
+{
+ int fd_src = -1, fd_dst = -1;
+ void *buf = NULL;
+ ssize_t size;
+ size_t count;
+ int ret = -1;
+
+ fd_src = open(src, O_RDONLY);
+ if (fd_src < 0) {
+ printf("Can't open file %s (%s)\n", src, strerror(errno));
+ goto out;
+ }
+
+ fd_dst = open(dst, O_WRONLY | O_CREAT, 0700);
+ if (fd_dst < 0) {
+ printf("Can't open file %s (%s)\n", dst, strerror(errno));
+ goto out;
+ }
+
+ buf = malloc(512);
+ if (!buf) {
+ printf("Can't allocate buffer to copy file\n");
+ goto out;
+ }
+
+ while (1) {
+ size = read(fd_src, buf, 512);
+ if (size < 0) {
+ printf("Can't read file %s\n", src);
+ goto out;
+ }
+ if (!size)
+ break;
+
+ count = size;
+ size = write(fd_dst, buf, count);
+ if (size < 0) {
+ printf("Can't write file %s\n", dst);
+ goto out;
+ }
+ }
+
+ ret = 0;
+
+ out:
+ if (fd_src >= 0)
+ close(fd_src);
+ if (fd_dst >= 0)
+ close(fd_dst);
+ if (buf)
+ free(buf);
+
+ return ret;
+}
+
/**
* fit_handle_file - main FIT file processing function
*
static int fit_handle_file(struct image_tool_params *params)
{
char tmpfile[MKIMAGE_MAX_TMPFILE_LEN];
+ char bakfile[MKIMAGE_MAX_TMPFILE_LEN + 4] = {0};
char cmd[MKIMAGE_MAX_DTC_CMDLINE_LEN];
size_t size_inc;
int ret;
snprintf(cmd, sizeof(cmd), "cp \"%s\" \"%s\"",
params->imagefile, tmpfile);
}
+
if (*cmd && system(cmd) == -1) {
fprintf (stderr, "%s: system(%s) failed: %s\n",
params->cmdname, cmd, strerror(errno));
if (ret)
goto err_system;
+ /*
+ * Copy the tmpfile to bakfile, then in the following loop
+ * we copy bakfile to tmpfile. So we always start from the
+ * beginning.
+ */
+ sprintf(bakfile, "%s%s", tmpfile, ".bak");
+ rename(tmpfile, bakfile);
+
/*
* Set hashes for images in the blob. Unfortunately we may need more
* space in either FDT, so keep trying until we succeed.
* steps of this loop is enough to sign with several keys.
*/
for (size_inc = 0; size_inc < 64 * 1024; size_inc += 1024) {
+ if (copyfile(bakfile, tmpfile) < 0) {
+ printf("Can't copy %s to %s\n", bakfile, tmpfile);
+ ret = -EIO;
+ break;
+ }
ret = fit_add_file_data(params, size_inc, tmpfile);
if (!ret || ret != -ENOSPC)
break;
params->cmdname, tmpfile, params->imagefile,
strerror (errno));
unlink (tmpfile);
+ unlink(bakfile);
unlink (params->imagefile);
return EXIT_FAILURE;
}
+ unlink(bakfile);
return EXIT_SUCCESS;
err_system:
unlink(tmpfile);
+ unlink(bakfile);
return -1;
}
#include <bootm.h>
#include <image.h>
#include <version.h>
+#include <uboot_aes.h>
/**
* fit_set_hash_value - set hash value in requested has node
return 0;
}
+static int fit_image_read_data(char *filename, unsigned char *data,
+ int expected_size)
+{
+ struct stat sbuf;
+ int fd, ret = -1;
+ ssize_t n;
+
+ /* Open file */
+ fd = open(filename, O_RDONLY | O_BINARY);
+ if (fd < 0) {
+ printf("Can't open file %s (err=%d => %s)\n",
+ filename, errno, strerror(errno));
+ return -1;
+ }
+
+ /* Compute file size */
+ if (fstat(fd, &sbuf) < 0) {
+ printf("Can't fstat file %s (err=%d => %s)\n",
+ filename, errno, strerror(errno));
+ goto err;
+ }
+
+ /* Check file size */
+ if (sbuf.st_size != expected_size) {
+ printf("File %s don't have the expected size (size=%ld, expected=%d)\n",
+ filename, sbuf.st_size, expected_size);
+ goto err;
+ }
+
+ /* Read data */
+ n = read(fd, data, sbuf.st_size);
+ if (n < 0) {
+ printf("Can't read file %s (err=%d => %s)\n",
+ filename, errno, strerror(errno));
+ goto err;
+ }
+
+ /* Check that we have read all the file */
+ if (n != sbuf.st_size) {
+ printf("Can't read all file %s (read %ld bytes, expexted %ld)\n",
+ filename, n, sbuf.st_size);
+ goto err;
+ }
+
+ ret = 0;
+
+err:
+ close(fd);
+ return ret;
+}
+
+static int fit_image_setup_cipher(struct image_cipher_info *info,
+ const char *keydir, void *fit,
+ const char *image_name, int image_noffset,
+ const char *node_name, int noffset)
+{
+ char *algo_name;
+ char filename[128];
+ int ret = -1;
+
+ if (fit_image_cipher_get_algo(fit, noffset, &algo_name)) {
+ printf("Can't get algo name for cipher '%s' in image '%s'\n",
+ node_name, image_name);
+ goto out;
+ }
+
+ info->keydir = keydir;
+
+ /* Read the key name */
+ info->keyname = fdt_getprop(fit, noffset, "key-name-hint", NULL);
+ if (!info->keyname) {
+ printf("Can't get key name for cipher '%s' in image '%s'\n",
+ node_name, image_name);
+ goto out;
+ }
+
+ /* Read the IV name */
+ info->ivname = fdt_getprop(fit, noffset, "iv-name-hint", NULL);
+ if (!info->ivname) {
+ printf("Can't get iv name for cipher '%s' in image '%s'\n",
+ node_name, image_name);
+ goto out;
+ }
+
+ info->fit = fit;
+ info->node_noffset = noffset;
+ info->name = algo_name;
+
+ info->cipher = image_get_cipher_algo(algo_name);
+ if (!info->cipher) {
+ printf("Can't get algo for cipher '%s'\n", image_name);
+ goto out;
+ }
+
+ /* Read the key in the file */
+ snprintf(filename, sizeof(filename), "%s/%s%s",
+ info->keydir, info->keyname, ".bin");
+ info->key = malloc(info->cipher->key_len);
+ if (!info->key) {
+ printf("Can't allocate memory for key\n");
+ ret = -1;
+ goto out;
+ }
+ ret = fit_image_read_data(filename, (unsigned char *)info->key,
+ info->cipher->key_len);
+ if (ret < 0)
+ goto out;
+
+ /* Read the IV in the file */
+ snprintf(filename, sizeof(filename), "%s/%s%s",
+ info->keydir, info->ivname, ".bin");
+ info->iv = malloc(info->cipher->iv_len);
+ if (!info->iv) {
+ printf("Can't allocate memory for iv\n");
+ ret = -1;
+ goto out;
+ }
+ ret = fit_image_read_data(filename, (unsigned char *)info->iv,
+ info->cipher->iv_len);
+
+ out:
+ return ret;
+}
+
+int fit_image_write_cipher(void *fit, int image_noffset, int noffset,
+ const void *data, size_t size,
+ unsigned char *data_ciphered, int data_ciphered_len)
+{
+ int ret = -1;
+
+ /* Remove unciphered data */
+ ret = fdt_delprop(fit, image_noffset, FIT_DATA_PROP);
+ if (ret) {
+ printf("Can't remove data (err = %d)\n", ret);
+ goto out;
+ }
+
+ /* Add ciphered data */
+ ret = fdt_setprop(fit, image_noffset, FIT_DATA_PROP,
+ data_ciphered, data_ciphered_len);
+ if (ret) {
+ printf("Can't add ciphered data (err = %d)\n", ret);
+ goto out;
+ }
+
+ /* add non ciphered data size */
+ ret = fdt_setprop_u32(fit, image_noffset, "data-size-unciphered", size);
+ if (ret) {
+ printf("Can't add unciphered data size (err = %d)\n", ret);
+ goto out;
+ }
+
+ out:
+ return ret;
+}
+
+static int
+fit_image_process_cipher(const char *keydir, void *keydest, void *fit,
+ const char *image_name, int image_noffset,
+ const char *node_name, int node_noffset,
+ const void *data, size_t size,
+ const char *cmdname)
+{
+ struct image_cipher_info info;
+ unsigned char *data_ciphered = NULL;
+ int data_ciphered_len;
+ int ret;
+
+ memset(&info, 0, sizeof(info));
+
+ ret = fit_image_setup_cipher(&info, keydir, fit, image_name,
+ image_noffset, node_name, node_noffset);
+ if (ret)
+ goto out;
+
+ ret = info.cipher->encrypt(&info, data, size,
+ &data_ciphered, &data_ciphered_len);
+ if (ret)
+ goto out;
+
+ /*
+ * Write the public key into the supplied FDT file; this might fail
+ * several times, since we try signing with successively increasing
+ * size values
+ */
+ if (keydest) {
+ ret = info.cipher->add_cipher_data(&info, keydest);
+ if (ret) {
+ printf("Failed to add verification data for cipher '%s' in image '%s'\n",
+ info.keyname, image_name);
+ goto out;
+ }
+ }
+
+ ret = fit_image_write_cipher(fit, image_noffset, node_noffset,
+ data, size,
+ data_ciphered, data_ciphered_len);
+
+ out:
+ free(data_ciphered);
+ free((void *)info.key);
+ free((void *)info.iv);
+ return ret;
+}
+
+int fit_image_cipher_data(const char *keydir, void *keydest,
+ void *fit, int image_noffset, const char *comment,
+ int require_keys, const char *engine_id,
+ const char *cmdname)
+{
+ const char *image_name;
+ const void *data;
+ size_t size;
+ int node_noffset;
+
+ /* Get image name */
+ image_name = fit_get_name(fit, image_noffset, NULL);
+ if (!image_name) {
+ printf("Can't get image name\n");
+ return -1;
+ }
+
+ /* Get image data and data length */
+ if (fit_image_get_data(fit, image_noffset, &data, &size)) {
+ printf("Can't get image data/size\n");
+ return -1;
+ }
+
+ /* Process all hash subnodes of the component image node */
+ for (node_noffset = fdt_first_subnode(fit, image_noffset);
+ node_noffset >= 0;
+ node_noffset = fdt_next_subnode(fit, node_noffset)) {
+ const char *node_name;
+ int ret = 0;
+
+ node_name = fit_get_name(fit, node_noffset, NULL);
+ if (!node_name) {
+ printf("Can't get node name\n");
+ return -1;
+ }
+
+ if (IMAGE_ENABLE_ENCRYPT && keydir &&
+ !strncmp(node_name, FIT_CIPHER_NODENAME,
+ strlen(FIT_CIPHER_NODENAME)))
+ ret = fit_image_process_cipher(keydir, keydest,
+ fit, image_name,
+ image_noffset,
+ node_name, node_noffset,
+ data, size, cmdname);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
/**
* fit_image_add_verification_data() - calculate/set verig. data for image node
*
return 0;
}
+int fit_cipher_data(const char *keydir, void *keydest, void *fit,
+ const char *comment, int require_keys,
+ const char *engine_id, const char *cmdname)
+{
+ int images_noffset;
+ int noffset;
+ int ret;
+
+ /* Find images parent node offset */
+ images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH);
+ if (images_noffset < 0) {
+ printf("Can't find images parent node '%s' (%s)\n",
+ FIT_IMAGES_PATH, fdt_strerror(images_noffset));
+ return images_noffset;
+ }
+
+ /* Process its subnodes, print out component images details */
+ for (noffset = fdt_first_subnode(fit, images_noffset);
+ noffset >= 0;
+ noffset = fdt_next_subnode(fit, noffset)) {
+ /*
+ * Direct child node of the images parent node,
+ * i.e. component image node.
+ */
+ ret = fit_image_cipher_data(keydir, keydest,
+ fit, noffset, comment,
+ require_keys, engine_id,
+ cmdname);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
int fit_add_verification_data(const char *keydir, void *keydest, void *fit,
const char *comment, int require_keys,
const char *engine_id, const char *cmdname)