From: Peter Delevoryas <pdel@fb.com>
Cc: <pdel@fb.com>, <clg@kaod.org>, <peter.maydell@linaro.org>,
<qemu-devel@nongnu.org>, <qemu-arm@nongnu.org>
Subject: [PATCH v2 8/8] aspeed: Add AST2600 (BMC) to fby35
Date: Thu, 23 Jun 2022 17:37:01 -0700 [thread overview]
Message-ID: <20220624003701.1363500-9-pdel@fb.com> (raw)
In-Reply-To: <20220624003701.1363500-1-pdel@fb.com>
You can test booting the BMC with both '-device loader' and '-drive
file'. This is necessary because of how the fb-openbmc boot sequence
works (jump to 0x20000000 after U-Boot SPL).
wget https://github.com/facebook/openbmc/releases/download/openbmc-e2294ff5d31d/fby35.mtd
qemu-system-arm -machine fby35 -nographic \
-device loader,file=fby35.mtd,addr=0,cpu-num=0 -drive file=fby35.mtd,format=raw,if=mtd
Signed-off-by: Peter Delevoryas <pdel@fb.com>
---
hw/arm/fby35.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/hw/arm/fby35.c b/hw/arm/fby35.c
index dc1ae8e62a..1e24cbf3f8 100644
--- a/hw/arm/fby35.c
+++ b/hw/arm/fby35.c
@@ -21,17 +21,53 @@
*/
#include "qemu/osdep.h"
+#include "qemu/units.h"
+#include "qapi/error.h"
#include "hw/boards.h"
+#include "hw/arm/aspeed_soc.h"
#define TYPE_FBY35 MACHINE_TYPE_NAME("fby35")
OBJECT_DECLARE_SIMPLE_TYPE(Fby35State, FBY35);
struct Fby35State {
MachineState parent_obj;
+
+ MemoryRegion bmc_memory;
+ MemoryRegion bmc_dram;
+ MemoryRegion bmc_boot_rom;
+
+ AspeedSoCState bmc;
};
+static void fby35_bmc_init(Fby35State *s)
+{
+ uint32_t boot_rom_size;
+
+ memory_region_init(&s->bmc_memory, OBJECT(s), "bmc-memory", UINT64_MAX);
+ memory_region_init_ram(&s->bmc_dram, OBJECT(s), "bmc-dram", 2 * GiB, &error_abort);
+
+ object_initialize_child(OBJECT(s), "bmc", &s->bmc, "ast2600-a3");
+ object_property_set_int(OBJECT(&s->bmc), "ram-size", s->bmc_dram.size, &error_abort);
+ object_property_set_link(OBJECT(&s->bmc), "memory", OBJECT(&s->bmc_memory), &error_abort);
+ object_property_set_link(OBJECT(&s->bmc), "dram", OBJECT(&s->bmc_dram), &error_abort);
+ object_property_set_int(OBJECT(&s->bmc), "hw-strap1", 0x000000C0, &error_abort);
+ object_property_set_int(OBJECT(&s->bmc), "hw-strap2", 0x00000003, &error_abort);
+ object_property_set_int(OBJECT(&s->bmc), "uart-default", ASPEED_DEV_UART5, &error_abort);
+ qdev_realize(DEVICE(&s->bmc), NULL, &error_abort);
+
+ boot_rom_size = ASPEED_SMC_GET_CLASS(&s->bmc.fmc)->segments[0].size;
+
+ memory_region_init_rom(&s->bmc_boot_rom, OBJECT(s), "bmc-boot-rom", boot_rom_size, &error_abort);
+ memory_region_add_subregion(&s->bmc_memory, 0, &s->bmc_boot_rom);
+
+ aspeed_board_init_flashes(&s->bmc.fmc, "n25q00", 2, 0);
+}
+
static void fby35_init(MachineState *machine)
{
+ Fby35State *s = FBY35(machine);
+
+ fby35_bmc_init(s);
}
static void fby35_class_init(ObjectClass *oc, void *data)
@@ -40,6 +76,9 @@ static void fby35_class_init(ObjectClass *oc, void *data)
mc->desc = "Meta Platforms fby35";
mc->init = fby35_init;
+ mc->no_floppy = 1;
+ mc->no_cdrom = 1;
+ mc->min_cpus = mc->max_cpus = mc->default_cpus = 2;
}
static const TypeInfo fby35_types[] = {
--
2.30.2
next prev parent reply other threads:[~2022-06-24 0:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-24 0:36 [PATCH v2 0/8] aspeed: Add multi-SoC machine Peter Delevoryas
2022-06-24 0:36 ` [PATCH v2 1/8] aspeed: Set CPU memory property explicitly Peter Delevoryas
2022-06-24 6:36 ` Cédric Le Goater
2022-06-24 6:55 ` Cédric Le Goater
2022-06-24 14:00 ` Peter Delevoryas
2022-06-24 0:36 ` [PATCH v2 2/8] aspeed: Add memory property to Aspeed SoC Peter Delevoryas
2022-06-24 6:40 ` Cédric Le Goater
2022-06-24 0:36 ` [PATCH v2 3/8] aspeed: Remove usage of sysbus_mmio_map Peter Delevoryas
2022-06-24 6:56 ` Cédric Le Goater
2022-06-24 0:36 ` [PATCH v2 4/8] aspeed: Map unimplemented devices in SoC memory Peter Delevoryas
2022-06-24 6:58 ` Cédric Le Goater
2022-06-24 0:36 ` [PATCH v2 5/8] aspeed: Remove use of qemu_get_cpu Peter Delevoryas
2022-06-24 6:58 ` Cédric Le Goater
2022-06-24 0:36 ` [PATCH v2 6/8] aspeed: Add fby35 skeleton Peter Delevoryas
2022-06-24 7:00 ` Cédric Le Goater
2022-06-24 0:37 ` [PATCH v2 7/8] aspeed: Make aspeed_board_init_flashes public Peter Delevoryas
2022-06-28 5:03 ` Cédric Le Goater
2022-06-24 0:37 ` Peter Delevoryas [this message]
2022-06-28 5:01 ` [PATCH v2 8/8] aspeed: Add AST2600 (BMC) to fby35 Cédric Le Goater
2022-06-28 6:55 ` Peter Delevoryas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220624003701.1363500-9-pdel@fb.com \
--to=pdel@fb.com \
--cc=clg@kaod.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).