Add a Raspberry Pi Zero machine. $ qemu-system-arm -M raspi0 -serial stdio \ -kernel raspberrypi/firmware/boot/kernel.img \ -dtb raspberrypi/firmware/boot/bcm2708-rpi-zero-w.dtb \ -append 'printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0' [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 4.19.69+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1261 Tue Sep 3 20:21:01 BST 2019 [ 0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d [ 0.000000] CPU: VIPT aliasing data cache, unknown instruction cache [ 0.000000] OF: fdt: Machine model: Raspberry Pi Zero W [ 0.000000] earlycon: pl11 at MMIO 0x20201000 (options '') [ 0.000000] bootconsole [pl11] enabled [ 0.000000] Memory policy: Data cache writeback [ 0.000000] cma: Reserved 8 MiB at 0x1b800000 [ 0.000000] random: get_random_bytes called from start_kernel+0x8c/0x49c with crng_init=0 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 113680 [ 0.000000] Kernel command line: printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0 root=/dev/mmcblk0 rootwait Dentry cache hash table entries: 65536 (order: 6, 262144 bytes) Inode-cache hash table entries: 32768 (order: 5, 131072 bytes) Memory: 434380K/458752K available (6971K kernel code, 635K rwdata, 2080K rodata, 464K init, 797K bss, 16180K reserved, 8192K cma-reserved) Virtual kernel memory layout: vector : 0xffff0000 - 0xffff1000 ( 4 kB) fixmap : 0xffc00000 - 0xfff00000 (3072 kB) vmalloc : 0xdc800000 - 0xff800000 ( 560 MB) lowmem : 0xc0000000 - 0xdc000000 ( 448 MB) modules : 0xbf000000 - 0xc0000000 ( 16 MB) .text : 0x(ptrval) - 0x(ptrval) (6973 kB) .init : 0x(ptrval) - 0x(ptrval) ( 464 kB) .data : 0x(ptrval) - 0x(ptrval) ( 636 kB) .bss : 0x(ptrval) - 0x(ptrval) ( 798 kB) SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 ftrace: allocating 25193 entries in 74 pages NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16 sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 2147483647500ns clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns bcm2835: system timer (irq = 27) Console: colour dummy device 80x30 ...
Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> --- TODO: Add acceptance test --- hw/arm/raspi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 4f7e5ecfab..0d1f15e08c 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -88,7 +88,7 @@ static int board_version(uint32_t board_rev) static const char *board_soc_type(uint32_t board_rev) { static const char *soc_types[] = { - NULL, TYPE_BCM2836, TYPE_BCM2837, + TYPE_BCM2835, TYPE_BCM2836, TYPE_BCM2837, }; int proc_id = board_processor_id(board_rev); @@ -103,7 +103,7 @@ static const char *board_soc_type(uint32_t board_rev) static int cores_count(uint32_t board_rev) { static const int soc_cores_count[] = { - 0, BCM283X_NCPUS, BCM283X_NCPUS, + 1, BCM283X_NCPUS, BCM283X_NCPUS, }; int proc_id = board_processor_id(board_rev); @@ -330,6 +330,11 @@ static void raspi_machine_class_init(ObjectClass *oc, void *data) static const TypeInfo raspi_machine_types[] = { { + .name = MACHINE_TYPE_NAME("raspi0"), + .parent = TYPE_RASPI_MACHINE, + .class_init = raspi_machine_class_init, + .class_data = (void *)0x9000c1, + }, { .name = MACHINE_TYPE_NAME("raspi2"), .parent = TYPE_RASPI_MACHINE, .class_init = raspi_machine_class_init, -- 2.21.1