/[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 28 - (hide annotations)
Mon Oct 8 16:20:26 2007 UTC (11 years, 11 months ago) by dpavlin
File MIME type: text/plain
File size: 20271 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.1298 2006/07/22 11:27:46 debug Exp $
20060626	Continuing on SPARC emulation (beginning on the 'save'
		instruction, register windows, etc).
20060629	Planning statistics gathering (new -s command line option),
		and renaming speed_tricks to allow_instruction_combinations.
20060630	Some minor manual page updates.
		Various cleanups.
		Implementing the -s command line option.
20060701	FINALLY found the bug which prevented Linux and Ultrix from
		running without the ugly hack in the R2000/R3000 cache isol
		code; it was the phystranslation hint array which was buggy.
		Removing the phystranslation hint code completely, for now.
20060702	Minor dyntrans cleanups; invalidation of physpages now only
		invalidate those parts of a page that have actually been
		translated. (32 parts per page.)
		Some MIPS non-R3000 speed fixes.
		Experimenting with MIPS instruction combination for some
		addiu+bne+sw loops, and sw+sw+sw.
		Adding support (again) for larger-than-4KB pages in MIPS tlbw*.
		Continuing on SPARC emulation: adding load/store instructions.
20060704	Fixing a virtual vs physical page shift bug in the new tlbw*
		implementation. Problem noticed by Jakub Jermar. (Many thanks.)
		Moving rfe and eret to cpu_mips_instr.c, since that is the
		only place that uses them nowadays.
20060705	Removing the BSD license from the "testmachine" include files,
		placing them in the public domain instead; this enables the
		testmachine stuff to be used from projects which are
		incompatible with the BSD license for some reason.
20060707	Adding instruction combinations for the R2000/R3000 L1
		I-cache invalidation code used by NetBSD/pmax 3.0, lui+addiu,
		various branches followed by addiu or nop, and jr ra followed
		by addiu. The time it takes to perform a full NetBSD/pmax R3000
		install on the laptop has dropped from 573 seconds to 539. :-)
20060708	Adding a framebuffer controller device (dev_fbctrl), which so
		far can be used to change the fb resolution during runtime, but
		in the future will also be useful for accelerated block fill/
		copy, and possibly also simplified character output.
		Adding an instruction combination for NetBSD/pmax' strlen.
20060709	Minor fixes: reading raw files in src/file.c wasn't memblock
		aligned, removing buggy multi_sw MIPS instruction combination,
		etc.
20060711	Adding a machine_qemu.c, which contains a "qemu_mips" machine.
		(It mimics QEMU's MIPS machine mode, so that a test kernel
		made for QEMU_MIPS also can run in GXemul... at least to some
		extent.)  Adding a short section about how to run this mode to
		doc/guestoses.html.
20060714	Misc. minor code cleanups.
20060715	Applying a patch which adds getchar() to promemul/yamon.c
		(from Oleksandr Tymoshenko).
		Adding yamon.h from NetBSD, and rewriting yamon.c to use it
		(instead of ugly hardcoded numbers) + some cleanup.
20060716	Found and fixed the bug which broke single-stepping of 64-bit
		programs between 0.4.0 and 0.4.0.1 (caused by too quick
		refactoring and no testing). Hopefully this fix will not
		break too many other things.
20060718	Continuing on the 8253 PIT; it now works with Linux/QEMU_MIPS.
		Re-adding the sw+sw+sw instr comb (the problem was that I had
		ignored endian issues); however, it doesn't seem to give any
		big performance gain.
20060720	Adding a dummy Transputer mode (T414, T800 etc) skeleton (only
		the 'j' and 'ldc' instructions are implemented so far). :-}
20060721	Adding gtreg.h from NetBSD, updating dev_gt.c to use it, plus
		misc. other updates to get Linux 2.6 for evbmips/malta working
		(thanks to Alec Voropay for the details).
		FINALLY found and fixed the bug which made tlbw* for non-R3000
		buggy; it was a reference count problem in the dyntrans core.
20060722	Testing stuff; things seem stable enough for a new release.

==============  RELEASE 0.4.1  ==============


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

  ViewVC Help
Powered by ViewVC 1.1.26