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 > 256) {
430  fatal("TODO: Legacy framework cannot handle more than 256 MB for the SGI O2.\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  at address 0. */
437  dev_ram_init(machine, 0x40000000ULL, machine->physical_ram_in_mb * 1048576, DEV_RAM_MIRROR, 0);
438 
439  /* Connect CRIME (Interrupt Controller) to MIPS irq 2: */
440  snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2",
442  dev_crime_init(machine, mem, 0x14000000, tmpstr, machine->x11_md.in_use);
443 
444  /* Rendering Engine */
445  dev_sgi_re_init(machine, mem, 0x15000000);
446 
447  /* Graphics Back End */
448  dev_sgi_gbe_init(machine, mem, 0x16000000);
449 
450  /*
451  * A combination of NetBSD and Linux info:
452  *
453  * 14000000 crime (interrupt/memory controller?)
454  * 15000000 drawing engine, memory transfer engine, rendering engine
455  * 16000000 gbe (graphics), crm framebuffer control
456  * 17000000 vice (Video Image Compression Engine)
457  * 18000000 pci (?)
458  * 1f000000 mace
459  * 1f080000 macepci
460  * 1f100000 vin1
461  * 1f180000 vin2
462  * 1f200000 vout
463  * 1f280000 enet (mec0, MAC-110 Ethernet)
464  * 1f300000 perif:
465  * 1f300000 audio ("a3"?)
466  * 1f310000 isa
467  * 1f318000 (unknown, accessed by Irix' pciio_pio_write64 and by the PROM during bootup)
468  * 1f31c000 (unknown, accessed by the PROM during bootup)
469  * 1f320000 kbdms
470  * 1f330000 i2c
471  * 1f340000 ust
472  * 1f380000 isa ext
473  * 1f390000 com0 (serial)
474  * 1f398000 com1 (serial)
475  * 1f3a0000 mcclock0
476  */
477 
478  /*
479  * IRQ mapping is really ugly. TODO: fix
480  *
481  * com0 at mace0 offset 0x390000 intr 4 intrmask
482  * 0x3f00000: ns16550a, working fifo
483  * com1 at mace0 offset 0x398000 intr 4 intrmask
484  * 0xfc000000: ns16550a, working fifo
485  * pckbc0 at mace0 offset 0x320000 intr 5 intrmask 0x0
486  * mcclock0 at mace0 offset 0x3a0000 intrmask 0x0
487  * macepci0 at mace0 offset 0x80000 intr 7 intrmask 0x0: rev 1
488  *
489  * intr 4 = CRIME_INT_PERIPH_SERIAL
490  * intr 5 = CRIME_INT_PERIPH_MISC
491  * intr 7 = CRIME_INT_PCI_BRIDGE
492  */
493 
494  snprintf(eaddr_string, ETHERNET_STRING_MAXLEN,
495  "eaddr=%02x:%02x:%02x:%02x:%02x:%02x",
496  macaddr[0], macaddr[1], macaddr[2],
497  macaddr[3], macaddr[4], macaddr[5]);
498 
499  snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2.crime.0x%x",
501  dev_sgi_mec_init(machine, mem, 0x1f280000,
502  tmpstr, macaddr);
503 
504  dev_sgi_ust_init(mem, 0x1f340000); /* ust? */
505 
506  snprintf(tmpstr, sizeof(tmpstr),
507  "ns16550 irq=%s.cpu[%i].2.crime.0x%x.mace.%i addr="
508  "0x1f390000 addr_mult=0x100 in_use=%i name2=tty0",
511  j = (size_t)device_add(machine, tmpstr);
512  snprintf(tmpstr, sizeof(tmpstr),
513  "ns16550 irq=%s.cpu[%i].2.crime.0x%x.mace.%i addr="
514  "0x1f398000 addr_mult=0x100 in_use=%i name2=tty1",
516  CRIME_INT_PERIPH_SERIAL, 26, 0);
517  device_add(machine, tmpstr);
518 
520 
521  {
522  /* keyb+mouse (mace irq numbers) */
523  char tmpstr1[1000];
524  char tmpstr2[1000];
525  snprintf(tmpstr1, sizeof(tmpstr1),
526  "%s.cpu[%i].2.crime.0x%x.mace.%i",
529 
530  snprintf(tmpstr2, sizeof(tmpstr2),
531  "%s.cpu[%i].2.crime.0x%x.mace.%i",
534 
535  i = dev_pckbc_init(machine, mem, 0x1f320000,
536  PCKBC_8242, tmpstr1,
537  tmpstr2, machine->x11_md.in_use,
538  0);
539 
540  if (machine->x11_md.in_use)
542  }
543 
544  snprintf(tmpstr, sizeof(tmpstr),
545  "%s.cpu[%i].2.crime.0x%x.mace.%i",
548  dev_mc146818_init(machine, mem, 0x1f3a0000, tmpstr,
549  MC146818_SGI, 0x40); /* mcclock0 */
550 
551  /*
552  * PCI devices: (according to NetBSD's GENERIC
553  * config file for sgimips)
554  *
555  * ne* at pci? dev ? function ?
556  * ahc0 at pci0 dev 1 function ?
557  * ahc1 at pci0 dev 2 function ?
558  */
559 
560  snprintf(tmpstr, sizeof(tmpstr),
561  "%s.cpu[%i].2.crime.0x%x", machine->path,
563  pci_data = dev_macepci_init(machine, mem, 0x1f080000,
564  tmpstr); /* macepci0 */
565  /* bus_pci_add(machine, pci_data, mem, 0, 0, 0,
566  "ne2000"); TODO */
567 
568  /*
569  * OpenBSD accesses the SCSI controller at paddr=0x2800010xx.
570  * Note that the 2 is above 32-bit range.
571  *
572  * TODO: Investigate what this actually means. Possibly
573  * a bug in GXemul's 64-bit instructions? Or perhaps it really
574  * is correct.
575  */
576  dev_ram_init(machine, 0x280000000ULL, 0x01000000, DEV_RAM_MIRROR, 0x18000000);
577 
578 
579  // ahc0:
580  /* TODO: Make it possible to add the controller, regardless of
581  the existence of disks! */
590  bus_pci_add(machine, pci_data, mem, 0, 1, 0, "ahc");
591 
592  // ahc1:
593  // bus_pci_add(machine, pci_data, mem, 0, 2, 0, "ahc");
594 
595  break;
596 
597  case 35:
598  strlcat(machineName, " (Origin 3000)", MACHINE_NAME_MAXBUF);
599  /* 4 cpus per node */
600 
601  // TODO: Correct Interrupt!
602  snprintf(tmpstr, sizeof(tmpstr), "z8530 addr=0x1fbd9830 irq=%s.cpu[%i].2",
604  machine->main_console_handle = (size_t)device_add(machine, tmpstr);
605 
606  break;
607 
608  case 53:
609  strlcat(machineName, " (Origin 350)",
611 
612  /*
613  * According to http://kumba.drachentekh.net/xml/myguide.html
614  * Origin 350, Tezro IP53 R16000
615  */
616  break;
617 
618  default:
619  fatal("unimplemented SGI machine type IP%i\n",
621  exit(1);
622  }
623 
624  if (!machine->prom_emulation)
625  return;
626 
627  arcbios_init(machine, arc_wordlen == sizeof(uint64_t), sgi_ram_offset,
628  eaddr_string, macaddr);
629 }
630 
631 
633 {
634  if (machine->machine_subtype <= 12)
635  machine->cpu_name = strdup("R3000");
636  if (machine->cpu_name == NULL && machine->machine_subtype == 35)
637  machine->cpu_name = strdup("R12000");
638  if (machine->cpu_name == NULL && (machine->machine_subtype == 25 ||
639  machine->machine_subtype == 27 || machine->machine_subtype == 28 ||
641  machine->cpu_name = strdup("R10000");
642  if (machine->cpu_name == NULL && (machine->machine_subtype == 21 ||
643  machine->machine_subtype == 26))
644  machine->cpu_name = strdup("R8000");
645  if (machine->cpu_name == NULL && machine->machine_subtype == 24)
646  machine->cpu_name = strdup("R5000");
647 
648  /* Other SGIs should probably work with
649  R4000, R4400 or R5000 or similar: */
650  if (machine->cpu_name == NULL)
651  machine->cpu_name = strdup("R4400");
652 }
653 
654 
656 {
657  // Self-compilation fails with OpenBSD/sgi 6.3 with as low as 128 MB
658  // RAM, so 256 would be better. But my O2 has 128 MB, so this is kept
659  // as 128 to simplify comparison between the real machine and the
660  // emulator.
662 }
663 
664 
666 {
667  MR_DEFAULT(sgi, "SGI", ARCH_MIPS, MACHINE_SGI);
668 
669  me->set_default_ram = machine_default_ram_sgi;
670 
671  machine_entry_add_alias(me, "silicon graphics");
672  machine_entry_add_alias(me, "sgi");
673 
674  machine_entry_add_subtype(me, "IP12", 12, "ip12", NULL);
675 
676  machine_entry_add_subtype(me, "IP19", 19, "ip19", NULL);
677 
678  machine_entry_add_subtype(me, "IP20", 20, "ip20", NULL);
679 
680  machine_entry_add_subtype(me, "IP22", 22, "ip22", "indy", NULL);
681 
682  machine_entry_add_subtype(me, "IP24", 24, "ip24", NULL);
683 
684  machine_entry_add_subtype(me, "IP27", 27,
685  "ip27", "origin 200", "origin 2000", NULL);
686 
687  machine_entry_add_subtype(me, "IP28", 28, "ip28", NULL);
688 
689  machine_entry_add_subtype(me, "IP30", 30, "ip30", "octane", NULL);
690 
691  machine_entry_add_subtype(me, "IP32", 32, "ip32", "o2", NULL);
692 
693  machine_entry_add_subtype(me, "IP35", 35, "ip35", NULL);
694 }
695 
void dev_mc146818_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, char *irq_path, int access_style, int addrdiv)
void fatal(const char *fmt,...)
Definition: main.cc:152
int prom_emulation
Definition: machine.h:149
char * cpu_name
Definition: machine.h:133
int main_console_handle
Definition: machine.h:128
int store_32bit_word(struct cpu *cpu, uint64_t addr, uint64_t data32)
Definition: memory.cc:783
int diskimage_exist(struct machine *machine, int id, int type)
Definition: diskimage.cc:106
#define DEV_RAM_RAM
Definition: devices.h:364
#define DISKIMAGE_SCSI
Definition: diskimage.h:40
void dev_sgi_ust_init(struct memory *mem, uint64_t baseaddr)
MACHINE_DEFAULT_CPU(sgi)
Definition: machine_sgi.cc:632
MACHINE_DEFAULT_RAM(sgi)
Definition: machine_sgi.cc:655
struct memory * memory
Definition: machine.h:126
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
struct pci_data * dev_macepci_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, char *irq_path)
void * device_add(struct machine *machine, const char *name_and_params)
Definition: device.cc:252
int physical_ram_in_mb
Definition: machine.h:147
#define DEV_RAM_MIRROR
Definition: devices.h:365
void dev_sgi_re_init(struct machine *machine, struct memory *mem, uint64_t baseaddr)
Definition: dev_sgi_re.cc:380
MACHINE_SETUP(sgi)
Definition: machine_sgi.cc:59
#define CHECK_ALLOCATION(ptr)
Definition: misc.h:239
char * path
Definition: machine.h:108
int bootstrap_cpu
Definition: machine.h:136
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:134
void machine_entry_add_subtype(struct machine_entry *me, const char *name, int oldstyle_subtype,...)
Definition: machine.cc:717
void net_generate_unique_mac(struct machine *, unsigned char *macbuf)
Definition: net_misc.cc:88
void machine_entry_add_alias(struct machine_entry *me, const char *name)
Definition: machine.cc:697
struct x11_md x11_md
Definition: machine.h:179
#define MACHINE_NAME_MAXBUF
Definition: machine_sgi.cc:56
Definition: cpu.h:326
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
#define DEV_RAM_MIGHT_POINT_TO_DEVICES
Definition: devices.h:366
#define MC146818_SGI
Definition: devices.h:306
void dev_crime_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, char *irq_path, int use_fb)
#define CRIME_INT_PERIPH_SERIAL
Definition: crimereg.h:114
#define MACHINE_SGI
Definition: machine.h:217
int in_use
Definition: machine.h:82
uint8_t byte_order
Definition: cpu.h:347
void dev_sgi_gbe_init(struct machine *machine, struct memory *mem, uint64_t baseaddr)
Definition: dev_sgi_gbe.cc:736
#define CRIME_INT_ETHERNET
Definition: crimereg.h:115
#define PCKBC_8242
Definition: devices.h:321
Definition: memory.h:75
MACHINE_REGISTER(sgi)
Definition: machine_sgi.cc:665
int memory_offset_in_mb
Definition: machine.h:148
int machine_subtype
Definition: machine.h:112
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
#define CRIME_INT_PCI_BRIDGE
Definition: crimereg.h:111
#define ETHERNET_STRING_MAXLEN
Definition: machine_sgi.cc:55
#define MR_DEFAULT(x, name, arch, type)
Definition: machine.h:370
const char * machine_name
Definition: machine.h:115
#define ARCH_MIPS
Definition: machine.h:203
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:2476
#define EMUL_BIG_ENDIAN
Definition: misc.h:165
#define CRIME_INT_PERIPH_MISC
Definition: crimereg.h:113

Generated on Fri Dec 7 2018 19:52:23 for GXemul by doxygen 1.8.13