summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/Makefile3
-rw-r--r--common/board_f.c10
-rw-r--r--common/board_r.c20
-rw-r--r--common/bootm.c23
-rw-r--r--common/cmd_blob.c109
-rw-r--r--common/cmd_bootm.c1
-rw-r--r--common/cmd_elf.c4
-rw-r--r--common/cmd_gpio.c59
-rw-r--r--common/cmd_sf.c26
-rw-r--r--common/cmd_spi.c39
-rw-r--r--common/console.c3
-rw-r--r--common/cros_ec.c30
-rw-r--r--common/env_nand.c4
-rw-r--r--common/env_sf.c1
-rw-r--r--common/exports.c4
-rw-r--r--common/image-fit.c26
-rw-r--r--common/image.c11
-rw-r--r--common/lcd.c4
-rw-r--r--common/menu.c5
-rw-r--r--common/modem.c13
-rw-r--r--common/stdio.c14
21 files changed, 313 insertions, 96 deletions
diff --git a/common/Makefile b/common/Makefile
index b19d379..6cc4de8 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -233,6 +233,7 @@ obj-$(CONFIG_SPL_ENV_SUPPORT) += env_flags.o
obj-$(CONFIG_SPL_ENV_SUPPORT) += env_callback.o
obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
+obj-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o
obj-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
obj-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o
obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
@@ -265,4 +266,6 @@ obj-y += aboot.o
obj-y += fb_mmc.o
endif
+obj-$(CONFIG_CMD_BLOB) += cmd_blob.o
+
CFLAGS_env_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null)
diff --git a/common/board_f.c b/common/board_f.c
index e6aa298..b5bebc9 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -128,14 +128,11 @@ int init_func_watchdog_reset(void)
}
#endif /* CONFIG_WATCHDOG */
-void __board_add_ram_info(int use_default)
+__weak void board_add_ram_info(int use_default)
{
/* please define platform specific board_add_ram_info() */
}
-void board_add_ram_info(int)
- __attribute__ ((weak, alias("__board_add_ram_info")));
-
static int init_baud_rate(void)
{
gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
@@ -221,7 +218,7 @@ static int show_dram_config(void)
return 0;
}
-void __dram_init_banksize(void)
+__weak void dram_init_banksize(void)
{
#if defined(CONFIG_NR_DRAM_BANKS) && defined(CONFIG_SYS_SDRAM_BASE)
gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
@@ -229,9 +226,6 @@ void __dram_init_banksize(void)
#endif
}
-void dram_init_banksize(void)
- __attribute__((weak, alias("__dram_init_banksize")));
-
#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
static int init_func_i2c(void)
{
diff --git a/common/board_r.c b/common/board_r.c
index 7e1a76d..7c33900 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -60,7 +60,7 @@ DECLARE_GLOBAL_DATA_PTR;
ulong monitor_flash_len;
-int __board_flash_wp_on(void)
+__weak int board_flash_wp_on(void)
{
/*
* Most flashes can't be detected when write protection is enabled,
@@ -70,16 +70,10 @@ int __board_flash_wp_on(void)
return 0;
}
-int board_flash_wp_on(void)
- __attribute__ ((weak, alias("__board_flash_wp_on")));
-
-void __cpu_secondary_init_r(void)
+__weak void cpu_secondary_init_r(void)
{
}
-void cpu_secondary_init_r(void)
- __attribute__ ((weak, alias("__cpu_secondary_init_r")));
-
static int initr_secondary_cpu(void)
{
/*
@@ -354,7 +348,7 @@ static int initr_flash(void)
}
#endif
-#ifdef CONFIG_PPC
+#if defined(CONFIG_PPC) && !defined(CONFIG_DM_SPI)
static int initr_spi(void)
{
/* PPC does this here */
@@ -370,7 +364,7 @@ static int initr_spi(void)
#ifdef CONFIG_CMD_NAND
/* go init the NAND */
-int initr_nand(void)
+static int initr_nand(void)
{
puts("NAND: ");
nand_init();
@@ -380,7 +374,7 @@ int initr_nand(void)
#if defined(CONFIG_CMD_ONENAND)
/* go init the NAND */
-int initr_onenand(void)
+static int initr_onenand(void)
{
puts("NAND: ");
onenand_init();
@@ -389,7 +383,7 @@ int initr_onenand(void)
#endif
#ifdef CONFIG_GENERIC_MMC
-int initr_mmc(void)
+static int initr_mmc(void)
{
puts("MMC: ");
mmc_initialize(gd->bd);
@@ -398,7 +392,7 @@ int initr_mmc(void)
#endif
#ifdef CONFIG_HAS_DATAFLASH
-int initr_dataflash(void)
+static int initr_dataflash(void)
{
AT91F_DataflashInit();
dataflash_print_info();
diff --git a/common/bootm.c b/common/bootm.c
index ff81a27..17ed389 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <bootstage.h>
#include <bzlib.h>
+#include <errno.h>
#include <fdt_support.h>
#include <lmb.h>
#include <malloc.h>
@@ -83,6 +84,7 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc,
{
const void *os_hdr;
bool ep_found = false;
+ int ret;
/* get kernel image header, start address and length */
os_hdr = boot_get_kernel(cmdtp, flag, argc, argv,
@@ -102,6 +104,7 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc,
images.os.end = image_get_image_end(os_hdr);
images.os.load = image_get_load(os_hdr);
+ images.os.arch = image_get_arch(os_hdr);
break;
#endif
#if defined(CONFIG_FIT)
@@ -129,6 +132,13 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc,
return 1;
}
+ if (fit_image_get_arch(images.fit_hdr_os,
+ images.fit_noffset_os,
+ &images.os.arch)) {
+ puts("Can't get image ARCH!\n");
+ return 1;
+ }
+
images.os.end = fit_get_end(images.fit_hdr_os);
if (fit_image_get_load(images.fit_hdr_os, images.fit_noffset_os,
@@ -156,8 +166,17 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc,
return 1;
}
- /* find kernel entry point */
- if (images.legacy_hdr_valid) {
+ /* If we have a valid setup.bin, we will use that for entry (x86) */
+ if (images.os.arch == IH_ARCH_I386) {
+ ulong len;
+
+ ret = boot_get_setup(&images, IH_ARCH_I386, &images.ep, &len);
+ if (ret < 0 && ret != -ENOENT) {
+ puts("Could not find a valid setup.bin for x86\n");
+ return 1;
+ }
+ /* Kernel entry point is the setup.bin */
+ } else if (images.legacy_hdr_valid) {
images.ep = image_get_ep(&images.legacy_hdr_os_copy);
#if defined(CONFIG_FIT)
} else if (images.fit_uname_os) {
diff --git a/common/cmd_blob.c b/common/cmd_blob.c
new file mode 100644
index 0000000..82ecaf0
--- /dev/null
+++ b/common/cmd_blob.c
@@ -0,0 +1,109 @@
+/*
+ *
+ * Command for encapsulating/decapsulating blob of memory.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <command.h>
+#include <environment.h>
+#include <malloc.h>
+#include <asm/byteorder.h>
+#include <linux/compiler.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/**
+ * blob_decap() - Decapsulate the data as a blob
+ * @key_mod: - Pointer to key modifier/key
+ * @src: - Address of data to be decapsulated
+ * @dst: - Address of data to be decapsulated
+ * @len: - Size of data to be decapsulated
+ *
+ * Returns zero on success,and negative on error.
+ */
+__weak int blob_decap(u8 *key_mod, u8 *src, u8 *dst, u32 len)
+{
+ return 0;
+}
+
+/**
+ * blob_encap() - Encapsulate the data as a blob
+ * @key_mod: - Pointer to key modifier/key
+ * @src: - Address of data to be encapsulated
+ * @dst: - Address of data to be encapsulated
+ * @len: - Size of data to be encapsulated
+ *
+ * Returns zero on success,and negative on error.
+ */
+__weak int blob_encap(u8 *key_mod, u8 *src, u8 *dst, u32 len)
+{
+ return 0;
+}
+
+/**
+ * do_blob() - Handle the "blob" command-line command
+ * @cmdtp: Command data struct pointer
+ * @flag: Command flag
+ * @argc: Command-line argument count
+ * @argv: Array of command-line arguments
+ *
+ * Returns zero on success, CMD_RET_USAGE in case of misuse and negative
+ * on error.
+ */
+static int do_blob(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+ uint32_t key_addr, src_addr, dst_addr, len;
+ uint8_t *km_ptr, *src_ptr, *dst_ptr;
+ int enc, ret = 0;
+
+ if (argc != 6)
+ return CMD_RET_USAGE;
+
+ if (!strncmp(argv[1], "enc", 3))
+ enc = 1;
+ else if (!strncmp(argv[1], "dec", 3))
+ enc = 0;
+ else
+ return CMD_RET_USAGE;
+
+ src_addr = simple_strtoul(argv[2], NULL, 16);
+ dst_addr = simple_strtoul(argv[3], NULL, 16);
+ len = simple_strtoul(argv[4], NULL, 16);
+ key_addr = simple_strtoul(argv[5], NULL, 16);
+
+ km_ptr = (uint8_t *)key_addr;
+ src_ptr = (uint8_t *)src_addr;
+ dst_ptr = (uint8_t *)dst_addr;
+
+ if (enc)
+ ret = blob_encap(km_ptr, src_ptr, dst_ptr, len);
+ else
+ ret = blob_decap(km_ptr, src_ptr, dst_ptr, len);
+
+ return ret;
+}
+
+/***************************************************/
+static char blob_help_text[] =
+ "enc src dst len km - Encapsulate and create blob of data\n"
+ " $len bytes long at address $src and\n"
+ " store the result at address $dst.\n"
+ " $km is the 16 byte key modifier\n"
+ " is also required for generation/use as\n"
+ " key for cryptographic operation. Key\n"
+ " modifier should be 16 byte long.\n"
+ "blob dec src dst len km - Decapsulate the blob of data at address\n"
+ " $src and store result of $len byte at\n"
+ " addr $dst.\n"
+ " $km is the 16 byte key modifier\n"
+ " is also required for generation/use as\n"
+ " key for cryptographic operation. Key\n"
+ " modifier should be 16 byte long.\n";
+
+U_BOOT_CMD(
+ blob, 6, 1, do_blob,
+ "Blob encapsulation/decryption",
+ blob_help_text
+);
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 843ec6e..6723360 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -12,6 +12,7 @@
#include <bootm.h>
#include <command.h>
#include <environment.h>
+#include <errno.h>
#include <image.h>
#include <lmb.h>
#include <malloc.h>
diff --git a/common/cmd_elf.c b/common/cmd_elf.c
index ab9c7e3..42a5296 100644
--- a/common/cmd_elf.c
+++ b/common/cmd_elf.c
@@ -14,6 +14,7 @@
*/
#include <common.h>
+#include <bootm.h>
#include <command.h>
#include <linux/ctype.h>
#include <net.h>
@@ -28,8 +29,7 @@ static unsigned long load_elf_image_phdr(unsigned long addr);
static unsigned long load_elf_image_shdr(unsigned long addr);
/* Allow ports to override the default behavior */
-__attribute__((weak))
-unsigned long do_bootelf_exec(ulong (*entry)(int, char * const[]),
+static unsigned long do_bootelf_exec(ulong (*entry)(int, char * const[]),
int argc, char * const argv[])
{
unsigned long ret;
diff --git a/common/cmd_gpio.c b/common/cmd_gpio.c
index 11f4e40..65d6df4 100644
--- a/common/cmd_gpio.c
+++ b/common/cmd_gpio.c
@@ -12,7 +12,7 @@
#include <dm.h>
#include <asm/gpio.h>
-int __weak name_to_gpio(const char *name)
+__weak int name_to_gpio(const char *name)
{
return simple_strtoul(name, NULL, 10);
}
@@ -25,13 +25,6 @@ enum gpio_cmd {
};
#if defined(CONFIG_DM_GPIO) && !defined(gpio_status)
-static const char * const gpio_function[GPIOF_COUNT] = {
- "input",
- "output",
- "unused",
- "unknown",
- "func",
-};
/* A few flags used by show_gpio() */
enum {
@@ -40,22 +33,16 @@ enum {
FLAG_SHOW_NEWLINE = 1 << 2,
};
-static void show_gpio(struct udevice *dev, const char *bank_name, int offset,
- int *flagsp)
+static void gpio_get_description(struct udevice *dev, const char *bank_name,
+ int offset, int *flagsp)
{
- struct dm_gpio_ops *ops = gpio_get_ops(dev);
- int func = GPIOF_UNKNOWN;
char buf[80];
int ret;
- BUILD_BUG_ON(GPIOF_COUNT != ARRAY_SIZE(gpio_function));
-
- if (ops->get_function) {
- ret = ops->get_function(dev, offset);
- if (ret >= 0 && ret < ARRAY_SIZE(gpio_function))
- func = ret;
- }
- if (!(*flagsp & FLAG_SHOW_ALL) && func == GPIOF_UNUSED)
+ ret = gpio_get_function(dev, offset, NULL);
+ if (ret < 0)
+ goto err;
+ if (!(*flagsp & FLAG_SHOW_ALL) && ret == GPIOF_UNUSED)
return;
if ((*flagsp & FLAG_SHOW_BANK) && bank_name) {
if (*flagsp & FLAG_SHOW_NEWLINE) {
@@ -65,20 +52,15 @@ static void show_gpio(struct udevice *dev, const char *bank_name, int offset,
printf("Bank %s:\n", bank_name);
*flagsp &= ~FLAG_SHOW_BANK;
}
- *buf = '\0';
- if (ops->get_state) {
- ret = ops->get_state(dev, offset, buf, sizeof(buf));
- if (ret) {
- puts("<unknown>");
- return;
- }
- } else {
- sprintf(buf, "%s%u: %8s %d", bank_name, offset,
- gpio_function[func], ops->get_value(dev, offset));
- }
- puts(buf);
- puts("\n");
+ ret = gpio_get_status(dev, offset, buf, sizeof(buf));
+ if (ret)
+ goto err;
+
+ printf("%s\n", buf);
+ return;
+err:
+ printf("Error %d\n", ret);
}
static int do_gpio_status(bool all, const char *gpio_name)
@@ -101,8 +83,10 @@ static int do_gpio_status(bool all, const char *gpio_name)
if (all)
flags |= FLAG_SHOW_ALL;
bank_name = gpio_get_bank_info(dev, &num_bits);
- if (!num_bits)
+ if (!num_bits) {
+ debug("GPIO device %s has no bits\n", dev->name);
continue;
+ }
banklen = bank_name ? strlen(bank_name) : 0;
if (!gpio_name || !bank_name ||
@@ -113,11 +97,12 @@ static int do_gpio_status(bool all, const char *gpio_name)
p = gpio_name + banklen;
if (gpio_name && *p) {
offset = simple_strtoul(p, NULL, 10);
- show_gpio(dev, bank_name, offset, &flags);
+ gpio_get_description(dev, bank_name, offset,
+ &flags);
} else {
for (offset = 0; offset < num_bits; offset++) {
- show_gpio(dev, bank_name, offset,
- &flags);
+ gpio_get_description(dev, bank_name,
+ offset, &flags);
}
}
}
diff --git a/common/cmd_sf.c b/common/cmd_sf.c
index c60e8d1..95a6f89 100644
--- a/common/cmd_sf.c
+++ b/common/cmd_sf.c
@@ -8,10 +8,13 @@
#include <common.h>
#include <div64.h>
+#include <dm.h>
#include <malloc.h>
+#include <spi.h>
#include <spi_flash.h>
#include <asm/io.h>
+#include <dm/device-internal.h>
static struct spi_flash *flash;
@@ -80,7 +83,12 @@ static int do_spi_flash_probe(int argc, char * const argv[])
unsigned int speed = CONFIG_SF_DEFAULT_SPEED;
unsigned int mode = CONFIG_SF_DEFAULT_MODE;
char *endp;
+#ifdef CONFIG_DM_SPI_FLASH
+ struct udevice *new, *bus_dev;
+ int ret;
+#else
struct spi_flash *new;
+#endif
if (argc >= 2) {
cs = simple_strtoul(argv[1], &endp, 0);
@@ -108,6 +116,23 @@ static int do_spi_flash_probe(int argc, char * const argv[])
return -1;
}
+#ifdef CONFIG_DM_SPI_FLASH
+ /* Remove the old device, otherwise probe will just be a nop */
+ ret = spi_find_bus_and_cs(bus, cs, &bus_dev, &new);
+ if (!ret) {
+ device_remove(new);
+ device_unbind(new);
+ }
+ flash = NULL;
+ ret = spi_flash_probe_bus_cs(bus, cs, speed, mode, &new);
+ if (ret) {
+ printf("Failed to initialize SPI flash at %u:%u (error %d)\n",
+ bus, cs, ret);
+ return 1;
+ }
+
+ flash = new->uclass_priv;
+#else
new = spi_flash_probe(bus, cs, speed, mode);
if (!new) {
printf("Failed to initialize SPI flash at %u:%u\n", bus, cs);
@@ -117,6 +142,7 @@ static int do_spi_flash_probe(int argc, char * const argv[])
if (flash)
spi_flash_free(flash);
flash = new;
+#endif
return 0;
}
diff --git a/common/cmd_spi.c b/common/cmd_spi.c
index be5709c..64c3ffc 100644
--- a/common/cmd_spi.c
+++ b/common/cmd_spi.c
@@ -11,6 +11,7 @@
#include <common.h>
#include <command.h>
+#include <dm.h>
#include <errno.h>
#include <spi.h>
@@ -42,19 +43,38 @@ static uchar din[MAX_SPI_BYTES];
static int do_spi_xfer(int bus, int cs)
{
struct spi_slave *slave;
- int rcode = 0;
-
+ int ret = 0;
+
+#ifdef CONFIG_DM_SPI
+ char name[30], *str;
+ struct udevice *dev;
+
+ snprintf(name, sizeof(name), "generic_%d:%d", bus, cs);
+ str = strdup(name);
+ ret = spi_get_bus_and_cs(bus, cs, 1000000, mode, "spi_generic_drv",
+ str, &dev, &slave);
+ if (ret)
+ return ret;
+#else
slave = spi_setup_slave(bus, cs, 1000000, mode);
if (!slave) {
printf("Invalid device %d:%d\n", bus, cs);
return -EINVAL;
}
+#endif
- spi_claim_bus(slave);
- if (spi_xfer(slave, bitlen, dout, din,
- SPI_XFER_BEGIN | SPI_XFER_END) != 0) {
- printf("Error during SPI transaction\n");
- rcode = -EIO;
+ ret = spi_claim_bus(slave);
+ if (ret)
+ goto done;
+ ret = spi_xfer(slave, bitlen, dout, din,
+ SPI_XFER_BEGIN | SPI_XFER_END);
+#ifndef CONFIG_DM_SPI
+ /* We don't get an error code in this case */
+ if (ret)
+ ret = -EIO;
+#endif
+ if (ret) {
+ printf("Error %d during SPI transaction\n", ret);
} else {
int j;
@@ -62,10 +82,13 @@ static int do_spi_xfer(int bus, int cs)
printf("%02X", din[j]);
printf("\n");
}
+done:
spi_release_bus(slave);
+#ifndef CONFIG_DM_SPI
spi_free_slave(slave);
+#endif
- return rcode;
+ return ret;
}
/*
diff --git a/common/console.c b/common/console.c
index 5a2f411..4695386 100644
--- a/common/console.c
+++ b/common/console.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <stdarg.h>
+#include <iomux.h>
#include <malloc.h>
#include <os.h>
#include <serial.h>
@@ -621,7 +622,7 @@ inline void dbg(const char *fmt, ...)
}
#else
-inline void dbg(const char *fmt, ...)
+static inline void dbg(const char *fmt, ...)
{
}
#endif
diff --git a/common/cros_ec.c b/common/cros_ec.c
index b8ce1b5..bb299bc 100644
--- a/common/cros_ec.c
+++ b/common/cros_ec.c
@@ -10,25 +10,44 @@
#include <common.h>
#include <cros_ec.h>
+#include <dm.h>
+#include <errno.h>
+
DECLARE_GLOBAL_DATA_PTR;
+#ifndef CONFIG_DM_CROS_EC
struct local_info {
struct cros_ec_dev *cros_ec_dev; /* Pointer to cros_ec device */
int cros_ec_err; /* Error for cros_ec, 0 if ok */
};
static struct local_info local;
+#endif
struct cros_ec_dev *board_get_cros_ec_dev(void)
{
+#ifdef CONFIG_DM_CROS_EC
+ struct udevice *dev;
+ int ret;
+
+ ret = uclass_get_device(UCLASS_CROS_EC, 0, &dev);
+ if (ret) {
+ debug("%s: Error %d\n", __func__, ret);
+ return NULL;
+ }
+ return dev->uclass_priv;
+#else
return local.cros_ec_dev;
+#endif
}
static int board_init_cros_ec_devices(const void *blob)
{
+#ifndef CONFIG_DM_CROS_EC
local.cros_ec_err = cros_ec_init(blob, &local.cros_ec_dev);
if (local.cros_ec_err)
return -1; /* Will report in board_late_init() */
+#endif
return 0;
}
@@ -40,5 +59,16 @@ int cros_ec_board_init(void)
int cros_ec_get_error(void)
{
+#ifdef CONFIG_DM_CROS_EC
+ struct udevice *dev;
+ int ret;
+
+ ret = uclass_get_device(UCLASS_CROS_EC, 0, &dev);
+ if (ret && ret != -ENODEV)
+ return ret;
+
+ return 0;
+#else
return local.cros_ec_err;
+#endif
}
diff --git a/common/env_nand.c b/common/env_nand.c
index 5a734a9..749605f 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -124,7 +124,7 @@ int env_init(void)
* The legacy NAND code saved the environment in the first NAND device i.e.,
* nand_dev_desc + 0. This is also the behaviour using the new NAND code.
*/
-int writeenv(size_t offset, u_char *buf)
+static int writeenv(size_t offset, u_char *buf)
{
size_t end = offset + CONFIG_ENV_RANGE;
size_t amount_saved = 0;
@@ -233,7 +233,7 @@ int saveenv(void)
}
#endif /* CMD_SAVEENV */
-int readenv(size_t offset, u_char *buf)
+static int readenv(size_t offset, u_char *buf)
{
size_t end = offset + CONFIG_ENV_RANGE;
size_t amount_loaded = 0;
diff --git a/common/env_sf.c b/common/env_sf.c
index 37ab13a..5e3729c 100644
--- a/common/env_sf.c
+++ b/common/env_sf.c
@@ -12,6 +12,7 @@
#include <common.h>
#include <environment.h>
#include <malloc.h>
+#include <spi.h>
#include <spi_flash.h>
#include <search.h>
#include <errno.h>
diff --git a/common/exports.c b/common/exports.c
index b97ca48..88fcfc8 100644
--- a/common/exports.c
+++ b/common/exports.c
@@ -27,10 +27,12 @@ unsigned long get_version(void)
# define i2c_write dummy
# define i2c_read dummy
#endif
-#ifndef CONFIG_CMD_SPI
+#if !defined(CONFIG_CMD_SPI) || defined(CONFIG_DM_SPI)
# define spi_init dummy
# define spi_setup_slave dummy
# define spi_free_slave dummy
+#endif
+#ifndef CONFIG_CMD_SPI
# define spi_claim_bus dummy
# define spi_release_bus dummy
# define spi_xfer dummy
diff --git a/common/image-fit.c b/common/image-fit.c
index 255c4ca..a272ea2 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1434,7 +1434,7 @@ void fit_conf_print(const void *fit, int noffset, const char *p)
printf("%s FDT: %s\n", p, uname);
}
-int fit_image_select(const void *fit, int rd_noffset, int verify)
+static int fit_image_select(const void *fit, int rd_noffset, int verify)
{
fit_image_print(fit, rd_noffset, " ");
@@ -1497,6 +1497,8 @@ static const char *fit_get_image_type_property(int type)
return FIT_KERNEL_PROP;
case IH_TYPE_RAMDISK:
return FIT_RAMDISK_PROP;
+ case IH_TYPE_X86_SETUP:
+ return FIT_SETUP_PROP;
}
return "unknown";
@@ -1591,7 +1593,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
}
bootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ARCH);
-#ifndef USE_HOSTCC
+#if !defined(USE_HOSTCC) && !defined(CONFIG_SANDBOX)
if (!fit_image_check_target_arch(fit, noffset)) {
puts("Unsupported Architecture\n");
bootstage_error(bootstage_id + BOOTSTAGE_SUB_CHECK_ARCH);
@@ -1693,3 +1695,23 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
return noffset;
}
+
+int boot_get_setup_fit(bootm_headers_t *images, uint8_t arch,
+ ulong *setup_start, ulong *setup_len)
+{
+ int noffset;
+ ulong addr;
+ ulong len;
+ int ret;
+
+ addr = map_to_sysmem(images->fit_hdr_os);
+ noffset = fit_get_node_from_config(images, FIT_SETUP_PROP, addr);
+ if (noffset < 0)
+ return noffset;
+
+ ret = fit_image_load(images, addr, NULL, NULL, arch,
+ IH_TYPE_X86_SETUP, BOOTSTAGE_ID_FIT_SETUP_START,
+ FIT_LOAD_REQUIRED, setup_start, &len);
+
+ return ret;
+}
diff --git a/common/image.c b/common/image.c
index 085771c..640e83b 100644
--- a/common/image.c
+++ b/common/image.c
@@ -143,6 +143,7 @@ static const table_entry_t uimage_type[] = {
{ IH_TYPE_UBLIMAGE, "ublimage", "Davinci UBL image",},
{ IH_TYPE_MXSIMAGE, "mxsimage", "Freescale MXS Boot Image",},
{ IH_TYPE_ATMELIMAGE, "atmelimage", "ATMEL ROM-Boot Image",},
+ { IH_TYPE_X86_SETUP, "x86_setup", "x86 setup.bin", },
{ -1, "", "", },
};
@@ -1136,6 +1137,16 @@ error:
}
#endif /* CONFIG_SYS_BOOT_RAMDISK_HIGH */
+int boot_get_setup(bootm_headers_t *images, uint8_t arch,
+ ulong *setup_start, ulong *setup_len)
+{
+#if defined(CONFIG_FIT)
+ return boot_get_setup_fit(images, arch, setup_start, setup_len);
+#else
+ return -ENOENT;
+#endif
+}
+
#ifdef CONFIG_SYS_BOOT_GET_CMDLINE
/**
* boot_get_cmdline - allocate and initialize kernel cmdline
diff --git a/common/lcd.c b/common/lcd.c
index 217ec9d..689d30e 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -1023,7 +1023,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
switch (bmp_bpix) {
case 1: /* pass through */
- case 8:
+ case 8: {
#ifdef CONFIG_LCD_BMP_RLE8
u32 compression = get_unaligned_le32(&bmp->header.compression);
if (compression == BMP_BI_RLE8) {
@@ -1056,7 +1056,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
fb -= byte_width + lcd_line_length;
}
break;
-
+ }
#if defined(CONFIG_BMP_16BPP)
case 16:
for (i = 0; i < height; ++i) {
diff --git a/common/menu.c b/common/menu.c
index 94afeb2..e81c074 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -105,12 +105,9 @@ static inline void *menu_item_destroy(struct menu *m,
return NULL;
}
-void __menu_display_statusline(struct menu *m)
+__weak void menu_display_statusline(struct menu *m)
{
- return;
}
-void menu_display_statusline(struct menu *m)
- __attribute__ ((weak, alias("__menu_display_statusline")));
/*
* Display a menu so the user can make a choice of an item. First display its
diff --git a/common/modem.c b/common/modem.c
index be54b10..96b1064 100644
--- a/common/modem.c
+++ b/common/modem.c
@@ -19,7 +19,7 @@ static inline void mdm_readline(char *buf, int bufsiz)
for(;;) {
c = serial_getc();
- /* dbg("(%c)", c); */
+ debug("(%c)", c);
switch(c) {
case '\r':
@@ -40,7 +40,6 @@ static inline void mdm_readline(char *buf, int bufsiz)
}
}
-extern void dbg(const char *fmt, ...);
int mdm_init (void)
{
char env_str[16];
@@ -66,15 +65,15 @@ int mdm_init (void)
serial_puts("\n");
for(;;) {
mdm_readline(console_buffer, CONFIG_SYS_CBSIZE);
- dbg("ini%d: [%s]", i, console_buffer);
+ debug("ini%d: [%s]", i, console_buffer);
if ((strcmp(console_buffer, "OK") == 0) ||
(strcmp(console_buffer, "ERROR") == 0)) {
- dbg("ini%d: cmd done", i);
+ debug("ini%d: cmd done", i);
break;
} else /* in case we are originating call ... */
if (strncmp(console_buffer, "CONNECT", 7) == 0) {
- dbg("ini%d: connect", i);
+ debug("ini%d: connect", i);
return 0;
}
}
@@ -90,9 +89,9 @@ int mdm_init (void)
for(;i > 1;) { /* if 'i' > 1 - wait for connection
message from modem */
mdm_readline(console_buffer, CONFIG_SYS_CBSIZE);
- dbg("ini_f: [%s]", console_buffer);
+ debug("ini_f: [%s]", console_buffer);
if (strncmp(console_buffer, "CONNECT", 7) == 0) {
- dbg("ini_f: connected");
+ debug("ini_f: connected");
return 0;
}
}
diff --git a/common/stdio.c b/common/stdio.c
index 8232815..68c595d 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -39,39 +39,39 @@ char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" };
#endif
#ifdef CONFIG_SYS_DEVICE_NULLDEV
-void nulldev_putc(struct stdio_dev *dev, const char c)
+static void nulldev_putc(struct stdio_dev *dev, const char c)
{
/* nulldev is empty! */
}
-void nulldev_puts(struct stdio_dev *dev, const char *s)
+static void nulldev_puts(struct stdio_dev *dev, const char *s)
{
/* nulldev is empty! */
}
-int nulldev_input(struct stdio_dev *dev)
+static int nulldev_input(struct stdio_dev *dev)
{
/* nulldev is empty! */
return 0;
}
#endif
-void stdio_serial_putc(struct stdio_dev *dev, const char c)
+static void stdio_serial_putc(struct stdio_dev *dev, const char c)
{
serial_putc(c);
}
-void stdio_serial_puts(struct stdio_dev *dev, const char *s)
+static void stdio_serial_puts(struct stdio_dev *dev, const char *s)
{
serial_puts(s);
}
-int stdio_serial_getc(struct stdio_dev *dev)
+static int stdio_serial_getc(struct stdio_dev *dev)
{
return serial_getc();
}
-int stdio_serial_tstc(struct stdio_dev *dev)
+static int stdio_serial_tstc(struct stdio_dev *dev)
{
return serial_tstc();
}