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