/[gxemul]/upstream/0.4.4/src/machines/machine_sgi.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /upstream/0.4.4/src/machines/machine_sgi.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 35 - (hide annotations)
Mon Oct 8 16:21:26 2007 UTC (16 years, 7 months ago) by dpavlin
File MIME type: text/plain
File size: 21583 byte(s)
0.4.4
1 dpavlin 22 /*
2 dpavlin 34 * Copyright (C) 2003-2007 Anders Gavare. All rights reserved.
3 dpavlin 22 *
4     * Redistribution and use in source and binary forms, with or without
5     * modification, are permitted provided that the following conditions are met:
6     *
7     * 1. Redistributions of source code must retain the above copyright
8     * notice, this list of conditions and the following disclaimer.
9     * 2. Redistributions in binary form must reproduce the above copyright
10     * notice, this list of conditions and the following disclaimer in the
11     * documentation and/or other materials provided with the distribution.
12     * 3. The name of the author may not be used to endorse or promote products
13     * derived from this software without specific prior written permission.
14     *
15     * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16     * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17     * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18     * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19     * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20     * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21     * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22     * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23     * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24     * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25     * SUCH DAMAGE.
26     *
27     *
28 dpavlin 34 * $Id: machine_sgi.c,v 1.17 2007/02/18 09:19:48 debug Exp $
29 dpavlin 22 *
30 dpavlin 24 * Machine descriptions for Silicon Graphics' MIPS-based machines.
31     *
32 dpavlin 22 * http://obsolete.majix.org/computers/sgi/iptable.shtml contains a
33     * pretty detailed list of IP ("Inhouse Processor") model numbers.
34     *
35     * See also: http://hardware.majix.org/computers/sgi/iptable.shtml
36     */
37    
38     #include <stdio.h>
39     #include <stdlib.h>
40     #include <string.h>
41    
42     #include "arcbios.h"
43     #include "bus_pci.h"
44     #include "cpu.h"
45     #include "device.h"
46     #include "devices.h"
47     #include "diskimage.h"
48     #include "machine.h"
49     #include "memory.h"
50     #include "misc.h"
51     #include "net.h"
52    
53     #include "sgi_arcbios.h"
54     #include "crimereg.h"
55    
56    
57 dpavlin 28 #define ETHERNET_STRING_MAXLEN 40
58     #define MACHINE_NAME_MAXBUF 100
59 dpavlin 22
60    
61     MACHINE_SETUP(sgi)
62     {
63     uint64_t sgi_ram_offset = 0;
64     int arc_wordlen = sizeof(uint32_t);
65     struct memory *mem = machine->memory;
66     char tmpstr[1000];
67     int i, j;
68     char *eaddr_string = "eaddr=10:20:30:40:50:60"; /* bogus */
69     unsigned char macaddr[6];
70    
71     struct pci_data *pci_data = NULL;
72    
73     machine->machine_name = malloc(MACHINE_NAME_MAXBUF);
74     if (machine->machine_name == NULL) {
75     fprintf(stderr, "out of memory\n");
76     exit(1);
77     }
78    
79     cpu->byte_order = EMUL_BIG_ENDIAN;
80     snprintf(machine->machine_name, MACHINE_NAME_MAXBUF,
81     "SGI-IP%i", machine->machine_subtype);
82    
83     sgi_ram_offset = 1048576 * machine->memory_offset_in_mb;
84    
85     /* Special cases for IP20,22,24,26 memory offset: */
86     if (machine->machine_subtype == 20 || machine->machine_subtype == 22 ||
87     machine->machine_subtype == 24 || machine->machine_subtype == 26) {
88     dev_ram_init(machine, 0x00000000, 0x10000, DEV_RAM_MIRROR
89     | DEV_RAM_MIGHT_POINT_TO_DEVICES, sgi_ram_offset);
90     dev_ram_init(machine, 0x00050000, sgi_ram_offset-0x50000,
91     DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES,
92     sgi_ram_offset + 0x50000);
93     }
94    
95     /* Special cases for IP28,30 memory offset: */
96     if (machine->machine_subtype == 28 || machine->machine_subtype == 30) {
97     /* TODO: length below should maybe not be 128MB? */
98     dev_ram_init(machine, 0x00000000, 128*1048576, DEV_RAM_MIRROR
99     | DEV_RAM_MIGHT_POINT_TO_DEVICES, sgi_ram_offset);
100     }
101    
102     net_generate_unique_mac(machine, macaddr);
103     eaddr_string = malloc(ETHERNET_STRING_MAXLEN);
104    
105     switch (machine->machine_subtype) {
106    
107     case 10:
108     strlcat(machine->machine_name, " (4D/25)", MACHINE_NAME_MAXBUF);
109     /* TODO */
110     break;
111    
112     case 12:
113     strlcat(machine->machine_name,
114     " (Iris Indigo IP12)", MACHINE_NAME_MAXBUF);
115    
116     /* TODO */
117     /* 33 MHz R3000, according to http://www.irisindigo.com/ */
118     /* "capable of addressing up to 96MB of memory." */
119    
120     break;
121    
122     case 19:
123     strlcat(machine->machine_name,
124     " (Everest IP19)", MACHINE_NAME_MAXBUF);
125     machine->main_console_handle = (size_t)device_add(machine,
126     "z8530 addr=0x1fbd9830 irq=0 addr_mult=4");
127     dev_scc_init(machine, mem, 0x10086000, 0, machine->use_x11,
128     0, 8); /* serial? irix? */
129    
130     device_add(machine, "sgi_ip19 addr=0x18000000");
131    
132     /* Irix' <everest_du_init+0x130> reads this device: */
133     device_add(machine, "random addr=0x10006000 len=16");
134    
135     /* Irix' get_mpconf() looks for this: (TODO) */
136     store_32bit_word(cpu, 0xa0000000 + 0x3000,
137     0xbaddeed2);
138    
139     /* Memory size, not 4096 byte pages, but 256 bytes?
140     (16 is size of kernel... approx) */
141     store_32bit_word(cpu, 0xa0000000 + 0x26d0, 30000);
142     /* (machine->physical_ram_in_mb - 16) * (1048576 / 256)); */
143    
144     break;
145    
146     case 20:
147     strlcat(machine->machine_name,
148     " (Indigo)", MACHINE_NAME_MAXBUF);
149    
150     /*
151     * Guesses based on NetBSD 2.0 beta, 20040606.
152     *
153     * int0 at mainbus0 addr 0x1fb801c0: bus 1MHz, CPU 2MHz
154     * imc0 at mainbus0 addr 0x1fa00000: revision 0
155     * gio0 at imc0
156 dpavlin 24 * unknown GIO card (product 0x00 revision 0x00)
157     * at gio0 slot 0 addr 0x1f400000 not configured
158     * 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 dpavlin 22 * hpc0 at gio0 addr 0x1fb80000: SGI HPC1
163 dpavlin 24 * zsc0 at hpc0 offset 0xd10 (channels 0 and 1,
164     * channel 1 for console)
165 dpavlin 22 * zsc1 at hpc0 offset 0xd00 (2 channels)
166     * sq0 at hpc0 offset 0x100: SGI Seeq 80c03
167     * wdsc0 at hpc0 offset 0x11f
168     * dpclock0 at hpc0 offset 0xe00
169     */
170    
171     /* int0 at mainbus0 addr 0x1fb801c0 */
172 dpavlin 34 fatal("TODO: SGI legacy interrupt system rewrite!\n");
173     abort();
174     // machine->md_int.sgi_ip20_data = dev_sgi_ip20_init(cpu, mem,
175     // DEV_SGI_IP20_BASE);
176 dpavlin 22
177 dpavlin 24 /* imc0 at mainbus0 addr 0x1fa00000: revision 0:
178     TODO (or in dev_sgi_ip20?) */
179 dpavlin 22
180     machine->main_console_handle = (size_t)device_add(machine,
181     "z8530 addr=0x1fbd9830 irq=0 addr_mult=4");
182    
183     /* This is the zsc0 reported by NetBSD: TODO: irqs */
184     machine->main_console_handle = (size_t)device_add(machine,
185     "z8530 addr=0x1fb80d10 irq=0 addr_mult=4");
186     machine->main_console_handle = (size_t)device_add(machine,
187     "z8530 addr=0x1fb80d00 irq=0 addr_mult=4");
188    
189     /* WDSC SCSI controller: */
190     dev_wdsc_init(machine, mem, 0x1fb8011f, 0, 0);
191    
192     /* Return memory read errors so that hpc1
193     and hpc2 are not detected: */
194     device_add(machine, "unreadable addr=0x1fb00000 len=0x10000");
195     device_add(machine, "unreadable addr=0x1f980000 len=0x10000");
196    
197     /* Return nothing for gio slots 0, 1, and 2: */
198 dpavlin 24 device_add(machine, "unreadable addr=0x1f400000 len=0x1000");
199     device_add(machine, "unreadable addr=0x1f600000 len=0x1000");
200     device_add(machine, "unreadable addr=0x1f000000 len=0x1000");
201 dpavlin 22
202     break;
203    
204     case 21:
205     strlcat(machine->machine_name, /* TODO */
206     " (uknown SGI-IP21 ?)", MACHINE_NAME_MAXBUF);
207     /* NOTE: Special case for arc_wordlen: */
208     arc_wordlen = sizeof(uint64_t);
209    
210     device_add(machine, "random addr=0x418000200, len=0x20000");
211    
212     break;
213    
214     case 22:
215     case 24:
216     if (machine->machine_subtype == 22) {
217     strlcat(machine->machine_name,
218     " (Indy, Indigo2, Challenge S; Full-house)",
219     MACHINE_NAME_MAXBUF);
220 dpavlin 34 fatal("TODO: SGI legacy interrupt system rewrite!\n");
221     abort();
222     // machine->md_int.sgi_ip22_data =
223     // dev_sgi_ip22_init(machine, mem, 0x1fbd9000, 0);
224 dpavlin 22 } else {
225     strlcat(machine->machine_name,
226     " (Indy, Indigo2, Challenge S; Guiness)",
227     MACHINE_NAME_MAXBUF);
228 dpavlin 34 fatal("TODO: SGI legacy interrupt system rewrite!\n");
229     abort();
230     // machine->md_int.sgi_ip22_data =
231     // dev_sgi_ip22_init(machine, mem, 0x1fbd9880, 1);
232 dpavlin 22 }
233    
234     /*
235     Why is this here? TODO
236     dev_ram_init(machine, 0x88000000ULL,
237     128 * 1048576, DEV_RAM_MIRROR, 0x08000000);
238     */
239    
240 dpavlin 34 fatal("TODO: Legacy rewrite\n");
241     abort();
242     // machine->md_interrupt = sgi_ip22_interrupt;
243    
244 dpavlin 22 /*
245     * According to NetBSD 1.6.2:
246     *
247     * imc0 at mainbus0 addr 0x1fa00000, Revision 0
248     * gio0 at imc0
249     * hpc0 at gio0 addr 0x1fb80000: SGI HPC3
250     * zsc0 at hpc0 offset 0x59830
251     * zstty0 at zsc0 channel 1 (console i/o)
252     * zstty1 at zsc0 channel 0
253     * sq0 at hpc0 offset 0x54000: SGI Seeq 80c03 (Ethernet)
254     * wdsc0 at hpc0 offset 0x44000: WD33C93 SCSI, rev=0, target 7
255     * scsibus2 at wdsc0: 8 targets, 8 luns per target
256     * dsclock0 at hpc0 offset 0x60000
257     *
258     * According to Linux/IP22:
259     * tty00 at 0xbfbd9830 (irq = 45) is a Zilog8530
260     * tty01 at 0xbfbd9838 (irq = 45) is a Zilog8530
261     *
262     * and according to NetBSD 2.0_BETA (20040606):
263     *
264     * haltwo0 at hpc0 offset 0x58000: HAL2 revision 0.0.0
265     * audio0 at haltwo0: half duplex
266     *
267 dpavlin 24 * IRQ numbers are of the form 8 + x, where x=0..31 for local0
268 dpavlin 22 * interrupts, and 32..63 for local1. + y*65 for "mappable".
269     */
270    
271     /* zsc0 serial console. 8 + 32 + 3 + 64*5 = 43+64*5 = 363 */
272     i = (size_t)device_add(machine,
273     "z8530 addr=0x1fbd9830 irq=363 addr_mult=4");
274    
275     /* Not supported by NetBSD 1.6.2, but by 2.0_BETA: */
276 dpavlin 34 fatal("TODO: legacy rewrite\n");
277     abort();
278     // j = dev_pckbc_init(machine, mem, 0x1fbd9840, PCKBC_8242,
279     // 0, 0, machine->use_x11, 0); /* TODO: irq numbers */
280 dpavlin 22
281     if (machine->use_x11)
282     machine->main_console_handle = j;
283    
284     /* sq0: Ethernet. TODO: This should have irq_nr = 8 + 3 */
285     /* dev_sq_init... */
286    
287     /* wdsc0: SCSI */
288     dev_wdsc_init(machine, mem, 0x1fbc4000, 0, 8 + 1);
289    
290     /* wdsc1: SCSI TODO: irq nr */
291     dev_wdsc_init(machine, mem, 0x1fbcc000, 1, 8 + 1);
292    
293     /* dsclock0: TODO: possibly irq 8 + 33 */
294    
295 dpavlin 24 /* Return memory read errors so that hpc1 and hpc2 are
296     not detected: */
297 dpavlin 22 device_add(machine, "unreadable addr=0x1fb00000, len=0x10000");
298     device_add(machine, "unreadable addr=0x1f980000, len=0x10000");
299    
300     /* Similarly for gio slots 0, 1, and 2: */
301 dpavlin 24 device_add(machine, "unreadable addr=0x1f400000, len=0x1000");
302     device_add(machine, "unreadable addr=0x1f600000, len=0x1000");
303     device_add(machine, "unreadable addr=0x1f000000, len=0x1000");
304 dpavlin 22
305     break;
306    
307     case 25:
308     /* NOTE: Special case for arc_wordlen: */
309     arc_wordlen = sizeof(uint64_t);
310     strlcat(machine->machine_name,
311     " (Everest IP25)", MACHINE_NAME_MAXBUF);
312    
313     /* serial? irix? */
314     dev_scc_init(machine, mem,
315     0x400086000ULL, 0, machine->use_x11, 0, 8);
316    
317     /* NOTE: ip19! (perhaps not really the same */
318     device_add(machine, "sgi_ip19 addr=0x18000000");
319    
320     /*
321     * Memory size, not 4096 byte pages, but 256
322     * bytes? (16 is size of kernel... approx)
323     */
324     store_32bit_word(cpu, 0xa0000000ULL + 0x26d0,
325     30000); /* (machine->physical_ram_in_mb - 16)
326     * (1048576 / 256)); */
327    
328     break;
329    
330     case 26:
331     /* NOTE: Special case for arc_wordlen: */
332     arc_wordlen = sizeof(uint64_t);
333     strlcat(machine->machine_name, " (uknown SGI-IP26 ?)",
334     MACHINE_NAME_MAXBUF); /* TODO */
335     machine->main_console_handle = (size_t)device_add(machine,
336     "z8530 addr=0x1fbd9830 irq=0 addr_mult=4");
337     break;
338    
339     case 27:
340     strlcat(machine->machine_name, " (Origin 200/2000, Onyx2)",
341     MACHINE_NAME_MAXBUF);
342     arc_wordlen = sizeof(uint64_t);
343     /* 2 cpus per node */
344    
345     machine->main_console_handle = (size_t)device_add(machine,
346     "z8530 addr=0x1fbd9830 irq=0 addr_mult=4");
347     break;
348    
349     case 28:
350     /* NOTE: Special case for arc_wordlen: */
351     arc_wordlen = sizeof(uint64_t);
352     strlcat(machine->machine_name,
353     " (Impact Indigo2 ?)", MACHINE_NAME_MAXBUF);
354    
355     device_add(machine, "random addr=0x1fbe0000, len=1");
356    
357     /* Something at paddr 0x1880fb0000. */
358    
359     break;
360    
361     case 30:
362     /* NOTE: Special case for arc_wordlen: */
363     arc_wordlen = sizeof(uint64_t);
364     strlcat(machine->machine_name, " (Octane)",
365     MACHINE_NAME_MAXBUF);
366    
367 dpavlin 34 fatal("TODO: SGI legacy interrupt system rewrite!\n");
368     abort();
369     // machine->md_int.sgi_ip30_data =
370     // dev_sgi_ip30_init(machine, mem, 0x0ff00000);
371 dpavlin 22
372 dpavlin 34 fatal("TODO: Legacy rewrite\n");
373     abort();
374     // machine->md_interrupt = sgi_ip30_interrupt;
375    
376 dpavlin 22 dev_ram_init(machine, 0xa0000000ULL, 128 * 1048576,
377     DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES,
378     0x00000000);
379    
380     dev_ram_init(machine, 0x80000000ULL,
381     32 * 1048576, DEV_RAM_RAM, 0x00000000);
382    
383     /*
384     * Something at paddr=1f022004: TODO
385     * Something at paddr=813f0510 - paddr=813f0570 ?
386     * Something at paddr=813f04b8
387     * Something at paddr=f8000003c used by Linux/Octane
388     *
389     * 16550 serial port at paddr=1f620178, addr mul 1
390 dpavlin 24 * (Error messages are printed to this serial port by
391     * the PROM.)
392 dpavlin 22 *
393 dpavlin 24 * There seems to also be a serial port at 1f620170. The
394     * "symmon" program dumps something there, but it doesn't
395     * look like readable text. (TODO)
396 dpavlin 22 */
397    
398     /* TODO: irq! */
399 dpavlin 24 snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr="
400     "0x1f620170 name2=tty0 in_use=%i", machine->use_x11? 0 : 1);
401     machine->main_console_handle = (size_t)device_add(machine,
402     tmpstr);
403     snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr="
404     "0x1f620178 name2=tty1 in_use=0");
405 dpavlin 22 device_add(machine, tmpstr);
406    
407     /* MardiGras graphics: */
408     device_add(machine, "sgi_mardigras addr=0x1c000000");
409    
410     break;
411    
412     case 32:
413     strlcat(machine->machine_name, " (O2)", MACHINE_NAME_MAXBUF);
414     machine->stable = 1;
415    
416 dpavlin 24 /* TODO: Find out where the phys ram is actually located. */
417     dev_ram_init(machine, 0x07ffff00ULL, 256,
418     DEV_RAM_MIRROR, 0x03ffff00);
419     dev_ram_init(machine, 0x10000000ULL, 256,
420     DEV_RAM_MIRROR, 0x00000000);
421     dev_ram_init(machine, 0x11ffff00ULL, 256,
422     DEV_RAM_MIRROR, 0x01ffff00);
423     dev_ram_init(machine, 0x12000000ULL, 256,
424     DEV_RAM_MIRROR, 0x02000000);
425     dev_ram_init(machine, 0x17ffff00ULL, 256,
426     DEV_RAM_MIRROR, 0x03ffff00);
427     dev_ram_init(machine, 0x20000000ULL, 128 * 1048576,
428     DEV_RAM_MIRROR, 0x00000000);
429     dev_ram_init(machine, 0x40000000ULL, 128 * 1048576,
430     DEV_RAM_MIRROR, 0x10000000);
431 dpavlin 22
432 dpavlin 34 /* Connect CRIME (Interrupt Controller) to MIPS irq 2: */
433     snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2",
434     machine->path, machine->bootstrap_cpu);
435     dev_crime_init(machine, mem, 0x14000000, tmpstr,
436     machine->use_x11); /* crime0 */
437 dpavlin 24 dev_sgi_mte_init(mem, 0x15000000); /* mte ??? */
438     dev_sgi_gbe_init(machine, mem, 0x16000000); /* gbe? */
439 dpavlin 22
440     /*
441     * A combination of NetBSD and Linux info:
442     *
443     * 17000000 vice (Video Image Compression Engine)
444     * 1f000000 mace
445     * 1f080000 macepci
446     * 1f100000 vin1
447     * 1f180000 vin2
448     * 1f200000 vout
449     * 1f280000 enet (mec0, MAC-110 Ethernet)
450     * 1f300000 perif:
451     * 1f300000 audio
452     * 1f310000 isa
453 dpavlin 24 * 1f318000 (accessed by Irix'
454     * pciio_pio_write64)
455 dpavlin 22 * 1f320000 kbdms
456     * 1f330000 i2c
457     * 1f340000 ust
458     * 1f380000 isa ext
459     * 1f390000 com0 (serial)
460     * 1f398000 com1 (serial)
461     * 1f3a0000 mcclock0
462     */
463    
464 dpavlin 24 /*
465     * IRQ mapping is really ugly. TODO: fix
466     *
467     * com0 at mace0 offset 0x390000 intr 4 intrmask
468     * 0x3f00000: ns16550a, working fifo
469     * com1 at mace0 offset 0x398000 intr 4 intrmask
470     * 0xfc000000: ns16550a, working fifo
471     * pckbc0 at mace0 offset 0x320000 intr 5 intrmask 0x0
472     * mcclock0 at mace0 offset 0x3a0000 intrmask 0x0
473     * macepci0 at mace0 offset 0x80000 intr 7 intrmask 0x0: rev 1
474     *
475     * intr 4 = MACE_PERIPH_SERIAL
476     * intr 5 = MACE_PERIPH_MISC
477     * intr 7 = MACE_PCI_BRIDGE
478     */
479 dpavlin 22
480 dpavlin 24 if (eaddr_string == NULL) {
481     fprintf(stderr, "out of memory\n");
482     exit(1);
483     }
484     snprintf(eaddr_string, ETHERNET_STRING_MAXLEN,
485     "eaddr=%02x:%02x:%02x:%02x:%02x:%02x",
486     macaddr[0], macaddr[1], macaddr[2],
487     macaddr[3], macaddr[4], macaddr[5]);
488 dpavlin 34
489     snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2.crime.0x%x",
490     machine->path, machine->bootstrap_cpu, MACE_ETHERNET);
491 dpavlin 24 dev_sgi_mec_init(machine, mem, 0x1f280000,
492 dpavlin 34 tmpstr, macaddr);
493 dpavlin 22
494 dpavlin 24 dev_sgi_ust_init(mem, 0x1f340000); /* ust? */
495 dpavlin 22
496 dpavlin 34 snprintf(tmpstr, sizeof(tmpstr),
497     "ns16550 irq=%s.cpu[%i].2.crime.0x%x.mace.%i addr="
498 dpavlin 24 "0x1f390000 addr_mult=0x100 in_use=%i name2=tty0",
499 dpavlin 34 machine->path, machine->bootstrap_cpu,
500     MACE_PERIPH_SERIAL, 20, machine->use_x11? 0 : 1);
501 dpavlin 24 j = (size_t)device_add(machine, tmpstr);
502 dpavlin 34 snprintf(tmpstr, sizeof(tmpstr),
503     "ns16550 irq=%s.cpu[%i].2.crime.0x%x.mace.%i addr="
504 dpavlin 24 "0x1f398000 addr_mult=0x100 in_use=%i name2=tty1",
505 dpavlin 34 machine->path, machine->bootstrap_cpu,
506     MACE_PERIPH_SERIAL, 26, 0);
507 dpavlin 24 device_add(machine, tmpstr);
508 dpavlin 22
509 dpavlin 24 machine->main_console_handle = j;
510 dpavlin 22
511 dpavlin 24 /* TODO: Once this works, it should be enabled
512     always, not just when using X! */
513 dpavlin 34 #if 0
514     fatal("TODO: legacy SGI rewrite\n");
515     abort();
516 dpavlin 24 if (machine->use_x11) {
517     i = dev_pckbc_init(machine, mem, 0x1f320000,
518     PCKBC_8242, 0x200 + MACE_PERIPH_MISC,
519     0x800 + MACE_PERIPH_MISC, machine->use_x11, 0);
520     /* keyb+mouse (mace irq numbers) */
521     machine->main_console_handle = i;
522     }
523 dpavlin 34 #endif
524 dpavlin 22
525 dpavlin 34 snprintf(tmpstr, sizeof(tmpstr),
526     "%s.cpu[%i].2.crime.0x%x.mace.%i",
527     machine->path, machine->bootstrap_cpu,
528     MACE_PERIPH_MISC, 8);
529     dev_mc146818_init(machine, mem, 0x1f3a0000, tmpstr,
530     MC146818_SGI, 0x40); /* mcclock0 */
531 dpavlin 22
532 dpavlin 34 /* TODO: _WHERE_ does the z8530 interrupt? */
533     snprintf(tmpstr, sizeof(tmpstr), "z8530 addr=0x1fbd9830 "
534     "irq=%s.cpu[%i].2 addr_mult=4",
535     machine->path, machine->bootstrap_cpu);
536     machine->main_console_handle = (size_t)
537     device_add(machine, tmpstr);
538    
539 dpavlin 24 /*
540     * PCI devices: (according to NetBSD's GENERIC
541     * config file for sgimips)
542     *
543     * ne* at pci? dev ? function ?
544     * ahc0 at pci0 dev 1 function ?
545     * ahc1 at pci0 dev 2 function ?
546     */
547 dpavlin 22
548 dpavlin 34 snprintf(tmpstr, sizeof(tmpstr),
549     "%s.cpu[%i].2.crime.0x%x", machine->path,
550     machine->bootstrap_cpu, MACE_PCI_BRIDGE);
551 dpavlin 24 pci_data = dev_macepci_init(machine, mem, 0x1f080000,
552 dpavlin 34 tmpstr); /* macepci0 */
553 dpavlin 24 /* bus_pci_add(machine, pci_data, mem, 0, 0, 0,
554     "ne2000"); TODO */
555 dpavlin 22
556     /* TODO: make this nicer */
557     if (diskimage_exist(machine, 0, DISKIMAGE_SCSI) ||
558     diskimage_exist(machine, 1, DISKIMAGE_SCSI) ||
559     diskimage_exist(machine, 2, DISKIMAGE_SCSI) ||
560     diskimage_exist(machine, 3, DISKIMAGE_SCSI) ||
561     diskimage_exist(machine, 4, DISKIMAGE_SCSI) ||
562     diskimage_exist(machine, 5, DISKIMAGE_SCSI) ||
563     diskimage_exist(machine, 6, DISKIMAGE_SCSI) ||
564     diskimage_exist(machine, 7, DISKIMAGE_SCSI))
565     bus_pci_add(machine, pci_data, mem, 0, 1, 0, "ahc");
566    
567     /* TODO: second ahc */
568     /* bus_pci_add(machine, pci_data, mem, 0, 2, 0, "ahc"); */
569    
570 dpavlin 32 /*
571     * An additional PCI IDE controller, for NetBSD/sgimips
572     * experiments: (Not found in a regular O2.)
573     */
574     bus_pci_add(machine, pci_data, mem, 0, 3, 0, "symphony_82c105");
575    
576 dpavlin 22 break;
577    
578     case 35:
579     strlcat(machine->machine_name,
580     " (Origin 3000)", MACHINE_NAME_MAXBUF);
581     /* 4 cpus per node */
582    
583     machine->main_console_handle = (size_t)device_add(machine,
584     "z8530 addr=0x1fbd9830 irq=0 addr_mult=4");
585     break;
586    
587     case 53:
588     strlcat(machine->machine_name, " (Origin 350)",
589     MACHINE_NAME_MAXBUF);
590    
591     /*
592     * According to http://kumba.drachentekh.net/xml/myguide.html
593     * Origin 350, Tezro IP53 R16000
594     */
595     break;
596    
597     default:
598     fatal("unimplemented SGI machine type IP%i\n",
599     machine->machine_subtype);
600     exit(1);
601     }
602    
603     if (!machine->prom_emulation)
604     return;
605    
606     arcbios_init(machine, arc_wordlen == sizeof(uint64_t), sgi_ram_offset,
607     eaddr_string, macaddr);
608     }
609    
610    
611     MACHINE_DEFAULT_CPU(sgi)
612     {
613     if (machine->machine_subtype <= 12)
614     machine->cpu_name = strdup("R3000");
615     if (machine->cpu_name == NULL && machine->machine_subtype == 35)
616     machine->cpu_name = strdup("R12000");
617     if (machine->cpu_name == NULL && (machine->machine_subtype == 25 ||
618     machine->machine_subtype == 27 || machine->machine_subtype == 28 ||
619     machine->machine_subtype == 30 || machine->machine_subtype == 32))
620     machine->cpu_name = strdup("R10000");
621     if (machine->cpu_name == NULL && (machine->machine_subtype == 21 ||
622     machine->machine_subtype == 26))
623     machine->cpu_name = strdup("R8000");
624     if (machine->cpu_name == NULL && machine->machine_subtype == 24)
625     machine->cpu_name = strdup("R5000");
626    
627     /* Other SGIs should probably work with
628     R4000, R4400 or R5000 or similar: */
629     if (machine->cpu_name == NULL)
630     machine->cpu_name = strdup("R4400");
631     }
632    
633    
634     MACHINE_DEFAULT_RAM(sgi)
635     {
636     machine->physical_ram_in_mb = 64;
637     }
638    
639    
640     MACHINE_REGISTER(sgi)
641     {
642 dpavlin 26 MR_DEFAULT(sgi, "SGI", ARCH_MIPS, MACHINE_SGI);
643    
644 dpavlin 22 me->set_default_ram = machine_default_ram_sgi;
645    
646 dpavlin 26 machine_entry_add_alias(me, "silicon graphics");
647     machine_entry_add_alias(me, "sgi");
648 dpavlin 22
649 dpavlin 26 machine_entry_add_subtype(me, "IP12", 12, "ip12", NULL);
650 dpavlin 22
651 dpavlin 26 machine_entry_add_subtype(me, "IP19", 19, "ip19", NULL);
652 dpavlin 22
653 dpavlin 26 machine_entry_add_subtype(me, "IP20", 20, "ip20", NULL);
654 dpavlin 22
655 dpavlin 26 machine_entry_add_subtype(me, "IP22", 22, "ip22", "indy", NULL);
656 dpavlin 22
657 dpavlin 26 machine_entry_add_subtype(me, "IP24", 24, "ip24", NULL);
658 dpavlin 22
659 dpavlin 26 machine_entry_add_subtype(me, "IP27", 27,
660     "ip27", "origin 200", "origin 2000", NULL);
661 dpavlin 22
662 dpavlin 26 machine_entry_add_subtype(me, "IP28", 28, "ip28", NULL);
663 dpavlin 22
664 dpavlin 26 machine_entry_add_subtype(me, "IP30", 30, "ip30", "octane", NULL);
665 dpavlin 22
666 dpavlin 26 machine_entry_add_subtype(me, "IP32", 32, "ip32", "o2", NULL);
667 dpavlin 22
668 dpavlin 26 machine_entry_add_subtype(me, "IP35", 35, "ip35", NULL);
669 dpavlin 22 }
670    

  ViewVC Help
Powered by ViewVC 1.1.26