/[gxemul]/trunk/src/machines/machine_sgi.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/machines/machine_sgi.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 28 by dpavlin, Mon Oct 8 16:20:26 2007 UTC revision 38 by dpavlin, Mon Oct 8 16:21:53 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2003-2006  Anders Gavare.  All rights reserved.   *  Copyright (C) 2003-2007  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: machine_sgi.c,v 1.5 2006/06/30 20:22:54 debug Exp $   *  $Id: machine_sgi.c,v 1.18 2007/03/24 06:40:16 debug Exp $
29   *   *
30   *  Machine descriptions for Silicon Graphics' MIPS-based machines.   *  Machine descriptions for Silicon Graphics' MIPS-based machines.
31   *   *
# Line 46  Line 46 
46  #include "devices.h"  #include "devices.h"
47  #include "diskimage.h"  #include "diskimage.h"
48  #include "machine.h"  #include "machine.h"
 #include "machine_interrupts.h"  
49  #include "memory.h"  #include "memory.h"
50  #include "misc.h"  #include "misc.h"
51  #include "net.h"  #include "net.h"
# Line 170  MACHINE_SETUP(sgi) Line 169  MACHINE_SETUP(sgi)
169                   */                   */
170    
171                  /*  int0 at mainbus0 addr 0x1fb801c0  */                  /*  int0 at mainbus0 addr 0x1fb801c0  */
172                  machine->md_int.sgi_ip20_data = dev_sgi_ip20_init(cpu, mem,  fatal("TODO: SGI legacy interrupt system rewrite!\n");
173                      DEV_SGI_IP20_BASE);  abort();
174    //              machine->md_int.sgi_ip20_data = dev_sgi_ip20_init(cpu, mem,
175    //                  DEV_SGI_IP20_BASE);
176    
177                  /*  imc0 at mainbus0 addr 0x1fa00000: revision 0:                  /*  imc0 at mainbus0 addr 0x1fa00000: revision 0:
178                      TODO (or in dev_sgi_ip20?)  */                      TODO (or in dev_sgi_ip20?)  */
# Line 216  MACHINE_SETUP(sgi) Line 217  MACHINE_SETUP(sgi)
217                          strlcat(machine->machine_name,                          strlcat(machine->machine_name,
218                              " (Indy, Indigo2, Challenge S; Full-house)",                              " (Indy, Indigo2, Challenge S; Full-house)",
219                              MACHINE_NAME_MAXBUF);                              MACHINE_NAME_MAXBUF);
220                          machine->md_int.sgi_ip22_data =  fatal("TODO: SGI legacy interrupt system rewrite!\n");
221                              dev_sgi_ip22_init(machine, mem, 0x1fbd9000, 0);  abort();
222    //                      machine->md_int.sgi_ip22_data =
223    //                          dev_sgi_ip22_init(machine, mem, 0x1fbd9000, 0);
224                  } else {                  } else {
225                          strlcat(machine->machine_name,                          strlcat(machine->machine_name,
226                              " (Indy, Indigo2, Challenge S; Guiness)",                              " (Indy, Indigo2, Challenge S; Guiness)",
227                              MACHINE_NAME_MAXBUF);                              MACHINE_NAME_MAXBUF);
228                          machine->md_int.sgi_ip22_data =  fatal("TODO: SGI legacy interrupt system rewrite!\n");
229                              dev_sgi_ip22_init(machine, mem, 0x1fbd9880, 1);  abort();
230    //                      machine->md_int.sgi_ip22_data =
231    //                          dev_sgi_ip22_init(machine, mem, 0x1fbd9880, 1);
232                  }                  }
233    
234  /*  /*
# Line 231  Why is this here? TODO Line 236  Why is this here? TODO
236                  dev_ram_init(machine, 0x88000000ULL,                  dev_ram_init(machine, 0x88000000ULL,
237                      128 * 1048576, DEV_RAM_MIRROR, 0x08000000);                      128 * 1048576, DEV_RAM_MIRROR, 0x08000000);
238  */  */
239                  machine->md_interrupt = sgi_ip22_interrupt;  
240    fatal("TODO: Legacy rewrite\n");
241    abort();
242    //              machine->md_interrupt = sgi_ip22_interrupt;
243    
244                  /*                  /*
245                   *  According to NetBSD 1.6.2:                   *  According to NetBSD 1.6.2:
# Line 265  Why is this here? TODO Line 273  Why is this here? TODO
273                      "z8530 addr=0x1fbd9830 irq=363 addr_mult=4");                      "z8530 addr=0x1fbd9830 irq=363 addr_mult=4");
274    
275                  /*  Not supported by NetBSD 1.6.2, but by 2.0_BETA:  */                  /*  Not supported by NetBSD 1.6.2, but by 2.0_BETA:  */
276                  j = dev_pckbc_init(machine, mem, 0x1fbd9840, PCKBC_8242,  fatal("TODO: legacy rewrite\n");
277                      0, 0, machine->use_x11, 0);  /*  TODO: irq numbers  */  abort();
278    //              j = dev_pckbc_init(machine, mem, 0x1fbd9840, PCKBC_8242,
279    //                  0, 0, machine->use_x11, 0);  /*  TODO: irq numbers  */
280    j = 0;
281    
282                  if (machine->use_x11)                  if (machine->use_x11)
283                          machine->main_console_handle = j;                          machine->main_console_handle = j;
# Line 354  Why is this here? TODO Line 365  Why is this here? TODO
365                  strlcat(machine->machine_name, " (Octane)",                  strlcat(machine->machine_name, " (Octane)",
366                      MACHINE_NAME_MAXBUF);                      MACHINE_NAME_MAXBUF);
367    
368                  machine->md_int.sgi_ip30_data =  fatal("TODO: SGI legacy interrupt system rewrite!\n");
369                      dev_sgi_ip30_init(machine, mem, 0x0ff00000);  abort();
370                  machine->md_interrupt = sgi_ip30_interrupt;  //              machine->md_int.sgi_ip30_data =
371    //                  dev_sgi_ip30_init(machine, mem, 0x0ff00000);
372    
373    fatal("TODO: Legacy rewrite\n");
374    abort();
375    //              machine->md_interrupt = sgi_ip30_interrupt;
376    
377                  dev_ram_init(machine, 0xa0000000ULL, 128 * 1048576,                  dev_ram_init(machine, 0xa0000000ULL, 128 * 1048576,
378                      DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES,                      DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES,
# Line 414  Why is this here? TODO Line 430  Why is this here? TODO
430                  dev_ram_init(machine, 0x40000000ULL, 128 * 1048576,                  dev_ram_init(machine, 0x40000000ULL, 128 * 1048576,
431                      DEV_RAM_MIRROR, 0x10000000);                      DEV_RAM_MIRROR, 0x10000000);
432    
433                  machine->md_int.ip32.crime_data = dev_crime_init(machine,                  /*  Connect CRIME (Interrupt Controller) to MIPS irq 2:  */
434                      mem, 0x14000000, 2, machine->use_x11);      /*  crime0  */                  snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2",
435                        machine->path, machine->bootstrap_cpu);
436                    dev_crime_init(machine, mem, 0x14000000, tmpstr,
437                        machine->use_x11);                          /*  crime0  */
438                  dev_sgi_mte_init(mem, 0x15000000);              /*  mte ???  */                  dev_sgi_mte_init(mem, 0x15000000);              /*  mte ???  */
439                  dev_sgi_gbe_init(machine, mem, 0x16000000);     /*  gbe?  */                  dev_sgi_gbe_init(machine, mem, 0x16000000);     /*  gbe?  */
440    
# Line 443  Why is this here? TODO Line 462  Why is this here? TODO
462                   *        1f3a0000        mcclock0                   *        1f3a0000        mcclock0
463                   */                   */
464    
                 machine->md_int.ip32.mace_data =  
                     dev_mace_init(mem, 0x1f310000, 2);  
                 machine->md_interrupt = sgi_ip32_interrupt;  
   
465                  /*                  /*
466                   *  IRQ mapping is really ugly.  TODO: fix                   *  IRQ mapping is really ugly.  TODO: fix
467                   *                   *
# Line 471  Why is this here? TODO Line 486  Why is this here? TODO
486                      "eaddr=%02x:%02x:%02x:%02x:%02x:%02x",                      "eaddr=%02x:%02x:%02x:%02x:%02x:%02x",
487                      macaddr[0], macaddr[1], macaddr[2],                      macaddr[0], macaddr[1], macaddr[2],
488                      macaddr[3], macaddr[4], macaddr[5]);                      macaddr[3], macaddr[4], macaddr[5]);
489    
490                    snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2.crime.0x%x",
491                        machine->path, machine->bootstrap_cpu, MACE_ETHERNET);
492                  dev_sgi_mec_init(machine, mem, 0x1f280000,                  dev_sgi_mec_init(machine, mem, 0x1f280000,
493                      MACE_ETHERNET, macaddr);                      tmpstr, macaddr);
494    
495                  dev_sgi_ust_init(mem, 0x1f340000);  /*  ust?  */                  dev_sgi_ust_init(mem, 0x1f340000);  /*  ust?  */
496    
497                  snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%i addr="                  snprintf(tmpstr, sizeof(tmpstr),
498                        "ns16550 irq=%s.cpu[%i].2.crime.0x%x.mace.%i addr="
499                      "0x1f390000 addr_mult=0x100 in_use=%i name2=tty0",                      "0x1f390000 addr_mult=0x100 in_use=%i name2=tty0",
500                      (1<<20) + MACE_PERIPH_SERIAL, machine->use_x11? 0 : 1);                      machine->path, machine->bootstrap_cpu,
501                        MACE_PERIPH_SERIAL, 20, machine->use_x11? 0 : 1);
502                  j = (size_t)device_add(machine, tmpstr);                  j = (size_t)device_add(machine, tmpstr);
503                  snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%i addr="                  snprintf(tmpstr, sizeof(tmpstr),
504                        "ns16550 irq=%s.cpu[%i].2.crime.0x%x.mace.%i addr="
505                      "0x1f398000 addr_mult=0x100 in_use=%i name2=tty1",                      "0x1f398000 addr_mult=0x100 in_use=%i name2=tty1",
506                      (1<<26) + MACE_PERIPH_SERIAL, 0);                      machine->path, machine->bootstrap_cpu,
507                        MACE_PERIPH_SERIAL, 26, 0);
508                  device_add(machine, tmpstr);                  device_add(machine, tmpstr);
509    
510                  machine->main_console_handle = j;                  machine->main_console_handle = j;
511    
512                  /*  TODO: Once this works, it should be enabled                  /*  TODO: Once this works, it should be enabled
513                      always, not just when using X!  */                      always, not just when using X!  */
514    #if 0
515    fatal("TODO: legacy SGI rewrite\n");
516    abort();
517                  if (machine->use_x11) {                  if (machine->use_x11) {
518                          i = dev_pckbc_init(machine, mem, 0x1f320000,                          i = dev_pckbc_init(machine, mem, 0x1f320000,
519                              PCKBC_8242, 0x200 + MACE_PERIPH_MISC,                              PCKBC_8242, 0x200 + MACE_PERIPH_MISC,
# Line 496  Why is this here? TODO Line 521  Why is this here? TODO
521                                  /*  keyb+mouse (mace irq numbers)  */                                  /*  keyb+mouse (mace irq numbers)  */
522                          machine->main_console_handle = i;                          machine->main_console_handle = i;
523                  }                  }
524    #endif
525    
526                  dev_mc146818_init(machine, mem, 0x1f3a0000, (1<<8) +                  snprintf(tmpstr, sizeof(tmpstr),
527                      MACE_PERIPH_MISC, MC146818_SGI, 0x40);  /*  mcclock0  */                      "%s.cpu[%i].2.crime.0x%x.mace.%i",
528                  machine->main_console_handle = (size_t)device_add(machine,                      machine->path, machine->bootstrap_cpu,
529                      "z8530 addr=0x1fbd9830 irq=0 addr_mult=4");                      MACE_PERIPH_MISC, 8);
530                    dev_mc146818_init(machine, mem, 0x1f3a0000, tmpstr,
531                        MC146818_SGI, 0x40);  /*  mcclock0  */
532    
533                    /*  TODO: _WHERE_ does the z8530 interrupt?  */
534                    snprintf(tmpstr, sizeof(tmpstr), "z8530 addr=0x1fbd9830 "
535                        "irq=%s.cpu[%i].2 addr_mult=4",
536                        machine->path, machine->bootstrap_cpu);
537                    machine->main_console_handle = (size_t)
538                        device_add(machine, tmpstr);
539    
540                  /*                  /*
541                   *  PCI devices:   (according to NetBSD's GENERIC                   *  PCI devices:   (according to NetBSD's GENERIC
# Line 511  Why is this here? TODO Line 546  Why is this here? TODO
546                   *      ahc1            at pci0 dev 2 function ?                   *      ahc1            at pci0 dev 2 function ?
547                   */                   */
548    
549                    snprintf(tmpstr, sizeof(tmpstr),
550                        "%s.cpu[%i].2.crime.0x%x", machine->path,
551                        machine->bootstrap_cpu, MACE_PCI_BRIDGE);
552                  pci_data = dev_macepci_init(machine, mem, 0x1f080000,                  pci_data = dev_macepci_init(machine, mem, 0x1f080000,
553                      MACE_PCI_BRIDGE);   /*  macepci0  */                      tmpstr);            /*  macepci0  */
554                  /*  bus_pci_add(machine, pci_data, mem, 0, 0, 0,                  /*  bus_pci_add(machine, pci_data, mem, 0, 0, 0,
555                      "ne2000");  TODO  */                      "ne2000");  TODO  */
556    
# Line 530  Why is this here? TODO Line 568  Why is this here? TODO
568                  /*  TODO: second ahc  */                  /*  TODO: second ahc  */
569                  /*  bus_pci_add(machine, pci_data, mem, 0, 2, 0, "ahc");  */                  /*  bus_pci_add(machine, pci_data, mem, 0, 2, 0, "ahc");  */
570    
571                    /*
572                     *  An additional PCI IDE controller, for NetBSD/sgimips
573                     *  experiments:  (Not found in a regular O2.)
574                     */
575                    bus_pci_add(machine, pci_data, mem, 0, 3, 0, "symphony_82c105");
576    
577                  break;                  break;
578    
579          case 35:          case 35:

Legend:
Removed from v.28  
changed lines
  Added in v.38

  ViewVC Help
Powered by ViewVC 1.1.26