Commit c7ba218da1639a054b5ca1c259530305562fa571
1 parent
d4066479
Add T1 and T2 CPUs, add a Sun4v machine
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4923 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
6 changed files
with
98 additions
and
13 deletions
hw/boards.h
@@ -64,6 +64,7 @@ extern QEMUMachine ss1000_machine, ss2000_machine; | @@ -64,6 +64,7 @@ extern QEMUMachine ss1000_machine, ss2000_machine; | ||
64 | 64 | ||
65 | /* sun4u.c */ | 65 | /* sun4u.c */ |
66 | extern QEMUMachine sun4u_machine; | 66 | extern QEMUMachine sun4u_machine; |
67 | +extern QEMUMachine sun4v_machine; | ||
67 | 68 | ||
68 | /* integratorcp.c */ | 69 | /* integratorcp.c */ |
69 | extern QEMUMachine integratorcp_machine; | 70 | extern QEMUMachine integratorcp_machine; |
hw/sun4u.c
1 | /* | 1 | /* |
2 | - * QEMU Sun4u System Emulator | 2 | + * QEMU Sun4u/Sun4v System Emulator |
3 | * | 3 | * |
4 | * Copyright (c) 2005 Fabrice Bellard | 4 | * Copyright (c) 2005 Fabrice Bellard |
5 | * | 5 | * |
@@ -45,6 +45,10 @@ | @@ -45,6 +45,10 @@ | ||
45 | #define NVRAM_SIZE 0x2000 | 45 | #define NVRAM_SIZE 0x2000 |
46 | #define MAX_IDE_BUS 2 | 46 | #define MAX_IDE_BUS 2 |
47 | 47 | ||
48 | +struct hwdef { | ||
49 | + const char * const default_cpu_model; | ||
50 | +}; | ||
51 | + | ||
48 | int DMA_get_channel_mode (int nchan) | 52 | int DMA_get_channel_mode (int nchan) |
49 | { | 53 | { |
50 | return 0; | 54 | return 0; |
@@ -245,11 +249,11 @@ static const int parallel_irq[MAX_PARALLEL_PORTS] = { 7, 7, 7 }; | @@ -245,11 +249,11 @@ static const int parallel_irq[MAX_PARALLEL_PORTS] = { 7, 7, 7 }; | ||
245 | 249 | ||
246 | static fdctrl_t *floppy_controller; | 250 | static fdctrl_t *floppy_controller; |
247 | 251 | ||
248 | -/* Sun4u hardware initialisation */ | ||
249 | -static void sun4u_init(ram_addr_t RAM_size, int vga_ram_size, | ||
250 | - const char *boot_devices, DisplayState *ds, | ||
251 | - const char *kernel_filename, const char *kernel_cmdline, | ||
252 | - const char *initrd_filename, const char *cpu_model) | 252 | +static void sun4uv_init(ram_addr_t RAM_size, int vga_ram_size, |
253 | + const char *boot_devices, DisplayState *ds, | ||
254 | + const char *kernel_filename, const char *kernel_cmdline, | ||
255 | + const char *initrd_filename, const char *cpu_model, | ||
256 | + const struct hwdef *hwdef) | ||
253 | { | 257 | { |
254 | CPUState *env; | 258 | CPUState *env; |
255 | char buf[1024]; | 259 | char buf[1024]; |
@@ -267,8 +271,9 @@ static void sun4u_init(ram_addr_t RAM_size, int vga_ram_size, | @@ -267,8 +271,9 @@ static void sun4u_init(ram_addr_t RAM_size, int vga_ram_size, | ||
267 | linux_boot = (kernel_filename != NULL); | 271 | linux_boot = (kernel_filename != NULL); |
268 | 272 | ||
269 | /* init CPUs */ | 273 | /* init CPUs */ |
270 | - if (cpu_model == NULL) | ||
271 | - cpu_model = "TI UltraSparc II"; | 274 | + if (!cpu_model) |
275 | + cpu_model = hwdef->default_cpu_model; | ||
276 | + | ||
272 | env = cpu_init(cpu_model); | 277 | env = cpu_init(cpu_model); |
273 | if (!env) { | 278 | if (!env) { |
274 | fprintf(stderr, "Unable to find Sparc CPU definition\n"); | 279 | fprintf(stderr, "Unable to find Sparc CPU definition\n"); |
@@ -409,9 +414,47 @@ static void sun4u_init(ram_addr_t RAM_size, int vga_ram_size, | @@ -409,9 +414,47 @@ static void sun4u_init(ram_addr_t RAM_size, int vga_ram_size, | ||
409 | 414 | ||
410 | } | 415 | } |
411 | 416 | ||
417 | +static const struct hwdef hwdefs[] = { | ||
418 | + /* Sun4u generic PC-like machine */ | ||
419 | + { | ||
420 | + .default_cpu_model = "TI UltraSparc II", | ||
421 | + }, | ||
422 | + /* Sun4v generic PC-like machine */ | ||
423 | + { | ||
424 | + .default_cpu_model = "Sun UltraSparc T1", | ||
425 | + }, | ||
426 | +}; | ||
427 | + | ||
428 | +/* Sun4u hardware initialisation */ | ||
429 | +static void sun4u_init(ram_addr_t RAM_size, int vga_ram_size, | ||
430 | + const char *boot_devices, DisplayState *ds, | ||
431 | + const char *kernel_filename, const char *kernel_cmdline, | ||
432 | + const char *initrd_filename, const char *cpu_model) | ||
433 | +{ | ||
434 | + sun4uv_init(RAM_size, vga_ram_size, boot_devices, ds, kernel_filename, | ||
435 | + kernel_cmdline, initrd_filename, cpu_model, &hwdefs[0]); | ||
436 | +} | ||
437 | + | ||
438 | +/* Sun4v hardware initialisation */ | ||
439 | +static void sun4v_init(ram_addr_t RAM_size, int vga_ram_size, | ||
440 | + const char *boot_devices, DisplayState *ds, | ||
441 | + const char *kernel_filename, const char *kernel_cmdline, | ||
442 | + const char *initrd_filename, const char *cpu_model) | ||
443 | +{ | ||
444 | + sun4uv_init(RAM_size, vga_ram_size, boot_devices, ds, kernel_filename, | ||
445 | + kernel_cmdline, initrd_filename, cpu_model, &hwdefs[1]); | ||
446 | +} | ||
447 | + | ||
412 | QEMUMachine sun4u_machine = { | 448 | QEMUMachine sun4u_machine = { |
413 | "sun4u", | 449 | "sun4u", |
414 | "Sun4u platform", | 450 | "Sun4u platform", |
415 | sun4u_init, | 451 | sun4u_init, |
416 | PROM_SIZE_MAX + VGA_RAM_SIZE, | 452 | PROM_SIZE_MAX + VGA_RAM_SIZE, |
417 | }; | 453 | }; |
454 | + | ||
455 | +QEMUMachine sun4v_machine = { | ||
456 | + "sun4v", | ||
457 | + "Sun4v platform", | ||
458 | + sun4v_init, | ||
459 | + PROM_SIZE_MAX + VGA_RAM_SIZE, | ||
460 | +}; |
qemu-doc.texi
@@ -75,7 +75,7 @@ For system emulation, the following hardware targets are supported: | @@ -75,7 +75,7 @@ For system emulation, the following hardware targets are supported: | ||
75 | @item G3 BW PowerMac (PowerPC processor) | 75 | @item G3 BW PowerMac (PowerPC processor) |
76 | @item Mac99 PowerMac (PowerPC processor, in progress) | 76 | @item Mac99 PowerMac (PowerPC processor, in progress) |
77 | @item Sun4m/Sun4c/Sun4d (32-bit Sparc processor) | 77 | @item Sun4m/Sun4c/Sun4d (32-bit Sparc processor) |
78 | -@item Sun4u (64-bit Sparc processor, in progress) | 78 | +@item Sun4u/Sun4v (64-bit Sparc processor, in progress) |
79 | @item Malta board (32-bit and 64-bit MIPS processors) | 79 | @item Malta board (32-bit and 64-bit MIPS processors) |
80 | @item MIPS Magnum (64-bit MIPS processor) | 80 | @item MIPS Magnum (64-bit MIPS processor) |
81 | @item ARM Integrator/CP (ARM) | 81 | @item ARM Integrator/CP (ARM) |
@@ -2315,10 +2315,10 @@ Set the emulated machine type. Default is SS-5. | @@ -2315,10 +2315,10 @@ Set the emulated machine type. Default is SS-5. | ||
2315 | @node Sparc64 System emulator | 2315 | @node Sparc64 System emulator |
2316 | @section Sparc64 System emulator | 2316 | @section Sparc64 System emulator |
2317 | 2317 | ||
2318 | -Use the executable @file{qemu-system-sparc64} to simulate a Sun4u machine. | ||
2319 | -The emulator is not usable for anything yet. | 2318 | +Use the executable @file{qemu-system-sparc64} to simulate a Sun4u or |
2319 | +Sun4v machine. The emulator is not usable for anything yet. | ||
2320 | 2320 | ||
2321 | -QEMU emulates the following sun4u peripherals: | 2321 | +QEMU emulates the following peripherals: |
2322 | 2322 | ||
2323 | @itemize @minus | 2323 | @itemize @minus |
2324 | @item | 2324 | @item |
@@ -2329,8 +2329,24 @@ PCI VGA compatible card with VESA Bochs Extensions | @@ -2329,8 +2329,24 @@ PCI VGA compatible card with VESA Bochs Extensions | ||
2329 | Non Volatile RAM M48T59 | 2329 | Non Volatile RAM M48T59 |
2330 | @item | 2330 | @item |
2331 | PC-compatible serial ports | 2331 | PC-compatible serial ports |
2332 | +@item | ||
2333 | +2 PCI IDE interfaces with hard disk and CD-ROM support | ||
2332 | @end itemize | 2334 | @end itemize |
2333 | 2335 | ||
2336 | +@c man begin OPTIONS | ||
2337 | + | ||
2338 | +The following options are specific to the Sparc64 emulation: | ||
2339 | + | ||
2340 | +@table @option | ||
2341 | + | ||
2342 | +@item -M [sun4u|sun4v] | ||
2343 | + | ||
2344 | +Set the emulated machine type. The default is sun4u. | ||
2345 | + | ||
2346 | +@end table | ||
2347 | + | ||
2348 | +@c man end | ||
2349 | + | ||
2334 | @node MIPS System emulator | 2350 | @node MIPS System emulator |
2335 | @section MIPS System emulator | 2351 | @section MIPS System emulator |
2336 | 2352 |
target-sparc/TODO
target-sparc/helper.c
@@ -1116,6 +1116,28 @@ static const sparc_def_t sparc_defs[] = { | @@ -1116,6 +1116,28 @@ static const sparc_def_t sparc_defs[] = { | ||
1116 | .features = CPU_DEFAULT_FEATURES, | 1116 | .features = CPU_DEFAULT_FEATURES, |
1117 | }, | 1117 | }, |
1118 | { | 1118 | { |
1119 | + .name = "Sun UltraSparc T1", | ||
1120 | + // defined in sparc_ifu_fdp.v and ctu.h | ||
1121 | + .iu_version = ((0x3eULL << 48) | (0x23ULL << 32) | (0x02ULL << 24) | ||
1122 | + | (MAXTL << 8)), | ||
1123 | + .fpu_version = 0x00000000, | ||
1124 | + .mmu_version = mmu_sun4v, | ||
1125 | + .nwindows = 8, | ||
1126 | + .features = CPU_DEFAULT_FEATURES | CPU_FEATURE_HYPV | CPU_FEATURE_CMT | ||
1127 | + | CPU_FEATURE_GL, | ||
1128 | + }, | ||
1129 | + { | ||
1130 | + .name = "Sun UltraSparc T2", | ||
1131 | + // defined in tlu_asi_ctl.v and n2_revid_cust.v | ||
1132 | + .iu_version = ((0x3eULL << 48) | (0x24ULL << 32) | (0x02ULL << 24) | ||
1133 | + | (MAXTL << 8)), | ||
1134 | + .fpu_version = 0x00000000, | ||
1135 | + .mmu_version = mmu_sun4v, | ||
1136 | + .nwindows = 8, | ||
1137 | + .features = CPU_DEFAULT_FEATURES | CPU_FEATURE_HYPV | CPU_FEATURE_CMT | ||
1138 | + | CPU_FEATURE_GL, | ||
1139 | + }, | ||
1140 | + { | ||
1119 | .name = "NEC UltraSparc I", | 1141 | .name = "NEC UltraSparc I", |
1120 | .iu_version = ((0x22ULL << 48) | (0x10ULL << 32) | (0x40ULL << 24) | 1142 | .iu_version = ((0x22ULL << 48) | (0x10ULL << 32) | (0x40ULL << 24) |
1121 | | (MAXTL << 8)), | 1143 | | (MAXTL << 8)), |
target-sparc/machine.c
@@ -7,6 +7,7 @@ void register_machines(void) | @@ -7,6 +7,7 @@ void register_machines(void) | ||
7 | { | 7 | { |
8 | #ifdef TARGET_SPARC64 | 8 | #ifdef TARGET_SPARC64 |
9 | qemu_register_machine(&sun4u_machine); | 9 | qemu_register_machine(&sun4u_machine); |
10 | + qemu_register_machine(&sun4v_machine); | ||
10 | #else | 11 | #else |
11 | qemu_register_machine(&ss5_machine); | 12 | qemu_register_machine(&ss5_machine); |
12 | qemu_register_machine(&ss10_machine); | 13 | qemu_register_machine(&ss10_machine); |