1 |
/* |
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.6 2006/08/30 15:07:47 debug Exp $ |
29 |
* |
30 |
* Machine descriptions for Silicon Graphics' MIPS-based machines. |
31 |
* |
32 |
* 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 |
#define ETHERNET_STRING_MAXLEN 40 |
59 |
#define MACHINE_NAME_MAXBUF 100 |
60 |
|
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 |
* 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 |
* hpc0 at gio0 addr 0x1fb80000: SGI HPC1 |
164 |
* zsc0 at hpc0 offset 0xd10 (channels 0 and 1, |
165 |
* channel 1 for console) |
166 |
* 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 |
machine->md_int.sgi_ip20_data = dev_sgi_ip20_init(cpu, mem, |
174 |
DEV_SGI_IP20_BASE); |
175 |
|
176 |
/* imc0 at mainbus0 addr 0x1fa00000: revision 0: |
177 |
TODO (or in dev_sgi_ip20?) */ |
178 |
|
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 |
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 |
|
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 |
machine->md_int.sgi_ip22_data = |
220 |
dev_sgi_ip22_init(machine, mem, 0x1fbd9000, 0); |
221 |
} else { |
222 |
strlcat(machine->machine_name, |
223 |
" (Indy, Indigo2, Challenge S; Guiness)", |
224 |
MACHINE_NAME_MAXBUF); |
225 |
machine->md_int.sgi_ip22_data = |
226 |
dev_sgi_ip22_init(machine, mem, 0x1fbd9880, 1); |
227 |
} |
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 |
* IRQ numbers are of the form 8 + x, where x=0..31 for local0 |
260 |
* 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 |
/* Return memory read errors so that hpc1 and hpc2 are |
286 |
not detected: */ |
287 |
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 |
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 |
|
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 |
machine->md_int.sgi_ip30_data = |
358 |
dev_sgi_ip30_init(machine, mem, 0x0ff00000); |
359 |
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 |
* (Error messages are printed to this serial port by |
376 |
* the PROM.) |
377 |
* |
378 |
* 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 |
*/ |
382 |
|
383 |
/* TODO: irq! */ |
384 |
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 |
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 |
/* 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 |
|
417 |
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 |
|
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 |
* 1f318000 (accessed by Irix' |
436 |
* pciio_pio_write64) |
437 |
* 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 |
machine->md_int.ip32.mace_data = |
447 |
dev_mace_init(mem, 0x1f310000, 2); |
448 |
machine->md_interrupt = sgi_ip32_interrupt; |
449 |
|
450 |
/* |
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 |
|
466 |
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 |
|
477 |
dev_sgi_ust_init(mem, 0x1f340000); /* ust? */ |
478 |
|
479 |
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 |
|
488 |
machine->main_console_handle = j; |
489 |
|
490 |
/* 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 |
|
500 |
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 |
|
505 |
/* |
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 |
|
514 |
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 |
|
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 |
/* |
534 |
* An additional PCI IDE controller, for NetBSD/sgimips |
535 |
* experiments: (Not found in a regular O2.) |
536 |
*/ |
537 |
bus_pci_add(machine, pci_data, mem, 0, 3, 0, "symphony_82c105"); |
538 |
|
539 |
break; |
540 |
|
541 |
case 35: |
542 |
strlcat(machine->machine_name, |
543 |
" (Origin 3000)", MACHINE_NAME_MAXBUF); |
544 |
/* 4 cpus per node */ |
545 |
|
546 |
machine->main_console_handle = (size_t)device_add(machine, |
547 |
"z8530 addr=0x1fbd9830 irq=0 addr_mult=4"); |
548 |
break; |
549 |
|
550 |
case 53: |
551 |
strlcat(machine->machine_name, " (Origin 350)", |
552 |
MACHINE_NAME_MAXBUF); |
553 |
|
554 |
/* |
555 |
* According to http://kumba.drachentekh.net/xml/myguide.html |
556 |
* Origin 350, Tezro IP53 R16000 |
557 |
*/ |
558 |
break; |
559 |
|
560 |
default: |
561 |
fatal("unimplemented SGI machine type IP%i\n", |
562 |
machine->machine_subtype); |
563 |
exit(1); |
564 |
} |
565 |
|
566 |
if (!machine->prom_emulation) |
567 |
return; |
568 |
|
569 |
arcbios_init(machine, arc_wordlen == sizeof(uint64_t), sgi_ram_offset, |
570 |
eaddr_string, macaddr); |
571 |
} |
572 |
|
573 |
|
574 |
MACHINE_DEFAULT_CPU(sgi) |
575 |
{ |
576 |
if (machine->machine_subtype <= 12) |
577 |
machine->cpu_name = strdup("R3000"); |
578 |
if (machine->cpu_name == NULL && machine->machine_subtype == 35) |
579 |
machine->cpu_name = strdup("R12000"); |
580 |
if (machine->cpu_name == NULL && (machine->machine_subtype == 25 || |
581 |
machine->machine_subtype == 27 || machine->machine_subtype == 28 || |
582 |
machine->machine_subtype == 30 || machine->machine_subtype == 32)) |
583 |
machine->cpu_name = strdup("R10000"); |
584 |
if (machine->cpu_name == NULL && (machine->machine_subtype == 21 || |
585 |
machine->machine_subtype == 26)) |
586 |
machine->cpu_name = strdup("R8000"); |
587 |
if (machine->cpu_name == NULL && machine->machine_subtype == 24) |
588 |
machine->cpu_name = strdup("R5000"); |
589 |
|
590 |
/* Other SGIs should probably work with |
591 |
R4000, R4400 or R5000 or similar: */ |
592 |
if (machine->cpu_name == NULL) |
593 |
machine->cpu_name = strdup("R4400"); |
594 |
} |
595 |
|
596 |
|
597 |
MACHINE_DEFAULT_RAM(sgi) |
598 |
{ |
599 |
machine->physical_ram_in_mb = 64; |
600 |
} |
601 |
|
602 |
|
603 |
MACHINE_REGISTER(sgi) |
604 |
{ |
605 |
MR_DEFAULT(sgi, "SGI", ARCH_MIPS, MACHINE_SGI); |
606 |
|
607 |
me->set_default_ram = machine_default_ram_sgi; |
608 |
|
609 |
machine_entry_add_alias(me, "silicon graphics"); |
610 |
machine_entry_add_alias(me, "sgi"); |
611 |
|
612 |
machine_entry_add_subtype(me, "IP12", 12, "ip12", NULL); |
613 |
|
614 |
machine_entry_add_subtype(me, "IP19", 19, "ip19", NULL); |
615 |
|
616 |
machine_entry_add_subtype(me, "IP20", 20, "ip20", NULL); |
617 |
|
618 |
machine_entry_add_subtype(me, "IP22", 22, "ip22", "indy", NULL); |
619 |
|
620 |
machine_entry_add_subtype(me, "IP24", 24, "ip24", NULL); |
621 |
|
622 |
machine_entry_add_subtype(me, "IP27", 27, |
623 |
"ip27", "origin 200", "origin 2000", NULL); |
624 |
|
625 |
machine_entry_add_subtype(me, "IP28", 28, "ip28", NULL); |
626 |
|
627 |
machine_entry_add_subtype(me, "IP30", 30, "ip30", "octane", NULL); |
628 |
|
629 |
machine_entry_add_subtype(me, "IP32", 32, "ip32", "o2", NULL); |
630 |
|
631 |
machine_entry_add_subtype(me, "IP35", 35, "ip35", NULL); |
632 |
} |
633 |
|