diff options
| author | Raymond Mao <[email protected]> | 2024-12-06 14:54:19 -0800 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-01-14 14:29:29 -0600 |
| commit | dc8053eaee7be64ef17d1bdbcb169af2e611b966 (patch) | |
| tree | f2dab47f41a743628b13161d5e141081712f1ab9 /include/sysinfo.h | |
| parent | 8aa5f8e02f7869d2d4131b04eb35b6ea948da80c (diff) | |
sysinfo: Add sysinfo API for accessing data area
Add interface for sysinfo to access a data area from the platform.
This is useful to save/read a memory region of platform-specific
data.
Signed-off-by: Raymond Mao <[email protected]>
Diffstat (limited to 'include/sysinfo.h')
| -rw-r--r-- | include/sysinfo.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/sysinfo.h b/include/sysinfo.h index 027a463dc33..cb6cf326535 100644 --- a/include/sysinfo.h +++ b/include/sysinfo.h @@ -116,6 +116,18 @@ struct sysinfo_ops { int (*get_str)(struct udevice *dev, int id, size_t size, char *val); /** + * get_data() - Read a specific string data value that describes the + * hardware setup. + * @dev: The sysinfo instance to gather the data. + * @id: A unique identifier for the data area to be get. + * @data: Pointer to the address of the data area. + * @size: Pointer to the size of the data area. + * + * Return: 0 if OK, -ve on error. + */ + int (*get_data)(struct udevice *dev, int id, void **data, size_t *size); + + /** * get_fit_loadable - Get the name of an image to load from FIT * This function can be used to provide the image names based on runtime * detection. A classic use-case would when DTBOs are used to describe @@ -187,6 +199,18 @@ int sysinfo_get_int(struct udevice *dev, int id, int *val); int sysinfo_get_str(struct udevice *dev, int id, size_t size, char *val); /** + * sysinfo_get_data() - Get a data area from the platform. + * @dev: The sysinfo instance to gather the data. + * @id: A unique identifier for the data area to be get. + * @data: Pointer to the address of the data area. + * @size: Pointer to the size of the data area. + * + * Return: 0 if OK, -EPERM if called before sysinfo_detect(), else -ve on + * error. + */ +int sysinfo_get_data(struct udevice *dev, int id, void **data, size_t *size); + +/** * sysinfo_get() - Return the sysinfo device for the sysinfo in question. * @devp: Pointer to structure to receive the sysinfo device. * @@ -241,6 +265,12 @@ static inline int sysinfo_get_str(struct udevice *dev, int id, size_t size, return -ENOSYS; } +static inline int sysinfo_get_data(struct udevice *dev, int id, void **data, + size_t *size) +{ + return -ENOSYS; +} + static inline int sysinfo_get(struct udevice **devp) { return -ENOSYS; |
