25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: machine_sgi.c,v 1.2 2006/02/03 17:25:14 debug Exp $ |
* $Id: machine_sgi.c,v 1.3 2006/02/19 08:04:17 debug Exp $ |
29 |
|
* |
30 |
|
* Machine descriptions for Silicon Graphics' MIPS-based machines. |
31 |
* |
* |
32 |
* http://obsolete.majix.org/computers/sgi/iptable.shtml contains a |
* http://obsolete.majix.org/computers/sgi/iptable.shtml contains a |
33 |
* pretty detailed list of IP ("Inhouse Processor") model numbers. |
* pretty detailed list of IP ("Inhouse Processor") model numbers. |
153 |
* int0 at mainbus0 addr 0x1fb801c0: bus 1MHz, CPU 2MHz |
* int0 at mainbus0 addr 0x1fb801c0: bus 1MHz, CPU 2MHz |
154 |
* imc0 at mainbus0 addr 0x1fa00000: revision 0 |
* imc0 at mainbus0 addr 0x1fa00000: revision 0 |
155 |
* gio0 at imc0 |
* gio0 at imc0 |
156 |
* unknown GIO card (product 0x00 revision 0x00) at gio0 slot 0 addr 0x1f400000 not configured |
* unknown GIO card (product 0x00 revision 0x00) |
157 |
* unknown GIO card (product 0x00 revision 0x00) at gio0 slot 1 addr 0x1f600000 not configured |
* at gio0 slot 0 addr 0x1f400000 not configured |
158 |
* unknown GIO card (product 0x00 revision 0x00) at gio0 slot 2 addr 0x1f000000 not configured |
* unknown GIO card (product 0x00 revision 0x00) |
159 |
|
* at gio0 slot 1 addr 0x1f600000 not configured |
160 |
|
* unknown GIO card (product 0x00 revision 0x00) |
161 |
|
* at gio0 slot 2 addr 0x1f000000 not configured |
162 |
* hpc0 at gio0 addr 0x1fb80000: SGI HPC1 |
* hpc0 at gio0 addr 0x1fb80000: SGI HPC1 |
163 |
* zsc0 at hpc0 offset 0xd10 (channels 0 and 1, channel 1 for console) |
* zsc0 at hpc0 offset 0xd10 (channels 0 and 1, |
164 |
|
* channel 1 for console) |
165 |
* zsc1 at hpc0 offset 0xd00 (2 channels) |
* zsc1 at hpc0 offset 0xd00 (2 channels) |
166 |
* sq0 at hpc0 offset 0x100: SGI Seeq 80c03 |
* sq0 at hpc0 offset 0x100: SGI Seeq 80c03 |
167 |
* wdsc0 at hpc0 offset 0x11f |
* wdsc0 at hpc0 offset 0x11f |
169 |
*/ |
*/ |
170 |
|
|
171 |
/* int0 at mainbus0 addr 0x1fb801c0 */ |
/* int0 at mainbus0 addr 0x1fb801c0 */ |
172 |
machine->md_int.sgi_ip20_data = dev_sgi_ip20_init(cpu, mem, DEV_SGI_IP20_BASE); |
machine->md_int.sgi_ip20_data = dev_sgi_ip20_init(cpu, mem, |
173 |
|
DEV_SGI_IP20_BASE); |
174 |
|
|
175 |
/* imc0 at mainbus0 addr 0x1fa00000: revision 0: TODO (or in dev_sgi_ip20?) */ |
/* imc0 at mainbus0 addr 0x1fa00000: revision 0: |
176 |
|
TODO (or in dev_sgi_ip20?) */ |
177 |
|
|
178 |
machine->main_console_handle = (size_t)device_add(machine, |
machine->main_console_handle = (size_t)device_add(machine, |
179 |
"z8530 addr=0x1fbd9830 irq=0 addr_mult=4"); |
"z8530 addr=0x1fbd9830 irq=0 addr_mult=4"); |
193 |
device_add(machine, "unreadable addr=0x1f980000 len=0x10000"); |
device_add(machine, "unreadable addr=0x1f980000 len=0x10000"); |
194 |
|
|
195 |
/* Return nothing for gio slots 0, 1, and 2: */ |
/* Return nothing for gio slots 0, 1, and 2: */ |
196 |
device_add(machine, "unreadable addr=0x1f400000 len=0x1000"); /* gio0 slot 0 */ |
device_add(machine, "unreadable addr=0x1f400000 len=0x1000"); |
197 |
device_add(machine, "unreadable addr=0x1f600000 len=0x1000"); /* gio0 slot 1 */ |
device_add(machine, "unreadable addr=0x1f600000 len=0x1000"); |
198 |
device_add(machine, "unreadable addr=0x1f000000 len=0x1000"); /* gio0 slot 2 */ |
device_add(machine, "unreadable addr=0x1f000000 len=0x1000"); |
199 |
|
|
200 |
break; |
break; |
201 |
|
|
215 |
strlcat(machine->machine_name, |
strlcat(machine->machine_name, |
216 |
" (Indy, Indigo2, Challenge S; Full-house)", |
" (Indy, Indigo2, Challenge S; Full-house)", |
217 |
MACHINE_NAME_MAXBUF); |
MACHINE_NAME_MAXBUF); |
218 |
machine->md_int.sgi_ip22_data = dev_sgi_ip22_init(machine, mem, 0x1fbd9000, 0); |
machine->md_int.sgi_ip22_data = |
219 |
|
dev_sgi_ip22_init(machine, mem, 0x1fbd9000, 0); |
220 |
} else { |
} else { |
221 |
strlcat(machine->machine_name, |
strlcat(machine->machine_name, |
222 |
" (Indy, Indigo2, Challenge S; Guiness)", |
" (Indy, Indigo2, Challenge S; Guiness)", |
223 |
MACHINE_NAME_MAXBUF); |
MACHINE_NAME_MAXBUF); |
224 |
machine->md_int.sgi_ip22_data = dev_sgi_ip22_init(machine, mem, 0x1fbd9880, 1); |
machine->md_int.sgi_ip22_data = |
225 |
|
dev_sgi_ip22_init(machine, mem, 0x1fbd9880, 1); |
226 |
} |
} |
227 |
|
|
228 |
/* |
/* |
255 |
* haltwo0 at hpc0 offset 0x58000: HAL2 revision 0.0.0 |
* haltwo0 at hpc0 offset 0x58000: HAL2 revision 0.0.0 |
256 |
* audio0 at haltwo0: half duplex |
* audio0 at haltwo0: half duplex |
257 |
* |
* |
258 |
* IRQ numbers are of the form 8 + x, where x = 0..31 for local0 |
* IRQ numbers are of the form 8 + x, where x=0..31 for local0 |
259 |
* interrupts, and 32..63 for local1. + y*65 for "mappable". |
* interrupts, and 32..63 for local1. + y*65 for "mappable". |
260 |
*/ |
*/ |
261 |
|
|
281 |
|
|
282 |
/* dsclock0: TODO: possibly irq 8 + 33 */ |
/* dsclock0: TODO: possibly irq 8 + 33 */ |
283 |
|
|
284 |
/* Return memory read errors so that hpc1 and hpc2 are not detected: */ |
/* Return memory read errors so that hpc1 and hpc2 are |
285 |
|
not detected: */ |
286 |
device_add(machine, "unreadable addr=0x1fb00000, len=0x10000"); |
device_add(machine, "unreadable addr=0x1fb00000, len=0x10000"); |
287 |
device_add(machine, "unreadable addr=0x1f980000, len=0x10000"); |
device_add(machine, "unreadable addr=0x1f980000, len=0x10000"); |
288 |
|
|
289 |
/* Similarly for gio slots 0, 1, and 2: */ |
/* Similarly for gio slots 0, 1, and 2: */ |
290 |
device_add(machine, "unreadable addr=0x1f400000, len=0x1000"); /* gio0 slot 0 */ |
device_add(machine, "unreadable addr=0x1f400000, len=0x1000"); |
291 |
device_add(machine, "unreadable addr=0x1f600000, len=0x1000"); /* gio0 slot 1 */ |
device_add(machine, "unreadable addr=0x1f600000, len=0x1000"); |
292 |
device_add(machine, "unreadable addr=0x1f000000, len=0x1000"); /* gio0 slot 2 */ |
device_add(machine, "unreadable addr=0x1f000000, len=0x1000"); |
293 |
|
|
294 |
break; |
break; |
295 |
|
|
353 |
strlcat(machine->machine_name, " (Octane)", |
strlcat(machine->machine_name, " (Octane)", |
354 |
MACHINE_NAME_MAXBUF); |
MACHINE_NAME_MAXBUF); |
355 |
|
|
356 |
machine->md_int.sgi_ip30_data = dev_sgi_ip30_init(machine, mem, 0x0ff00000); |
machine->md_int.sgi_ip30_data = |
357 |
|
dev_sgi_ip30_init(machine, mem, 0x0ff00000); |
358 |
machine->md_interrupt = sgi_ip30_interrupt; |
machine->md_interrupt = sgi_ip30_interrupt; |
359 |
|
|
360 |
dev_ram_init(machine, 0xa0000000ULL, 128 * 1048576, |
dev_ram_init(machine, 0xa0000000ULL, 128 * 1048576, |
371 |
* Something at paddr=f8000003c used by Linux/Octane |
* Something at paddr=f8000003c used by Linux/Octane |
372 |
* |
* |
373 |
* 16550 serial port at paddr=1f620178, addr mul 1 |
* 16550 serial port at paddr=1f620178, addr mul 1 |
374 |
* (Error messages are printed to this serial port by the PROM.) |
* (Error messages are printed to this serial port by |
375 |
|
* the PROM.) |
376 |
* |
* |
377 |
* There seems to also be a serial port at 1f620170. The "symmon" |
* There seems to also be a serial port at 1f620170. The |
378 |
* program dumps something there, but it doesn't look like |
* "symmon" program dumps something there, but it doesn't |
379 |
* readable text. (TODO) |
* look like readable text. (TODO) |
380 |
*/ |
*/ |
381 |
|
|
382 |
/* TODO: irq! */ |
/* TODO: irq! */ |
383 |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=0x1f620170 name2=tty0 in_use=%i", machine->use_x11? 0 : 1); |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=" |
384 |
machine->main_console_handle = (size_t)device_add(machine, tmpstr); |
"0x1f620170 name2=tty0 in_use=%i", machine->use_x11? 0 : 1); |
385 |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=0x1f620178 name2=tty1 in_use=0"); |
machine->main_console_handle = (size_t)device_add(machine, |
386 |
|
tmpstr); |
387 |
|
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=" |
388 |
|
"0x1f620178 name2=tty1 in_use=0"); |
389 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
390 |
|
|
391 |
/* MardiGras graphics: */ |
/* MardiGras graphics: */ |
397 |
strlcat(machine->machine_name, " (O2)", MACHINE_NAME_MAXBUF); |
strlcat(machine->machine_name, " (O2)", MACHINE_NAME_MAXBUF); |
398 |
machine->stable = 1; |
machine->stable = 1; |
399 |
|
|
400 |
/* TODO: Find out where the physical ram is actually located. */ |
/* TODO: Find out where the phys ram is actually located. */ |
401 |
dev_ram_init(machine, 0x07ffff00ULL, 256, DEV_RAM_MIRROR, 0x03ffff00); |
dev_ram_init(machine, 0x07ffff00ULL, 256, |
402 |
dev_ram_init(machine, 0x10000000ULL, 256, DEV_RAM_MIRROR, 0x00000000); |
DEV_RAM_MIRROR, 0x03ffff00); |
403 |
dev_ram_init(machine, 0x11ffff00ULL, 256, DEV_RAM_MIRROR, 0x01ffff00); |
dev_ram_init(machine, 0x10000000ULL, 256, |
404 |
dev_ram_init(machine, 0x12000000ULL, 256, DEV_RAM_MIRROR, 0x02000000); |
DEV_RAM_MIRROR, 0x00000000); |
405 |
dev_ram_init(machine, 0x17ffff00ULL, 256, DEV_RAM_MIRROR, 0x03ffff00); |
dev_ram_init(machine, 0x11ffff00ULL, 256, |
406 |
dev_ram_init(machine, 0x20000000ULL, 128 * 1048576, DEV_RAM_MIRROR, 0x00000000); |
DEV_RAM_MIRROR, 0x01ffff00); |
407 |
dev_ram_init(machine, 0x40000000ULL, 128 * 1048576, DEV_RAM_MIRROR, 0x10000000); |
dev_ram_init(machine, 0x12000000ULL, 256, |
408 |
|
DEV_RAM_MIRROR, 0x02000000); |
409 |
machine->md_int.ip32.crime_data = dev_crime_init(machine, mem, 0x14000000, 2, machine->use_x11); /* crime0 */ |
dev_ram_init(machine, 0x17ffff00ULL, 256, |
410 |
dev_sgi_mte_init(mem, 0x15000000); /* mte ??? memory thing */ |
DEV_RAM_MIRROR, 0x03ffff00); |
411 |
dev_sgi_gbe_init(machine, mem, 0x16000000); /* gbe? framebuffer? */ |
dev_ram_init(machine, 0x20000000ULL, 128 * 1048576, |
412 |
|
DEV_RAM_MIRROR, 0x00000000); |
413 |
|
dev_ram_init(machine, 0x40000000ULL, 128 * 1048576, |
414 |
|
DEV_RAM_MIRROR, 0x10000000); |
415 |
|
|
416 |
|
machine->md_int.ip32.crime_data = dev_crime_init(machine, |
417 |
|
mem, 0x14000000, 2, machine->use_x11); /* crime0 */ |
418 |
|
dev_sgi_mte_init(mem, 0x15000000); /* mte ??? */ |
419 |
|
dev_sgi_gbe_init(machine, mem, 0x16000000); /* gbe? */ |
420 |
|
|
421 |
/* |
/* |
422 |
* A combination of NetBSD and Linux info: |
* A combination of NetBSD and Linux info: |
431 |
* 1f300000 perif: |
* 1f300000 perif: |
432 |
* 1f300000 audio |
* 1f300000 audio |
433 |
* 1f310000 isa |
* 1f310000 isa |
434 |
* 1f318000 (accessed by Irix' pciio_pio_write64) |
* 1f318000 (accessed by Irix' |
435 |
|
* pciio_pio_write64) |
436 |
* 1f320000 kbdms |
* 1f320000 kbdms |
437 |
* 1f330000 i2c |
* 1f330000 i2c |
438 |
* 1f340000 ust |
* 1f340000 ust |
442 |
* 1f3a0000 mcclock0 |
* 1f3a0000 mcclock0 |
443 |
*/ |
*/ |
444 |
|
|
445 |
machine->md_int.ip32.mace_data = dev_mace_init(mem, 0x1f310000, 2); |
machine->md_int.ip32.mace_data = |
446 |
machine->md_interrupt = sgi_ip32_interrupt; |
dev_mace_init(mem, 0x1f310000, 2); |
447 |
|
machine->md_interrupt = sgi_ip32_interrupt; |
448 |
|
|
449 |
|
/* |
450 |
|
* IRQ mapping is really ugly. TODO: fix |
451 |
|
* |
452 |
|
* com0 at mace0 offset 0x390000 intr 4 intrmask |
453 |
|
* 0x3f00000: ns16550a, working fifo |
454 |
|
* com1 at mace0 offset 0x398000 intr 4 intrmask |
455 |
|
* 0xfc000000: ns16550a, working fifo |
456 |
|
* pckbc0 at mace0 offset 0x320000 intr 5 intrmask 0x0 |
457 |
|
* mcclock0 at mace0 offset 0x3a0000 intrmask 0x0 |
458 |
|
* macepci0 at mace0 offset 0x80000 intr 7 intrmask 0x0: rev 1 |
459 |
|
* |
460 |
|
* intr 4 = MACE_PERIPH_SERIAL |
461 |
|
* intr 5 = MACE_PERIPH_MISC |
462 |
|
* intr 7 = MACE_PCI_BRIDGE |
463 |
|
*/ |
464 |
|
|
465 |
|
if (eaddr_string == NULL) { |
466 |
|
fprintf(stderr, "out of memory\n"); |
467 |
|
exit(1); |
468 |
|
} |
469 |
|
snprintf(eaddr_string, ETHERNET_STRING_MAXLEN, |
470 |
|
"eaddr=%02x:%02x:%02x:%02x:%02x:%02x", |
471 |
|
macaddr[0], macaddr[1], macaddr[2], |
472 |
|
macaddr[3], macaddr[4], macaddr[5]); |
473 |
|
dev_sgi_mec_init(machine, mem, 0x1f280000, |
474 |
|
MACE_ETHERNET, macaddr); |
475 |
|
|
476 |
|
dev_sgi_ust_init(mem, 0x1f340000); /* ust? */ |
477 |
|
|
478 |
|
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%i addr=" |
479 |
|
"0x1f390000 addr_mult=0x100 in_use=%i name2=tty0", |
480 |
|
(1<<20) + MACE_PERIPH_SERIAL, machine->use_x11? 0 : 1); |
481 |
|
j = (size_t)device_add(machine, tmpstr); |
482 |
|
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%i addr=" |
483 |
|
"0x1f398000 addr_mult=0x100 in_use=%i name2=tty1", |
484 |
|
(1<<26) + MACE_PERIPH_SERIAL, 0); |
485 |
|
device_add(machine, tmpstr); |
486 |
|
|
487 |
/* |
machine->main_console_handle = j; |
488 |
* IRQ mapping is really ugly. TODO: fix |
|
489 |
* |
/* TODO: Once this works, it should be enabled |
490 |
* com0 at mace0 offset 0x390000 intr 4 intrmask 0x3f00000: ns16550a, working fifo |
always, not just when using X! */ |
491 |
* com1 at mace0 offset 0x398000 intr 4 intrmask 0xfc000000: ns16550a, working fifo |
if (machine->use_x11) { |
492 |
* pckbc0 at mace0 offset 0x320000 intr 5 intrmask 0x0 |
i = dev_pckbc_init(machine, mem, 0x1f320000, |
493 |
* mcclock0 at mace0 offset 0x3a0000 intrmask 0x0 |
PCKBC_8242, 0x200 + MACE_PERIPH_MISC, |
494 |
* macepci0 at mace0 offset 0x80000 intr 7 intrmask 0x0: rev 1 |
0x800 + MACE_PERIPH_MISC, machine->use_x11, 0); |
495 |
* |
/* keyb+mouse (mace irq numbers) */ |
496 |
* intr 4 = MACE_PERIPH_SERIAL |
machine->main_console_handle = i; |
497 |
* intr 5 = MACE_PERIPH_MISC |
} |
498 |
* intr 7 = MACE_PCI_BRIDGE |
|
499 |
*/ |
dev_mc146818_init(machine, mem, 0x1f3a0000, (1<<8) + |
500 |
|
MACE_PERIPH_MISC, MC146818_SGI, 0x40); /* mcclock0 */ |
501 |
if (eaddr_string == NULL) { |
machine->main_console_handle = (size_t)device_add(machine, |
502 |
fprintf(stderr, "out of memory\n"); |
"z8530 addr=0x1fbd9830 irq=0 addr_mult=4"); |
503 |
exit(1); |
|
504 |
} |
/* |
505 |
snprintf(eaddr_string, ETHERNET_STRING_MAXLEN, |
* PCI devices: (according to NetBSD's GENERIC |
506 |
"eaddr=%02x:%02x:%02x:%02x:%02x:%02x", |
* config file for sgimips) |
507 |
macaddr[0], macaddr[1], macaddr[2], |
* |
508 |
macaddr[3], macaddr[4], macaddr[5]); |
* ne* at pci? dev ? function ? |
509 |
dev_sgi_mec_init(machine, mem, 0x1f280000, |
* ahc0 at pci0 dev 1 function ? |
510 |
MACE_ETHERNET, macaddr); |
* ahc1 at pci0 dev 2 function ? |
511 |
|
*/ |
|
dev_sgi_ust_init(mem, 0x1f340000); /* ust? */ |
|
|
|
|
|
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%i addr=0x1f390000 addr_mult=0x100 in_use=%i name2=tty0", |
|
|
(1<<20) + MACE_PERIPH_SERIAL, machine->use_x11? 0 : 1); |
|
|
j = (size_t)device_add(machine, tmpstr); |
|
|
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%i addr=0x1f398000 addr_mult=0x100 in_use=%i name2=tty1", |
|
|
(1<<26) + MACE_PERIPH_SERIAL, 0); |
|
|
device_add(machine, tmpstr); |
|
|
|
|
|
machine->main_console_handle = j; |
|
|
|
|
|
/* TODO: Once this works, it should be enabled |
|
|
always, not just when using X! */ |
|
|
if (machine->use_x11) { |
|
|
i = dev_pckbc_init(machine, mem, 0x1f320000, |
|
|
PCKBC_8242, 0x200 + MACE_PERIPH_MISC, |
|
|
0x800 + MACE_PERIPH_MISC, machine->use_x11, 0); |
|
|
/* keyb+mouse (mace irq numbers) */ |
|
|
machine->main_console_handle = i; |
|
|
} |
|
|
|
|
|
dev_mc146818_init(machine, mem, 0x1f3a0000, (1<<8) + MACE_PERIPH_MISC, MC146818_SGI, 0x40); /* mcclock0 */ |
|
|
machine->main_console_handle = (size_t)device_add(machine, |
|
|
"z8530 addr=0x1fbd9830 irq=0 addr_mult=4"); |
|
|
|
|
|
/* |
|
|
* PCI devices: (according to NetBSD's GENERIC config file for sgimips) |
|
|
* |
|
|
* ne* at pci? dev ? function ? |
|
|
* ahc0 at pci0 dev 1 function ? |
|
|
* ahc1 at pci0 dev 2 function ? |
|
|
*/ |
|
512 |
|
|
513 |
pci_data = dev_macepci_init(machine, mem, 0x1f080000, MACE_PCI_BRIDGE); /* macepci0 */ |
pci_data = dev_macepci_init(machine, mem, 0x1f080000, |
514 |
/* bus_pci_add(machine, pci_data, mem, 0, 0, 0, "ne2000"); TODO */ |
MACE_PCI_BRIDGE); /* macepci0 */ |
515 |
|
/* bus_pci_add(machine, pci_data, mem, 0, 0, 0, |
516 |
|
"ne2000"); TODO */ |
517 |
|
|
518 |
/* TODO: make this nicer */ |
/* TODO: make this nicer */ |
519 |
if (diskimage_exist(machine, 0, DISKIMAGE_SCSI) || |
if (diskimage_exist(machine, 0, DISKIMAGE_SCSI) || |