diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/global_data.h | 12 | ||||
-rw-r--r-- | include/bloblist.h | 18 | ||||
-rw-r--r-- | include/bootstage.h | 22 | ||||
-rw-r--r-- | include/command.h | 4 | ||||
-rw-r--r-- | include/configs/socfpga_common.h | 2 | ||||
-rw-r--r-- | include/configs/socfpga_soc64_common.h | 2 | ||||
-rw-r--r-- | include/dm/device.h | 3 | ||||
-rw-r--r-- | include/dm/fdtaddr.h | 3 | ||||
-rw-r--r-- | include/dm/of_access.h | 18 | ||||
-rw-r--r-- | include/dm/ofnode.h | 102 | ||||
-rw-r--r-- | include/dm/read.h | 8 | ||||
-rw-r--r-- | include/ns16550.h | 4 | ||||
-rw-r--r-- | include/of_live.h | 18 | ||||
-rw-r--r-- | include/serial.h | 2 | ||||
-rw-r--r-- | include/spl.h | 38 | ||||
-rw-r--r-- | include/system-constants.h | 20 |
16 files changed, 256 insertions, 20 deletions
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index c6d63b3657c..e8c6412e3f8 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -307,7 +307,7 @@ struct global_data { #if CONFIG_IS_ENABLED(CMD_BDINFO_EXTRA) unsigned long malloc_start; #endif -#if CONFIG_VAL(SYS_MALLOC_F_LEN) +#if CONFIG_IS_ENABLED(SYS_MALLOC_F) /** * @malloc_base: base address of early malloc() */ @@ -588,6 +588,12 @@ static_assert(sizeof(struct global_data) == GD_SIZE); #define gd_set_pci_ram_top(val) #endif +#if CONFIG_VAL(SYS_MALLOC_F_LEN) +#define gd_malloc_ptr() gd->malloc_ptr +#else +#define gd_malloc_ptr() 0L +#endif + /** * enum gd_flags - global data flags * @@ -687,6 +693,10 @@ enum gd_flags { * the memory used to holds its tables has been mapped out. */ GD_FLG_DM_DEAD = 0x400000, + /** + * @GD_FLG_BLOBLIST_READY: bloblist is ready for use + */ + GD_FLG_BLOBLIST_READY = 0x800000, }; #endif /* __ASSEMBLY__ */ diff --git a/include/bloblist.h b/include/bloblist.h index 7ea72c6bd46..080cc46a126 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -413,8 +413,26 @@ void bloblist_reloc(void *to, uint to_size, void *from, uint from_size); * standard passage. The size is detected automatically so CONFIG_BLOBLIST_SIZE * can be 0. * + * Sets GD_FLG_BLOBLIST_READY in global_data flags on success + * * Return: 0 if OK, -ve on error */ int bloblist_init(void); +#if CONFIG_IS_ENABLED(BLOBLIST) +/** + * bloblist_maybe_init() - Init the bloblist system if not already done + * + * Calls bloblist_init() if the GD_FLG_BLOBLIST_READY flag is not et + * + * Return: 0 if OK, -ve on error + */ +int bloblist_maybe_init(void); +#else +static inline int bloblist_maybe_init(void) +{ + return 0; +} +#endif /* BLOBLIST */ + #endif /* __BLOBLIST_H */ diff --git a/include/bootstage.h b/include/bootstage.h index 685939ccffc..f9376c320c9 100644 --- a/include/bootstage.h +++ b/include/bootstage.h @@ -244,6 +244,8 @@ void show_boot_progress(int val); #ifdef ENABLE_BOOTSTAGE +#include <mapmem.h> + /* This is the full bootstage implementation */ /** @@ -452,6 +454,26 @@ static inline int bootstage_init(bool first) #endif /* ENABLE_BOOTSTAGE */ +/* helpers for SPL */ +int _bootstage_stash_default(void); +int _bootstage_unstash_default(void); + +static inline int bootstage_stash_default(void) +{ + if (CONFIG_IS_ENABLED(BOOTSTAGE) && IS_ENABLED(CONFIG_BOOTSTAGE_STASH)) + return _bootstage_stash_default(); + + return 0; +} + +static inline int bootstage_unstash_default(void) +{ + if (CONFIG_IS_ENABLED(BOOTSTAGE) && IS_ENABLED(CONFIG_BOOTSTAGE_STASH)) + return _bootstage_unstash_default(); + + return 0; +} + /* Helper macro for adding a bootstage to a line of code */ #define BOOTSTAGE_MARKER() \ bootstage_mark_code(__FILE__, __func__, __LINE__) diff --git a/include/command.h b/include/command.h index ae7bb4a30b0..34ea989b39b 100644 --- a/include/command.h +++ b/include/command.h @@ -25,6 +25,10 @@ #endif #ifndef __ASSEMBLY__ + +/* For ARRAY_SIZE() */ +#include <linux/kernel.h> + /* * Monitor Command Table */ diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h index 0c96c9c24fe..4838bfd4f13 100644 --- a/include/configs/socfpga_common.h +++ b/include/configs/socfpga_common.h @@ -18,7 +18,7 @@ #define CFG_SYS_INIT_RAM_ADDR 0xFFE00000 /* SPL memory allocation configuration, this is for FAT implementation */ #define CFG_SYS_INIT_RAM_SIZE (SOCFPGA_PHYS_OCRAM_SIZE - \ - CONFIG_SYS_SPL_MALLOC_SIZE) + CONFIG_SPL_SYS_MALLOC_SIZE) #endif /* diff --git a/include/configs/socfpga_soc64_common.h b/include/configs/socfpga_soc64_common.h index 66ecb168a0a..820372c28b3 100644 --- a/include/configs/socfpga_soc64_common.h +++ b/include/configs/socfpga_soc64_common.h @@ -112,7 +112,7 @@ unsigned int cm_get_l4_sys_free_clk_hz(void); * SDRAM * 0x0000_0000 ...... Start of SDRAM_1 * unused / empty space for image loading - * Size 64MB ...... MALLOC (size CONFIG_SYS_SPL_MALLOC_SIZE) + * Size 64MB ...... MALLOC (size CONFIG_SPL_SYS_MALLOC_SIZE) * Size 1MB ...... BSS (size CONFIG_SPL_BSS_MAX_SIZE) * 0x8000_0000 ...... End of SDRAM_1 (assume 2GB) * diff --git a/include/dm/device.h b/include/dm/device.h index e54cb6bca41..add67f9ec06 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -1005,7 +1005,8 @@ int dev_enable_by_path(const char *path); */ static inline bool device_is_on_pci_bus(const struct udevice *dev) { - return dev->parent && device_get_uclass_id(dev->parent) == UCLASS_PCI; + return CONFIG_IS_ENABLED(PCI) && dev->parent && + device_get_uclass_id(dev->parent) == UCLASS_PCI; } /** diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h index dcdc19137cc..6d2fa8f1044 100644 --- a/include/dm/fdtaddr.h +++ b/include/dm/fdtaddr.h @@ -168,8 +168,9 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev, * devfdt_get_addr_pci() - Read an address and handle PCI address translation * * @dev: Device to read from + * @sizep: If non-NULL, returns size of address space * Return: address or FDT_ADDR_T_NONE if not found */ -fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev); +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev, fdt_size_t *sizep); #endif diff --git a/include/dm/of_access.h b/include/dm/of_access.h index 9361d0a87bf..de740d44674 100644 --- a/include/dm/of_access.h +++ b/include/dm/of_access.h @@ -597,4 +597,22 @@ int of_write_prop(struct device_node *np, const char *propname, int len, int of_add_subnode(struct device_node *node, const char *name, int len, struct device_node **subnodep); +/** + * of_remove_property() - Remove a property from a node + * + * @np: Node to remove from + * @prop: Pointer to property to remove + * Return 0 if OK, -ENODEV if the property could not be found in the node + */ +int of_remove_property(struct device_node *np, struct property *prop); + +/** + * of_remove_node() - Remove a node from the tree + * + * @to_remove: Node to remove + * Return: 0 if OK, -EPERM if it is the root node (wWhich cannot be removed), + * -ENOENT if the tree is broken (to_remove is not a child of its parent) + */ +int of_remove_node(struct device_node *to_remove); + #endif diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 06c969c61fe..19e97a90327 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -17,6 +17,7 @@ /* Enable checks to protect against invalid calls */ #undef OF_CHECKS +struct abuf; struct resource; #include <dm/ofnode_decl.h> @@ -128,6 +129,27 @@ static inline ofnode noffset_to_ofnode(ofnode other_node, int of_offset) #endif /* OFNODE_MULTI_TREE */ /** + * oftree_new() - Create a new, empty tree + * + * @treep: Returns a pointer to the tree, on success + * Returns: 0 on success, -ENOMEM if out of memory, -E2BIG if !OF_LIVE and + * there are too many (flattrees) already + */ +int oftree_new(oftree *treep); + +/** + * oftree_to_fdt() - Convert an oftree to a flat FDT + * + * @tree: tree to flatten (if livetree) or copy (if not) + * @buf: Returns inited buffer containing the newly created flat tree. Note + * that for flat tree the buffer is not allocated. In either case the caller + * must call abut_uninit() to free any memory used by @buf + * Return: 0 on success, -ENOMEM if out of memory, other -ve value for any other + * error + */ +int oftree_to_fdt(oftree tree, struct abuf *buf); + +/** * ofnode_to_np() - convert an ofnode to a live DT node pointer * * This cannot be called if the reference contains an offset. @@ -1015,11 +1037,20 @@ int ofnode_decode_panel_timing(ofnode node, * @node: node to read * @propname: property to read * @lenp: place to put length on success - * Return: pointer to property, or NULL if not found + * Return: pointer to property value, or NULL if not found or empty */ const void *ofnode_get_property(ofnode node, const char *propname, int *lenp); /** + * ofnode_has_property() - check if a node has a named property + * + * @node: node to read + * @propname: property to read + * Return: true if the property exists in the node, false if not + */ +bool ofnode_has_property(ofnode node, const char *propname); + +/** * ofnode_first_property()- get the reference of the first property * * Get reference to the first property of the node, it is used to iterate @@ -1122,13 +1153,15 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname, * @type: pci address type (FDT_PCI_SPACE_xxx) * @propname: name of property to find * @addr: returns pci address in the form of fdt_pci_addr + * @size: if non-null, returns register-space size * Return: * 0 if ok, -ENOENT if the property did not exist, -EINVAL if the * format of the property was invalid, -ENXIO if the requested * address type was not found */ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type, - const char *propname, struct fdt_pci_addr *addr); + const char *propname, struct fdt_pci_addr *addr, + fdt_size_t *size); /** * ofnode_read_pci_vendev() - look up PCI vendor and device id @@ -1431,6 +1464,37 @@ int ofnode_write_string(ofnode node, const char *propname, const char *value); int ofnode_write_u32(ofnode node, const char *propname, u32 value); /** + * ofnode_write_u64() - Set an integer property of an ofnode + * + * @node: The node for whose string property should be set + * @propname: The name of the string property to set + * @value: The new value of the 64-bit integer property + * Return: 0 if successful, -ve on error + */ +int ofnode_write_u64(ofnode node, const char *propname, u64 value); + +/** + * ofnode_write_bool() - Set a boolean property of an ofnode + * + * This either adds or deleted a property with a zero-length value + * + * @node: The node for whose string property should be set + * @propname: The name of the string property to set + * @value: The new value of the boolean property + * Return: 0 if successful, -ve on error + */ +int ofnode_write_bool(ofnode node, const char *propname, bool value); + +/** + * ofnode_delete_prop() - Delete a property + * + * @node: Node containing the property to delete + * @propname: Name of property to delete + * Return: 0 if successful, -ve on error + */ +int ofnode_delete_prop(ofnode node, const char *propname); + +/** * ofnode_set_enabled() - Enable or disable a device tree node given by its * ofnode * @@ -1598,7 +1662,7 @@ int ofnode_add_subnode(ofnode parent, const char *name, ofnode *nodep); /** * ofnode_copy_props() - copy all properties from one node to another * - * Makes a copy of all properties from the source note in the destination node. + * Makes a copy of all properties from the source node to the destination node. * Existing properties in the destination node remain unchanged, except that * any with the same name are overwritten, including changing the size of the * property. @@ -1606,9 +1670,37 @@ int ofnode_add_subnode(ofnode parent, const char *name, ofnode *nodep); * For livetree, properties are copied / allocated, so the source tree does not * need to be present afterwards. * + * @dst: Destination node to write properties to * @src: Source node to read properties from - * @dst: Destination node to write properties too */ -int ofnode_copy_props(ofnode src, ofnode dst); +int ofnode_copy_props(ofnode dst, ofnode src); + +/** + * ofnode_copy_node() - Copy a node to another place + * + * If a node with this name already exists in dst_parent, this returns an + * .error + * + * @dst_parent: Parent of the newly copied node + * @name: Name to give the new node + * @src: Source node to copy + * @nodep: Returns the new node, or the existing node if there is one + * Return: 0 if OK, -EEXIST if dst_parent already has a node with this parent + */ +int ofnode_copy_node(ofnode dst_parent, const char *name, ofnode src, + ofnode *nodep); + +/** + * ofnode_delete() - Delete a node + * + * Delete a node from the tree + * + * @nodep: Pointer to node to delete (set to ofnode_null() on success) + * Return: 0 if OK, -ENOENT if the node does not exist, -EPERM if it is the root + * node (wWhich cannot be removed), -EFAULT if the tree is broken (to_remove is + * not a child of its parent), + * + */ +int ofnode_delete(ofnode *nodep); #endif diff --git a/include/dm/read.h b/include/dm/read.h index c2615f72f40..3c2eea6f0c4 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -346,9 +346,10 @@ void *dev_read_addr_ptr(const struct udevice *dev); * fdtdec_get_addr() and friends. * * @dev: Device to read from + * @sizep: If non-NULL, returns size of address space found * Return: address or FDT_ADDR_T_NONE if not found */ -fdt_addr_t dev_read_addr_pci(const struct udevice *dev); +fdt_addr_t dev_read_addr_pci(const struct udevice *dev, fdt_size_t *sizep); /** * dev_remap_addr() - Get the reg property of a device as a @@ -996,9 +997,10 @@ static inline void *dev_read_addr_ptr(const struct udevice *dev) return devfdt_get_addr_ptr(dev); } -static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev) +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev, + fdt_size_t *sizep) { - return devfdt_get_addr_pci(dev); + return devfdt_get_addr_pci(dev, sizep); } static inline void *dev_remap_addr(const struct udevice *dev) diff --git a/include/ns16550.h b/include/ns16550.h index e7e68663d03..7f481300083 100644 --- a/include/ns16550.h +++ b/include/ns16550.h @@ -58,6 +58,7 @@ enum ns16550_flags { * struct ns16550_plat - information about a NS16550 port * * @base: Base register address + * @size: Size of register area in bytes * @reg_width: IO accesses size of registers (in bytes, 1 or 4) * @reg_shift: Shift size of registers (0=byte, 1=16bit, 2=32bit...) * @reg_offset: Offset to start of registers (normally 0) @@ -67,7 +68,8 @@ enum ns16550_flags { * @bdf: PCI slot/function (pci_dev_t) */ struct ns16550_plat { - unsigned long base; + ulong base; + ulong size; int reg_width; int reg_shift; int reg_offset; diff --git a/include/of_live.h b/include/of_live.h index 05e86ac06b1..67bd5f02c74 100644 --- a/include/of_live.h +++ b/include/of_live.h @@ -9,6 +9,7 @@ #ifndef _OF_LIVE_H #define _OF_LIVE_H +struct abuf; struct device_node; /** @@ -46,4 +47,21 @@ int unflatten_device_tree(const void *blob, struct device_node **mynodes); */ void of_live_free(struct device_node *root); +/** + * of_live_create_empty() - Create a new, empty tree + * + * @rootp: Returns the root node of the created tree + * Return: 0 if OK, -ENOMEM if out of memory + */ +int of_live_create_empty(struct device_node **rootp); + +/** + * of_live_flatten() - Create an FDT from a hierarchical tree + * + * @root: Root node of tree to convert + * @buf: Buffer to return the tree (inited by this function) + * Return: 0 if OK, -ENOMEM if out of memory + */ +int of_live_flatten(const struct device_node *root, struct abuf *buf); + #endif diff --git a/include/serial.h b/include/serial.h index 42bdf3759c0..205889d28be 100644 --- a/include/serial.h +++ b/include/serial.h @@ -137,6 +137,7 @@ enum adr_space_type { * @type: type of the UART chip * @addr_space: address space to access the registers * @addr: physical address of the registers + * @size: size of the register area in bytes * @reg_width: size (in bytes) of the IO accesses to the registers * @reg_offset: offset to apply to the @addr from the start of the registers * @reg_shift: quantity to shift the register offsets by @@ -147,6 +148,7 @@ struct serial_device_info { enum serial_chip_type type; enum adr_space_type addr_space; ulong addr; + ulong size; u8 reg_width; u8 reg_offset; u8 reg_shift; diff --git a/include/spl.h b/include/spl.h index 0fedddd00ef..a222db9c559 100644 --- a/include/spl.h +++ b/include/spl.h @@ -132,6 +132,16 @@ static inline enum u_boot_phase spl_phase(void) #endif } +/* returns true if in U-Boot proper, false if in SPL */ +static inline bool spl_in_proper(void) +{ +#ifdef CONFIG_SPL_BUILD + return false; +#endif + + return true; +} + /** * spl_prev_phase() - Figure out the previous U-Boot phase * @@ -263,6 +273,15 @@ struct spl_image_info { #endif }; +static inline void *spl_image_fdt_addr(struct spl_image_info *info) +{ +#if CONFIG_IS_ENABLED(LOAD_FIT) || CONFIG_IS_ENABLED(LOAD_FIT_FULL) + return info->fdt_addr; +#else + return 0; +#endif +} + /** * Information required to load data from a device * @@ -707,9 +726,13 @@ int spl_early_init(void); */ int spl_init(void); -#ifdef CONFIG_SPL_BOARD_INIT +/* + * spl_board_init() - Do board-specific init in SPL + * + * If xPL_BOARD_INIT is enabled, this is called from board_init_r() before + * jumping to the next phase. + */ void spl_board_init(void); -#endif /** * spl_was_boot_source() - check if U-Boot booted from SPL @@ -897,4 +920,15 @@ struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size); void board_boot_order(u32 *spl_boot_list); void spl_save_restore_data(void); + +/** + * spl_load_fit_image() - Fully parse and a FIT image in SPL + * + * @spl_image: SPL Image data to fill in + * @header: Pointer to FIT image + * Return 0 if OK, -ve on error + */ +int spl_load_fit_image(struct spl_image_info *spl_image, + const struct legacy_img_hdr *header); + #endif diff --git a/include/system-constants.h b/include/system-constants.h index 0d6b71b35a0..59371568d1e 100644 --- a/include/system-constants.h +++ b/include/system-constants.h @@ -22,11 +22,23 @@ /* * Typically, we have the SPL malloc pool at the end of the BSS area. */ -#ifdef CONFIG_HAS_CUSTOM_SPL_MALLOC_START -#define SYS_SPL_MALLOC_START CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR -#else -#define SYS_SPL_MALLOC_START (CONFIG_SPL_BSS_START_ADDR + \ +#ifdef CONFIG_SPL_HAS_CUSTOM_MALLOC_START +#define SPL_SYS_MALLOC_START CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR +#elif defined(CONFIG_SPL_BSS_START_ADDR) +#define SPL_SYS_MALLOC_START (CONFIG_SPL_BSS_START_ADDR + \ CONFIG_SPL_BSS_MAX_SIZE) +#else +/* feature not enabled: this value avoids compiler errors but is not used */ +#define SPL_SYS_MALLOC_START 0 +#endif +#define SPL_SYS_MALLOC_SIZE \ + IF_ENABLED_INT(CONFIG_SPL_SYS_MALLOC, CONFIG_SPL_SYS_MALLOC_SIZE) + +/* deal with an optional value */ +#ifdef CONFIG_SPL_OS_BOOT +#define SPL_PAYLOAD_ARGS_ADDR CONFIG_SPL_PAYLOAD_ARGS_ADDR +#else +#define SPL_PAYLOAD_ARGS_ADDR 0 #endif #endif |