[PATCH v2 2/5] sysinfo: Provide some global/default IDs
Sean Anderson
sean.anderson at seco.com
Fri Mar 5 21:12:22 CET 2021
This adds an ID for a board revision. Existing IDs have been moved above
SYSINFO_ID_END to allow for future expansion.
Signed-off-by: Sean Anderson <sean.anderson at seco.com>
---
Changes in v2:
- Set BOARD_HWVERSION to SYSINFO_ID_REVISION, as they represent the same
content.
- Use enums instead of defines for sysinfo ids
drivers/sysinfo/gazerbeam.h | 8 +++++---
drivers/sysinfo/sandbox.h | 2 +-
include/sysinfo.h | 13 +++++++++++++
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/drivers/sysinfo/gazerbeam.h b/drivers/sysinfo/gazerbeam.h
index 171729d203..21514dd122 100644
--- a/drivers/sysinfo/gazerbeam.h
+++ b/drivers/sysinfo/gazerbeam.h
@@ -5,10 +5,12 @@
*
*/
+#include <sysinfo.h>
+
enum {
- BOARD_MULTICHANNEL,
- BOARD_VARIANT,
- BOARD_HWVERSION,
+ BOARD_HWVERSION = SYSINFO_ID_REVISION,
+ BOARD_MULTICHANNEL = SYSINFO_ID_END + 1,
+ BOARD_VARIANT
};
enum {
diff --git a/drivers/sysinfo/sandbox.h b/drivers/sysinfo/sandbox.h
index 2cff494f56..9a67fd2389 100644
--- a/drivers/sysinfo/sandbox.h
+++ b/drivers/sysinfo/sandbox.h
@@ -5,7 +5,7 @@
*/
enum {
- BOOL_CALLED_DETECT,
+ BOOL_CALLED_DETECT = SYSINFO_ID_END + 1,
INT_TEST1,
INT_TEST2,
STR_VACATIONSPOT,
diff --git a/include/sysinfo.h b/include/sysinfo.h
index c045d316b0..9386bdf49a 100644
--- a/include/sysinfo.h
+++ b/include/sysinfo.h
@@ -32,6 +32,19 @@
*/
#if CONFIG_IS_ENABLED(SYSINFO)
+/**
+ * enum sysinfo_id - IDs which may be passed to sysinfo accessors
+ */
+enum sysinfo_id {
+ /** @SYSINFO_ID_REVISION: Use this ID to access the board revision. */
+ SYSINFO_ID_REVISION,
+ /**
+ * @SYSINFO_ID_END: The last global sysinfo id. If you need to return
+ * custom information, use SYSINFO_ID_END+1 as the base offset.
+ */
+ SYSINFO_ID_END = 127,
+};
+
struct sysinfo_ops {
/**
* detect() - Run the hardware info detection procedure for this
--
2.25.1
More information about the U-Boot
mailing list