]> git.proxmox.com Git - qemu.git/blame - hw/sun4m.c
Use C99 initializers
[qemu.git] / hw / sun4m.c
CommitLineData
420557e8 1/*
ee76f82e 2 * QEMU Sun4m & Sun4d & Sun4c System Emulator
5fafdf24 3 *
b81b3b10 4 * Copyright (c) 2003-2005 Fabrice Bellard
5fafdf24 5 *
420557e8
FB
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
87ecb68b
PB
24#include "hw.h"
25#include "qemu-timer.h"
26#include "sun4m.h"
27#include "nvram.h"
28#include "sparc32_dma.h"
29#include "fdc.h"
30#include "sysemu.h"
31#include "net.h"
32#include "boards.h"
d2c63fc1 33#include "firmware_abi.h"
8b17de88 34#include "scsi.h"
22548760
BS
35#include "pc.h"
36#include "isa.h"
d2c63fc1 37
b3a23197 38//#define DEBUG_IRQ
420557e8 39
36cd9210
BS
40/*
41 * Sun4m architecture was used in the following machines:
42 *
43 * SPARCserver 6xxMP/xx
77f193da
BS
44 * SPARCclassic (SPARCclassic Server)(SPARCstation LC) (4/15),
45 * SPARCclassic X (4/10)
36cd9210
BS
46 * SPARCstation LX/ZX (4/30)
47 * SPARCstation Voyager
48 * SPARCstation 10/xx, SPARCserver 10/xx
49 * SPARCstation 5, SPARCserver 5
50 * SPARCstation 20/xx, SPARCserver 20
51 * SPARCstation 4
52 *
7d85892b
BS
53 * Sun4d architecture was used in the following machines:
54 *
55 * SPARCcenter 2000
56 * SPARCserver 1000
57 *
ee76f82e
BS
58 * Sun4c architecture was used in the following machines:
59 * SPARCstation 1/1+, SPARCserver 1/1+
60 * SPARCstation SLC
61 * SPARCstation IPC
62 * SPARCstation ELC
63 * SPARCstation IPX
64 *
36cd9210
BS
65 * See for example: http://www.sunhelp.org/faq/sunref1.html
66 */
67
b3a23197
BS
68#ifdef DEBUG_IRQ
69#define DPRINTF(fmt, args...) \
70 do { printf("CPUIRQ: " fmt , ##args); } while (0)
71#else
72#define DPRINTF(fmt, args...)
73#endif
74
420557e8 75#define KERNEL_LOAD_ADDR 0x00004000
b6f479d3 76#define CMDLINE_ADDR 0x007ff000
713c45fa 77#define INITRD_LOAD_ADDR 0x00800000
aa6ad6fe 78#define PROM_SIZE_MAX (512 * 1024)
40ce0a9a 79#define PROM_VADDR 0xffd00000
f930d07e 80#define PROM_FILENAME "openbios-sparc32"
b8174937 81
ac2e9d66
BS
82// Control plane, 8-bit and 24-bit planes
83#define TCX_SIZE (9 * 1024 * 1024)
84
ba3c64fb 85#define MAX_CPUS 16
b3a23197 86#define MAX_PILS 16
420557e8 87
36cd9210 88struct hwdef {
5dcb6b91
BS
89 target_phys_addr_t iommu_base, slavio_base;
90 target_phys_addr_t intctl_base, counter_base, nvram_base, ms_kb_base;
91 target_phys_addr_t serial_base, fd_base;
4c2485de 92 target_phys_addr_t idreg_base, dma_base, esp_base, le_base;
0019ad53 93 target_phys_addr_t tcx_base, cs_base, apc_base, aux1_base, aux2_base;
7eb0c8e8
BS
94 target_phys_addr_t ecc_base;
95 uint32_t ecc_version;
ee76f82e 96 target_phys_addr_t sun4c_intctl_base, sun4c_counter_base;
36cd9210 97 long vram_size, nvram_size;
6341fdcb 98 // IRQ numbers are not PIL ones, but master interrupt controller
e3a79bca 99 // register bit numbers
d7edfd27 100 int intctl_g_intr, esp_irq, le_irq, clock_irq, clock1_irq;
e42c20b4 101 int ser_irq, ms_kb_irq, fd_irq, me_irq, cs_irq, ecc_irq;
36cd9210 102 int machine_id; // For NVRAM
7fbfb139 103 uint32_t iommu_version;
e0353fe2 104 uint32_t intbit_to_level[32];
3ebf5aaf
BS
105 uint64_t max_mem;
106 const char * const default_cpu_model;
36cd9210
BS
107};
108
7d85892b
BS
109#define MAX_IOUNITS 5
110
111struct sun4d_hwdef {
112 target_phys_addr_t iounit_bases[MAX_IOUNITS], slavio_base;
113 target_phys_addr_t counter_base, nvram_base, ms_kb_base;
114 target_phys_addr_t serial_base;
115 target_phys_addr_t espdma_base, esp_base;
116 target_phys_addr_t ledma_base, le_base;
117 target_phys_addr_t tcx_base;
118 target_phys_addr_t sbi_base;
119 unsigned long vram_size, nvram_size;
120 // IRQ numbers are not PIL ones, but SBI register bit numbers
121 int esp_irq, le_irq, clock_irq, clock1_irq;
122 int ser_irq, ms_kb_irq, me_irq;
123 int machine_id; // For NVRAM
124 uint32_t iounit_version;
125 uint64_t max_mem;
126 const char * const default_cpu_model;
127};
128
6f7e9aec
FB
129int DMA_get_channel_mode (int nchan)
130{
131 return 0;
132}
133int DMA_read_memory (int nchan, void *buf, int pos, int size)
134{
135 return 0;
136}
137int DMA_write_memory (int nchan, void *buf, int pos, int size)
138{
139 return 0;
140}
141void DMA_hold_DREQ (int nchan) {}
142void DMA_release_DREQ (int nchan) {}
143void DMA_schedule(int nchan) {}
144void DMA_run (void) {}
145void DMA_init (int high_page_enable) {}
146void DMA_register_channel (int nchan,
147 DMA_transfer_handler transfer_handler,
148 void *opaque)
149{
150}
151
81864572
BS
152static int nvram_boot_set(void *opaque, const char *boot_device)
153{
154 unsigned int i;
155 uint8_t image[sizeof(ohwcfg_v3_t)];
156 ohwcfg_v3_t *header = (ohwcfg_v3_t *)ℑ
157 m48t59_t *nvram = (m48t59_t *)opaque;
158
159 for (i = 0; i < sizeof(image); i++)
160 image[i] = m48t59_read(nvram, i) & 0xff;
161
e7fb1406 162 strcpy((char *)header->boot_devices, boot_device);
81864572
BS
163 header->nboot_devices = strlen(boot_device) & 0xff;
164 header->crc = cpu_to_be16(OHW_compute_crc(header, 0x00, 0xF8));
165
166 for (i = 0; i < sizeof(image); i++)
167 m48t59_write(nvram, i, image[i]);
168
169 return 0;
170}
171
6f7e9aec
FB
172extern int nographic;
173
819385c5 174static void nvram_init(m48t59_t *nvram, uint8_t *macaddr, const char *cmdline,
6ef05b95 175 const char *boot_devices, ram_addr_t RAM_size,
f930d07e
BS
176 uint32_t kernel_size,
177 int width, int height, int depth,
7d85892b 178 int machine_id, const char *arch)
e80cfcfc 179{
d2c63fc1 180 unsigned int i;
66508601 181 uint32_t start, end;
d2c63fc1
BS
182 uint8_t image[0x1ff0];
183 ohwcfg_v3_t *header = (ohwcfg_v3_t *)&image;
184 struct sparc_arch_cfg *sparc_header;
185 struct OpenBIOS_nvpart_v1 *part_header;
186
187 memset(image, '\0', sizeof(image));
e80cfcfc 188
6f7e9aec 189 // Try to match PPC NVRAM
e7fb1406 190 strcpy((char *)header->struct_ident, "QEMU_BIOS");
d2c63fc1
BS
191 header->struct_version = cpu_to_be32(3); /* structure v3 */
192
193 header->nvram_size = cpu_to_be16(0x2000);
194 header->nvram_arch_ptr = cpu_to_be16(sizeof(ohwcfg_v3_t));
195 header->nvram_arch_size = cpu_to_be16(sizeof(struct sparc_arch_cfg));
e7fb1406 196 strcpy((char *)header->arch, arch);
d2c63fc1
BS
197 header->nb_cpus = smp_cpus & 0xff;
198 header->RAM0_base = 0;
199 header->RAM0_size = cpu_to_be64((uint64_t)RAM_size);
e7fb1406 200 strcpy((char *)header->boot_devices, boot_devices);
d2c63fc1
BS
201 header->nboot_devices = strlen(boot_devices) & 0xff;
202 header->kernel_image = cpu_to_be64((uint64_t)KERNEL_LOAD_ADDR);
203 header->kernel_size = cpu_to_be64((uint64_t)kernel_size);
b6f479d3 204 if (cmdline) {
293f78bc 205 pstrcpy_targphys(CMDLINE_ADDR, TARGET_PAGE_SIZE, cmdline);
d2c63fc1
BS
206 header->cmdline = cpu_to_be64((uint64_t)CMDLINE_ADDR);
207 header->cmdline_size = cpu_to_be64((uint64_t)strlen(cmdline));
b6f479d3 208 }
d2c63fc1
BS
209 // XXX add initrd_image, initrd_size
210 header->width = cpu_to_be16(width);
211 header->height = cpu_to_be16(height);
212 header->depth = cpu_to_be16(depth);
213 if (nographic)
214 header->graphic_flags = cpu_to_be16(OHW_GF_NOGRAPHICS);
215
216 header->crc = cpu_to_be16(OHW_compute_crc(header, 0x00, 0xF8));
217
218 // Architecture specific header
219 start = sizeof(ohwcfg_v3_t);
220 sparc_header = (struct sparc_arch_cfg *)&image[start];
221 sparc_header->valid = 0;
222 start += sizeof(struct sparc_arch_cfg);
b6f479d3 223
66508601
BS
224 // OpenBIOS nvram variables
225 // Variable partition
d2c63fc1
BS
226 part_header = (struct OpenBIOS_nvpart_v1 *)&image[start];
227 part_header->signature = OPENBIOS_PART_SYSTEM;
228 strcpy(part_header->name, "system");
66508601 229
d2c63fc1 230 end = start + sizeof(struct OpenBIOS_nvpart_v1);
66508601 231 for (i = 0; i < nb_prom_envs; i++)
d2c63fc1
BS
232 end = OpenBIOS_set_var(image, end, prom_envs[i]);
233
234 // End marker
235 image[end++] = '\0';
66508601 236
66508601 237 end = start + ((end - start + 15) & ~15);
d2c63fc1 238 OpenBIOS_finish_partition(part_header, end - start);
66508601
BS
239
240 // free partition
241 start = end;
d2c63fc1
BS
242 part_header = (struct OpenBIOS_nvpart_v1 *)&image[start];
243 part_header->signature = OPENBIOS_PART_FREE;
244 strcpy(part_header->name, "free");
66508601
BS
245
246 end = 0x1fd0;
d2c63fc1
BS
247 OpenBIOS_finish_partition(part_header, end - start);
248
249 Sun_init_header((struct Sun_nvram *)&image[0x1fd8], macaddr, machine_id);
250
251 for (i = 0; i < sizeof(image); i++)
252 m48t59_write(nvram, i, image[i]);
81864572
BS
253
254 qemu_register_boot_set(nvram_boot_set, nvram);
e80cfcfc
FB
255}
256
257static void *slavio_intctl;
258
22548760 259void pic_info(void)
e80cfcfc 260{
7d85892b
BS
261 if (slavio_intctl)
262 slavio_pic_info(slavio_intctl);
e80cfcfc
FB
263}
264
22548760 265void irq_info(void)
e80cfcfc 266{
7d85892b
BS
267 if (slavio_intctl)
268 slavio_irq_info(slavio_intctl);
e80cfcfc
FB
269}
270
327ac2e7
BS
271void cpu_check_irqs(CPUState *env)
272{
273 if (env->pil_in && (env->interrupt_index == 0 ||
274 (env->interrupt_index & ~15) == TT_EXTINT)) {
275 unsigned int i;
276
277 for (i = 15; i > 0; i--) {
278 if (env->pil_in & (1 << i)) {
279 int old_interrupt = env->interrupt_index;
280
281 env->interrupt_index = TT_EXTINT | i;
f32d7ec5
BS
282 if (old_interrupt != env->interrupt_index) {
283 DPRINTF("Set CPU IRQ %d\n", i);
327ac2e7 284 cpu_interrupt(env, CPU_INTERRUPT_HARD);
f32d7ec5 285 }
327ac2e7
BS
286 break;
287 }
288 }
289 } else if (!env->pil_in && (env->interrupt_index & ~15) == TT_EXTINT) {
f32d7ec5 290 DPRINTF("Reset CPU IRQ %d\n", env->interrupt_index & 15);
327ac2e7
BS
291 env->interrupt_index = 0;
292 cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
293 }
294}
295
b3a23197
BS
296static void cpu_set_irq(void *opaque, int irq, int level)
297{
298 CPUState *env = opaque;
299
300 if (level) {
301 DPRINTF("Raise CPU IRQ %d\n", irq);
b3a23197 302 env->halted = 0;
327ac2e7
BS
303 env->pil_in |= 1 << irq;
304 cpu_check_irqs(env);
b3a23197
BS
305 } else {
306 DPRINTF("Lower CPU IRQ %d\n", irq);
327ac2e7
BS
307 env->pil_in &= ~(1 << irq);
308 cpu_check_irqs(env);
b3a23197
BS
309 }
310}
311
312static void dummy_cpu_set_irq(void *opaque, int irq, int level)
313{
314}
315
3475187d
FB
316static void *slavio_misc;
317
318void qemu_system_powerdown(void)
319{
320 slavio_set_power_fail(slavio_misc, 1);
321}
322
c68ea704
FB
323static void main_cpu_reset(void *opaque)
324{
325 CPUState *env = opaque;
3d29fbef
BS
326
327 cpu_reset(env);
328 env->halted = 0;
329}
330
331static void secondary_cpu_reset(void *opaque)
332{
333 CPUState *env = opaque;
334
c68ea704 335 cpu_reset(env);
3d29fbef 336 env->halted = 1;
c68ea704
FB
337}
338
3ebf5aaf 339static unsigned long sun4m_load_kernel(const char *kernel_filename,
293f78bc
BS
340 const char *initrd_filename,
341 ram_addr_t RAM_size)
3ebf5aaf
BS
342{
343 int linux_boot;
344 unsigned int i;
345 long initrd_size, kernel_size;
346
347 linux_boot = (kernel_filename != NULL);
348
349 kernel_size = 0;
350 if (linux_boot) {
351 kernel_size = load_elf(kernel_filename, -0xf0000000ULL, NULL, NULL,
352 NULL);
353 if (kernel_size < 0)
293f78bc
BS
354 kernel_size = load_aout(kernel_filename, KERNEL_LOAD_ADDR,
355 RAM_size - KERNEL_LOAD_ADDR);
3ebf5aaf 356 if (kernel_size < 0)
293f78bc
BS
357 kernel_size = load_image_targphys(kernel_filename,
358 KERNEL_LOAD_ADDR,
359 RAM_size - KERNEL_LOAD_ADDR);
3ebf5aaf
BS
360 if (kernel_size < 0) {
361 fprintf(stderr, "qemu: could not load kernel '%s'\n",
362 kernel_filename);
363 exit(1);
364 }
365
366 /* load initrd */
367 initrd_size = 0;
368 if (initrd_filename) {
293f78bc
BS
369 initrd_size = load_image_targphys(initrd_filename,
370 INITRD_LOAD_ADDR,
371 RAM_size - INITRD_LOAD_ADDR);
3ebf5aaf
BS
372 if (initrd_size < 0) {
373 fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
374 initrd_filename);
375 exit(1);
376 }
377 }
378 if (initrd_size > 0) {
379 for (i = 0; i < 64 * TARGET_PAGE_SIZE; i += TARGET_PAGE_SIZE) {
293f78bc
BS
380 if (ldl_phys(KERNEL_LOAD_ADDR + i) == 0x48647253) { // HdrS
381 stl_phys(KERNEL_LOAD_ADDR + i + 16, INITRD_LOAD_ADDR);
382 stl_phys(KERNEL_LOAD_ADDR + i + 20, initrd_size);
3ebf5aaf
BS
383 break;
384 }
385 }
386 }
387 }
388 return kernel_size;
389}
390
6ef05b95 391static void sun4m_hw_init(const struct hwdef *hwdef, ram_addr_t RAM_size,
3ebf5aaf
BS
392 const char *boot_device,
393 DisplayState *ds, const char *kernel_filename,
394 const char *kernel_cmdline,
395 const char *initrd_filename, const char *cpu_model)
36cd9210 396
420557e8 397{
ba3c64fb 398 CPUState *env, *envs[MAX_CPUS];
713c45fa 399 unsigned int i;
b3ceef24 400 void *iommu, *espdma, *ledma, *main_esp, *nvram;
b3a23197 401 qemu_irq *cpu_irqs[MAX_CPUS], *slavio_irq, *slavio_cpu_irq,
d7edfd27 402 *espdma_irq, *ledma_irq;
2d069bab 403 qemu_irq *esp_reset, *le_reset;
2be17ebd 404 qemu_irq *fdc_tc;
3ebf5aaf
BS
405 unsigned long prom_offset, kernel_size;
406 int ret;
407 char buf[1024];
e4bcb14c 408 BlockDriverState *fd[MAX_FD];
22548760 409 int drive_index;
420557e8 410
ba3c64fb 411 /* init CPUs */
3ebf5aaf
BS
412 if (!cpu_model)
413 cpu_model = hwdef->default_cpu_model;
b3a23197 414
ba3c64fb 415 for(i = 0; i < smp_cpus; i++) {
aaed909a
FB
416 env = cpu_init(cpu_model);
417 if (!env) {
8e82c6a8 418 fprintf(stderr, "qemu: Unable to find Sparc CPU definition\n");
aaed909a
FB
419 exit(1);
420 }
421 cpu_sparc_set_id(env, i);
ba3c64fb 422 envs[i] = env;
3d29fbef
BS
423 if (i == 0) {
424 qemu_register_reset(main_cpu_reset, env);
425 } else {
426 qemu_register_reset(secondary_cpu_reset, env);
ba3c64fb 427 env->halted = 1;
3d29fbef 428 }
b3a23197 429 cpu_irqs[i] = qemu_allocate_irqs(cpu_set_irq, envs[i], MAX_PILS);
3ebf5aaf 430 env->prom_addr = hwdef->slavio_base;
ba3c64fb 431 }
b3a23197
BS
432
433 for (i = smp_cpus; i < MAX_CPUS; i++)
434 cpu_irqs[i] = qemu_allocate_irqs(dummy_cpu_set_irq, NULL, MAX_PILS);
435
3ebf5aaf 436
420557e8 437 /* allocate RAM */
3ebf5aaf 438 if ((uint64_t)RAM_size > hwdef->max_mem) {
77f193da
BS
439 fprintf(stderr,
440 "qemu: Too much memory for this machine: %d, maximum %d\n",
6ef05b95 441 (unsigned int)(RAM_size / (1024 * 1024)),
3ebf5aaf
BS
442 (unsigned int)(hwdef->max_mem / (1024 * 1024)));
443 exit(1);
444 }
b3ceef24 445 cpu_register_physical_memory(0, RAM_size, 0);
420557e8 446
3ebf5aaf
BS
447 /* load boot prom */
448 prom_offset = RAM_size + hwdef->vram_size;
449 cpu_register_physical_memory(hwdef->slavio_base,
450 (PROM_SIZE_MAX + TARGET_PAGE_SIZE - 1) &
451 TARGET_PAGE_MASK,
452 prom_offset | IO_MEM_ROM);
453
454 if (bios_name == NULL)
455 bios_name = PROM_FILENAME;
456 snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
457 ret = load_elf(buf, hwdef->slavio_base - PROM_VADDR, NULL, NULL, NULL);
458 if (ret < 0 || ret > PROM_SIZE_MAX)
e01f4a1c 459 ret = load_image_targphys(buf, hwdef->slavio_base, PROM_SIZE_MAX);
3ebf5aaf
BS
460 if (ret < 0 || ret > PROM_SIZE_MAX) {
461 fprintf(stderr, "qemu: could not load prom '%s'\n",
462 buf);
463 exit(1);
464 }
4c2485de 465 prom_offset += (ret + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
3ebf5aaf
BS
466
467 /* set up devices */
36cd9210 468 slavio_intctl = slavio_intctl_init(hwdef->intctl_base,
5dcb6b91 469 hwdef->intctl_base + 0x10000ULL,
d537cf6c 470 &hwdef->intbit_to_level[0],
d7edfd27 471 &slavio_irq, &slavio_cpu_irq,
b3a23197 472 cpu_irqs,
d7edfd27 473 hwdef->clock_irq);
b3a23197 474
4c2485de 475 if (hwdef->idreg_base != (target_phys_addr_t)-1) {
293f78bc 476 static const uint8_t idreg_data[] = { 0xfe, 0x81, 0x01, 0x03 };
4c2485de 477
293f78bc 478 cpu_register_physical_memory(hwdef->idreg_base, sizeof(idreg_data),
4c2485de 479 prom_offset | IO_MEM_ROM);
293f78bc
BS
480 cpu_physical_memory_write_rom(hwdef->idreg_base, idreg_data,
481 sizeof(idreg_data));
4c2485de
BS
482 }
483
ff403da6
BS
484 iommu = iommu_init(hwdef->iommu_base, hwdef->iommu_version,
485 slavio_irq[hwdef->me_irq]);
486
5aca8c3b 487 espdma = sparc32_dma_init(hwdef->dma_base, slavio_irq[hwdef->esp_irq],
2d069bab
BS
488 iommu, &espdma_irq, &esp_reset);
489
5aca8c3b 490 ledma = sparc32_dma_init(hwdef->dma_base + 16ULL,
2d069bab
BS
491 slavio_irq[hwdef->le_irq], iommu, &ledma_irq,
492 &le_reset);
ba3c64fb 493
eee0b836
BS
494 if (graphic_depth != 8 && graphic_depth != 24) {
495 fprintf(stderr, "qemu: Unsupported depth: %d\n", graphic_depth);
496 exit (1);
497 }
b3ceef24 498 tcx_init(ds, hwdef->tcx_base, phys_ram_base + RAM_size, RAM_size,
eee0b836 499 hwdef->vram_size, graphic_width, graphic_height, graphic_depth);
dbe06e18
BS
500
501 if (nd_table[0].model == NULL
502 || strcmp(nd_table[0].model, "lance") == 0) {
2d069bab 503 lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset);
c4a7060c
BS
504 } else if (strcmp(nd_table[0].model, "?") == 0) {
505 fprintf(stderr, "qemu: Supported NICs: lance\n");
506 exit (1);
dbe06e18
BS
507 } else {
508 fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model);
509 exit (1);
a41b2ff2 510 }
dbe06e18 511
d537cf6c
PB
512 nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0,
513 hwdef->nvram_size, 8);
81732d19
BS
514
515 slavio_timer_init_all(hwdef->counter_base, slavio_irq[hwdef->clock1_irq],
19f8e5dd 516 slavio_cpu_irq, smp_cpus);
81732d19 517
577390ff
BS
518 slavio_serial_ms_kbd_init(hwdef->ms_kb_base, slavio_irq[hwdef->ms_kb_irq],
519 nographic);
b81b3b10
FB
520 // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device
521 // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device
d537cf6c
PB
522 slavio_serial_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq],
523 serial_hds[1], serial_hds[0]);
741402f9 524
2be17ebd
BS
525 slavio_misc = slavio_misc_init(hwdef->slavio_base, hwdef->apc_base,
526 hwdef->aux1_base, hwdef->aux2_base,
527 slavio_irq[hwdef->me_irq], envs[0],
528 &fdc_tc);
529
e4bcb14c
TS
530 if (hwdef->fd_base != (target_phys_addr_t)-1) {
531 /* there is zero or one floppy drive */
309e60bd 532 memset(fd, 0, sizeof(fd));
22548760
BS
533 drive_index = drive_get_index(IF_FLOPPY, 0, 0);
534 if (drive_index != -1)
535 fd[0] = drives_table[drive_index].bdrv;
2d069bab 536
2be17ebd
BS
537 sun4m_fdctrl_init(slavio_irq[hwdef->fd_irq], hwdef->fd_base, fd,
538 fdc_tc);
e4bcb14c
TS
539 }
540
541 if (drive_get_max_bus(IF_SCSI) > 0) {
542 fprintf(stderr, "qemu: too many SCSI bus\n");
543 exit(1);
544 }
545
5d20fa6b 546 main_esp = esp_init(hwdef->esp_base, 2,
8b17de88
BS
547 espdma_memory_read, espdma_memory_write,
548 espdma, *espdma_irq, esp_reset);
f1587550 549
e4bcb14c 550 for (i = 0; i < ESP_MAX_DEVS; i++) {
22548760
BS
551 drive_index = drive_get_index(IF_SCSI, 0, i);
552 if (drive_index == -1)
e4bcb14c 553 continue;
22548760 554 esp_scsi_attach(main_esp, drives_table[drive_index].bdrv, i);
f1587550
TS
555 }
556
5dcb6b91 557 if (hwdef->cs_base != (target_phys_addr_t)-1)
803b3c7b 558 cs_init(hwdef->cs_base, hwdef->cs_irq, slavio_intctl);
b3ceef24 559
293f78bc
BS
560 kernel_size = sun4m_load_kernel(kernel_filename, initrd_filename,
561 RAM_size);
36cd9210 562
36cd9210 563 nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline,
b3ceef24 564 boot_device, RAM_size, kernel_size, graphic_width,
7d85892b 565 graphic_height, graphic_depth, hwdef->machine_id, "Sun4m");
7eb0c8e8
BS
566
567 if (hwdef->ecc_base != (target_phys_addr_t)-1)
e42c20b4
BS
568 ecc_init(hwdef->ecc_base, slavio_irq[hwdef->ecc_irq],
569 hwdef->ecc_version);
36cd9210
BS
570}
571
6ef05b95 572static void sun4c_hw_init(const struct hwdef *hwdef, ram_addr_t RAM_size,
ee76f82e
BS
573 const char *boot_device,
574 DisplayState *ds, const char *kernel_filename,
575 const char *kernel_cmdline,
576 const char *initrd_filename, const char *cpu_model)
577{
578 CPUState *env;
579 unsigned int i;
580 void *iommu, *espdma, *ledma, *main_esp, *nvram;
581 qemu_irq *cpu_irqs, *slavio_irq, *espdma_irq, *ledma_irq;
582 qemu_irq *esp_reset, *le_reset;
2be17ebd 583 qemu_irq *fdc_tc;
ee76f82e
BS
584 unsigned long prom_offset, kernel_size;
585 int ret;
586 char buf[1024];
587 BlockDriverState *fd[MAX_FD];
22548760 588 int drive_index;
ee76f82e
BS
589
590 /* init CPU */
591 if (!cpu_model)
592 cpu_model = hwdef->default_cpu_model;
593
594 env = cpu_init(cpu_model);
595 if (!env) {
8e82c6a8 596 fprintf(stderr, "qemu: Unable to find Sparc CPU definition\n");
ee76f82e
BS
597 exit(1);
598 }
599
600 cpu_sparc_set_id(env, 0);
601
602 qemu_register_reset(main_cpu_reset, env);
ee76f82e 603 cpu_irqs = qemu_allocate_irqs(cpu_set_irq, env, MAX_PILS);
cebb73aa 604 env->prom_addr = hwdef->slavio_base;
ee76f82e
BS
605
606 /* allocate RAM */
607 if ((uint64_t)RAM_size > hwdef->max_mem) {
77f193da
BS
608 fprintf(stderr,
609 "qemu: Too much memory for this machine: %d, maximum %d\n",
6ef05b95
BS
610 (unsigned int)(RAM_size / (1024 * 1024)),
611 (unsigned int)(hwdef->max_mem / (1024 * 1024)));
ee76f82e
BS
612 exit(1);
613 }
614 cpu_register_physical_memory(0, RAM_size, 0);
615
616 /* load boot prom */
617 prom_offset = RAM_size + hwdef->vram_size;
618 cpu_register_physical_memory(hwdef->slavio_base,
619 (PROM_SIZE_MAX + TARGET_PAGE_SIZE - 1) &
620 TARGET_PAGE_MASK,
621 prom_offset | IO_MEM_ROM);
622
623 if (bios_name == NULL)
624 bios_name = PROM_FILENAME;
625 snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
626 ret = load_elf(buf, hwdef->slavio_base - PROM_VADDR, NULL, NULL, NULL);
627 if (ret < 0 || ret > PROM_SIZE_MAX)
e01f4a1c 628 ret = load_image_targphys(buf, hwdef->slavio_base, PROM_SIZE_MAX);
ee76f82e
BS
629 if (ret < 0 || ret > PROM_SIZE_MAX) {
630 fprintf(stderr, "qemu: could not load prom '%s'\n",
631 buf);
632 exit(1);
633 }
634 prom_offset += (ret + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
635
636 /* set up devices */
637 slavio_intctl = sun4c_intctl_init(hwdef->sun4c_intctl_base,
638 &slavio_irq, cpu_irqs);
639
ff403da6
BS
640 iommu = iommu_init(hwdef->iommu_base, hwdef->iommu_version,
641 slavio_irq[hwdef->me_irq]);
ee76f82e
BS
642
643 espdma = sparc32_dma_init(hwdef->dma_base, slavio_irq[hwdef->esp_irq],
644 iommu, &espdma_irq, &esp_reset);
645
646 ledma = sparc32_dma_init(hwdef->dma_base + 16ULL,
647 slavio_irq[hwdef->le_irq], iommu, &ledma_irq,
648 &le_reset);
649
650 if (graphic_depth != 8 && graphic_depth != 24) {
651 fprintf(stderr, "qemu: Unsupported depth: %d\n", graphic_depth);
652 exit (1);
653 }
654 tcx_init(ds, hwdef->tcx_base, phys_ram_base + RAM_size, RAM_size,
655 hwdef->vram_size, graphic_width, graphic_height, graphic_depth);
656
657 if (nd_table[0].model == NULL
658 || strcmp(nd_table[0].model, "lance") == 0) {
659 lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset);
660 } else if (strcmp(nd_table[0].model, "?") == 0) {
661 fprintf(stderr, "qemu: Supported NICs: lance\n");
662 exit (1);
663 } else {
664 fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model);
665 exit (1);
666 }
667
668 nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0,
4aed2c33 669 hwdef->nvram_size, 2);
ee76f82e
BS
670
671 slavio_serial_ms_kbd_init(hwdef->ms_kb_base, slavio_irq[hwdef->ms_kb_irq],
672 nographic);
673 // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device
674 // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device
675 slavio_serial_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq],
676 serial_hds[1], serial_hds[0]);
677
2be17ebd
BS
678 slavio_misc = slavio_misc_init(-1, hwdef->apc_base,
679 hwdef->aux1_base, hwdef->aux2_base,
680 slavio_irq[hwdef->me_irq], env, &fdc_tc);
681
ee76f82e
BS
682 if (hwdef->fd_base != (target_phys_addr_t)-1) {
683 /* there is zero or one floppy drive */
684 fd[1] = fd[0] = NULL;
22548760
BS
685 drive_index = drive_get_index(IF_FLOPPY, 0, 0);
686 if (drive_index != -1)
687 fd[0] = drives_table[drive_index].bdrv;
ee76f82e 688
2be17ebd
BS
689 sun4m_fdctrl_init(slavio_irq[hwdef->fd_irq], hwdef->fd_base, fd,
690 fdc_tc);
ee76f82e
BS
691 }
692
693 if (drive_get_max_bus(IF_SCSI) > 0) {
694 fprintf(stderr, "qemu: too many SCSI bus\n");
695 exit(1);
696 }
697
5d20fa6b 698 main_esp = esp_init(hwdef->esp_base, 2,
8b17de88
BS
699 espdma_memory_read, espdma_memory_write,
700 espdma, *espdma_irq, esp_reset);
ee76f82e
BS
701
702 for (i = 0; i < ESP_MAX_DEVS; i++) {
22548760
BS
703 drive_index = drive_get_index(IF_SCSI, 0, i);
704 if (drive_index == -1)
ee76f82e 705 continue;
22548760 706 esp_scsi_attach(main_esp, drives_table[drive_index].bdrv, i);
ee76f82e
BS
707 }
708
293f78bc
BS
709 kernel_size = sun4m_load_kernel(kernel_filename, initrd_filename,
710 RAM_size);
ee76f82e
BS
711
712 nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline,
713 boot_device, RAM_size, kernel_size, graphic_width,
714 graphic_height, graphic_depth, hwdef->machine_id, "Sun4c");
715}
716
36cd9210
BS
717static const struct hwdef hwdefs[] = {
718 /* SS-5 */
719 {
720 .iommu_base = 0x10000000,
721 .tcx_base = 0x50000000,
722 .cs_base = 0x6c000000,
384ccb5d 723 .slavio_base = 0x70000000,
36cd9210
BS
724 .ms_kb_base = 0x71000000,
725 .serial_base = 0x71100000,
726 .nvram_base = 0x71200000,
727 .fd_base = 0x71400000,
728 .counter_base = 0x71d00000,
729 .intctl_base = 0x71e00000,
4c2485de 730 .idreg_base = 0x78000000,
36cd9210
BS
731 .dma_base = 0x78400000,
732 .esp_base = 0x78800000,
733 .le_base = 0x78c00000,
127fc407 734 .apc_base = 0x6a000000,
0019ad53
BS
735 .aux1_base = 0x71900000,
736 .aux2_base = 0x71910000,
7eb0c8e8 737 .ecc_base = -1,
ee76f82e
BS
738 .sun4c_intctl_base = -1,
739 .sun4c_counter_base = -1,
36cd9210
BS
740 .vram_size = 0x00100000,
741 .nvram_size = 0x2000,
742 .esp_irq = 18,
743 .le_irq = 16,
e3a79bca 744 .clock_irq = 7,
36cd9210
BS
745 .clock1_irq = 19,
746 .ms_kb_irq = 14,
747 .ser_irq = 15,
748 .fd_irq = 22,
749 .me_irq = 30,
750 .cs_irq = 5,
751 .machine_id = 0x80,
cf3102ac 752 .iommu_version = 0x05000000,
e0353fe2 753 .intbit_to_level = {
f930d07e
BS
754 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12,
755 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0,
e0353fe2 756 },
3ebf5aaf
BS
757 .max_mem = 0x10000000,
758 .default_cpu_model = "Fujitsu MB86904",
e0353fe2
BS
759 },
760 /* SS-10 */
e0353fe2 761 {
5dcb6b91
BS
762 .iommu_base = 0xfe0000000ULL,
763 .tcx_base = 0xe20000000ULL,
803b3c7b 764 .cs_base = -1,
5dcb6b91
BS
765 .slavio_base = 0xff0000000ULL,
766 .ms_kb_base = 0xff1000000ULL,
767 .serial_base = 0xff1100000ULL,
768 .nvram_base = 0xff1200000ULL,
769 .fd_base = 0xff1700000ULL,
770 .counter_base = 0xff1300000ULL,
771 .intctl_base = 0xff1400000ULL,
4c2485de 772 .idreg_base = 0xef0000000ULL,
5dcb6b91
BS
773 .dma_base = 0xef0400000ULL,
774 .esp_base = 0xef0800000ULL,
775 .le_base = 0xef0c00000ULL,
0019ad53 776 .apc_base = 0xefa000000ULL, // XXX should not exist
127fc407
BS
777 .aux1_base = 0xff1800000ULL,
778 .aux2_base = 0xff1a01000ULL,
7eb0c8e8
BS
779 .ecc_base = 0xf00000000ULL,
780 .ecc_version = 0x10000000, // version 0, implementation 1
ee76f82e
BS
781 .sun4c_intctl_base = -1,
782 .sun4c_counter_base = -1,
e0353fe2
BS
783 .vram_size = 0x00100000,
784 .nvram_size = 0x2000,
785 .esp_irq = 18,
786 .le_irq = 16,
e3a79bca 787 .clock_irq = 7,
e0353fe2
BS
788 .clock1_irq = 19,
789 .ms_kb_irq = 14,
790 .ser_irq = 15,
791 .fd_irq = 22,
792 .me_irq = 30,
803b3c7b 793 .cs_irq = -1,
e42c20b4 794 .ecc_irq = 28,
803b3c7b 795 .machine_id = 0x72,
7fbfb139 796 .iommu_version = 0x03000000,
e0353fe2 797 .intbit_to_level = {
f930d07e
BS
798 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12,
799 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0,
e0353fe2 800 },
6ef05b95 801 .max_mem = 0xf00000000ULL,
3ebf5aaf 802 .default_cpu_model = "TI SuperSparc II",
36cd9210 803 },
6a3b9cc9
BS
804 /* SS-600MP */
805 {
806 .iommu_base = 0xfe0000000ULL,
807 .tcx_base = 0xe20000000ULL,
808 .cs_base = -1,
809 .slavio_base = 0xff0000000ULL,
810 .ms_kb_base = 0xff1000000ULL,
811 .serial_base = 0xff1100000ULL,
812 .nvram_base = 0xff1200000ULL,
813 .fd_base = -1,
814 .counter_base = 0xff1300000ULL,
815 .intctl_base = 0xff1400000ULL,
4c2485de 816 .idreg_base = -1,
6a3b9cc9
BS
817 .dma_base = 0xef0081000ULL,
818 .esp_base = 0xef0080000ULL,
819 .le_base = 0xef0060000ULL,
0019ad53 820 .apc_base = 0xefa000000ULL, // XXX should not exist
127fc407
BS
821 .aux1_base = 0xff1800000ULL,
822 .aux2_base = 0xff1a01000ULL, // XXX should not exist
7eb0c8e8
BS
823 .ecc_base = 0xf00000000ULL,
824 .ecc_version = 0x00000000, // version 0, implementation 0
ee76f82e
BS
825 .sun4c_intctl_base = -1,
826 .sun4c_counter_base = -1,
6a3b9cc9
BS
827 .vram_size = 0x00100000,
828 .nvram_size = 0x2000,
829 .esp_irq = 18,
830 .le_irq = 16,
e3a79bca 831 .clock_irq = 7,
6a3b9cc9
BS
832 .clock1_irq = 19,
833 .ms_kb_irq = 14,
834 .ser_irq = 15,
835 .fd_irq = 22,
836 .me_irq = 30,
837 .cs_irq = -1,
e42c20b4 838 .ecc_irq = 28,
6a3b9cc9 839 .machine_id = 0x71,
7fbfb139 840 .iommu_version = 0x01000000,
6a3b9cc9
BS
841 .intbit_to_level = {
842 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12,
843 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0,
844 },
6ef05b95 845 .max_mem = 0xf00000000ULL,
3ebf5aaf 846 .default_cpu_model = "TI SuperSparc II",
6a3b9cc9 847 },
ae40972f
BS
848 /* SS-20 */
849 {
850 .iommu_base = 0xfe0000000ULL,
851 .tcx_base = 0xe20000000ULL,
852 .cs_base = -1,
853 .slavio_base = 0xff0000000ULL,
854 .ms_kb_base = 0xff1000000ULL,
855 .serial_base = 0xff1100000ULL,
856 .nvram_base = 0xff1200000ULL,
857 .fd_base = 0xff1700000ULL,
858 .counter_base = 0xff1300000ULL,
859 .intctl_base = 0xff1400000ULL,
4c2485de 860 .idreg_base = 0xef0000000ULL,
ae40972f
BS
861 .dma_base = 0xef0400000ULL,
862 .esp_base = 0xef0800000ULL,
863 .le_base = 0xef0c00000ULL,
0019ad53 864 .apc_base = 0xefa000000ULL, // XXX should not exist
577d8dd4
BS
865 .aux1_base = 0xff1800000ULL,
866 .aux2_base = 0xff1a01000ULL,
ae40972f
BS
867 .ecc_base = 0xf00000000ULL,
868 .ecc_version = 0x20000000, // version 0, implementation 2
ee76f82e
BS
869 .sun4c_intctl_base = -1,
870 .sun4c_counter_base = -1,
ae40972f
BS
871 .vram_size = 0x00100000,
872 .nvram_size = 0x2000,
873 .esp_irq = 18,
874 .le_irq = 16,
e3a79bca 875 .clock_irq = 7,
ae40972f
BS
876 .clock1_irq = 19,
877 .ms_kb_irq = 14,
878 .ser_irq = 15,
879 .fd_irq = 22,
880 .me_irq = 30,
881 .cs_irq = -1,
e42c20b4 882 .ecc_irq = 28,
ae40972f
BS
883 .machine_id = 0x72,
884 .iommu_version = 0x13000000,
885 .intbit_to_level = {
886 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12,
887 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0,
888 },
6ef05b95 889 .max_mem = 0xf00000000ULL,
ae40972f
BS
890 .default_cpu_model = "TI SuperSparc II",
891 },
ee76f82e
BS
892 /* SS-2 */
893 {
894 .iommu_base = 0xf8000000,
895 .tcx_base = 0xfe000000,
896 .cs_base = -1,
897 .slavio_base = 0xf6000000,
898 .ms_kb_base = 0xf0000000,
899 .serial_base = 0xf1000000,
900 .nvram_base = 0xf2000000,
901 .fd_base = 0xf7200000,
902 .counter_base = -1,
903 .intctl_base = -1,
904 .dma_base = 0xf8400000,
905 .esp_base = 0xf8800000,
906 .le_base = 0xf8c00000,
0019ad53
BS
907 .apc_base = -1,
908 .aux1_base = 0xf7400003,
909 .aux2_base = -1,
ee76f82e
BS
910 .sun4c_intctl_base = 0xf5000000,
911 .sun4c_counter_base = 0xf3000000,
912 .vram_size = 0x00100000,
4aed2c33 913 .nvram_size = 0x800,
ee76f82e
BS
914 .esp_irq = 2,
915 .le_irq = 3,
916 .clock_irq = 5,
917 .clock1_irq = 7,
918 .ms_kb_irq = 1,
919 .ser_irq = 1,
920 .fd_irq = 1,
921 .me_irq = 1,
922 .cs_irq = -1,
923 .machine_id = 0x55,
924 .max_mem = 0x10000000,
925 .default_cpu_model = "Cypress CY7C601",
926 },
a526a31c
BS
927 /* Voyager */
928 {
929 .iommu_base = 0x10000000,
930 .tcx_base = 0x50000000,
931 .cs_base = -1,
932 .slavio_base = 0x70000000,
933 .ms_kb_base = 0x71000000,
934 .serial_base = 0x71100000,
935 .nvram_base = 0x71200000,
936 .fd_base = 0x71400000,
937 .counter_base = 0x71d00000,
938 .intctl_base = 0x71e00000,
939 .idreg_base = 0x78000000,
940 .dma_base = 0x78400000,
941 .esp_base = 0x78800000,
942 .le_base = 0x78c00000,
943 .apc_base = 0x71300000, // pmc
944 .aux1_base = 0x71900000,
945 .aux2_base = 0x71910000,
946 .ecc_base = -1,
947 .sun4c_intctl_base = -1,
948 .sun4c_counter_base = -1,
949 .vram_size = 0x00100000,
950 .nvram_size = 0x2000,
951 .esp_irq = 18,
952 .le_irq = 16,
953 .clock_irq = 7,
954 .clock1_irq = 19,
955 .ms_kb_irq = 14,
956 .ser_irq = 15,
957 .fd_irq = 22,
958 .me_irq = 30,
959 .cs_irq = -1,
960 .machine_id = 0x80,
961 .iommu_version = 0x05000000,
962 .intbit_to_level = {
963 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12,
964 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0,
965 },
966 .max_mem = 0x10000000,
967 .default_cpu_model = "Fujitsu MB86904",
968 },
969 /* LX */
970 {
971 .iommu_base = 0x10000000,
972 .tcx_base = 0x50000000,
973 .cs_base = -1,
974 .slavio_base = 0x70000000,
975 .ms_kb_base = 0x71000000,
976 .serial_base = 0x71100000,
977 .nvram_base = 0x71200000,
978 .fd_base = 0x71400000,
979 .counter_base = 0x71d00000,
980 .intctl_base = 0x71e00000,
981 .idreg_base = 0x78000000,
982 .dma_base = 0x78400000,
983 .esp_base = 0x78800000,
984 .le_base = 0x78c00000,
985 .apc_base = -1,
986 .aux1_base = 0x71900000,
987 .aux2_base = 0x71910000,
988 .ecc_base = -1,
989 .sun4c_intctl_base = -1,
990 .sun4c_counter_base = -1,
991 .vram_size = 0x00100000,
992 .nvram_size = 0x2000,
993 .esp_irq = 18,
994 .le_irq = 16,
995 .clock_irq = 7,
996 .clock1_irq = 19,
997 .ms_kb_irq = 14,
998 .ser_irq = 15,
999 .fd_irq = 22,
1000 .me_irq = 30,
1001 .cs_irq = -1,
1002 .machine_id = 0x80,
1003 .iommu_version = 0x04000000,
1004 .intbit_to_level = {
1005 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12,
1006 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0,
1007 },
1008 .max_mem = 0x10000000,
1009 .default_cpu_model = "TI MicroSparc I",
1010 },
1011 /* SS-4 */
1012 {
1013 .iommu_base = 0x10000000,
1014 .tcx_base = 0x50000000,
1015 .cs_base = 0x6c000000,
1016 .slavio_base = 0x70000000,
1017 .ms_kb_base = 0x71000000,
1018 .serial_base = 0x71100000,
1019 .nvram_base = 0x71200000,
1020 .fd_base = 0x71400000,
1021 .counter_base = 0x71d00000,
1022 .intctl_base = 0x71e00000,
1023 .idreg_base = 0x78000000,
1024 .dma_base = 0x78400000,
1025 .esp_base = 0x78800000,
1026 .le_base = 0x78c00000,
1027 .apc_base = 0x6a000000,
1028 .aux1_base = 0x71900000,
1029 .aux2_base = 0x71910000,
1030 .ecc_base = -1,
1031 .sun4c_intctl_base = -1,
1032 .sun4c_counter_base = -1,
1033 .vram_size = 0x00100000,
1034 .nvram_size = 0x2000,
1035 .esp_irq = 18,
1036 .le_irq = 16,
1037 .clock_irq = 7,
1038 .clock1_irq = 19,
1039 .ms_kb_irq = 14,
1040 .ser_irq = 15,
1041 .fd_irq = 22,
1042 .me_irq = 30,
1043 .cs_irq = 5,
1044 .machine_id = 0x80,
1045 .iommu_version = 0x05000000,
1046 .intbit_to_level = {
1047 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12,
1048 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0,
1049 },
1050 .max_mem = 0x10000000,
1051 .default_cpu_model = "Fujitsu MB86904",
1052 },
1053 /* SPARCClassic */
1054 {
1055 .iommu_base = 0x10000000,
1056 .tcx_base = 0x50000000,
1057 .cs_base = -1,
1058 .slavio_base = 0x70000000,
1059 .ms_kb_base = 0x71000000,
1060 .serial_base = 0x71100000,
1061 .nvram_base = 0x71200000,
1062 .fd_base = 0x71400000,
1063 .counter_base = 0x71d00000,
1064 .intctl_base = 0x71e00000,
1065 .idreg_base = 0x78000000,
1066 .dma_base = 0x78400000,
1067 .esp_base = 0x78800000,
1068 .le_base = 0x78c00000,
1069 .apc_base = 0x6a000000,
1070 .aux1_base = 0x71900000,
1071 .aux2_base = 0x71910000,
1072 .ecc_base = -1,
1073 .sun4c_intctl_base = -1,
1074 .sun4c_counter_base = -1,
1075 .vram_size = 0x00100000,
1076 .nvram_size = 0x2000,
1077 .esp_irq = 18,
1078 .le_irq = 16,
1079 .clock_irq = 7,
1080 .clock1_irq = 19,
1081 .ms_kb_irq = 14,
1082 .ser_irq = 15,
1083 .fd_irq = 22,
1084 .me_irq = 30,
1085 .cs_irq = -1,
1086 .machine_id = 0x80,
1087 .iommu_version = 0x05000000,
1088 .intbit_to_level = {
1089 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12,
1090 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0,
1091 },
1092 .max_mem = 0x10000000,
1093 .default_cpu_model = "TI MicroSparc I",
1094 },
1095 /* SPARCbook */
1096 {
1097 .iommu_base = 0x10000000,
1098 .tcx_base = 0x50000000, // XXX
1099 .cs_base = -1,
1100 .slavio_base = 0x70000000,
1101 .ms_kb_base = 0x71000000,
1102 .serial_base = 0x71100000,
1103 .nvram_base = 0x71200000,
1104 .fd_base = 0x71400000,
1105 .counter_base = 0x71d00000,
1106 .intctl_base = 0x71e00000,
1107 .idreg_base = 0x78000000,
1108 .dma_base = 0x78400000,
1109 .esp_base = 0x78800000,
1110 .le_base = 0x78c00000,
1111 .apc_base = 0x6a000000,
1112 .aux1_base = 0x71900000,
1113 .aux2_base = 0x71910000,
1114 .ecc_base = -1,
1115 .sun4c_intctl_base = -1,
1116 .sun4c_counter_base = -1,
1117 .vram_size = 0x00100000,
1118 .nvram_size = 0x2000,
1119 .esp_irq = 18,
1120 .le_irq = 16,
1121 .clock_irq = 7,
1122 .clock1_irq = 19,
1123 .ms_kb_irq = 14,
1124 .ser_irq = 15,
1125 .fd_irq = 22,
1126 .me_irq = 30,
1127 .cs_irq = -1,
1128 .machine_id = 0x80,
1129 .iommu_version = 0x05000000,
1130 .intbit_to_level = {
1131 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12,
1132 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0,
1133 },
1134 .max_mem = 0x10000000,
1135 .default_cpu_model = "TI MicroSparc I",
1136 },
36cd9210
BS
1137};
1138
36cd9210 1139/* SPARCstation 5 hardware initialisation */
00f82b8a 1140static void ss5_init(ram_addr_t RAM_size, int vga_ram_size,
b881c2c6
BS
1141 const char *boot_device, DisplayState *ds,
1142 const char *kernel_filename, const char *kernel_cmdline,
1143 const char *initrd_filename, const char *cpu_model)
36cd9210 1144{
3ebf5aaf
BS
1145 sun4m_hw_init(&hwdefs[0], RAM_size, boot_device, ds, kernel_filename,
1146 kernel_cmdline, initrd_filename, cpu_model);
420557e8 1147}
c0e564d5 1148
e0353fe2 1149/* SPARCstation 10 hardware initialisation */
00f82b8a 1150static void ss10_init(ram_addr_t RAM_size, int vga_ram_size,
b881c2c6
BS
1151 const char *boot_device, DisplayState *ds,
1152 const char *kernel_filename, const char *kernel_cmdline,
1153 const char *initrd_filename, const char *cpu_model)
e0353fe2 1154{
3ebf5aaf
BS
1155 sun4m_hw_init(&hwdefs[1], RAM_size, boot_device, ds, kernel_filename,
1156 kernel_cmdline, initrd_filename, cpu_model);
e0353fe2
BS
1157}
1158
6a3b9cc9 1159/* SPARCserver 600MP hardware initialisation */
00f82b8a 1160static void ss600mp_init(ram_addr_t RAM_size, int vga_ram_size,
b881c2c6 1161 const char *boot_device, DisplayState *ds,
77f193da
BS
1162 const char *kernel_filename,
1163 const char *kernel_cmdline,
6a3b9cc9
BS
1164 const char *initrd_filename, const char *cpu_model)
1165{
3ebf5aaf
BS
1166 sun4m_hw_init(&hwdefs[2], RAM_size, boot_device, ds, kernel_filename,
1167 kernel_cmdline, initrd_filename, cpu_model);
6a3b9cc9
BS
1168}
1169
ae40972f 1170/* SPARCstation 20 hardware initialisation */
00f82b8a 1171static void ss20_init(ram_addr_t RAM_size, int vga_ram_size,
ae40972f
BS
1172 const char *boot_device, DisplayState *ds,
1173 const char *kernel_filename, const char *kernel_cmdline,
1174 const char *initrd_filename, const char *cpu_model)
1175{
1176 sun4m_hw_init(&hwdefs[3], RAM_size, boot_device, ds, kernel_filename,
1177 kernel_cmdline, initrd_filename, cpu_model);
1178}
1179
ee76f82e 1180/* SPARCstation 2 hardware initialisation */
00f82b8a 1181static void ss2_init(ram_addr_t RAM_size, int vga_ram_size,
ee76f82e
BS
1182 const char *boot_device, DisplayState *ds,
1183 const char *kernel_filename, const char *kernel_cmdline,
1184 const char *initrd_filename, const char *cpu_model)
1185{
1186 sun4c_hw_init(&hwdefs[4], RAM_size, boot_device, ds, kernel_filename,
1187 kernel_cmdline, initrd_filename, cpu_model);
1188}
1189
a526a31c 1190/* SPARCstation Voyager hardware initialisation */
6ef05b95 1191static void vger_init(ram_addr_t RAM_size, int vga_ram_size,
a526a31c
BS
1192 const char *boot_device, DisplayState *ds,
1193 const char *kernel_filename, const char *kernel_cmdline,
1194 const char *initrd_filename, const char *cpu_model)
1195{
1196 sun4m_hw_init(&hwdefs[5], RAM_size, boot_device, ds, kernel_filename,
1197 kernel_cmdline, initrd_filename, cpu_model);
1198}
1199
1200/* SPARCstation LX hardware initialisation */
6ef05b95 1201static void ss_lx_init(ram_addr_t RAM_size, int vga_ram_size,
a526a31c
BS
1202 const char *boot_device, DisplayState *ds,
1203 const char *kernel_filename, const char *kernel_cmdline,
1204 const char *initrd_filename, const char *cpu_model)
1205{
1206 sun4m_hw_init(&hwdefs[6], RAM_size, boot_device, ds, kernel_filename,
1207 kernel_cmdline, initrd_filename, cpu_model);
1208}
1209
1210/* SPARCstation 4 hardware initialisation */
6ef05b95 1211static void ss4_init(ram_addr_t RAM_size, int vga_ram_size,
a526a31c
BS
1212 const char *boot_device, DisplayState *ds,
1213 const char *kernel_filename, const char *kernel_cmdline,
1214 const char *initrd_filename, const char *cpu_model)
1215{
1216 sun4m_hw_init(&hwdefs[7], RAM_size, boot_device, ds, kernel_filename,
1217 kernel_cmdline, initrd_filename, cpu_model);
1218}
1219
1220/* SPARCClassic hardware initialisation */
6ef05b95 1221static void scls_init(ram_addr_t RAM_size, int vga_ram_size,
a526a31c
BS
1222 const char *boot_device, DisplayState *ds,
1223 const char *kernel_filename, const char *kernel_cmdline,
1224 const char *initrd_filename, const char *cpu_model)
1225{
1226 sun4m_hw_init(&hwdefs[8], RAM_size, boot_device, ds, kernel_filename,
1227 kernel_cmdline, initrd_filename, cpu_model);
1228}
1229
1230/* SPARCbook hardware initialisation */
6ef05b95 1231static void sbook_init(ram_addr_t RAM_size, int vga_ram_size,
a526a31c
BS
1232 const char *boot_device, DisplayState *ds,
1233 const char *kernel_filename, const char *kernel_cmdline,
1234 const char *initrd_filename, const char *cpu_model)
1235{
1236 sun4m_hw_init(&hwdefs[9], RAM_size, boot_device, ds, kernel_filename,
1237 kernel_cmdline, initrd_filename, cpu_model);
1238}
1239
36cd9210 1240QEMUMachine ss5_machine = {
66de733b
BS
1241 .name = "SS-5",
1242 .desc = "Sun4m platform, SPARCstation 5",
1243 .init = ss5_init,
1244 .ram_require = PROM_SIZE_MAX + TCX_SIZE,
c0e564d5 1245};
e0353fe2
BS
1246
1247QEMUMachine ss10_machine = {
66de733b
BS
1248 .name = "SS-10",
1249 .desc = "Sun4m platform, SPARCstation 10",
1250 .init = ss10_init,
1251 .ram_require = PROM_SIZE_MAX + TCX_SIZE,
e0353fe2 1252};
6a3b9cc9
BS
1253
1254QEMUMachine ss600mp_machine = {
66de733b
BS
1255 .name = "SS-600MP",
1256 .desc = "Sun4m platform, SPARCserver 600MP",
1257 .init = ss600mp_init,
1258 .ram_require = PROM_SIZE_MAX + TCX_SIZE,
6a3b9cc9 1259};
ae40972f
BS
1260
1261QEMUMachine ss20_machine = {
66de733b
BS
1262 .name = "SS-20",
1263 .desc = "Sun4m platform, SPARCstation 20",
1264 .init = ss20_init,
1265 .ram_require = PROM_SIZE_MAX + TCX_SIZE,
ae40972f
BS
1266};
1267
ee76f82e 1268QEMUMachine ss2_machine = {
66de733b
BS
1269 .name = "SS-2",
1270 .desc = "Sun4c platform, SPARCstation 2",
1271 .init = ss2_init,
1272 .ram_require = PROM_SIZE_MAX + TCX_SIZE,
ee76f82e 1273};
7d85892b 1274
a526a31c 1275QEMUMachine voyager_machine = {
66de733b
BS
1276 .name = "Voyager",
1277 .desc = "Sun4m platform, SPARCstation Voyager",
1278 .init = vger_init,
1279 .ram_require = PROM_SIZE_MAX + TCX_SIZE,
a526a31c
BS
1280};
1281
1282QEMUMachine ss_lx_machine = {
66de733b
BS
1283 .name = "LX",
1284 .desc = "Sun4m platform, SPARCstation LX",
1285 .init = ss_lx_init,
1286 .ram_require = PROM_SIZE_MAX + TCX_SIZE,
a526a31c
BS
1287};
1288
1289QEMUMachine ss4_machine = {
66de733b
BS
1290 .name = "SS-4",
1291 .desc = "Sun4m platform, SPARCstation 4",
1292 .init = ss4_init,
1293 .ram_require = PROM_SIZE_MAX + TCX_SIZE,
a526a31c
BS
1294};
1295
1296QEMUMachine scls_machine = {
66de733b
BS
1297 .name = "SPARCClassic",
1298 .desc = "Sun4m platform, SPARCClassic",
1299 .init = scls_init,
1300 .ram_require = PROM_SIZE_MAX + TCX_SIZE,
a526a31c
BS
1301};
1302
1303QEMUMachine sbook_machine = {
66de733b
BS
1304 .name = "SPARCbook",
1305 .desc = "Sun4m platform, SPARCbook",
1306 .init = sbook_init,
1307 .ram_require = PROM_SIZE_MAX + TCX_SIZE,
a526a31c
BS
1308};
1309
7d85892b
BS
1310static const struct sun4d_hwdef sun4d_hwdefs[] = {
1311 /* SS-1000 */
1312 {
1313 .iounit_bases = {
1314 0xfe0200000ULL,
1315 0xfe1200000ULL,
1316 0xfe2200000ULL,
1317 0xfe3200000ULL,
1318 -1,
1319 },
1320 .tcx_base = 0x820000000ULL,
1321 .slavio_base = 0xf00000000ULL,
1322 .ms_kb_base = 0xf00240000ULL,
1323 .serial_base = 0xf00200000ULL,
1324 .nvram_base = 0xf00280000ULL,
1325 .counter_base = 0xf00300000ULL,
1326 .espdma_base = 0x800081000ULL,
1327 .esp_base = 0x800080000ULL,
1328 .ledma_base = 0x800040000ULL,
1329 .le_base = 0x800060000ULL,
1330 .sbi_base = 0xf02800000ULL,
c1d00dc0 1331 .vram_size = 0x00100000,
7d85892b
BS
1332 .nvram_size = 0x2000,
1333 .esp_irq = 3,
1334 .le_irq = 4,
1335 .clock_irq = 14,
1336 .clock1_irq = 10,
1337 .ms_kb_irq = 12,
1338 .ser_irq = 12,
1339 .machine_id = 0x80,
1340 .iounit_version = 0x03000000,
6ef05b95 1341 .max_mem = 0xf00000000ULL,
7d85892b
BS
1342 .default_cpu_model = "TI SuperSparc II",
1343 },
1344 /* SS-2000 */
1345 {
1346 .iounit_bases = {
1347 0xfe0200000ULL,
1348 0xfe1200000ULL,
1349 0xfe2200000ULL,
1350 0xfe3200000ULL,
1351 0xfe4200000ULL,
1352 },
1353 .tcx_base = 0x820000000ULL,
1354 .slavio_base = 0xf00000000ULL,
1355 .ms_kb_base = 0xf00240000ULL,
1356 .serial_base = 0xf00200000ULL,
1357 .nvram_base = 0xf00280000ULL,
1358 .counter_base = 0xf00300000ULL,
1359 .espdma_base = 0x800081000ULL,
1360 .esp_base = 0x800080000ULL,
1361 .ledma_base = 0x800040000ULL,
1362 .le_base = 0x800060000ULL,
1363 .sbi_base = 0xf02800000ULL,
c1d00dc0 1364 .vram_size = 0x00100000,
7d85892b
BS
1365 .nvram_size = 0x2000,
1366 .esp_irq = 3,
1367 .le_irq = 4,
1368 .clock_irq = 14,
1369 .clock1_irq = 10,
1370 .ms_kb_irq = 12,
1371 .ser_irq = 12,
1372 .machine_id = 0x80,
1373 .iounit_version = 0x03000000,
6ef05b95 1374 .max_mem = 0xf00000000ULL,
7d85892b
BS
1375 .default_cpu_model = "TI SuperSparc II",
1376 },
1377};
1378
6ef05b95 1379static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size,
7d85892b
BS
1380 const char *boot_device,
1381 DisplayState *ds, const char *kernel_filename,
1382 const char *kernel_cmdline,
1383 const char *initrd_filename, const char *cpu_model)
1384{
1385 CPUState *env, *envs[MAX_CPUS];
1386 unsigned int i;
1387 void *iounits[MAX_IOUNITS], *espdma, *ledma, *main_esp, *nvram, *sbi;
1388 qemu_irq *cpu_irqs[MAX_CPUS], *sbi_irq, *sbi_cpu_irq,
1389 *espdma_irq, *ledma_irq;
1390 qemu_irq *esp_reset, *le_reset;
1391 unsigned long prom_offset, kernel_size;
1392 int ret;
1393 char buf[1024];
22548760 1394 int drive_index;
7d85892b
BS
1395
1396 /* init CPUs */
1397 if (!cpu_model)
1398 cpu_model = hwdef->default_cpu_model;
1399
1400 for (i = 0; i < smp_cpus; i++) {
1401 env = cpu_init(cpu_model);
1402 if (!env) {
8e82c6a8 1403 fprintf(stderr, "qemu: Unable to find Sparc CPU definition\n");
7d85892b
BS
1404 exit(1);
1405 }
1406 cpu_sparc_set_id(env, i);
1407 envs[i] = env;
1408 if (i == 0) {
1409 qemu_register_reset(main_cpu_reset, env);
1410 } else {
1411 qemu_register_reset(secondary_cpu_reset, env);
1412 env->halted = 1;
1413 }
7d85892b
BS
1414 cpu_irqs[i] = qemu_allocate_irqs(cpu_set_irq, envs[i], MAX_PILS);
1415 env->prom_addr = hwdef->slavio_base;
1416 }
1417
1418 for (i = smp_cpus; i < MAX_CPUS; i++)
1419 cpu_irqs[i] = qemu_allocate_irqs(dummy_cpu_set_irq, NULL, MAX_PILS);
1420
1421 /* allocate RAM */
1422 if ((uint64_t)RAM_size > hwdef->max_mem) {
77f193da
BS
1423 fprintf(stderr,
1424 "qemu: Too much memory for this machine: %d, maximum %d\n",
6ef05b95 1425 (unsigned int)(RAM_size / (1024 * 1024)),
7d85892b
BS
1426 (unsigned int)(hwdef->max_mem / (1024 * 1024)));
1427 exit(1);
1428 }
1429 cpu_register_physical_memory(0, RAM_size, 0);
1430
1431 /* load boot prom */
1432 prom_offset = RAM_size + hwdef->vram_size;
1433 cpu_register_physical_memory(hwdef->slavio_base,
1434 (PROM_SIZE_MAX + TARGET_PAGE_SIZE - 1) &
1435 TARGET_PAGE_MASK,
1436 prom_offset | IO_MEM_ROM);
1437
1438 if (bios_name == NULL)
1439 bios_name = PROM_FILENAME;
1440 snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
1441 ret = load_elf(buf, hwdef->slavio_base - PROM_VADDR, NULL, NULL, NULL);
1442 if (ret < 0 || ret > PROM_SIZE_MAX)
e01f4a1c 1443 ret = load_image_targphys(buf, hwdef->slavio_base, PROM_SIZE_MAX);
7d85892b
BS
1444 if (ret < 0 || ret > PROM_SIZE_MAX) {
1445 fprintf(stderr, "qemu: could not load prom '%s'\n",
1446 buf);
1447 exit(1);
1448 }
1449
1450 /* set up devices */
1451 sbi = sbi_init(hwdef->sbi_base, &sbi_irq, &sbi_cpu_irq, cpu_irqs);
1452
1453 for (i = 0; i < MAX_IOUNITS; i++)
1454 if (hwdef->iounit_bases[i] != (target_phys_addr_t)-1)
ff403da6
BS
1455 iounits[i] = iommu_init(hwdef->iounit_bases[i],
1456 hwdef->iounit_version,
1457 sbi_irq[hwdef->me_irq]);
7d85892b
BS
1458
1459 espdma = sparc32_dma_init(hwdef->espdma_base, sbi_irq[hwdef->esp_irq],
1460 iounits[0], &espdma_irq, &esp_reset);
1461
1462 ledma = sparc32_dma_init(hwdef->ledma_base, sbi_irq[hwdef->le_irq],
1463 iounits[0], &ledma_irq, &le_reset);
1464
1465 if (graphic_depth != 8 && graphic_depth != 24) {
1466 fprintf(stderr, "qemu: Unsupported depth: %d\n", graphic_depth);
1467 exit (1);
1468 }
1469 tcx_init(ds, hwdef->tcx_base, phys_ram_base + RAM_size, RAM_size,
1470 hwdef->vram_size, graphic_width, graphic_height, graphic_depth);
1471
1472 if (nd_table[0].model == NULL
1473 || strcmp(nd_table[0].model, "lance") == 0) {
1474 lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset);
1475 } else if (strcmp(nd_table[0].model, "?") == 0) {
1476 fprintf(stderr, "qemu: Supported NICs: lance\n");
1477 exit (1);
1478 } else {
1479 fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model);
1480 exit (1);
1481 }
1482
1483 nvram = m48t59_init(sbi_irq[0], hwdef->nvram_base, 0,
1484 hwdef->nvram_size, 8);
1485
1486 slavio_timer_init_all(hwdef->counter_base, sbi_irq[hwdef->clock1_irq],
1487 sbi_cpu_irq, smp_cpus);
1488
1489 slavio_serial_ms_kbd_init(hwdef->ms_kb_base, sbi_irq[hwdef->ms_kb_irq],
1490 nographic);
1491 // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device
1492 // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device
1493 slavio_serial_init(hwdef->serial_base, sbi_irq[hwdef->ser_irq],
1494 serial_hds[1], serial_hds[0]);
1495
1496 if (drive_get_max_bus(IF_SCSI) > 0) {
1497 fprintf(stderr, "qemu: too many SCSI bus\n");
1498 exit(1);
1499 }
1500
5d20fa6b 1501 main_esp = esp_init(hwdef->esp_base, 2,
8b17de88
BS
1502 espdma_memory_read, espdma_memory_write,
1503 espdma, *espdma_irq, esp_reset);
7d85892b
BS
1504
1505 for (i = 0; i < ESP_MAX_DEVS; i++) {
22548760
BS
1506 drive_index = drive_get_index(IF_SCSI, 0, i);
1507 if (drive_index == -1)
7d85892b 1508 continue;
22548760 1509 esp_scsi_attach(main_esp, drives_table[drive_index].bdrv, i);
7d85892b
BS
1510 }
1511
293f78bc
BS
1512 kernel_size = sun4m_load_kernel(kernel_filename, initrd_filename,
1513 RAM_size);
7d85892b
BS
1514
1515 nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline,
1516 boot_device, RAM_size, kernel_size, graphic_width,
1517 graphic_height, graphic_depth, hwdef->machine_id, "Sun4d");
1518}
1519
1520/* SPARCserver 1000 hardware initialisation */
00f82b8a 1521static void ss1000_init(ram_addr_t RAM_size, int vga_ram_size,
7d85892b
BS
1522 const char *boot_device, DisplayState *ds,
1523 const char *kernel_filename, const char *kernel_cmdline,
1524 const char *initrd_filename, const char *cpu_model)
1525{
1526 sun4d_hw_init(&sun4d_hwdefs[0], RAM_size, boot_device, ds, kernel_filename,
1527 kernel_cmdline, initrd_filename, cpu_model);
1528}
1529
1530/* SPARCcenter 2000 hardware initialisation */
00f82b8a 1531static void ss2000_init(ram_addr_t RAM_size, int vga_ram_size,
7d85892b
BS
1532 const char *boot_device, DisplayState *ds,
1533 const char *kernel_filename, const char *kernel_cmdline,
1534 const char *initrd_filename, const char *cpu_model)
1535{
1536 sun4d_hw_init(&sun4d_hwdefs[1], RAM_size, boot_device, ds, kernel_filename,
1537 kernel_cmdline, initrd_filename, cpu_model);
1538}
1539
1540QEMUMachine ss1000_machine = {
66de733b
BS
1541 .name = "SS-1000",
1542 .desc = "Sun4d platform, SPARCserver 1000",
1543 .init = ss1000_init,
1544 .ram_require = PROM_SIZE_MAX + TCX_SIZE,
7d85892b
BS
1545};
1546
1547QEMUMachine ss2000_machine = {
66de733b
BS
1548 .name = "SS-2000",
1549 .desc = "Sun4d platform, SPARCcenter 2000",
1550 .init = ss2000_init,
1551 .ram_require = PROM_SIZE_MAX + TCX_SIZE,
7d85892b 1552};