diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/avb_verify.h | 96 | ||||
-rw-r--r-- | include/blk.h | 2 | ||||
-rw-r--r-- | include/common.h | 8 | ||||
-rw-r--r-- | include/configs/UCP1020.h | 2 | ||||
-rw-r--r-- | include/configs/da850evm.h | 2 | ||||
-rw-r--r-- | include/configs/dragonboard410c.h | 1 | ||||
-rw-r--r-- | include/configs/meson-gx-common.h | 7 | ||||
-rw-r--r-- | include/configs/vme8349.h | 3 | ||||
-rw-r--r-- | include/environment/ti/boot.h | 26 | ||||
-rw-r--r-- | include/image.h | 5 | ||||
-rw-r--r-- | include/iotrace.h | 33 | ||||
-rw-r--r-- | include/log.h | 3 |
12 files changed, 173 insertions, 15 deletions
diff --git a/include/avb_verify.h b/include/avb_verify.h new file mode 100644 index 0000000000..eaa60f5393 --- /dev/null +++ b/include/avb_verify.h @@ -0,0 +1,96 @@ + +/* + * (C) Copyright 2018, Linaro Limited + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef _AVB_VERIFY_H +#define _AVB_VERIFY_H + +#include <../lib/libavb/libavb.h> +#include <mmc.h> + +#define AVB_MAX_ARGS 1024 +#define VERITY_TABLE_OPT_RESTART "restart_on_corruption" +#define VERITY_TABLE_OPT_LOGGING "ignore_corruption" +#define ALLOWED_BUF_ALIGN 8 + +enum avb_boot_state { + AVB_GREEN, + AVB_YELLOW, + AVB_ORANGE, + AVB_RED, +}; + +struct AvbOpsData { + struct AvbOps ops; + int mmc_dev; + enum avb_boot_state boot_state; +}; + +struct mmc_part { + int dev_num; + struct mmc *mmc; + struct blk_desc *mmc_blk; + disk_partition_t info; +}; + +enum mmc_io_type { + IO_READ, + IO_WRITE +}; + +AvbOps *avb_ops_alloc(int boot_device); +void avb_ops_free(AvbOps *ops); + +char *avb_set_state(AvbOps *ops, enum avb_boot_state boot_state); +char *avb_set_enforce_verity(const char *cmdline); +char *avb_set_ignore_corruption(const char *cmdline); + +char *append_cmd_line(char *cmdline_orig, char *cmdline_new); + +/** + * ============================================================================ + * I/O helper inline functions + * ============================================================================ + */ +static inline uint64_t calc_offset(struct mmc_part *part, int64_t offset) +{ + u64 part_size = part->info.size * part->info.blksz; + + if (offset < 0) + return part_size + offset; + + return offset; +} + +static inline size_t get_sector_buf_size(void) +{ + return (size_t)CONFIG_FASTBOOT_BUF_SIZE; +} + +static inline void *get_sector_buf(void) +{ + return (void *)CONFIG_FASTBOOT_BUF_ADDR; +} + +static inline bool is_buf_unaligned(void *buffer) +{ + return (bool)((uintptr_t)buffer % ALLOWED_BUF_ALIGN); +} + +static inline int get_boot_device(AvbOps *ops) +{ + struct AvbOpsData *data; + + if (ops) { + data = ops->user_data; + if (data) + return data->mmc_dev; + } + + return -1; +} + +#endif /* _AVB_VERIFY_H */ diff --git a/include/blk.h b/include/blk.h index fc0c239e46..86f6d5057f 100644 --- a/include/blk.h +++ b/include/blk.h @@ -111,7 +111,7 @@ struct blk_desc { #define PAD_TO_BLOCKSIZE(size, blk_desc) \ (PAD_SIZE(size, blk_desc->blksz)) -#ifdef CONFIG_BLOCK_CACHE +#if CONFIG_IS_ENABLED(BLOCK_CACHE) /** * blkcache_read() - attempt to read a set of blocks from cache * diff --git a/include/common.h b/include/common.h index 60c79137e2..940161f175 100644 --- a/include/common.h +++ b/include/common.h @@ -536,10 +536,10 @@ void show_activity(int arg); /* Multicore arch functions */ #ifdef CONFIG_MP -int cpu_status(int nr); -int cpu_reset(int nr); -int cpu_disable(int nr); -int cpu_release(int nr, int argc, char * const argv[]); +int cpu_status(u32 nr); +int cpu_reset(u32 nr); +int cpu_disable(u32 nr); +int cpu_release(u32 nr, int argc, char * const argv[]); #endif #else /* __ASSEMBLY__ */ diff --git a/include/configs/UCP1020.h b/include/configs/UCP1020.h index 6231a1e4ae..b5ff5d3fe1 100644 --- a/include/configs/UCP1020.h +++ b/include/configs/UCP1020.h @@ -70,8 +70,6 @@ #define CONFIG_NETMASK 255.255.255.0 #define CONFIG_ETHPRIME "eTSEC1" -#ifndef CONFIG_SPI_FLASH -#endif #define CONFIG_SYS_REDUNDAND_ENVIRONMENT #define CONFIG_SYS_L2_SIZE (256 << 10) diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h index d2cd440311..ebfdd1c7a3 100644 --- a/include/configs/da850evm.h +++ b/include/configs/da850evm.h @@ -40,7 +40,6 @@ #ifdef CONFIG_DIRECT_NOR_BOOT #define CONFIG_ARCH_CPU_INIT -#define CONFIG_DA8XX_GPIO #define CONFIG_SYS_DV_NOR_BOOT_CFG (0x11) #endif @@ -227,6 +226,7 @@ #define CONFIG_MTD_PARTITIONS /* required for UBI partition support */ #endif +#define CONFIG_DA8XX_GPIO /* * U-Boot general configuration */ diff --git a/include/configs/dragonboard410c.h b/include/configs/dragonboard410c.h index 86fa735470..46a7179f1b 100644 --- a/include/configs/dragonboard410c.h +++ b/include/configs/dragonboard410c.h @@ -94,6 +94,7 @@ REFLASH(dragonboard/u-boot.img, 8)\ #define CONFIG_ENV_SIZE 0x2000 #define CONFIG_SYS_MMC_ENV_DEV 0 /* mmc0 = emmc, mmc1 = sd */ +#define CONFIG_SYS_MMC_ENV_PART 2 /* Set env partition to BOOT2 partition */ /* Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + SZ_8M) diff --git a/include/configs/meson-gx-common.h b/include/configs/meson-gx-common.h index 6e61b704a3..7435f3475e 100644 --- a/include/configs/meson-gx-common.h +++ b/include/configs/meson-gx-common.h @@ -23,10 +23,17 @@ #define GICD_BASE 0xc4301000 #define GICC_BASE 0xc4302000 +#ifdef CONFIG_CMD_USB +#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) +#else +#define BOOT_TARGET_DEVICES_USB(func) +#endif + #define BOOT_TARGET_DEVICES(func) \ func(MMC, mmc, 0) \ func(MMC, mmc, 1) \ func(MMC, mmc, 2) \ + BOOT_TARGET_DEVICES_USB(func) \ func(PXE, pxe, na) \ func(DHCP, dhcp, na) diff --git a/include/configs/vme8349.h b/include/configs/vme8349.h index 0d8ae0b099..2456475f27 100644 --- a/include/configs/vme8349.h +++ b/include/configs/vme8349.h @@ -257,9 +257,6 @@ #undef PCI_ONE_PCI1 #endif -#ifndef VME_CADDY2 -#endif - #undef CONFIG_EEPRO100 #undef CONFIG_TULIP diff --git a/include/environment/ti/boot.h b/include/environment/ti/boot.h index a43b211df5..2893cd4287 100644 --- a/include/environment/ti/boot.h +++ b/include/environment/ti/boot.h @@ -13,6 +13,16 @@ #define CONSOLEDEV "ttyO2" #endif +#define VBMETA_PART_SIZE (64 * 1024) + +#if defined(CONFIG_LIBAVB) +#define VBMETA_PART \ + "name=vbmeta,size=" __stringify(VBMETA_PART_SIZE) \ + ",uuid=${uuid_gpt_vbmeta};" +#else +#define VBMETA_PART "" +#endif + #ifndef PARTS_DEFAULT /* Define the default GPT table for eMMC */ #define PARTS_DEFAULT \ @@ -37,9 +47,23 @@ "name=cache,size=256M,uuid=${uuid_gpt_cache};" \ "name=ipu1,size=1M,uuid=${uuid_gpt_ipu1};" \ "name=ipu2,size=1M,uuid=${uuid_gpt_ipu2};" \ + VBMETA_PART \ "name=userdata,size=-,uuid=${uuid_gpt_userdata}" #endif /* PARTS_DEFAULT */ +#if defined(CONFIG_CMD_AVB) +#define AVB_VERIFY_CHECK "if run avb_verify; then " \ + "echo AVB verification OK.;" \ + "set bootargs $bootargs $avb_bootargs;" \ + "else " \ + "echo AVB verification failed.;" \ + "exit; fi;" +#define AVB_VERIFY_CMD "avb_verify=avb init 1; avb verify;\0" +#else +#define AVB_VERIFY_CHECK "" +#define AVB_VERIFY_CMD "" +#endif + #define DEFAULT_COMMON_BOOT_TI_ARGS \ "console=" CONSOLEDEV ",115200n8\0" \ "fdtfile=undefined\0" \ @@ -48,6 +72,7 @@ "bootfile=zImage\0" \ "usbtty=cdc_acm\0" \ "vram=16M\0" \ + AVB_VERIFY_CMD \ "partitions=" PARTS_DEFAULT "\0" \ "optargs=\0" \ "dofastboot=0\0" \ @@ -66,6 +91,7 @@ "setenv machid fe6; " \ "mmc dev $mmcdev; " \ "mmc rescan; " \ + AVB_VERIFY_CHECK \ "part start mmc ${mmcdev} environment fdt_start; " \ "part size mmc ${mmcdev} environment fdt_size; " \ "part start mmc ${mmcdev} boot boot_start; " \ diff --git a/include/image.h b/include/image.h index 95d5934344..420b8ff576 100644 --- a/include/image.h +++ b/include/image.h @@ -17,6 +17,7 @@ #include "compiler.h" #include <asm/byteorder.h> +#include <stdbool.h> /* Define this to avoid #ifdefs later on */ struct lmb; @@ -881,9 +882,11 @@ int bootz_setup(ulong image, ulong *start, ulong *end); * @image: Address of image * @start: Returns start address of image * @size : Returns size image + * @force_reloc: Ignore image->ep field, always place image to RAM start * @return 0 if OK, 1 if the image was not recognised */ -int booti_setup(ulong image, ulong *relocated_addr, ulong *size); +int booti_setup(ulong image, ulong *relocated_addr, ulong *size, + bool force_reloc); /*******************************************************************/ /* New uImage format specific code (prefixed with fit_) */ diff --git a/include/iotrace.h b/include/iotrace.h index 1efb117343..be1d2753e1 100644 --- a/include/iotrace.h +++ b/include/iotrace.h @@ -6,8 +6,36 @@ #ifndef __IOTRACE_H #define __IOTRACE_H +//#include <common.h> #include <linux/types.h> +/* Support up to the machine word length for now */ +typedef ulong iovalue_t; + +enum iotrace_flags { + IOT_8 = 0, + IOT_16, + IOT_32, + + IOT_READ = 0 << 3, + IOT_WRITE = 1 << 3, +}; + +/** + * struct iotrace_record - Holds a single I/O trace record + * + * @flags: I/O access type + * @timestamp: Timestamp of access + * @addr: Address of access + * @value: Value written or read + */ +struct iotrace_record { + enum iotrace_flags flags; + u64 timestamp; + phys_addr_t addr; + iovalue_t value; +}; + /* * This file is designed to be included in arch/<arch>/include/asm/io.h. * It redirects all IO access through a tracing/checksumming feature for @@ -118,11 +146,12 @@ void iotrace_set_buffer(ulong start, ulong size); * iotrace_get_buffer() - Get buffer information * * @start: Returns start address of buffer - * @size: Returns size of buffer in bytes + * @size: Returns actual size of buffer in bytes + * @needed_size: Returns needed size of buffer in bytes * @offset: Returns the byte offset where the next output trace record will * @count: Returns the number of trace records recorded * be written (or would be if the buffer was large enough) */ -void iotrace_get_buffer(ulong *start, ulong *size, ulong *offset, ulong *count); +void iotrace_get_buffer(ulong *start, ulong *size, ulong *needed_size, ulong *offset, ulong *count); #endif /* __IOTRACE_H */ diff --git a/include/log.h b/include/log.h index a3edd25546..3e99d6e62b 100644 --- a/include/log.h +++ b/include/log.h @@ -274,7 +274,8 @@ struct log_filter { * log_get_cat_name() - Get the name of a category * * @cat: Category to look up - * @return category name (which may be a uclass driver name) + * @return category name (which may be a uclass driver name) if found, or + * "<invalid>" if invalid, or "<missing>" if not found */ const char *log_get_cat_name(enum log_category_t cat); |