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