/[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 32 by dpavlin, Mon Oct 8 16:20:58 2007 UTC revision 34 by dpavlin, Mon Oct 8 16:21:17 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.6 2006/08/30 15:07:47 debug Exp $   *  $Id: machine_sgi.c,v 1.17 2007/02/18 09:19:48 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    
281                  if (machine->use_x11)                  if (machine->use_x11)
282                          machine->main_console_handle = j;                          machine->main_console_handle = j;
# Line 354  Why is this here? TODO Line 364  Why is this here? TODO
364                  strlcat(machine->machine_name, " (Octane)",                  strlcat(machine->machine_name, " (Octane)",
365                      MACHINE_NAME_MAXBUF);                      MACHINE_NAME_MAXBUF);
366    
367                  machine->md_int.sgi_ip30_data =  fatal("TODO: SGI legacy interrupt system rewrite!\n");
368                      dev_sgi_ip30_init(machine, mem, 0x0ff00000);  abort();
369                  machine->md_interrupt = sgi_ip30_interrupt;  //              machine->md_int.sgi_ip30_data =
370    //                  dev_sgi_ip30_init(machine, mem, 0x0ff00000);
371    
372    fatal("TODO: Legacy rewrite\n");
373    abort();
374    //              machine->md_interrupt = sgi_ip30_interrupt;
375    
376                  dev_ram_init(machine, 0xa0000000ULL, 128 * 1048576,                  dev_ram_init(machine, 0xa0000000ULL, 128 * 1048576,
377                      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 429  Why is this here? TODO
429                  dev_ram_init(machine, 0x40000000ULL, 128 * 1048576,                  dev_ram_init(machine, 0x40000000ULL, 128 * 1048576,
430                      DEV_RAM_MIRROR, 0x10000000);                      DEV_RAM_MIRROR, 0x10000000);
431    
432                  machine->md_int.ip32.crime_data = dev_crime_init(machine,                  /*  Connect CRIME (Interrupt Controller) to MIPS irq 2:  */
433                      mem, 0x14000000, 2, machine->use_x11);      /*  crime0  */                  snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2",
434                        machine->path, machine->bootstrap_cpu);
435                    dev_crime_init(machine, mem, 0x14000000, tmpstr,
436                        machine->use_x11);                          /*  crime0  */
437                  dev_sgi_mte_init(mem, 0x15000000);              /*  mte ???  */                  dev_sgi_mte_init(mem, 0x15000000);              /*  mte ???  */
438                  dev_sgi_gbe_init(machine, mem, 0x16000000);     /*  gbe?  */                  dev_sgi_gbe_init(machine, mem, 0x16000000);     /*  gbe?  */
439    
# Line 443  Why is this here? TODO Line 461  Why is this here? TODO
461                   *        1f3a0000        mcclock0                   *        1f3a0000        mcclock0
462                   */                   */
463    
                 machine->md_int.ip32.mace_data =  
                     dev_mace_init(mem, 0x1f310000, 2);  
                 machine->md_interrupt = sgi_ip32_interrupt;  
   
464                  /*                  /*
465                   *  IRQ mapping is really ugly.  TODO: fix                   *  IRQ mapping is really ugly.  TODO: fix
466                   *                   *
# Line 471  Why is this here? TODO Line 485  Why is this here? TODO
485                      "eaddr=%02x:%02x:%02x:%02x:%02x:%02x",                      "eaddr=%02x:%02x:%02x:%02x:%02x:%02x",
486                      macaddr[0], macaddr[1], macaddr[2],                      macaddr[0], macaddr[1], macaddr[2],
487                      macaddr[3], macaddr[4], macaddr[5]);                      macaddr[3], macaddr[4], macaddr[5]);
488    
489                    snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2.crime.0x%x",
490                        machine->path, machine->bootstrap_cpu, MACE_ETHERNET);
491                  dev_sgi_mec_init(machine, mem, 0x1f280000,                  dev_sgi_mec_init(machine, mem, 0x1f280000,
492                      MACE_ETHERNET, macaddr);                      tmpstr, macaddr);
493    
494                  dev_sgi_ust_init(mem, 0x1f340000);  /*  ust?  */                  dev_sgi_ust_init(mem, 0x1f340000);  /*  ust?  */
495    
496                  snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%i addr="                  snprintf(tmpstr, sizeof(tmpstr),
497                        "ns16550 irq=%s.cpu[%i].2.crime.0x%x.mace.%i addr="
498                      "0x1f390000 addr_mult=0x100 in_use=%i name2=tty0",                      "0x1f390000 addr_mult=0x100 in_use=%i name2=tty0",
499                      (1<<20) + MACE_PERIPH_SERIAL, machine->use_x11? 0 : 1);                      machine->path, machine->bootstrap_cpu,
500                        MACE_PERIPH_SERIAL, 20, machine->use_x11? 0 : 1);
501                  j = (size_t)device_add(machine, tmpstr);                  j = (size_t)device_add(machine, tmpstr);
502                  snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%i addr="                  snprintf(tmpstr, sizeof(tmpstr),
503                        "ns16550 irq=%s.cpu[%i].2.crime.0x%x.mace.%i addr="
504                      "0x1f398000 addr_mult=0x100 in_use=%i name2=tty1",                      "0x1f398000 addr_mult=0x100 in_use=%i name2=tty1",
505                      (1<<26) + MACE_PERIPH_SERIAL, 0);                      machine->path, machine->bootstrap_cpu,
506                        MACE_PERIPH_SERIAL, 26, 0);
507                  device_add(machine, tmpstr);                  device_add(machine, tmpstr);
508    
509                  machine->main_console_handle = j;                  machine->main_console_handle = j;
510    
511                  /*  TODO: Once this works, it should be enabled                  /*  TODO: Once this works, it should be enabled
512                      always, not just when using X!  */                      always, not just when using X!  */
513    #if 0
514    fatal("TODO: legacy SGI rewrite\n");
515    abort();
516                  if (machine->use_x11) {                  if (machine->use_x11) {
517                          i = dev_pckbc_init(machine, mem, 0x1f320000,                          i = dev_pckbc_init(machine, mem, 0x1f320000,
518                              PCKBC_8242, 0x200 + MACE_PERIPH_MISC,                              PCKBC_8242, 0x200 + MACE_PERIPH_MISC,
# Line 496  Why is this here? TODO Line 520  Why is this here? TODO
520                                  /*  keyb+mouse (mace irq numbers)  */                                  /*  keyb+mouse (mace irq numbers)  */
521                          machine->main_console_handle = i;                          machine->main_console_handle = i;
522                  }                  }
523    #endif
524    
525                  dev_mc146818_init(machine, mem, 0x1f3a0000, (1<<8) +                  snprintf(tmpstr, sizeof(tmpstr),
526                      MACE_PERIPH_MISC, MC146818_SGI, 0x40);  /*  mcclock0  */                      "%s.cpu[%i].2.crime.0x%x.mace.%i",
527                  machine->main_console_handle = (size_t)device_add(machine,                      machine->path, machine->bootstrap_cpu,
528                      "z8530 addr=0x1fbd9830 irq=0 addr_mult=4");                      MACE_PERIPH_MISC, 8);
529                    dev_mc146818_init(machine, mem, 0x1f3a0000, tmpstr,
530                        MC146818_SGI, 0x40);  /*  mcclock0  */
531    
532                    /*  TODO: _WHERE_ does the z8530 interrupt?  */
533                    snprintf(tmpstr, sizeof(tmpstr), "z8530 addr=0x1fbd9830 "
534                        "irq=%s.cpu[%i].2 addr_mult=4",
535                        machine->path, machine->bootstrap_cpu);
536                    machine->main_console_handle = (size_t)
537                        device_add(machine, tmpstr);
538    
539                  /*                  /*
540                   *  PCI devices:   (according to NetBSD's GENERIC                   *  PCI devices:   (according to NetBSD's GENERIC
# Line 511  Why is this here? TODO Line 545  Why is this here? TODO
545                   *      ahc1            at pci0 dev 2 function ?                   *      ahc1            at pci0 dev 2 function ?
546                   */                   */
547    
548                    snprintf(tmpstr, sizeof(tmpstr),
549                        "%s.cpu[%i].2.crime.0x%x", machine->path,
550                        machine->bootstrap_cpu, MACE_PCI_BRIDGE);
551                  pci_data = dev_macepci_init(machine, mem, 0x1f080000,                  pci_data = dev_macepci_init(machine, mem, 0x1f080000,
552                      MACE_PCI_BRIDGE);   /*  macepci0  */                      tmpstr);            /*  macepci0  */
553                  /*  bus_pci_add(machine, pci_data, mem, 0, 0, 0,                  /*  bus_pci_add(machine, pci_data, mem, 0, 0, 0,
554                      "ne2000");  TODO  */                      "ne2000");  TODO  */
555    

Legend:
Removed from v.32  
changed lines
  Added in v.34

  ViewVC Help
Powered by ViewVC 1.1.26