diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/abuf.h | 43 | ||||
-rw-r--r-- | include/bootflow.h | 77 | ||||
-rw-r--r-- | include/cedit.h | 17 | ||||
-rw-r--r-- | include/command.h | 1 | ||||
-rw-r--r-- | include/configs/MPC837XERDB.h | 7 | ||||
-rw-r--r-- | include/configs/MPC8548CDS.h | 3 | ||||
-rw-r--r-- | include/configs/P1010RDB.h | 2 | ||||
-rw-r--r-- | include/configs/P2041RDB.h | 1 | ||||
-rw-r--r-- | include/configs/T208xQDS.h | 1 | ||||
-rw-r--r-- | include/configs/imx6ulz_smm_m2.h | 6 | ||||
-rw-r--r-- | include/configs/p1_p2_rdb_pc.h | 1 | ||||
-rw-r--r-- | include/configs/starfive-visionfive2.h | 2 | ||||
-rw-r--r-- | include/configs/th1520_lpi4a.h | 1 | ||||
-rw-r--r-- | include/dt-bindings/clock/imxrt1170-clock.h | 4 | ||||
-rw-r--r-- | include/dt-bindings/media/video-interfaces.h | 16 | ||||
-rw-r--r-- | include/efi_device_path.h | 421 | ||||
-rw-r--r-- | include/efi_loader.h | 78 | ||||
-rw-r--r-- | include/env_internal.h | 1 | ||||
-rw-r--r-- | include/expo.h | 293 | ||||
-rw-r--r-- | include/image.h | 5 | ||||
-rw-r--r-- | include/net-common.h | 16 | ||||
-rw-r--r-- | include/net-legacy.h | 1 | ||||
-rw-r--r-- | include/net6.h | 1 | ||||
-rw-r--r-- | include/part.h | 20 | ||||
-rw-r--r-- | include/scsi.h | 10 | ||||
-rw-r--r-- | include/slre.h | 1 |
26 files changed, 886 insertions, 143 deletions
diff --git a/include/abuf.h b/include/abuf.h index 62ff6499a0c..7872e9c9b27 100644 --- a/include/abuf.h +++ b/include/abuf.h @@ -112,6 +112,38 @@ bool abuf_realloc(struct abuf *abuf, size_t new_size); bool abuf_realloc_inc(struct abuf *abuf, size_t inc); /** + * abuf_copy() - Make a copy of an abuf + * + * Creates an allocated copy of @old in @new + * + * @old: abuf to copy + * @new: new abuf to hold the copy (inited by this function) + * Return: true if OK, false if out of memory + */ +bool abuf_copy(const struct abuf *old, struct abuf *new); + +/** + * abuf_printf() - Format a string and place it in an abuf + * + * @buf: The buffer to place the result into + * @fmt: The format string to use + * @...: Arguments for the format string + * Return: the number of characters writtenwhich would be + * generated for the given input, excluding the trailing null, + * as per ISO C99. + * + * The abuf is expanded as necessary to fit the formated string + * + * See the vsprintf() documentation for format string extensions over C99. + * + * Returns: number of characters written (excluding trailing nul) on success, + * -E2BIG if the size exceeds 4K, -ENOMEM if out of memory, -EFAULT if there is + * an internal bug in the vsnprintf() implementation + */ +int abuf_printf(struct abuf *buf, const char *fmt, ...) + __attribute__ ((format (__printf__, 2, 3))); + +/** * 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 @@ -171,6 +203,17 @@ void abuf_init_set(struct abuf *abuf, void *data, size_t size); void abuf_init_const(struct abuf *abuf, const void *data, size_t size); /** + * abuf_init_size() - Set up an allocated abuf + * + * Init a new abuf and allocate its size. + * + * @abuf: abuf to set up + * @data: New contents of abuf + * @size: New size of abuf + */ +bool abuf_init_size(struct abuf *buf, size_t size); + +/** * abuf_uninit() - Free any memory used by an abuf * * The buffer must be inited before this can be called. diff --git a/include/bootflow.h b/include/bootflow.h index 5a9ac5ed3b3..32422067723 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -15,6 +15,7 @@ struct bootstd_priv; struct expo; +struct scene; enum { BOOTFLOW_MAX_USED_DEVS = 16, @@ -488,12 +489,40 @@ int bootflow_iter_check_system(const struct bootflow_iter *iter); /** * bootflow_menu_new() - Create a new bootflow menu * + * This is initially empty. Call bootflow_menu_add_all() to add all the + * bootflows to it. + * * @expp: Returns the expo created * Returns 0 on success, -ve on error */ int bootflow_menu_new(struct expo **expp); /** + * bootflow_menu_add_all() - Add all bootflows to a menu + * + * Loops through all bootflows and adds them to the menu + * + * @exp: Menu to update + * Return 0 on success, -ve on error + */ +int bootflow_menu_add_all(struct expo *exp); + +/** + * bootflow_menu_add() - Add a bootflow to a menu + * + * Adds a new bootflow to the end of a menu. The caller must be careful to pass + * seq=0 for the first bootflow added, 1 for the second, etc. + * + * @exp: Menu to update + * @bflow: Bootflow to add + * @seq: Sequence number of this bootflow (0 = first) + * @scnp: Returns a pointer to the scene + * Return 0 on success, -ve on error + */ +int bootflow_menu_add(struct expo *exp, struct bootflow *bflow, int seq, + struct scene **scnp); + +/** * bootflow_menu_apply_theme() - Apply a theme to a bootmenu * * @exp: Expo to update @@ -502,18 +531,6 @@ int bootflow_menu_new(struct expo **expp); */ int bootflow_menu_apply_theme(struct expo *exp, ofnode node); -/** - * bootflow_menu_run() - Create and run a menu of available bootflows - * - * @std: Bootstd information - * @text_mode: Uses a text-based menu suitable for a serial port - * @bflowp: Returns chosen bootflow (set to NULL if nothing is chosen) - * @return 0 if an option was chosen, -EAGAIN if nothing was chosen, -ve on - * error - */ -int bootflow_menu_run(struct bootstd_priv *std, bool text_mode, - struct bootflow **bflowp); - #define BOOTFLOWCL_EMPTY ((void *)1) /** @@ -638,4 +655,40 @@ struct bootflow_img *bootflow_img_add(struct bootflow *bflow, const char *fname, */ int bootflow_get_seq(const struct bootflow *bflow); +/** + * bootflow_menu_setup() - Set up a menu for bootflows + * + * Set up the expo, initially empty + * + * @std: bootstd information + * @text_mode: true to show the menu in text mode, false to use video display + * @expp: Returns the expo created, on success + * Return: 0 if OK, -ve on error + */ +int bootflow_menu_setup(struct bootstd_priv *std, bool text_mode, + struct expo **expp); + +/** + * bootflow_menu_start() - Start up a menu for bootflows + * + * Set up the expo and add items + * + * @std: bootstd information + * @text_mode: true to show the menu in text mode, false to use video display + * @expp: Returns the expo created, on success + * Return: 0 if OK, -ve on error + */ +int bootflow_menu_start(struct bootstd_priv *std, bool text_mode, + struct expo **expp); + +/** + * bootflow_menu_poll() - Poll a menu for user action + * + * @exp: Expo to poll + * @seqp: Returns the bootflow chosen or currently pointed to (numbered from 0) + * Return: 0 if a bootflow was chosen, -EAGAIN if nothing is chosen yet, -EPIPE + * if the user quit, -ERESTART if the expo needs refreshing + */ +int bootflow_menu_poll(struct expo *exp, int *seqp); + #endif diff --git a/include/cedit.h b/include/cedit.h index 856509f0c7f..319a61aecb8 100644 --- a/include/cedit.h +++ b/include/cedit.h @@ -13,6 +13,7 @@ struct abuf; struct expo; +struct expo_action; struct scene; struct udevice; struct video_priv; @@ -55,14 +56,26 @@ int cedit_run(struct expo *exp); * This ensures that all menus have a selected item. * * @exp: Expo to use - * @vid_privp: Set to private data for the video device + * @dev: Video device to use * @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, +int cedit_prepare(struct expo *exp, struct udevice *vid_dev, struct scene **scnp); /** + * cedit_do_action() - Process an action on a cedit + * + * @exp: Expo to use + * @scn: Current scene + * @vid_priv: Private data for the video device + * @act: Action to process + * Return: 0 on success, -EAGAIN if there was no action taken + */ +int cedit_do_action(struct expo *exp, struct scene *scn, + struct video_priv *vid_priv, struct expo_action *act); + +/** * cedit_write_settings() - Write settings in FDT format * * Sets up an FDT with the settings diff --git a/include/command.h b/include/command.h index 4158ca11b0e..5d225cd197f 100644 --- a/include/command.h +++ b/include/command.h @@ -10,7 +10,6 @@ #ifndef __COMMAND_H #define __COMMAND_H -#include <env.h> #include <linker_lists.h> #include <linux/compiler_attributes.h> diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h index a5176d176dc..b22c720d07f 100644 --- a/include/configs/MPC837XERDB.h +++ b/include/configs/MPC837XERDB.h @@ -136,13 +136,6 @@ #define CFG_SYS_VSC7385_BASE 0xF0000000 -/* - * Serial Port - */ -#if !CONFIG_IS_ENABLED(DM_SERIAL) && !CONFIG_IS_ENABLED(DM_CLK) -#define CFG_SYS_NS16550_CLK get_bus_freq(0) -#endif - #define CFG_SYS_BAUDRATE_TABLE \ {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 115200} diff --git a/include/configs/MPC8548CDS.h b/include/configs/MPC8548CDS.h index 6f3e298a249..71e81e09ddb 100644 --- a/include/configs/MPC8548CDS.h +++ b/include/configs/MPC8548CDS.h @@ -217,9 +217,6 @@ #define CFG_SYS_INIT_SP_OFFSET (CFG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) -/* Serial Port */ -#define CFG_SYS_NS16550_CLK get_bus_freq(0) - #define CFG_SYS_BAUDRATE_TABLE \ {300, 600, 1200, 2400, 4800, 9600, 19200, 38400,115200} diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h index 20fded56b77..0d312643bc8 100644 --- a/include/configs/P1010RDB.h +++ b/include/configs/P1010RDB.h @@ -309,8 +309,6 @@ extern unsigned long get_sdram_size(void); #endif /* Serial Port */ -#define CFG_SYS_NS16550_CLK get_bus_freq(0) - #define CFG_SYS_BAUDRATE_TABLE \ {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200} diff --git a/include/configs/P2041RDB.h b/include/configs/P2041RDB.h index 7cf6514f148..f88fb9cdb9a 100644 --- a/include/configs/P2041RDB.h +++ b/include/configs/P2041RDB.h @@ -148,7 +148,6 @@ * open - index 2 * shorted - index 1 */ -#define CFG_SYS_NS16550_CLK (get_bus_freq(0)/2) #define CFG_SYS_BAUDRATE_TABLE \ {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200} diff --git a/include/configs/T208xQDS.h b/include/configs/T208xQDS.h index 2023d7497f6..e81937cc332 100644 --- a/include/configs/T208xQDS.h +++ b/include/configs/T208xQDS.h @@ -250,7 +250,6 @@ /* * Serial Port */ -#define CFG_SYS_NS16550_CLK (get_bus_freq(0)/2) #define CFG_SYS_BAUDRATE_TABLE \ {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200} #define CFG_SYS_NS16550_COM1 (CFG_SYS_CCSRBAR+0x11C500) diff --git a/include/configs/imx6ulz_smm_m2.h b/include/configs/imx6ulz_smm_m2.h index 44a3fc02e8a..87aede218d1 100644 --- a/include/configs/imx6ulz_smm_m2.h +++ b/include/configs/imx6ulz_smm_m2.h @@ -60,10 +60,8 @@ BOOTENV /* Physical Memory Map */ -#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR -#define PHYS_SDRAM_SIZE SZ_128M - -#define CFG_SYS_SDRAM_BASE PHYS_SDRAM +#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR +#define CFG_SYS_SDRAM_BASE PHYS_SDRAM #define CFG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR #define CFG_SYS_INIT_RAM_SIZE IRAM_SIZE diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h index 23d8917b718..2d9d5b27511 100644 --- a/include/configs/p1_p2_rdb_pc.h +++ b/include/configs/p1_p2_rdb_pc.h @@ -302,7 +302,6 @@ * open - index 2 * shorted - index 1 */ -#define CFG_SYS_NS16550_CLK get_bus_freq(0) #define CFG_SYS_BAUDRATE_TABLE \ {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200} diff --git a/include/configs/starfive-visionfive2.h b/include/configs/starfive-visionfive2.h index 049b0a06301..e7001b26abf 100644 --- a/include/configs/starfive-visionfive2.h +++ b/include/configs/starfive-visionfive2.h @@ -39,4 +39,6 @@ "partitions=" PARTS_DEFAULT "\0" \ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" +#define CFG_SYS_NS16550_CLK 24000000 + #endif /* _STARFIVE_VISIONFIVE2_H */ diff --git a/include/configs/th1520_lpi4a.h b/include/configs/th1520_lpi4a.h index 87496a52c4c..7a9b70a3678 100644 --- a/include/configs/th1520_lpi4a.h +++ b/include/configs/th1520_lpi4a.h @@ -9,6 +9,7 @@ #include <linux/sizes.h> +#define CFG_SYS_NS16550_CLK 100000000 #define CFG_SYS_SDRAM_BASE 0x00000000 #define UART_BASE 0xffe7014000 diff --git a/include/dt-bindings/clock/imxrt1170-clock.h b/include/dt-bindings/clock/imxrt1170-clock.h index 8ab8018a15e..d3d21cf310d 100644 --- a/include/dt-bindings/clock/imxrt1170-clock.h +++ b/include/dt-bindings/clock/imxrt1170-clock.h @@ -43,6 +43,8 @@ #define IMXRT1170_CLK_GPT1 33 #define IMXRT1170_CLK_SEMC_SEL 34 #define IMXRT1170_CLK_SEMC 35 -#define IMXRT1170_CLK_END 36 +#define IMXRT1170_CLK_FLEXSPI1_SEL 36 +#define IMXRT1170_CLK_FLEXSPI1 37 +#define IMXRT1170_CLK_END 38 #endif /* __DT_BINDINGS_CLOCK_IMXRT1170_H */ diff --git a/include/dt-bindings/media/video-interfaces.h b/include/dt-bindings/media/video-interfaces.h deleted file mode 100644 index 68ac4e05e37..00000000000 --- a/include/dt-bindings/media/video-interfaces.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ -/* - * Copyright (C) 2022 Laurent Pinchart <laurent.pinchart@ideasonboard.com> - */ - -#ifndef __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ -#define __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ - -#define MEDIA_BUS_TYPE_CSI2_CPHY 1 -#define MEDIA_BUS_TYPE_CSI1 2 -#define MEDIA_BUS_TYPE_CCP2 3 -#define MEDIA_BUS_TYPE_CSI2_DPHY 4 -#define MEDIA_BUS_TYPE_PARALLEL 5 -#define MEDIA_BUS_TYPE_BT656 6 - -#endif /* __DT_BINDINGS_MEDIA_VIDEO_INTERFACES_H__ */ diff --git a/include/efi_device_path.h b/include/efi_device_path.h new file mode 100644 index 00000000000..aae85228f68 --- /dev/null +++ b/include/efi_device_path.h @@ -0,0 +1,421 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * EFI device path functions + * + * (C) Copyright 2017 Rob Clark + */ + +#ifndef EFI_DEVICE_PATH_H +#define EFI_DEVICE_PATH_H + +#include <efi.h> + +struct blk_desc; +struct efi_load_option; +struct udevice; + +/* + * EFI_DP_END - Template end node for EFI device paths. + * + * Represents the terminating node of an EFI device path. + * It has a type of DEVICE_PATH_TYPE_END and sub_type DEVICE_PATH_SUB_TYPE_END + */ +extern const struct efi_device_path EFI_DP_END; + +/** + * efi_dp_next() - Iterate to next block in device-path + * + * Advance to the next node in an EFI device path. + * + * @dp: Pointer to the current device path node. + * Return: Pointer to the next device path node, or NULL if at the end + * or if input is NULL. + */ +struct efi_device_path *efi_dp_next(const struct efi_device_path *dp); + +/** + * efi_dp_match() - Compare two device-paths + * + * Compare two device paths node by node. The comparison stops when an End + * node is reached in the shorter of the two paths. This is useful, for example, + * to compare a device-path representing a device with one representing a file + * on that device, or a device with a parent device. + * + * @a: Pointer to the first device path. + * @b: Pointer to the second device path. + * Return: An integer less than, equal to, or greater than zero if the first + * differing node in 'a' is found, respectively, to be less than, + * to match, or be greater than the corresponding node in 'b'. Returns 0 + * if they match up to the end of the shorter path. Compares length first, + * then content. + */ +int efi_dp_match(const struct efi_device_path *a, + const struct efi_device_path *b); + +/** + * efi_dp_shorten() - shorten device-path + * + * When creating a short-boot option we want to use a device-path that is + * independent of the location where the block device is plugged in. + * + * UsbWwi() nodes contain a serial number, hard drive paths a partition + * UUID. Both should be unique. + * + * See UEFI spec, section 3.1.2 for "short-form device path". + * + * @dp: original device-path + * Return: shortened device-path or NULL + */ +struct efi_device_path *efi_dp_shorten(struct efi_device_path *dp); + +/** + * efi_dp_find_obj() - find handle by device path + * + * If @rem is provided, the handle with the longest partial match is returned. + * + * @dp: device path to search + * @guid: GUID of protocol that must be installed on path or NULL + * @rem: pointer to receive remaining device path + * Return: matching handle + */ +efi_handle_t efi_dp_find_obj(struct efi_device_path *dp, const efi_guid_t *guid, + struct efi_device_path **rem); + +/** + * efi_dp_last_node() - Determine the last device path node before the end node + * + * Iterate through the device path to find the very last node before + * the terminating EFI_DP_END node. + * + * @dp: Pointer to the device path. + * Return: Pointer to the last actual data node before the end node if it exists + * otherwise NULL (e.g., if dp is NULL or only an EFI_DP_END node). + */ +const struct efi_device_path *efi_dp_last_node(const struct efi_device_path *dp); + +/** + * efi_dp_instance_size() - Get size of the first device path instance + * + * Calculate the total length of all nodes in the first instance of a + * (potentially multi-instance) device path. The size of the instance-specific + * end node (if any) or the final device path. The end node is not included. + * + * @dp: Pointer to the device path. + * Return: Size in bytes of the first instance, or 0 if dp is NULL or an + * EFI_DP_END node + */ +efi_uintn_t efi_dp_instance_size(const struct efi_device_path *dp); + +/** + * efi_dp_size() - Get size of multi-instance device path excluding end node + * + * Calculate the total size of the entire device path structure, traversing + * through all instances, up to but not including the final + * END_ENTIRE_DEVICE_PATH node. + * + * @dp: Pointer to the device path. + * Return: Total size in bytes of all nodes in the device path (excluding the + * final EFI_DP_END node), or 0 if dp is NULL. + */ +efi_uintn_t efi_dp_size(const struct efi_device_path *dp); + +/** + * efi_dp_dup() - Copy multi-instance device path + * + * Duplicate the given device path, including its end node(s). + * The caller is responsible for freeing the allocated memory (e.g., + * using efi_free()). + * + * @dp: Pointer to the device path to duplicate. + * Return: Pointer to the newly allocated and copied device path, or NULL on + * allocation failure or if dp is NULL. + */ +struct efi_device_path *efi_dp_dup(const struct efi_device_path *dp); + +/** + * efi_dp_concat() - Concatenate two device paths and terminate the result + * + * @dp1: First device path + * @dp2: Second device path + * @split_end_node: + * - 0 to concatenate (dp1 is assumed not to have an end node or it's ignored, + * dp2 is appended, then one EFI_DP_END node) + * - 1 to concatenate with end node added as separator (dp1, END_THIS_INSTANCE, + * dp2, END_ENTIRE) + * + * Size of dp1 excluding last end node to concatenate with end node as + * separator in case dp1 contains an end node (dp1 (partial), END_THIS_INSTANCE, + * dp2, END_ENTIRE) + * + * Return: + * concatenated device path or NULL. Caller must free the returned value. + */ +struct efi_device_path *efi_dp_concat(const struct efi_device_path *dp1, + const struct efi_device_path *dp2, + size_t split_end_node); + +/** + * efi_dp_append_node() - Append a single node to a device path + * + * Create a new device path by appending a given node to an existing + * device path. + * If the original device path @dp is NULL, a new path is created + * with the given @node followed by an EFI_DP_END node. + * If the @node is NULL and @dp is not NULL, the original path @dp is + * duplicated. + * If both @dp and @node are NULL, a path with only an EFI_DP_END node is + * returned. + * The caller must free the returned path (e.g., using efi_free()). + * + * @dp: Original device path (can be NULL). + * @node: Node to append (can be NULL). + * Return: New device path with the node appended, or NULL on allocation + * failure. + */ +struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp, + const struct efi_device_path *node); + +/** + * efi_dp_create_device_node() - Create a new device path node + * + * Allocate and initialise the header of a new EFI device path node with the + * given type, sub-type, and length. The content of the node beyond the basic + * efi_device_path header is zeroed by efi_alloc. + * + * @type: Device path type. + * @sub_type: Device path sub-type. + * @length: Length of the node (must be >= sizeof(struct efi_device_path)). + * Return: Pointer to the new device path node, or NULL on allocation failure + * or if length is invalid. + */ +struct efi_device_path *efi_dp_create_device_node(const u8 type, + const u8 sub_type, + const u16 length); + +/** + * efi_dp_append_instance() - Append a device path instance to another + * + * Concatenate two device paths, treating the second path (@dpi) as a new + * instance appended to the first path (@dp). An END_THIS_INSTANCE node is + * inserted between @dp and @dpi if @dp is not NULL. + * If @dp is NULL, @dpi is duplicated (and terminated appropriately). + * @dpi must not be NULL. + * The caller is responsible for freeing the returned path (e.g., using + * efi_free()). + * + * @dp: The base device path. If NULL, @dpi is duplicated. + * @dpi: The device path instance to append. Must not be NULL. + * Return: A new device path with @dpi appended as a new instance, or NULL on + * error (e.g. allocation failure, @dpi is NULL). + */ +struct efi_device_path * +efi_dp_append_instance(const struct efi_device_path *dp, + const struct efi_device_path *dpi); + +/** + * efi_dp_get_next_instance() - Extract the next dp instance + * + * Given a pointer to a pointer to a device path (@dp), this function extracts + * the first instance from the path. It allocates a new path for this extracted + * instance (including its instance-specific EFI_DP_END node). The input pointer + * (*@dp) is then updated to point to the start of the next instance in the + * original path, or set to NULL if no more instances remain. + * The caller is responsible for freeing the returned instance path (e.g., + * using efi_free()). + * + * @dp: On input, a pointer to a pointer to the multi-instance device path. + * On output, *@dp is updated to point to the start of the next instance, + * or NULL if no more instances. + * @size: Optional pointer to an efi_uintn_t variable that will receive the size + * of the extracted instance path (including its EFI_DP_END node). + * Return: Pointer to a newly allocated device path for the extracted instance, + * or NULL if no instance could be extracted or an error occurred (e.g., + * allocation failure). + */ +struct efi_device_path *efi_dp_get_next_instance(struct efi_device_path **dp, + efi_uintn_t *size); + +/** + * efi_dp_is_multi_instance() - Check if a device path is multi-instance + * + * Traverse the device path to its end. It is considered multi-instance if an + * END_THIS_INSTANCE_DEVICE_PATH node (type DEVICE_PATH_TYPE_END, sub-type + * DEVICE_PATH_SUB_TYPE_INSTANCE_END) is encountered before the final + * END_ENTIRE_DEVICE_PATH node. + * + * @dp: The device path to check. + * Return: True if the device path contains multiple instances, false otherwise + * (including if @dp is NULL). + */ +bool efi_dp_is_multi_instance(const struct efi_device_path *dp); + +/** + * efi_dp_from_part() - Construct a dp from a partition on a block device + * + * Create a full device path for a specified partition on a given block device. + * If the partition number @part is 0, the path is for the block device itself. + * The caller is responsible for freeing the allocated memory (e.g., using + * efi_free()). + * + * @desc: Pointer to the block device descriptor. + * @part: Partition number (0 for the whole device, >0 for a specific + * partition). + * Return: Pointer to the newly created device path, or NULL on allocation + * failure or if the device/partition is not found or invalid. + */ +struct efi_device_path *efi_dp_from_part(struct blk_desc *desc, int part); + +/** + * efi_dp_part_node() - Create a device node for a block device partition + * + * Creates a single device path node representing a specific partition + * (e.g., HardDrivePath or CDROMPath, depending on desc->part_type). + * It does not create the full path from the root, only the partition-specific + * node. The caller is responsible for freeing the allocated memory (e.g., + * using efi_free()). + * + * @desc: Pointer to the block device descriptor. + * @part: Partition number (must be > 0 and correspond to a valid partition on + * the device). + * Return: Pointer to the new device path node for the partition, or NULL on + * allocation * failure or error in getting partition information. + */ +struct efi_device_path *efi_dp_part_node(struct blk_desc *desc, int part); + +/** + * efi_dp_from_file() - append file path node to device path. + * + * @dp: device path or NULL + * @path: file path or NULL + * Return: device path or NULL in case of an error + */ +struct efi_device_path *efi_dp_from_file(const struct efi_device_path *dp, + const char *path); + +/** + * efi_dp_from_uart() - Create a device path for a UART device. + * + * Construct a device path representing the system's default UART, + * typically based on the U-Boot device model root and a UART messaging node. + * The caller is responsible for freeing the allocated memory (e.g., using + * efi_free()). + * + * Return: Pointer to the new UART device path, or NULL on allocation failure. + */ +struct efi_device_path *efi_dp_from_uart(void); + +/** + * efi_dp_from_eth() - Create a device path for an Ethernet device + * + * Construct a device path representing the given device. The caller is + * responsible for freeing the allocated memory (e.g. using efi_free()) + * + * @dev: UCLASS_ETH device to process + * + * Return: Pointer to the new Ethernet device path, or NULL on allocation + * failure + */ +struct efi_device_path *efi_dp_from_eth(struct udevice *dev); + +/** + * efi_dp_from_mem() - Construct a device-path for a memory-mapped region + * + * Create an EFI device path representing a specific memory region, defined + * by its type, start address, and size. + * The caller is responsible for freeing the allocated memory (e.g., + * using efi_free()). + * + * @memory_type: EFI memory type (e.g., EFI_RESERVED_MEMORY_TYPE). + * @start_address: Starting address of the memory region. + * @size: Size of the memory region in bytes. + * Return: Pointer to the new memory device path, or NULL on allocation failure + */ +struct efi_device_path *efi_dp_from_mem(u32 memory_type, u64 start_address, + size_t size); + +/** + * efi_dp_split_file_path() - split of relative file path from device path + * + * Given a device path indicating a file on a device, separate the device + * path in two: the device path of the actual device and the file path + * relative to this device. + * + * @full_path: device path including device and file path + * @device_path: path of the device + * @file_path: relative path of the file or NULL if there is none + * Return: status code + */ +efi_status_t efi_dp_split_file_path(struct efi_device_path *full_path, + struct efi_device_path **device_path, + struct efi_device_path **file_path); + +/** + * efi_dp_from_name() - convert U-Boot device and file path to device path + * + * @dev: U-Boot device, e.g. 'mmc' + * @devnr: U-Boot device number, e.g. 1 for 'mmc:1' + * @path: file path relative to U-Boot device, may be NULL + * @device: pointer to receive device path of the device + * @file: pointer to receive device path for the file + * Return: status code + */ +efi_status_t efi_dp_from_name(const char *dev, const char *devnr, + const char *path, struct efi_device_path **device, + struct efi_device_path **file); + +/** + * efi_dp_check_length() - check length of a device path + * + * @dp: pointer to device path + * @maxlen: maximum length of the device path + * Return: + * * length of the device path if it is less or equal @maxlen + * * -1 if the device path is longer then @maxlen + * * -1 if a device path node has a length of less than 4 + * * -EINVAL if maxlen exceeds SSIZE_MAX + */ +ssize_t efi_dp_check_length(const struct efi_device_path *dp, + const size_t maxlen); + +/** + * efi_dp_from_lo() - get device-path from load option + * + * The load options in U-Boot may contain multiple concatenated device-paths. + * The first device-path indicates the EFI binary to execute. Subsequent + * device-paths start with a VenMedia node where the GUID identifies the + * function (initrd or fdt). + * + * @lo: EFI load option containing a valid device path + * @guid: GUID identifying device-path or NULL for the EFI binary + * + * Return: + * device path excluding the matched VenMedia node or NULL. + * Caller must free the returned value. + */ +struct efi_device_path *efi_dp_from_lo(struct efi_load_option *lo, + const efi_guid_t *guid); + +/** + * search_gpt_dp_node() - search gpt device path node + * + * @device_path: device path + * + * Return: pointer to the gpt device path node + */ +struct efi_device_path *search_gpt_dp_node(struct efi_device_path *device_path); + +/** + * efi_dp_from_http() - set device path from http + * + * Set the device path to an IPv4 path as provided by efi_dp_from_ipv4 + * concatenated with a device path of subtype DEVICE_PATH_SUB_TYPE_MSG_URI, + * and an EFI_DP_END node. + * + * @server: URI of remote server + * @dev: net udevice + * Return: pointer to HTTP device path, NULL on error + */ +struct efi_device_path *efi_dp_from_http(const char *server, + struct udevice *dev); + +#endif /* EFI_DEVICE_PATH_H */ diff --git a/include/efi_loader.h b/include/efi_loader.h index f3c85ae8d66..8fd09aad2d0 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -9,6 +9,7 @@ #define _EFI_LOADER_H 1 #include <blk.h> +#include <efi_device_path.h> #include <event.h> #include <efi_api.h> #include <image.h> @@ -584,8 +585,27 @@ efi_status_t efi_bootmgr_delete_boot_option(u16 boot_index); efi_status_t efi_bootmgr_run(void *fdt); /* search the boot option index in BootOrder */ bool efi_search_bootorder(u16 *bootorder, efi_uintn_t num, u32 target, u32 *index); -/* Set up console modes */ + +/** + * efi_setup_console_size() - update the mode table. + * + * By default the only mode available is 80x25. If the console has at least 50 + * lines, enable mode 80x50. If we can query the console size and it is neither + * 80x25 nor 80x50, set it as an additional mode. + */ void efi_setup_console_size(void); + +/** + * efi_console_set_ansi() - Set whether ANSI escape-characters should be emitted + * + * These characters mess up tests which use ut_assert_nextline(). Call this + * function to tell efi_loader not to emit these characters when starting up the + * terminal + * + * @allow_ansi: Allow emitting ANSI escape-characters + */ +void efi_console_set_ansi(bool allow_ansi); + /* Set up load options from environment variable */ efi_status_t efi_env_set_load_options(efi_handle_t handle, const char *env_var, u16 **load_options); @@ -912,66 +932,10 @@ extern void *efi_bounce_buffer; #define EFI_LOADER_BOUNCE_BUFFER_SIZE (64 * 1024 * 1024) #endif -/* shorten device path */ -struct efi_device_path *efi_dp_shorten(struct efi_device_path *dp); -struct efi_device_path *efi_dp_next(const struct efi_device_path *dp); -int efi_dp_match(const struct efi_device_path *a, - const struct efi_device_path *b); -efi_handle_t efi_dp_find_obj(struct efi_device_path *dp, - const efi_guid_t *guid, - struct efi_device_path **rem); -/* get size of the first device path instance excluding end node */ -efi_uintn_t efi_dp_instance_size(const struct efi_device_path *dp); -/* size of multi-instance device path excluding end node */ -efi_uintn_t efi_dp_size(const struct efi_device_path *dp); -struct efi_device_path *efi_dp_dup(const struct efi_device_path *dp); -struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp, - const struct efi_device_path *node); -/* Create a device path node of given type, sub-type, length */ -struct efi_device_path *efi_dp_create_device_node(const u8 type, - const u8 sub_type, - const u16 length); -/* Append device path instance */ -struct efi_device_path *efi_dp_append_instance( - const struct efi_device_path *dp, - const struct efi_device_path *dpi); -/* Get next device path instance */ -struct efi_device_path *efi_dp_get_next_instance(struct efi_device_path **dp, - efi_uintn_t *size); -/* Check if a device path contains muliple instances */ -bool efi_dp_is_multi_instance(const struct efi_device_path *dp); - -struct efi_device_path *efi_dp_from_part(struct blk_desc *desc, int part); -/* Create a device node for a block device partition. */ -struct efi_device_path *efi_dp_part_node(struct blk_desc *desc, int part); -struct efi_device_path *efi_dp_from_file(const struct efi_device_path *dp, - const char *path); -struct efi_device_path *efi_dp_from_eth(struct udevice *dev); -struct efi_device_path *efi_dp_from_http(const char *server, struct udevice *dev); -struct efi_device_path *efi_dp_from_mem(uint32_t mem_type, - uint64_t start_address, - size_t size); -/* Determine the last device path node that is not the end node. */ -const struct efi_device_path *efi_dp_last_node( - const struct efi_device_path *dp); -efi_status_t efi_dp_split_file_path(struct efi_device_path *full_path, - struct efi_device_path **device_path, - struct efi_device_path **file_path); -struct efi_device_path *efi_dp_from_uart(void); -efi_status_t efi_dp_from_name(const char *dev, const char *devnr, - const char *path, - struct efi_device_path **device, - struct efi_device_path **file); -ssize_t efi_dp_check_length(const struct efi_device_path *dp, - const size_t maxlen); - #define EFI_DP_TYPE(_dp, _type, _subtype) \ (((_dp)->type == DEVICE_PATH_TYPE_##_type) && \ ((_dp)->sub_type == DEVICE_PATH_SUB_TYPE_##_subtype)) -/* template END node: */ -extern const struct efi_device_path END; - /* Indicate supported runtime services */ efi_status_t efi_init_runtime_supported(void); diff --git a/include/env_internal.h b/include/env_internal.h index ee939ba4293..75b46d0bcb0 100644 --- a/include/env_internal.h +++ b/include/env_internal.h @@ -115,6 +115,7 @@ enum env_location { ENVL_SPI_FLASH, ENVL_MTD, ENVL_UBI, + ENVL_SCSI, ENVL_NOWHERE, ENVL_COUNT, diff --git a/include/expo.h b/include/expo.h index 3c383d2e2ee..4dee479e9a0 100644 --- a/include/expo.h +++ b/include/expo.h @@ -8,7 +8,9 @@ #define __EXPO_H #include <abuf.h> +#include <alist.h> #include <dm/ofnode_decl.h> +#include <linux/bitops.h> #include <linux/list.h> struct udevice; @@ -104,10 +106,14 @@ struct expo_theme { * type set to EXPOACT_NONE if there is no action * @text_mode: true to use text mode for the menu (no vidconsole) * @popup: true to use popup menus, instead of showing all items + * @show_highlight: show a highlight bar on the selected menu item * @priv: Private data for the controller + * @done: Indicates that a cedit session is complete and the user has quit + * @save: Indicates that cedit data should be saved, rather than discarded * @theme: Information about fonts styles, etc. * @scene_head: List of scenes * @str_head: list of strings + * @cch: Keyboard context for input */ struct expo { char *name; @@ -118,22 +124,26 @@ struct expo { struct expo_action action; bool text_mode; bool popup; + bool show_highlight; void *priv; + bool done; + bool save; struct expo_theme theme; struct list_head scene_head; struct list_head str_head; + struct cli_ch_state cch; }; /** * struct expo_string - a string that can be used in an expo * * @id: ID number of the string - * @str: String + * @buf: String (contains nul terminator) * @sibling: Node to link this object to its siblings */ struct expo_string { uint id; - const char *str; + struct abuf buf; struct list_head sibling; }; @@ -171,14 +181,18 @@ struct scene { * * @SCENEOBJT_NONE: Used to indicate that the type does not matter * @SCENEOBJT_IMAGE: Image data to render + * @SCENEOBJT_BOX: Rectangular box * @SCENEOBJT_TEXT: Text line to render * @SCENEOBJT_MENU: Menu containing items the user can select * @SCENEOBJT_TEXTLINE: Line of text the user can edit + * @SCENEOBJT_TEXTEDIT: Simple text editor */ enum scene_obj_t { SCENEOBJT_NONE = 0, SCENEOBJT_IMAGE, SCENEOBJT_TEXT, + SCENEOBJT_BOX, + SCENEOBJT_TEXTEDIT, /* types from here on can be highlighted */ SCENEOBJT_MENU, @@ -186,18 +200,76 @@ enum scene_obj_t { }; /** - * struct scene_dim - Dimensions of an object + * struct scene_obj_bbox - Dimensions of an object * - * @x: x position, in pixels from left side - * @y: y position, in pixels from top - * @w: width, in pixels - * @h: height, in pixels + * @x0: x position, in pixels from left side + * @y0: y position, in pixels from top + * @x1: x position of right size + * @y1: y position of bottom + */ +struct scene_obj_bbox { + int x0; + int y0; + int x1; + int y1; +}; + +/** + * struct scene_obj_offset - Offsets for drawing the object + * + * Stores the offset from x0, x1 at which objects are drawn + * + * @xofs: x offset + * @yofs: y offset */ -struct scene_dim { +struct scene_obj_offset { + int xofs; + int yofs; +}; + +/** + * struct scene_obj_dims - Dimensions of the object being drawn + * + * Image and text objects have a dimension which can change depending on what + * they contain. For images this stores the size. For text it stores the size as + * rendered on the display + * + * @x: x dimension + * @y: y dimension + */ +struct scene_obj_dims { int x; int y; - int w; - int h; +}; + +/* special values for dimensions */ +enum { + /* width/height of the display */ + SCENEOB_DISPLAY_MAX = 0x7f000000, +}; + +/** + * enum scene_obj_halign - Horizontal alignment of objects + * + * Objects are normally drawn on the left size of their bounding box. This + * properly allows aligning on the right or having the object centred. + * + * @SCENEOA_LEFT: Left of object is aligned with its x coordinate + * @SCENEOA_RIGHT: Right of object is aligned with x + w + * @SCENEOA_CENTRE: Centre of object is aligned with centre of bounding box + * @SCENEOA_TOP: Left of object is aligned with its x coordinate + * @SCENEOA_BOTTOM: Right of object is aligned with x + w + * + * Note: It would be nice to make this a char type but Sphinx riddles: + * ./include/expo.h:258: error: Cannot parse enum! + * enum scene_obj_align : char { + */ +enum scene_obj_align { + SCENEOA_LEFT, + SCENEOA_RIGHT, + SCENEOA_CENTRE, + SCENEOA_TOP = SCENEOA_LEFT, + SCENEOA_BOTTOM = SCENEOA_RIGHT, }; /** @@ -207,11 +279,14 @@ struct scene_dim { * @SCENEOF_POINT: object should be highlighted * @SCENEOF_OPEN: object should be opened (e.g. menu is opened so that an option * can be selected) + * @SCENEOF_SIZE_VALID: object's size (width/height) is valid, so any adjustment + * to x0/y0 should maintain the width/height of the object */ enum scene_obj_flags_t { SCENEOF_HIDE = 1 << 0, SCENEOF_POINT = 1 << 1, SCENEOF_OPEN = 1 << 2, + SCENEOF_SIZE_VALID = BIT(3), }; enum { @@ -226,7 +301,11 @@ enum { * @name: Name of the object (allocated) * @id: ID number of the object * @type: Type of this object - * @dim: Dimensions for this object + * @bbox: Bounding box for this object + * @ofs: Offset from x0, y0 where the object is drawn + * @dims: Dimensions of the text/image (may be smaller than bbox) + * @horiz: Horizonal alignment + * @vert: Vertical alignment * @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 @@ -237,7 +316,11 @@ struct scene_obj { char *name; uint id; enum scene_obj_t type; - struct scene_dim dim; + struct scene_obj_bbox bbox; + struct scene_obj_offset ofs; + struct scene_obj_dims dims; + enum scene_obj_align horiz; + enum scene_obj_align vert; u8 flags; u8 bit_length; u16 start_bit; @@ -264,20 +347,32 @@ struct scene_obj_img { }; /** - * struct scene_obj_txt - information about a text object in a scene + * struct scene_txt_generic - Generic information common to text objects * - * This is a single-line text object - * - * @obj: Basic object information * @str_id: ID of the text string to display * @font_name: Name of font (allocated by caller) * @font_size: Nominal size of font in pixels + * @lines: alist of struct vidconsole_mline with a separate record for each + * line of text */ -struct scene_obj_txt { - struct scene_obj obj; +struct scene_txt_generic { uint str_id; const char *font_name; uint font_size; + struct alist lines; +}; + +/** + * struct scene_obj_txt - information about a text object in a scene + * + * This is a single-line text object + * + * @obj: Basic object information + * @gen: Generic information common to all objects which show text + */ +struct scene_obj_txt { + struct scene_obj obj; + struct scene_txt_generic gen; }; /** @@ -367,6 +462,34 @@ struct scene_obj_textline { }; /** + * struct scene_obj_box - information about a box in a scene + * + * A box surrounds a part of the screen with a border + * + * @obj: Basic object information + * @width: Line-width in pixels + */ +struct scene_obj_box { + struct scene_obj obj; + uint width; +}; + +/** + * struct scene_obj_txtedit - information about a box in a scene + * + * A text editor which allows users to edit a small text file + * + * @obj: Basic object information + * @gen: Generic information common to all objects which show text + * @buf: Text buffer containing current text + */ +struct scene_obj_txtedit { + struct scene_obj obj; + struct scene_txt_generic gen; + struct abuf buf; +}; + +/** * struct expo_arrange_info - Information used when arranging a scene * * @label_width: Maximum width of labels in scene @@ -434,6 +557,23 @@ int expo_str(struct expo *exp, const char *name, uint id, const char *str); const char *expo_get_str(struct expo *exp, uint id); /** + * expo_edit_str() - Make a string writeable + * + * This allows a string to be updated under the control of the caller. The + * buffer must remain valid while the expo is active. + * + * @exp: Expo to use + * @id: String ID to look up + * @orig: If non-NULL, returns the original buffer, which can be used by the + * caller. It is no-longer used by expo so must be uninited by the caller. + * It contains a snapshot of the string contents + * @copyp: Returns a pointer to the new, writeable buffer + * Return: 0 if OK, -ENOENT if the id was not found, -ENOMEM if out of memory + */ +int expo_edit_str(struct expo *exp, uint id, struct abuf *orig, + struct abuf **copyp); + +/** * expo_set_display() - set the display to use for a expo * * @exp: Expo to update @@ -614,6 +754,32 @@ int scene_textline(struct scene *scn, const char *name, uint id, uint max_chars, struct scene_obj_textline **tlinep); /** + * scene_box() - create a box + * + * @scn: Scene to update + * @name: Name to use (this is allocated by this call) + * @id: ID to use for the new object (0 to allocate one) + * @width: Line-width in pixels + * @boxp: If non-NULL, returns the new object + * Returns: ID number for the object (typically @id), or -ve on error + */ +int scene_box(struct scene *scn, const char *name, uint id, uint width, + struct scene_obj_box **boxp); + +/** + * scene_texted() - create a text editor + * + * @scn: Scene to update + * @name: Name to use (this is allocated by this call) + * @id: ID to use for the new object (0 to allocate one) + * @strid: ID of the string to edit + * @teditp: If non-NULL, returns the new object + * Returns: ID number for the object (typically @id), or -ve on error + */ +int scene_texted(struct scene *scn, const char *name, uint id, uint strid, + struct scene_obj_txtedit **teditp); + +/** * scene_txt_set_font() - Set the font for an object * * @scn: Scene to update @@ -625,6 +791,17 @@ int scene_txt_set_font(struct scene *scn, uint id, const char *font_name, uint font_size); /** + * scene_txted_set_font() - Set the font for an object + * + * @scn: Scene to update + * @id: ID of object to update + * @font_name: Font name to use (allocated by caller) + * @font_size: Font size to use (nominal height in pixels) + */ +int scene_txted_set_font(struct scene *scn, uint id, const char *font_name, + uint font_size); + +/** * scene_obj_set_pos() - Set the postion of an object * * @scn: Scene to update @@ -647,6 +824,50 @@ int scene_obj_set_pos(struct scene *scn, uint id, int x, int y); int scene_obj_set_size(struct scene *scn, uint id, int w, int h); /** + * scene_obj_set_width() - Set the width of an object + * + * @scn: Scene to update + * @id: ID of object to update + * @w: width in pixels + * Returns: 0 if OK, -ENOENT if @id is invalid + */ +int scene_obj_set_width(struct scene *scn, uint id, int w); + +/** + * scene_obj_set_bbox() - Set the bounding box of an object + * + * @scn: Scene to update + * @id: ID of object to update + * @x0: x position, in pixels from left side + * @y0: y position, in pixels from top + * @x1: ending x position (right side) + * @y1: ending y position (botton side) + * Returns: 0 if OK, -ENOENT if @id is invalid + */ +int scene_obj_set_bbox(struct scene *scn, uint id, int x0, int y0, int x1, + int y1); + +/** + * scene_obj_set_halign() - Set the horizontal alignment of an object + * + * @scn: Scene to update + * @id: ID of object to update + * @aln: Horizontal alignment to use + * Returns: 0 if OK, -ENOENT if @id is invalid + */ +int scene_obj_set_halign(struct scene *scn, uint id, enum scene_obj_align aln); + +/** + * scene_obj_set_valign() - Set the vertical alignment of an object + * + * @scn: Scene to update + * @id: ID of object to update + * @aln: Vertical alignment to use + * Returns: 0 if OK, -ENOENT if @id is invalid + */ +int scene_obj_set_valign(struct scene *scn, uint id, enum scene_obj_align aln); + +/** * scene_obj_set_hide() - Set whether an object is hidden * * The update happens when the expo is next rendered. @@ -684,6 +905,26 @@ int scene_menu_set_title(struct scene *scn, uint id, uint title_id); int scene_menu_set_pointer(struct scene *scn, uint id, uint cur_item_id); /** + * scene_menu_select_item() - move the pointer/highlight to an item + * + * @scn: Scene to update + * @id: ID of menu object to update + * @sel_id: ID of the menuitem to select + * Return 0 on success, -ENOENT if there was no such item + */ +int scene_menu_select_item(struct scene *scn, uint id, uint sel_id); + +/** + * scene_menu_get_cur_item() - get the currently pointed-to item + * + * @scn: Scene to update + * @id: ID of menu object to update + * Return ID of the current item the menu is pointing to, -ENOENT if @id is not + * valid, 0 if no item is pointed to + */ +int scene_menu_get_cur_item(struct scene *scn, uint id); + +/** * scene_obj_get_hw() - Get width and height of an object in a scene * * @scn: Scene to check @@ -770,4 +1011,20 @@ int expo_build(ofnode root, struct expo **expp); */ int cb_expo_build(struct expo **expp); +/** + * expo_poll() - see if the user takes an action + * + * This checks for a keypress. If there is one, it is processed and the + * resulting action returned, if any. + * + * Note that expo_render() should normally be called immediately before this + * function so that the user can see the latest state. + * + * @exp: Expo to poll + * @act: Returns action on success + * Return: 0 if an action was obtained, -EAGAIN if not, other error if something + * went wrong + */ +int expo_poll(struct expo *exp, struct expo_action *act); + #endif /*__EXPO_H */ diff --git a/include/image.h b/include/image.h index c1db8383459..1e1bded690b 100644 --- a/include/image.h +++ b/include/image.h @@ -138,7 +138,8 @@ enum { IH_ARCH_ARC, /* Synopsys DesignWare ARC */ IH_ARCH_X86_64, /* AMD x86_64, Intel and Via */ IH_ARCH_XTENSA, /* Xtensa */ - IH_ARCH_RISCV, /* RISC-V */ + IH_ARCH_RISCV, /* RISC-V 32 bit*/ + IH_ARCH_RISCV64, /* RISC-V 64 bit*/ IH_ARCH_COUNT, }; @@ -2133,7 +2134,7 @@ struct fit_loadable_tbl { * _handler is the handler function to call after this image type is loaded */ #define U_BOOT_FIT_LOADABLE_HANDLER(_type, _handler) \ - ll_entry_declare(struct fit_loadable_tbl, _function, fit_loadable) = { \ + ll_entry_declare(struct fit_loadable_tbl, _type, fit_loadable) = { \ .type = _type, \ .handler = _handler, \ } diff --git a/include/net-common.h b/include/net-common.h index e536968a92b..c04f86bdfcc 100644 --- a/include/net-common.h +++ b/include/net-common.h @@ -5,7 +5,6 @@ #include <asm/cache.h> #include <command.h> -#include <env.h> #include <hexdump.h> #include <linux/if_ether.h> #include <linux/sizes.h> @@ -456,19 +455,6 @@ void net_process_received_packet(uchar *in_packet, int len); */ int update_tftp(ulong addr, char *interface, char *devstring); -/** - * env_get_ip() - Convert an environment value to an ip address - * - * @var: Environment variable to convert. The value of this variable must be - * in the format a.b.c.d, where each value is a decimal number from - * 0 to 255 - * Return: IP address, or 0 if invalid - */ -static inline struct in_addr env_get_ip(char *var) -{ - return string_to_ip(env_get(var)); -} - int net_init(void); /* Called when a network operation fails to know if it should be re-tried */ @@ -570,6 +556,7 @@ enum wget_http_method { * Filled by client. * @hdr_cont_len: content length according to headers. Filled by wget * @headers: buffer for headers. Filled by wget. + * @silent: do not print anything to the console. Filled by client. */ struct wget_http_info { enum wget_http_method method; @@ -580,6 +567,7 @@ struct wget_http_info { bool check_buffer_size; u32 hdr_cont_len; char *headers; + bool silent; }; extern struct wget_http_info default_wget_info; diff --git a/include/net-legacy.h b/include/net-legacy.h index 51780999a88..a7dbcec1506 100644 --- a/include/net-legacy.h +++ b/include/net-legacy.h @@ -17,6 +17,7 @@ #include <log.h> #include <time.h> #include <linux/if_ether.h> +#include <linux/string.h> struct bd_info; struct cmd_tbl; diff --git a/include/net6.h b/include/net6.h index 2ceeaba0639..39573e490a6 100644 --- a/include/net6.h +++ b/include/net6.h @@ -11,6 +11,7 @@ #define __NET6_H__ #include <net.h> +#include <asm/byteorder.h> #include <linux/ctype.h> #include <linux/errno.h> diff --git a/include/part.h b/include/part.h index 3fa2d8424b7..7075b2cb116 100644 --- a/include/part.h +++ b/include/part.h @@ -315,6 +315,20 @@ int part_get_info_by_name(struct blk_desc *desc, const char *name, struct disk_partition *info); /** + * part_get_info_by_uuid() - Search for a partition by uuid + * among all available registered partitions + * + * @desc: block device descriptor + * @uuid: the specified table entry uuid + * @info: the disk partition info + * + * Return: the partition number on match (starting on 1), -ENOENT on no match, + * otherwise error + */ +int part_get_info_by_uuid(struct blk_desc *desc, const char *uuid, + struct disk_partition *info); + +/** * part_get_info_by_dev_and_name_or_num() - Get partition info from dev number * and part name, or dev number and * part number. @@ -385,6 +399,12 @@ static inline int part_get_info_by_name(struct blk_desc *desc, const char *name, return -ENOENT; } +static inline int part_get_info_by_uuid(struct blk_desc *desc, const char *uuid, + struct disk_partition *info) +{ + return -ENOENT; +} + static inline int part_get_info_by_dev_and_name_or_num(const char *dev_iface, const char *dev_part_str, diff --git a/include/scsi.h b/include/scsi.h index ab53b47b58f..8d6c5116419 100644 --- a/include/scsi.h +++ b/include/scsi.h @@ -351,6 +351,16 @@ int scsi_scan(bool verbose); */ int scsi_scan_dev(struct udevice *dev, bool verbose); +/** + * scsi_get_blk_by_uuid() - Provides SCSI partition information. + * + * @uuid: UUID of the partition for fetching its info + * @blk_desc_ptr: Provides the blk descriptor + * @part_info_ptr: Provides partition info + */ +int scsi_get_blk_by_uuid(const char *uuid, struct blk_desc **blk_desc_ptr, + struct disk_partition *part_info_ptr); + #define SCSI_IDENTIFY 0xC0 /* not used */ /* Hardware errors */ diff --git a/include/slre.h b/include/slre.h index 4b41a4b276f..af5b1302d9c 100644 --- a/include/slre.h +++ b/include/slre.h @@ -63,7 +63,6 @@ struct slre { int code_size; int data_size; int num_caps; /* Number of bracket pairs */ - int anchored; /* Must match from string start */ const char *err_str; /* Error string */ }; |