machine_sgi.cc Source File

Back to the index.

machine_sgi.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003-2018 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  * COMMENT: Silicon Graphics' MIPS-based machines
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 "memory.h"
48 #include "misc.h"
49 #include "net.h"
50 
51 #include "thirdparty/sgi_arcbios.h"
52 #include "thirdparty/crimereg.h"
53 
54 
55 #define ETHERNET_STRING_MAXLEN 40
56 #define MACHINE_NAME_MAXBUF 100
57 
58 
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 = strdup("eaddr=10:20:30:40:50:60"); /* bogus */
67  unsigned char macaddr[6];
68  char *machineName;
69 
70  struct pci_data *pci_data = NULL;
71 
72  CHECK_ALLOCATION(machineName = (char *) malloc(MACHINE_NAME_MAXBUF));
73  machine->machine_name = machineName;
74 
76  snprintf(machineName, 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 ||
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,
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 
99  CHECK_ALLOCATION(eaddr_string = (char *) malloc(ETHERNET_STRING_MAXLEN));
100 
101  switch (machine->machine_subtype) {
102 
103  case 10:
104  strlcat(machineName, " (4D/25)", MACHINE_NAME_MAXBUF);
105  /* TODO */
106  break;
107 
108  case 12:
109  strlcat(machineName, " (Iris Indigo IP12)", MACHINE_NAME_MAXBUF);
110 
111  /* TODO */
112  /* 33 MHz R3000, according to http://www.irisindigo.com/ */
113  /* "capable of addressing up to 96MB of memory." */
114 
115  break;
116 
117  case 19:
118  strlcat(machineName,
119  " (Everest IP19)", MACHINE_NAME_MAXBUF);
121  "z8530 addr=0x1fbd9830 irq=0 addr_mult=4");
122 
123  fatal("TODO ip19 interrupt rewrite\n");
124  abort();
125  //dev_scc_init(machine, mem, 0x10086000, 0,
126  // machine->x11_md.in_use, 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(machineName, " (Indigo)", MACHINE_NAME_MAXBUF);
146 
147  /*
148  * Guesses based on NetBSD 2.0 beta, 20040606.
149  *
150  * int0 at mainbus0 addr 0x1fb801c0: bus 1MHz, CPU 2MHz
151  * imc0 at mainbus0 addr 0x1fa00000: revision 0
152  * gio0 at imc0
153  * unknown GIO card (product 0x00 revision 0x00)
154  * at gio0 slot 0 addr 0x1f400000 not configured
155  * unknown GIO card (product 0x00 revision 0x00)
156  * at gio0 slot 1 addr 0x1f600000 not configured
157  * unknown GIO card (product 0x00 revision 0x00)
158  * at gio0 slot 2 addr 0x1f000000 not configured
159  * hpc0 at gio0 addr 0x1fb80000: SGI HPC1
160  * zsc0 at hpc0 offset 0xd10 (channels 0 and 1,
161  * channel 1 for console)
162  * zsc1 at hpc0 offset 0xd00 (2 channels)
163  * sq0 at hpc0 offset 0x100: SGI Seeq 80c03
164  * wdsc0 at hpc0 offset 0x11f
165  * dpclock0 at hpc0 offset 0xe00
166  */
167 
168  /* int0 at mainbus0 addr 0x1fb801c0 */
169 fatal("TODO: SGI legacy interrupt system rewrite!\n");
170 abort();
171 // machine->md_int.sgi_ip20_data = dev_sgi_ip20_init(cpu, mem,
172 // DEV_SGI_IP20_BASE);
173 
174  /* imc0 at mainbus0 addr 0x1fa00000: revision 0:
175  TODO (or in dev_sgi_ip20?) */
176 
178  "z8530 addr=0x1fbd9830 irq=0 addr_mult=4");
179 
180  /* This is the zsc0 reported by NetBSD: TODO: irqs */
182  "z8530 addr=0x1fb80d10 irq=0 addr_mult=4");
184  "z8530 addr=0x1fb80d00 irq=0 addr_mult=4");
185 
186  /* WDSC SCSI controller: */
187 /* dev_wdsc_init(machine, mem, 0x1fb8011f, 0, 0); */
188 
189  /* Return memory read errors so that hpc1
190  and hpc2 are not detected: */
191  device_add(machine, "unreadable addr=0x1fb00000 len=0x10000");
192  device_add(machine, "unreadable addr=0x1f980000 len=0x10000");
193 
194  /* Return nothing for gio slots 0, 1, and 2: */
195  device_add(machine, "unreadable addr=0x1f400000 len=0x1000");
196  device_add(machine, "unreadable addr=0x1f600000 len=0x1000");
197  device_add(machine, "unreadable addr=0x1f000000 len=0x1000");
198 
199  break;
200 
201  case 21:
202  strlcat(machineName, /* TODO */
203  " (uknown SGI-IP21 ?)", MACHINE_NAME_MAXBUF);
204  /* NOTE: Special case for arc_wordlen: */
205  arc_wordlen = sizeof(uint64_t);
206 
207  device_add(machine, "random addr=0x418000200, len=0x20000");
208 
209  break;
210 
211  case 22:
212  case 24:
213  if (machine->machine_subtype == 22) {
214  strlcat(machineName,
215  " (Indy, Indigo2, Challenge S; Full-house)",
217 fatal("TODO: SGI legacy interrupt system rewrite!\n");
218 abort();
219 // machine->md_int.sgi_ip22_data =
220 // dev_sgi_ip22_init(machine, mem, 0x1fbd9000, 0);
221  } else {
222  strlcat(machineName,
223  " (Indy, Indigo2, Challenge S; Guiness)",
225 fatal("TODO: SGI legacy interrupt system rewrite!\n");
226 abort();
227 // machine->md_int.sgi_ip22_data =
228 // dev_sgi_ip22_init(machine, mem, 0x1fbd9880, 1);
229  }
230 
231 /*
232 Why is this here? TODO
233  dev_ram_init(machine, 0x88000000ULL,
234  128 * 1048576, DEV_RAM_MIRROR, 0x08000000);
235 */
236 
237 fatal("TODO: Legacy rewrite\n");
238 abort();
239 // machine->md_interrupt = sgi_ip22_interrupt;
240 
241  /*
242  * According to NetBSD 1.6.2:
243  *
244  * imc0 at mainbus0 addr 0x1fa00000, Revision 0
245  * gio0 at imc0
246  * hpc0 at gio0 addr 0x1fb80000: SGI HPC3
247  * zsc0 at hpc0 offset 0x59830
248  * zstty0 at zsc0 channel 1 (console i/o)
249  * zstty1 at zsc0 channel 0
250  * sq0 at hpc0 offset 0x54000: SGI Seeq 80c03 (Ethernet)
251  * wdsc0 at hpc0 offset 0x44000: WD33C93 SCSI, rev=0, target 7
252  * scsibus2 at wdsc0: 8 targets, 8 luns per target
253  * dsclock0 at hpc0 offset 0x60000
254  *
255  * According to Linux/IP22:
256  * tty00 at 0xbfbd9830 (irq = 45) is a Zilog8530
257  * tty01 at 0xbfbd9838 (irq = 45) is a Zilog8530
258  *
259  * and according to NetBSD 2.0_BETA (20040606):
260  *
261  * haltwo0 at hpc0 offset 0x58000: HAL2 revision 0.0.0
262  * audio0 at haltwo0: half duplex
263  *
264  * IRQ numbers are of the form 8 + x, where x=0..31 for local0
265  * interrupts, and 32..63 for local1. + y*65 for "mappable".
266  */
267 
268  /* zsc0 serial console. 8 + 32 + 3 + 64*5 = 43+64*5 = 363 */
269  i = (size_t)device_add(machine,
270  "z8530 addr=0x1fbd9830 irq=363 addr_mult=4");
271 
272  /* Not supported by NetBSD 1.6.2, but by 2.0_BETA: */
273 fatal("TODO: legacy rewrite\n");
274 abort();
275 // j = dev_pckbc_init(machine, mem, 0x1fbd9840, PCKBC_8242,
276 // 0, 0, machine->x11_md.in_use, 0); /* TODO: irq numbers */
277 j = 0;
278 
279  if (machine->x11_md.in_use)
281 
282  /* sq0: Ethernet. TODO: This should have irq_nr = 8 + 3 */
283  /* dev_sq_init... */
284 
285  /* wdsc0: SCSI */
286 /* dev_wdsc_init(machine, mem, 0x1fbc4000, 0, 8 + 1); */
287 
288  /* wdsc1: SCSI TODO: irq nr */
289 /* dev_wdsc_init(machine, mem, 0x1fbcc000, 1, 8 + 1); */
290 
291  /* dsclock0: TODO: possibly irq 8 + 33 */
292 
293  /* Return memory read errors so that hpc1 and hpc2 are
294  not detected: */
295  device_add(machine, "unreadable addr=0x1fb00000, len=0x10000");
296  device_add(machine, "unreadable addr=0x1f980000, len=0x10000");
297 
298  /* Similarly for gio slots 0, 1, and 2: */
299  device_add(machine, "unreadable addr=0x1f400000, len=0x1000");
300  device_add(machine, "unreadable addr=0x1f600000, len=0x1000");
301  device_add(machine, "unreadable addr=0x1f000000, len=0x1000");
302 
303  break;
304 
305  case 25:
306  /* NOTE: Special case for arc_wordlen: */
307  arc_wordlen = sizeof(uint64_t);
308  strlcat(machineName, " (Everest IP25)", MACHINE_NAME_MAXBUF);
309 
310  /* serial? irix? */
311  fatal("TODO ip25 interrupt rewrite\n");
312  abort();
313  //dev_scc_init(machine, mem,
314  // 0x400086000ULL, 0, machine->x11_md.in_use, 0, 8);
315 
316  /* NOTE: ip19! (perhaps not really the same */
317  device_add(machine, "sgi_ip19 addr=0x18000000");
318 
319  /*
320  * Memory size, not 4096 byte pages, but 256
321  * bytes? (16 is size of kernel... approx)
322  */
323  store_32bit_word(cpu, 0xa0000000ULL + 0x26d0,
324  30000); /* (machine->physical_ram_in_mb - 16)
325  * (1048576 / 256)); */
326 
327  break;
328 
329  case 26:
330  /* NOTE: Special case for arc_wordlen: */
331  arc_wordlen = sizeof(uint64_t);
332  strlcat(machineName, " (uknown SGI-IP26 ?)",
333  MACHINE_NAME_MAXBUF); /* TODO */
335  "z8530 addr=0x1fbd9830 irq=0 addr_mult=4");
336  break;
337 
338  case 27:
339  strlcat(machineName, " (Origin 200/2000, Onyx2)",
341  arc_wordlen = sizeof(uint64_t);
342  /* 2 cpus per node */
343 
345  "z8530 addr=0x1fbd9830 irq=0 addr_mult=4");
346  break;
347 
348  case 28:
349  /* NOTE: Special case for arc_wordlen: */
350  arc_wordlen = sizeof(uint64_t);
351  strlcat(machineName, " (Impact Indigo2 ?)", MACHINE_NAME_MAXBUF);
352 
353  device_add(machine, "random addr=0x1fbe0000, len=1");
354 
355  /* Something at paddr 0x1880fb0000. */
356 
357  break;
358 
359  case 30:
360  /* NOTE: Special case for arc_wordlen: */
361  arc_wordlen = sizeof(uint64_t);
362  strlcat(machineName, " (Octane)",
364 
365  // TODO: Interrupts!
366  snprintf(tmpstr, sizeof(tmpstr),
367  "sgi_ip30 addr=0x0ff00000");
368  device_add(machine, tmpstr);
369 
370  dev_ram_init(machine, 0xa0000000ULL, 128 * 1048576,
372  0x00000000);
373 
374  dev_ram_init(machine, 0x80000000ULL,
375  32 * 1048576, DEV_RAM_RAM, 0x00000000);
376 
377  /*
378  * Something at paddr=1f022004: TODO
379  * Something at paddr=813f0510 - paddr=813f0570 ?
380  * Something at paddr=813f04b8
381  * Something at paddr=f8000003c used by Linux/Octane
382  *
383  * 16550 serial port at paddr=1f620178, addr mul 1
384  * (Error messages are printed to this serial port by
385  * the PROM.)
386  *
387  * There seems to also be a serial port at 1f620170. The
388  * "symmon" program dumps something there, but it doesn't
389  * look like readable text. (TODO)
390  */
391 
392  /* TODO: irq! */
393  snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%s.cpu[%i].2 addr="
394  "0x1f620170 name2=tty0 in_use=%i",
396  machine->x11_md.in_use? 0 : 1);
398  tmpstr);
399  snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%s.cpu[%i].2 addr="
400  "0x1f620178 name2=tty1 in_use=0",
402  device_add(machine, tmpstr);
403 
404  /* MardiGras graphics: */
405  device_add(machine, "sgi_mardigras addr=0x1c000000");
406 
407  break;
408 
409  case 32:
410  strlcat(machineName, " (O2)", MACHINE_NAME_MAXBUF);
411 
412  /*
413  * The IP32 prom probes "bank 0" with the following
414  * TLB entries:
415  *
416  * 00: vaddr=0000000000000000 (global): p0=0x040000000 D p1=0x041000000 D (16MB)
417  * 01: vaddr=0000000002000000 (global): p0=0x042000000 D p1=0x043000000 D (16MB)
418  * 02: vaddr=0000000004000000 (global): p0=0x044000000 D p1=0x045000000 D (16MB)
419  * 03: vaddr=0000000006000000 (global): p0=0x046000000 D p1=0x047000000 D (16MB)
420  *
421  * In other words, it uses real memory at 0x40000000 and up.
422  * However, it is _also_ accessible at physical address 0x0.
423  *
424  * Max amount of RAM in an O2 is 1 GB. However, devices start at
425  * 0x14000000 (or below that), so 256 MB is the most that the legacy GXemul
426  * framework can handle. Memory above that must be accessed from 0x40000000 and up.
427  */
428 
429  if (machine->physical_ram_in_mb > 1024) {
430  fatal("SGI O2 cannot have more than 1 GB of RAM.\n");
431  exit(1);
432  }
433 
434  /* In the new framework, this would be the other way around :-), i.e.
435  actual memory at 0x40000000 and the first 256 MB would be mirrored
436  to address 0. */
437  {
438  int mirrorInMB = machine->physical_ram_in_mb < 256 ? machine->physical_ram_in_mb : 256;
439  dev_ram_init(machine, 0x40000000ULL, mirrorInMB * 1048576, DEV_RAM_MIRROR, 0);
440  if (machine->physical_ram_in_mb > 256)
441  dev_ram_init(machine, 0x50000000ULL, (machine->physical_ram_in_mb - 256) * 1048576, DEV_RAM_RAM, 0);
442  }
443 
444  /* Connect CRIME (Interrupt Controller) to MIPS irq 2: */
445  snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2",
447  dev_crime_init(machine, mem, 0x14000000, tmpstr, machine->x11_md.in_use);
448 
449  /* Rendering Engine */
450  dev_sgi_re_init(machine, mem, 0x15000000);
451 
452  /* Graphics Back End */
453  dev_sgi_gbe_init(machine, mem, 0x16000000);
454 
455  /*
456  * A combination of NetBSD and Linux info:
457  *
458  * 14000000 crime (interrupt/memory controller?)
459  * 15000000 drawing engine, memory transfer engine, rendering engine
460  * 16000000 gbe (graphics), crm framebuffer control
461  * 17000000 vice (Video Image Compression Engine)
462  * 18000000 pci (?)
463  * 1f000000 mace
464  * 1f080000 macepci
465  * 1f100000 vin1
466  * 1f180000 vin2
467  * 1f200000 vout
468  * 1f280000 enet (mec0, MAC-110 Ethernet)
469  * 1f300000 perif:
470  * 1f300000 audio ("a3"?)
471  * 1f310000 isa
472  * 1f318000 (unknown, accessed by Irix' pciio_pio_write64 and by the PROM during bootup)
473  * 1f31c000 (unknown, accessed by the PROM during bootup)
474  * 1f320000 kbdms
475  * 1f330000 i2c
476  * 1f340000 ust
477  * 1f380000 isa ext
478  * 1f390000 com0 (serial)
479  * 1f398000 com1 (serial)
480  * 1f3a0000 mcclock0
481  */
482 
483  /*
484  * IRQ mapping is really ugly. TODO: fix
485  *
486  * com0 at mace0 offset 0x390000 intr 4 intrmask
487  * 0x3f00000: ns16550a, working fifo
488  * com1 at mace0 offset 0x398000 intr 4 intrmask
489  * 0xfc000000: ns16550a, working fifo
490  * pckbc0 at mace0 offset 0x320000 intr 5 intrmask 0x0
491  * mcclock0 at mace0 offset 0x3a0000 intrmask 0x0
492  * macepci0 at mace0 offset 0x80000 intr 7 intrmask 0x0: rev 1
493  *
494  * intr 4 = CRIME_INT_PERIPH_SERIAL
495  * intr 5 = CRIME_INT_PERIPH_MISC
496  * intr 7 = CRIME_INT_PCI_BRIDGE
497  */
498 
499  snprintf(eaddr_string, ETHERNET_STRING_MAXLEN,
500  "eaddr=%02x:%02x:%02x:%02x:%02x:%02x",
501  macaddr[0], macaddr[1], macaddr[2],
502  macaddr[3], macaddr[4], macaddr[5]);
503 
504  snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2.crime.0x%x",
506  dev_sgi_mec_init(machine, mem, 0x1f280000,
507  tmpstr, macaddr);
508 
509  dev_sgi_ust_init(mem, 0x1f340000); /* ust? */
510 
511  snprintf(tmpstr, sizeof(tmpstr),
512  "ns16550 irq=%s.cpu[%i].2.crime.0x%x.mace.%i addr="
513  "0x1f390000 addr_mult=0x100 in_use=%i name2=tty0",
516  j = (size_t)device_add(machine, tmpstr);
517  snprintf(tmpstr, sizeof(tmpstr),
518  "ns16550 irq=%s.cpu[%i].2.crime.0x%x.mace.%i addr="
519  "0x1f398000 addr_mult=0x100 in_use=%i name2=tty1",
521  CRIME_INT_PERIPH_SERIAL, 26, 0);
522  device_add(machine, tmpstr);
523 
525 
526  {
527  /* keyb+mouse (mace irq numbers) */
528  char tmpstr1[1000];
529  char tmpstr2[1000];
530  snprintf(tmpstr1, sizeof(tmpstr1),
531  "%s.cpu[%i].2.crime.0x%x.mace.%i",
534 
535  snprintf(tmpstr2, sizeof(tmpstr2),
536  "%s.cpu[%i].2.crime.0x%x.mace.%i",
539 
540  i = dev_pckbc_init(machine, mem, 0x1f320000,
541  PCKBC_8242, tmpstr1,
542  tmpstr2, machine->x11_md.in_use,
543  0);
544 
545  if (machine->x11_md.in_use)
547  }
548 
549  snprintf(tmpstr, sizeof(tmpstr),
550  "%s.cpu[%i].2.crime.0x%x.mace.%i",
553  dev_mc146818_init(machine, mem, 0x1f3a0000, tmpstr,
554  MC146818_SGI, 0x40); /* mcclock0 */
555 
556  /*
557  * PCI devices: (according to NetBSD's GENERIC
558  * config file for sgimips)
559  *
560  * ne* at pci? dev ? function ?
561  * ahc0 at pci0 dev 1 function ?
562  * ahc1 at pci0 dev 2 function ?
563  */
564 
565  snprintf(tmpstr, sizeof(tmpstr),
566  "%s.cpu[%i].2.crime.0x%x", machine->path,
568  pci_data = dev_macepci_init(machine, mem, 0x1f080000,
569  tmpstr); /* macepci0 */
570  /* bus_pci_add(machine, pci_data, mem, 0, 0, 0,
571  "ne2000"); TODO */
572 
573  /*
574  * OpenBSD accesses the SCSI controller at paddr=0x2800010xx.
575  * Note that the 2 is above 32-bit range.
576  *
577  * TODO: Investigate what this actually means. Possibly
578  * a bug in GXemul's 64-bit instructions? Or perhaps it really
579  * is correct.
580  */
581  dev_ram_init(machine, 0x280000000ULL, 0x01000000, DEV_RAM_MIRROR, 0x18000000);
582 
583 
584  // ahc0:
585  /* TODO: Make it possible to add the controller, regardless of
586  the existence of disks! */
595  bus_pci_add(machine, pci_data, mem, 0, 1, 0, "ahc");
596 
597  // ahc1:
598  // bus_pci_add(machine, pci_data, mem, 0, 2, 0, "ahc");
599 
600  break;
601 
602  case 35:
603  strlcat(machineName, " (Origin 3000)", MACHINE_NAME_MAXBUF);
604  /* 4 cpus per node */
605 
606  // TODO: Correct Interrupt!
607  snprintf(tmpstr, sizeof(tmpstr), "z8530 addr=0x1fbd9830 irq=%s.cpu[%i].2",
609  machine->main_console_handle = (size_t)device_add(machine, tmpstr);
610 
611  break;
612 
613  case 53:
614  strlcat(machineName, " (Origin 350)",
616 
617  /*
618  * According to http://kumba.drachentekh.net/xml/myguide.html
619  * Origin 350, Tezro IP53 R16000
620  */
621  break;
622 
623  default:
624  fatal("unimplemented SGI machine type IP%i\n",
626  exit(1);
627  }
628 
629  if (!machine->prom_emulation)
630  return;
631 
632  arcbios_init(machine, arc_wordlen == sizeof(uint64_t), sgi_ram_offset,
633  eaddr_string, macaddr);
634 }
635 
636 
638 {
639  if (machine->machine_subtype <= 12)
640  machine->cpu_name = strdup("R3000");
641  if (machine->cpu_name == NULL && machine->machine_subtype == 35)
642  machine->cpu_name = strdup("R12000");
643  if (machine->cpu_name == NULL && (machine->machine_subtype == 25 ||
644  machine->machine_subtype == 27 || machine->machine_subtype == 28 ||
646  machine->cpu_name = strdup("R10000");
647  if (machine->cpu_name == NULL && (machine->machine_subtype == 21 ||
648  machine->machine_subtype == 26))
649  machine->cpu_name = strdup("R8000");
650  if (machine->cpu_name == NULL && machine->machine_subtype == 24)
651  machine->cpu_name = strdup("R5000");
652 
653  /* Other SGIs should probably work with
654  R4000, R4400 or R5000 or similar: */
655  if (machine->cpu_name == NULL)
656  machine->cpu_name = strdup("R4400");
657 }
658 
659 
661 {
662  // Self-compilation fails with OpenBSD/sgi 6.3 with as low as 128 MB
663  // RAM, so 256 would be better. But my O2 has 128 MB, so this is kept
664  // as 128 to simplify comparison between the real machine and the
665  // emulator.
667 }
668 
669 
671 {
672  MR_DEFAULT(sgi, "SGI", ARCH_MIPS, MACHINE_SGI);
673 
674  me->set_default_ram = machine_default_ram_sgi;
675 
676  machine_entry_add_alias(me, "silicon graphics");
677  machine_entry_add_alias(me, "sgi");
678 
679  machine_entry_add_subtype(me, "IP12", 12, "ip12", NULL);
680 
681  machine_entry_add_subtype(me, "IP19", 19, "ip19", NULL);
682 
683  machine_entry_add_subtype(me, "IP20", 20, "ip20", NULL);
684 
685  machine_entry_add_subtype(me, "IP22", 22, "ip22", "indy", NULL);
686 
687  machine_entry_add_subtype(me, "IP24", 24, "ip24", NULL);
688 
689  machine_entry_add_subtype(me, "IP27", 27,
690  "ip27", "origin 200", "origin 2000", NULL);
691 
692  machine_entry_add_subtype(me, "IP28", 28, "ip28", NULL);
693 
694  machine_entry_add_subtype(me, "IP30", 30, "ip30", "octane", NULL);
695 
696  machine_entry_add_subtype(me, "IP32", 32, "ip32", "o2", NULL);
697 
698  machine_entry_add_subtype(me, "IP35", 35, "ip35", NULL);
699 }
700 
MACHINE_DEFAULT_CPU
MACHINE_DEFAULT_CPU(sgi)
Definition: machine_sgi.cc:637
machine::machine_subtype
int machine_subtype
Definition: machine.h:112
machine::bootstrap_cpu
int bootstrap_cpu
Definition: machine.h:136
dev_crime_init
void dev_crime_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, char *irq_path, int use_fb)
Definition: dev_sgi_ip32.cc:400
ETHERNET_STRING_MAXLEN
#define ETHERNET_STRING_MAXLEN
Definition: machine_sgi.cc:55
MACHINE_DEFAULT_RAM
MACHINE_DEFAULT_RAM(sgi)
Definition: machine_sgi.cc:660
diskimage.h
memory
Definition: memory.h:75
CRIME_INT_PERIPH_SERIAL
#define CRIME_INT_PERIPH_SERIAL
Definition: crimereg.h:114
DEV_RAM_MIRROR
#define DEV_RAM_MIRROR
Definition: devices.h:365
dev_sgi_re_init
void dev_sgi_re_init(struct machine *machine, struct memory *mem, uint64_t baseaddr)
Definition: dev_sgi_re.cc:380
cpu::byte_order
uint8_t byte_order
Definition: cpu.h:347
EMUL_BIG_ENDIAN
#define EMUL_BIG_ENDIAN
Definition: misc.h:165
MACHINE_SETUP
MACHINE_SETUP(sgi)
Definition: machine_sgi.cc:59
machine::prom_emulation
int prom_emulation
Definition: machine.h:149
DEV_RAM_RAM
#define DEV_RAM_RAM
Definition: devices.h:364
device.h
CRIME_INT_ETHERNET
#define CRIME_INT_ETHERNET
Definition: crimereg.h:115
CRIME_INT_PCI_BRIDGE
#define CRIME_INT_PCI_BRIDGE
Definition: crimereg.h:111
ARCH_MIPS
#define ARCH_MIPS
Definition: machine.h:203
fatal
void fatal(const char *fmt,...)
Definition: main.cc:152
DISKIMAGE_SCSI
#define DISKIMAGE_SCSI
Definition: diskimage.h:40
machine::cpu_name
char * cpu_name
Definition: machine.h:133
machine_entry_add_subtype
void machine_entry_add_subtype(struct machine_entry *me, const char *name, int oldstyle_subtype,...)
Definition: machine.cc:717
x11_md::in_use
int in_use
Definition: machine.h:82
MACHINE_REGISTER
MACHINE_REGISTER(sgi)
Definition: machine_sgi.cc:670
misc.h
device_add
void * device_add(struct machine *machine, const char *name_and_params)
Definition: device.cc:252
machine.h
machine
Definition: machine.h:97
machine::main_console_handle
int main_console_handle
Definition: machine.h:128
net_generate_unique_mac
void net_generate_unique_mac(struct machine *, unsigned char *macbuf)
Definition: net_misc.cc:88
MR_DEFAULT
#define MR_DEFAULT(x, name, arch, type)
Definition: machine.h:373
machine::x11_md
struct x11_md x11_md
Definition: machine.h:179
MACHINE_SGI
#define MACHINE_SGI
Definition: machine.h:217
MC146818_SGI
#define MC146818_SGI
Definition: devices.h:306
cpu.h
machine::path
char * path
Definition: machine.h:108
machine::memory
struct memory * memory
Definition: machine.h:126
bus_pci.h
machine::physical_ram_in_mb
uint32_t physical_ram_in_mb
Definition: machine.h:147
dev_pckbc_init
int dev_pckbc_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int type, char *keyboard_irqpath, char *mouse_irqpath, int in_use, int pc_style_flag)
Definition: dev_pckbc.cc:1157
dev_sgi_gbe_init
void dev_sgi_gbe_init(struct machine *machine, struct memory *mem, uint64_t baseaddr)
Definition: dev_sgi_gbe.cc:736
MACHINE_NAME_MAXBUF
#define MACHINE_NAME_MAXBUF
Definition: machine_sgi.cc:56
DEV_RAM_MIGHT_POINT_TO_DEVICES
#define DEV_RAM_MIGHT_POINT_TO_DEVICES
Definition: devices.h:366
store_32bit_word
int store_32bit_word(struct cpu *cpu, uint64_t addr, uint64_t data32)
Definition: memory.cc:783
dev_macepci_init
struct pci_data * dev_macepci_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, char *irq_path)
Definition: dev_sgi_ip32.cc:785
dev_sgi_mec_init
void dev_sgi_mec_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, char *irq_path, unsigned char *macaddr)
Definition: dev_sgi_mec.cc:667
arcbios_init
void arcbios_init(struct machine *machine, int is64bit, uint64_t sgi_ram_offset, const char *primary_ether_string, uint8_t *primary_ether_macaddr)
Definition: arcbios.cc:2481
arcbios.h
devices.h
dev_sgi_ust_init
void dev_sgi_ust_init(struct memory *mem, uint64_t baseaddr)
Definition: dev_sgi_ip32.cc:860
PCKBC_8242
#define PCKBC_8242
Definition: devices.h:321
machine::machine_name
const char * machine_name
Definition: machine.h:115
dev_mc146818_init
void dev_mc146818_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, char *irq_path, int access_style, int addrdiv)
Definition: dev_mc146818.cc:587
cpu
Definition: cpu.h:326
net.h
machine::memory_offset_in_mb
int memory_offset_in_mb
Definition: machine.h:148
machine_entry_add_alias
void machine_entry_add_alias(struct machine_entry *me, const char *name)
Definition: machine.cc:697
bus_pci_add
void bus_pci_add(struct machine *machine, struct pci_data *pci_data, struct memory *mem, int bus, int device, int function, const char *name)
Definition: bus_pci.cc:216
CRIME_INT_PERIPH_MISC
#define CRIME_INT_PERIPH_MISC
Definition: crimereg.h:113
dev_ram_init
void dev_ram_init(struct machine *machine, uint64_t baseaddr, uint64_t length, int mode, uint64_t otheraddress, const char *name)
Definition: dev_ram.cc:146
memory.h
crimereg.h
diskimage_exist
int diskimage_exist(struct machine *machine, int id, int type)
Definition: diskimage.cc:106
sgi_arcbios.h
CHECK_ALLOCATION
#define CHECK_ALLOCATION(ptr)
Definition: misc.h:239

Generated on Tue Aug 25 2020 19:25:06 for GXemul by doxygen 1.8.18