From 8f997dcf36679e7d3d2b194352868212d9be32d3 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Thu, 8 Jun 2017 22:54:18 +1000 Subject: [PATCH] chip: Add support for discovering chips on mambo Currently the only way for skiboot to discover chips is by looking for xscom nodes. But on mambo it's currently not possible to create multiple xscom nodes, which means we can only simulate a single chip system. However it seems we can fairly cleanly add support for a special mambo chip node, and use that to instantiate multiple chips. Add a check in init_chip() that we're not clobbering an already initialised chip, now that we have two places that initialise chips. Signed-off-by: Michael Ellerman Signed-off-by: Stewart Smith --- core/chip.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/chip.c b/core/chip.c index 3550804383dc..c18ac4971473 100644 --- a/core/chip.c +++ b/core/chip.c @@ -78,6 +78,7 @@ static void init_chip(struct dt_node *dn) id = dt_get_chip_id(dn); assert(id < MAX_CHIPS); + assert(chips[id] == NULL); chip = zalloc(sizeof(struct proc_chip)); assert(chip); @@ -108,7 +109,11 @@ void init_chips(void) | QUIRK_NO_F000F | QUIRK_NO_PBA | QUIRK_NO_OCC_IRQ | QUIRK_NO_DIRECT_CTL | QUIRK_NO_RNG; prlog(PR_NOTICE, "CHIP: Detected Mambo simulator\n"); + + dt_for_each_compatible(dt_root, xn, "ibm,mambo-chip") + init_chip(xn); } + /* Detect simics */ if (dt_find_by_path(dt_root, "/simics")) { proc_chip_quirks |= QUIRK_SIMICS