diff options
| author | Tom Rini <[email protected]> | 2020-10-06 13:59:01 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2020-10-06 13:59:01 -0400 |
| commit | 42378e3cd2432e0353cdcc1789039293e4b46252 (patch) | |
| tree | 0d7f41a9e50432c32aca3cd7e611cfea70f9efc4 /include | |
| parent | 5dcf7cc590b348f1e730ec38242df64c179f10a8 (diff) | |
| parent | 175e8322bcee64127a24acdac12c54f5ddb95f82 (diff) | |
Merge tag 'dm-pull-6oct20' of git://git.denx.de/u-boot-dm
bloblist enhancement for alignment
Update ofnode/dev_read phandle function
sandbox keyboard enhancements and fixes
Diffstat (limited to 'include')
| -rw-r--r-- | include/bloblist.h | 42 | ||||
| -rw-r--r-- | include/dm/of_access.h | 4 | ||||
| -rw-r--r-- | include/dm/ofnode.h | 12 | ||||
| -rw-r--r-- | include/dm/read.h | 8 | ||||
| -rw-r--r-- | include/test/ut.h | 13 |
5 files changed, 66 insertions, 13 deletions
diff --git a/include/bloblist.h b/include/bloblist.h index 5784c2226e7..2b4b6696897 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -19,6 +19,7 @@ enum { BLOBLIST_ALIGN = 16, }; +/* Supported tags - add new ones to tag_name in bloblist.c */ enum bloblist_tag_t { BLOBLISTT_NONE = 0, @@ -35,6 +36,8 @@ enum bloblist_tag_t { BLOBLISTT_INTEL_VBT, /* Intel Video-BIOS table */ BLOBLISTT_TPM2_TCG_LOG, /* TPM v2 log space */ BLOBLISTT_TCPA_LOG, /* TPM log space */ + + BLOBLISTT_COUNT }; /** @@ -65,7 +68,7 @@ enum bloblist_tag_t { * the bloblist can grow up to this size. This starts out as * sizeof(bloblist_hdr) since we need at least that much space to store a * valid bloblist - * @spare: Space space + * @spare: Spare space (for future use) * @chksum: CRC32 for the entire bloblist allocated area. Since any of the * blobs can be altered after being created, this checksum is only valid * when the bloblist is finalised before jumping to the next stage of boot. @@ -112,7 +115,7 @@ struct bloblist_rec { * Searches the bloblist and returns the blob with the matching tag * * @tag: Tag to search for (enum bloblist_tag_t) - * @size: Expected size of the blob + * @size: Expected size of the blob, or 0 for any size * @return pointer to blob if found, or NULL if not found, or a blob was found * but it is the wrong size */ @@ -129,10 +132,11 @@ void *bloblist_find(uint tag, int size); * * @tag: Tag to add (enum bloblist_tag_t) * @size: Size of the blob + * @align: Alignment of the blob (in bytes), 0 for default * @return pointer to the newly added block, or NULL if there is not enough * space for the blob */ -void *bloblist_add(uint tag, int size); +void *bloblist_add(uint tag, int size, int align); /** * bloblist_ensure_size() - Find or add a blob @@ -142,10 +146,11 @@ void *bloblist_add(uint tag, int size); * @tag: Tag to add (enum bloblist_tag_t) * @size: Size of the blob * @blobp: Returns a pointer to blob on success + * @align: Alignment of the blob (in bytes), 0 for default * @return 0 if OK, -ENOSPC if it is missing and could not be added due to lack * of space, or -ESPIPE it exists but has the wrong size */ -int bloblist_ensure_size(uint tag, int size, void **blobp); +int bloblist_ensure_size(uint tag, int size, int align, void **blobp); /** * bloblist_ensure() - Find or add a blob @@ -207,6 +212,35 @@ int bloblist_check(ulong addr, uint size); int bloblist_finish(void); /** + * bloblist_get_stats() - Get information about the bloblist + * + * This returns useful information about the bloblist + */ +void bloblist_get_stats(ulong *basep, ulong *sizep, ulong *allocedp); + +/** + * bloblist_show_stats() - Show information about the bloblist + * + * This shows useful information about the bloblist on the console + */ +void bloblist_show_stats(void); + +/** + * bloblist_show_list() - Show a list of blobs in the bloblist + * + * This shows a list of blobs, showing their address, size and tag. + */ +void bloblist_show_list(void); + +/** + * bloblist_tag_name() - Get the name for a tag + * + * @tag: Tag to check + * @return name of tag, or "invalid" if an invalid tag is provided + */ +const char *bloblist_tag_name(enum bloblist_tag_t tag); + +/** * bloblist_init() - Init the bloblist system with a single bloblist * * This uses CONFIG_BLOBLIST_ADDR and CONFIG_BLOBLIST_SIZE to set up a bloblist diff --git a/include/dm/of_access.h b/include/dm/of_access.h index 2fa65c9332e..cc382b1671c 100644 --- a/include/dm/of_access.h +++ b/include/dm/of_access.h @@ -450,6 +450,7 @@ int of_parse_phandle_with_args(const struct device_node *np, * @np: pointer to a device tree node containing a list * @list_name: property name that contains a list * @cells_name: property name that specifies phandles' arguments count + * @cells_count: Cell count to use if @cells_name is NULL * @return number of phandle found, -ENOENT if * @list_name does not exist, -EINVAL if a phandle was not found, * @cells_name could not be found, the arguments were truncated or there @@ -460,7 +461,8 @@ int of_parse_phandle_with_args(const struct device_node *np, * */ int of_count_phandle_with_args(const struct device_node *np, - const char *list_name, const char *cells_name); + const char *list_name, const char *cells_name, + int cells_count); /** * of_alias_scan() - Scan all properties of the 'aliases' node diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 8df2facf998..4b7af370560 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -10,6 +10,7 @@ /* TODO([email protected]): Drop fdtdec.h include */ #include <fdtdec.h> #include <dm/of.h> +#include <log.h> /* Enable checks to protect against invalid calls */ #undef OF_CHECKS @@ -84,7 +85,7 @@ struct ofprop { }; /** - * _ofnode_to_np() - convert an ofnode to a live DT node pointer + * ofnode_to_np() - convert an ofnode to a live DT node pointer * * This cannot be called if the reference contains an offset. * @@ -127,7 +128,7 @@ static inline bool ofnode_valid(ofnode node) if (of_live_active()) return node.np != NULL; else - return node.of_offset != -1; + return node.of_offset >= 0; } /** @@ -182,8 +183,8 @@ static inline bool ofnode_is_np(ofnode node) * live tree is in use. */ assert(!ofnode_valid(node) || - (of_live_active() ? _ofnode_to_np(node) - : _ofnode_to_np(node))); + (of_live_active() ? ofnode_to_np(node) + : ofnode_to_np(node))); #endif return of_live_active() && ofnode_valid(node); } @@ -555,12 +556,13 @@ int ofnode_parse_phandle_with_args(ofnode node, const char *list_name, * @node: device tree node containing a list * @list_name: property name that contains a list * @cells_name: property name that specifies phandles' arguments count + * @cells_count: Cell count to use if @cells_name is NULL * @return number of phandle on success, -ENOENT if @list_name does not * exist, -EINVAL if a phandle was not found, @cells_name could not * be found. */ int ofnode_count_phandle_with_args(ofnode node, const char *list_name, - const char *cells_name); + const char *cells_name, int cell_count); /** * ofnode_path() - find a node by full path diff --git a/include/dm/read.h b/include/dm/read.h index 67db94adfc1..0585eb12281 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -429,12 +429,14 @@ int dev_read_phandle_with_args(const struct udevice *dev, const char *list_name, * @dev: device whose node containing a list * @list_name: property name that contains a list * @cells_name: property name that specifies phandles' arguments count + * @cells_count: Cell count to use if @cells_name is NULL * @Returns number of phandle found on success, on error returns appropriate * errno value. */ int dev_count_phandle_with_args(const struct udevice *dev, - const char *list_name, const char *cells_name); + const char *list_name, const char *cells_name, + int cell_count); /** * dev_read_addr_cells() - Get the number of address cells for a device's node @@ -880,10 +882,10 @@ static inline int dev_read_phandle_with_args(const struct udevice *dev, } static inline int dev_count_phandle_with_args(const struct udevice *dev, - const char *list_name, const char *cells_name) + const char *list_name, const char *cells_name, int cell_count) { return ofnode_count_phandle_with_args(dev_ofnode(dev), list_name, - cells_name); + cells_name, cell_count); } static inline int dev_read_addr_cells(const struct udevice *dev) diff --git a/include/test/ut.h b/include/test/ut.h index 3295cd4e548..3f2ee7514b8 100644 --- a/include/test/ut.h +++ b/include/test/ut.h @@ -224,6 +224,19 @@ int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); } \ } +/* Assert that two addresses (converted from pointers) are equal */ +#define ut_asserteq_addr(expr1, expr2) { \ + ulong _val1 = map_to_sysmem(expr1); \ + ulong _val2 = map_to_sysmem(expr2); \ + \ + if (_val1 != _val2) { \ + ut_failf(uts, __FILE__, __LINE__, __func__, \ + #expr1 " = " #expr2, \ + "Expected %lx, got %lx", _val1, _val2); \ + return CMD_RET_FAILURE; \ + } \ +} + /* Assert that a pointer is NULL */ #define ut_assertnull(expr) { \ const void *_val = (expr); \ |
