/[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 22 - (hide annotations)
Mon Oct 8 16:19:37 2007 UTC (16 years, 7 months ago) by dpavlin
File MIME type: text/plain
File size: 20776 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.1121 2006/02/18 21:03:08 debug Exp $
20051126	Cobalt and PReP now work with the 21143 NIC.
		Continuing on Alpha dyntrans things.
		Fixing some more left-shift-by-24 to unsigned.
20051127	Working on OpenFirmware emulation; major cleanup/redesign.
		Progress on MacPPC emulation: NetBSD detects two CPUs (when
		running with -n 2), framebuffer output (for text) works.
		Adding quick-hack Bandit PCI controller and "gc" interrupt
		controller for MacPPC.
20051128	Changing from a Bandit to a Uni-North controller for macppc.
		Continuing on OpenFirmware and MacPPC emulation in general
		(obio controller, and wdc attached to the obio seems to work).
20051129	More work on MacPPC emulation (adding a dummy ADB controller).
		Continuing the PCI bus cleanup (endianness and tag composition)
		and rewriting all PCI controllers' access functions.
20051130	Various minor PPC dyntrans optimizations.
		Manually inlining some parts of the framebuffer redraw routine.
		Slowly beginning the conversion of the old MIPS emulation into
		dyntrans (but this will take quite some time to get right).
		Generalizing quick_pc_to_pointers.
20051201	Documentation update (David Muse has made available a kernel
		which simplifies Debian/DECstation installation).
		Continuing on the ADB bus controller.
20051202	Beginning a rewrite of the Zilog serial controller (dev_zs).
20051203	Continuing on the zs rewrite (now called dev_z8530); conversion
		to devinit style.
		Reworking some of the input-only vs output-only vs input-output
		details of src/console.c, better warning messages, and adding
		a debug dump.
		Removing the concept of "device state"; it wasn't really used.
		Changing some debug output (-vv should now be used to show all
		details about devices and busses; not shown during normal
		startup anymore).
		Beginning on some SPARC instruction disassembly support.
20051204	Minor PPC updates (WALNUT skeleton stuff).
		Continuing on the MIPS dyntrans rewrite.
		More progress on the ADB controller (a keyboard is "detected"
		by NetBSD and OpenBSD).
		Downgrading OpenBSD/arc as a guest OS from "working" to
		"almost working" in the documentation.
		Progress on Algor emulation ("v3" PCI controller).
20051205	Minor updates.
20051207	Sorting devices according to address; this reduces complexity
		of device lookups from O(n) to O(log n) in memory_rw (but no
		real performance increase (yet) in experiments).
20051210	Beginning the work on native dyntrans backends (by making a
		simple skeleton; so far only for Alpha hosts).
20051211	Some very minor SPARC updates.
20051215	Fixing a bug in the MIPS mul (note: not mult) instruction,
		so it also works with non-64-bit emulation. (Thanks to Alec
		Voropay for noticing the problem.)
20051216	More work on the fake/empty/simple/skeleton/whatever backend;
		performance doesn't increase, so this isn't really worth it,
		but it was probably worth it to prepare for a real backend
		later.
20051219	More instr call statistics gathering and analysis stuff.
20051220	Another fix for MIPS 'mul'. Also converting mul and {d,}cl{o,z}
		to dyntrans.
		memory_ppc.c syntax error fix (noticed by Peter Valchev).
		Beginning to move out machines from src/machine.c into
		individual files in src/machines (in a way similar to the
		autodev system for devices).
20051222	Updating the documentation regarding NetBSD/pmax 3.0.
20051223	- " - NetBSD/cats 3.0.
20051225	- " - NetBSD/hpcmips 3.0.
20051226	Continuing on the machine registry redesign.
		Adding support for ARM rrx (33-bit rotate).
		Fixing some signed/unsigned issues (exposed by gcc -W).
20051227	Fixing the bug which prevented a NetBSD/prep 3.0 install kernel
		from starting (triggered when an mtmsr was the last instruction
		on a page). Unfortunately not enough to get the kernel to run
		as well as the 2.1 kernels did.
20051230	Some dyntrans refactoring.
20051231	Continuing on the machine registry redesign.
20060101-10	Continuing... moving more machines. Moving MD interrupt stuff
		from machine.c into a new src/machines/interrupts.c.
20060114	Adding various mvmeppc machine skeletons.
20060115	Continuing on mvme* stuff. NetBSD/mvmeppc prints boot messages
		(for MVME1600) and reaches the root device prompt, but no
		specific hardware devices are emulated yet.
20060116	Minor updates to the mvme1600 emulation mode; the Eagle PCI bus
		seems to work without much modification, and a 21143 can be
		detected, interrupts might work (but untested so far).
		Adding a fake MK48Txx (mkclock) device, for NetBSD/mvmeppc.
20060121	Adding an aux control register for ARM. (A BIG thank you to
		Olivier Houchard for tracking down this bug.)
20060122	Adding more ARM instructions (smulXY), and dev_iq80321_7seg.
20060124	Adding disassembly of more ARM instructions (mia*, mra/mar),
		and some semi-bogus XScale and i80321 registers.
20060201-02	Various minor updates. Moving the last machines out of
		machine.c.
20060204	Adding a -c command line option, for running debugger commands
		before the simulation starts, but after all files have been
		loaded.
		Minor iq80321-related updates.
20060209	Minor hacks (DEVINIT macro, etc).
		Preparing for the generalization of the 64-bit dyntrans address
		translation subsystem.
20060216	Adding ARM ldrd (double-register load).
20060217	Continuing on various ARM-related stuff.
20060218	More progress on the ATA/wdc emulation for NetBSD/iq80321.
		NetBSD/evbarm can now be installed :-)  Updating the docs, etc.
		Continuing on Algor emulation.

==============  RELEASE 0.3.8  ==============


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

  ViewVC Help
Powered by ViewVC 1.1.26