Skip to content

Commit

Permalink
platforms/astbmc: Add more slot helper macros
Browse files Browse the repository at this point in the history
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@gmail.com>
  • Loading branch information
oohal committed Nov 14, 2019
1 parent 446f9f0 commit bbe5f00
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions platforms/astbmc/astbmc.h
Expand Up @@ -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 }, \
}
Expand All @@ -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;
Expand Down

0 comments on commit bbe5f00

Please sign in to comment.