]> Git Repo - qemu.git/blame - hw/sun4m.c
Drop unused parameters
[qemu.git] / hw / sun4m.c
CommitLineData
420557e8
FB
1/*
2 * QEMU Sun4m System Emulator
3 *
b81b3b10 4 * Copyright (c) 2003-2005 Fabrice Bellard
420557e8
FB
5 *
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 */
24#include "vl.h"
b3a23197 25//#define DEBUG_IRQ
420557e8 26
36cd9210
BS
27/*
28 * Sun4m architecture was used in the following machines:
29 *
30 * SPARCserver 6xxMP/xx
31 * SPARCclassic (SPARCclassic Server)(SPARCstation LC) (4/15), SPARCclassic X (4/10)
32 * SPARCstation LX/ZX (4/30)
33 * SPARCstation Voyager
34 * SPARCstation 10/xx, SPARCserver 10/xx
35 * SPARCstation 5, SPARCserver 5
36 * SPARCstation 20/xx, SPARCserver 20
37 * SPARCstation 4
38 *
39 * See for example: http://www.sunhelp.org/faq/sunref1.html
40 */
41
b3a23197
BS
42#ifdef DEBUG_IRQ
43#define DPRINTF(fmt, args...) \
44 do { printf("CPUIRQ: " fmt , ##args); } while (0)
45#else
46#define DPRINTF(fmt, args...)
47#endif
48
420557e8 49#define KERNEL_LOAD_ADDR 0x00004000
b6f479d3 50#define CMDLINE_ADDR 0x007ff000
713c45fa 51#define INITRD_LOAD_ADDR 0x00800000
b3783731 52#define PROM_SIZE_MAX (256 * 1024)
e80cfcfc 53#define PROM_ADDR 0xffd00000
0986ac3b 54#define PROM_FILENAME "openbios-sparc32"
b8174937 55
ba3c64fb 56#define MAX_CPUS 16
b3a23197 57#define MAX_PILS 16
420557e8 58
36cd9210 59struct hwdef {
5dcb6b91
BS
60 target_phys_addr_t iommu_base, slavio_base;
61 target_phys_addr_t intctl_base, counter_base, nvram_base, ms_kb_base;
62 target_phys_addr_t serial_base, fd_base;
63 target_phys_addr_t dma_base, esp_base, le_base;
64 target_phys_addr_t tcx_base, cs_base, power_base;
36cd9210
BS
65 long vram_size, nvram_size;
66 // IRQ numbers are not PIL ones, but master interrupt controller register
67 // bit numbers
d7edfd27 68 int intctl_g_intr, esp_irq, le_irq, clock_irq, clock1_irq;
36cd9210
BS
69 int ser_irq, ms_kb_irq, fd_irq, me_irq, cs_irq;
70 int machine_id; // For NVRAM
e0353fe2 71 uint32_t intbit_to_level[32];
36cd9210
BS
72};
73
420557e8
FB
74/* TSC handling */
75
76uint64_t cpu_get_tsc()
77{
78 return qemu_get_clock(vm_clock);
79}
80
6f7e9aec
FB
81int DMA_get_channel_mode (int nchan)
82{
83 return 0;
84}
85int DMA_read_memory (int nchan, void *buf, int pos, int size)
86{
87 return 0;
88}
89int DMA_write_memory (int nchan, void *buf, int pos, int size)
90{
91 return 0;
92}
93void DMA_hold_DREQ (int nchan) {}
94void DMA_release_DREQ (int nchan) {}
95void DMA_schedule(int nchan) {}
96void DMA_run (void) {}
97void DMA_init (int high_page_enable) {}
98void DMA_register_channel (int nchan,
99 DMA_transfer_handler transfer_handler,
100 void *opaque)
101{
102}
103
819385c5 104static void nvram_set_word (m48t59_t *nvram, uint32_t addr, uint16_t value)
6f7e9aec 105{
819385c5
FB
106 m48t59_write(nvram, addr++, (value >> 8) & 0xff);
107 m48t59_write(nvram, addr++, value & 0xff);
6f7e9aec
FB
108}
109
819385c5 110static void nvram_set_lword (m48t59_t *nvram, uint32_t addr, uint32_t value)
6f7e9aec 111{
819385c5
FB
112 m48t59_write(nvram, addr++, value >> 24);
113 m48t59_write(nvram, addr++, (value >> 16) & 0xff);
114 m48t59_write(nvram, addr++, (value >> 8) & 0xff);
115 m48t59_write(nvram, addr++, value & 0xff);
6f7e9aec
FB
116}
117
819385c5 118static void nvram_set_string (m48t59_t *nvram, uint32_t addr,
6f7e9aec
FB
119 const unsigned char *str, uint32_t max)
120{
121 unsigned int i;
122
123 for (i = 0; i < max && str[i] != '\0'; i++) {
819385c5 124 m48t59_write(nvram, addr + i, str[i]);
6f7e9aec 125 }
819385c5 126 m48t59_write(nvram, addr + max - 1, '\0');
6f7e9aec 127}
420557e8 128
66508601
BS
129static uint32_t nvram_set_var (m48t59_t *nvram, uint32_t addr,
130 const unsigned char *str)
131{
132 uint32_t len;
133
134 len = strlen(str) + 1;
135 nvram_set_string(nvram, addr, str, len);
136
137 return addr + len;
138}
139
140static void nvram_finish_partition (m48t59_t *nvram, uint32_t start,
141 uint32_t end)
142{
143 unsigned int i, sum;
144
145 // Length divided by 16
146 m48t59_write(nvram, start + 2, ((end - start) >> 12) & 0xff);
147 m48t59_write(nvram, start + 3, ((end - start) >> 4) & 0xff);
148 // Checksum
149 sum = m48t59_read(nvram, start);
150 for (i = 0; i < 14; i++) {
151 sum += m48t59_read(nvram, start + 2 + i);
152 sum = (sum + ((sum & 0xff00) >> 8)) & 0xff;
153 }
154 m48t59_write(nvram, start + 1, sum & 0xff);
155}
156
819385c5 157static m48t59_t *nvram;
420557e8 158
6f7e9aec
FB
159extern int nographic;
160
819385c5 161static void nvram_init(m48t59_t *nvram, uint8_t *macaddr, const char *cmdline,
6f7e9aec
FB
162 int boot_device, uint32_t RAM_size,
163 uint32_t kernel_size,
36cd9210
BS
164 int width, int height, int depth,
165 int machine_id)
e80cfcfc
FB
166{
167 unsigned char tmp = 0;
66508601
BS
168 unsigned int i, j;
169 uint32_t start, end;
e80cfcfc 170
6f7e9aec
FB
171 // Try to match PPC NVRAM
172 nvram_set_string(nvram, 0x00, "QEMU_BIOS", 16);
173 nvram_set_lword(nvram, 0x10, 0x00000001); /* structure v1 */
174 // NVRAM_size, arch not applicable
ba3c64fb
FB
175 m48t59_write(nvram, 0x2D, smp_cpus & 0xff);
176 m48t59_write(nvram, 0x2E, 0);
819385c5 177 m48t59_write(nvram, 0x2F, nographic & 0xff);
6f7e9aec 178 nvram_set_lword(nvram, 0x30, RAM_size);
819385c5 179 m48t59_write(nvram, 0x34, boot_device & 0xff);
6f7e9aec
FB
180 nvram_set_lword(nvram, 0x38, KERNEL_LOAD_ADDR);
181 nvram_set_lword(nvram, 0x3C, kernel_size);
b6f479d3 182 if (cmdline) {
b6f479d3 183 strcpy(phys_ram_base + CMDLINE_ADDR, cmdline);
6f7e9aec
FB
184 nvram_set_lword(nvram, 0x40, CMDLINE_ADDR);
185 nvram_set_lword(nvram, 0x44, strlen(cmdline));
b6f479d3 186 }
6f7e9aec
FB
187 // initrd_image, initrd_size passed differently
188 nvram_set_word(nvram, 0x54, width);
189 nvram_set_word(nvram, 0x56, height);
190 nvram_set_word(nvram, 0x58, depth);
b6f479d3 191
66508601
BS
192 // OpenBIOS nvram variables
193 // Variable partition
194 start = 252;
195 m48t59_write(nvram, start, 0x70);
196 nvram_set_string(nvram, start + 4, "system", 12);
197
198 end = start + 16;
199 for (i = 0; i < nb_prom_envs; i++)
200 end = nvram_set_var(nvram, end, prom_envs[i]);
201
202 m48t59_write(nvram, end++ , 0);
203 end = start + ((end - start + 15) & ~15);
204 nvram_finish_partition(nvram, start, end);
205
206 // free partition
207 start = end;
208 m48t59_write(nvram, start, 0x7f);
209 nvram_set_string(nvram, start + 4, "free", 12);
210
211 end = 0x1fd0;
212 nvram_finish_partition(nvram, start, end);
213
6f7e9aec 214 // Sun4m specific use
66508601 215 start = i = 0x1fd8;
819385c5 216 m48t59_write(nvram, i++, 0x01);
36cd9210 217 m48t59_write(nvram, i++, machine_id);
e80cfcfc 218 j = 0;
819385c5
FB
219 m48t59_write(nvram, i++, macaddr[j++]);
220 m48t59_write(nvram, i++, macaddr[j++]);
221 m48t59_write(nvram, i++, macaddr[j++]);
222 m48t59_write(nvram, i++, macaddr[j++]);
223 m48t59_write(nvram, i++, macaddr[j++]);
224 m48t59_write(nvram, i, macaddr[j]);
e80cfcfc
FB
225
226 /* Calculate checksum */
66508601
BS
227 for (i = start; i < start + 15; i++) {
228 tmp ^= m48t59_read(nvram, i);
e80cfcfc 229 }
66508601 230 m48t59_write(nvram, start + 15, tmp);
e80cfcfc
FB
231}
232
233static void *slavio_intctl;
234
235void pic_info()
236{
237 slavio_pic_info(slavio_intctl);
238}
239
240void irq_info()
241{
242 slavio_irq_info(slavio_intctl);
243}
244
b3a23197
BS
245static void cpu_set_irq(void *opaque, int irq, int level)
246{
247 CPUState *env = opaque;
248
249 if (level) {
250 DPRINTF("Raise CPU IRQ %d\n", irq);
251
252 env->halted = 0;
253
254 if (env->interrupt_index == 0 ||
255 ((env->interrupt_index & ~15) == TT_EXTINT &&
256 (env->interrupt_index & 15) < irq)) {
257 env->interrupt_index = TT_EXTINT | irq;
258 cpu_interrupt(env, CPU_INTERRUPT_HARD);
259 } else {
260 DPRINTF("Not triggered, pending exception %d\n",
261 env->interrupt_index);
262 }
263 } else {
264 DPRINTF("Lower CPU IRQ %d\n", irq);
265 }
266}
267
268static void dummy_cpu_set_irq(void *opaque, int irq, int level)
269{
270}
271
3475187d
FB
272static void *slavio_misc;
273
274void qemu_system_powerdown(void)
275{
276 slavio_set_power_fail(slavio_misc, 1);
277}
278
c68ea704
FB
279static void main_cpu_reset(void *opaque)
280{
281 CPUState *env = opaque;
3d29fbef
BS
282
283 cpu_reset(env);
284 env->halted = 0;
285}
286
287static void secondary_cpu_reset(void *opaque)
288{
289 CPUState *env = opaque;
290
c68ea704 291 cpu_reset(env);
3d29fbef 292 env->halted = 1;
c68ea704
FB
293}
294
36cd9210
BS
295static void sun4m_hw_init(const struct hwdef *hwdef, int ram_size,
296 DisplayState *ds, const char *cpu_model)
297
420557e8 298{
ba3c64fb 299 CPUState *env, *envs[MAX_CPUS];
713c45fa 300 unsigned int i;
70c0de96 301 void *iommu, *espdma, *ledma, *main_esp;
62724a37 302 const sparc_def_t *def;
b3a23197 303 qemu_irq *cpu_irqs[MAX_CPUS], *slavio_irq, *slavio_cpu_irq,
d7edfd27 304 *espdma_irq, *ledma_irq;
420557e8 305
ba3c64fb 306 /* init CPUs */
62724a37
BS
307 sparc_find_by_name(cpu_model, &def);
308 if (def == NULL) {
309 fprintf(stderr, "Unable to find Sparc CPU definition\n");
310 exit(1);
311 }
b3a23197 312
ba3c64fb
FB
313 for(i = 0; i < smp_cpus; i++) {
314 env = cpu_init();
62724a37 315 cpu_sparc_register(env, def);
ba3c64fb 316 envs[i] = env;
3d29fbef
BS
317 if (i == 0) {
318 qemu_register_reset(main_cpu_reset, env);
319 } else {
320 qemu_register_reset(secondary_cpu_reset, env);
ba3c64fb 321 env->halted = 1;
3d29fbef 322 }
ba3c64fb 323 register_savevm("cpu", i, 3, cpu_save, cpu_load, env);
b3a23197 324 cpu_irqs[i] = qemu_allocate_irqs(cpu_set_irq, envs[i], MAX_PILS);
ba3c64fb 325 }
b3a23197
BS
326
327 for (i = smp_cpus; i < MAX_CPUS; i++)
328 cpu_irqs[i] = qemu_allocate_irqs(dummy_cpu_set_irq, NULL, MAX_PILS);
329
420557e8
FB
330 /* allocate RAM */
331 cpu_register_physical_memory(0, ram_size, 0);
420557e8 332
36cd9210
BS
333 iommu = iommu_init(hwdef->iommu_base);
334 slavio_intctl = slavio_intctl_init(hwdef->intctl_base,
5dcb6b91 335 hwdef->intctl_base + 0x10000ULL,
d537cf6c 336 &hwdef->intbit_to_level[0],
d7edfd27 337 &slavio_irq, &slavio_cpu_irq,
b3a23197 338 cpu_irqs,
d7edfd27 339 hwdef->clock_irq);
b3a23197 340
5aca8c3b 341 espdma = sparc32_dma_init(hwdef->dma_base, slavio_irq[hwdef->esp_irq],
70c0de96 342 iommu, &espdma_irq);
5aca8c3b 343 ledma = sparc32_dma_init(hwdef->dma_base + 16ULL,
70c0de96 344 slavio_irq[hwdef->le_irq], iommu, &ledma_irq);
ba3c64fb 345
eee0b836
BS
346 if (graphic_depth != 8 && graphic_depth != 24) {
347 fprintf(stderr, "qemu: Unsupported depth: %d\n", graphic_depth);
348 exit (1);
349 }
36cd9210 350 tcx_init(ds, hwdef->tcx_base, phys_ram_base + ram_size, ram_size,
eee0b836 351 hwdef->vram_size, graphic_width, graphic_height, graphic_depth);
dbe06e18
BS
352
353 if (nd_table[0].model == NULL
354 || strcmp(nd_table[0].model, "lance") == 0) {
355 lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq);
c4a7060c
BS
356 } else if (strcmp(nd_table[0].model, "?") == 0) {
357 fprintf(stderr, "qemu: Supported NICs: lance\n");
358 exit (1);
dbe06e18
BS
359 } else {
360 fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model);
361 exit (1);
a41b2ff2 362 }
dbe06e18 363
d537cf6c
PB
364 nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0,
365 hwdef->nvram_size, 8);
ba3c64fb 366 for (i = 0; i < MAX_CPUS; i++) {
5dcb6b91
BS
367 slavio_timer_init(hwdef->counter_base +
368 (target_phys_addr_t)(i * TARGET_PAGE_SIZE),
d7edfd27 369 slavio_cpu_irq[i], 0);
ba3c64fb 370 }
d7edfd27
BS
371 slavio_timer_init(hwdef->counter_base + 0x10000ULL,
372 slavio_irq[hwdef->clock1_irq], 2);
d537cf6c 373 slavio_serial_ms_kbd_init(hwdef->ms_kb_base, slavio_irq[hwdef->ms_kb_irq]);
b81b3b10
FB
374 // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device
375 // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device
d537cf6c
PB
376 slavio_serial_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq],
377 serial_hds[1], serial_hds[0]);
378 fdctrl_init(slavio_irq[hwdef->fd_irq], 0, 1, hwdef->fd_base, fd_table);
70c0de96 379 main_esp = esp_init(bs_table, hwdef->esp_base, espdma, *espdma_irq);
f1587550
TS
380
381 for (i = 0; i < MAX_DISKS; i++) {
382 if (bs_table[i]) {
383 esp_scsi_attach(main_esp, bs_table[i], i);
384 }
385 }
386
5dcb6b91 387 slavio_misc = slavio_misc_init(hwdef->slavio_base, hwdef->power_base,
d537cf6c 388 slavio_irq[hwdef->me_irq]);
5dcb6b91 389 if (hwdef->cs_base != (target_phys_addr_t)-1)
803b3c7b 390 cs_init(hwdef->cs_base, hwdef->cs_irq, slavio_intctl);
36cd9210
BS
391}
392
393static void sun4m_load_kernel(long vram_size, int ram_size, int boot_device,
394 const char *kernel_filename,
395 const char *kernel_cmdline,
396 const char *initrd_filename,
397 int machine_id)
398{
399 int ret, linux_boot;
400 char buf[1024];
401 unsigned int i;
402 long prom_offset, initrd_size, kernel_size;
403
404 linux_boot = (kernel_filename != NULL);
420557e8 405
e80cfcfc 406 prom_offset = ram_size + vram_size;
b3783731
FB
407 cpu_register_physical_memory(PROM_ADDR,
408 (PROM_SIZE_MAX + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK,
409 prom_offset | IO_MEM_ROM);
e80cfcfc 410
0986ac3b 411 snprintf(buf, sizeof(buf), "%s/%s", bios_dir, PROM_FILENAME);
74287114 412 ret = load_elf(buf, 0, NULL, NULL, NULL);
e80cfcfc
FB
413 if (ret < 0) {
414 fprintf(stderr, "qemu: could not load prom '%s'\n",
415 buf);
416 exit(1);
417 }
e80cfcfc 418
6f7e9aec 419 kernel_size = 0;
e80cfcfc 420 if (linux_boot) {
74287114 421 kernel_size = load_elf(kernel_filename, -0xf0000000, NULL, NULL, NULL);
6f7e9aec
FB
422 if (kernel_size < 0)
423 kernel_size = load_aout(kernel_filename, phys_ram_base + KERNEL_LOAD_ADDR);
424 if (kernel_size < 0)
425 kernel_size = load_image(kernel_filename, phys_ram_base + KERNEL_LOAD_ADDR);
426 if (kernel_size < 0) {
420557e8 427 fprintf(stderr, "qemu: could not load kernel '%s'\n",
e80cfcfc
FB
428 kernel_filename);
429 exit(1);
420557e8 430 }
713c45fa
FB
431
432 /* load initrd */
433 initrd_size = 0;
434 if (initrd_filename) {
435 initrd_size = load_image(initrd_filename, phys_ram_base + INITRD_LOAD_ADDR);
436 if (initrd_size < 0) {
437 fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
438 initrd_filename);
439 exit(1);
440 }
441 }
442 if (initrd_size > 0) {
443 for (i = 0; i < 64 * TARGET_PAGE_SIZE; i += TARGET_PAGE_SIZE) {
444 if (ldl_raw(phys_ram_base + KERNEL_LOAD_ADDR + i)
445 == 0x48647253) { // HdrS
446 stl_raw(phys_ram_base + KERNEL_LOAD_ADDR + i + 16, INITRD_LOAD_ADDR);
447 stl_raw(phys_ram_base + KERNEL_LOAD_ADDR + i + 20, initrd_size);
448 break;
449 }
450 }
451 }
420557e8 452 }
36cd9210
BS
453 nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline,
454 boot_device, ram_size, kernel_size, graphic_width,
455 graphic_height, graphic_depth, machine_id);
456}
457
458static const struct hwdef hwdefs[] = {
459 /* SS-5 */
460 {
461 .iommu_base = 0x10000000,
462 .tcx_base = 0x50000000,
463 .cs_base = 0x6c000000,
384ccb5d 464 .slavio_base = 0x70000000,
36cd9210
BS
465 .ms_kb_base = 0x71000000,
466 .serial_base = 0x71100000,
467 .nvram_base = 0x71200000,
468 .fd_base = 0x71400000,
469 .counter_base = 0x71d00000,
470 .intctl_base = 0x71e00000,
471 .dma_base = 0x78400000,
472 .esp_base = 0x78800000,
473 .le_base = 0x78c00000,
5dcb6b91 474 .power_base = 0x7a000000,
36cd9210
BS
475 .vram_size = 0x00100000,
476 .nvram_size = 0x2000,
477 .esp_irq = 18,
478 .le_irq = 16,
479 .clock_irq = 7,
480 .clock1_irq = 19,
481 .ms_kb_irq = 14,
482 .ser_irq = 15,
483 .fd_irq = 22,
484 .me_irq = 30,
485 .cs_irq = 5,
486 .machine_id = 0x80,
e0353fe2
BS
487 .intbit_to_level = {
488 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12,
489 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0,
490 },
491 },
492 /* SS-10 */
e0353fe2 493 {
5dcb6b91
BS
494 .iommu_base = 0xfe0000000ULL,
495 .tcx_base = 0xe20000000ULL,
803b3c7b 496 .cs_base = -1,
5dcb6b91
BS
497 .slavio_base = 0xff0000000ULL,
498 .ms_kb_base = 0xff1000000ULL,
499 .serial_base = 0xff1100000ULL,
500 .nvram_base = 0xff1200000ULL,
501 .fd_base = 0xff1700000ULL,
502 .counter_base = 0xff1300000ULL,
503 .intctl_base = 0xff1400000ULL,
504 .dma_base = 0xef0400000ULL,
505 .esp_base = 0xef0800000ULL,
506 .le_base = 0xef0c00000ULL,
507 .power_base = 0xefa000000ULL,
e0353fe2
BS
508 .vram_size = 0x00100000,
509 .nvram_size = 0x2000,
510 .esp_irq = 18,
511 .le_irq = 16,
512 .clock_irq = 7,
513 .clock1_irq = 19,
514 .ms_kb_irq = 14,
515 .ser_irq = 15,
516 .fd_irq = 22,
517 .me_irq = 30,
803b3c7b
BS
518 .cs_irq = -1,
519 .machine_id = 0x72,
e0353fe2
BS
520 .intbit_to_level = {
521 2, 3, 5, 7, 9, 11, 0, 14, 3, 5, 7, 9, 11, 13, 12, 12,
522 6, 0, 4, 10, 8, 0, 11, 0, 0, 0, 0, 0, 15, 0, 15, 0,
523 },
36cd9210
BS
524 },
525};
526
527static void sun4m_common_init(int ram_size, int boot_device, DisplayState *ds,
528 const char *kernel_filename, const char *kernel_cmdline,
529 const char *initrd_filename, const char *cpu_model,
4edebb0e 530 unsigned int machine, int max_ram)
36cd9210 531{
5dcb6b91 532 if ((unsigned int)ram_size > (unsigned int)max_ram) {
4edebb0e 533 fprintf(stderr, "qemu: Too much memory for this machine: %d, maximum %d\n",
5dcb6b91
BS
534 (unsigned int)ram_size / (1024 * 1024),
535 (unsigned int)max_ram / (1024 * 1024));
4edebb0e
BS
536 exit(1);
537 }
36cd9210
BS
538 sun4m_hw_init(&hwdefs[machine], ram_size, ds, cpu_model);
539
540 sun4m_load_kernel(hwdefs[machine].vram_size, ram_size, boot_device,
541 kernel_filename, kernel_cmdline, initrd_filename,
542 hwdefs[machine].machine_id);
543}
544
545/* SPARCstation 5 hardware initialisation */
546static void ss5_init(int ram_size, int vga_ram_size, int boot_device,
547 DisplayState *ds, const char **fd_filename, int snapshot,
548 const char *kernel_filename, const char *kernel_cmdline,
549 const char *initrd_filename, const char *cpu_model)
550{
551 if (cpu_model == NULL)
552 cpu_model = "Fujitsu MB86904";
553 sun4m_common_init(ram_size, boot_device, ds, kernel_filename,
554 kernel_cmdline, initrd_filename, cpu_model,
4edebb0e 555 0, 0x10000000);
420557e8 556}
c0e564d5 557
e0353fe2
BS
558/* SPARCstation 10 hardware initialisation */
559static void ss10_init(int ram_size, int vga_ram_size, int boot_device,
560 DisplayState *ds, const char **fd_filename, int snapshot,
561 const char *kernel_filename, const char *kernel_cmdline,
562 const char *initrd_filename, const char *cpu_model)
563{
564 if (cpu_model == NULL)
565 cpu_model = "TI SuperSparc II";
566 sun4m_common_init(ram_size, boot_device, ds, kernel_filename,
567 kernel_cmdline, initrd_filename, cpu_model,
5dcb6b91 568 1, PROM_ADDR); // XXX prom overlap, actually first 4GB ok
e0353fe2
BS
569}
570
36cd9210
BS
571QEMUMachine ss5_machine = {
572 "SS-5",
573 "Sun4m platform, SPARCstation 5",
574 ss5_init,
c0e564d5 575};
e0353fe2
BS
576
577QEMUMachine ss10_machine = {
578 "SS-10",
579 "Sun4m platform, SPARCstation 10",
580 ss10_init,
581};
This page took 0.205453 seconds and 4 git commands to generate.