Commit c7ba218da1639a054b5ca1c259530305562fa571

Authored by blueswir1
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
hw/boards.h
... ... @@ -64,6 +64,7 @@ extern QEMUMachine ss1000_machine, ss2000_machine;
64 64  
65 65 /* sun4u.c */
66 66 extern QEMUMachine sun4u_machine;
  67 +extern QEMUMachine sun4v_machine;
67 68  
68 69 /* integratorcp.c */
69 70 extern QEMUMachine integratorcp_machine;
... ...
hw/sun4u.c
1 1 /*
2   - * QEMU Sun4u System Emulator
  2 + * QEMU Sun4u/Sun4v System Emulator
3 3 *
4 4 * Copyright (c) 2005 Fabrice Bellard
5 5 *
... ... @@ -45,6 +45,10 @@
45 45 #define NVRAM_SIZE 0x2000
46 46 #define MAX_IDE_BUS 2
47 47  
  48 +struct hwdef {
  49 + const char * const default_cpu_model;
  50 +};
  51 +
48 52 int DMA_get_channel_mode (int nchan)
49 53 {
50 54 return 0;
... ... @@ -245,11 +249,11 @@ static const int parallel_irq[MAX_PARALLEL_PORTS] = { 7, 7, 7 };
245 249  
246 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 258 CPUState *env;
255 259 char buf[1024];
... ... @@ -267,8 +271,9 @@ static void sun4u_init(ram_addr_t RAM_size, int vga_ram_size,
267 271 linux_boot = (kernel_filename != NULL);
268 272  
269 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 277 env = cpu_init(cpu_model);
273 278 if (!env) {
274 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 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 448 QEMUMachine sun4u_machine = {
413 449 "sun4u",
414 450 "Sun4u platform",
415 451 sun4u_init,
416 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 75 @item G3 BW PowerMac (PowerPC processor)
76 76 @item Mac99 PowerMac (PowerPC processor, in progress)
77 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 79 @item Malta board (32-bit and 64-bit MIPS processors)
80 80 @item MIPS Magnum (64-bit MIPS processor)
81 81 @item ARM Integrator/CP (ARM)
... ... @@ -2315,10 +2315,10 @@ Set the emulated machine type. Default is SS-5.
2315 2315 @node Sparc64 System emulator
2316 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 2323 @itemize @minus
2324 2324 @item
... ... @@ -2329,8 +2329,24 @@ PCI VGA compatible card with VESA Bochs Extensions
2329 2329 Non Volatile RAM M48T59
2330 2330 @item
2331 2331 PC-compatible serial ports
  2332 +@item
  2333 +2 PCI IDE interfaces with hard disk and CD-ROM support
2332 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 2350 @node MIPS System emulator
2335 2351 @section MIPS System emulator
2336 2352  
... ...
target-sparc/TODO
... ... @@ -86,4 +86,6 @@ Sun4u:
86 86 - A lot of real machine types
87 87  
88 88 Sun4v:
89   -- To be added
  89 +- A lot of unimplemented features
  90 + - A lot of real machine types
  91 +
... ...
target-sparc/helper.c
... ... @@ -1116,6 +1116,28 @@ static const sparc_def_t sparc_defs[] = {
1116 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 1141 .name = "NEC UltraSparc I",
1120 1142 .iu_version = ((0x22ULL << 48) | (0x10ULL << 32) | (0x40ULL << 24)
1121 1143 | (MAXTL << 8)),
... ...
target-sparc/machine.c
... ... @@ -7,6 +7,7 @@ void register_machines(void)
7 7 {
8 8 #ifdef TARGET_SPARC64
9 9 qemu_register_machine(&sun4u_machine);
  10 + qemu_register_machine(&sun4v_machine);
10 11 #else
11 12 qemu_register_machine(&ss5_machine);
12 13 qemu_register_machine(&ss10_machine);
... ...