diff options
author | Tom Rini | 2023-10-02 10:55:44 -0400 |
---|---|---|
committer | Tom Rini | 2023-10-02 10:55:44 -0400 |
commit | ac897385bbfa30cfdfb62ccf24acfcd4b274b2ff (patch) | |
tree | ae567980737beb24ca24e2ee8cfeaf6eb9e26e3f /include | |
parent | 4459ed60cb1e0562bc5b40405e2b4b9bbf766d57 (diff) | |
parent | e29b932aa07fa0226d325b35d96cd4eea0370129 (diff) |
Merge branch 'next'
Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'include')
71 files changed, 1068 insertions, 370 deletions
diff --git a/include/abuf.h b/include/abuf.h index 9badda64e4f..be98ec78c86 100644 --- a/include/abuf.h +++ b/include/abuf.h @@ -91,6 +91,15 @@ void abuf_map_sysmem(struct abuf *abuf, ulong addr, size_t size); bool abuf_realloc(struct abuf *abuf, size_t new_size); /** + * abuf_realloc_inc() - Increment abuf size by a given amount + * + * @abuf: abuf to adjust + * @inc: Size incrmement to use (the buffer size will be increased by this much) + * Return: true if OK, false if out of memory + */ +bool abuf_realloc_inc(struct abuf *abuf, size_t inc); + +/** * abuf_uninit_move() - Return the allocated contents and uninit the abuf * * This returns the abuf data to the caller, allocating it if necessary, so that diff --git a/include/acpi/acpi_table.h b/include/acpi/acpi_table.h index 7ed0443c821..1f85de091d3 100644 --- a/include/acpi/acpi_table.h +++ b/include/acpi/acpi_table.h @@ -883,6 +883,13 @@ void acpi_inc_align(struct acpi_ctx *ctx, uint amount); */ int acpi_add_table(struct acpi_ctx *ctx, void *table); +static inline int acpi_add_fadt(struct acpi_ctx *ctx, struct acpi_fadt *fadt) +{ + acpi_add_table(ctx, fadt); + acpi_inc(ctx, sizeof(struct acpi_fadt)); + return 0; +} + /** * acpi_write_rsdp() - Write out an RSDP indicating where the ACPI tables are * diff --git a/include/asm-generic/bitops/builtin-__ffs.h b/include/asm-generic/bitops/builtin-__ffs.h new file mode 100644 index 00000000000..87024da44d1 --- /dev/null +++ b/include/asm-generic/bitops/builtin-__ffs.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_ +#define _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_ + +/** + * __ffs - find first bit in word. + * @word: The word to search + * + * Undefined if no bit exists, so code should check against 0 first. + */ +static __always_inline unsigned long __ffs(unsigned long word) +{ + return __builtin_ctzl(word); +} + +#endif diff --git a/include/asm-generic/bitops/builtin-__fls.h b/include/asm-generic/bitops/builtin-__fls.h new file mode 100644 index 00000000000..43a5aa9afbd --- /dev/null +++ b/include/asm-generic/bitops/builtin-__fls.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_GENERIC_BITOPS_BUILTIN___FLS_H_ +#define _ASM_GENERIC_BITOPS_BUILTIN___FLS_H_ + +/** + * __fls - find last (most-significant) set bit in a long word + * @word: the word to search + * + * Undefined if no set bit exists, so code should check against 0 first. + */ +static __always_inline unsigned long __fls(unsigned long word) +{ + return (sizeof(word) * 8) - 1 - __builtin_clzl(word); +} + +#endif diff --git a/include/asm-generic/bitops/builtin-ffs.h b/include/asm-generic/bitops/builtin-ffs.h new file mode 100644 index 00000000000..7b129329046 --- /dev/null +++ b/include/asm-generic/bitops/builtin-ffs.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_GENERIC_BITOPS_BUILTIN_FFS_H_ +#define _ASM_GENERIC_BITOPS_BUILTIN_FFS_H_ + +/** + * ffs - find first bit set + * @x: the word to search + * + * This is defined the same way as + * the libc and compiler builtin ffs routines, therefore + * differs in spirit from ffz (man ffs). + */ +#define ffs(x) __builtin_ffs(x) + +#endif diff --git a/include/asm-generic/bitops/builtin-fls.h b/include/asm-generic/bitops/builtin-fls.h new file mode 100644 index 00000000000..c8455cc2884 --- /dev/null +++ b/include/asm-generic/bitops/builtin-fls.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_GENERIC_BITOPS_BUILTIN_FLS_H_ +#define _ASM_GENERIC_BITOPS_BUILTIN_FLS_H_ + +/** + * fls - find last (most-significant) bit set + * @x: the word to search + * + * This is defined the same way as ffs. + * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. + */ +static __always_inline int fls(unsigned int x) +{ + return x ? sizeof(x) * 8 - __builtin_clz(x) : 0; +} + +#endif diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 8fc205ded1a..c6d63b3657c 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -552,6 +552,14 @@ static_assert(sizeof(struct global_data) == GD_SIZE); #define gd_set_acpi_start(addr) #endif +#ifdef CONFIG_SMBIOS +#define gd_smbios_start() gd->smbios_start +#define gd_set_smbios_start(addr) gd->arch.smbios_start = addr +#else +#define gd_smbios_start() 0UL +#define gd_set_smbios_start(addr) +#endif + #if CONFIG_IS_ENABLED(MULTI_DTB_FIT) #define gd_multi_dtb_fit() gd->multi_dtb_fit #define gd_set_multi_dtb_fit(_dtb) gd->multi_dtb_fit = _dtb @@ -573,6 +581,13 @@ static_assert(sizeof(struct global_data) == GD_SIZE); #define gd_malloc_start() 0 #define gd_set_malloc_start(val) #endif + +#if CONFIG_IS_ENABLED(PCI) +#define gd_set_pci_ram_top(val) gd->pci_ram_top = val +#else +#define gd_set_pci_ram_top(val) +#endif + /** * enum gd_flags - global data flags * @@ -667,6 +682,11 @@ enum gd_flags { * @GD_FLG_OF_TAG_MIGRATE: Device tree has old u-boot,dm- tags */ GD_FLG_OF_TAG_MIGRATE = 0x200000, + /** + * @GD_FLG_DM_DEAD: Driver model is not accessible. This can be set when + * the memory used to holds its tables has been mapped out. + */ + GD_FLG_DM_DEAD = 0x400000, }; #endif /* __ASSEMBLY__ */ diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index c4a7fd28439..a21c606f2b8 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -414,6 +414,7 @@ struct dm_gpio_ops { * @gpio_base: Base GPIO number for this device. For the first active device * this will be 0; the numbering for others will follow sequentially so that * @gpio_base for device 1 will equal the number of GPIOs in device 0. + * @claimed: Array of bits indicating which GPIOs in the bank are claimed. * @name: Array of pointers to the name for each GPIO in this bank. The * value of the pointer will be NULL if the GPIO has not been claimed. */ @@ -421,6 +422,7 @@ struct gpio_dev_priv { const char *bank_name; unsigned gpio_count; unsigned gpio_base; + u32 *claimed; char **name; }; diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 267f1db73f2..1e1657a0167 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -61,8 +61,12 @@ static inline int arch_is_kernel_data(unsigned long addr) /* Start of U-Boot text region */ extern char __text_start[]; -/* This marks the end of the text region which must be relocated */ -extern char __image_copy_end[]; +/* This marks the text region which must be relocated */ +extern char __image_copy_start[], __image_copy_end[]; + +extern char __bss_end[]; +extern char __rel_dyn_start[], __rel_dyn_end[]; +extern char _image_binary_end[]; /* * This is the U-Boot entry point - prior to relocation it should be same @@ -70,30 +74,4 @@ extern char __image_copy_end[]; */ extern void _start(void); -/* - * ARM defines its symbols as char[]. Other arches define them as ulongs. - */ -#ifdef CONFIG_ARM - -extern char __bss_start[]; -extern char __bss_end[]; -extern char __image_copy_start[]; -extern char __image_copy_end[]; -extern char _image_binary_end[]; -extern char __rel_dyn_start[]; -extern char __rel_dyn_end[]; - -#else /* don't use offsets: */ - -/* Exports from the Linker Script */ -extern ulong __data_end; -extern ulong __rel_dyn_start; -extern ulong __rel_dyn_end; -extern ulong __bss_end; -extern ulong _image_binary_end; - -extern ulong _TEXT_BASE; /* code start */ - -#endif - #endif /* _ASM_GENERIC_SECTIONS_H_ */ diff --git a/include/blk.h b/include/blk.h index 2c9c7985a88..95e86e2d5d1 100644 --- a/include/blk.h +++ b/include/blk.h @@ -7,6 +7,7 @@ #ifndef BLK_H #define BLK_H +#include <bouncebuf.h> #include <dm/uclass-id.h> #include <efi.h> @@ -104,12 +105,6 @@ struct blk_desc { (PAD_SIZE(size, blk_desc->blksz)) #if CONFIG_IS_ENABLED(BLOCK_CACHE) - -/** - * blkcache_init() - initialize the block cache list pointers - */ -int blkcache_init(void); - /** * blkcache_read() - attempt to read a set of blocks from cache * @@ -260,9 +255,25 @@ struct blk_ops { * @return 0 if OK, -ve on error */ int (*select_hwpart)(struct udevice *dev, int hwpart); -}; -#define blk_get_ops(dev) ((struct blk_ops *)(dev)->driver->ops) +#if IS_ENABLED(CONFIG_BOUNCE_BUFFER) + /** + * buffer_aligned() - test memory alignment of block operation buffer + * + * Some devices have limited DMA capabilities and require that the + * buffers passed to them fit specific properties. This optional + * callback can be used to indicate whether a buffer alignment is + * suitable for the device DMA or not, and trigger use of generic + * bounce buffer implementation to help use of unsuitable buffers + * at the expense of performance degradation. + * + * @dev: Block device associated with the request + * @state: Bounce buffer state + * @return 1 if OK, 0 if unaligned + */ + int (*buffer_aligned)(struct udevice *dev, struct bounce_buffer *state); +#endif /* CONFIG_BOUNCE_BUFFER */ +}; /* * These functions should take struct udevice instead of struct blk_desc, diff --git a/include/bootdev.h b/include/bootdev.h index 848233187f8..b079a91b5b7 100644 --- a/include/bootdev.h +++ b/include/bootdev.h @@ -321,6 +321,15 @@ int bootdev_hunt(const char *spec, bool show); int bootdev_hunt_prio(enum bootdev_prio_t prio, bool show); /** + * bootdev_unhunt() - Mark a device as needing to be hunted again + * + * @id: uclass ID to update + * Return: 0 if done, -EALREADY if already in this state, -ENOENT if no hunter + * found for that uclass + */ +int bootdev_unhunt(enum uclass_id id); + +/** * bootdev_hunt_and_find_by_label() - Hunt for bootdevs by label * * Runs the hunter for the label, then tries to find the bootdev, possible diff --git a/include/bootflow.h b/include/bootflow.h index 4152577afb7..44d3741eaca 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -83,6 +83,7 @@ enum bootflow_flags_t { * @flags: Flags for the bootflow (see enum bootflow_flags_t) * @cmdline: OS command line, or NULL if not known (allocated) * @x86_setup: Pointer to x86 setup block inside @buf, NULL if not present + * @bootmeth_priv: Private data for the bootmeth */ struct bootflow { struct list_head bm_node; @@ -107,7 +108,8 @@ struct bootflow { ulong fdt_addr; int flags; char *cmdline; - char *x86_setup; + void *x86_setup; + void *bootmeth_priv; }; /** @@ -351,6 +353,17 @@ void bootflow_free(struct bootflow *bflow); int bootflow_boot(struct bootflow *bflow); /** + * bootflow_read_all() - Read all bootflow files + * + * Some bootmeths delay reading of large files until booting is requested. This + * causes those files to be read. + * + * @bflow: Bootflow to read + * Return: result of trying to read + */ +int bootflow_read_all(struct bootflow *bflow); + +/** * bootflow_run_boot() - Try to boot a bootflow * * @iter: Current iteration (or NULL if none). Used to disable a bootmeth if the diff --git a/include/bootm.h b/include/bootm.h index 044a4797ed3..c3c7336207b 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -9,6 +9,7 @@ #include <image.h> +struct boot_params; struct cmd_tbl; #define BOOTM_ERR_RESET (-1) @@ -124,4 +125,50 @@ int bootm_process_cmdline(char *buf, int maxlen, int flags); */ int bootm_process_cmdline_env(int flags); +/** + * zboot_start() - Boot a zimage + * + * Boot a zimage, given the component parts + * + * @addr: Address where the bzImage is moved before booting, either + * BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR + * @base: Pointer to the boot parameters, typically at address + * DEFAULT_SETUP_BASE + * @initrd: Address of the initial ramdisk, or 0 if none + * @initrd_size: Size of the initial ramdisk, or 0 if none + * @cmdline: Command line to use for booting + * Return: -EFAULT on error (normally it does not return) + */ +int zboot_start(ulong addr, ulong size, ulong initrd, ulong initrd_size, + ulong base, char *cmdline); + +/* + * zimage_get_kernel_version() - Get the version string from a kernel + * + * @params: boot_params pointer + * @kernel_base: base address of kernel + * Return: Kernel version as a NUL-terminated string + */ +const char *zimage_get_kernel_version(struct boot_params *params, + void *kernel_base); + +/** + * zimage_dump() - Dump the metadata of a zimage + * + * This shows all available information in a zimage that has been loaded. + * + * @base_ptr: Pointer to the boot parameters, typically at address + * DEFAULT_SETUP_BASE + * @show_cmdline: true to show the full command line + */ +void zimage_dump(struct boot_params *base_ptr, bool show_cmdline); + +/* + * bootm_boot_start() - Boot an image at the given address + * + * @addr: Image address + * @cmdline: Command line to set + */ +int bootm_boot_start(ulong addr, const char *cmdline); + #endif diff --git a/include/bootmeth.h b/include/bootmeth.h index 7cb7da33dea..0fc36104ece 100644 --- a/include/bootmeth.h +++ b/include/bootmeth.h @@ -16,9 +16,12 @@ struct udevice; * enum bootmeth_flags - Flags for bootmeths * * @BOOTMETHF_GLOBAL: bootmeth handles bootdev selection automatically + * @BOOTMETHF_ANY_PART: bootmeth is willing to check any partition, even if it + * has no filesystem */ enum bootmeth_flags { BOOTMETHF_GLOBAL = BIT(0), + BOOTMETHF_ANY_PART = BIT(1), }; /** @@ -119,7 +122,16 @@ struct bootmeth_ops { */ int (*read_file)(struct udevice *dev, struct bootflow *bflow, const char *file_path, ulong addr, ulong *sizep); - +#if CONFIG_IS_ENABLED(BOOTSTD_FULL) + /** + * readall() - read all files for a bootflow + * + * @dev: Bootmethod device to boot + * @bflow: Bootflow to read + * Return: 0 if OK, -EIO on I/O error, other -ve on other error + */ + int (*read_all)(struct udevice *dev, struct bootflow *bflow); +#endif /* BOOTSTD_FULL */ /** * boot() - boot a bootflow * @@ -224,6 +236,20 @@ int bootmeth_read_file(struct udevice *dev, struct bootflow *bflow, const char *file_path, ulong addr, ulong *sizep); /** + * bootmeth_read_all() - read all bootflow files + * + * Some bootmeths delay reading of large files until booting is requested. This + * causes those files to be read. + * + * @dev: Bootmethod device to use + * @bflow: Bootflow to read + * Return: does not return on success, since it should boot the + * Operating Systemn. Returns -EFAULT if that fails, other -ve on + * other error + */ +int bootmeth_read_all(struct udevice *dev, struct bootflow *bflow); + +/** * bootmeth_boot() - boot a bootflow * * @dev: Bootmethod device to boot diff --git a/include/cedit.h b/include/cedit.h new file mode 100644 index 00000000000..f43cafa5aa2 --- /dev/null +++ b/include/cedit.h @@ -0,0 +1,125 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2023 Google LLC + * Written by Simon Glass <sjg@chromium.org> + */ + +#ifndef __CEDIT_H +#define __CEDIT_H + +#include <dm/ofnode_decl.h> + +struct abuf; +struct expo; +struct scene; +struct video_priv; + +enum { + /* size increment for writing FDT */ + CEDIT_SIZE_INC = 1024, +}; + +/* Name of the cedit node in the devicetree */ +#define CEDIT_NODE_NAME "cedit-values" + +extern struct expo *cur_exp; + +/** + * cedit_arange() - Arrange objects in a configuration-editor scene + * + * @exp: Expo to update + * @vid_priv: Private info of the video device + * @scene_id: scene ID to arrange + * Returns: 0 if OK, -ve on error + */ +int cedit_arange(struct expo *exp, struct video_priv *vid_priv, uint scene_id); + +/** + * cedit_run() - Run a configuration editor + * + * This accepts input until the user quits with Escape + * + * @exp: Expo to use + * Returns: 0 if OK, -ve on error + */ +int cedit_run(struct expo *exp); + +/** + * cedit_prepare() - Prepare to run a cedit + * + * Set up the video device, select the first scene and highlight the first item. + * This ensures that all menus have a selected item. + * + * @exp: Expo to use + * @vid_privp: Set to private data for the video device + * @scnp: Set to the first scene + * Return: scene ID of first scene if OK, -ve on error + */ +int cedit_prepare(struct expo *exp, struct video_priv **vid_privp, + struct scene **scnp); + +/** + * cedit_write_settings() - Write settings in FDT format + * + * Sets up an FDT with the settings + * + * @exp: Expo to write settings from + * @buf: Returns abuf containing the settings FDT (inited by this function) + * Return: 0 if OK, -ve on error + */ +int cedit_write_settings(struct expo *exp, struct abuf *buf); + +/** + * cedit_read_settings() - Read settings in FDT format + * + * Read an FDT with the settings + * + * @exp: Expo to read settings into + * @tree: Tree to read from + * Return: 0 if OK, -ve on error + */ +int cedit_read_settings(struct expo *exp, oftree tree); + +/** + * cedit_write_settings_env() - Write settings to envrionment variables + * + * @exp: Expo to write settings from + * @verbose: true to print each var as it is set + * Return: 0 if OK, -ve on error + */ +int cedit_write_settings_env(struct expo *exp, bool verbose); + +/* + * cedit_read_settings_env() - Read settings from the environment + * + * @exp: Expo to read settings into + * @verbose: true to print each var before it is read + */ +int cedit_read_settings_env(struct expo *exp, bool verbose); + +/** + * cedit_write_settings_cmos() - Write settings to CMOS RAM + * + * Write settings to the defined places in CMOS RAM + * + * @exp: Expo to write settings from + * @dev: UCLASS_RTC device containing space for this information + * Returns 0 if OK, -ve on error + * @verbose: true to print a summary at the end + */ +int cedit_write_settings_cmos(struct expo *exp, struct udevice *dev, + bool verbose); + +/** + * cedit_read_settings_cmos() - Read settings from CMOS RAM + * + * Read settings from the defined places in CMO RAM + * + * @exp: Expo to read settings into + * @dev: RTC device to read settings from + * @verbose: true to print a summary at the end + */ +int cedit_read_settings_cmos(struct expo *exp, struct udevice *dev, + bool verbose); + +#endif /* __CEDIT_H */ diff --git a/include/command.h b/include/command.h index c4e3170967d..ae7bb4a30b0 100644 --- a/include/command.h +++ b/include/command.h @@ -318,24 +318,6 @@ int cmd_source_script(ulong addr, const char *fit_uname, const char *confname); # define _CMD_HELP(x) #endif -#ifdef CONFIG_NEEDS_MANUAL_RELOC -#define U_BOOT_SUBCMDS_RELOC(_cmdname) \ - static void _cmdname##_subcmds_reloc(void) \ - { \ - static int relocated; \ - \ - if (relocated) \ - return; \ - \ - fixup_cmdtable(_cmdname##_subcmds, \ - ARRAY_SIZE(_cmdname##_subcmds)); \ - relocated = 1; \ - } -#else -#define U_BOOT_SUBCMDS_RELOC(_cmdname) \ - static void _cmdname##_subcmds_reloc(void) { } -#endif - #define U_BOOT_SUBCMDS_DO_CMD(_cmdname) \ static int do_##_cmdname(struct cmd_tbl *cmdtp, int flag, \ int argc, char *const argv[], \ @@ -343,8 +325,6 @@ int cmd_source_script(ulong addr, const char *fit_uname, const char *confname); { \ struct cmd_tbl *subcmd; \ \ - _cmdname##_subcmds_reloc(); \ - \ /* We need at least the cmd and subcmd names. */ \ if (argc < 2 || argc > CONFIG_SYS_MAXARGS) \ return CMD_RET_USAGE; \ @@ -379,7 +359,6 @@ int cmd_source_script(ulong addr, const char *fit_uname, const char *confname); #define U_BOOT_SUBCMDS(_cmdname, ...) \ static struct cmd_tbl _cmdname##_subcmds[] = { __VA_ARGS__ }; \ - U_BOOT_SUBCMDS_RELOC(_cmdname) \ U_BOOT_SUBCMDS_DO_CMD(_cmdname) \ U_BOOT_SUBCMDS_COMPLETE(_cmdname) diff --git a/include/common.h b/include/common.h index 25c317f4439..a79c2bb4993 100644 --- a/include/common.h +++ b/include/common.h @@ -17,7 +17,6 @@ #include <errno.h> #include <time.h> #include <linux/types.h> -#include <linux/printk.h> #include <linux/string.h> #include <stdarg.h> #include <stdio.h> diff --git a/include/configs/am62x_evm.h b/include/configs/am62x_evm.h index 44180dc7687..c8fe59b7531 100644 --- a/include/configs/am62x_evm.h +++ b/include/configs/am62x_evm.h @@ -9,12 +9,6 @@ #ifndef __CONFIG_AM625_EVM_H #define __CONFIG_AM625_EVM_H -#include <config_distro_bootcmd.h> -#include <env/ti/mmc.h> - -/* DDR Configuration */ -#define CFG_SYS_SDRAM_BASE1 0x880000000 - /* Now for the remaining common defines */ #include <configs/ti_armv7_common.h> diff --git a/include/configs/gardena-smart-gateway-mt7688.h b/include/configs/gardena-smart-gateway-mt7688.h index 0ba4efe67ac..1b97ae22fc6 100644 --- a/include/configs/gardena-smart-gateway-mt7688.h +++ b/include/configs/gardena-smart-gateway-mt7688.h @@ -11,10 +11,6 @@ #define CFG_SYS_INIT_SP_OFFSET 0x400000 -/* SPL */ - -#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE - /* Dummy value */ #define CFG_SYS_UBOOT_BASE 0 diff --git a/include/configs/imxrt1020-evk.h b/include/configs/imxrt1020-evk.h index e180387c687..cd6af93454b 100644 --- a/include/configs/imxrt1020-evk.h +++ b/include/configs/imxrt1020-evk.h @@ -18,10 +18,4 @@ #define DMAMEM_BASE (PHYS_SDRAM + PHYS_SDRAM_SIZE - \ DMAMEM_SZ_ALL) -/* - * Configuration of the external SDRAM memory - */ - -#define CFG_SYS_UBOOT_START 0x800023FD - #endif /* __IMXRT1020_EVK_H */ diff --git a/include/configs/imxrt1050-evk.h b/include/configs/imxrt1050-evk.h index 7688464841e..2af2dde2aea 100644 --- a/include/configs/imxrt1050-evk.h +++ b/include/configs/imxrt1050-evk.h @@ -25,10 +25,4 @@ "stderr=serial,vidconsole\0" #endif -/* - * Configuration of the external SDRAM memory - */ - -#define CFG_SYS_UBOOT_START 0x800023FD - #endif /* __IMXRT1050_EVK_H */ diff --git a/include/configs/imxrt1170-evk.h b/include/configs/imxrt1170-evk.h index f83429082ac..1ccaa15bc11 100644 --- a/include/configs/imxrt1170-evk.h +++ b/include/configs/imxrt1170-evk.h @@ -22,8 +22,5 @@ #define DMAMEM_SZ_ALL (1 * 1024 * 1024) #define DMAMEM_BASE (PHYS_SDRAM + PHYS_SDRAM_SIZE - \ DMAMEM_SZ_ALL) -/* For SPL */ -#define CFG_SYS_UBOOT_START 0x202403FD -/* For SPL ends */ #endif /* __IMXRT1170_EVK_H */ diff --git a/include/configs/linkit-smart-7688.h b/include/configs/linkit-smart-7688.h index f16c7e91221..e8f7a59c401 100644 --- a/include/configs/linkit-smart-7688.h +++ b/include/configs/linkit-smart-7688.h @@ -11,10 +11,6 @@ #define CFG_SYS_INIT_SP_OFFSET 0x400000 -/* SPL */ - -#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE - /* Dummy value */ #define CFG_SYS_UBOOT_BASE 0 diff --git a/include/configs/mt7620.h b/include/configs/mt7620.h index d69d35fa96c..3bc0c18a1e5 100644 --- a/include/configs/mt7620.h +++ b/include/configs/mt7620.h @@ -12,9 +12,6 @@ #define CFG_SYS_INIT_SP_OFFSET 0x400000 -/* SPL */ -#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE - /* Dummy value */ #define CFG_SYS_UBOOT_BASE 0 diff --git a/include/configs/mt7628.h b/include/configs/mt7628.h index 0ac376d33ca..1df06811d65 100644 --- a/include/configs/mt7628.h +++ b/include/configs/mt7628.h @@ -22,9 +22,6 @@ #define CFG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, \ 230400, 460800, 921600 } -/* SPL */ -#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE - /* Dummy value */ #define CFG_SYS_UBOOT_BASE 0 diff --git a/include/configs/mt8512.h b/include/configs/mt8512.h index c0fc8688ca6..4e70291e943 100644 --- a/include/configs/mt8512.h +++ b/include/configs/mt8512.h @@ -10,8 +10,6 @@ #define __MT8512_H /* Uboot definition */ -#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE - #define ENV_BOOT_READ_IMAGE \ "boot_rd_img=mmc dev 0" \ ";mmc read ${loadaddr} 0x27000 0x8000" \ diff --git a/include/configs/sama5d29_curiosity.h b/include/configs/sama5d29_curiosity.h new file mode 100644 index 00000000000..ef09b8b25bc --- /dev/null +++ b/include/configs/sama5d29_curiosity.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Configuration file for the SAMA5D29 CURIOSITY board. + * + * Copyright (C) 2023 Microchip Technology Inc. and its subsidiaries + * + * Author: Mihai Sain <mihai.sain@microchip.com> + * + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CFG_SYS_AT91_SLOW_CLOCK 32768 +#define CFG_SYS_AT91_MAIN_CLOCK 24000000 + +#endif diff --git a/include/configs/starfive-visionfive2.h b/include/configs/starfive-visionfive2.h index 4ee02b8420f..ff43113f243 100644 --- a/include/configs/starfive-visionfive2.h +++ b/include/configs/starfive-visionfive2.h @@ -18,6 +18,9 @@ /* Environment options */ #define BOOT_TARGET_DEVICES(func) \ + func(NVME, nvme, 0) \ + func(USB, usb, 0) \ + func(MMC, mmc, 0) \ func(MMC, mmc, 1) \ func(DHCP, dhcp, na) diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h index dbbeff34ba8..4e30d0d2ddf 100644 --- a/include/configs/ti_armv7_common.h +++ b/include/configs/ti_armv7_common.h @@ -200,7 +200,7 @@ #define CFG_EXTRA_ENV_SETTINGS \ BOOTENV -#endif +#endif /* CONFIG_DISTRO_DEFAULTS */ #endif /* CONFIG_ARM64 */ diff --git a/include/configs/verdin-am62.h b/include/configs/verdin-am62.h index 7990ea83102..9d2e37f2d96 100644 --- a/include/configs/verdin-am62.h +++ b/include/configs/verdin-am62.h @@ -13,8 +13,7 @@ /* DDR Configuration */ #define CFG_SYS_SDRAM_BASE 0x80000000 -#define CFG_SYS_SDRAM_BASE1 0x880000000 -#define CFG_SYS_SDRAM_SIZE SZ_2G /* Maximum supported size */ +#define CFG_SYS_SDRAM_SIZE SZ_2G /* Maximum supported size, auto-detection is used */ #define MEM_LAYOUT_ENV_SETTINGS \ "fdt_addr_r=0x90200000\0" \ @@ -46,10 +45,20 @@ "fdt_board=dev\0" \ "setup=setenv setupargs console=tty1 console=${console},${baudrate} " \ "consoleblank=0 earlycon=ns16550a,mmio32,0x02800000\0" \ - "update_uboot=askenv confirm Did you load flash.bin (y/N)?; " \ + "update_tiboot3=askenv confirm Did you load tiboot3.bin (y/N)?; " \ "if test \"$confirm\" = \"y\"; then " \ "setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \ "${blkcnt} / 0x200; mmc dev 0 1; mmc write ${loadaddr} 0x0 " \ + "${blkcnt}; fi\0" \ + "update_tispl=askenv confirm Did you load tispl.bin (y/N)?; " \ + "if test \"$confirm\" = \"y\"; then " \ + "setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \ + "${blkcnt} / 0x200; mmc dev 0 1; mmc write ${loadaddr} 0x400 " \ + "${blkcnt}; fi\0" \ + "update_uboot=askenv confirm Did you load u-boot.img (y/N)?; " \ + "if test \"$confirm\" = \"y\"; then " \ + "setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \ + "${blkcnt} / 0x200; mmc dev 0 1; mmc write ${loadaddr} 0x1400 " \ "${blkcnt}; fi\0" #endif /* __VERDIN_AM62_H */ diff --git a/include/configs/vocore2.h b/include/configs/vocore2.h index 43050d61c37..eb876336616 100644 --- a/include/configs/vocore2.h +++ b/include/configs/vocore2.h @@ -11,10 +11,6 @@ #define CFG_SYS_INIT_SP_OFFSET 0x400000 -/* SPL */ - -#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE - /* Dummy value */ #define CFG_SYS_UBOOT_BASE 0 diff --git a/include/configs/xilinx_versal.h b/include/configs/xilinx_versal.h index a403999977e..b634bb1ab70 100644 --- a/include/configs/xilinx_versal.h +++ b/include/configs/xilinx_versal.h @@ -40,10 +40,11 @@ "kernel_size_r=0x10000000\0" \ "kernel_comp_addr_r=0x30000000\0" \ "kernel_comp_size=0x3C00000\0" \ - "scriptaddr=0x20000000\0" \ "ramdisk_addr_r=0x02100000\0" \ "script_size_f=0x80000\0" +#if defined(CONFIG_DISTRO_DEFAULTS) + #if defined(CONFIG_MMC_SDHCI_ZYNQ) # define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1) #else @@ -125,6 +126,10 @@ #include <config_distro_bootcmd.h> +#else /* CONFIG_DISTRO_DEFAULTS */ +# define BOOTENV +#endif /* CONFIG_DISTRO_DEFAULTS */ + /* Initial environment variables */ #ifndef CFG_EXTRA_ENV_SETTINGS #define CFG_EXTRA_ENV_SETTINGS \ diff --git a/include/configs/xilinx_versal_net.h b/include/configs/xilinx_versal_net.h index 613cce46f90..2b441da91a1 100644 --- a/include/configs/xilinx_versal_net.h +++ b/include/configs/xilinx_versal_net.h @@ -54,10 +54,11 @@ "kernel_size_r=0x10000000\0" \ "kernel_comp_addr_r=0x30000000\0" \ "kernel_comp_size=0x3C00000\0" \ - "scriptaddr=0x20000000\0" \ "ramdisk_addr_r=0x02100000\0" \ "script_size_f=0x80000\0" +#if defined(CONFIG_DISTRO_DEFAULTS) + #if defined(CONFIG_MMC_SDHCI_ZYNQ) # define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1) #else @@ -126,6 +127,10 @@ #include <config_distro_bootcmd.h> +#else /* CONFIG_DISTRO_DEFAULTS */ +# define BOOTENV +#endif /* CONFIG_DISTRO_DEFAULTS */ + /* Initial environment variables */ #ifndef CFG_EXTRA_ENV_SETTINGS #define CFG_EXTRA_ENV_SETTINGS \ diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h index 74264b7bee8..5bc117e1900 100644 --- a/include/configs/xilinx_zynqmp.h +++ b/include/configs/xilinx_zynqmp.h @@ -29,7 +29,7 @@ /* Miscellaneous configurable options */ -#if defined(CONFIG_ZYNQMP_USB) +#if defined(CONFIG_USB_STORAGE) #define DFU_DEFAULT_POLL_TIMEOUT 300 # define PARTS_DEFAULT \ @@ -57,13 +57,14 @@ "kernel_size_r=0x10000000\0" \ "kernel_comp_addr_r=0x30000000\0" \ "kernel_comp_size=0x3C00000\0" \ - "scriptaddr=0x20000000\0" \ "ramdisk_addr_r=0x02100000\0" \ "script_size_f=0x80000\0" \ "stdin=serial\0" \ "stdout=serial,vidconsole\0" \ "stderr=serial,vidconsole\0" \ +#if defined(CONFIG_DISTRO_DEFAULTS) + #if defined(CONFIG_MMC_SDHCI_ZYNQ) # define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1) #else @@ -76,7 +77,7 @@ # define BOOT_TARGET_DEVICES_SCSI(func) #endif -#if defined(CONFIG_ZYNQMP_USB) +#if defined(CONFIG_USB_STORAGE) # define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) func(USB, usb, 1) #else # define BOOT_TARGET_DEVICES_USB(func) @@ -175,6 +176,10 @@ #include <config_distro_bootcmd.h> +#else /* CONFIG_DISTRO_DEFAULTS */ +# define BOOTENV +#endif /* CONFIG_DISTRO_DEFAULTS */ + /* Initial environment variables */ #ifndef CFG_EXTRA_ENV_SETTINGS #define CFG_EXTRA_ENV_SETTINGS \ diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h index e372e903170..553bb1b45b6 100644 --- a/include/configs/zynq-common.h +++ b/include/configs/zynq-common.h @@ -172,12 +172,10 @@ /* Default environment */ #ifndef CFG_EXTRA_ENV_SETTINGS #define CFG_EXTRA_ENV_SETTINGS \ - "scriptaddr=0x20000\0" \ "script_size_f=0x40000\0" \ "fdt_addr_r=0x1f00000\0" \ "pxefile_addr_r=0x2000000\0" \ "kernel_addr_r=0x2000000\0" \ - "scriptaddr=0x3000000\0" \ "ramdisk_addr_r=0x3100000\0" \ BOOTENV #endif diff --git a/include/crypto/pkcs7_parser.h b/include/crypto/pkcs7_parser.h index 906033a90eb..2c45cce5234 100644 --- a/include/crypto/pkcs7_parser.h +++ b/include/crypto/pkcs7_parser.h @@ -11,6 +11,7 @@ #include <linux/oid_registry.h> #include <crypto/pkcs7.h> #include <crypto/x509_parser.h> +#include <linux/printk.h> #define kenter(FMT, ...) \ pr_devel("==> %s("FMT")\n", __func__, ##__VA_ARGS__) diff --git a/include/dm/device_compat.h b/include/dm/device_compat.h index 82d7a7d4924..aa9a6fbb5e3 100644 --- a/include/dm/device_compat.h +++ b/include/dm/device_compat.h @@ -14,6 +14,7 @@ #include <log.h> #include <linux/build_bug.h> #include <linux/compat.h> +#include <linux/printk.h> /* * Define a new identifier which can be tested on by C code. A similar diff --git a/include/dm/of_access.h b/include/dm/of_access.h index c556a18f7d9..9361d0a87bf 100644 --- a/include/dm/of_access.h +++ b/include/dm/of_access.h @@ -334,6 +334,25 @@ int of_read_u32_index(const struct device_node *np, const char *propname, int index, u32 *outp); /** + * of_read_u64_index() - Find and read a 64-bit value from a multi-value + * property + * + * @np: device node from which the property value is to be read. + * @propname: name of the property to be searched. + * @index: index of the u32 in the list of values + * @outp: pointer to return value, modified only if return value is 0. + * + * Search for a property in a device node and read a 64-bit value from + * it. + * + * Return: + * 0 on success, -EINVAL if the property does not exist, or -EOVERFLOW if the + * property data isn't large enough. + */ +int of_read_u64_index(const struct device_node *np, const char *propname, + int index, u64 *outp); + +/** * of_read_u64() - Find and read a 64-bit integer from a property * * Search for a property in a device node and read a 64-bit value from diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 0f38b3e736d..06c969c61fe 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -20,6 +20,7 @@ struct resource; #include <dm/ofnode_decl.h> +#include <linux/errno.h> struct ofnode_phandle_args { ofnode node; @@ -435,6 +436,18 @@ int ofnode_read_u32_index(ofnode node, const char *propname, int index, u32 *outp); /** + * ofnode_read_u64_index() - Read a 64-bit integer from a multi-value property + * + * @node: valid node reference to read property from + * @propname: name of the property to read from + * @index: index of the integer to return + * @outp: place to put value (if found) + * Return: 0 if OK, -ve on error + */ +int ofnode_read_u64_index(ofnode node, const char *propname, int index, + u64 *outp); + +/** * ofnode_read_s32() - Read a 32-bit integer from a property * * @node: valid node reference to read property from @@ -1198,15 +1211,15 @@ int ofnode_read_simple_size_cells(ofnode node); * determine if a node was bound in one of SPL/TPL stages. * * There are 4 settings currently in use - * - bootph-some-ram: U-Boot proper pre-relocation only + * - bootph-some-ram: U-Boot proper pre-relocation phase * - bootph-all: all phases * Existing platforms only use it to indicate nodes needed in * SPL. Should probably be replaced by bootph-pre-ram for new platforms. - * - bootph-pre-ram: SPL and U-Boot pre-relocation - * - bootph-pre-sram: TPL and U-Boot pre-relocation + * - bootph-pre-ram: SPL phase + * - bootph-pre-sram: TPL phase * * @node: node to check - * Return: true if node is needed in SPL/TL, false otherwise + * Return: true if node should be or was bound, false otherwise */ bool ofnode_pre_reloc(ofnode node); @@ -1500,6 +1513,47 @@ int ofnode_conf_read_int(const char *prop_name, int default_val); */ const char *ofnode_conf_read_str(const char *prop_name); +/** + * ofnode_read_bootscript_address() - Read bootscr-address or bootscr-ram-offset + * + * @bootscr_address: pointer to 64bit address where bootscr-address property value + * is stored + * @bootscr_offset: pointer to 64bit offset address where bootscr-ram-offset + * property value is stored + * + * This reads a bootscr-address or bootscr-ram-offset property from + * the /options/u-boot/ node of the devicetree. bootscr-address holds the full + * address of the boot script file. bootscr-ram-offset holds the boot script + * file offset from the start of the ram base address. When bootscr-address is + * defined, bootscr-ram-offset property is ignored. + * + * This only works with the control FDT. + * + * Return: 0 if OK, -EINVAL if property is not found. + */ +int ofnode_read_bootscript_address(u64 *bootscr_address, u64 *bootscr_offset); + +/** + * ofnode_read_bootscript_flash() - Read bootscr-flash-offset/size + * + * @bootscr_flash_offset: pointer to 64bit offset where bootscr-flash-offset + * property value is stored + * @bootscr_flash_size: pointer to 64bit size where bootscr-flash-size property + * value is stored + * + * This reads a bootscr-flash-offset and bootscr-flash-size properties from + * the /options/u-boot/ node of the devicetree. bootscr-flash-offset holds + * the offset of the boot script file from start of flash. bootscr-flash-size + * holds the boot script size in flash. When bootscr-flash-size is not defined, + * bootscr-flash-offset property is cleaned. + * + * This only works with the control FDT. + * + * Return: 0 if OK, -EINVAL if property is not found or incorrect. + */ +int ofnode_read_bootscript_flash(u64 *bootscr_flash_offset, + u64 *bootscr_flash_size); + #else /* CONFIG_DM */ static inline bool ofnode_conf_read_bool(const char *prop_name) { @@ -1516,6 +1570,17 @@ static inline const char *ofnode_conf_read_str(const char *prop_name) return NULL; } +static inline int ofnode_read_bootscript_address(u64 *bootscr_address, u64 *bootscr_offset) +{ + return -EINVAL; +} + +static inline int ofnode_read_bootscript_flash(u64 *bootscr_flash_offset, + u64 *bootscr_flash_size) +{ + return -EINVAL; +} + #endif /* CONFIG_DM */ /** diff --git a/include/dm/util.h b/include/dm/util.h index 4bb49e9e8c0..89206cc4966 100644 --- a/include/dm/util.h +++ b/include/dm/util.h @@ -27,14 +27,21 @@ struct list_head; int list_count_items(struct list_head *head); /** - * Dump out a tree of all devices + * Dump out a tree of all devices starting @uclass * + * @dev_name: udevice name + * @extended: true if forword-matching expected * @sort: Sort by uclass name */ -void dm_dump_tree(bool sort); +void dm_dump_tree(char *dev_name, bool extended, bool sort); -/* Dump out a list of uclasses and their devices */ -void dm_dump_uclass(void); +/* + * Dump out a list of uclasses and their devices + * + * @uclass: uclass name + * @extended: true if forword-matching expected + */ +void dm_dump_uclass(char *uclass, bool extended); #ifdef CONFIG_DEBUG_DEVRES /* Dump out a list of device resources */ diff --git a/include/dt-bindings/mux/ti-serdes.h b/include/dt-bindings/mux/ti-serdes.h index d3116c52ab7..b0b1091aad6 100644 --- a/include/dt-bindings/mux/ti-serdes.h +++ b/include/dt-bindings/mux/ti-serdes.h @@ -6,6 +6,14 @@ #ifndef _DT_BINDINGS_MUX_TI_SERDES #define _DT_BINDINGS_MUX_TI_SERDES +/* + * These bindings are deprecated, because they do not match the actual + * concept of bindings but rather contain pure constants values used only + * in DTS board files. + * Instead include the header in the DTS source directory. + */ +#warning "These bindings are deprecated. Instead, use the header in the DTS source directory." + /* J721E */ #define J721E_SERDES0_LANE0_QSGMII_LANE1 0x0 @@ -117,4 +125,66 @@ #define J721S2_SERDES0_LANE3_USB 0x2 #define J721S2_SERDES0_LANE3_IP4_UNUSED 0x3 +/* J784S4 */ + +#define J784S4_SERDES0_LANE0_IP1_UNUSED 0x0 +#define J784S4_SERDES0_LANE0_PCIE1_LANE0 0x1 +#define J784S4_SERDES0_LANE0_IP3_UNUSED 0x2 +#define J784S4_SERDES0_LANE0_IP4_UNUSED 0x3 + +#define J784S4_SERDES0_LANE1_IP1_UNUSED 0x0 +#define J784S4_SERDES0_LANE1_PCIE1_LANE1 0x1 +#define J784S4_SERDES0_LANE1_IP3_UNUSED 0x2 +#define J784S4_SERDES0_LANE1_IP4_UNUSED 0x3 + +#define J784S4_SERDES0_LANE2_PCIE3_LANE0 0x0 +#define J784S4_SERDES0_LANE2_PCIE1_LANE2 0x1 +#define J784S4_SERDES0_LANE2_IP3_UNUSED 0x2 +#define J784S4_SERDES0_LANE2_IP4_UNUSED 0x3 + +#define J784S4_SERDES0_LANE3_PCIE3_LANE1 0x0 +#define J784S4_SERDES0_LANE3_PCIE1_LANE3 0x1 +#define J784S4_SERDES0_LANE3_USB 0x2 +#define J784S4_SERDES0_LANE3_IP4_UNUSED 0x3 + +#define J784S4_SERDES1_LANE0_QSGMII_LANE3 0x0 +#define J784S4_SERDES1_LANE0_PCIE0_LANE0 0x1 +#define J784S4_SERDES1_LANE0_IP3_UNUSED 0x2 +#define J784S4_SERDES1_LANE0_IP4_UNUSED 0x3 + +#define J784S4_SERDES1_LANE1_QSGMII_LANE4 0x0 +#define J784S4_SERDES1_LANE1_PCIE0_LANE1 0x1 +#define J784S4_SERDES1_LANE1_IP3_UNUSED 0x2 +#define J784S4_SERDES1_LANE1_IP4_UNUSED 0x3 + +#define J784S4_SERDES1_LANE2_QSGMII_LANE1 0x0 +#define J784S4_SERDES1_LANE2_PCIE0_LANE2 0x1 +#define J784S4_SERDES1_LANE2_PCIE2_LANE0 0x2 +#define J784S4_SERDES1_LANE2_IP4_UNUSED 0x3 + +#define J784S4_SERDES1_LANE3_QSGMII_LANE2 0x0 +#define J784S4_SERDES1_LANE3_PCIE0_LANE3 0x1 +#define J784S4_SERDES1_LANE3_PCIE2_LANE1 0x2 +#define J784S4_SERDES1_LANE3_IP4_UNUSED 0x3 + +#define J784S4_SERDES2_LANE0_QSGMII_LANE5 0x0 +#define J784S4_SERDES2_LANE0_IP2_UNUSED 0x1 +#define J784S4_SERDES2_LANE0_IP3_UNUSED 0x2 +#define J784S4_SERDES2_LANE0_IP4_UNUSED 0x3 + +#define J784S4_SERDES2_LANE1_QSGMII_LANE6 0x0 +#define J784S4_SERDES2_LANE1_IP2_UNUSED 0x1 +#define J784S4_SERDES2_LANE1_IP3_UNUSED 0x2 +#define J784S4_SERDES2_LANE1_IP4_UNUSED 0x3 + +#define J784S4_SERDES2_LANE2_QSGMII_LANE7 0x0 +#define J784S4_SERDES2_LANE2_QSGMII_LANE1 0x1 +#define J784S4_SERDES2_LANE2_IP3_UNUSED 0x2 +#define J784S4_SERDES2_LANE2_IP4_UNUSED 0x3 + +#define J784S4_SERDES2_LANE3_QSGMII_LANE8 0x0 +#define J784S4_SERDES2_LANE3_QSGMII_LANE2 0x1 +#define J784S4_SERDES2_LANE3_IP3_UNUSED 0x2 +#define J784S4_SERDES2_LANE3_IP4_UNUSED 0x3 + #endif /* _DT_BINDINGS_MUX_TI_SERDES */ diff --git a/include/dwc3-omap-uboot.h b/include/dwc3-omap-uboot.h index 7c982e3798b..9e0e717dc98 100644 --- a/include/dwc3-omap-uboot.h +++ b/include/dwc3-omap-uboot.h @@ -27,5 +27,5 @@ struct dwc3_omap_device { int dwc3_omap_uboot_init(struct dwc3_omap_device *dev); void dwc3_omap_uboot_exit(int index); -int dwc3_omap_uboot_interrupt_status(int index); +int dwc3_omap_uboot_interrupt_status(struct udevice *dev); #endif /* __DWC3_OMAP_UBOOT_H_ */ diff --git a/include/dwc3-uboot.h b/include/dwc3-uboot.h index e08530ec4e5..bb0436c0973 100644 --- a/include/dwc3-uboot.h +++ b/include/dwc3-uboot.h @@ -44,7 +44,7 @@ struct dwc3_device { int dwc3_uboot_init(struct dwc3_device *dev); void dwc3_uboot_exit(int index); -void dwc3_uboot_handle_interrupt(int index); +void dwc3_uboot_handle_interrupt(struct udevice *dev); struct phy; #if CONFIG_IS_ENABLED(PHY) && CONFIG_IS_ENABLED(DM_USB) diff --git a/include/env.h b/include/env.h index 1480efa59e3..430c4fa94a4 100644 --- a/include/env.h +++ b/include/env.h @@ -240,11 +240,6 @@ int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr); int eth_env_set_enetaddr(const char *name, const uint8_t *enetaddr); /** - * env_fix_drivers() - Updates envdriver as per relocation - */ -void env_fix_drivers(void); - -/** * env_set_default_vars() - reset variables to their default value * * This resets individual variables to their value in the default environment @@ -357,14 +352,6 @@ char *env_get_default(const char *name); void env_set_default(const char *s, int flags); /** - * env_reloc() - Relocate the 'env' sub-commands - * - * This is used for those unfortunate archs with crappy toolchains - */ -void env_reloc(void); - - -/** * env_import_fdt() - Import environment values from device tree blob * * This uses the value of the environment variable "env_fdt_path" as a diff --git a/include/env/ti/default_findfdt.env b/include/env/ti/default_findfdt.env new file mode 100644 index 00000000000..a2b51dd923b --- /dev/null +++ b/include/env/ti/default_findfdt.env @@ -0,0 +1,12 @@ +default_device_tree=CONFIG_DEFAULT_DEVICE_TREE +default_device_tree_arch=ti +#ifdef CONFIG_ARM64 +findfdt= + setenv name_fdt ${default_device_tree_arch}/${default_device_tree}.dtb; + setenv fdtfile ${name_fdt} +#else +default_device_tree_subarch=omap +findfdt= + setenv name_fdt ${default_device_tree_arch}/${default_device_tree_subarch}/${default_device_tree}.dtb; + setenv fdtfile ${name_fdt} +#endif diff --git a/include/env/ti/mmc.env b/include/env/ti/mmc.env index 6fb47fb2667..0256a2d2aac 100644 --- a/include/env/ti/mmc.env +++ b/include/env/ti/mmc.env @@ -5,7 +5,9 @@ args_mmc=run finduuid;setenv bootargs console=${console} ${optargs} root=PARTUUID=${uuid} rw rootfstype=${mmcrootfstype} +#ifndef CONFIG_BOOTSTD loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr +#endif bootscript=echo Running bootscript from mmc${mmcdev} ...; source ${loadaddr} bootenvfile=uEnv.txt @@ -15,10 +17,10 @@ loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile} loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile} loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile} get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${name_fdt} -envboot=mmc dev ${mmcdev}; +envboot=if mmc dev ${mmcdev}; then if mmc rescan; then echo SD/MMC found on device ${mmcdev}; - if run loadbootscript; then + if test -n "${loadbootscript}" && run loadbootscript; then run bootscript; else if run loadbootenv; then @@ -31,6 +33,7 @@ envboot=mmc dev ${mmcdev}; fi; fi; fi; + fi; mmcloados= if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run get_fdt_mmc; then @@ -45,7 +48,7 @@ mmcloados= else bootz; fi; -mmcboot=mmc dev ${mmcdev}; +mmcboot=if mmc dev ${mmcdev}; then devnum=${mmcdev}; devtype=mmc; if mmc rescan; then @@ -58,7 +61,8 @@ mmcboot=mmc dev ${mmcdev}; run mmcloados; fi; fi; -fi; + fi; + fi; init_mmc=run args_all args_mmc get_overlay_mmc= diff --git a/include/env/ti/ti_armv7_common.env b/include/env/ti/ti_common.env index f5d84216e3c..f5d84216e3c 100644 --- a/include/env/ti/ti_armv7_common.env +++ b/include/env/ti/ti_common.env diff --git a/include/event.h b/include/event.h index f5c5d30a645..be4cefd6ae8 100644 --- a/include/event.h +++ b/include/event.h @@ -95,6 +95,28 @@ enum event_t { EVT_MISC_INIT_F, /** + * @EVT_FSP_INIT_F: + * This event is triggered before relocation to set up Firmware Support + * Package. + * Where U-Boot relies on binary blobs to handle part of the system + * init, this event can be used to set up the blobs. This is used on + * some Intel platforms + */ + EVT_FSP_INIT_F, + + /** + * @EVT_LAST_STAGE_INIT: + * This event is triggered just before jumping to the main loop. + * Some boards need to perform initialisation immediately before control + * is passed to the command-line interpreter (e.g. for init that depend + * on later phases in the init sequence). + * + * Some parts can be only initialized if all others (like Interrupts) + * are up and running (e.g. the PC-style ISA keyboard). + */ + EVT_LAST_STAGE_INIT, + + /** * @EVT_FPGA_LOAD: * The FPGA load hook is called after loading an FPGA with a new binary. * Its parameter is of type struct event_fpga_load and contains @@ -185,19 +207,48 @@ struct event { union event_data data; }; +/* Flags for event spy */ +enum evspy_flags { + EVSPYF_SIMPLE = 1 << 0, +}; + /** Function type for event handlers */ typedef int (*event_handler_t)(void *ctx, struct event *event); +/** Function type for simple event handlers */ +typedef int (*event_handler_simple_t)(void); + /** * struct evspy_info - information about an event spy * * @func: Function to call when the event is activated (must be first) * @type: Event type + * @flags: Flags for this spy * @id: Event id string */ struct evspy_info { event_handler_t func; - enum event_t type; + u8 type; + u8 flags; +#if CONFIG_IS_ENABLED(EVENT_DEBUG) + const char *id; +#endif +}; + +/** + * struct evspy_info_simple - information about an event spy + * + * THis is the 'simple' record, the only difference being the handler function + * + * @func: Function to call when the event is activated (must be first) + * @type: Event type + * @flags: Flags for this spy + * @id: Event id string + */ +struct evspy_info_simple { + event_handler_simple_t func; + u8 type; + u8 flags; #if CONFIG_IS_ENABLED(EVENT_DEBUG) const char *id; #endif @@ -205,9 +256,11 @@ struct evspy_info { /* Declare a new event spy */ #if CONFIG_IS_ENABLED(EVENT_DEBUG) -#define _ESPY_REC(_type, _func) { _func, _type, #_func, } +#define _ESPY_REC(_type, _func) { _func, _type, 0, #_func, } +#define _ESPY_REC_SIMPLE(_type, _func) { _func, _type, EVSPYF_SIMPLE, #_func, } #else #define _ESPY_REC(_type, _func) { _func, _type, } +#define _ESPY_REC_SIMPLE(_type, _func) { _func, _type, EVSPYF_SIMPLE } #endif static inline const char *event_spy_id(struct evspy_info *spy) @@ -250,10 +303,16 @@ static inline const char *event_spy_id(struct evspy_info *spy) * away the linker-list entry sometimes, e.g. with the EVT_FT_FIXUP entry in * vbe_simple.c - so for now, make it global. */ -#define EVENT_SPY(_type, _func) \ +#define EVENT_SPY_FULL(_type, _func) \ __used ll_entry_declare(struct evspy_info, _type ## _3_ ## _func, \ evspy_info) = _ESPY_REC(_type, _func) +/* Simple spy with no function arguemnts */ +#define EVENT_SPY_SIMPLE(_type, _func) \ + __used ll_entry_declare(struct evspy_info_simple, \ + _type ## _3_ ## _func, \ + evspy_info) = _ESPY_REC_SIMPLE(_type, _func) + /** * event_register - register a new spy * @@ -270,14 +329,12 @@ int event_register(const char *id, enum event_t type, event_handler_t func, void event_show_spy_list(void); /** - * event_manual_reloc() - Relocate event handler pointers - * - * Relocate event handler pointers for all static event spies. It is called - * during the generic board init sequence, after relocation. + * event_type_name() - Get the name of an event type * - * Return: 0 if OK + * @type: Type to check + * Return: Name of event, or "(unknown)" if not known */ -int event_manual_reloc(void); +const char *event_type_name(enum event_t type); /** * event_notify() - notify spies about an event diff --git a/include/expo.h b/include/expo.h index e8f7d7d6ffb..9d2e817eb97 100644 --- a/include/expo.h +++ b/include/expo.h @@ -4,14 +4,13 @@ * Written by Simon Glass <sjg@chromium.org> */ -#ifndef __SCENE_H -#define __SCENE_H +#ifndef __EXPO_H +#define __EXPO_H #include <dm/ofnode_decl.h> #include <linux/list.h> struct udevice; -struct video_priv; /** * enum expoact_type - types of actions reported by the expo @@ -188,6 +187,8 @@ enum scene_obj_flags_t { * @type: Type of this object * @dim: Dimensions for this object * @flags: Flags for this object + * @bit_length: Number of bits used for this object in CMOS RAM + * @start_bit: Start bit to use for this object in CMOS RAM * @sibling: Node to link this object to its siblings */ struct scene_obj { @@ -196,7 +197,9 @@ struct scene_obj { uint id; enum scene_obj_t type; struct scene_dim dim; - int flags; + u8 flags; + u8 bit_length; + u16 start_bit; struct list_head sibling; }; @@ -676,24 +679,4 @@ int expo_apply_theme(struct expo *exp, ofnode node); */ int expo_build(ofnode root, struct expo **expp); -/** - * cedit_arange() - Arrange objects in a configuration-editor scene - * - * @exp: Expo to update - * @vid_priv: Private info of the video device - * @scene_id: scene ID to arrange - * Returns: 0 if OK, -ve on error - */ -int cedit_arange(struct expo *exp, struct video_priv *vid_priv, uint scene_id); - -/** - * cedit_run() - Run a configuration editor - * - * This accepts input until the user quits with Escape - * - * @exp: Expo to use - * Returns: 0 if OK, -ve on error - */ -int cedit_run(struct expo *exp); - -#endif /*__SCENE_H */ +#endif /*__EXPO_H */ diff --git a/include/fpga.h b/include/fpga.h index ed688cc0fa3..44f2755a3f1 100644 --- a/include/fpga.h +++ b/include/fpga.h @@ -60,8 +60,16 @@ int fpga_add(fpga_type devtype, void *desc); int fpga_count(void); const fpga_desc *const fpga_get_desc(int devnum); int fpga_is_partial_data(int devnum, size_t img_len); +#if CONFIG_IS_ENABLED(FPGA) int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype, int flags); +#else +static inline int fpga_load(int devnum, const void *buf, size_t bsize, + bitstream_type bstype, int flags) +{ + return FPGA_FAIL; +} +#endif int fpga_fsload(int devnum, const void *buf, size_t size, fpga_fs_info *fpga_fsinfo); int fpga_loads(int devnum, const void *buf, size_t size, diff --git a/include/image.h b/include/image.h index 01a6787d211..5f85bf84a2d 100644 --- a/include/image.h +++ b/include/image.h @@ -231,6 +231,7 @@ enum image_type_t { IH_TYPE_SUNXI_TOC0, /* Allwinner TOC0 Boot Image */ IH_TYPE_FDT_LEGACY, /* Binary Flat Device Tree Blob in a Legacy Image */ IH_TYPE_RENESAS_SPKG, /* Renesas SPKG image */ + IH_TYPE_STARFIVE_SPL, /* StarFive SPL image */ IH_TYPE_COUNT, /* Number of image types */ }; diff --git a/include/init.h b/include/init.h index 3bf30476a2e..4e7fe26c200 100644 --- a/include/init.h +++ b/include/init.h @@ -58,17 +58,6 @@ int arch_cpu_init(void); int mach_cpu_init(void); /** - * arch_fsp_init() - perform firmware support package init - * - * Where U-Boot relies on binary blobs to handle part of the system init, this - * function can be used to set up the blobs. This is used on some Intel - * platforms. - * - * Return: 0 - */ -int arch_fsp_init(void); - -/** * arch_fsp_init() - perform post-relocation firmware support package init * * Where U-Boot relies on binary blobs to handle part of the system init, this @@ -281,15 +270,11 @@ void board_init_r(struct global_data *id, ulong dest_addr) __attribute__ ((noreturn)); int cpu_init_r(void); -int last_stage_init(void); int mac_read_from_eeprom(void); int set_cpu_clk_info(void); int update_flash_size(int flash_size); int arch_early_init_r(void); int misc_init_r(void); -#if defined(CONFIG_VID) -int init_func_vid(void); -#endif /* common/board_info.c */ int checkboard(void); diff --git a/include/initcall.h b/include/initcall.h index 69ce2680705..62d3bb67f08 100644 --- a/include/initcall.h +++ b/include/initcall.h @@ -6,52 +6,33 @@ #ifndef __INITCALL_H #define __INITCALL_H +#include <asm/types.h> +#include <event.h> + +_Static_assert(EVT_COUNT < 256, "Can only support 256 event types with 8 bits"); + +/** + * init_fnc_t - Init function + * + * Return: 0 if OK -ve on error + */ typedef int (*init_fnc_t)(void); -#include <log.h> -#ifdef CONFIG_EFI_APP -#include <efi.h> -#endif -#include <asm/global_data.h> +/* Top bit indicates that the initcall is an event */ +#define INITCALL_IS_EVENT GENMASK(BITS_PER_LONG - 1, 8) +#define INITCALL_EVENT_TYPE GENMASK(7, 0) -/* - * To enable debugging. add #define DEBUG at the top of the including file. +#define INITCALL_EVENT(_type) (void *)((_type) | INITCALL_IS_EVENT) + +/** + * initcall_run_list() - Run through a list of function calls * - * To find a symbol, use grep on u-boot.map + * This calls functions one after the other, stopping at the first error, or + * when NULL is obtained. + * + * @init_sequence: NULL-terminated init sequence to run + * Return: 0 if OK, or -ve error code from the first failure */ -static inline int initcall_run_list(const init_fnc_t init_sequence[]) -{ - const init_fnc_t *init_fnc_ptr; - - for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) { - unsigned long reloc_ofs = 0; - int ret; - - /* - * Sandbox is relocated by the OS, so symbols always appear at - * the relocated address. - */ - if (IS_ENABLED(CONFIG_SANDBOX) || (gd->flags & GD_FLG_RELOC)) - reloc_ofs = gd->reloc_off; -#ifdef CONFIG_EFI_APP - reloc_ofs = (unsigned long)image_base; -#endif - if (reloc_ofs) - debug("initcall: %p (relocated to %p)\n", - (char *)*init_fnc_ptr - reloc_ofs, - (char *)*init_fnc_ptr); - else - debug("initcall: %p\n", (char *)*init_fnc_ptr - reloc_ofs); - - ret = (*init_fnc_ptr)(); - if (ret) { - printf("initcall sequence %p failed at call %p (err=%d)\n", - init_sequence, - (char *)*init_fnc_ptr - reloc_ofs, ret); - return -1; - } - } - return 0; -} +int initcall_run_list(const init_fnc_t init_sequence[]); #endif diff --git a/include/linux/soc/ti/cppi5.h b/include/linux/soc/ti/cppi5.h index cfdf7ea29fc..3a55c3ec46f 100644 --- a/include/linux/soc/ti/cppi5.h +++ b/include/linux/soc/ti/cppi5.h @@ -11,6 +11,7 @@ #include <hexdump.h> #include <linux/bitops.h> #include <linux/bug.h> +#include <linux/printk.h> /** * Descriptor header, present in all types of descriptors diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index b3f4b8d134c..36572be89e6 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -968,23 +968,23 @@ extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, extern void usb_ep_autoconfig_reset(struct usb_gadget *); -extern int usb_gadget_handle_interrupts(int index); +extern int dm_usb_gadget_handle_interrupts(struct udevice *); -#if CONFIG_IS_ENABLED(DM_USB_GADGET) -int usb_gadget_initialize(int index); -int usb_gadget_release(int index); -int dm_usb_gadget_handle_interrupts(struct udevice *dev); -#else -#include <usb.h> -static inline int usb_gadget_initialize(int index) -{ - return board_usb_init(index, USB_INIT_DEVICE); -} +/** + * udc_device_get_by_index() - Get UDC udevice by index + * @index: UDC device index + * @udev: UDC udevice matching the index (if found) + * + * Return: 0 if Ok, -ve on error + */ +int udc_device_get_by_index(int index, struct udevice **udev); -static inline int usb_gadget_release(int index) -{ - return board_usb_cleanup(index, USB_INIT_DEVICE); -} -#endif +/** + * udc_device_put() - Put UDC udevice + * @udev: UDC udevice + * + * Return: 0 if Ok, -ve on error + */ +int udc_device_put(struct udevice *udev); #endif /* __LINUX_USB_GADGET_H */ diff --git a/include/nvmxip.h b/include/nvmxip.h index f4ef37725d2..726fffeb3e8 100644 --- a/include/nvmxip.h +++ b/include/nvmxip.h @@ -29,4 +29,16 @@ struct nvmxip_plat { lbaint_t lba; }; +/** + * nvmxip_bind() - post binding treatments + * @dev: the NVMXIP device + * + * Create and probe a child block device. + * + * Return: + * + * 0 on success. Otherwise, failure + */ +int nvmxip_probe(struct udevice *udev); + #endif /* __DRIVER_NVMXIP_H__ */ diff --git a/include/os.h b/include/os.h index 968412b0a82..fc8a1b15cbf 100644 --- a/include/os.h +++ b/include/os.h @@ -98,6 +98,16 @@ int os_close(int fd); */ int os_unlink(const char *pathname); +/** os_persistent_fname() - Find the path to a test file + * + * @buf: Buffer to hold path + * @maxsize: Maximum size of buffer + * @fname: Leaf filename to find + * Returns: 0 on success, -ENOENT if file is not found, -ENOSPC if the buffer is + * too small + */ +int os_persistent_file(char *buf, int maxsize, const char *fname); + /** * os_exit() - access to the OS exit() system call * diff --git a/include/part.h b/include/part.h index 8e451bbdff9..db34bc6bb7d 100644 --- a/include/part.h +++ b/include/part.h @@ -80,6 +80,93 @@ struct disk_partition { #endif }; +/* Accessors for struct disk_partition field ->uuid */ +extern char *__invalid_use_of_disk_partition_uuid; + +static inline const char *disk_partition_uuid(const struct disk_partition *info) +{ +#if CONFIG_IS_ENABLED(PARTITION_UUIDS) + return info->uuid; +#else + return __invalid_use_of_disk_partition_uuid; +#endif +} + +static inline void disk_partition_set_uuid(struct disk_partition *info, + const char *val) +{ +#if CONFIG_IS_ENABLED(PARTITION_UUIDS) + strlcpy(info->uuid, val, UUID_STR_LEN + 1); +#endif +} + +static inline void disk_partition_clr_uuid(struct disk_partition *info) +{ +#if CONFIG_IS_ENABLED(PARTITION_UUIDS) + *info->uuid = '\0'; +#endif +} + +/* Accessors for struct disk_partition field ->type_guid */ +extern char *__invalid_use_of_disk_partition_type_guid; + +/** + * disk_partition_type_guid() - get partition type GUID + * + * By using this function to get the partition type GUID we can use + * 'if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID))' instead of + * '#ifdef CONFIG_PARTITION_TYPE_GUID'. + * + * @info: partition information + * Return: partition type GUID + */ +static inline const +char *disk_partition_type_guid(const struct disk_partition *info) +{ +#ifdef CONFIG_PARTITION_TYPE_GUID + return info->type_guid; +#else + return __invalid_use_of_disk_partition_type_guid; +#endif +} + +/** + * disk_partition_set_type_guid() - set partition type GUID + * + * By using this function to set the partition type GUID we can use + * 'if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID))' instead of + * '#ifdef CONFIG_PARTITION_TYPE_GUID'. + * + * @info: partition information + * @val: partition type GUID as string + */ +static inline void disk_partition_set_type_guid(struct disk_partition *info, + const char *val) +{ +#ifdef CONFIG_PARTITION_TYPE_GUID + strlcpy(info->type_guid, val, UUID_STR_LEN + 1); +#endif +} + +static inline void disk_partition_clr_type_guid(struct disk_partition *info) +{ +#ifdef CONFIG_PARTITION_TYPE_GUID + *info->type_guid = '\0'; +#endif +} + +/* Accessors for struct disk_partition field ->sys_ind */ +extern int __invalid_use_of_disk_partition_sys_ind; + +static inline uint disk_partition_sys_ind(const struct disk_partition *info) +{ +#ifdef CONFIG_DOS_PARTITION + return info->sys_ind; +#else + return __invalid_use_of_disk_partition_sys_ind; +#endif +} + struct disk_part { int partnum; struct disk_partition gpt_part_info; @@ -113,7 +200,7 @@ struct blk_desc *mg_disk_get_dev(int dev); * contained with the interface's data structure. There is no global * numbering for block devices, so the interface name must be provided. * - * @dev_desc: Block device descriptor + * @desc: Block device descriptor * @part: Partition number to read * @part_type: Partition driver to use, or PART_TYPE_UNKNOWN to automatically * choose a driver @@ -121,24 +208,24 @@ struct blk_desc *mg_disk_get_dev(int dev); * * Return: 0 on success, negative errno on failure */ -int part_get_info_by_type(struct blk_desc *dev_desc, int part, int part_type, +int part_get_info_by_type(struct blk_desc *desc, int part, int part_type, struct disk_partition *info); -int part_get_info(struct blk_desc *dev_desc, int part, +int part_get_info(struct blk_desc *desc, int part, struct disk_partition *info); /** * part_get_info_whole_disk() - get partition info for the special case of * a partition occupying the entire disk. * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @info: returned partition information * Return: 0 on success */ -int part_get_info_whole_disk(struct blk_desc *dev_desc, +int part_get_info_whole_disk(struct blk_desc *desc, struct disk_partition *info); -void part_print(struct blk_desc *dev_desc); -void part_init(struct blk_desc *dev_desc); -void dev_print(struct blk_desc *dev_desc); +void part_print(struct blk_desc *desc); +void part_init(struct blk_desc *desc); +void dev_print(struct blk_desc *desc); /** * blk_get_device_by_str() - Get a block device given its interface/hw partition @@ -162,11 +249,11 @@ void dev_print(struct blk_desc *dev_desc); * containing the device number (e.g. "2") or the device number * and hardware partition number (e.g. "2.4") for devices that * support it (currently only MMC). - * @dev_desc: Returns a pointer to the block device on success + * @desc: Returns a pointer to the block device on success * Return: block device number (local to the interface), or -1 on error */ int blk_get_device_by_str(const char *ifname, const char *dev_str, - struct blk_desc **dev_desc); + struct blk_desc **desc); /** * blk_get_device_part_str() - Get a block device and partition @@ -196,7 +283,7 @@ int blk_get_device_by_str(const char *ifname, const char *dev_str, * * @ifname: Interface name (e.g. "ide", "scsi") * @dev_part_str: Device and partition string - * @dev_desc: Returns a pointer to the block device on success + * @desc: Returns a pointer to the block device on success * @info: Returns partition information * @allow_whole_dev: true to allow the user to select partition 0 * (which means the whole device), false to require a valid @@ -205,22 +292,22 @@ int blk_get_device_by_str(const char *ifname, const char *dev_str, * */ int blk_get_device_part_str(const char *ifname, const char *dev_part_str, - struct blk_desc **dev_desc, + struct blk_desc **desc, struct disk_partition *info, int allow_whole_dev); /** * part_get_info_by_name() - Search for a partition by name * among all available registered partitions * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @name: the specified table entry name * @info: returns the disk partition info * * Return: the partition number on match (starting on 1), -1 on no match, * otherwise error */ -int part_get_info_by_name(struct blk_desc *dev_desc, - const char *name, struct disk_partition *info); +int part_get_info_by_name(struct blk_desc *desc, const char *name, + struct disk_partition *info); /** * part_get_info_by_dev_and_name_or_num() - Get partition info from dev number @@ -232,11 +319,11 @@ int part_get_info_by_name(struct blk_desc *dev_desc, * (like "device_num#partition_name") or a device number plus a partition number * separated by a ":". For example both "0#misc" and "0:1" can be valid * partition descriptions for a given interface. If the partition is found, sets - * dev_desc and part_info accordingly with the information of the partition. + * desc and part_info accordingly with the information of the partition. * * @dev_iface: Device interface * @dev_part_str: Input partition description, like "0#misc" or "0:1" - * @dev_desc: Place to store the device description pointer + * @desc: Place to store the device description pointer * @part_info: Place to store the partition information * @allow_whole_dev: true to allow the user to select partition 0 * (which means the whole device), false to require a valid @@ -245,7 +332,7 @@ int part_get_info_by_name(struct blk_desc *dev_desc, */ int part_get_info_by_dev_and_name_or_num(const char *dev_iface, const char *dev_part_str, - struct blk_desc **dev_desc, + struct blk_desc **desc, struct disk_partition *part_info, int allow_whole_dev); @@ -256,12 +343,12 @@ int part_get_info_by_dev_and_name_or_num(const char *dev_iface, * (DOS, ISO). Generates partition name out of the device type and partition * number. * - * @dev_desc: pointer to the block device + * @desc: pointer to the block device * @part_num: partition number for which the name is generated * @name: buffer where the name is written */ -void part_set_generic_name(const struct blk_desc *dev_desc, - int part_num, char *name); +void part_set_generic_name(const struct blk_desc *desc, int part_num, + char *name); extern const struct block_drvr block_drvr[]; #else @@ -269,26 +356,25 @@ static inline struct blk_desc *blk_get_dev(const char *ifname, int dev) { return NULL; } static inline struct blk_desc *mg_disk_get_dev(int dev) { return NULL; } -static inline int part_get_info(struct blk_desc *dev_desc, int part, +static inline int part_get_info(struct blk_desc *desc, int part, struct disk_partition *info) { return -1; } -static inline int part_get_info_whole_disk(struct blk_desc *dev_desc, +static inline int part_get_info_whole_disk(struct blk_desc *desc, struct disk_partition *info) { return -1; } -static inline void part_print(struct blk_desc *dev_desc) {} -static inline void part_init(struct blk_desc *dev_desc) {} -static inline void dev_print(struct blk_desc *dev_desc) {} +static inline void part_print(struct blk_desc *desc) {} +static inline void part_init(struct blk_desc *desc) {} +static inline void dev_print(struct blk_desc *desc) {} static inline int blk_get_device_by_str(const char *ifname, const char *dev_str, - struct blk_desc **dev_desc) + struct blk_desc **desc) { return -1; } static inline int blk_get_device_part_str(const char *ifname, const char *dev_part_str, - struct blk_desc **dev_desc, + struct blk_desc **desc, struct disk_partition *info, int allow_whole_dev) -{ *dev_desc = NULL; return -1; } +{ *desc = NULL; return -1; } -static inline int part_get_info_by_name(struct blk_desc *dev_desc, - const char *name, +static inline int part_get_info_by_name(struct blk_desc *desc, const char *name, struct disk_partition *info) { return -ENOENT; @@ -297,34 +383,17 @@ static inline int part_get_info_by_name(struct blk_desc *dev_desc, static inline int part_get_info_by_dev_and_name_or_num(const char *dev_iface, const char *dev_part_str, - struct blk_desc **dev_desc, + struct blk_desc **desc, struct disk_partition *part_info, int allow_whole_dev) { - *dev_desc = NULL; + *desc = NULL; return -ENOSYS; } #endif -/** - * part_get_bootable() - Find the first bootable partition - * - * @desc: Block-device descriptor - * @return first bootable partition, or 0 if there is none - */ -int part_get_bootable(struct blk_desc *desc); - struct udevice; /** - * part_create_block_devices - Create block devices for disk partitions - * - * Create UCLASS_PARTITION udevices for each of disk partitions in @parent - * - * @blk_dev: Whole disk device - */ -int part_create_block_devices(struct udevice *blk_dev); - -/** * disk_blk_read() - read blocks from a disk partition * * @dev: Device to read from (UCLASS_PARTITION) @@ -391,29 +460,29 @@ struct part_driver { /** * @get_info: Get information about a partition * - * @get_info.dev_desc: Block device descriptor + * @get_info.desc: Block device descriptor * @get_info.part: Partition number (1 = first) * @get_info.info: Returns partition information */ - int (*get_info)(struct blk_desc *dev_desc, int part, + int (*get_info)(struct blk_desc *desc, int part, struct disk_partition *info); /** * @print: Print partition information * - * @print.dev_desc: Block device descriptor + * @print.desc: Block device descriptor */ - void (*print)(struct blk_desc *dev_desc); + void (*print)(struct blk_desc *desc); /** * @test: Test if a device contains this partition type * - * @test.dev_desc: Block device descriptor + * @test.desc: Block device descriptor * @test.Return: * 0 if the block device appears to contain this partition type, * -ve if not */ - int (*test)(struct blk_desc *dev_desc); + int (*test)(struct blk_desc *desc); }; /* Declare a new U-Boot partition 'driver' */ @@ -427,19 +496,18 @@ struct part_driver { /** * write_gpt_table() - Write the GUID Partition Table to disk * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @gpt_h: pointer to GPT header representation * @gpt_e: pointer to GPT partition table entries * * Return: zero on success, otherwise error */ -int write_gpt_table(struct blk_desc *dev_desc, - gpt_header *gpt_h, gpt_entry *gpt_e); +int write_gpt_table(struct blk_desc *desc, gpt_header *gpt_h, gpt_entry *gpt_e); /** * gpt_fill_pte() - Fill the GPT partition table entry * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @gpt_h: GPT header representation * @gpt_e: GPT partition table entries * @partitions: list of partitions @@ -447,55 +515,54 @@ int write_gpt_table(struct blk_desc *dev_desc, * * Return: zero on success */ -int gpt_fill_pte(struct blk_desc *dev_desc, - gpt_header *gpt_h, gpt_entry *gpt_e, +int gpt_fill_pte(struct blk_desc *desc, gpt_header *gpt_h, gpt_entry *gpt_e, struct disk_partition *partitions, int parts); /** * gpt_fill_header() - Fill the GPT header * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @gpt_h: GPT header representation * @str_guid: disk guid string representation * @parts_count: number of partitions * * Return: error on str_guid conversion error */ -int gpt_fill_header(struct blk_desc *dev_desc, gpt_header *gpt_h, - char *str_guid, int parts_count); +int gpt_fill_header(struct blk_desc *desc, gpt_header *gpt_h, char *str_guid, + int parts_count); /** * gpt_restore() - Restore GPT partition table * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @str_disk_guid: disk GUID * @partitions: list of partitions * @parts_count: number of partitions * * Return: 0 on success */ -int gpt_restore(struct blk_desc *dev_desc, char *str_disk_guid, +int gpt_restore(struct blk_desc *desc, char *str_disk_guid, struct disk_partition *partitions, const int parts_count); /** * is_valid_gpt_buf() - Ensure that the Primary GPT information is valid * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @buf: buffer which contains the MBR and Primary GPT info * * Return: 0 on success, otherwise error */ -int is_valid_gpt_buf(struct blk_desc *dev_desc, void *buf); +int is_valid_gpt_buf(struct blk_desc *desc, void *buf); /** * write_mbr_and_gpt_partitions() - write MBR, Primary GPT and Backup GPT * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @buf: buffer which contains the MBR and Primary GPT info * * Return: 0 on success, otherwise error */ -int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf); +int write_mbr_and_gpt_partitions(struct blk_desc *desc, void *buf); /** * gpt_verify_headers() - Read and check CRC32 of the GPT's header @@ -503,24 +570,24 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf); * * As a side effect if sets gpt_head and gpt_pte so they point to GPT data. * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @gpt_head: pointer to GPT header data read from medium * @gpt_pte: pointer to GPT partition table enties read from medium * * Return: 0 on success, otherwise error */ -int gpt_verify_headers(struct blk_desc *dev_desc, gpt_header *gpt_head, +int gpt_verify_headers(struct blk_desc *desc, gpt_header *gpt_head, gpt_entry **gpt_pte); /** * gpt_repair_headers() - Function to repair the GPT's header * and partition table entries (PTE) * - * @dev_desc: block device descriptor + * @desc: block device descriptor * * Return: 0 on success, otherwise error */ -int gpt_repair_headers(struct blk_desc *dev_desc); +int gpt_repair_headers(struct blk_desc *desc); /** * gpt_verify_partitions() - Function to check if partitions' name, start and @@ -530,7 +597,7 @@ int gpt_repair_headers(struct blk_desc *dev_desc); * provided in '$partitions' environment variable. Specificially, name, start * and size of the partition is checked. * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @partitions: partition data read from '$partitions' env variable * @parts: number of partitions read from '$partitions' env variable * @gpt_head: pointer to GPT header data read from medium @@ -538,7 +605,7 @@ int gpt_repair_headers(struct blk_desc *dev_desc); * * Return: 0 on success, otherwise error */ -int gpt_verify_partitions(struct blk_desc *dev_desc, +int gpt_verify_partitions(struct blk_desc *desc, struct disk_partition *partitions, int parts, gpt_header *gpt_head, gpt_entry **gpt_pte); @@ -549,12 +616,12 @@ int gpt_verify_partitions(struct blk_desc *dev_desc, * This function reads the GUID string from a block device whose descriptor * is provided. * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @guid: pre-allocated string in which to return the GUID * * Return: 0 on success, otherwise error */ -int get_disk_guid(struct blk_desc *dev_desc, char *guid); +int get_disk_guid(struct blk_desc *desc, char *guid); #endif @@ -571,12 +638,12 @@ int is_valid_dos_buf(void *buf); /** * write_mbr_sector() - write DOS MBR * - * @dev_desc: block device descriptor + * @desc: block device descriptor * @buf: buffer which contains the MBR * * Return: 0 on success, otherwise error */ -int write_mbr_sector(struct blk_desc *dev_desc, void *buf); +int write_mbr_sector(struct blk_desc *desc, void *buf); int write_mbr_partitions(struct blk_desc *dev, struct disk_partition *p, int count, unsigned int disksig); @@ -615,12 +682,24 @@ static inline struct part_driver *part_driver_get_first(void) */ int part_get_type_by_name(const char *name); +/** + * part_get_bootable() - Find the first bootable partition + * + * @desc: Block-device descriptor + * @return first bootable partition, or 0 if there is none + */ +int part_get_bootable(struct blk_desc *desc); + #else static inline int part_driver_get_count(void) { return 0; } static inline struct part_driver *part_driver_get_first(void) { return NULL; } + +static inline bool part_get_bootable(struct blk_desc *desc) +{ return false; } + #endif /* CONFIG_PARTITIONS */ #endif /* _PART_H */ diff --git a/include/part_efi.h b/include/part_efi.h index c68529b4daf..59b7895b8a2 100644 --- a/include/part_efi.h +++ b/include/part_efi.h @@ -60,6 +60,20 @@ EFI_GUID( 0x3de21764, 0x95bd, 0x54bd, \ 0xa5, 0xc3, 0x4a, 0xbe, 0x78, 0x6f, 0x38, 0xa8) +/* Special ChromiumOS things */ +#define PARTITION_CROS_KERNEL \ + EFI_GUID(0xfe3a2a5d, 0x4f32, 0x41a7, \ + 0xb7, 0x25, 0xac, 0xcc, 0x32, 0x85, 0xa3, 0x09) +#define PARTITION_CROS_ROOT \ + EFI_GUID(0x3cb8e202, 0x3b7e, 0x47dd, \ + 0x8a, 0x3c, 0x7f, 0xf2, 0xa1, 0x3c, 0xfc, 0xec) +#define PARTITION_CROS_FIRMWARE \ + EFI_GUID(0xcab6e88e, 0xabf3, 0x4102, \ + 0xa0, 0x7a, 0xd4, 0xbb, 0x9b, 0xe3, 0xc1, 0xd3) +#define PARTITION_CROS_RESERVED \ + EFI_GUID(0x2e0a753d, 0x9e48, 0x43b0, \ + 0x83, 0x37, 0xb1, 0x51, 0x92, 0xcb, 0x1b, 0x5e) + /* linux/include/efi.h */ typedef u16 efi_char16_t; diff --git a/include/phy.h b/include/phy.h index f023a3c2685..27effdb5763 100644 --- a/include/phy.h +++ b/include/phy.h @@ -172,14 +172,6 @@ struct fixed_link { }; /** - * phy_init() - Initializes the PHY drivers - * This function registers all available PHY drivers - * - * @return: 0 if OK, -ve on error - */ -int phy_init(void); - -/** * phy_reset() - Resets the specified PHY * Issues a reset of the PHY and waits for it to complete * diff --git a/include/post.h b/include/post.h index 41120695064..6e88d550722 100644 --- a/include/post.h +++ b/include/post.h @@ -105,9 +105,6 @@ void post_bootmode_clear (void); int post_run (char *name, int flags); int post_info (char *name); int post_log (char *format, ...); -#ifdef CONFIG_NEEDS_MANUAL_RELOC -void post_reloc (void); -#endif unsigned long post_time_ms (unsigned long base); /** diff --git a/include/relocate.h b/include/relocate.h index 2dbfd901e4f..8ca25e1105e 100644 --- a/include/relocate.h +++ b/include/relocate.h @@ -39,28 +39,4 @@ int clear_bss(void); */ int do_elf_reloc_fixups(void); -/** - * manual_reloc() - Manually relocate a pointer if needed - * - * This is a nop in almost all cases, except for the systems with a broken gcc - * which need to manually relocate some things. - * - * @ptr: Pointer to relocate - * Return: new pointer value - */ -static inline void *manual_reloc(void *ptr) -{ -#ifndef USE_HOSTCC - if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) - return ptr + gd->reloc_off; -#endif - return ptr; -} - -#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC) -#define MANUAL_RELOC(ptr) (ptr) = manual_reloc(ptr) -#else -#define MANUAL_RELOC(ptr) (void)(ptr) -#endif - #endif /* _RELOCATE_H_ */ diff --git a/include/sandbox_efi_capsule.h b/include/sandbox_efi_capsule.h new file mode 100644 index 00000000000..3e288e8a84a --- /dev/null +++ b/include/sandbox_efi_capsule.h @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2023, Linaro Limited + */ + +#if !defined(_SANDBOX_EFI_CAPSULE_H_) +#define _SANDBOX_EFI_CAPSULE_H_ + +#define SANDBOX_UBOOT_IMAGE_GUID "09d7cf52-0720-4710-91d1-08469b7fe9c8" +#define SANDBOX_UBOOT_ENV_IMAGE_GUID "5a7021f5-fef2-48b4-aaba-832e777418c0" +#define SANDBOX_FIT_IMAGE_GUID "3673b45d-6a7c-46f3-9e60-adabb03f7937" +#define SANDBOX_INCORRECT_GUID "058b7d83-50d5-4c47-a195-60d86ad341c4" + +#define UBOOT_FIT_IMAGE "u-boot_bin_env.itb" + +#define CAPSULE_PRIV_KEY "capsule_priv_key_good.key" +#define CAPSULE_PUB_KEY "capsule_pub_key_good.crt" +#define CAPSULE_INVAL_KEY "capsule_priv_key_bad.key" +#define CAPSULE_INVAL_PUB_KEY "capsule_pub_key_bad.crt" + +#endif /* _SANDBOX_EFI_CAPSULE_H_ */ diff --git a/include/scsi.h b/include/scsi.h index 9efefea99bb..ee9d622680d 100644 --- a/include/scsi.h +++ b/include/scsi.h @@ -7,6 +7,7 @@ #define _SCSI_H #include <asm/cache.h> +#include <bouncebuf.h> #include <linux/dma-direction.h> /* Fix this to the maximum */ @@ -298,6 +299,24 @@ struct scsi_ops { * @return 0 if OK, -ve on error */ int (*bus_reset)(struct udevice *dev); + +#if IS_ENABLED(CONFIG_BOUNCE_BUFFER) + /** + * buffer_aligned() - test memory alignment of block operation buffer + * + * Some devices have limited DMA capabilities and require that the + * buffers passed to them fit specific properties. This optional + * callback can be used to indicate whether a buffer alignment is + * suitable for the device DMA or not, and trigger use of generic + * bounce buffer implementation to help use of unsuitable buffers + * at the expense of performance degradation. + * + * @dev: Block device associated with the request + * @state: Bounce buffer state + * @return 1 if OK, 0 if unaligned + */ + int (*buffer_aligned)(struct udevice *dev, struct bounce_buffer *state); +#endif /* CONFIG_BOUNCE_BUFFER */ }; #define scsi_get_ops(dev) ((struct scsi_ops *)(dev)->driver->ops) diff --git a/include/sdp.h b/include/sdp.h index 6d89baa04ec..5492f9c47d2 100644 --- a/include/sdp.h +++ b/include/sdp.h @@ -9,15 +9,15 @@ #ifndef __SDP_H_ #define __SDP_H_ -int sdp_init(int controller_index); +int sdp_init(struct udevice *udc); #ifdef CONFIG_SPL_BUILD #include <spl.h> -int spl_sdp_handle(int controller_index, struct spl_image_info *spl_image, +int spl_sdp_handle(struct udevice *udc, struct spl_image_info *spl_image, struct spl_boot_device *bootdev); #else -int sdp_handle(int controller_index); +int sdp_handle(struct udevice *udc); #endif #endif /* __SDP_H_ */ diff --git a/include/spl.h b/include/spl.h index 93e906431e7..0fedddd00ef 100644 --- a/include/spl.h +++ b/include/spl.h @@ -484,7 +484,7 @@ unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc, * spl_set_header_raw_uboot() - Set up a standard SPL image structure * * This sets up the given spl_image which the standard values obtained from - * config options: CONFIG_SYS_MONITOR_LEN, CFG_SYS_UBOOT_START, + * config options: CONFIG_SYS_MONITOR_LEN, CONFIG_SYS_UBOOT_START, * CONFIG_TEXT_BASE. * * @spl_image: Image description to set up diff --git a/include/thor.h b/include/thor.h index ee67ab0a270..3cb56b654ae 100644 --- a/include/thor.h +++ b/include/thor.h @@ -14,7 +14,7 @@ #define THOR_DFU_REINIT_NEEDED 0xFFFFFFFE -int thor_handle(void); -int thor_init(void); +int thor_handle(struct udevice *udc); +int thor_init(struct udevice *udc); int thor_add(struct usb_configuration *c); #endif /* __THOR_H_ */ diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h index 08ccc97cf22..83ab93b530d 100644 --- a/include/usb_mass_storage.h +++ b/include/usb_mass_storage.h @@ -25,7 +25,7 @@ struct ums { struct blk_desc block_dev; }; -int fsg_init(struct ums *ums_devs, int count, unsigned int controller_idx); +int fsg_init(struct ums *ums_devs, int count, struct udevice *udc); void fsg_cleanup(void); int fsg_main_thread(void *); int fsg_add(struct usb_configuration *c); diff --git a/include/uuid.h b/include/uuid.h index 89b93e642b7..f5a941250f4 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -12,6 +12,51 @@ #include <linux/bitops.h> +/* + * UUID - Universally Unique IDentifier - 128 bits unique number. + * There are 5 versions and one variant of UUID defined by RFC4122 + * specification. A UUID contains a set of fields. The set varies + * depending on the version of the UUID, as shown below: + * - time, MAC address(v1), + * - user ID(v2), + * - MD5 of name or URL(v3), + * - random data(v4), + * - SHA-1 of name or URL(v5), + * + * Layout of UUID: + * timestamp - 60-bit: time_low, time_mid, time_hi_and_version + * version - 4 bit (bit 4 through 7 of the time_hi_and_version) + * clock seq - 14 bit: clock_seq_hi_and_reserved, clock_seq_low + * variant: - bit 6 and 7 of clock_seq_hi_and_reserved + * node - 48 bit + * + * source: https://www.ietf.org/rfc/rfc4122.txt + * + * UUID binary format (16 bytes): + * + * 4B-2B-2B-2B-6B (big endian - network byte order) + * + * UUID string is 36 length of characters (36 bytes): + * + * 0 9 14 19 24 + * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + * be be be be be + * + * where x is a hexadecimal character. Fields are separated by '-'s. + * When converting to a binary UUID, le means the field should be converted + * to little endian and be means it should be converted to big endian. + * + * UUID is also used as GUID (Globally Unique Identifier) with the same binary + * format but it differs in string format like below. + * + * GUID: + * 0 9 14 19 24 + * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + * le le le be be + * + * GUID is used e.g. in GPT (GUID Partition Table) as a partiions unique id. + */ + /* This is structure is in big-endian */ struct uuid { unsigned int time_low; @@ -40,20 +85,78 @@ struct uuid { #define UUID_VARIANT 0x1 int uuid_str_valid(const char *uuid); + +/* + * uuid_str_to_bin() - convert string UUID or GUID to big endian binary data. + * + * @param uuid_str - pointer to UUID or GUID string [37B] or GUID shorcut + * @param uuid_bin - pointer to allocated array for big endian output [16B] + * @str_format - UUID string format: 0 - UUID; 1 - GUID + * Return: 0 if OK, -EINVAL if the string is not a valid UUID + */ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin, int str_format); + +/* + * uuid_bin_to_str() - convert big endian binary data to string UUID or GUID. + * + * @param uuid_bin: pointer to binary data of UUID (big endian) [16B] + * @param uuid_str: pointer to allocated array for output string [37B] + * @str_format: bit 0: 0 - UUID; 1 - GUID + * bit 1: 0 - lower case; 2 - upper case + */ void uuid_bin_to_str(const unsigned char *uuid_bin, char *uuid_str, int str_format); + +/* + * uuid_guid_get_bin() - this function get GUID bin for string + * + * @param guid_str - pointer to partition type string + * @param guid_bin - pointer to allocated array for big endian output [16B] + */ int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin); + +/* + * uuid_guid_get_str() - this function get string for GUID. + * + * @param guid_bin - pointer to string with partition type guid [16B] + * + * Returns NULL if the type GUID is not known. + */ const char *uuid_guid_get_str(const unsigned char *guid_bin); + +/* + * gen_rand_uuid() - this function generates a random binary UUID version 4. + * In this version all fields beside 4 bits of version and + * 2 bits of variant are randomly generated. + * + * @param uuid_bin - pointer to allocated array [16B]. Output is in big endian. + */ void gen_rand_uuid(unsigned char *uuid_bin); + +/* + * gen_rand_uuid_str() - this function generates UUID v4 (random) in two string + * formats UUID or GUID. + * + * @param uuid_str - pointer to allocated array [37B]. + * @param - uuid output type: UUID - 0, GUID - 1 + */ void gen_rand_uuid_str(char *uuid_str, int str_format); /** * uuid_str_to_le_bin() - Convert string UUID to little endian binary data. * @uuid_str: pointer to UUID string * @uuid_bin: pointer to allocated array for little endian output [16B] + * + * UUID string is 36 characters (36 bytes): + * + * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + * + * where x is a hexadecimal character. Fields are separated by '-'s. + * When converting to a little endian binary UUID, the string fields are reversed. + * * Return: + * * uuid_bin filled with little endian UUID data * On success 0 is returned. Otherwise, failure code. */ diff --git a/include/video.h b/include/video.h index 16f7a83f8d5..5048116a3d5 100644 --- a/include/video.h +++ b/include/video.h @@ -58,7 +58,7 @@ enum video_log2_bpp { * Convert enum video_log2_bpp to bytes and bits. Note we omit the outer * brackets to allow multiplication by fractional pixels. */ -#define VNBYTES(bpix) (1 << (bpix)) / 8 +#define VNBYTES(bpix) ((1 << (bpix)) / 8) #define VNBITS(bpix) (1 << (bpix)) diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h index 18a87d27495..73198a6a6ea 100644 --- a/include/zynqmp_firmware.h +++ b/include/zynqmp_firmware.h @@ -456,6 +456,7 @@ int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config, int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id); int zynqmp_mmio_read(const u32 address, u32 *value); int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value); +int zynqmp_pm_feature(const u32 api_id); /* Type of Config Object */ #define PM_CONFIG_OBJECT_TYPE_BASE 0x1U @@ -492,6 +493,8 @@ enum zynqmp_pm_request_ack { /* PM API versions */ #define PM_API_VERSION_2 2 +#define PM_PINCTRL_PARAM_SET_VERSION 2 + struct zynqmp_ipi_msg { size_t len; u32 *buf; |