Fix q800 memory map

-----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAl3BufoSHGxhdXJlbnRA
 dml2aWVyLmV1AAoJEPMMOL0/L748qM0P/0hiaOUMkqvL2KaaSi2jmKg53zKkH995
 RUjO0VzXDI+2hJMu+Qle49JBK9LoPdlVkpDCELG78fgsjiCQ2RZuJ8Nb5Q2O8Ikk
 yfagqCUGU9g6PtNp15KekoJ0K3iOTYp+NlLytWapDnj2pkAvAAduVJp09JuPgBkP
 WCmGe1/tfvTzZv9M1gj/p5Itx65aN8ggTD8C+tcATZZxquUNayPI6VWrMZr2GXcO
 R54u3edfeAnTJusSLKI/d60GKBznN6t21jGXqiK+nhIAlCthYyKU4tgGCmXc8g72
 +BNsRW+Fl7EW9pYgl5UekwF1+jxWUvpsoynmLVf7N0kC+qBQv03asl6lal814GHO
 uI0oAtmQ5Fg+dSao92IShaWaVoh7hwlq34hV6UG2xOCMvTIdKYgeDtHcqdSgOm3A
 F2q5ktgUh+caeg6NnMghrhcU1TAByu4SXvynWtrHniHmOATy7eYXSGbhXR0Sl5Bk
 J1pD/Rc0PatlhROA9b6JD5P17RNVC3gxmBIrSKDYM+kwz2QcMQH3u0OQNWiiK8+G
 if1Tg0WjkTH72cjRYBtIDEliOTMsBNDqPBkedn24XDh/0C5SIIrfkU3mbHQlNWJm
 nqBmHrt6lJU1nJVRtVADxgPYw8A4rNuat+pIigVdCSslys+0w5BmIn9tir4vW4tX
 OWcSfY03FhTa
 =BcZV
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/vivier/tags/q800-branch-pull-request' into staging

Fix q800 memory map

# gpg: Signature made Tue 05 Nov 2019 18:05:46 GMT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier/tags/q800-branch-pull-request:
  q800: fix I/O memory map

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2019-11-06 16:05:36 +00:00
commit 4570c2e5fa

View File

@ -60,14 +60,19 @@
#define MACH_MAC 3 #define MACH_MAC 3
#define Q800_MAC_CPU_ID 2 #define Q800_MAC_CPU_ID 2
#define VIA_BASE 0x50f00000 #define IO_BASE 0x50000000
#define SONIC_PROM_BASE 0x50f08000 #define IO_SLICE 0x00040000
#define SONIC_BASE 0x50f0a000 #define IO_SIZE 0x04000000
#define SCC_BASE 0x50f0c020
#define ESP_BASE 0x50f10000 #define VIA_BASE (IO_BASE + 0x00000)
#define ESP_PDMA 0x50f10100 #define SONIC_PROM_BASE (IO_BASE + 0x08000)
#define ASC_BASE 0x50F14000 #define SONIC_BASE (IO_BASE + 0x0a000)
#define SWIM_BASE 0x50F1E000 #define SCC_BASE (IO_BASE + 0x0c020)
#define ESP_BASE (IO_BASE + 0x10000)
#define ESP_PDMA (IO_BASE + 0x10100)
#define ASC_BASE (IO_BASE + 0x14000)
#define SWIM_BASE (IO_BASE + 0x1E000)
#define NUBUS_SUPER_SLOT_BASE 0x60000000 #define NUBUS_SUPER_SLOT_BASE 0x60000000
#define NUBUS_SLOT_BASE 0xf0000000 #define NUBUS_SLOT_BASE 0xf0000000
@ -135,6 +140,9 @@ static void q800_init(MachineState *machine)
int32_t initrd_size; int32_t initrd_size;
MemoryRegion *rom; MemoryRegion *rom;
MemoryRegion *ram; MemoryRegion *ram;
MemoryRegion *io;
const int io_slice_nb = (IO_SIZE / IO_SLICE) - 1;
int i;
ram_addr_t ram_size = machine->ram_size; ram_addr_t ram_size = machine->ram_size;
const char *kernel_filename = machine->kernel_filename; const char *kernel_filename = machine->kernel_filename;
const char *initrd_filename = machine->initrd_filename; const char *initrd_filename = machine->initrd_filename;
@ -163,10 +171,26 @@ static void q800_init(MachineState *machine)
cpu = M68K_CPU(cpu_create(machine->cpu_type)); cpu = M68K_CPU(cpu_create(machine->cpu_type));
qemu_register_reset(main_cpu_reset, cpu); qemu_register_reset(main_cpu_reset, cpu);
/* RAM */
ram = g_malloc(sizeof(*ram)); ram = g_malloc(sizeof(*ram));
memory_region_init_ram(ram, NULL, "m68k_mac.ram", ram_size, &error_abort); memory_region_init_ram(ram, NULL, "m68k_mac.ram", ram_size, &error_abort);
memory_region_add_subregion(get_system_memory(), 0, ram); memory_region_add_subregion(get_system_memory(), 0, ram);
/*
* Memory from IO_BASE to IO_BASE + IO_SLICE is repeated
* from IO_BASE + IO_SLICE to IO_BASE + IO_SIZE
*/
io = g_new(MemoryRegion, io_slice_nb);
for (i = 0; i < io_slice_nb; i++) {
char *name = g_strdup_printf("mac_m68k.io[%d]", i + 1);
memory_region_init_alias(&io[i], NULL, name, get_system_memory(),
IO_BASE, IO_SLICE);
memory_region_add_subregion(get_system_memory(),
IO_BASE + (i + 1) * IO_SLICE, &io[i]);
g_free(name);
}
/* IRQ Glue */ /* IRQ Glue */
irq = g_new0(GLUEState, 1); irq = g_new0(GLUEState, 1);