]> git.proxmox.com Git - mirror_qemu.git/blame - hw/sparc/sun4m.c
Merge remote-tracking branch 'remotes/kraxel/tags/audio-20180703-pull-request' into...
[mirror_qemu.git] / hw / sparc / 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 */
db5ebe5f 24#include "qemu/osdep.h"
0a2e467b 25#include "qemu/units.h"
da34e65c 26#include "qapi/error.h"
4771d756
PB
27#include "qemu-common.h"
28#include "cpu.h"
83c9f4ca 29#include "hw/sysbus.h"
af87bf29 30#include "qemu/error-report.h"
1de7afc9 31#include "qemu/timer.h"
1527f488 32#include "hw/sparc/sun4m_iommu.h"
0d09e41a
PB
33#include "hw/timer/m48t59.h"
34#include "hw/sparc/sparc32_dma.h"
35#include "hw/block/fdc.h"
9c17d615 36#include "sysemu/sysemu.h"
1422e32d 37#include "net/net.h"
83c9f4ca 38#include "hw/boards.h"
0d09e41a 39#include "hw/scsi/esp.h"
0d09e41a 40#include "hw/isa/isa.h"
c6363bae 41#include "hw/nvram/sun_nvram.h"
2024c014 42#include "hw/nvram/chrp_nvram.h"
0d09e41a
PB
43#include "hw/nvram/fw_cfg.h"
44#include "hw/char/escc.h"
83c9f4ca 45#include "hw/empty_slot.h"
83c9f4ca 46#include "hw/loader.h"
ca20cf32 47#include "elf.h"
97bf4851 48#include "trace.h"
420557e8 49
36cd9210
BS
50/*
51 * Sun4m architecture was used in the following machines:
52 *
53 * SPARCserver 6xxMP/xx
77f193da
BS
54 * SPARCclassic (SPARCclassic Server)(SPARCstation LC) (4/15),
55 * SPARCclassic X (4/10)
36cd9210
BS
56 * SPARCstation LX/ZX (4/30)
57 * SPARCstation Voyager
58 * SPARCstation 10/xx, SPARCserver 10/xx
59 * SPARCstation 5, SPARCserver 5
60 * SPARCstation 20/xx, SPARCserver 20
61 * SPARCstation 4
62 *
63 * See for example: http://www.sunhelp.org/faq/sunref1.html
64 */
65
420557e8 66#define KERNEL_LOAD_ADDR 0x00004000
b6f479d3 67#define CMDLINE_ADDR 0x007ff000
713c45fa 68#define INITRD_LOAD_ADDR 0x00800000
0a2e467b 69#define PROM_SIZE_MAX (1 * MiB)
40ce0a9a 70#define PROM_VADDR 0xffd00000
f930d07e 71#define PROM_FILENAME "openbios-sparc32"
3cce6243 72#define CFG_ADDR 0xd00000510ULL
fbfcf955 73#define FW_CFG_SUN4M_DEPTH (FW_CFG_ARCH_LOCAL + 0x00)
b96919e0
MCA
74#define FW_CFG_SUN4M_WIDTH (FW_CFG_ARCH_LOCAL + 0x01)
75#define FW_CFG_SUN4M_HEIGHT (FW_CFG_ARCH_LOCAL + 0x02)
b8174937 76
ba3c64fb 77#define MAX_CPUS 16
b3a23197 78#define MAX_PILS 16
9a62fb24 79#define MAX_VSIMMS 4
420557e8 80
b4ed08e0
BS
81#define ESCC_CLOCK 4915200
82
8137cde8 83struct sun4m_hwdef {
a8170e5e
AK
84 hwaddr iommu_base, iommu_pad_base, iommu_pad_len, slavio_base;
85 hwaddr intctl_base, counter_base, nvram_base, ms_kb_base;
86 hwaddr serial_base, fd_base;
87 hwaddr afx_base, idreg_base, dma_base, esp_base, le_base;
88 hwaddr tcx_base, cs_base, apc_base, aux1_base, aux2_base;
89 hwaddr bpp_base, dbri_base, sx_base;
9a62fb24 90 struct {
a8170e5e 91 hwaddr reg_base, vram_base;
9a62fb24 92 } vsimm[MAX_VSIMMS];
a8170e5e 93 hwaddr ecc_base;
3ebf5aaf 94 uint64_t max_mem;
61999750
BS
95 uint32_t ecc_version;
96 uint32_t iommu_version;
97 uint16_t machine_id;
98 uint8_t nvram_machine_id;
36cd9210
BS
99};
100
ddcd5531
GA
101static void fw_cfg_boot_set(void *opaque, const char *boot_device,
102 Error **errp)
81864572 103{
48779e50 104 fw_cfg_modify_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
81864572
BS
105}
106
31688246 107static void nvram_init(Nvram *nvram, uint8_t *macaddr,
43a34704
BS
108 const char *cmdline, const char *boot_devices,
109 ram_addr_t RAM_size, uint32_t kernel_size,
f930d07e 110 int width, int height, int depth,
905fdcb5 111 int nvram_machine_id, const char *arch)
e80cfcfc 112{
d2c63fc1 113 unsigned int i;
2024c014 114 int sysp_end;
d2c63fc1 115 uint8_t image[0x1ff0];
31688246 116 NvramClass *k = NVRAM_GET_CLASS(nvram);
d2c63fc1
BS
117
118 memset(image, '\0', sizeof(image));
e80cfcfc 119
2024c014
TH
120 /* OpenBIOS nvram variables partition */
121 sysp_end = chrp_nvram_create_system_partition(image, 0);
b6f479d3 122
2024c014
TH
123 /* Free space partition */
124 chrp_nvram_create_free_partition(&image[sysp_end], 0x1fd0 - sysp_end);
d2c63fc1 125
905fdcb5
BS
126 Sun_init_header((struct Sun_nvram *)&image[0x1fd8], macaddr,
127 nvram_machine_id);
d2c63fc1 128
31688246
HP
129 for (i = 0; i < sizeof(image); i++) {
130 (k->write)(nvram, i, image[i]);
131 }
e80cfcfc
FB
132}
133
98cec4a2 134void cpu_check_irqs(CPUSPARCState *env)
327ac2e7 135{
d8ed887b
AF
136 CPUState *cs;
137
5ee59930
AB
138 /* We should be holding the BQL before we mess with IRQs */
139 g_assert(qemu_mutex_iothread_locked());
140
327ac2e7
BS
141 if (env->pil_in && (env->interrupt_index == 0 ||
142 (env->interrupt_index & ~15) == TT_EXTINT)) {
143 unsigned int i;
144
145 for (i = 15; i > 0; i--) {
146 if (env->pil_in & (1 << i)) {
147 int old_interrupt = env->interrupt_index;
148
149 env->interrupt_index = TT_EXTINT | i;
f32d7ec5 150 if (old_interrupt != env->interrupt_index) {
c3affe56 151 cs = CPU(sparc_env_get_cpu(env));
97bf4851 152 trace_sun4m_cpu_interrupt(i);
c3affe56 153 cpu_interrupt(cs, CPU_INTERRUPT_HARD);
f32d7ec5 154 }
327ac2e7
BS
155 break;
156 }
157 }
158 } else if (!env->pil_in && (env->interrupt_index & ~15) == TT_EXTINT) {
d8ed887b 159 cs = CPU(sparc_env_get_cpu(env));
97bf4851 160 trace_sun4m_cpu_reset_interrupt(env->interrupt_index & 15);
327ac2e7 161 env->interrupt_index = 0;
d8ed887b 162 cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
327ac2e7
BS
163 }
164}
165
38c66cf2 166static void cpu_kick_irq(SPARCCPU *cpu)
94ad5b00 167{
38c66cf2 168 CPUSPARCState *env = &cpu->env;
259186a7 169 CPUState *cs = CPU(cpu);
38c66cf2 170
259186a7 171 cs->halted = 0;
94ad5b00 172 cpu_check_irqs(env);
259186a7 173 qemu_cpu_kick(cs);
94ad5b00
PB
174}
175
b3a23197
BS
176static void cpu_set_irq(void *opaque, int irq, int level)
177{
e0bbf9b5
AF
178 SPARCCPU *cpu = opaque;
179 CPUSPARCState *env = &cpu->env;
b3a23197
BS
180
181 if (level) {
97bf4851 182 trace_sun4m_cpu_set_irq_raise(irq);
327ac2e7 183 env->pil_in |= 1 << irq;
38c66cf2 184 cpu_kick_irq(cpu);
b3a23197 185 } else {
97bf4851 186 trace_sun4m_cpu_set_irq_lower(irq);
327ac2e7
BS
187 env->pil_in &= ~(1 << irq);
188 cpu_check_irqs(env);
b3a23197
BS
189 }
190}
191
192static void dummy_cpu_set_irq(void *opaque, int irq, int level)
193{
194}
195
c68ea704
FB
196static void main_cpu_reset(void *opaque)
197{
5414dec6 198 SPARCCPU *cpu = opaque;
259186a7 199 CPUState *cs = CPU(cpu);
3d29fbef 200
259186a7
AF
201 cpu_reset(cs);
202 cs->halted = 0;
3d29fbef
BS
203}
204
205static void secondary_cpu_reset(void *opaque)
206{
5414dec6 207 SPARCCPU *cpu = opaque;
259186a7 208 CPUState *cs = CPU(cpu);
3d29fbef 209
259186a7
AF
210 cpu_reset(cs);
211 cs->halted = 1;
c68ea704
FB
212}
213
6d0c293d
BS
214static void cpu_halt_signal(void *opaque, int irq, int level)
215{
4917cf44
AF
216 if (level && current_cpu) {
217 cpu_interrupt(current_cpu, CPU_INTERRUPT_HALT);
c3affe56 218 }
6d0c293d
BS
219}
220
409dbce5
AJ
221static uint64_t translate_kernel_address(void *opaque, uint64_t addr)
222{
223 return addr - 0xf0000000ULL;
224}
225
3ebf5aaf 226static unsigned long sun4m_load_kernel(const char *kernel_filename,
293f78bc 227 const char *initrd_filename,
c227f099 228 ram_addr_t RAM_size)
3ebf5aaf
BS
229{
230 int linux_boot;
231 unsigned int i;
232 long initrd_size, kernel_size;
3c178e72 233 uint8_t *ptr;
3ebf5aaf
BS
234
235 linux_boot = (kernel_filename != NULL);
236
237 kernel_size = 0;
238 if (linux_boot) {
ca20cf32
BS
239 int bswap_needed;
240
241#ifdef BSWAP_NEEDED
242 bswap_needed = 1;
243#else
244 bswap_needed = 0;
245#endif
409dbce5 246 kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL,
7ef295ea 247 NULL, NULL, NULL, 1, EM_SPARC, 0, 0);
3ebf5aaf 248 if (kernel_size < 0)
293f78bc 249 kernel_size = load_aout(kernel_filename, KERNEL_LOAD_ADDR,
ca20cf32
BS
250 RAM_size - KERNEL_LOAD_ADDR, bswap_needed,
251 TARGET_PAGE_SIZE);
3ebf5aaf 252 if (kernel_size < 0)
293f78bc
BS
253 kernel_size = load_image_targphys(kernel_filename,
254 KERNEL_LOAD_ADDR,
255 RAM_size - KERNEL_LOAD_ADDR);
3ebf5aaf 256 if (kernel_size < 0) {
29bd7231 257 error_report("could not load kernel '%s'", kernel_filename);
3ebf5aaf
BS
258 exit(1);
259 }
260
261 /* load initrd */
262 initrd_size = 0;
263 if (initrd_filename) {
293f78bc
BS
264 initrd_size = load_image_targphys(initrd_filename,
265 INITRD_LOAD_ADDR,
266 RAM_size - INITRD_LOAD_ADDR);
3ebf5aaf 267 if (initrd_size < 0) {
29bd7231
AF
268 error_report("could not load initial ram disk '%s'",
269 initrd_filename);
3ebf5aaf
BS
270 exit(1);
271 }
272 }
273 if (initrd_size > 0) {
274 for (i = 0; i < 64 * TARGET_PAGE_SIZE; i += TARGET_PAGE_SIZE) {
0f0f8b61
TH
275 ptr = rom_ptr(KERNEL_LOAD_ADDR + i, 24);
276 if (ptr && ldl_p(ptr) == 0x48647253) { /* HdrS */
3c178e72
GH
277 stl_p(ptr + 16, INITRD_LOAD_ADDR);
278 stl_p(ptr + 20, initrd_size);
3ebf5aaf
BS
279 break;
280 }
281 }
282 }
283 }
284 return kernel_size;
285}
286
a8170e5e 287static void *iommu_init(hwaddr addr, uint32_t version, qemu_irq irq)
4b48bf05
BS
288{
289 DeviceState *dev;
290 SysBusDevice *s;
291
f542ad03 292 dev = qdev_create(NULL, TYPE_SUN4M_IOMMU);
4b48bf05 293 qdev_prop_set_uint32(dev, "version", version);
e23a1b33 294 qdev_init_nofail(dev);
1356b98d 295 s = SYS_BUS_DEVICE(dev);
4b48bf05
BS
296 sysbus_connect_irq(s, 0, irq);
297 sysbus_mmio_map(s, 0, addr);
298
299 return s;
300}
301
6aa62ed6
MCA
302static void *sparc32_dma_init(hwaddr dma_base,
303 hwaddr esp_base, qemu_irq espdma_irq,
304 hwaddr le_base, qemu_irq ledma_irq)
74ff8d90 305{
6aa62ed6
MCA
306 DeviceState *dma;
307 ESPDMADeviceState *espdma;
308 LEDMADeviceState *ledma;
309 SysBusESPState *esp;
310 SysBusPCNetState *lance;
74ff8d90 311
6aa62ed6
MCA
312 dma = qdev_create(NULL, TYPE_SPARC32_DMA);
313 qdev_init_nofail(dma);
314 sysbus_mmio_map(SYS_BUS_DEVICE(dma), 0, dma_base);
74ff8d90 315
6aa62ed6
MCA
316 espdma = SPARC32_ESPDMA_DEVICE(object_resolve_path_component(
317 OBJECT(dma), "espdma"));
318 sysbus_connect_irq(SYS_BUS_DEVICE(espdma), 0, espdma_irq);
319
320 esp = ESP_STATE(object_resolve_path_component(OBJECT(espdma), "esp"));
321 sysbus_mmio_map(SYS_BUS_DEVICE(esp), 0, esp_base);
12850b1b 322 scsi_bus_legacy_handle_cmdline(&esp->esp.bus);
6aa62ed6
MCA
323
324 ledma = SPARC32_LEDMA_DEVICE(object_resolve_path_component(
325 OBJECT(dma), "ledma"));
326 sysbus_connect_irq(SYS_BUS_DEVICE(ledma), 0, ledma_irq);
327
328 lance = SYSBUS_PCNET(object_resolve_path_component(
329 OBJECT(ledma), "lance"));
330 sysbus_mmio_map(SYS_BUS_DEVICE(lance), 0, le_base);
331
332 return dma;
74ff8d90
BS
333}
334
a8170e5e
AK
335static DeviceState *slavio_intctl_init(hwaddr addr,
336 hwaddr addrg,
462eda24 337 qemu_irq **parent_irq)
4b48bf05
BS
338{
339 DeviceState *dev;
340 SysBusDevice *s;
341 unsigned int i, j;
342
343 dev = qdev_create(NULL, "slavio_intctl");
e23a1b33 344 qdev_init_nofail(dev);
4b48bf05 345
1356b98d 346 s = SYS_BUS_DEVICE(dev);
4b48bf05
BS
347
348 for (i = 0; i < MAX_CPUS; i++) {
349 for (j = 0; j < MAX_PILS; j++) {
350 sysbus_connect_irq(s, i * MAX_PILS + j, parent_irq[i][j]);
351 }
352 }
353 sysbus_mmio_map(s, 0, addrg);
354 for (i = 0; i < MAX_CPUS; i++) {
355 sysbus_mmio_map(s, i + 1, addr + i * TARGET_PAGE_SIZE);
356 }
357
358 return dev;
359}
360
361#define SYS_TIMER_OFFSET 0x10000ULL
362#define CPU_TIMER_OFFSET(cpu) (0x1000ULL * cpu)
363
a8170e5e 364static void slavio_timer_init_all(hwaddr addr, qemu_irq master_irq,
4b48bf05
BS
365 qemu_irq *cpu_irqs, unsigned int num_cpus)
366{
367 DeviceState *dev;
368 SysBusDevice *s;
369 unsigned int i;
370
371 dev = qdev_create(NULL, "slavio_timer");
372 qdev_prop_set_uint32(dev, "num_cpus", num_cpus);
e23a1b33 373 qdev_init_nofail(dev);
1356b98d 374 s = SYS_BUS_DEVICE(dev);
4b48bf05
BS
375 sysbus_connect_irq(s, 0, master_irq);
376 sysbus_mmio_map(s, 0, addr + SYS_TIMER_OFFSET);
377
378 for (i = 0; i < MAX_CPUS; i++) {
a8170e5e 379 sysbus_mmio_map(s, i + 1, addr + (hwaddr)CPU_TIMER_OFFSET(i));
4b48bf05
BS
380 sysbus_connect_irq(s, i + 1, cpu_irqs[i]);
381 }
382}
383
bea42280
IM
384static qemu_irq slavio_system_powerdown;
385
386static void slavio_powerdown_req(Notifier *n, void *opaque)
387{
388 qemu_irq_raise(slavio_system_powerdown);
389}
390
391static Notifier slavio_system_powerdown_notifier = {
392 .notify = slavio_powerdown_req
393};
394
4b48bf05
BS
395#define MISC_LEDS 0x01600000
396#define MISC_CFG 0x01800000
397#define MISC_DIAG 0x01a00000
398#define MISC_MDM 0x01b00000
399#define MISC_SYS 0x01f00000
400
a8170e5e
AK
401static void slavio_misc_init(hwaddr base,
402 hwaddr aux1_base,
403 hwaddr aux2_base, qemu_irq irq,
b2b6f6ec 404 qemu_irq fdc_tc)
4b48bf05
BS
405{
406 DeviceState *dev;
407 SysBusDevice *s;
408
409 dev = qdev_create(NULL, "slavio_misc");
e23a1b33 410 qdev_init_nofail(dev);
1356b98d 411 s = SYS_BUS_DEVICE(dev);
4b48bf05
BS
412 if (base) {
413 /* 8 bit registers */
414 /* Slavio control */
415 sysbus_mmio_map(s, 0, base + MISC_CFG);
416 /* Diagnostics */
417 sysbus_mmio_map(s, 1, base + MISC_DIAG);
418 /* Modem control */
419 sysbus_mmio_map(s, 2, base + MISC_MDM);
420 /* 16 bit registers */
421 /* ss600mp diag LEDs */
422 sysbus_mmio_map(s, 3, base + MISC_LEDS);
423 /* 32 bit registers */
424 /* System control */
425 sysbus_mmio_map(s, 4, base + MISC_SYS);
426 }
427 if (aux1_base) {
428 /* AUX 1 (Misc System Functions) */
429 sysbus_mmio_map(s, 5, aux1_base);
430 }
431 if (aux2_base) {
432 /* AUX 2 (Software Powerdown Control) */
433 sysbus_mmio_map(s, 6, aux2_base);
434 }
435 sysbus_connect_irq(s, 0, irq);
436 sysbus_connect_irq(s, 1, fdc_tc);
bea42280
IM
437 slavio_system_powerdown = qdev_get_gpio_in(dev, 0);
438 qemu_register_powerdown_notifier(&slavio_system_powerdown_notifier);
4b48bf05
BS
439}
440
a8170e5e 441static void ecc_init(hwaddr base, qemu_irq irq, uint32_t version)
4b48bf05
BS
442{
443 DeviceState *dev;
444 SysBusDevice *s;
445
446 dev = qdev_create(NULL, "eccmemctl");
447 qdev_prop_set_uint32(dev, "version", version);
e23a1b33 448 qdev_init_nofail(dev);
1356b98d 449 s = SYS_BUS_DEVICE(dev);
4b48bf05
BS
450 sysbus_connect_irq(s, 0, irq);
451 sysbus_mmio_map(s, 0, base);
452 if (version == 0) { // SS-600MP only
453 sysbus_mmio_map(s, 1, base + 0x1000);
454 }
455}
456
a8170e5e 457static void apc_init(hwaddr power_base, qemu_irq cpu_halt)
4b48bf05
BS
458{
459 DeviceState *dev;
460 SysBusDevice *s;
461
462 dev = qdev_create(NULL, "apc");
e23a1b33 463 qdev_init_nofail(dev);
1356b98d 464 s = SYS_BUS_DEVICE(dev);
4b48bf05
BS
465 /* Power management (APC) XXX: not a Slavio device */
466 sysbus_mmio_map(s, 0, power_base);
467 sysbus_connect_irq(s, 0, cpu_halt);
468}
469
55d7bfe2 470static void tcx_init(hwaddr addr, qemu_irq irq, int vram_size, int width,
4b48bf05
BS
471 int height, int depth)
472{
473 DeviceState *dev;
474 SysBusDevice *s;
475
476 dev = qdev_create(NULL, "SUNW,tcx");
4b48bf05
BS
477 qdev_prop_set_uint32(dev, "vram_size", vram_size);
478 qdev_prop_set_uint16(dev, "width", width);
479 qdev_prop_set_uint16(dev, "height", height);
480 qdev_prop_set_uint16(dev, "depth", depth);
e23a1b33 481 qdev_init_nofail(dev);
1356b98d 482 s = SYS_BUS_DEVICE(dev);
55d7bfe2
MCA
483
484 /* 10/ROM : FCode ROM */
da87dd7b 485 sysbus_mmio_map(s, 0, addr);
55d7bfe2
MCA
486 /* 2/STIP : Stipple */
487 sysbus_mmio_map(s, 1, addr + 0x04000000ULL);
488 /* 3/BLIT : Blitter */
489 sysbus_mmio_map(s, 2, addr + 0x06000000ULL);
490 /* 5/RSTIP : Raw Stipple */
491 sysbus_mmio_map(s, 3, addr + 0x0c000000ULL);
492 /* 6/RBLIT : Raw Blitter */
493 sysbus_mmio_map(s, 4, addr + 0x0e000000ULL);
494 /* 7/TEC : Transform Engine */
495 sysbus_mmio_map(s, 5, addr + 0x00700000ULL);
496 /* 8/CMAP : DAC */
497 sysbus_mmio_map(s, 6, addr + 0x00200000ULL);
498 /* 9/THC : */
499 if (depth == 8) {
500 sysbus_mmio_map(s, 7, addr + 0x00300000ULL);
4b48bf05 501 } else {
55d7bfe2 502 sysbus_mmio_map(s, 7, addr + 0x00301000ULL);
4b48bf05 503 }
55d7bfe2
MCA
504 /* 11/DHC : */
505 sysbus_mmio_map(s, 8, addr + 0x00240000ULL);
506 /* 12/ALT : */
507 sysbus_mmio_map(s, 9, addr + 0x00280000ULL);
508 /* 0/DFB8 : 8-bit plane */
509 sysbus_mmio_map(s, 10, addr + 0x00800000ULL);
510 /* 1/DFB24 : 24bit plane */
511 sysbus_mmio_map(s, 11, addr + 0x02000000ULL);
512 /* 4/RDFB32: Raw framebuffer. Control plane */
513 sysbus_mmio_map(s, 12, addr + 0x0a000000ULL);
514 /* 9/THC24bits : NetBSD writes here even with 8-bit display: dummy */
515 if (depth == 8) {
516 sysbus_mmio_map(s, 13, addr + 0x00301000ULL);
517 }
518
519 sysbus_connect_irq(s, 0, irq);
4b48bf05
BS
520}
521
af87bf29
MCA
522static void cg3_init(hwaddr addr, qemu_irq irq, int vram_size, int width,
523 int height, int depth)
524{
525 DeviceState *dev;
526 SysBusDevice *s;
527
528 dev = qdev_create(NULL, "cgthree");
529 qdev_prop_set_uint32(dev, "vram-size", vram_size);
530 qdev_prop_set_uint16(dev, "width", width);
531 qdev_prop_set_uint16(dev, "height", height);
532 qdev_prop_set_uint16(dev, "depth", depth);
af87bf29
MCA
533 qdev_init_nofail(dev);
534 s = SYS_BUS_DEVICE(dev);
535
536 /* FCode ROM */
537 sysbus_mmio_map(s, 0, addr);
538 /* DAC */
539 sysbus_mmio_map(s, 1, addr + 0x400000ULL);
540 /* 8-bit plane */
541 sysbus_mmio_map(s, 2, addr + 0x800000ULL);
542
543 sysbus_connect_irq(s, 0, irq);
544}
545
325f2747 546/* NCR89C100/MACIO Internal ID register */
ef9dfa4c
AF
547
548#define TYPE_MACIO_ID_REGISTER "macio_idreg"
549
325f2747
BS
550static const uint8_t idreg_data[] = { 0xfe, 0x81, 0x01, 0x03 };
551
a8170e5e 552static void idreg_init(hwaddr addr)
325f2747
BS
553{
554 DeviceState *dev;
555 SysBusDevice *s;
556
ef9dfa4c 557 dev = qdev_create(NULL, TYPE_MACIO_ID_REGISTER);
e23a1b33 558 qdev_init_nofail(dev);
1356b98d 559 s = SYS_BUS_DEVICE(dev);
325f2747
BS
560
561 sysbus_mmio_map(s, 0, addr);
2a221651
EI
562 cpu_physical_memory_write_rom(&address_space_memory,
563 addr, idreg_data, sizeof(idreg_data));
325f2747
BS
564}
565
ef9dfa4c
AF
566#define MACIO_ID_REGISTER(obj) \
567 OBJECT_CHECK(IDRegState, (obj), TYPE_MACIO_ID_REGISTER)
568
3150fa50 569typedef struct IDRegState {
ef9dfa4c
AF
570 SysBusDevice parent_obj;
571
3150fa50
AK
572 MemoryRegion mem;
573} IDRegState;
574
a2a5a7b5 575static void idreg_realize(DeviceState *ds, Error **errp)
325f2747 576{
a2a5a7b5
TH
577 IDRegState *s = MACIO_ID_REGISTER(ds);
578 SysBusDevice *dev = SYS_BUS_DEVICE(ds);
579 Error *local_err = NULL;
580
581 memory_region_init_ram_nomigrate(&s->mem, OBJECT(ds), "sun4m.idreg",
582 sizeof(idreg_data), &local_err);
583 if (local_err) {
584 error_propagate(errp, local_err);
585 return;
586 }
325f2747 587
c5705a77 588 vmstate_register_ram_global(&s->mem);
3150fa50 589 memory_region_set_readonly(&s->mem, true);
750ecd44 590 sysbus_init_mmio(dev, &s->mem);
999e12bb
AL
591}
592
a2a5a7b5
TH
593static void idreg_class_init(ObjectClass *oc, void *data)
594{
595 DeviceClass *dc = DEVICE_CLASS(oc);
596
597 dc->realize = idreg_realize;
598}
599
8c43a6f0 600static const TypeInfo idreg_info = {
ef9dfa4c 601 .name = TYPE_MACIO_ID_REGISTER,
39bffca2
AL
602 .parent = TYPE_SYS_BUS_DEVICE,
603 .instance_size = sizeof(IDRegState),
a2a5a7b5 604 .class_init = idreg_class_init,
325f2747
BS
605};
606
b3a49965
AF
607#define TYPE_TCX_AFX "tcx_afx"
608#define TCX_AFX(obj) OBJECT_CHECK(AFXState, (obj), TYPE_TCX_AFX)
609
3150fa50 610typedef struct AFXState {
b3a49965
AF
611 SysBusDevice parent_obj;
612
3150fa50
AK
613 MemoryRegion mem;
614} AFXState;
615
c5de386a 616/* SS-5 TCX AFX register */
a8170e5e 617static void afx_init(hwaddr addr)
c5de386a
AT
618{
619 DeviceState *dev;
620 SysBusDevice *s;
621
b3a49965 622 dev = qdev_create(NULL, TYPE_TCX_AFX);
c5de386a 623 qdev_init_nofail(dev);
1356b98d 624 s = SYS_BUS_DEVICE(dev);
c5de386a
AT
625
626 sysbus_mmio_map(s, 0, addr);
627}
628
a2a5a7b5 629static void afx_realize(DeviceState *ds, Error **errp)
c5de386a 630{
a2a5a7b5
TH
631 AFXState *s = TCX_AFX(ds);
632 SysBusDevice *dev = SYS_BUS_DEVICE(ds);
633 Error *local_err = NULL;
634
635 memory_region_init_ram_nomigrate(&s->mem, OBJECT(ds), "sun4m.afx", 4,
636 &local_err);
637 if (local_err) {
638 error_propagate(errp, local_err);
639 return;
640 }
c5de386a 641
c5705a77 642 vmstate_register_ram_global(&s->mem);
750ecd44 643 sysbus_init_mmio(dev, &s->mem);
999e12bb
AL
644}
645
a2a5a7b5
TH
646static void afx_class_init(ObjectClass *oc, void *data)
647{
648 DeviceClass *dc = DEVICE_CLASS(oc);
649
650 dc->realize = afx_realize;
651}
652
8c43a6f0 653static const TypeInfo afx_info = {
b3a49965 654 .name = TYPE_TCX_AFX,
39bffca2
AL
655 .parent = TYPE_SYS_BUS_DEVICE,
656 .instance_size = sizeof(AFXState),
a2a5a7b5 657 .class_init = afx_class_init,
c5de386a
AT
658};
659
e6f54c91
AF
660#define TYPE_OPENPROM "openprom"
661#define OPENPROM(obj) OBJECT_CHECK(PROMState, (obj), TYPE_OPENPROM)
662
3150fa50 663typedef struct PROMState {
e6f54c91
AF
664 SysBusDevice parent_obj;
665
3150fa50
AK
666 MemoryRegion prom;
667} PROMState;
668
f48f6569 669/* Boot PROM (OpenBIOS) */
409dbce5
AJ
670static uint64_t translate_prom_address(void *opaque, uint64_t addr)
671{
a8170e5e 672 hwaddr *base_addr = (hwaddr *)opaque;
409dbce5
AJ
673 return addr + *base_addr - PROM_VADDR;
674}
675
a8170e5e 676static void prom_init(hwaddr addr, const char *bios_name)
f48f6569
BS
677{
678 DeviceState *dev;
679 SysBusDevice *s;
680 char *filename;
681 int ret;
682
e6f54c91 683 dev = qdev_create(NULL, TYPE_OPENPROM);
e23a1b33 684 qdev_init_nofail(dev);
1356b98d 685 s = SYS_BUS_DEVICE(dev);
f48f6569
BS
686
687 sysbus_mmio_map(s, 0, addr);
688
689 /* load boot prom */
690 if (bios_name == NULL) {
691 bios_name = PROM_FILENAME;
692 }
693 filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
694 if (filename) {
409dbce5 695 ret = load_elf(filename, translate_prom_address, &addr, NULL,
7ef295ea 696 NULL, NULL, 1, EM_SPARC, 0, 0);
f48f6569
BS
697 if (ret < 0 || ret > PROM_SIZE_MAX) {
698 ret = load_image_targphys(filename, addr, PROM_SIZE_MAX);
699 }
7267c094 700 g_free(filename);
f48f6569
BS
701 } else {
702 ret = -1;
703 }
704 if (ret < 0 || ret > PROM_SIZE_MAX) {
29bd7231 705 error_report("could not load prom '%s'", bios_name);
f48f6569
BS
706 exit(1);
707 }
708}
709
a2a5a7b5 710static void prom_realize(DeviceState *ds, Error **errp)
f48f6569 711{
a2a5a7b5
TH
712 PROMState *s = OPENPROM(ds);
713 SysBusDevice *dev = SYS_BUS_DEVICE(ds);
714 Error *local_err = NULL;
715
716 memory_region_init_ram_nomigrate(&s->prom, OBJECT(ds), "sun4m.prom",
717 PROM_SIZE_MAX, &local_err);
718 if (local_err) {
719 error_propagate(errp, local_err);
720 return;
721 }
f48f6569 722
c5705a77 723 vmstate_register_ram_global(&s->prom);
3150fa50 724 memory_region_set_readonly(&s->prom, true);
750ecd44 725 sysbus_init_mmio(dev, &s->prom);
f48f6569
BS
726}
727
999e12bb
AL
728static Property prom_properties[] = {
729 {/* end of property list */},
730};
731
732static void prom_class_init(ObjectClass *klass, void *data)
733{
39bffca2 734 DeviceClass *dc = DEVICE_CLASS(klass);
999e12bb 735
39bffca2 736 dc->props = prom_properties;
a2a5a7b5 737 dc->realize = prom_realize;
999e12bb
AL
738}
739
8c43a6f0 740static const TypeInfo prom_info = {
e6f54c91 741 .name = TYPE_OPENPROM,
39bffca2
AL
742 .parent = TYPE_SYS_BUS_DEVICE,
743 .instance_size = sizeof(PROMState),
744 .class_init = prom_class_init,
f48f6569
BS
745};
746
5ab6b4c6
AF
747#define TYPE_SUN4M_MEMORY "memory"
748#define SUN4M_RAM(obj) OBJECT_CHECK(RamDevice, (obj), TYPE_SUN4M_MEMORY)
749
750typedef struct RamDevice {
751 SysBusDevice parent_obj;
752
3150fa50 753 MemoryRegion ram;
04843626 754 uint64_t size;
ee6847d1
GH
755} RamDevice;
756
a350db85 757/* System RAM */
dc8b6dd9 758static void ram_realize(DeviceState *dev, Error **errp)
a350db85 759{
5ab6b4c6 760 RamDevice *d = SUN4M_RAM(dev);
dc8b6dd9 761 SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
a350db85 762
8e7ba4ed
DM
763 memory_region_allocate_system_memory(&d->ram, OBJECT(d), "sun4m.ram",
764 d->size);
dc8b6dd9 765 sysbus_init_mmio(sbd, &d->ram);
a350db85
BS
766}
767
a8170e5e 768static void ram_init(hwaddr addr, ram_addr_t RAM_size,
a350db85
BS
769 uint64_t max_mem)
770{
771 DeviceState *dev;
772 SysBusDevice *s;
ee6847d1 773 RamDevice *d;
a350db85
BS
774
775 /* allocate RAM */
776 if ((uint64_t)RAM_size > max_mem) {
0a2e467b
PMD
777 error_report("Too much memory for this machine: %" PRId64 ","
778 " maximum %" PRId64,
779 RAM_size / MiB, max_mem / MiB);
a350db85
BS
780 exit(1);
781 }
782 dev = qdev_create(NULL, "memory");
1356b98d 783 s = SYS_BUS_DEVICE(dev);
a350db85 784
5ab6b4c6 785 d = SUN4M_RAM(dev);
ee6847d1 786 d->size = RAM_size;
e23a1b33 787 qdev_init_nofail(dev);
ee6847d1 788
a350db85
BS
789 sysbus_mmio_map(s, 0, addr);
790}
791
999e12bb
AL
792static Property ram_properties[] = {
793 DEFINE_PROP_UINT64("size", RamDevice, size, 0),
794 DEFINE_PROP_END_OF_LIST(),
795};
796
797static void ram_class_init(ObjectClass *klass, void *data)
798{
39bffca2 799 DeviceClass *dc = DEVICE_CLASS(klass);
999e12bb 800
dc8b6dd9 801 dc->realize = ram_realize;
39bffca2 802 dc->props = ram_properties;
999e12bb
AL
803}
804
8c43a6f0 805static const TypeInfo ram_info = {
5ab6b4c6 806 .name = TYPE_SUN4M_MEMORY,
39bffca2
AL
807 .parent = TYPE_SYS_BUS_DEVICE,
808 .instance_size = sizeof(RamDevice),
809 .class_init = ram_class_init,
a350db85
BS
810};
811
49cbd887 812static void cpu_devinit(const char *cpu_type, unsigned int id,
89835363 813 uint64_t prom_addr, qemu_irq **cpu_irqs)
666713c0 814{
259186a7 815 CPUState *cs;
8968f588 816 SPARCCPU *cpu;
98cec4a2 817 CPUSPARCState *env;
666713c0 818
49cbd887 819 cpu = SPARC_CPU(cpu_create(cpu_type));
8968f588 820 env = &cpu->env;
666713c0
BS
821
822 cpu_sparc_set_id(env, id);
823 if (id == 0) {
5414dec6 824 qemu_register_reset(main_cpu_reset, cpu);
666713c0 825 } else {
5414dec6 826 qemu_register_reset(secondary_cpu_reset, cpu);
259186a7
AF
827 cs = CPU(cpu);
828 cs->halted = 1;
666713c0 829 }
e0bbf9b5 830 *cpu_irqs = qemu_allocate_irqs(cpu_set_irq, cpu, MAX_PILS);
666713c0 831 env->prom_addr = prom_addr;
666713c0
BS
832}
833
acfbe712
BS
834static void dummy_fdc_tc(void *opaque, int irq, int level)
835{
836}
837
6b63ef4d 838static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
3ef96221 839 MachineState *machine)
420557e8 840{
61b97833 841 DeviceState *slavio_intctl;
713c45fa 842 unsigned int i;
6aa62ed6 843 void *nvram;
9540619d 844 qemu_irq *cpu_irqs[MAX_CPUS], slavio_irq[32], slavio_cpu_irq[MAX_CPUS];
2582cfa0 845 qemu_irq fdc_tc;
5c6602c5 846 unsigned long kernel_size;
fd8014e1 847 DriveInfo *fd[MAX_FD];
a88b362c 848 FWCfgState *fw_cfg;
9a62fb24 849 unsigned int num_vsimms;
2cc75c32
LV
850 DeviceState *dev;
851 SysBusDevice *s;
420557e8 852
ba3c64fb
FB
853 /* init CPUs */
854 for(i = 0; i < smp_cpus; i++) {
49cbd887 855 cpu_devinit(machine->cpu_type, i, hwdef->slavio_base, &cpu_irqs[i]);
ba3c64fb 856 }
b3a23197
BS
857
858 for (i = smp_cpus; i < MAX_CPUS; i++)
859 cpu_irqs[i] = qemu_allocate_irqs(dummy_cpu_set_irq, NULL, MAX_PILS);
860
3ebf5aaf 861
3ebf5aaf 862 /* set up devices */
3ef96221 863 ram_init(0, machine->ram_size, hwdef->max_mem);
676d9b9b
AT
864 /* models without ECC don't trap when missing ram is accessed */
865 if (!hwdef->ecc_base) {
3ef96221 866 empty_slot_init(machine->ram_size, hwdef->max_mem - machine->ram_size);
676d9b9b 867 }
a350db85 868
f48f6569
BS
869 prom_init(hwdef->slavio_base, bios_name);
870
d453c2c3
BS
871 slavio_intctl = slavio_intctl_init(hwdef->intctl_base,
872 hwdef->intctl_base + 0x10000ULL,
462eda24 873 cpu_irqs);
a1961a4b
BS
874
875 for (i = 0; i < 32; i++) {
d453c2c3 876 slavio_irq[i] = qdev_get_gpio_in(slavio_intctl, i);
a1961a4b
BS
877 }
878 for (i = 0; i < MAX_CPUS; i++) {
d453c2c3 879 slavio_cpu_irq[i] = qdev_get_gpio_in(slavio_intctl, 32 + i);
a1961a4b 880 }
b3a23197 881
fe096129 882 if (hwdef->idreg_base) {
325f2747 883 idreg_init(hwdef->idreg_base);
4c2485de
BS
884 }
885
c5de386a
AT
886 if (hwdef->afx_base) {
887 afx_init(hwdef->afx_base);
888 }
889
6aa62ed6 890 iommu_init(hwdef->iommu_base, hwdef->iommu_version, slavio_irq[30]);
ff403da6 891
3386376c
AT
892 if (hwdef->iommu_pad_base) {
893 /* On the real hardware (SS-5, LX) the MMU is not padded, but aliased.
894 Software shouldn't use aliased addresses, neither should it crash
895 when does. Using empty_slot instead of aliasing can help with
896 debugging such accesses */
897 empty_slot_init(hwdef->iommu_pad_base,hwdef->iommu_pad_len);
898 }
899
6aa62ed6
MCA
900 sparc32_dma_init(hwdef->dma_base,
901 hwdef->esp_base, slavio_irq[18],
902 hwdef->le_base, slavio_irq[16]);
e6ca02a4 903
eee0b836 904 if (graphic_depth != 8 && graphic_depth != 24) {
af87bf29 905 error_report("Unsupported depth: %d", graphic_depth);
eee0b836
BS
906 exit (1);
907 }
9a62fb24
BB
908 num_vsimms = 0;
909 if (num_vsimms == 0) {
af87bf29
MCA
910 if (vga_interface_type == VGA_CG3) {
911 if (graphic_depth != 8) {
912 error_report("Unsupported depth: %d", graphic_depth);
913 exit(1);
914 }
915
916 if (!(graphic_width == 1024 && graphic_height == 768) &&
917 !(graphic_width == 1152 && graphic_height == 900)) {
918 error_report("Unsupported resolution: %d x %d", graphic_width,
919 graphic_height);
920 exit(1);
921 }
922
923 /* sbus irq 5 */
924 cg3_init(hwdef->tcx_base, slavio_irq[11], 0x00100000,
925 graphic_width, graphic_height, graphic_depth);
926 } else {
927 /* If no display specified, default to TCX */
928 if (graphic_depth != 8 && graphic_depth != 24) {
929 error_report("Unsupported depth: %d", graphic_depth);
930 exit(1);
931 }
932
933 if (!(graphic_width == 1024 && graphic_height == 768)) {
934 error_report("Unsupported resolution: %d x %d",
935 graphic_width, graphic_height);
936 exit(1);
937 }
938
55d7bfe2
MCA
939 tcx_init(hwdef->tcx_base, slavio_irq[11], 0x00100000,
940 graphic_width, graphic_height, graphic_depth);
af87bf29 941 }
9a62fb24
BB
942 }
943
944 for (i = num_vsimms; i < MAX_VSIMMS; i++) {
945 /* vsimm registers probed by OBP */
946 if (hwdef->vsimm[i].reg_base) {
947 empty_slot_init(hwdef->vsimm[i].reg_base, 0x2000);
948 }
949 }
950
951 if (hwdef->sx_base) {
952 empty_slot_init(hwdef->sx_base, 0x2000);
953 }
dbe06e18 954
6de04973 955 nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0, 0x2000, 1968, 8);
81732d19 956
c533e0b3 957 slavio_timer_init_all(hwdef->counter_base, slavio_irq[19], slavio_cpu_irq, smp_cpus);
81732d19 958
5cbdb3a3
SW
959 /* Slavio TTYA (base+4, Linux ttyS0) is the first QEMU serial device
960 Slavio TTYB (base+0, Linux ttyS1) is the second QEMU serial device */
2cc75c32
LV
961 dev = qdev_create(NULL, TYPE_ESCC);
962 qdev_prop_set_uint32(dev, "disabled", !machine->enable_graphics);
963 qdev_prop_set_uint32(dev, "frequency", ESCC_CLOCK);
964 qdev_prop_set_uint32(dev, "it_shift", 1);
965 qdev_prop_set_chr(dev, "chrB", NULL);
966 qdev_prop_set_chr(dev, "chrA", NULL);
967 qdev_prop_set_uint32(dev, "chnBtype", escc_mouse);
968 qdev_prop_set_uint32(dev, "chnAtype", escc_kbd);
969 qdev_init_nofail(dev);
970 s = SYS_BUS_DEVICE(dev);
971 sysbus_connect_irq(s, 0, slavio_irq[14]);
972 sysbus_connect_irq(s, 1, slavio_irq[14]);
973 sysbus_mmio_map(s, 0, hwdef->ms_kb_base);
974
975 dev = qdev_create(NULL, TYPE_ESCC);
976 qdev_prop_set_uint32(dev, "disabled", 0);
977 qdev_prop_set_uint32(dev, "frequency", ESCC_CLOCK);
978 qdev_prop_set_uint32(dev, "it_shift", 1);
9bca0edb
PM
979 qdev_prop_set_chr(dev, "chrB", serial_hd(1));
980 qdev_prop_set_chr(dev, "chrA", serial_hd(0));
2cc75c32
LV
981 qdev_prop_set_uint32(dev, "chnBtype", escc_serial);
982 qdev_prop_set_uint32(dev, "chnAtype", escc_serial);
983 qdev_init_nofail(dev);
984
985 s = SYS_BUS_DEVICE(dev);
986 sysbus_connect_irq(s, 0, slavio_irq[15]);
987 sysbus_connect_irq(s, 1, slavio_irq[15]);
988 sysbus_mmio_map(s, 0, hwdef->serial_base);
741402f9 989
2582cfa0 990 if (hwdef->apc_base) {
ca43b97b 991 apc_init(hwdef->apc_base, qemu_allocate_irq(cpu_halt_signal, NULL, 0));
2582cfa0 992 }
2be17ebd 993
fe096129 994 if (hwdef->fd_base) {
e4bcb14c 995 /* there is zero or one floppy drive */
309e60bd 996 memset(fd, 0, sizeof(fd));
fd8014e1 997 fd[0] = drive_get(IF_FLOPPY, 0, 0);
c533e0b3 998 sun4m_fdctrl_init(slavio_irq[22], hwdef->fd_base, fd,
2582cfa0 999 &fdc_tc);
acfbe712 1000 } else {
ca43b97b 1001 fdc_tc = qemu_allocate_irq(dummy_fdc_tc, NULL, 0);
e4bcb14c
TS
1002 }
1003
acfbe712
BS
1004 slavio_misc_init(hwdef->slavio_base, hwdef->aux1_base, hwdef->aux2_base,
1005 slavio_irq[30], fdc_tc);
1006
fa28ec52
BS
1007 if (hwdef->cs_base) {
1008 sysbus_create_simple("SUNW,CS4231", hwdef->cs_base,
c533e0b3 1009 slavio_irq[5]);
fa28ec52 1010 }
b3ceef24 1011
9a62fb24
BB
1012 if (hwdef->dbri_base) {
1013 /* ISDN chip with attached CS4215 audio codec */
1014 /* prom space */
1015 empty_slot_init(hwdef->dbri_base+0x1000, 0x30);
1016 /* reg space */
1017 empty_slot_init(hwdef->dbri_base+0x10000, 0x100);
1018 }
1019
1020 if (hwdef->bpp_base) {
1021 /* parallel port */
1022 empty_slot_init(hwdef->bpp_base, 0x20);
1023 }
1024
3ef96221
MA
1025 kernel_size = sun4m_load_kernel(machine->kernel_filename,
1026 machine->initrd_filename,
1027 machine->ram_size);
36cd9210 1028
3ef96221
MA
1029 nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, machine->kernel_cmdline,
1030 machine->boot_order, machine->ram_size, kernel_size,
1031 graphic_width, graphic_height, graphic_depth,
1032 hwdef->nvram_machine_id, "Sun4m");
7eb0c8e8 1033
fe096129 1034 if (hwdef->ecc_base)
c533e0b3 1035 ecc_init(hwdef->ecc_base, slavio_irq[28],
e42c20b4 1036 hwdef->ecc_version);
3cce6243 1037
66708822 1038 fw_cfg = fw_cfg_init_mem(CFG_ADDR, CFG_ADDR + 2);
5836d168 1039 fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);
70db9222 1040 fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
905fdcb5
BS
1041 fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
1042 fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id);
fbfcf955 1043 fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_DEPTH, graphic_depth);
b96919e0
MCA
1044 fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_WIDTH, graphic_width);
1045 fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_HEIGHT, graphic_height);
513f789f
BS
1046 fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, KERNEL_LOAD_ADDR);
1047 fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size);
3ef96221 1048 if (machine->kernel_cmdline) {
513f789f 1049 fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, CMDLINE_ADDR);
6b63ef4d 1050 pstrcpy_targphys("cmdline", CMDLINE_ADDR, TARGET_PAGE_SIZE,
3ef96221
MA
1051 machine->kernel_cmdline);
1052 fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, machine->kernel_cmdline);
748a4ee3 1053 fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE,
3ef96221 1054 strlen(machine->kernel_cmdline) + 1);
513f789f
BS
1055 } else {
1056 fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0);
748a4ee3 1057 fw_cfg_add_i32(fw_cfg, FW_CFG_CMDLINE_SIZE, 0);
513f789f
BS
1058 }
1059 fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, INITRD_LOAD_ADDR);
1060 fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, 0); // not used
3ef96221 1061 fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, machine->boot_order[0]);
513f789f 1062 qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
36cd9210
BS
1063}
1064
905fdcb5 1065enum {
905fdcb5
BS
1066 ss5_id = 32,
1067 vger_id,
1068 lx_id,
1069 ss4_id,
1070 scls_id,
1071 sbook_id,
1072 ss10_id = 64,
1073 ss20_id,
1074 ss600mp_id,
905fdcb5
BS
1075};
1076
8137cde8 1077static const struct sun4m_hwdef sun4m_hwdefs[] = {
36cd9210
BS
1078 /* SS-5 */
1079 {
1080 .iommu_base = 0x10000000,
3386376c
AT
1081 .iommu_pad_base = 0x10004000,
1082 .iommu_pad_len = 0x0fffb000,
36cd9210
BS
1083 .tcx_base = 0x50000000,
1084 .cs_base = 0x6c000000,
384ccb5d 1085 .slavio_base = 0x70000000,
36cd9210
BS
1086 .ms_kb_base = 0x71000000,
1087 .serial_base = 0x71100000,
1088 .nvram_base = 0x71200000,
1089 .fd_base = 0x71400000,
1090 .counter_base = 0x71d00000,
1091 .intctl_base = 0x71e00000,
4c2485de 1092 .idreg_base = 0x78000000,
36cd9210
BS
1093 .dma_base = 0x78400000,
1094 .esp_base = 0x78800000,
1095 .le_base = 0x78c00000,
127fc407 1096 .apc_base = 0x6a000000,
c5de386a 1097 .afx_base = 0x6e000000,
0019ad53
BS
1098 .aux1_base = 0x71900000,
1099 .aux2_base = 0x71910000,
905fdcb5
BS
1100 .nvram_machine_id = 0x80,
1101 .machine_id = ss5_id,
cf3102ac 1102 .iommu_version = 0x05000000,
3ebf5aaf 1103 .max_mem = 0x10000000,
e0353fe2
BS
1104 },
1105 /* SS-10 */
e0353fe2 1106 {
5dcb6b91
BS
1107 .iommu_base = 0xfe0000000ULL,
1108 .tcx_base = 0xe20000000ULL,
5dcb6b91
BS
1109 .slavio_base = 0xff0000000ULL,
1110 .ms_kb_base = 0xff1000000ULL,
1111 .serial_base = 0xff1100000ULL,
1112 .nvram_base = 0xff1200000ULL,
1113 .fd_base = 0xff1700000ULL,
1114 .counter_base = 0xff1300000ULL,
1115 .intctl_base = 0xff1400000ULL,
4c2485de 1116 .idreg_base = 0xef0000000ULL,
5dcb6b91
BS
1117 .dma_base = 0xef0400000ULL,
1118 .esp_base = 0xef0800000ULL,
1119 .le_base = 0xef0c00000ULL,
0019ad53 1120 .apc_base = 0xefa000000ULL, // XXX should not exist
127fc407
BS
1121 .aux1_base = 0xff1800000ULL,
1122 .aux2_base = 0xff1a01000ULL,
7eb0c8e8
BS
1123 .ecc_base = 0xf00000000ULL,
1124 .ecc_version = 0x10000000, // version 0, implementation 1
905fdcb5
BS
1125 .nvram_machine_id = 0x72,
1126 .machine_id = ss10_id,
7fbfb139 1127 .iommu_version = 0x03000000,
6ef05b95 1128 .max_mem = 0xf00000000ULL,
36cd9210 1129 },
6a3b9cc9
BS
1130 /* SS-600MP */
1131 {
1132 .iommu_base = 0xfe0000000ULL,
1133 .tcx_base = 0xe20000000ULL,
6a3b9cc9
BS
1134 .slavio_base = 0xff0000000ULL,
1135 .ms_kb_base = 0xff1000000ULL,
1136 .serial_base = 0xff1100000ULL,
1137 .nvram_base = 0xff1200000ULL,
6a3b9cc9
BS
1138 .counter_base = 0xff1300000ULL,
1139 .intctl_base = 0xff1400000ULL,
1140 .dma_base = 0xef0081000ULL,
1141 .esp_base = 0xef0080000ULL,
1142 .le_base = 0xef0060000ULL,
0019ad53 1143 .apc_base = 0xefa000000ULL, // XXX should not exist
127fc407
BS
1144 .aux1_base = 0xff1800000ULL,
1145 .aux2_base = 0xff1a01000ULL, // XXX should not exist
7eb0c8e8
BS
1146 .ecc_base = 0xf00000000ULL,
1147 .ecc_version = 0x00000000, // version 0, implementation 0
905fdcb5
BS
1148 .nvram_machine_id = 0x71,
1149 .machine_id = ss600mp_id,
7fbfb139 1150 .iommu_version = 0x01000000,
6ef05b95 1151 .max_mem = 0xf00000000ULL,
6a3b9cc9 1152 },
ae40972f
BS
1153 /* SS-20 */
1154 {
1155 .iommu_base = 0xfe0000000ULL,
1156 .tcx_base = 0xe20000000ULL,
ae40972f
BS
1157 .slavio_base = 0xff0000000ULL,
1158 .ms_kb_base = 0xff1000000ULL,
1159 .serial_base = 0xff1100000ULL,
1160 .nvram_base = 0xff1200000ULL,
1161 .fd_base = 0xff1700000ULL,
1162 .counter_base = 0xff1300000ULL,
1163 .intctl_base = 0xff1400000ULL,
4c2485de 1164 .idreg_base = 0xef0000000ULL,
ae40972f
BS
1165 .dma_base = 0xef0400000ULL,
1166 .esp_base = 0xef0800000ULL,
1167 .le_base = 0xef0c00000ULL,
9a62fb24 1168 .bpp_base = 0xef4800000ULL,
0019ad53 1169 .apc_base = 0xefa000000ULL, // XXX should not exist
577d8dd4
BS
1170 .aux1_base = 0xff1800000ULL,
1171 .aux2_base = 0xff1a01000ULL,
9a62fb24
BB
1172 .dbri_base = 0xee0000000ULL,
1173 .sx_base = 0xf80000000ULL,
1174 .vsimm = {
1175 {
1176 .reg_base = 0x9c000000ULL,
1177 .vram_base = 0xfc000000ULL
1178 }, {
1179 .reg_base = 0x90000000ULL,
1180 .vram_base = 0xf0000000ULL
1181 }, {
1182 .reg_base = 0x94000000ULL
1183 }, {
1184 .reg_base = 0x98000000ULL
1185 }
1186 },
ae40972f
BS
1187 .ecc_base = 0xf00000000ULL,
1188 .ecc_version = 0x20000000, // version 0, implementation 2
905fdcb5
BS
1189 .nvram_machine_id = 0x72,
1190 .machine_id = ss20_id,
ae40972f 1191 .iommu_version = 0x13000000,
6ef05b95 1192 .max_mem = 0xf00000000ULL,
ae40972f 1193 },
a526a31c
BS
1194 /* Voyager */
1195 {
1196 .iommu_base = 0x10000000,
1197 .tcx_base = 0x50000000,
a526a31c
BS
1198 .slavio_base = 0x70000000,
1199 .ms_kb_base = 0x71000000,
1200 .serial_base = 0x71100000,
1201 .nvram_base = 0x71200000,
1202 .fd_base = 0x71400000,
1203 .counter_base = 0x71d00000,
1204 .intctl_base = 0x71e00000,
1205 .idreg_base = 0x78000000,
1206 .dma_base = 0x78400000,
1207 .esp_base = 0x78800000,
1208 .le_base = 0x78c00000,
1209 .apc_base = 0x71300000, // pmc
1210 .aux1_base = 0x71900000,
1211 .aux2_base = 0x71910000,
905fdcb5
BS
1212 .nvram_machine_id = 0x80,
1213 .machine_id = vger_id,
a526a31c 1214 .iommu_version = 0x05000000,
a526a31c 1215 .max_mem = 0x10000000,
a526a31c
BS
1216 },
1217 /* LX */
1218 {
1219 .iommu_base = 0x10000000,
3386376c
AT
1220 .iommu_pad_base = 0x10004000,
1221 .iommu_pad_len = 0x0fffb000,
a526a31c 1222 .tcx_base = 0x50000000,
a526a31c
BS
1223 .slavio_base = 0x70000000,
1224 .ms_kb_base = 0x71000000,
1225 .serial_base = 0x71100000,
1226 .nvram_base = 0x71200000,
1227 .fd_base = 0x71400000,
1228 .counter_base = 0x71d00000,
1229 .intctl_base = 0x71e00000,
1230 .idreg_base = 0x78000000,
1231 .dma_base = 0x78400000,
1232 .esp_base = 0x78800000,
1233 .le_base = 0x78c00000,
a526a31c
BS
1234 .aux1_base = 0x71900000,
1235 .aux2_base = 0x71910000,
905fdcb5
BS
1236 .nvram_machine_id = 0x80,
1237 .machine_id = lx_id,
a526a31c 1238 .iommu_version = 0x04000000,
a526a31c 1239 .max_mem = 0x10000000,
a526a31c
BS
1240 },
1241 /* SS-4 */
1242 {
1243 .iommu_base = 0x10000000,
1244 .tcx_base = 0x50000000,
1245 .cs_base = 0x6c000000,
1246 .slavio_base = 0x70000000,
1247 .ms_kb_base = 0x71000000,
1248 .serial_base = 0x71100000,
1249 .nvram_base = 0x71200000,
1250 .fd_base = 0x71400000,
1251 .counter_base = 0x71d00000,
1252 .intctl_base = 0x71e00000,
1253 .idreg_base = 0x78000000,
1254 .dma_base = 0x78400000,
1255 .esp_base = 0x78800000,
1256 .le_base = 0x78c00000,
1257 .apc_base = 0x6a000000,
1258 .aux1_base = 0x71900000,
1259 .aux2_base = 0x71910000,
905fdcb5
BS
1260 .nvram_machine_id = 0x80,
1261 .machine_id = ss4_id,
a526a31c 1262 .iommu_version = 0x05000000,
a526a31c 1263 .max_mem = 0x10000000,
a526a31c
BS
1264 },
1265 /* SPARCClassic */
1266 {
1267 .iommu_base = 0x10000000,
1268 .tcx_base = 0x50000000,
a526a31c
BS
1269 .slavio_base = 0x70000000,
1270 .ms_kb_base = 0x71000000,
1271 .serial_base = 0x71100000,
1272 .nvram_base = 0x71200000,
1273 .fd_base = 0x71400000,
1274 .counter_base = 0x71d00000,
1275 .intctl_base = 0x71e00000,
1276 .idreg_base = 0x78000000,
1277 .dma_base = 0x78400000,
1278 .esp_base = 0x78800000,
1279 .le_base = 0x78c00000,
1280 .apc_base = 0x6a000000,
1281 .aux1_base = 0x71900000,
1282 .aux2_base = 0x71910000,
905fdcb5
BS
1283 .nvram_machine_id = 0x80,
1284 .machine_id = scls_id,
a526a31c 1285 .iommu_version = 0x05000000,
a526a31c 1286 .max_mem = 0x10000000,
a526a31c
BS
1287 },
1288 /* SPARCbook */
1289 {
1290 .iommu_base = 0x10000000,
1291 .tcx_base = 0x50000000, // XXX
a526a31c
BS
1292 .slavio_base = 0x70000000,
1293 .ms_kb_base = 0x71000000,
1294 .serial_base = 0x71100000,
1295 .nvram_base = 0x71200000,
1296 .fd_base = 0x71400000,
1297 .counter_base = 0x71d00000,
1298 .intctl_base = 0x71e00000,
1299 .idreg_base = 0x78000000,
1300 .dma_base = 0x78400000,
1301 .esp_base = 0x78800000,
1302 .le_base = 0x78c00000,
1303 .apc_base = 0x6a000000,
1304 .aux1_base = 0x71900000,
1305 .aux2_base = 0x71910000,
905fdcb5
BS
1306 .nvram_machine_id = 0x80,
1307 .machine_id = sbook_id,
a526a31c 1308 .iommu_version = 0x05000000,
a526a31c 1309 .max_mem = 0x10000000,
a526a31c 1310 },
36cd9210
BS
1311};
1312
36cd9210 1313/* SPARCstation 5 hardware initialisation */
3ef96221 1314static void ss5_init(MachineState *machine)
36cd9210 1315{
3ef96221 1316 sun4m_hw_init(&sun4m_hwdefs[0], machine);
420557e8 1317}
c0e564d5 1318
e0353fe2 1319/* SPARCstation 10 hardware initialisation */
3ef96221 1320static void ss10_init(MachineState *machine)
e0353fe2 1321{
3ef96221 1322 sun4m_hw_init(&sun4m_hwdefs[1], machine);
e0353fe2
BS
1323}
1324
6a3b9cc9 1325/* SPARCserver 600MP hardware initialisation */
3ef96221 1326static void ss600mp_init(MachineState *machine)
6a3b9cc9 1327{
3ef96221 1328 sun4m_hw_init(&sun4m_hwdefs[2], machine);
6a3b9cc9
BS
1329}
1330
ae40972f 1331/* SPARCstation 20 hardware initialisation */
3ef96221 1332static void ss20_init(MachineState *machine)
ae40972f 1333{
3ef96221 1334 sun4m_hw_init(&sun4m_hwdefs[3], machine);
ee76f82e
BS
1335}
1336
a526a31c 1337/* SPARCstation Voyager hardware initialisation */
3ef96221 1338static void vger_init(MachineState *machine)
a526a31c 1339{
3ef96221 1340 sun4m_hw_init(&sun4m_hwdefs[4], machine);
a526a31c
BS
1341}
1342
1343/* SPARCstation LX hardware initialisation */
3ef96221 1344static void ss_lx_init(MachineState *machine)
a526a31c 1345{
3ef96221 1346 sun4m_hw_init(&sun4m_hwdefs[5], machine);
a526a31c
BS
1347}
1348
1349/* SPARCstation 4 hardware initialisation */
3ef96221 1350static void ss4_init(MachineState *machine)
a526a31c 1351{
3ef96221 1352 sun4m_hw_init(&sun4m_hwdefs[6], machine);
a526a31c
BS
1353}
1354
1355/* SPARCClassic hardware initialisation */
3ef96221 1356static void scls_init(MachineState *machine)
a526a31c 1357{
3ef96221 1358 sun4m_hw_init(&sun4m_hwdefs[7], machine);
a526a31c
BS
1359}
1360
1361/* SPARCbook hardware initialisation */
3ef96221 1362static void sbook_init(MachineState *machine)
a526a31c 1363{
3ef96221 1364 sun4m_hw_init(&sun4m_hwdefs[8], machine);
a526a31c
BS
1365}
1366
8a661aea 1367static void ss5_class_init(ObjectClass *oc, void *data)
e264d29d 1368{
8a661aea
AF
1369 MachineClass *mc = MACHINE_CLASS(oc);
1370
e264d29d
EH
1371 mc->desc = "Sun4m platform, SPARCstation 5";
1372 mc->init = ss5_init;
1373 mc->block_default_type = IF_SCSI;
1374 mc->is_default = 1;
1375 mc->default_boot_order = "c";
49cbd887 1376 mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Fujitsu-MB86904");
e264d29d 1377}
e0353fe2 1378
8a661aea
AF
1379static const TypeInfo ss5_type = {
1380 .name = MACHINE_TYPE_NAME("SS-5"),
1381 .parent = TYPE_MACHINE,
1382 .class_init = ss5_class_init,
1383};
6a3b9cc9 1384
8a661aea 1385static void ss10_class_init(ObjectClass *oc, void *data)
e264d29d 1386{
8a661aea
AF
1387 MachineClass *mc = MACHINE_CLASS(oc);
1388
e264d29d
EH
1389 mc->desc = "Sun4m platform, SPARCstation 10";
1390 mc->init = ss10_init;
1391 mc->block_default_type = IF_SCSI;
1392 mc->max_cpus = 4;
1393 mc->default_boot_order = "c";
49cbd887 1394 mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-SuperSparc-II");
e264d29d 1395}
ae40972f 1396
8a661aea
AF
1397static const TypeInfo ss10_type = {
1398 .name = MACHINE_TYPE_NAME("SS-10"),
1399 .parent = TYPE_MACHINE,
1400 .class_init = ss10_class_init,
1401};
ae40972f 1402
8a661aea 1403static void ss600mp_class_init(ObjectClass *oc, void *data)
e264d29d 1404{
8a661aea
AF
1405 MachineClass *mc = MACHINE_CLASS(oc);
1406
e264d29d
EH
1407 mc->desc = "Sun4m platform, SPARCserver 600MP";
1408 mc->init = ss600mp_init;
1409 mc->block_default_type = IF_SCSI;
1410 mc->max_cpus = 4;
1411 mc->default_boot_order = "c";
49cbd887 1412 mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-SuperSparc-II");
e264d29d 1413}
a526a31c 1414
8a661aea
AF
1415static const TypeInfo ss600mp_type = {
1416 .name = MACHINE_TYPE_NAME("SS-600MP"),
1417 .parent = TYPE_MACHINE,
1418 .class_init = ss600mp_class_init,
1419};
a526a31c 1420
8a661aea 1421static void ss20_class_init(ObjectClass *oc, void *data)
e264d29d 1422{
8a661aea
AF
1423 MachineClass *mc = MACHINE_CLASS(oc);
1424
e264d29d
EH
1425 mc->desc = "Sun4m platform, SPARCstation 20";
1426 mc->init = ss20_init;
1427 mc->block_default_type = IF_SCSI;
1428 mc->max_cpus = 4;
1429 mc->default_boot_order = "c";
49cbd887 1430 mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-SuperSparc-II");
e264d29d 1431}
a526a31c 1432
8a661aea
AF
1433static const TypeInfo ss20_type = {
1434 .name = MACHINE_TYPE_NAME("SS-20"),
1435 .parent = TYPE_MACHINE,
1436 .class_init = ss20_class_init,
1437};
a526a31c 1438
8a661aea 1439static void voyager_class_init(ObjectClass *oc, void *data)
e264d29d 1440{
8a661aea
AF
1441 MachineClass *mc = MACHINE_CLASS(oc);
1442
e264d29d
EH
1443 mc->desc = "Sun4m platform, SPARCstation Voyager";
1444 mc->init = vger_init;
1445 mc->block_default_type = IF_SCSI;
1446 mc->default_boot_order = "c";
49cbd887 1447 mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Fujitsu-MB86904");
e264d29d
EH
1448}
1449
8a661aea
AF
1450static const TypeInfo voyager_type = {
1451 .name = MACHINE_TYPE_NAME("Voyager"),
1452 .parent = TYPE_MACHINE,
1453 .class_init = voyager_class_init,
1454};
e264d29d 1455
8a661aea 1456static void ss_lx_class_init(ObjectClass *oc, void *data)
e264d29d 1457{
8a661aea
AF
1458 MachineClass *mc = MACHINE_CLASS(oc);
1459
e264d29d
EH
1460 mc->desc = "Sun4m platform, SPARCstation LX";
1461 mc->init = ss_lx_init;
1462 mc->block_default_type = IF_SCSI;
1463 mc->default_boot_order = "c";
49cbd887 1464 mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-MicroSparc-I");
e264d29d
EH
1465}
1466
8a661aea
AF
1467static const TypeInfo ss_lx_type = {
1468 .name = MACHINE_TYPE_NAME("LX"),
1469 .parent = TYPE_MACHINE,
1470 .class_init = ss_lx_class_init,
1471};
e264d29d 1472
8a661aea 1473static void ss4_class_init(ObjectClass *oc, void *data)
e264d29d 1474{
8a661aea
AF
1475 MachineClass *mc = MACHINE_CLASS(oc);
1476
e264d29d
EH
1477 mc->desc = "Sun4m platform, SPARCstation 4";
1478 mc->init = ss4_init;
1479 mc->block_default_type = IF_SCSI;
1480 mc->default_boot_order = "c";
49cbd887 1481 mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Fujitsu-MB86904");
e264d29d
EH
1482}
1483
8a661aea
AF
1484static const TypeInfo ss4_type = {
1485 .name = MACHINE_TYPE_NAME("SS-4"),
1486 .parent = TYPE_MACHINE,
1487 .class_init = ss4_class_init,
1488};
e264d29d 1489
8a661aea 1490static void scls_class_init(ObjectClass *oc, void *data)
e264d29d 1491{
8a661aea
AF
1492 MachineClass *mc = MACHINE_CLASS(oc);
1493
e264d29d
EH
1494 mc->desc = "Sun4m platform, SPARCClassic";
1495 mc->init = scls_init;
1496 mc->block_default_type = IF_SCSI;
1497 mc->default_boot_order = "c";
49cbd887 1498 mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-MicroSparc-I");
e264d29d
EH
1499}
1500
8a661aea
AF
1501static const TypeInfo scls_type = {
1502 .name = MACHINE_TYPE_NAME("SPARCClassic"),
1503 .parent = TYPE_MACHINE,
1504 .class_init = scls_class_init,
1505};
e264d29d 1506
8a661aea 1507static void sbook_class_init(ObjectClass *oc, void *data)
e264d29d 1508{
8a661aea
AF
1509 MachineClass *mc = MACHINE_CLASS(oc);
1510
e264d29d
EH
1511 mc->desc = "Sun4m platform, SPARCbook";
1512 mc->init = sbook_init;
1513 mc->block_default_type = IF_SCSI;
1514 mc->default_boot_order = "c";
49cbd887 1515 mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-MicroSparc-I");
e264d29d
EH
1516}
1517
8a661aea
AF
1518static const TypeInfo sbook_type = {
1519 .name = MACHINE_TYPE_NAME("SPARCbook"),
1520 .parent = TYPE_MACHINE,
1521 .class_init = sbook_class_init,
1522};
a526a31c 1523
83f7d43a
AF
1524static void sun4m_register_types(void)
1525{
1526 type_register_static(&idreg_info);
1527 type_register_static(&afx_info);
1528 type_register_static(&prom_info);
1529 type_register_static(&ram_info);
83f7d43a 1530
8a661aea
AF
1531 type_register_static(&ss5_type);
1532 type_register_static(&ss10_type);
1533 type_register_static(&ss600mp_type);
1534 type_register_static(&ss20_type);
1535 type_register_static(&voyager_type);
1536 type_register_static(&ss_lx_type);
1537 type_register_static(&ss4_type);
1538 type_register_static(&scls_type);
1539 type_register_static(&sbook_type);
1540}
1541
83f7d43a 1542type_init(sun4m_register_types)