diff options
Diffstat (limited to 'include')
53 files changed, 491 insertions, 229 deletions
diff --git a/include/android_bootloader_message.h b/include/android_bootloader_message.h index b84789f022..286d7ab0f3 100644 --- a/include/android_bootloader_message.h +++ b/include/android_bootloader_message.h @@ -2,7 +2,7 @@ * This is from the Android Project, * Repository: https://android.googlesource.com/platform/bootable/recovery * File: bootloader_message/include/bootloader_message/bootloader_message.h - * Commit: c784ce50e8c10eaf70e1f97e24e8324aef45faf5 + * Commit: See U-Boot commit description * * Copyright (C) 2008 The Android Open Source Project * @@ -12,18 +12,24 @@ #ifndef __ANDROID_BOOTLOADER_MESSAGE_H #define __ANDROID_BOOTLOADER_MESSAGE_H +#ifndef __UBOOT__ +#include <assert.h> +#include <stddef.h> +#include <stdint.h> +#else /* compiler.h defines the types that otherwise are included from stdint.h and * stddef.h */ #include <compiler.h> +#endif -/* Spaces used by misc partition are as below: - * 0 - 2K For bootloader_message - * 2K - 16K Used by Vendor's bootloader (the 2K - 4K range may be optionally used - * as bootloader_message_ab struct) - * 16K - 64K Used by uncrypt and recovery to store wipe_package for A/B devices - * Note that these offsets are admitted by bootloader,recovery and uncrypt, so they - * are not configurable without changing all of them. */ +// Spaces used by misc partition are as below: +// 0 - 2K For bootloader_message +// 2K - 16K Used by Vendor's bootloader (the 2K - 4K range may be optionally used +// as bootloader_message_ab struct) +// 16K - 64K Used by uncrypt and recovery to store wipe_package for A/B devices +// Note that these offsets are admitted by bootloader,recovery and uncrypt, so they +// are not configurable without changing all of them. static const size_t BOOTLOADER_MESSAGE_OFFSET_IN_MISC = 0; static const size_t WIPE_PACKAGE_OFFSET_IN_MISC = 16 * 1024; @@ -61,17 +67,17 @@ struct bootloader_message { char status[32]; char recovery[768]; - /* The 'recovery' field used to be 1024 bytes. It has only ever - * been used to store the recovery command line, so 768 bytes - * should be plenty. We carve off the last 256 bytes to store the - * stage string (for multistage packages) and possible future - * expansion. */ + // The 'recovery' field used to be 1024 bytes. It has only ever + // been used to store the recovery command line, so 768 bytes + // should be plenty. We carve off the last 256 bytes to store the + // stage string (for multistage packages) and possible future + // expansion. char stage[32]; - /* The 'reserved' field used to be 224 bytes when it was initially - * carved off from the 1024-byte recovery field. Bump it up to - * 1184-byte so that the entire bootloader_message struct rounds up - * to 2048-byte. */ + // The 'reserved' field used to be 224 bytes when it was initially + // carved off from the 1024-byte recovery field. Bump it up to + // 1184-byte so that the entire bootloader_message struct rounds up + // to 2048-byte. char reserved[1184]; }; @@ -79,10 +85,12 @@ struct bootloader_message { * We must be cautious when changing the bootloader_message struct size, * because A/B-specific fields may end up with different offsets. */ +#ifndef __UBOOT__ #if (__STDC_VERSION__ >= 201112L) || defined(__cplusplus) static_assert(sizeof(struct bootloader_message) == 2048, "struct bootloader_message size changes, which may break A/B devices"); #endif +#endif /* __UBOOT__ */ /** * The A/B-specific bootloader message structure (4-KiB). @@ -108,7 +116,7 @@ struct bootloader_message_ab { char slot_suffix[32]; char update_channel[128]; - /* Round up the entire struct to 4096-byte. */ + // Round up the entire struct to 4096-byte. char reserved[1888]; }; @@ -116,26 +124,28 @@ struct bootloader_message_ab { * Be cautious about the struct size change, in case we put anything post * bootloader_message_ab struct (b/29159185). */ +#ifndef __UBOOT__ #if (__STDC_VERSION__ >= 201112L) || defined(__cplusplus) static_assert(sizeof(struct bootloader_message_ab) == 4096, "struct bootloader_message_ab size changes"); #endif +#endif /* __UBOOT__ */ #define BOOT_CTRL_MAGIC 0x42414342 /* Bootloader Control AB */ #define BOOT_CTRL_VERSION 1 struct slot_metadata { - /* Slot priority with 15 meaning highest priority, 1 lowest - * priority and 0 the slot is unbootable. */ + // Slot priority with 15 meaning highest priority, 1 lowest + // priority and 0 the slot is unbootable. uint8_t priority : 4; - /* Number of times left attempting to boot this slot. */ + // Number of times left attempting to boot this slot. uint8_t tries_remaining : 3; - /* 1 if this slot has booted successfully, 0 otherwise. */ + // 1 if this slot has booted successfully, 0 otherwise. uint8_t successful_boot : 1; - /* 1 if this slot is corrupted from a dm-verity corruption, 0 - * otherwise. */ + // 1 if this slot is corrupted from a dm-verity corruption, 0 + // otherwise. uint8_t verity_corrupted : 1; - /* Reserved for further use. */ + // Reserved for further use. uint8_t reserved : 7; } __attribute__((packed)); @@ -148,99 +158,99 @@ struct slot_metadata { * mandatory. */ struct bootloader_control { - /* NUL terminated active slot suffix. */ + // NUL terminated active slot suffix. char slot_suffix[4]; - /* Bootloader Control AB magic number (see BOOT_CTRL_MAGIC). */ + // Bootloader Control AB magic number (see BOOT_CTRL_MAGIC). uint32_t magic; - /* Version of struct being used (see BOOT_CTRL_VERSION). */ + // Version of struct being used (see BOOT_CTRL_VERSION). uint8_t version; - /* Number of slots being managed. */ + // Number of slots being managed. uint8_t nb_slot : 3; - /* Number of times left attempting to boot recovery. */ + // Number of times left attempting to boot recovery. uint8_t recovery_tries_remaining : 3; - /* Ensure 4-bytes alignment for slot_info field. */ + // Ensure 4-bytes alignment for slot_info field. uint8_t reserved0[2]; - /* Per-slot information. Up to 4 slots. */ + // Per-slot information. Up to 4 slots. struct slot_metadata slot_info[4]; - /* Reserved for further use. */ + // Reserved for further use. uint8_t reserved1[8]; - /* CRC32 of all 28 bytes preceding this field (little endian - * format). */ + // CRC32 of all 28 bytes preceding this field (little endian + // format). uint32_t crc32_le; } __attribute__((packed)); +#ifndef __UBOOT__ #if (__STDC_VERSION__ >= 201112L) || defined(__cplusplus) static_assert(sizeof(struct bootloader_control) == sizeof(((struct bootloader_message_ab *)0)->slot_suffix), "struct bootloader_control has wrong size"); #endif +#endif /* __UBOOT__ */ #ifndef __UBOOT__ - #ifdef __cplusplus #include <string> #include <vector> -/* Return the block device name for the bootloader message partition and waits - * for the device for up to 10 seconds. In case of error returns the empty - * string. */ +// Return the block device name for the bootloader message partition and waits +// for the device for up to 10 seconds. In case of error returns the empty +// string. std::string get_bootloader_message_blk_device(std::string* err); -/* Read bootloader message into boot. Error message will be set in err. */ +// Read bootloader message into boot. Error message will be set in err. bool read_bootloader_message(bootloader_message* boot, std::string* err); -/* Read bootloader message from the specified misc device into boot. */ +// Read bootloader message from the specified misc device into boot. bool read_bootloader_message_from(bootloader_message* boot, const std::string& misc_blk_device, std::string* err); -/* Write bootloader message to BCB. */ +// Write bootloader message to BCB. bool write_bootloader_message(const bootloader_message& boot, std::string* err); -/* Write bootloader message to the specified BCB device. */ +// Write bootloader message to the specified BCB device. bool write_bootloader_message_to(const bootloader_message& boot, const std::string& misc_blk_device, std::string* err); -/* Write bootloader message (boots into recovery with the options) to BCB. Will - * set the command and recovery fields, and reset the rest. */ +// Write bootloader message (boots into recovery with the options) to BCB. Will +// set the command and recovery fields, and reset the rest. bool write_bootloader_message(const std::vector<std::string>& options, std::string* err); -/* Write bootloader message (boots into recovery with the options) to the specific BCB device. Will - * set the command and recovery fields, and reset the rest. */ +// Write bootloader message (boots into recovery with the options) to the specific BCB device. Will +// set the command and recovery fields, and reset the rest. bool write_bootloader_message_to(const std::vector<std::string>& options, const std::string& misc_blk_device, std::string* err); -/* Update bootloader message (boots into recovery with the options) to BCB. Will - * only update the command and recovery fields. */ +// Update bootloader message (boots into recovery with the options) to BCB. Will +// only update the command and recovery fields. bool update_bootloader_message(const std::vector<std::string>& options, std::string* err); -/* Update bootloader message (boots into recovery with the |options|) in |boot|. Will only update - * the command and recovery fields. */ +// Update bootloader message (boots into recovery with the |options|) in |boot|. Will only update +// the command and recovery fields. bool update_bootloader_message_in_struct(bootloader_message* boot, const std::vector<std::string>& options); -/* Clear BCB. */ +// Clear BCB. bool clear_bootloader_message(std::string* err); -/* Writes the reboot-bootloader reboot reason to the bootloader_message. */ +// Writes the reboot-bootloader reboot reason to the bootloader_message. bool write_reboot_bootloader(std::string* err); -/* Read the wipe package from BCB (from offset WIPE_PACKAGE_OFFSET_IN_MISC). */ +// Read the wipe package from BCB (from offset WIPE_PACKAGE_OFFSET_IN_MISC). bool read_wipe_package(std::string* package_data, size_t size, std::string* err); -/* Write the wipe package into BCB (to offset WIPE_PACKAGE_OFFSET_IN_MISC). */ +// Write the wipe package into BCB (to offset WIPE_PACKAGE_OFFSET_IN_MISC). bool write_wipe_package(const std::string& package_data, std::string* err); #else #include <stdbool.h> -/* C Interface. */ +// C Interface. bool write_bootloader_message(const char* options); bool write_reboot_bootloader(void); -#endif /* ifdef __cplusplus */ - +#endif // ifdef __cplusplus #endif /* __UBOOT__ */ #endif /* __ANDROID_BOOTLOADER_MESSAGE_H */ diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index b5fba0a8b0..1885ac8e36 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -31,9 +31,6 @@ #define V_OSCK 24000000 /* Clock output from T2 */ #define V_SCLK (V_OSCK) -/* Always 128 KiB env size */ -#define CONFIG_ENV_SIZE SZ_128K - #ifdef CONFIG_NAND #define NANDARGS \ "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \ diff --git a/include/configs/am335x_igep003x.h b/include/configs/am335x_igep003x.h index 5fe7565131..5b5e16026e 100644 --- a/include/configs/am335x_igep003x.h +++ b/include/configs/am335x_igep003x.h @@ -20,8 +20,6 @@ #define V_OSCK 24000000 /* Clock output from T2 */ #define V_SCLK (V_OSCK) -#define CONFIG_ENV_SIZE (96 << 10) /* 96 KiB */ - #ifndef CONFIG_SPL_BUILD #define CONFIG_EXTRA_ENV_SETTINGS \ DEFAULT_LINUX_BOOT_ENV \ @@ -108,27 +106,6 @@ /* NAND support */ #define CONFIG_SYS_NAND_ONFI_DETECTION 1 -/* SPL */ - -/* UBI configuration */ -#define CONFIG_SPL_UBI 1 -#define CONFIG_SPL_UBI_MAX_VOL_LEBS 256 -#define CONFIG_SPL_UBI_MAX_PEB_SIZE (256*1024) -#define CONFIG_SPL_UBI_MAX_PEBS 4096 -#define CONFIG_SPL_UBI_VOL_IDS 8 -#define CONFIG_SPL_UBI_LOAD_MONITOR_ID 0 -#define CONFIG_SPL_UBI_LOAD_KERNEL_ID 3 -#define CONFIG_SPL_UBI_LOAD_ARGS_ID 4 -#define CONFIG_SPL_UBI_PEB_OFFSET 4 -#define CONFIG_SPL_UBI_VID_OFFSET 512 -#define CONFIG_SPL_UBI_LEB_START 2048 -#define CONFIG_SPL_UBI_INFO_ADDR 0x88080000 - -/* environment organization */ -#define CONFIG_ENV_UBI_PART "UBI" -#define CONFIG_ENV_UBI_VOLUME "config" -#define CONFIG_ENV_UBI_VOLUME_REDUND "config_r" - /* NAND config */ #define CONFIG_SYS_NAND_5_ADDR_CYCLE #define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \ diff --git a/include/configs/am335x_sl50.h b/include/configs/am335x_sl50.h index 381c75e6ef..a08e6bfe08 100644 --- a/include/configs/am335x_sl50.h +++ b/include/configs/am335x_sl50.h @@ -22,9 +22,6 @@ #define V_OSCK 24000000 /* Clock output from T2 */ #define V_SCLK (V_OSCK) -/* Always 128 KiB env size */ -#define CONFIG_ENV_SIZE (128 << 10) - #ifndef CONFIG_SPL_BUILD #define MEM_LAYOUT_ENV_SETTINGS \ diff --git a/include/configs/am3517_crane.h b/include/configs/am3517_crane.h index 2c510265cc..cacd799aa2 100644 --- a/include/configs/am3517_crane.h +++ b/include/configs/am3517_crane.h @@ -31,7 +31,6 @@ /* * Size of malloc() pool */ -#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB sector */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (128 << 10)) /* initial data */ /* @@ -192,7 +191,6 @@ #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE #define CONFIG_SYS_ENV_SECT_SIZE (128 << 10) /* 128 KiB sector */ -#define CONFIG_ENV_OFFSET 0x260000 #define CONFIG_ENV_ADDR 0x260000 /*----------------------------------------------------------------------- diff --git a/include/configs/am3517_evm.h b/include/configs/am3517_evm.h index 9475e9975d..e0521abe90 100644 --- a/include/configs/am3517_evm.h +++ b/include/configs/am3517_evm.h @@ -184,8 +184,6 @@ #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE #define CONFIG_SYS_ENV_SECT_SIZE (128 << 10) /* 128 KiB */ -#define CONFIG_ENV_SIZE CONFIG_SYS_ENV_SECT_SIZE -#define CONFIG_ENV_OFFSET 0x260000 #define CONFIG_ENV_ADDR 0x260000 /* Defines for SPL */ diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h index ef85cd2994..b0d9559962 100644 --- a/include/configs/am43xx_evm.h +++ b/include/configs/am43xx_evm.h @@ -59,9 +59,6 @@ /* Now bring in the rest of the common code. */ #include <configs/ti_armv7_omap.h> -/* Always 64 KiB env size */ -#define CONFIG_ENV_SIZE (64 << 10) - /* Clock Defines */ #define V_OSCK 24000000 /* Clock output from T2 */ #define V_SCLK (V_OSCK) @@ -114,8 +111,6 @@ #ifdef CONFIG_QSPI_BOOT #define CONFIG_SYS_REDUNDAND_ENVIRONMENT -#define CONFIG_ENV_SECT_SIZE (64 << 10) /* 64 KB sectors */ -#define CONFIG_ENV_OFFSET 0x110000 #define CONFIG_ENV_OFFSET_REDUND 0x120000 #endif diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h index 2c651aab17..e69e800f61 100644 --- a/include/configs/am57xx_evm.h +++ b/include/configs/am57xx_evm.h @@ -19,8 +19,6 @@ /* MMC ENV related defines */ #define CONFIG_SYS_MMC_ENV_DEV 1 /* eMMC */ #define CONFIG_SYS_MMC_ENV_PART 0 -#define CONFIG_ENV_SIZE SZ_128K -#define CONFIG_ENV_OFFSET 0x260000 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) #define CONFIG_SYS_REDUNDAND_ENVIRONMENT diff --git a/include/configs/at91-sama5_common.h b/include/configs/at91-sama5_common.h index fc46540a10..1b8373fbc6 100644 --- a/include/configs/at91-sama5_common.h +++ b/include/configs/at91-sama5_common.h @@ -57,17 +57,12 @@ #ifdef CONFIG_NAND_BOOT /* u-boot env in nand flash */ -#define CONFIG_ENV_OFFSET 0x140000 #define CONFIG_ENV_OFFSET_REDUND 0x100000 -#define CONFIG_ENV_SIZE 0x20000 #define CONFIG_BOOTCOMMAND "nand read 0x21000000 0x180000 0x80000;" \ "nand read 0x22000000 0x200000 0x600000;" \ "bootz 0x22000000 - 0x21000000" #elif CONFIG_SPI_BOOT /* u-boot env in serial flash, by default is bus 0 and cs 0 */ -#define CONFIG_ENV_OFFSET 0x6000 -#define CONFIG_ENV_SIZE 0x2000 -#define CONFIG_ENV_SECT_SIZE 0x1000 #define CONFIG_BOOTCOMMAND "sf probe 0; " \ "sf read 0x21000000 0x60000 0xc000; " \ "sf read 0x22000000 0x6c000 0x394000; " \ @@ -75,7 +70,6 @@ #elif CONFIG_QSPI_BOOT #define CONFIG_ENV_OFFSET 0x140000 #define CONFIG_ENV_SIZE 0x20000 -#define CONFIG_ENV_SECT_SIZE 0x1000 #define CONFIG_BOOTCOMMAND "sf probe 0; " \ "sf read 0x21000000 0x180000 0x80000; " \ "sf read 0x22000000 0x200000 0x600000; " \ diff --git a/include/configs/at91rm9200ek.h b/include/configs/at91rm9200ek.h index e2a2f3b893..8bfba35e16 100644 --- a/include/configs/at91rm9200ek.h +++ b/include/configs/at91rm9200ek.h @@ -145,7 +145,7 @@ */ #define CONFIG_ENV_ADDR \ (CONFIG_SYS_FLASH_BASE + CONFIG_SYS_MONITOR_LEN) -#define CONFIG_ENV_SIZE SZ_64K /* sectors are 64K here */ + /* The following #defines are needed to get flash environment right */ #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE #define CONFIG_SYS_MONITOR_LEN SZ_256K diff --git a/include/configs/baltos.h b/include/configs/baltos.h index fbf657fe65..a9b14c5b03 100644 --- a/include/configs/baltos.h +++ b/include/configs/baltos.h @@ -25,9 +25,6 @@ #define V_OSCK 24000000 /* Clock output from T2 */ #define V_SCLK (V_OSCK) -/* Always 128 KiB env size */ -#define CONFIG_ENV_SIZE (128 << 10) - /* FIT support */ #define CONFIG_SYS_BOOTM_LEN SZ_64M diff --git a/include/configs/bav335x.h b/include/configs/bav335x.h index 0525efac8f..bfa9fc9a52 100644 --- a/include/configs/bav335x.h +++ b/include/configs/bav335x.h @@ -31,9 +31,6 @@ #define V_OSCK 24000000 /* Clock output from T2 */ #define V_SCLK (V_OSCK) -/* Always 128 KiB env size */ -#define CONFIG_ENV_SIZE (128 << 10) - #ifdef CONFIG_NAND #define NANDARGS \ "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \ diff --git a/include/configs/brppt1.h b/include/configs/brppt1.h index 82f3f1a707..5a40f3abd1 100644 --- a/include/configs/brppt1.h +++ b/include/configs/brppt1.h @@ -59,9 +59,6 @@ #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000 #endif /* CONFIG_NAND */ -/* Always 64 KiB env size */ -#define CONFIG_ENV_SIZE (64 << 10) - #ifdef CONFIG_NAND #define NANDTGTS \ "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \ @@ -187,8 +184,6 @@ NANDTGTS \ #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x40000 /* Environment */ #define CONFIG_SYS_REDUNDAND_ENVIRONMENT -#define CONFIG_ENV_SECT_SIZE CONFIG_ENV_SIZE -#define CONFIG_ENV_OFFSET 0x20000 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \ CONFIG_ENV_SECT_SIZE) #elif defined(CONFIG_ENV_IS_IN_MMC) diff --git a/include/configs/chiliboard.h b/include/configs/chiliboard.h index db990fcb2b..13c15bd79f 100644 --- a/include/configs/chiliboard.h +++ b/include/configs/chiliboard.h @@ -161,15 +161,11 @@ #endif #if defined(CONFIG_ENV_IS_IN_NAND) -#define CONFIG_ENV_OFFSET 0x001c0000 #define CONFIG_ENV_OFFSET_REDUND 0x001e0000 -#define CONFIG_ENV_SIZE SZ_128K #define CONFIG_SYS_ENV_SECT_SIZE CONFIG_SYS_NAND_BLOCK_SIZE #else #define CONFIG_SYS_MMC_ENV_DEV 0 -#define CONFIG_ENV_OFFSET SZ_128K #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) -#define CONFIG_ENV_SIZE SZ_8K #define CONFIG_SYS_REDUNDAND_ENVIRONMENT #endif diff --git a/include/configs/cm_t335.h b/include/configs/cm_t335.h index 740bbd45a0..54f2cea864 100644 --- a/include/configs/cm_t335.h +++ b/include/configs/cm_t335.h @@ -23,8 +23,6 @@ #define V_OSCK 25000000 /* Clock output from T2 */ #define V_SCLK (V_OSCK) -#define CONFIG_ENV_SIZE (16 << 10) /* 16 KiB */ - #ifndef CONFIG_SPL_BUILD #define MMCARGS \ "mmcdev=0\0" \ diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h index fd693cf251..f9a6444d1d 100644 --- a/include/configs/cm_t35.h +++ b/include/configs/cm_t35.h @@ -39,7 +39,6 @@ /* * Size of malloc() pool */ -#define CONFIG_ENV_SIZE (16 << 10) /* 16 KiB */ /* Sector */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (128 << 10)) @@ -179,7 +178,6 @@ #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE #define CONFIG_SYS_MONITOR_LEN (256 << 10) /* Reserve 2 sectors */ -#define CONFIG_ENV_OFFSET 0x260000 #define CONFIG_ENV_ADDR 0x260000 /* additions for new relocation code, must be added to all boards */ diff --git a/include/configs/cm_t43.h b/include/configs/cm_t43.h index bd409896bc..b2c1300427 100644 --- a/include/configs/cm_t43.h +++ b/include/configs/cm_t43.h @@ -75,14 +75,9 @@ #include <configs/ti_armv7_omap.h> #undef CONFIG_SYS_MONITOR_LEN -#define CONFIG_ENV_SIZE (16 * 1024) - #define V_OSCK 24000000 /* Clock output from T2 */ #define V_SCLK (V_OSCK) -#define CONFIG_ENV_SECT_SIZE (64 * 1024) -#define CONFIG_ENV_OFFSET (768 * 1024) - #define CONFIG_EXTRA_ENV_SETTINGS \ "loadaddr=0x80200000\0" \ "fdtaddr=0x81200000\0" \ diff --git a/include/configs/corvus.h b/include/configs/corvus.h index f1b0374abe..f2df66eaa3 100644 --- a/include/configs/corvus.h +++ b/include/configs/corvus.h @@ -88,9 +88,7 @@ #define CONFIG_SYS_LOAD_ADDR ATMEL_BASE_CS6 /* bootstrap + u-boot + env in nandflash */ -#define CONFIG_ENV_OFFSET 0x100000 #define CONFIG_ENV_OFFSET_REDUND 0x180000 -#define CONFIG_ENV_SIZE SZ_128K #define CONFIG_BOOTCOMMAND \ "nand read 0x70000000 0x200000 0x300000;" \ diff --git a/include/configs/devkit8000.h b/include/configs/devkit8000.h index 2eb658dc61..baf1a73b95 100644 --- a/include/configs/devkit8000.h +++ b/include/configs/devkit8000.h @@ -37,8 +37,6 @@ #define CONFIG_REVISION_TAG 1 /* Size of malloc() pool */ -#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */ - /* Sector */ #undef CONFIG_SYS_MALLOC_LEN #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (128 << 10)) @@ -144,10 +142,6 @@ #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + \ 0x01000000) /* 16MB */ -/* NAND and environment organization */ - -#define CONFIG_ENV_OFFSET 0x260000 - /* SRAM config */ #define CONFIG_SYS_SRAM_START 0x40200000 #define CONFIG_SYS_SRAM_SIZE 0x10000 diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h index aec70ee718..9c8141de2e 100644 --- a/include/configs/dra7xx_evm.h +++ b/include/configs/dra7xx_evm.h @@ -21,8 +21,6 @@ #ifndef CONFIG_QSPI_BOOT /* MMC ENV related defines */ #define CONFIG_SYS_MMC_ENV_DEV 1 /* SLOT2: eMMC(1) */ -#define CONFIG_ENV_SIZE (128 << 10) -#define CONFIG_ENV_OFFSET 0x260000 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) #define CONFIG_SYS_REDUNDAND_ENVIRONMENT #endif diff --git a/include/configs/ethernut5.h b/include/configs/ethernut5.h index b86b54209c..24aaae5640 100644 --- a/include/configs/ethernut5.h +++ b/include/configs/ethernut5.h @@ -52,8 +52,6 @@ /* bootstrap + u-boot + env + linux in dataflash on CS0 */ #define CONFIG_ENV_OFFSET 0x3DE000 -#define CONFIG_ENV_SIZE (132 << 10) -#define CONFIG_ENV_SECT_SIZE CONFIG_ENV_SIZE /* NAND flash */ #ifdef CONFIG_CMD_NAND diff --git a/include/configs/gardena-smart-gateway-at91sam.h b/include/configs/gardena-smart-gateway-at91sam.h index 02bf4d195f..482e4714b1 100644 --- a/include/configs/gardena-smart-gateway-at91sam.h +++ b/include/configs/gardena-smart-gateway-at91sam.h @@ -43,12 +43,6 @@ #define CONFIG_SYS_LOAD_ADDR 0x22000000 /* load address */ -/* environment organization */ -#define CONFIG_ENV_UBI_PART "ubi" -#define CONFIG_ENV_UBI_VOLUME "env" -#define CONFIG_ENV_UBI_VOLUME_REDUND "env_r" -#define CONFIG_ENV_SIZE (64 << 10) - /* SPL */ #define CONFIG_SPL_MAX_SIZE 0x7000 #define CONFIG_SPL_STACK 0x308000 diff --git a/include/configs/kc1.h b/include/configs/kc1.h index 59814b5514..e3a219c46b 100644 --- a/include/configs/kc1.h +++ b/include/configs/kc1.h @@ -103,8 +103,6 @@ * Environment */ -#define CONFIG_ENV_SIZE (128 * 1024) - #define CONFIG_ENV_OVERWRITE #define CONFIG_EXTRA_ENV_SETTINGS \ diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h index 453dd32fbd..d9f4bdc1d6 100644 --- a/include/configs/nokia_rx51.h +++ b/include/configs/nokia_rx51.h @@ -50,7 +50,6 @@ /* * Size of malloc() pool */ -#define CONFIG_ENV_SIZE (128 << 10) #define CONFIG_UBI_SIZE (512 << 10) #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + CONFIG_UBI_SIZE + \ (128 << 10)) diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h index f0c8c990fa..a2a6be7cf8 100644 --- a/include/configs/omap3_beagle.h +++ b/include/configs/omap3_beagle.h @@ -40,7 +40,6 @@ #define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW_DETECTION_SW #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000 #define CONFIG_SYS_ENV_SECT_SIZE SZ_128K -#define CONFIG_ENV_OFFSET 0x260000 #define CONFIG_ENV_ADDR 0x260000 #define CONFIG_ENV_OVERWRITE /* NAND: SPL falcon mode configs */ @@ -59,9 +58,6 @@ /* TWL4030 LED Support */ -/* Environment */ -#define CONFIG_ENV_SIZE SZ_128K - #define CONFIG_PREBOOT "usb start" #define MEM_LAYOUT_ENV_SETTINGS \ diff --git a/include/configs/omap3_cairo.h b/include/configs/omap3_cairo.h index ef69b24dd0..9e2b7523e5 100644 --- a/include/configs/omap3_cairo.h +++ b/include/configs/omap3_cairo.h @@ -160,11 +160,7 @@ #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE #define CONFIG_SYS_ONENAND_BASE ONENAND_MAP -#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */ -#define ONENAND_ENV_OFFSET 0x260000 /* environment starts here */ - #define CONFIG_SYS_ENV_SECT_SIZE (128 << 10) /* 128 KiB */ -#define CONFIG_ENV_OFFSET 0x260000 #define CONFIG_ENV_ADDR 0x260000 /* Defines for SPL */ diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h index 5b9d8a57e3..4ab172c06d 100644 --- a/include/configs/omap3_evm.h +++ b/include/configs/omap3_evm.h @@ -44,7 +44,6 @@ #define CONFIG_SYS_NAND_ECCBYTES 3 #define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW_DETECTION_SW #define CONFIG_SYS_ENV_SECT_SIZE SZ_128K -#define CONFIG_ENV_OFFSET 0x260000 #define CONFIG_ENV_ADDR 0x260000 #define CONFIG_ENV_OVERWRITE /* NAND: SPL falcon mode configs */ @@ -54,8 +53,6 @@ #endif /* CONFIG_NAND */ /* Environment */ -#define CONFIG_ENV_SIZE SZ_128K - #define CONFIG_PREBOOT "usb start" #define MEM_LAYOUT_ENV_SETTINGS \ diff --git a/include/configs/omap3_igep00x0.h b/include/configs/omap3_igep00x0.h index 23d12c6a4e..4ad7dc18b1 100644 --- a/include/configs/omap3_igep00x0.h +++ b/include/configs/omap3_igep00x0.h @@ -96,24 +96,4 @@ #define CONFIG_SYS_NAND_ECCBYTES 14 #define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW_DETECTION_SW -/* UBI configuration */ -#define CONFIG_SPL_UBI 1 -#define CONFIG_SPL_UBI_MAX_VOL_LEBS 256 -#define CONFIG_SPL_UBI_MAX_PEB_SIZE (256*1024) -#define CONFIG_SPL_UBI_MAX_PEBS 4096 -#define CONFIG_SPL_UBI_VOL_IDS 8 -#define CONFIG_SPL_UBI_LOAD_MONITOR_ID 0 -#define CONFIG_SPL_UBI_LOAD_KERNEL_ID 3 -#define CONFIG_SPL_UBI_LOAD_ARGS_ID 4 -#define CONFIG_SPL_UBI_PEB_OFFSET 4 -#define CONFIG_SPL_UBI_VID_OFFSET 512 -#define CONFIG_SPL_UBI_LEB_START 2048 -#define CONFIG_SPL_UBI_INFO_ADDR 0x88080000 - -/* environment organization */ -#define CONFIG_ENV_UBI_PART "UBI" -#define CONFIG_ENV_UBI_VOLUME "config" -#define CONFIG_ENV_UBI_VOLUME_REDUND "config_r" -#define CONFIG_ENV_SIZE (32*1024) - #endif /* __IGEP00X0_H */ diff --git a/include/configs/omap3_logic.h b/include/configs/omap3_logic.h index e318a9f896..6b7104db5f 100644 --- a/include/configs/omap3_logic.h +++ b/include/configs/omap3_logic.h @@ -194,10 +194,7 @@ /* Monitor at start of flash */ #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE -#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */ - #define CONFIG_SYS_ENV_SECT_SIZE (128 << 10) /* 128 KiB */ -#define CONFIG_ENV_OFFSET 0x260000 #define CONFIG_ENV_ADDR 0x260000 /* Defines for SPL */ diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h index ea941dbb81..38a10e23d9 100644 --- a/include/configs/omap3_overo.h +++ b/include/configs/omap3_overo.h @@ -19,7 +19,6 @@ /* override size of malloc() pool */ #undef CONFIG_SYS_MALLOC_LEN -#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB sector */ /* Shift 128 << 15 provides 4 MiB heap to support UBI commands. * Shift 128 << 10 provides 128 KiB heap for limited-memory devices. */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (128 << 15)) diff --git a/include/configs/omap3_pandora.h b/include/configs/omap3_pandora.h index 82c66c4b8c..98f243f4dd 100644 --- a/include/configs/omap3_pandora.h +++ b/include/configs/omap3_pandora.h @@ -15,8 +15,6 @@ #define CONFIG_REVISION_TAG 1 -#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */ - #define CONFIG_SYS_DEVICE_NULLDEV 1 /* @@ -63,7 +61,6 @@ #define CONFIG_SYS_ENV_SECT_SIZE (128 << 10) /* 128 KiB */ -#define CONFIG_ENV_OFFSET 0x260000 #define CONFIG_ENV_ADDR 0x260000 #endif /* __CONFIG_H */ diff --git a/include/configs/omap3_zoom1.h b/include/configs/omap3_zoom1.h index 0a02ecdc14..4dc22a7a19 100644 --- a/include/configs/omap3_zoom1.h +++ b/include/configs/omap3_zoom1.h @@ -23,8 +23,6 @@ #define CONFIG_REVISION_TAG 1 -#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */ - /* * Hardware drivers */ @@ -132,7 +130,6 @@ #define ONENAND_ENV_OFFSET 0x260000 /* environment starts here */ #define CONFIG_SYS_ENV_SECT_SIZE (128 << 10) /* 128 KiB */ -#define CONFIG_ENV_OFFSET 0x260000 #define CONFIG_ENV_ADDR 0x260000 #endif /* __CONFIG_H */ diff --git a/include/configs/omap5_uevm.h b/include/configs/omap5_uevm.h index 0d8f945349..27e47327d3 100644 --- a/include/configs/omap5_uevm.h +++ b/include/configs/omap5_uevm.h @@ -32,8 +32,6 @@ /* MMC ENV related defines */ #define CONFIG_SYS_MMC_ENV_DEV 1 /* SLOT2: eMMC(1) */ -#define CONFIG_ENV_SIZE (128 << 10) -#define CONFIG_ENV_OFFSET 0x260000 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) #define CONFIG_SYS_REDUNDAND_ENVIRONMENT diff --git a/include/configs/pcm051.h b/include/configs/pcm051.h index 8cde12e375..153e567c2f 100644 --- a/include/configs/pcm051.h +++ b/include/configs/pcm051.h @@ -21,7 +21,6 @@ #include <configs/ti_am335x_common.h> -#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */ #define CONFIG_MACH_TYPE MACH_TYPE_PCM051 /* set to negative value for no autoboot */ diff --git a/include/configs/pepper.h b/include/configs/pepper.h index ef662d7000..662fce3355 100644 --- a/include/configs/pepper.h +++ b/include/configs/pepper.h @@ -17,8 +17,6 @@ /* Mach type */ #define CONFIG_MACH_TYPE MACH_TYPE_PEPPER -#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */ - #define CONFIG_EXTRA_ENV_SETTINGS \ DEFAULT_LINUX_BOOT_ENV \ "bootdir=/boot\0" \ diff --git a/include/configs/siemens-am33x-common.h b/include/configs/siemens-am33x-common.h index 12819553b0..c07814f91b 100644 --- a/include/configs/siemens-am33x-common.h +++ b/include/configs/siemens-am33x-common.h @@ -18,7 +18,6 @@ #define CONFIG_DMA_COHERENT #define CONFIG_DMA_COHERENT_SIZE (1 << 20) -#define CONFIG_ENV_SIZE (0x2000) #define CONFIG_SYS_MALLOC_LEN (16 * 1024 * 1024) #ifdef CONFIG_SIEMENS_MACH_TYPE #define CONFIG_MACH_TYPE CONFIG_SIEMENS_MACH_TYPE @@ -461,7 +460,6 @@ #define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND devices */ #if !defined(CONFIG_SPI_BOOT) -#define CONFIG_ENV_OFFSET 0x260000 /* environment starts here */ #define CONFIG_SYS_ENV_SECT_SIZE (128 << 10) /* 128 KiB */ #endif #endif diff --git a/include/configs/smartweb.h b/include/configs/smartweb.h index 776d7d7970..c1a43a5e55 100644 --- a/include/configs/smartweb.h +++ b/include/configs/smartweb.h @@ -144,10 +144,8 @@ /* * The NAND Flash partitions: */ -#define CONFIG_ENV_OFFSET (0x100000) #define CONFIG_ENV_OFFSET_REDUND (0x180000) #define CONFIG_ENV_RANGE (SZ_512K) -#define CONFIG_ENV_SIZE (SZ_128K) /* * Predefined environment variables. diff --git a/include/configs/snapper9260.h b/include/configs/snapper9260.h index f212d154e9..7c2c5fb6ca 100644 --- a/include/configs/snapper9260.h +++ b/include/configs/snapper9260.h @@ -111,8 +111,6 @@ #define CONFIG_BOOTP_BOOTFILESIZE /* Environment settings */ -#define CONFIG_ENV_OFFSET (512 << 10) -#define CONFIG_ENV_SIZE (256 << 10) #define CONFIG_ENV_OVERWRITE /* Console settings */ diff --git a/include/configs/snapper9g45.h b/include/configs/snapper9g45.h index dac2e65231..ffcfdcaafc 100644 --- a/include/configs/snapper9g45.h +++ b/include/configs/snapper9g45.h @@ -74,8 +74,6 @@ #define CONFIG_BOOTP_BOOTFILESIZE /* Environment settings */ -#define CONFIG_ENV_OFFSET (512 << 10) -#define CONFIG_ENV_SIZE (256 << 10) #define CONFIG_ENV_OVERWRITE #define CONFIG_EXTRA_ENV_SETTINGS \ diff --git a/include/configs/sniper.h b/include/configs/sniper.h index 540ea77ce0..0e2fcc3e23 100644 --- a/include/configs/sniper.h +++ b/include/configs/sniper.h @@ -96,8 +96,6 @@ * Environment */ -#define CONFIG_ENV_SIZE (128 * 1024) - #define CONFIG_ENV_OVERWRITE #define CONFIG_EXTRA_ENV_SETTINGS \ diff --git a/include/configs/stm32mp1.h b/include/configs/stm32mp1.h index 1d385e0985..0ce2fcb8b7 100644 --- a/include/configs/stm32mp1.h +++ b/include/configs/stm32mp1.h @@ -38,10 +38,6 @@ */ #define CONFIG_SYS_LOAD_ADDR STM32_DDR_BASE -#if defined(CONFIG_ENV_IS_IN_UBI) -#define CONFIG_ENV_UBI_VOLUME_REDUND "uboot_config_r" -#endif - #if defined(CONFIG_ENV_IS_IN_SPI_FLASH) #define CONFIG_ENV_SECT_SIZE SZ_256K #define CONFIG_ENV_OFFSET 0x00280000 diff --git a/include/configs/tam3517-common.h b/include/configs/tam3517-common.h index e7bab7203e..121de2bd24 100644 --- a/include/configs/tam3517-common.h +++ b/include/configs/tam3517-common.h @@ -28,7 +28,6 @@ /* * Size of malloc() pool */ -#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB sector */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (128 << 10) + \ 2 * 1024 * 1024) /* diff --git a/include/configs/tao3530.h b/include/configs/tao3530.h index a95cbed33a..c34e785d9e 100644 --- a/include/configs/tao3530.h +++ b/include/configs/tao3530.h @@ -32,7 +32,6 @@ * Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (4 << 20) -#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB sector */ /* * Hardware drivers @@ -170,7 +169,6 @@ #define ONENAND_ENV_OFFSET 0x260000 /* environment starts here */ #define CONFIG_SYS_ENV_SECT_SIZE (128 << 10) -#define CONFIG_ENV_OFFSET 0x260000 #define CONFIG_ENV_ADDR CONFIG_ENV_OFFSET #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 diff --git a/include/configs/taurus.h b/include/configs/taurus.h index dbb01af439..36a41fff18 100644 --- a/include/configs/taurus.h +++ b/include/configs/taurus.h @@ -110,9 +110,7 @@ #define CONFIG_SYS_LOAD_ADDR 0x22000000 /* bootstrap in spi flash , u-boot + env + linux in nandflash */ -#define CONFIG_ENV_OFFSET 0x100000 #define CONFIG_ENV_OFFSET_REDUND 0x180000 -#define CONFIG_ENV_SIZE (SZ_128K) /* 1 sector = 128 kB */ #ifndef CONFIG_SPL_BUILD #if defined(CONFIG_BOARD_AXM) diff --git a/include/configs/ti814x_evm.h b/include/configs/ti814x_evm.h index 512386ee22..90b424f499 100644 --- a/include/configs/ti814x_evm.h +++ b/include/configs/ti814x_evm.h @@ -18,7 +18,6 @@ #include <asm/arch/omap.h> -#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */ #define CONFIG_SYS_MALLOC_LEN (1024 << 10) #define CONFIG_MACH_TYPE MACH_TYPE_TI8148EVM diff --git a/include/configs/ti_omap4_common.h b/include/configs/ti_omap4_common.h index fc59aba1fa..1e316227aa 100644 --- a/include/configs/ti_omap4_common.h +++ b/include/configs/ti_omap4_common.h @@ -24,11 +24,6 @@ #define CONFIG_SYS_TIMERBASE GPT2_BASE /* - * Total Size Environment - 128k - */ -#define CONFIG_ENV_SIZE (128 << 10) - -/* * For the DDR timing information we can either dynamically determine * the timings to use or use pre-determined timings (based on using the * dynamic method. Default to the static timing infomation. diff --git a/include/configs/tricorder.h b/include/configs/tricorder.h index 683375a0df..2106f4e5b0 100644 --- a/include/configs/tricorder.h +++ b/include/configs/tricorder.h @@ -78,9 +78,7 @@ /* environment placement (for NAND), is different for FLASHCARD but does not * harm there */ -#define CONFIG_ENV_OFFSET 0x120000 /* env start */ #define CONFIG_ENV_OFFSET_REDUND 0x2A0000 /* redundant env start */ -#define CONFIG_ENV_SIZE (16 << 10) /* use 16KiB for env */ #define CONFIG_ENV_RANGE (384 << 10) /* allow badblocks in env */ /* the loadaddr is the same as CONFIG_SYS_LOAD_ADDR, unfortunately the defiend diff --git a/include/configs/usb_a9263.h b/include/configs/usb_a9263.h index fa38274d56..ee72354dd5 100644 --- a/include/configs/usb_a9263.h +++ b/include/configs/usb_a9263.h @@ -79,9 +79,6 @@ #define CONFIG_SYS_MEMTEST_END 0x23e00000 /* bootstrap + u-boot + env + linux in dataflash on CS0 */ -#define CONFIG_ENV_OFFSET 0x2000 -#define CONFIG_ENV_SIZE 0x2000 -#define CONFIG_ENV_SECT_SIZE CONFIG_ENV_SIZE #define CONFIG_BOOTCOMMAND "nboot 21000000 0" #define CONFIG_EXTRA_ENV_SETTINGS \ "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \ diff --git a/include/configs/wb50n.h b/include/configs/wb50n.h index e3973d02a2..81d30a6114 100644 --- a/include/configs/wb50n.h +++ b/include/configs/wb50n.h @@ -74,9 +74,7 @@ "autostart=no\0" /* bootstrap + u-boot + env in nandflash */ -#define CONFIG_ENV_OFFSET 0xA0000 #define CONFIG_ENV_OFFSET_REDUND 0xC0000 -#define CONFIG_ENV_SIZE 0x20000 #define CONFIG_BOOTCOMMAND \ "nand read 0x22000000 0x000e0000 0x500000; " \ "bootm" diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index 418392875c..5056a084d2 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -69,6 +69,7 @@ enum uclass_id { UCLASS_PANEL_BACKLIGHT, /* Backlight controller for panel */ UCLASS_PCH, /* x86 platform controller hub */ UCLASS_PCI, /* PCI bus */ + UCLASS_PCI_EP, /* PCI endpoint device */ UCLASS_PCI_GENERIC, /* Generic PCI bus device */ UCLASS_PHY, /* Physical Layer (PHY) device */ UCLASS_PINCONFIG, /* Pin configuration node device */ diff --git a/include/image.h b/include/image.h index bb7089ef5d..5f82194951 100644 --- a/include/image.h +++ b/include/image.h @@ -561,7 +561,7 @@ int boot_get_setup(bootm_headers_t *images, uint8_t arch, ulong *setup_start, #ifndef USE_HOSTCC /* Image format types, returned by _get_format() routine */ #define IMAGE_FORMAT_INVALID 0x00 -#if defined(CONFIG_IMAGE_FORMAT_LEGACY) +#if defined(CONFIG_LEGACY_IMAGE_FORMAT) #define IMAGE_FORMAT_LEGACY 0x01 /* legacy image_header based format */ #endif #define IMAGE_FORMAT_FIT 0x02 /* new, libfdt based format */ diff --git a/include/pci_ep.h b/include/pci_ep.h new file mode 100644 index 0000000000..00e8c6d8ab --- /dev/null +++ b/include/pci_ep.h @@ -0,0 +1,414 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Adapted from Linux kernel driver + * Copyright (C) 2017 Texas Instruments + * Author: Kishon Vijay Abraham I <kishon@ti.com> + * + * (C) Copyright 2019 + * Ramon Fried <ramon.fried@gmail.com> + */ + +#ifndef _PCI_EP_H +#define _PCI_EP_H + +#include <pci.h> + +/** + * enum pci_interrupt_pin - PCI INTx interrupt values + * @PCI_INTERRUPT_UNKNOWN: Unknown or unassigned interrupt + * @PCI_INTERRUPT_INTA: PCI INTA pin + * @PCI_INTERRUPT_INTB: PCI INTB pin + * @PCI_INTERRUPT_INTC: PCI INTC pin + * @PCI_INTERRUPT_INTD: PCI INTD pin + * + * Corresponds to values for legacy PCI INTx interrupts, as can be found in the + * PCI_INTERRUPT_PIN register. + */ +enum pci_interrupt_pin { + PCI_INTERRUPT_UNKNOWN, + PCI_INTERRUPT_INTA, + PCI_INTERRUPT_INTB, + PCI_INTERRUPT_INTC, + PCI_INTERRUPT_INTD, +}; + +enum pci_barno { + BAR_0, + BAR_1, + BAR_2, + BAR_3, + BAR_4, + BAR_5, +}; + +enum pci_ep_irq_type { + PCI_EP_IRQ_UNKNOWN, + PCI_EP_IRQ_LEGACY, + PCI_EP_IRQ_MSI, + PCI_EP_IRQ_MSIX, +}; + +/** + * struct pci_bar - represents the BAR (Base Address Register) of EP device + * @phys_addr: physical address that should be mapped to the BAR + * @size: the size of the address space present in BAR + * pci_barno: number of pci BAR to set (0..5) + * @flags: BAR access flags + */ +struct pci_bar { + dma_addr_t phys_addr; + size_t size; + enum pci_barno barno; + int flags; +}; + +/** + * struct pci_ep_header - represents standard configuration header + * @vendorid: identifies device manufacturer + * @deviceid: identifies a particular device + * @revid: specifies a device-specific revision identifier + * @progif_code: identifies a specific register-level programming interface + * @subclass_code: identifies more specifically the function of the device + * @baseclass_code: broadly classifies the type of function the device performs + * @cache_line_size: specifies the system cacheline size in units of DWORDs + * @subsys_vendor_id: vendor of the add-in card or subsystem + * @subsys_id: id specific to vendor + * @interrupt_pin: interrupt pin the device (or device function) uses + */ +struct pci_ep_header { + u16 vendorid; + u16 deviceid; + u8 revid; + u8 progif_code; + u8 subclass_code; + u8 baseclass_code; + u8 cache_line_size; + u16 subsys_vendor_id; + u16 subsys_id; + enum pci_interrupt_pin interrupt_pin; +}; + +/* PCI endpoint operations */ +struct pci_ep_ops { + /** + * write_header() - Write a PCI configuration space header + * + * @dev: device to write to + * @func_num: EP function to fill + * @hdr: header to write + * @return 0 if OK, -ve on error + */ + int (*write_header)(struct udevice *dev, uint func_num, + struct pci_ep_header *hdr); + /** + * read_header() - Read a PCI configuration space header + * + * @dev: device to write to + * @func_num: EP function to fill + * @hdr: header to read to + * @return 0 if OK, -ve on error + */ + int (*read_header)(struct udevice *dev, uint func_num, + struct pci_ep_header *hdr); + /** + * set_bar() - Set BAR (Base Address Register) properties + * + * @dev: device to set + * @func_num: EP function to set + * @bar: bar data + * @return 0 if OK, -ve on error + */ + int (*set_bar)(struct udevice *dev, uint func_num, + struct pci_bar *bar); + /** + * read_bar() - Read BAR (Base Address Register) properties + * + * @dev: device to read + * @func_num: EP function to read + * @bar: struct to copy data to + * @barno: bar number to read + * @return 0 if OK, -ve on error + */ + int (*read_bar)(struct udevice *dev, uint func_num, + struct pci_bar *bar, enum pci_barno barno); + /** + * clear_bar() - clear BAR (Base Address Register) + * + * @dev: device to clear + * @func_num: EP function to clear + * @bar: bar number + * @return 0 if OK, -ve on error + */ + int (*clear_bar)(struct udevice *dev, uint func_num, + enum pci_barno bar); + /** + * map_addr() - map CPU address to PCI address + * + * outband region is used in order to generate PCI read/write + * transaction from local memory/write. + * + * @dev: device to set + * @func_num: EP function to set + * @addr: local physical address base + * @pci_addr: pci address to translate to + * @size: region size + * @return 0 if OK, -ve on error + */ + int (*map_addr)(struct udevice *dev, uint func_num, + phys_addr_t addr, u64 pci_addr, size_t size); + /** + * unmap_addr() - unmap CPU address to PCI address + * + * unmap previously mapped region. + * + * @dev: device to set + * @func_num: EP function to set + * @addr: local physical address base + * @return 0 if OK, -ve on error + */ + int (*unmap_addr)(struct udevice *dev, uint func_num, + phys_addr_t addr); + /** + * set_msi() - set msi capability property + * + * set the number of required MSI vectors the device + * needs for operation. + * + * @dev: device to set + * @func_num: EP function to set + * @interrupts: required interrupts count + * @return 0 if OK, -ve on error + */ + int (*set_msi)(struct udevice *dev, uint func_num, uint interrupts); + + /** + * get_msi() - get the number of MSI interrupts allocated by the host. + * + * Read the Multiple Message Enable bitfield from + * Message control register. + * + * @dev: device to use + * @func_num: EP function to use + * @return msi count if OK, -EINVAL if msi were not enabled at host. + */ + int (*get_msi)(struct udevice *dev, uint func_num); + + /** + * set_msix() - set msix capability property + * + * set the number of required MSIx vectors the device + * needs for operation. + * + * @dev: device to set + * @func_num: EP function to set + * @interrupts: required interrupts count + * @return 0 if OK, -ve on error + */ + int (*set_msix)(struct udevice *dev, uint func_num, + uint interrupts); + + /** + * get_msix() - get the number of MSIx interrupts allocated by the host. + * + * Read the Multiple Message Enable bitfield from + * Message control register. + * + * @dev: device to use + * @func_num: EP function to use + * @return msi count if OK, -EINVAL if msi were not enabled at host. + */ + int (*get_msix)(struct udevice *dev, uint func_num); + + /** + * raise_irq() - raise a legacy, MSI or MSI-X interrupt + * + * @dev: device to set + * @func_num: EP function to set + * @type: type of irq to send + * @interrupt_num: interrupt vector to use + * @return 0 if OK, -ve on error + */ + int (*raise_irq)(struct udevice *dev, uint func_num, + enum pci_ep_irq_type type, uint interrupt_num); + /** + * start() - start the PCI link + * + * @dev: device to set + * @return 0 if OK, -ve on error + */ + int (*start)(struct udevice *dev); + + /** + * stop() - stop the PCI link + * + * @dev: device to set + * @return 0 if OK, -ve on error + */ + int (*stop)(struct udevice *dev); +}; + +#define pci_ep_get_ops(dev) ((struct pci_ep_ops *)(dev)->driver->ops) + +/** + * pci_ep_write_header() - Write a PCI configuration space header + * + * @dev: device to write to + * @func_num: EP function to fill + * @hdr: header to write + * @return 0 if OK, -ve on error + */ +int pci_ep_write_header(struct udevice *dev, uint func_num, + struct pci_ep_header *hdr); + +/** + * dm_pci_ep_read_header() - Read a PCI configuration space header + * + * @dev: device to write to + * @func_num: EP function to fill + * @hdr: header to read to + * @return 0 if OK, -ve on error + */ +int pci_ep_read_header(struct udevice *dev, uint func_num, + struct pci_ep_header *hdr); +/** + * pci_ep_set_bar() - Set BAR (Base Address Register) properties + * + * @dev: device to set + * @func_num: EP function to set + * @bar: bar data + * @return 0 if OK, -ve on error + */ +int pci_ep_set_bar(struct udevice *dev, uint func_num, struct pci_bar *bar); + +/** + * pci_ep_read_bar() - Read BAR (Base Address Register) properties + * + * @dev: device to read + * @func_num: EP function to read + * @bar: struct to copy data to + * @barno: bar number to read + * @return 0 if OK, -ve on error + */ +int pci_ep_read_bar(struct udevice *dev, uint func_no, struct pci_bar *ep_bar, + enum pci_barno barno); + +/** + * pci_ep_clear_bar() - Clear BAR (Base Address Register) + * mark the BAR as empty so host won't map it. + * @dev: device to clear + * @func_num: EP function to clear + * @bar: bar number + * @return 0 if OK, -ve on error + */ +int pci_ep_clear_bar(struct udevice *dev, uint func_num, enum pci_barno bar); +/** + * pci_ep_map_addr() - map CPU address to PCI address + * + * outband region is used in order to generate PCI read/write + * transaction from local memory/write. + * + * @dev: device to set + * @func_num: EP function to set + * @addr: local physical address base + * @pci_addr: pci address to translate to + * @size: region size + * @return 0 if OK, -ve on error + */ +int pci_ep_map_addr(struct udevice *dev, uint func_num, phys_addr_t addr, + u64 pci_addr, size_t size); +/** + * pci_ep_unmap_addr() - unmap CPU address to PCI address + * + * unmap previously mapped region. + * + * @dev: device to set + * @func_num: EP function to set + * @addr: local physical address base + * @return 0 if OK, -ve on error + */ +int pci_ep_unmap_addr(struct udevice *dev, uint func_num, phys_addr_t addr); + +/** + * pci_ep_set_msi() - set msi capability property + * + * set the number of required MSI vectors the device + * needs for operation. + * + * @dev: device to set + * @func_num: EP function to set + * @interrupts: required interrupts count + * @return 0 if OK, -ve on error + */ +int pci_ep_set_msi(struct udevice *dev, uint func_num, uint interrupts); + +/** + * pci_ep_get_msi() - get the number of MSI interrupts allocated by the host. + * + * Read the Multiple Message Enable bitfield from + * Message control register. + * + * @dev: device to use + * @func_num: EP function to use + * @return msi count if OK, -EINVAL if msi were not enabled at host. + */ +int pci_ep_get_msi(struct udevice *dev, uint func_num); + +/** + * pci_ep_set_msix() - set msi capability property + * + * set the number of required MSIx vectors the device + * needs for operation. + * + * @dev: device to set + * @func_num: EP function to set + * @interrupts: required interrupts count + * @return 0 if OK, -ve on error + */ +int pci_ep_set_msix(struct udevice *dev, uint func_num, uint interrupts); + +/** + * pci_ep_get_msix() - get the number of MSIx interrupts allocated by the host. + * + * Read the Multiple Message Enable bitfield from + * Message control register. + * + * @dev: device to use + * @func_num: EP function to use + * @return msi count if OK, -EINVAL if msi were not enabled at host. + */ +int pci_ep_get_msix(struct udevice *dev, uint func_num); + +/** + * pci_ep_raise_irq() - raise a legacy, MSI or MSI-X interrupt + * + * @dev: device to set + * @func_num: EP function to set + * @type: type of irq to send + * @interrupt_num: interrupt vector to use + * @return 0 if OK, -ve on error + */ +int pci_ep_raise_irq(struct udevice *dev, uint func_num, + enum pci_ep_irq_type type, uint interrupt_num); +/** + * pci_ep_start() - start the PCI link + * + * Enable PCI endpoint device and start link + * process. + * + * @dev: device to set + * @return 0 if OK, -ve on error + */ +int pci_ep_start(struct udevice *dev); + +/** + * pci_ep_stop() - stop the PCI link + * + * Disable PCI endpoint device and stop + * link. + * + * @dev: device to set + * @return 0 if OK, -ve on error + */ +int pci_ep_stop(struct udevice *dev); + +#endif diff --git a/include/ubispl.h b/include/ubispl.h index 1e5da94eb1..ecfe0c93c1 100644 --- a/include/ubispl.h +++ b/include/ubispl.h @@ -5,6 +5,8 @@ #ifndef __UBOOT_UBISPL_H #define __UBOOT_UBISPL_H +#define UBI_VOL_NAME_MAX 127 + /* * The following CONFIG options are relevant for UBISPL * @@ -74,6 +76,10 @@ struct ubispl_info { */ struct ubispl_load { int vol_id; +#ifdef CONFIG_SPL_UBI_LOAD_BY_VOLNAME + u32 name_len; + char name[UBI_VOL_NAME_MAX + 1]; +#endif void *load_addr; }; |