/[gxemul]/trunk/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 /trunk/src/machines/machine_sgi.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 38 - (hide annotations)
Mon Oct 8 16:21:53 2007 UTC (16 years, 7 months ago) by dpavlin
File MIME type: text/plain
File size: 21590 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.1515 2007/04/14 05:39:46 debug Exp $
20070324	Adding a "--debug" option to the configure script, to disable
		optimizations in unstable development builds.
		Moving out SCSI-specific stuff from diskimage.c into a new
		diskimage_scsicmd.c.
		Applying Hĺvard Eidnes' patch for SCSICDROM_READ_DISKINFO and
		SCSICDROM_READ_TRACKINFO. (Not really tested yet.)
		Implementing disk image "overlays" (to allow simple roll-back
		to previous disk state). Adding a 'V' disk flag for this, and
		updating the man page and misc.html.
20070325	Stability fix to cpu_dyntrans.c, when multiple physical pages
		share the same initial table entry. (The ppp == NULL check
		should be physpage_ofs == 0.) Bug found by analysing GXemul
		against a version patched for Godson.
		Fixing a second occurance of the same problem (also in
		cpu_dyntrans.c).
		Fixing a MAJOR physical page leak in cpu_dyntrans.c; pages
		weren't _added_ to the set of translated pages, they _replaced_
		all previous pages. It's amazing that this bug has been able
		to live for this long. (Triggered when emulating >128MB RAM.)
20070326	Removing the GDB debugging stub support; it was too hackish
		and ugly.
20070328	Moving around some native code generation skeleton code.
20070329	The -lm check in the configure script now also checks for sin()
		in addition to sqrt(). (Thanks to Nigel Horne for noticing that
		sqrt was not enough on Fedora Core 6.) (Not verified yet.)
20070330	Fixing an indexing bug in dev_sh4.c, found by using gcc version
		4.3.0 20070323.
20070331	Some more experimentation with native code generation.
20070404	Attempting to fix some more SH4 SCIF interrupt bugs; rewriting
		the SH interrupt assertion/deassertion code somewhat.
20070410	Splitting src/file.c into separate files in src/file/.
		Cleanup: Removing the dummy TS7200, Walnut, PB1000, and
		Meshcube emulation modes, and dev_epcom and dev_au1x00.
		Removing the experimental CHIP8/RCA180x code; it wasn't really
		working much lately, anyway. It was fun while it lasted.
		Also removing the experimental Transputer CPU support.
20070412	Moving the section about how the dynamic translation system
		works from intro.html to a separate translation.html file.
		Minor SH fixes; attempting to get OpenBSD/landisk to run
		without randomly bugging out, but no success yet.
20070413	SH SCI (serial bit interface) should now work together with a
		(new) RS5C313 clock device (for Landisk emulation).
20070414	Moving Redhat/MIPS down from supported to experimental, in
		guestoses.html.
		Preparing for a new release; doing some regression testing etc.

==============  RELEASE 0.4.5  ==============


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 38 * $Id: machine_sgi.c,v 1.18 2007/03/24 06:40:16 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 38 j = 0;
281 dpavlin 22
282     if (machine->use_x11)
283     machine->main_console_handle = j;
284    
285     /* sq0: Ethernet. TODO: This should have irq_nr = 8 + 3 */
286     /* dev_sq_init... */
287    
288     /* wdsc0: SCSI */
289     dev_wdsc_init(machine, mem, 0x1fbc4000, 0, 8 + 1);
290    
291     /* wdsc1: SCSI TODO: irq nr */
292     dev_wdsc_init(machine, mem, 0x1fbcc000, 1, 8 + 1);
293    
294     /* dsclock0: TODO: possibly irq 8 + 33 */
295    
296 dpavlin 24 /* Return memory read errors so that hpc1 and hpc2 are
297     not detected: */
298 dpavlin 22 device_add(machine, "unreadable addr=0x1fb00000, len=0x10000");
299     device_add(machine, "unreadable addr=0x1f980000, len=0x10000");
300    
301     /* Similarly for gio slots 0, 1, and 2: */
302 dpavlin 24 device_add(machine, "unreadable addr=0x1f400000, len=0x1000");
303     device_add(machine, "unreadable addr=0x1f600000, len=0x1000");
304     device_add(machine, "unreadable addr=0x1f000000, len=0x1000");
305 dpavlin 22
306     break;
307    
308     case 25:
309     /* NOTE: Special case for arc_wordlen: */
310     arc_wordlen = sizeof(uint64_t);
311     strlcat(machine->machine_name,
312     " (Everest IP25)", MACHINE_NAME_MAXBUF);
313    
314     /* serial? irix? */
315     dev_scc_init(machine, mem,
316     0x400086000ULL, 0, machine->use_x11, 0, 8);
317    
318     /* NOTE: ip19! (perhaps not really the same */
319     device_add(machine, "sgi_ip19 addr=0x18000000");
320    
321     /*
322     * Memory size, not 4096 byte pages, but 256
323     * bytes? (16 is size of kernel... approx)
324     */
325     store_32bit_word(cpu, 0xa0000000ULL + 0x26d0,
326     30000); /* (machine->physical_ram_in_mb - 16)
327     * (1048576 / 256)); */
328    
329     break;
330    
331     case 26:
332     /* NOTE: Special case for arc_wordlen: */
333     arc_wordlen = sizeof(uint64_t);
334     strlcat(machine->machine_name, " (uknown SGI-IP26 ?)",
335     MACHINE_NAME_MAXBUF); /* TODO */
336     machine->main_console_handle = (size_t)device_add(machine,
337     "z8530 addr=0x1fbd9830 irq=0 addr_mult=4");
338     break;
339    
340     case 27:
341     strlcat(machine->machine_name, " (Origin 200/2000, Onyx2)",
342     MACHINE_NAME_MAXBUF);
343     arc_wordlen = sizeof(uint64_t);
344     /* 2 cpus per node */
345    
346     machine->main_console_handle = (size_t)device_add(machine,
347     "z8530 addr=0x1fbd9830 irq=0 addr_mult=4");
348     break;
349    
350     case 28:
351     /* NOTE: Special case for arc_wordlen: */
352     arc_wordlen = sizeof(uint64_t);
353     strlcat(machine->machine_name,
354     " (Impact Indigo2 ?)", MACHINE_NAME_MAXBUF);
355    
356     device_add(machine, "random addr=0x1fbe0000, len=1");
357    
358     /* Something at paddr 0x1880fb0000. */
359    
360     break;
361    
362     case 30:
363     /* NOTE: Special case for arc_wordlen: */
364     arc_wordlen = sizeof(uint64_t);
365     strlcat(machine->machine_name, " (Octane)",
366     MACHINE_NAME_MAXBUF);
367    
368 dpavlin 34 fatal("TODO: SGI legacy interrupt system rewrite!\n");
369     abort();
370     // machine->md_int.sgi_ip30_data =
371     // dev_sgi_ip30_init(machine, mem, 0x0ff00000);
372 dpavlin 22
373 dpavlin 34 fatal("TODO: Legacy rewrite\n");
374     abort();
375     // machine->md_interrupt = sgi_ip30_interrupt;
376    
377 dpavlin 22 dev_ram_init(machine, 0xa0000000ULL, 128 * 1048576,
378     DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES,
379     0x00000000);
380    
381     dev_ram_init(machine, 0x80000000ULL,
382     32 * 1048576, DEV_RAM_RAM, 0x00000000);
383    
384     /*
385     * Something at paddr=1f022004: TODO
386     * Something at paddr=813f0510 - paddr=813f0570 ?
387     * Something at paddr=813f04b8
388     * Something at paddr=f8000003c used by Linux/Octane
389     *
390     * 16550 serial port at paddr=1f620178, addr mul 1
391 dpavlin 24 * (Error messages are printed to this serial port by
392     * the PROM.)
393 dpavlin 22 *
394 dpavlin 24 * There seems to also be a serial port at 1f620170. The
395     * "symmon" program dumps something there, but it doesn't
396     * look like readable text. (TODO)
397 dpavlin 22 */
398    
399     /* TODO: irq! */
400 dpavlin 24 snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr="
401     "0x1f620170 name2=tty0 in_use=%i", machine->use_x11? 0 : 1);
402     machine->main_console_handle = (size_t)device_add(machine,
403     tmpstr);
404     snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr="
405     "0x1f620178 name2=tty1 in_use=0");
406 dpavlin 22 device_add(machine, tmpstr);
407    
408     /* MardiGras graphics: */
409     device_add(machine, "sgi_mardigras addr=0x1c000000");
410    
411     break;
412    
413     case 32:
414     strlcat(machine->machine_name, " (O2)", MACHINE_NAME_MAXBUF);
415     machine->stable = 1;
416    
417 dpavlin 24 /* TODO: Find out where the phys ram is actually located. */
418     dev_ram_init(machine, 0x07ffff00ULL, 256,
419     DEV_RAM_MIRROR, 0x03ffff00);
420     dev_ram_init(machine, 0x10000000ULL, 256,
421     DEV_RAM_MIRROR, 0x00000000);
422     dev_ram_init(machine, 0x11ffff00ULL, 256,
423     DEV_RAM_MIRROR, 0x01ffff00);
424     dev_ram_init(machine, 0x12000000ULL, 256,
425     DEV_RAM_MIRROR, 0x02000000);
426     dev_ram_init(machine, 0x17ffff00ULL, 256,
427     DEV_RAM_MIRROR, 0x03ffff00);
428     dev_ram_init(machine, 0x20000000ULL, 128 * 1048576,
429     DEV_RAM_MIRROR, 0x00000000);
430     dev_ram_init(machine, 0x40000000ULL, 128 * 1048576,
431     DEV_RAM_MIRROR, 0x10000000);
432 dpavlin 22
433 dpavlin 34 /* Connect CRIME (Interrupt Controller) to MIPS irq 2: */
434     snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2",
435     machine->path, machine->bootstrap_cpu);
436     dev_crime_init(machine, mem, 0x14000000, tmpstr,
437     machine->use_x11); /* crime0 */
438 dpavlin 24 dev_sgi_mte_init(mem, 0x15000000); /* mte ??? */
439     dev_sgi_gbe_init(machine, mem, 0x16000000); /* gbe? */
440 dpavlin 22
441     /*
442     * A combination of NetBSD and Linux info:
443     *
444     * 17000000 vice (Video Image Compression Engine)
445     * 1f000000 mace
446     * 1f080000 macepci
447     * 1f100000 vin1
448     * 1f180000 vin2
449     * 1f200000 vout
450     * 1f280000 enet (mec0, MAC-110 Ethernet)
451     * 1f300000 perif:
452     * 1f300000 audio
453     * 1f310000 isa
454 dpavlin 24 * 1f318000 (accessed by Irix'
455     * pciio_pio_write64)
456 dpavlin 22 * 1f320000 kbdms
457     * 1f330000 i2c
458     * 1f340000 ust
459     * 1f380000 isa ext
460     * 1f390000 com0 (serial)
461     * 1f398000 com1 (serial)
462     * 1f3a0000 mcclock0
463     */
464    
465 dpavlin 24 /*
466     * IRQ mapping is really ugly. TODO: fix
467     *
468     * com0 at mace0 offset 0x390000 intr 4 intrmask
469     * 0x3f00000: ns16550a, working fifo
470     * com1 at mace0 offset 0x398000 intr 4 intrmask
471     * 0xfc000000: ns16550a, working fifo
472     * pckbc0 at mace0 offset 0x320000 intr 5 intrmask 0x0
473     * mcclock0 at mace0 offset 0x3a0000 intrmask 0x0
474     * macepci0 at mace0 offset 0x80000 intr 7 intrmask 0x0: rev 1
475     *
476     * intr 4 = MACE_PERIPH_SERIAL
477     * intr 5 = MACE_PERIPH_MISC
478     * intr 7 = MACE_PCI_BRIDGE
479     */
480 dpavlin 22
481 dpavlin 24 if (eaddr_string == NULL) {
482     fprintf(stderr, "out of memory\n");
483     exit(1);
484     }
485     snprintf(eaddr_string, ETHERNET_STRING_MAXLEN,
486     "eaddr=%02x:%02x:%02x:%02x:%02x:%02x",
487     macaddr[0], macaddr[1], macaddr[2],
488     macaddr[3], macaddr[4], macaddr[5]);
489 dpavlin 34
490     snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2.crime.0x%x",
491     machine->path, machine->bootstrap_cpu, MACE_ETHERNET);
492 dpavlin 24 dev_sgi_mec_init(machine, mem, 0x1f280000,
493 dpavlin 34 tmpstr, macaddr);
494 dpavlin 22
495 dpavlin 24 dev_sgi_ust_init(mem, 0x1f340000); /* ust? */
496 dpavlin 22
497 dpavlin 34 snprintf(tmpstr, sizeof(tmpstr),
498     "ns16550 irq=%s.cpu[%i].2.crime.0x%x.mace.%i addr="
499 dpavlin 24 "0x1f390000 addr_mult=0x100 in_use=%i name2=tty0",
500 dpavlin 34 machine->path, machine->bootstrap_cpu,
501     MACE_PERIPH_SERIAL, 20, machine->use_x11? 0 : 1);
502 dpavlin 24 j = (size_t)device_add(machine, tmpstr);
503 dpavlin 34 snprintf(tmpstr, sizeof(tmpstr),
504     "ns16550 irq=%s.cpu[%i].2.crime.0x%x.mace.%i addr="
505 dpavlin 24 "0x1f398000 addr_mult=0x100 in_use=%i name2=tty1",
506 dpavlin 34 machine->path, machine->bootstrap_cpu,
507     MACE_PERIPH_SERIAL, 26, 0);
508 dpavlin 24 device_add(machine, tmpstr);
509 dpavlin 22
510 dpavlin 24 machine->main_console_handle = j;
511 dpavlin 22
512 dpavlin 24 /* TODO: Once this works, it should be enabled
513     always, not just when using X! */
514 dpavlin 34 #if 0
515     fatal("TODO: legacy SGI rewrite\n");
516     abort();
517 dpavlin 24 if (machine->use_x11) {
518     i = dev_pckbc_init(machine, mem, 0x1f320000,
519     PCKBC_8242, 0x200 + MACE_PERIPH_MISC,
520     0x800 + MACE_PERIPH_MISC, machine->use_x11, 0);
521     /* keyb+mouse (mace irq numbers) */
522     machine->main_console_handle = i;
523     }
524 dpavlin 34 #endif
525 dpavlin 22
526 dpavlin 34 snprintf(tmpstr, sizeof(tmpstr),
527     "%s.cpu[%i].2.crime.0x%x.mace.%i",
528     machine->path, machine->bootstrap_cpu,
529     MACE_PERIPH_MISC, 8);
530     dev_mc146818_init(machine, mem, 0x1f3a0000, tmpstr,
531     MC146818_SGI, 0x40); /* mcclock0 */
532 dpavlin 22
533 dpavlin 34 /* TODO: _WHERE_ does the z8530 interrupt? */
534     snprintf(tmpstr, sizeof(tmpstr), "z8530 addr=0x1fbd9830 "
535     "irq=%s.cpu[%i].2 addr_mult=4",
536     machine->path, machine->bootstrap_cpu);
537     machine->main_console_handle = (size_t)
538     device_add(machine, tmpstr);
539    
540 dpavlin 24 /*
541     * PCI devices: (according to NetBSD's GENERIC
542     * config file for sgimips)
543     *
544     * ne* at pci? dev ? function ?
545     * ahc0 at pci0 dev 1 function ?
546     * ahc1 at pci0 dev 2 function ?
547     */
548 dpavlin 22
549 dpavlin 34 snprintf(tmpstr, sizeof(tmpstr),
550     "%s.cpu[%i].2.crime.0x%x", machine->path,
551     machine->bootstrap_cpu, MACE_PCI_BRIDGE);
552 dpavlin 24 pci_data = dev_macepci_init(machine, mem, 0x1f080000,
553 dpavlin 34 tmpstr); /* macepci0 */
554 dpavlin 24 /* bus_pci_add(machine, pci_data, mem, 0, 0, 0,
555     "ne2000"); TODO */
556 dpavlin 22
557     /* TODO: make this nicer */
558     if (diskimage_exist(machine, 0, DISKIMAGE_SCSI) ||
559     diskimage_exist(machine, 1, DISKIMAGE_SCSI) ||
560     diskimage_exist(machine, 2, DISKIMAGE_SCSI) ||
561     diskimage_exist(machine, 3, DISKIMAGE_SCSI) ||
562     diskimage_exist(machine, 4, DISKIMAGE_SCSI) ||
563     diskimage_exist(machine, 5, DISKIMAGE_SCSI) ||
564     diskimage_exist(machine, 6, DISKIMAGE_SCSI) ||
565     diskimage_exist(machine, 7, DISKIMAGE_SCSI))
566     bus_pci_add(machine, pci_data, mem, 0, 1, 0, "ahc");
567    
568     /* TODO: second ahc */
569     /* bus_pci_add(machine, pci_data, mem, 0, 2, 0, "ahc"); */
570    
571 dpavlin 32 /*
572     * An additional PCI IDE controller, for NetBSD/sgimips
573     * experiments: (Not found in a regular O2.)
574     */
575     bus_pci_add(machine, pci_data, mem, 0, 3, 0, "symphony_82c105");
576    
577 dpavlin 22 break;
578    
579     case 35:
580     strlcat(machine->machine_name,
581     " (Origin 3000)", MACHINE_NAME_MAXBUF);
582     /* 4 cpus per node */
583    
584     machine->main_console_handle = (size_t)device_add(machine,
585     "z8530 addr=0x1fbd9830 irq=0 addr_mult=4");
586     break;
587    
588     case 53:
589     strlcat(machine->machine_name, " (Origin 350)",
590     MACHINE_NAME_MAXBUF);
591    
592     /*
593     * According to http://kumba.drachentekh.net/xml/myguide.html
594     * Origin 350, Tezro IP53 R16000
595     */
596     break;
597    
598     default:
599     fatal("unimplemented SGI machine type IP%i\n",
600     machine->machine_subtype);
601     exit(1);
602     }
603    
604     if (!machine->prom_emulation)
605     return;
606    
607     arcbios_init(machine, arc_wordlen == sizeof(uint64_t), sgi_ram_offset,
608     eaddr_string, macaddr);
609     }
610    
611    
612     MACHINE_DEFAULT_CPU(sgi)
613     {
614     if (machine->machine_subtype <= 12)
615     machine->cpu_name = strdup("R3000");
616     if (machine->cpu_name == NULL && machine->machine_subtype == 35)
617     machine->cpu_name = strdup("R12000");
618     if (machine->cpu_name == NULL && (machine->machine_subtype == 25 ||
619     machine->machine_subtype == 27 || machine->machine_subtype == 28 ||
620     machine->machine_subtype == 30 || machine->machine_subtype == 32))
621     machine->cpu_name = strdup("R10000");
622     if (machine->cpu_name == NULL && (machine->machine_subtype == 21 ||
623     machine->machine_subtype == 26))
624     machine->cpu_name = strdup("R8000");
625     if (machine->cpu_name == NULL && machine->machine_subtype == 24)
626     machine->cpu_name = strdup("R5000");
627    
628     /* Other SGIs should probably work with
629     R4000, R4400 or R5000 or similar: */
630     if (machine->cpu_name == NULL)
631     machine->cpu_name = strdup("R4400");
632     }
633    
634    
635     MACHINE_DEFAULT_RAM(sgi)
636     {
637     machine->physical_ram_in_mb = 64;
638     }
639    
640    
641     MACHINE_REGISTER(sgi)
642     {
643 dpavlin 26 MR_DEFAULT(sgi, "SGI", ARCH_MIPS, MACHINE_SGI);
644    
645 dpavlin 22 me->set_default_ram = machine_default_ram_sgi;
646    
647 dpavlin 26 machine_entry_add_alias(me, "silicon graphics");
648     machine_entry_add_alias(me, "sgi");
649 dpavlin 22
650 dpavlin 26 machine_entry_add_subtype(me, "IP12", 12, "ip12", NULL);
651 dpavlin 22
652 dpavlin 26 machine_entry_add_subtype(me, "IP19", 19, "ip19", NULL);
653 dpavlin 22
654 dpavlin 26 machine_entry_add_subtype(me, "IP20", 20, "ip20", NULL);
655 dpavlin 22
656 dpavlin 26 machine_entry_add_subtype(me, "IP22", 22, "ip22", "indy", NULL);
657 dpavlin 22
658 dpavlin 26 machine_entry_add_subtype(me, "IP24", 24, "ip24", NULL);
659 dpavlin 22
660 dpavlin 26 machine_entry_add_subtype(me, "IP27", 27,
661     "ip27", "origin 200", "origin 2000", NULL);
662 dpavlin 22
663 dpavlin 26 machine_entry_add_subtype(me, "IP28", 28, "ip28", NULL);
664 dpavlin 22
665 dpavlin 26 machine_entry_add_subtype(me, "IP30", 30, "ip30", "octane", NULL);
666 dpavlin 22
667 dpavlin 26 machine_entry_add_subtype(me, "IP32", 32, "ip32", "o2", NULL);
668 dpavlin 22
669 dpavlin 26 machine_entry_add_subtype(me, "IP35", 35, "ip35", NULL);
670 dpavlin 22 }
671    

  ViewVC Help
Powered by ViewVC 1.1.26