[Skiboot] [PATCH 1/3] platforms/astbmc: Add more slot helper macros

Oliver O'Halloran oohall at gmail.com
Tue Nov 5 18:43:51 AEDT 2019


Add a helper for adding builtin devices to a switch slot table and use
the VA_ARGS macro hacks to allow initialising other struct members (such
as the child pointer) to the ST_PLUGGABLE() and ST_BUILTIN() macros.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 platforms/astbmc/astbmc.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/platforms/astbmc/astbmc.h b/platforms/astbmc/astbmc.h
index b9f71fc2c502..a3b4a0769dd3 100644
--- a/platforms/astbmc/astbmc.h
+++ b/platforms/astbmc/astbmc.h
@@ -47,22 +47,24 @@ struct slot_table_entry {
  * table for each slot (e.g. power limit, devfn != 0) then you need to
  * define the actual structure.
  */
-#define ST_BUILTIN_DEV(st_name, slot_name) \
+#define ST_BUILTIN_DEV(st_name, slot_name, ...) \
 static struct slot_table_entry st_name[] = \
 { \
 	{ \
 		.etype = st_pluggable_slot, \
 		.name = slot_name, \
+		##__VA_ARGS__ \
 	}, \
 	{ .etype = st_end }, \
 }
 
-#define ST_PLUGGABLE(st_name, slot_name) \
+#define ST_PLUGGABLE(st_name, slot_name, ...) \
 static struct slot_table_entry st_name[] = \
 { \
 	{ \
 		.etype = st_pluggable_slot, \
 		.name = slot_name, \
+		##__VA_ARGS__ \
 	}, \
 	{ .etype = st_end }, \
 }
@@ -75,6 +77,14 @@ static struct slot_table_entry st_name[] = \
 	##__VA_ARGS__ \
 }
 
+#define SW_BUILTIN(slot_name, port, ...) \
+{ \
+	.etype = st_builtin_dev, \
+	.name = slot_name, \
+	.location = ST_LOC_DEVFN(port, 0), \
+	##__VA_ARGS__ \
+}
+
 extern const struct bmc_hw_config bmc_hw_ast2400;
 extern const struct bmc_hw_config bmc_hw_ast2500;
 extern const struct bmc_platform bmc_plat_ast2400_ami;
-- 
2.21.0



More information about the Skiboot mailing list