[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 2/3] hw/arm/raspi: Add the Raspberry Pi 4 model B
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH v2 2/3] hw/arm/raspi: Add the Raspberry Pi 4 model B |
Date: |
Sun, 18 Oct 2020 22:55:50 +0200 |
Add 2 variants of the raspi4:
- raspi4b1g: Raspberry Pi 4B (revision 1.1, with 1 GiB of RAM)
- raspi4b2g Raspberry Pi 4B (revision 1.2, with 2 GiB)
Example booting the 2GiB machine using content from [*]:
$ qemu-system-aarch64 -M raspi4b2g -serial stdio \
-kernel raspberrypi/firmware/boot/kernel8.img \
-dtb raspberrypi/firmware/boot/bcm2711-rpi-4-b.dtb \
-append 'printk.time=0 earlycon=pl011,0xfe201000 console=ttyAMA0'
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd083]
[ 0.000000] Linux version 5.4.51-v8+ (dom@buildbot) (gcc version 5.4.0
20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9)) #1333 SMP PREEMPT Mon Aug 10
16:58:35 BST 2020
[ 0.000000] Machine model: Raspberry Pi 4 Model B
[ 0.000000] earlycon: pl11 at MMIO 0x00000000fe201000 (options '')
[ 0.000000] printk: bootconsole [pl11] enabled
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: UEFI not found.
[ 0.000000] Reserved memory: created CMA memory pool at
0x000000002c000000, size 64 MiB
[ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id
shared-dma-pool
[ 0.000000] Detected PIPT I-cache on CPU0
[ 0.000000] CPU features: detected: EL2 vector hardening
[ 0.000000] ARM_SMCCC_ARCH_WORKAROUND_1 missing from firmware
[ 0.000000] software IO TLB: mapped [mem 0x3bfff000-0x3ffff000] (64MB)
[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[ 0.000000] GIC: Using split EOI/Deactivate mode
[ 0.633289] smp: Bringing up secondary CPUs ...
[ 0.694226] Detected PIPT I-cache on CPU1
[ 0.699002] CPU1: Booted secondary processor 0x0000000001 [0x410fd083]
[ 0.782443] Detected PIPT I-cache on CPU2
[ 0.783511] CPU2: Booted secondary processor 0x0000000002 [0x410fd083]
[ 0.848854] Detected PIPT I-cache on CPU3
[ 0.850003] CPU3: Booted secondary processor 0x0000000003 [0x410fd083]
[ 0.857099] smp: Brought up 1 node, 4 CPUs
[ 0.863500] SMP: Total of 4 processors activated.
[ 0.865446] CPU features: detected: 32-bit EL0 Support
[ 0.866667] CPU features: detected: CRC32 instructions
[ 2.235648] CPU: All CPU(s) started at EL2
...
[*]
http://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel_1.20200512-2_armhf.deb
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/arm/raspi.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index 4ea200572ea..6a793766840 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -73,6 +73,7 @@ typedef enum RaspiProcessorId {
PROCESSOR_ID_BCM2835 = 0,
PROCESSOR_ID_BCM2836 = 1,
PROCESSOR_ID_BCM2837 = 2,
+ PROCESSOR_ID_BCM2838 = 3,
} RaspiProcessorId;
static const struct {
@@ -82,6 +83,7 @@ static const struct {
[PROCESSOR_ID_BCM2835] = {TYPE_BCM2835, 1},
[PROCESSOR_ID_BCM2836] = {TYPE_BCM2836, BCM283X_NCPUS},
[PROCESSOR_ID_BCM2837] = {TYPE_BCM2837, BCM283X_NCPUS},
+ [PROCESSOR_ID_BCM2838] = {TYPE_BCM2838, BCM283X_NCPUS},
};
static uint64_t board_ram_size(uint32_t board_rev)
@@ -366,6 +368,24 @@ static void raspi3b_machine_class_init(ObjectClass *oc,
void *data)
rmc->board_rev = 0xa02082;
raspi_machine_class_common_init(mc, rmc->board_rev);
};
+
+static void raspi4b1g_machine_class_init(ObjectClass *oc, void *data)
+{
+ MachineClass *mc = MACHINE_CLASS(oc);
+ RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc);
+
+ rmc->board_rev = 0xa03111;
+ raspi_machine_class_common_init(mc, rmc->board_rev);
+};
+
+static void raspi4b2g_machine_class_init(ObjectClass *oc, void *data)
+{
+ MachineClass *mc = MACHINE_CLASS(oc);
+ RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc);
+
+ rmc->board_rev = 0xb03112;
+ raspi_machine_class_common_init(mc, rmc->board_rev);
+};
#endif /* TARGET_AARCH64 */
static const TypeInfo raspi_machine_types[] = {
@@ -390,6 +410,14 @@ static const TypeInfo raspi_machine_types[] = {
.name = MACHINE_TYPE_NAME("raspi3b"),
.parent = TYPE_RASPI_MACHINE,
.class_init = raspi3b_machine_class_init,
+ }, {
+ .name = MACHINE_TYPE_NAME("raspi4b1g"),
+ .parent = TYPE_RASPI_MACHINE,
+ .class_init = raspi4b1g_machine_class_init,
+ }, {
+ .name = MACHINE_TYPE_NAME("raspi4b2g"),
+ .parent = TYPE_RASPI_MACHINE,
+ .class_init = raspi4b2g_machine_class_init,
#endif
}, {
.name = TYPE_RASPI_MACHINE,
--
2.26.2