/[gxemul]/trunk/src/machine.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/machine.c

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

revision 16 by dpavlin, Mon Oct 8 16:19:01 2007 UTC revision 20 by dpavlin, Mon Oct 8 16:19:23 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: machine.c,v 1.569 2005/10/11 03:31:27 debug Exp $   *  $Id: machine.c,v 1.611 2005/11/23 23:31:34 debug Exp $
29   *   *
30   *  Emulation of specific machines.   *  Emulation of specific machines.
31   *   *
# Line 51  Line 51 
51  #include <unistd.h>  #include <unistd.h>
52    
53  #include "arcbios.h"  #include "arcbios.h"
54    #include "bus_isa.h"
55  #include "bus_pci.h"  #include "bus_pci.h"
56  #include "cpu.h"  #include "cpu.h"
57  #include "device.h"  #include "device.h"
# Line 165  struct machine *machine_new(char *name, Line 166  struct machine *machine_new(char *name,
166          m->boot_string_argument = NULL;          m->boot_string_argument = NULL;
167          m->automatic_clock_adjustment = 1;          m->automatic_clock_adjustment = 1;
168          m->x11_scaledown = 1;          m->x11_scaledown = 1;
169            m->x11_scaleup = 1;
170          m->n_gfx_cards = 1;          m->n_gfx_cards = 1;
171          m->dbe_on_nonexistant_memaccess = 1;          m->dbe_on_nonexistant_memaccess = 1;
172          m->show_symbolic_register_names = 1;          m->show_symbolic_register_names = 1;
# Line 1293  void au1x00_interrupt(struct machine *m, Line 1295  void au1x00_interrupt(struct machine *m,
1295    
1296    
1297  /*  /*
1298   *  Malta (evbmips) interrupts:   *  CPC700 interrupt routine:
1299   *   *
1300   *  ISA interrupts.   *  irq_nr should be 0..31. (32 means reassertion.)
  *  (irq_nr = 16+8 can be used to just reassert/deassert interrupts.)  
1301   */   */
1302  void malta_interrupt(struct machine *m, struct cpu *cpu, int irq_nr,  void cpc700_interrupt(struct machine *m, struct cpu *cpu,
1303          int assrt)          int irq_nr, int assrt)
1304  {  {
1305          int mask;          if (irq_nr < 32) {
1306                    uint32_t mask = 1 << (irq_nr & 31);
         irq_nr -= 8;  
         mask = 1 << (irq_nr & 7);  
   
         if (irq_nr < 8) {  
                 if (assrt)  
                         m->isa_pic_data.pic1->irr |= mask;  
                 else  
                         m->isa_pic_data.pic1->irr &= ~mask;  
         } else if (irq_nr < 16) {  
1307                  if (assrt)                  if (assrt)
1308                          m->isa_pic_data.pic2->irr |= mask;                          m->md_int.cpc700_data->sr |= mask;
1309                  else                  else
1310                          m->isa_pic_data.pic2->irr &= ~mask;                          m->md_int.cpc700_data->sr &= ~mask;
1311          }          }
1312    
1313          /*  Any interrupt assertions on PIC2 go to irq 2 on PIC1  */          if ((m->md_int.cpc700_data->sr & m->md_int.cpc700_data->er) != 0)
1314          /*  (TODO: don't hardcode this here)  */                  cpu_interrupt(cpu, 65);
         if (m->isa_pic_data.pic2->irr &  
             ~m->isa_pic_data.pic2->ier)  
                 m->isa_pic_data.pic1->irr |= 0x04;  
         else  
                 m->isa_pic_data.pic1->irr &= ~0x04;  
   
         /*  Now, PIC1:  */  
         if (m->isa_pic_data.pic1->irr &  
             ~m->isa_pic_data.pic1->ier)  
                 cpu_interrupt(cpu, 2);  
1315          else          else
1316                  cpu_interrupt_ack(cpu, 2);                  cpu_interrupt_ack(cpu, 65);
   
         /*  printf("MALTA: pic1.irr=0x%02x ier=0x%02x pic2.irr=0x%02x "  
             "ier=0x%02x\n", m->isa_pic_data.pic1->irr,  
             m->isa_pic_data.pic1->ier,  
             m->isa_pic_data.pic2->irr,  
             m->isa_pic_data.pic2->ier);  */  
1317  }  }
1318    
1319    
1320  /*  /*
1321   *  Cobalt interrupts:   *  Interrupt function for Cobalt, evbmips (Malta), and Algor.
1322   *   *
1323   *  (irq_nr = 8 + 16 can be used to just reassert/deassert interrupts.)   *  (irq_nr = 8 + 16 can be used to just reassert/deassert interrupts.)
1324   */   */
1325  void cobalt_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, int assrt)  void isa8_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, int assrt)
1326  {  {
1327          int mask;          int mask, x;
1328            int old_isa_assert, new_isa_assert;
1329    
1330            old_isa_assert = m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier;
1331    
1332          irq_nr -= 8;          irq_nr -= 8;
1333          mask = 1 << (irq_nr & 7);          mask = 1 << (irq_nr & 7);
# Line 1367  void cobalt_interrupt(struct machine *m, Line 1346  void cobalt_interrupt(struct machine *m,
1346    
1347          /*  Any interrupt assertions on PIC2 go to irq 2 on PIC1  */          /*  Any interrupt assertions on PIC2 go to irq 2 on PIC1  */
1348          /*  (TODO: don't hardcode this here)  */          /*  (TODO: don't hardcode this here)  */
1349          if (m->isa_pic_data.pic2->irr &          if (m->isa_pic_data.pic2->irr & ~m->isa_pic_data.pic2->ier)
             ~m->isa_pic_data.pic2->ier)  
1350                  m->isa_pic_data.pic1->irr |= 0x04;                  m->isa_pic_data.pic1->irr |= 0x04;
1351          else          else
1352                  m->isa_pic_data.pic1->irr &= ~0x04;                  m->isa_pic_data.pic1->irr &= ~0x04;
1353    
1354          /*  Now, PIC1:  */          /*  Now, PIC1:  */
1355          if (m->isa_pic_data.pic1->irr &          new_isa_assert = m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier;
1356              ~m->isa_pic_data.pic1->ier)          if (old_isa_assert != new_isa_assert) {
1357                  cpu_interrupt(cpu, 6);                  for (x=0; x<16; x++) {
1358          else                          if (x == 2)
1359                  cpu_interrupt_ack(cpu, 6);                                  continue;
1360                            if (x < 8 && (m->isa_pic_data.pic1->irr &
1361                                ~m->isa_pic_data.pic1->ier & (1 << x)))
1362                                    break;
1363                            if (x >= 8 && (m->isa_pic_data.pic2->irr &
1364                                ~m->isa_pic_data.pic2->ier & (1 << (x&7))))
1365                                    break;
1366                    }
1367                    m->isa_pic_data.last_int = x;
1368            }
1369    
1370          /*  printf("COBALT: pic1.irr=0x%02x ier=0x%02x pic2.irr=0x%02x "          if (m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier)
1371              "ier=0x%02x\n", m->isa_pic_data.pic1->irr,                  cpu_interrupt(cpu, m->isa_pic_data.native_irq);
1372              m->isa_pic_data.pic1->ier,          else
1373              m->isa_pic_data.pic2->irr,                  cpu_interrupt_ack(cpu, m->isa_pic_data.native_irq);
             m->isa_pic_data.pic2->ier);  */  
1374  }  }
1375    
1376    
# Line 1432  void x86_pc_interrupt(struct machine *m, Line 1418  void x86_pc_interrupt(struct machine *m,
1418    
1419    
1420  /*  /*
1421   *  Footbridge interrupts:   *  "Generic" ISA interrupt management, 32 native interrupts, 16 ISA
1422     *  interrupts.  So far: Footbridge (CATS, NetWinder), BeBox, and PReP.
1423   *   *
1424   *  0..31  = footbridge interrupt   *  0..31  = footbridge interrupt
1425   *  32..47 = ISA (connected to IRQ_IN_L2 on CATS, L3 on NetWinder)   *  32..47 = ISA interrupts
1426   *  64     = reassert   *  48     = ISA reassert
1427     *  64     = reassert (non-ISA)
1428   */   */
1429  void footbridge_interrupt(struct machine *m, struct cpu *cpu, int irq_nr,  void isa32_interrupt(struct machine *m, struct cpu *cpu, int irq_nr,
1430          int assrt)          int assrt)
1431  {  {
1432          uint32_t mask = 1 << (irq_nr & 31);          uint32_t mask = 1 << (irq_nr & 31);
1433          int old_isa_assert, new_isa_assert;          int old_isa_assert, new_isa_assert;
         int isa_int = m->machine_type == MACHINE_CATS? 10 : 11;  
1434    
1435          old_isa_assert = m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier;          old_isa_assert = m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier;
1436    
# Line 1470  void footbridge_interrupt(struct machine Line 1457  void footbridge_interrupt(struct machine
1457    
1458          /*  Now, PIC1:  */          /*  Now, PIC1:  */
1459          new_isa_assert = m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier;          new_isa_assert = m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier;
1460          if (old_isa_assert != new_isa_assert) {          if (old_isa_assert != new_isa_assert || irq_nr == 48) {
1461                  if (new_isa_assert)                  if (new_isa_assert) {
1462                          cpu_interrupt(cpu, isa_int);                          int x;
1463                  else                          for (x=0; x<16; x++) {
1464                          cpu_interrupt_ack(cpu, isa_int);                                  if (x == 2)
1465                                            continue;
1466                                    if (x < 8 && (m->isa_pic_data.pic1->irr &
1467                                        ~m->isa_pic_data.pic1->ier & (1 << x)))
1468                                            break;
1469                                    if (x >= 8 && (m->isa_pic_data.pic2->irr &
1470                                        ~m->isa_pic_data.pic2->ier & (1 << (x&7))))
1471                                            break;
1472                            }
1473                            m->isa_pic_data.last_int = x;
1474                            cpu_interrupt(cpu, m->isa_pic_data.native_irq);
1475                    } else
1476                            cpu_interrupt_ack(cpu, m->isa_pic_data.native_irq);
1477                  return;                  return;
1478          }          }
1479    
1480          if (irq_nr < 32) {          switch (m->machine_type) {
1481                  if (assrt)          case MACHINE_CATS:
1482                          m->md_int.footbridge_data->irq_status |= mask;          case MACHINE_NETWINDER:
1483                    if (irq_nr < 32) {
1484                            if (assrt)
1485                                    m->md_int.footbridge_data->irq_status |= mask;
1486                            else
1487                                    m->md_int.footbridge_data->irq_status &= ~mask;
1488                    }
1489                    if (m->md_int.footbridge_data->irq_status &
1490                        m->md_int.footbridge_data->irq_enable)
1491                            cpu_interrupt(cpu, 65);
1492                    else
1493                            cpu_interrupt_ack(cpu, 65);
1494                    break;
1495            case MACHINE_BEBOX:
1496                    if (irq_nr < 32) {
1497                            if (assrt)
1498                                    m->md_int.bebox_data->int_status |= mask;
1499                            else
1500                                    m->md_int.bebox_data->int_status &= ~mask;
1501                    }
1502                    if (m->md_int.bebox_data->int_status &
1503                        m->md_int.bebox_data->cpu0_int_mask)
1504                            cpu_interrupt(m->cpus[0], 65);
1505                    else
1506                            cpu_interrupt_ack(m->cpus[0], 65);
1507                    if (m->ncpus > 1 &&
1508                        m->md_int.bebox_data->int_status &
1509                        m->md_int.bebox_data->cpu1_int_mask)
1510                            cpu_interrupt(m->cpus[1], 65);
1511                  else                  else
1512                          m->md_int.footbridge_data->irq_status &= ~mask;                          cpu_interrupt_ack(m->cpus[1], 65);
1513                    break;
1514            case MACHINE_PREP:
1515                    if (irq_nr < 32) {
1516                            if (assrt)
1517                                    m->md_int.prep_data->int_status |= mask;
1518                            else
1519                                    m->md_int.prep_data->int_status &= ~mask;
1520                    }
1521                    if (m->md_int.prep_data->int_status & 2)
1522                            cpu_interrupt(cpu, 65);
1523                    else
1524                            cpu_interrupt_ack(cpu, 65);
1525                    break;
1526          }          }
   
         if (m->md_int.footbridge_data->irq_status &  
             m->md_int.footbridge_data->irq_enable)  
                 cpu_interrupt(cpu, 65);  
         else  
                 cpu_interrupt_ack(cpu, 65);  
1527  }  }
1528    
1529    
# Line 1528  void machine_setup(struct machine *machi Line 1562  void machine_setup(struct machine *machi
1562                  struct btinfo_symtab c;                  struct btinfo_symtab c;
1563          } xx;          } xx;
1564          struct hpc_bootinfo hpc_bootinfo;          struct hpc_bootinfo hpc_bootinfo;
1565          uint64_t hpcmips_fb_addr = 0;          int hpc_platid_flags = 0, hpc_platid_cpu_submodel = 0,
1566          int hpcmips_fb_bits = 0, hpcmips_fb_encoding = 0;              hpc_platid_cpu_model = 0, hpc_platid_cpu_series = 0,
1567          int hpcmips_fb_xsize = 0;              hpc_platid_cpu_arch = 0,
1568          int hpcmips_fb_ysize = 0;              hpc_platid_submodel = 0, hpc_platid_model = 0,
1569          int hpcmips_fb_xsize_mem = 0;              hpc_platid_series = 0, hpc_platid_vendor = 0;
1570          int hpcmips_fb_ysize_mem = 0;          uint64_t hpc_fb_addr = 0;
1571            int hpc_fb_bits = 0, hpc_fb_encoding = 0;
1572            int hpc_fb_xsize = 0;
1573            int hpc_fb_ysize = 0;
1574            int hpc_fb_xsize_mem = 0;
1575            int hpc_fb_ysize_mem = 0;
1576    
1577          /*  ARCBIOS stuff:  */          /*  ARCBIOS stuff:  */
1578          uint64_t sgi_ram_offset = 0;          uint64_t sgi_ram_offset = 0;
# Line 2121  void machine_setup(struct machine *machi Line 2160  void machine_setup(struct machine *machi
2160    
2161                  /*                  /*
2162                   *  Most OSes on DECstation use physical addresses below                   *  Most OSes on DECstation use physical addresses below
2163                   *  0x20000000, but OSF/1 seems to use 0xbe...... as if it was                   *  0x20000000, but both OSF/1 and Sprite use 0xbe...... as if
2164                   *  0x1e......, so we need this hack:                   *  it was 0x1e......, so we need this hack:
2165                   */                   */
2166                  dev_ram_init(mem, 0xa0000000, 0x20000000, DEV_RAM_MIRROR, 0x0);                  dev_ram_init(machine, 0xa0000000, 0x20000000,
2167                        DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES, 0x0);
2168    
2169                  if (machine->prom_emulation) {                  if (machine->prom_emulation) {
2170                          /*  DECstation PROM stuff:  (TODO: endianness)  */                          /*  DECstation PROM stuff:  (TODO: endianness)  */
# Line 2357  void machine_setup(struct machine *machi Line 2397  void machine_setup(struct machine *machi
2397                  machine->isa_pic_data.pic1 = device_add(machine, tmpstr);                  machine->isa_pic_data.pic1 = device_add(machine, tmpstr);
2398                  snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x100000a0");                  snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x100000a0");
2399                  machine->isa_pic_data.pic2 = device_add(machine, tmpstr);                  machine->isa_pic_data.pic2 = device_add(machine, tmpstr);
2400                  machine->md_interrupt = cobalt_interrupt;                  machine->md_interrupt = isa8_interrupt;
2401                    machine->isa_pic_data.native_irq = 6;
2402    
2403                  dev_mc146818_init(machine, mem, 0x10000070, 0, MC146818_PC_CMOS, 4);                  dev_mc146818_init(machine, mem, 0x10000070, 0, MC146818_PC_CMOS, 4);
2404    
2405                  machine->main_console_handle = (size_t)                  machine->main_console_handle = (size_t)
2406                      device_add(machine, "ns16550 irq=5 addr=0x1c800000 name2=tty0 in_use=1");                      device_add(machine, "ns16550 irq=5 addr=0x1c800000 name2=tty0 in_use=1");
2407    
2408                    /*  TODO: bus_isa() ?  */
2409    
2410  #if 0  #if 0
2411                  device_add(machine, "ns16550 irq=0 addr=0x1f000010 name2=tty1 in_use=0");                  device_add(machine, "ns16550 irq=0 addr=0x1f000010 name2=tty1 in_use=0");
2412  #endif  #endif
# Line 2381  void machine_setup(struct machine *machi Line 2424  void machine_setup(struct machine *machi
2424                   *  The PCI controller interrupts at ISA interrupt 9.                   *  The PCI controller interrupts at ISA interrupt 9.
2425                   */                   */
2426                  pci_data = dev_gt_init(machine, mem, 0x14000000, 2, 8 + 9, 11);                  pci_data = dev_gt_init(machine, mem, 0x14000000, 2, 8 + 9, 11);
2427                  /*  bus_pci_add(machine, pci_data, mem, 0,  7, 0, pci_dec21143_init, pci_dec21143_rr);  */                  bus_pci_add(machine, pci_data, mem, 0,  7, 0, "dec21143");
2428                  bus_pci_add(machine, pci_data, mem, 0,  8, 0, NULL, NULL);  /*  PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_860  */                  /*  bus_pci_add(machine, pci_data, mem, 0,  8, 0, "symbios_860");   PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_860  */
2429                  bus_pci_add(machine, pci_data, mem, 0,  9, 0, pci_vt82c586_isa_init, pci_vt82c586_isa_rr);                  bus_pci_add(machine, pci_data, mem, 0,  9, 0, "vt82c586_isa");
2430                  bus_pci_add(machine, pci_data, mem, 0,  9, 1, pci_vt82c586_ide_init, pci_vt82c586_ide_rr);                  bus_pci_add(machine, pci_data, mem, 0,  9, 1, "vt82c586_ide");
2431                  /*  bus_pci_add(machine, pci_data, mem, 0, 12, 0, pci_dec21143_init, pci_dec21143_rr);  */                  /*  bus_pci_add(machine, pci_data, mem, 0, 12, 0, "dec21143");  */
2432    
2433                  if (machine->prom_emulation) {                  if (machine->prom_emulation) {
2434                          /*                          /*
# Line 2407  void machine_setup(struct machine *machi Line 2450  void machine_setup(struct machine *machi
2450          case MACHINE_HPCMIPS:          case MACHINE_HPCMIPS:
2451                  cpu->byte_order = EMUL_LITTLE_ENDIAN;                  cpu->byte_order = EMUL_LITTLE_ENDIAN;
2452                  memset(&hpc_bootinfo, 0, sizeof(hpc_bootinfo));                  memset(&hpc_bootinfo, 0, sizeof(hpc_bootinfo));
                 /*  TODO:  set platid from netbsd/usr/src/sys/arch/hpc/include/platid*  */  
                 /*  
                 #define PLATID_FLAGS_SHIFT              0  
                 #define PLATID_CPU_SUBMODEL_SHIFT       8  
                 #define PLATID_CPU_MODEL_SHIFT          14  
                 #define PLATID_CPU_SERIES_SHIFT         20  
                 #define PLATID_CPU_ARCH_SHIFT           26  
   
                 #define PLATID_SUBMODEL_SHIFT           0  
                 #define PLATID_MODEL_SHIFT              8  
                 #define PLATID_SERIES_SHIFT             16  
                 #define PLATID_VENDOR_SHIFT             22  
                 */  
   
2453                  /*                  /*
2454                  NOTE: See http://forums.projectmayo.com/viewtopic.php?topic=2743&forum=23                  NOTE: See http://forums.projectmayo.com/viewtopic.php?topic=2743&forum=23
2455                  for info on framebuffer addresses.                  for info on framebuffer addresses.
# Line 2430  void machine_setup(struct machine *machi Line 2459  void machine_setup(struct machine *machi
2459                  case MACHINE_HPCMIPS_CASIO_BE300:                  case MACHINE_HPCMIPS_CASIO_BE300:
2460                          /*  166MHz VR4131  */                          /*  166MHz VR4131  */
2461                          machine->machine_name = "Casio Cassiopeia BE-300";                          machine->machine_name = "Casio Cassiopeia BE-300";
2462                          hpcmips_fb_addr = 0x0a200000;                          hpc_fb_addr = 0x0a200000;
2463                          hpcmips_fb_xsize = 240;                          hpc_fb_xsize = 240;
2464                          hpcmips_fb_ysize = 320;                          hpc_fb_ysize = 320;
2465                          hpcmips_fb_xsize_mem = 256;                          hpc_fb_xsize_mem = 256;
2466                          hpcmips_fb_ysize_mem = 320;                          hpc_fb_ysize_mem = 320;
2467                          hpcmips_fb_bits = 15;                          hpc_fb_bits = 15;
2468                          hpcmips_fb_encoding = BIFB_D16_0000;                          hpc_fb_encoding = BIFB_D16_0000;
2469    
2470                          /*  TODO: irq?  */                          /*  TODO: irq?  */
2471                          snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=0x0a008680 addr_mult=4 in_use=%i", machine->use_x11? 0 : 1);                          snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=0x0a008680 addr_mult=4 in_use=%i", machine->use_x11? 0 : 1);
# Line 2445  void machine_setup(struct machine *machi Line 2474  void machine_setup(struct machine *machi
2474                          machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4131);                          machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4131);
2475                          machine->md_interrupt = vr41xx_interrupt;                          machine->md_interrupt = vr41xx_interrupt;
2476    
2477                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu,                          hpc_platid_cpu_arch = 1;        /*  MIPS  */
2478                                (1 << 26)         /*  1 = MIPS  */                          hpc_platid_cpu_series = 1;      /*  VR  */
2479                              + (1 << 20)         /*  1 = VR  */                          hpc_platid_cpu_model = 1;       /*  VR41XX  */
2480                              + (1 << 14)         /*  1 = VR41XX  */                          hpc_platid_cpu_submodel = 6;    /*  VR4131  */
2481                              + (6 <<  8)         /*  6 = VR4131  */                          hpc_platid_vendor = 3;          /*  Casio  */
2482                              );                          hpc_platid_series = 1;          /*  CASSIOPEIAE  */
2483                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine,                          hpc_platid_model = 2;           /*  EXXX  */
2484                                (3 << 22)         /*  22: vendor  3=casio */                          hpc_platid_submodel = 3;        /*  E500  */
                             + (1 << 16)         /*  16: series  1=CASSIOPEIAE*/  
                             + (2 <<  8)         /*   8: model   2=EXXX*/  
                             + (3)               /*   0: submodel 3=E500 */  
                             );  
2485                          /*  TODO: Don't use model number for E500, it's a BE300!  */                          /*  TODO: Don't use model number for E500, it's a BE300!  */
2486                          break;                          break;
2487                  case MACHINE_HPCMIPS_CASIO_E105:                  case MACHINE_HPCMIPS_CASIO_E105:
2488                          /*  131MHz VR4121  */                          /*  131MHz VR4121  */
2489                          machine->machine_name = "Casio Cassiopeia E-105";                          machine->machine_name = "Casio Cassiopeia E-105";
2490                          hpcmips_fb_addr = 0x0a200000;   /*  TODO?  */                          hpc_fb_addr = 0x0a200000;       /*  TODO?  */
2491                          hpcmips_fb_xsize = 240;                          hpc_fb_xsize = 240;
2492                          hpcmips_fb_ysize = 320;                          hpc_fb_ysize = 320;
2493                          hpcmips_fb_xsize_mem = 256;                          hpc_fb_xsize_mem = 256;
2494                          hpcmips_fb_ysize_mem = 320;                          hpc_fb_ysize_mem = 320;
2495                          hpcmips_fb_bits = 16;                          hpc_fb_bits = 16;
2496                          hpcmips_fb_encoding = BIFB_D16_0000;                          hpc_fb_encoding = BIFB_D16_0000;
2497    
2498                          /*  TODO: irq?  */                          /*  TODO: irq?  */
2499                          snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=0x0a008680 addr_mult=4 in_use=%i", machine->use_x11? 0 : 1);                          snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=0x0a008680 addr_mult=4 in_use=%i", machine->use_x11? 0 : 1);
# Line 2477  void machine_setup(struct machine *machi Line 2502  void machine_setup(struct machine *machi
2502                          machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121);                          machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121);
2503                          machine->md_interrupt = vr41xx_interrupt;                          machine->md_interrupt = vr41xx_interrupt;
2504    
2505                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu,                          hpc_platid_cpu_arch = 1;        /*  MIPS  */
2506                                (1 << 26)         /*  1 = MIPS  */                          hpc_platid_cpu_series = 1;      /*  VR  */
2507                              + (1 << 20)         /*  1 = VR  */                          hpc_platid_cpu_model = 1;       /*  VR41XX  */
2508                              + (1 << 14)         /*  1 = VR41XX  */                          hpc_platid_cpu_submodel = 3;    /*  VR4121  */
2509                              + (3 <<  8)         /*  3 = VR4121  */                          hpc_platid_vendor = 3;          /*  Casio  */
2510                              );                          hpc_platid_series = 1;          /*  CASSIOPEIAE  */
2511                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine,                          hpc_platid_model = 2;           /*  EXXX  */
2512                                (3 << 22)         /*  22: vendor  3=casio */                          hpc_platid_submodel = 2;        /*  E105  */
                             + (1 << 16)         /*  16: series  1=CASSIOPEIAE*/  
                             + (2 <<  8)         /*   8: model   2=EXXX*/  
                             + (2)               /*   0: submodel 2=E105  */  
                             );  
2513                          break;                          break;
2514                  case MACHINE_HPCMIPS_NEC_MOBILEPRO_770:                  case MACHINE_HPCMIPS_NEC_MOBILEPRO_770:
2515                          /*  131 MHz VR4121  */                          /*  131 MHz VR4121  */
2516                          machine->machine_name = "NEC MobilePro 770";                          machine->machine_name = "NEC MobilePro 770";
2517                          /*  TODO:  */                          hpc_fb_addr = 0xa000000;
2518                          hpcmips_fb_addr = 0xa000000;                          hpc_fb_xsize = 640;
2519                          hpcmips_fb_xsize = 640;                          hpc_fb_ysize = 240;
2520                          hpcmips_fb_ysize = 240;                          hpc_fb_xsize_mem = 800;
2521                          hpcmips_fb_xsize_mem = 800;                          hpc_fb_ysize_mem = 240;
2522                          hpcmips_fb_ysize_mem = 240;                          hpc_fb_bits = 16;
2523                          hpcmips_fb_bits = 16;                          hpc_fb_encoding = BIFB_D16_0000;
                         hpcmips_fb_encoding = BIFB_D16_0000;  
2524    
2525                          machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121);                          machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121);
2526                          machine->md_interrupt = vr41xx_interrupt;                          machine->md_interrupt = vr41xx_interrupt;
2527    
2528                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu,                          hpc_platid_cpu_arch = 1;        /*  MIPS  */
2529                                (1 << 26)         /*  1 = MIPS  */                          hpc_platid_cpu_series = 1;      /*  VR  */
2530                              + (1 << 20)         /*  1 = VR  */                          hpc_platid_cpu_model = 1;       /*  VR41XX  */
2531                              + (1 << 14)         /*  1 = VR41XX  */                          hpc_platid_cpu_submodel = 3;    /*  VR4121  */
2532                              + (3 <<  8)         /*  3 = VR4121  */                          hpc_platid_vendor = 1;          /*  NEC  */
2533                              );                          hpc_platid_series = 2;          /*  NEC MCR  */
2534                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine,                          hpc_platid_model = 2;           /*  MCR 5XX  */
2535                                (1 << 22)         /*  22: vendor  1=NEC  */                          hpc_platid_submodel = 4;        /*  MCR 520A  */
                             + (2 << 16)         /*  16: series  2="NEC MCR" */  
                             + (2 <<  8)         /*   8: model   2="MCR 5XX" */  
                             + (4)               /*   0: submodel 4="MCR 520A" */  
                             );  
2536                          break;                          break;
2537                  case MACHINE_HPCMIPS_NEC_MOBILEPRO_780:                  case MACHINE_HPCMIPS_NEC_MOBILEPRO_780:
2538                          /*  166 (or 168) MHz VR4121  */                          /*  166 (or 168) MHz VR4121  */
2539                          machine->machine_name = "NEC MobilePro 780";                          machine->machine_name = "NEC MobilePro 780";
2540                          /*  TODO:  */                          hpc_fb_addr = 0xa180100;
2541                          hpcmips_fb_addr = 0xa180100;                          hpc_fb_xsize = 640;
2542                          hpcmips_fb_xsize = 640;                          hpc_fb_ysize = 240;
2543                          hpcmips_fb_ysize = 240;                          hpc_fb_xsize_mem = 640;
2544                          hpcmips_fb_xsize_mem = 640;                          hpc_fb_ysize_mem = 240;
2545                          hpcmips_fb_ysize_mem = 240;                          hpc_fb_bits = 16;
2546                          hpcmips_fb_bits = 16;                          hpc_fb_encoding = BIFB_D16_0000;
                         hpcmips_fb_encoding = BIFB_D16_0000;  
2547    
2548                          machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121);                          machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121);
2549                          machine->md_interrupt = vr41xx_interrupt;                          machine->md_interrupt = vr41xx_interrupt;
2550    
2551                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu,                          hpc_platid_cpu_arch = 1;        /*  MIPS  */
2552                                (1 << 26)         /*  1 = MIPS  */                          hpc_platid_cpu_series = 1;      /*  VR  */
2553                              + (1 << 20)         /*  1 = VR  */                          hpc_platid_cpu_model = 1;       /*  VR41XX  */
2554                              + (1 << 14)         /*  1 = VR41XX  */                          hpc_platid_cpu_submodel = 3;    /*  VR4121  */
2555                              + (3 <<  8)         /*  3 = VR4121  */                          hpc_platid_vendor = 1;          /*  NEC  */
2556                              );                          hpc_platid_series = 2;          /*  NEC MCR  */
2557                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine,                          hpc_platid_model = 2;           /*  MCR 5XX  */
2558                                (1 << 22)         /*  22: vendor  1=NEC  */                          hpc_platid_submodel = 8;        /*  MCR 530A  */
                             + (2 << 16)         /*  16: series  2="NEC MCR" */  
                             + (2 <<  8)         /*   8: model   2="MCR 5XX" */  
                             + (8)               /*   0: submodel 8="MCR 530A" */  
                             );  
2559                          break;                          break;
2560                  case MACHINE_HPCMIPS_NEC_MOBILEPRO_800:                  case MACHINE_HPCMIPS_NEC_MOBILEPRO_800:
2561                          /*  131 MHz VR4121  */                          /*  131 MHz VR4121  */
2562                          machine->machine_name = "NEC MobilePro 800";                          machine->machine_name = "NEC MobilePro 800";
2563                          /*  TODO:  */                          hpc_fb_addr = 0xa000000;
2564                          hpcmips_fb_addr = 0xa000000;                          hpc_fb_xsize = 800;
2565                          hpcmips_fb_xsize = 800;                          hpc_fb_ysize = 600;
2566                          hpcmips_fb_ysize = 600;                          hpc_fb_xsize_mem = 800;
2567                          hpcmips_fb_xsize_mem = 800;                          hpc_fb_ysize_mem = 600;
2568                          hpcmips_fb_ysize_mem = 600;                          hpc_fb_bits = 16;
2569                          hpcmips_fb_bits = 16;                          hpc_fb_encoding = BIFB_D16_0000;
                         hpcmips_fb_encoding = BIFB_D16_0000;  
2570    
2571                          machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121);                          machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121);
2572                          machine->md_interrupt = vr41xx_interrupt;                          machine->md_interrupt = vr41xx_interrupt;
2573    
2574                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu,                          hpc_platid_cpu_arch = 1;        /*  MIPS  */
2575                                (1 << 26)         /*  1 = MIPS  */                          hpc_platid_cpu_series = 1;      /*  VR  */
2576                              + (1 << 20)         /*  1 = VR  */                          hpc_platid_cpu_model = 1;       /*  VR41XX  */
2577                              + (1 << 14)         /*  1 = VR41XX  */                          hpc_platid_cpu_submodel = 3;    /*  VR4121  */
2578                              + (3 <<  8)         /*  3 = VR4121  */                          hpc_platid_vendor = 1;          /*  NEC  */
2579                              );                          hpc_platid_series = 2;          /*  NEC MCR  */
2580                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine,                          hpc_platid_model = 3;           /*  MCR 7XX  */
2581                                (1 << 22)         /*  22: vendor  1=NEC  */                          hpc_platid_submodel = 2;        /*  MCR 700A  */
                             + (2 << 16)         /*  16: series  2="NEC MCR" */  
                             + (3 <<  8)         /*   8: model   3="MCR 7XX" */  
                             + (2)               /*   0: submodel 2="MCR 700A" */  
                             );  
2582                          break;                          break;
2583                  case MACHINE_HPCMIPS_NEC_MOBILEPRO_880:                  case MACHINE_HPCMIPS_NEC_MOBILEPRO_880:
2584                          /*  168 MHz VR4121  */                          /*  168 MHz VR4121  */
2585                          machine->machine_name = "NEC MobilePro 880";                          machine->machine_name = "NEC MobilePro 880";
2586                          /*  TODO:  */                          hpc_fb_addr = 0xa0ea600;
2587                          hpcmips_fb_addr = 0xa0ea600;                          hpc_fb_xsize = 800;
2588                          hpcmips_fb_xsize = 800;                          hpc_fb_ysize = 600;
2589                          hpcmips_fb_ysize = 600;                          hpc_fb_xsize_mem = 800;
2590                          hpcmips_fb_xsize_mem = 800;                          hpc_fb_ysize_mem = 600;
2591                          hpcmips_fb_ysize_mem = 600;                          hpc_fb_bits = 16;
2592                          hpcmips_fb_bits = 16;                          hpc_fb_encoding = BIFB_D16_0000;
                         hpcmips_fb_encoding = BIFB_D16_0000;  
2593    
2594                          machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121);                          machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121);
2595                          machine->md_interrupt = vr41xx_interrupt;                          machine->md_interrupt = vr41xx_interrupt;
2596    
2597                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu,                          hpc_platid_cpu_arch = 1;        /*  MIPS  */
2598                                (1 << 26)         /*  1 = MIPS  */                          hpc_platid_cpu_series = 1;      /*  VR  */
2599                              + (1 << 20)         /*  1 = VR  */                          hpc_platid_cpu_model = 1;       /*  VR41XX  */
2600                              + (1 << 14)         /*  1 = VR41XX  */                          hpc_platid_cpu_submodel = 3;    /*  VR4121  */
2601                              + (3 <<  8)         /*  3 = VR4121  */                          hpc_platid_vendor = 1;          /*  NEC  */
2602                              );                          hpc_platid_series = 2;          /*  NEC MCR  */
2603                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine,                          hpc_platid_model = 3;           /*  MCR 7XX  */
2604                                (1 << 22)         /*  22: vendor  1=NEC  */                          hpc_platid_submodel = 4;        /*  MCR 730A  */
                             + (2 << 16)         /*  16: series  2="NEC MCR" */  
                             + (3 <<  8)         /*   8: model   3="MCR 7XX" */  
                             + (4)               /*   0: submodel 4="MCR 730A" */  
                             );  
2605                          break;                          break;
2606                  case MACHINE_HPCMIPS_AGENDA_VR3:                  case MACHINE_HPCMIPS_AGENDA_VR3:
2607                          /*  66 MHz VR4181  */                          /*  66 MHz VR4181  */
2608                          machine->machine_name = "Agenda VR3";                          machine->machine_name = "Agenda VR3";
2609                          /*  TODO:  */                          /*  TODO:  */
2610                          hpcmips_fb_addr = 0x1000;                          hpc_fb_addr = 0x1000;
2611                          hpcmips_fb_xsize = 160;                          hpc_fb_xsize = 160;
2612                          hpcmips_fb_ysize = 240;                          hpc_fb_ysize = 240;
2613                          hpcmips_fb_xsize_mem = 160;                          hpc_fb_xsize_mem = 160;
2614                          hpcmips_fb_ysize_mem = 240;                          hpc_fb_ysize_mem = 240;
2615                          hpcmips_fb_bits = 4;                          hpc_fb_bits = 4;
2616                          hpcmips_fb_encoding = BIFB_D4_M2L_F;                          hpc_fb_encoding = BIFB_D4_M2L_F;
2617    
2618                          machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4181);                          machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4181);
2619                          machine->md_interrupt = vr41xx_interrupt;                          machine->md_interrupt = vr41xx_interrupt;
# Line 2628  void machine_setup(struct machine *machi Line 2629  void machine_setup(struct machine *machi
2629                                          machine->main_console_handle = x;                                          machine->main_console_handle = x;
2630                          }                          }
2631    
2632                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu,                          hpc_platid_cpu_arch = 1;        /*  MIPS  */
2633                                (1 << 26)         /*  1 = MIPS  */                          hpc_platid_cpu_series = 1;      /*  VR  */
2634                              + (1 << 20)         /*  1 = VR  */                          hpc_platid_cpu_model = 1;       /*  VR41XX  */
2635                              + (1 << 14)         /*  1 = VR41XX  */                          hpc_platid_cpu_submodel = 4;    /*  VR4181  */
2636                              + (4 <<  8)         /*  4 = VR4181  */                          hpc_platid_vendor = 15;         /*  Agenda  */
2637                              );                          hpc_platid_series = 1;          /*  VR  */
2638                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine,                          hpc_platid_model = 1;           /*  VR3  */
2639                                (15 << 22)        /*  22: vendor  15=Agenda  */                          hpc_platid_submodel = 0;        /*  -  */
                             + (1 << 16)         /*  16: series  2=VR */  
                             + (1 <<  8)         /*   8: model   1=VR3  */  
                             + (0)               /*   0: submodel 0="VR3" */  
                             );  
2640    
2641                          dev_ram_init(mem, 0x0f000000, 0x01000000, DEV_RAM_MIRROR, 0x0);                          dev_ram_init(machine, 0x0f000000, 0x01000000,
2642                                DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES, 0x0);
2643                          break;                          break;
2644                  case MACHINE_HPCMIPS_IBM_WORKPAD_Z50:                  case MACHINE_HPCMIPS_IBM_WORKPAD_Z50:
2645                          /*  131 MHz VR4121  */                          /*  131 MHz VR4121  */
2646                          machine->machine_name = "IBM Workpad Z50";                          machine->machine_name = "IBM Workpad Z50";
2647                          /*  TODO:  */                          /*  TODO:  */
2648                          hpcmips_fb_addr = 0xa000000;                          hpc_fb_addr = 0xa000000;
2649                          hpcmips_fb_xsize = 640;                          hpc_fb_xsize = 640;
2650                          hpcmips_fb_ysize = 480;                          hpc_fb_ysize = 480;
2651                          hpcmips_fb_xsize_mem = 640;                          hpc_fb_xsize_mem = 640;
2652                          hpcmips_fb_ysize_mem = 480;                          hpc_fb_ysize_mem = 480;
2653                          hpcmips_fb_bits = 16;                          hpc_fb_bits = 16;
2654                          hpcmips_fb_encoding = BIFB_D16_0000;                          hpc_fb_encoding = BIFB_D16_0000;
2655    
2656                          machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121);                          machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121);
2657                          machine->md_interrupt = vr41xx_interrupt;                          machine->md_interrupt = vr41xx_interrupt;
2658    
2659                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu,                          hpc_platid_cpu_arch = 1;        /*  MIPS  */
2660                                (1 << 26)         /*  1 = MIPS  */                          hpc_platid_cpu_series = 1;      /*  VR  */
2661                              + (1 << 20)         /*  1 = VR  */                          hpc_platid_cpu_model = 1;       /*  VR41XX  */
2662                              + (1 << 14)         /*  1 = VR41XX  */                          hpc_platid_cpu_submodel = 3;    /*  VR4121  */
2663                              + (3 <<  8)         /*  3 = VR4121  */                          hpc_platid_vendor = 9;          /*  IBM  */
2664                              );                          hpc_platid_series = 1;          /*  WorkPad  */
2665                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine,                          hpc_platid_model = 1;           /*  Z50  */
2666                                (9 << 22)         /*  22: vendor  9=IBM  */                          hpc_platid_submodel = 0;        /*  0  */
                             + (1 << 16)         /*  16: series  1=WorkPad */  
                             + (1 <<  8)         /*   8: model   1=Z50  */  
                             + (0)               /*   0: submodel 0 */  
                             );  
2667                          break;                          break;
2668                  default:                  default:
2669                          printf("Unimplemented hpcmips machine number.\n");                          printf("Unimplemented hpcmips machine number.\n");
2670                          exit(1);                          exit(1);
2671                  }                  }
2672    
2673                    store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu,
2674                          (hpc_platid_cpu_arch << 26) + (hpc_platid_cpu_series << 20)
2675                        + (hpc_platid_cpu_model << 14) + (hpc_platid_cpu_submodel <<  8)
2676                        + hpc_platid_flags);
2677                    store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine,
2678                          (hpc_platid_vendor << 22) + (hpc_platid_series << 16)
2679                        + (hpc_platid_model <<  8) + hpc_platid_submodel);
2680    
2681                  if (machine->use_x11)                  if (machine->use_x11)
2682                          machine->main_console_handle =                          machine->main_console_handle =
2683                              machine->md_int.vr41xx_data->kiu_console_handle;                              machine->md_int.vr41xx_data->kiu_console_handle;
# Line 2734  void machine_setup(struct machine *machi Line 2736  void machine_setup(struct machine *machi
2736    
2737                          store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.length, sizeof(hpc_bootinfo));                          store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.length, sizeof(hpc_bootinfo));
2738                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.magic, HPC_BOOTINFO_MAGIC);                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.magic, HPC_BOOTINFO_MAGIC);
2739                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_addr, 0x80000000 + hpcmips_fb_addr);                          store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_addr, 0x80000000 + hpc_fb_addr);
2740                          store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_line_bytes, hpcmips_fb_xsize_mem * (((hpcmips_fb_bits-1)|7)+1) / 8);                          store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_line_bytes, hpc_fb_xsize_mem * (((hpc_fb_bits-1)|7)+1) / 8);
2741                          store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_width, hpcmips_fb_xsize);                          store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_width, hpc_fb_xsize);
2742                          store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_height, hpcmips_fb_ysize);                          store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_height, hpc_fb_ysize);
2743                          store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_type, hpcmips_fb_encoding);                          store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_type, hpc_fb_encoding);
2744                          store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.bi_cnuse, BI_CNUSE_BUILTIN);  /*  _BUILTIN or _SERIAL  */                          store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.bi_cnuse, BI_CNUSE_BUILTIN);  /*  _BUILTIN or _SERIAL  */
2745    
2746                          /*  printf("hpc_bootinfo.platid_cpu     = 0x%08x\n", hpc_bootinfo.platid_cpu);                          /*  printf("hpc_bootinfo.platid_cpu     = 0x%08x\n", hpc_bootinfo.platid_cpu);
# Line 2747  void machine_setup(struct machine *machi Line 2749  void machine_setup(struct machine *machi
2749                          store_buf(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 256, (char *)&hpc_bootinfo, sizeof(hpc_bootinfo));                          store_buf(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 256, (char *)&hpc_bootinfo, sizeof(hpc_bootinfo));
2750                  }                  }
2751    
2752                  if (hpcmips_fb_addr != 0) {                  if (hpc_fb_addr != 0) {
2753                          dev_fb_init(machine, mem, hpcmips_fb_addr, VFB_HPCMIPS,                          dev_fb_init(machine, mem, hpc_fb_addr, VFB_HPC,
2754                              hpcmips_fb_xsize, hpcmips_fb_ysize,                              hpc_fb_xsize, hpc_fb_ysize,
2755                              hpcmips_fb_xsize_mem, hpcmips_fb_ysize_mem,                              hpc_fb_xsize_mem, hpc_fb_ysize_mem,
2756                              hpcmips_fb_bits, "HPCmips");                              hpc_fb_bits, machine->machine_name);
2757    
2758                          /*  NetBSD/hpcmips uses framebuffer at physical                          /*  NetBSD/hpcmips uses framebuffer at physical
2759                              address 0x8.......:  */                              address 0x8.......:  */
2760                          dev_ram_init(mem, 0x80000000, 0x20000000,                          dev_ram_init(machine, 0x80000000, 0x20000000,
2761                              DEV_RAM_MIRROR, 0x0);                              DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES, 0x0);
2762                  }                  }
2763    
2764                  break;                  break;
# Line 2784  void machine_setup(struct machine *machi Line 2786  void machine_setup(struct machine *machi
2786                  machine->md_int.ps2_data = dev_ps2_stuff_init(machine, mem, 0x10000000);                  machine->md_int.ps2_data = dev_ps2_stuff_init(machine, mem, 0x10000000);
2787                  device_add(machine, "ps2_gs addr=0x12000000");                  device_add(machine, "ps2_gs addr=0x12000000");
2788                  device_add(machine, "ps2_ether addr=0x14001000");                  device_add(machine, "ps2_ether addr=0x14001000");
2789                  dev_ram_init(mem, 0x1c000000, 4 * 1048576, DEV_RAM_RAM, 0);     /*  TODO: how much?  */                  dev_ram_init(machine, 0x1c000000, 4 * 1048576, DEV_RAM_RAM, 0); /*  TODO: how much?  */
2790                  /*  irq = 8 + 32 + 1 (SBUS/USB)  */                  /*  irq = 8 + 32 + 1 (SBUS/USB)  */
2791                  device_add(machine, "ohci addr=0x1f801600 irq=41");                  device_add(machine, "ohci addr=0x1f801600 irq=41");
2792    
# Line 2871  void machine_setup(struct machine *machi Line 2873  void machine_setup(struct machine *machi
2873                          /*  Special cases for IP20,22,24,26 memory offset:  */                          /*  Special cases for IP20,22,24,26 memory offset:  */
2874                          if (machine->machine_subtype == 20 || machine->machine_subtype == 22 ||                          if (machine->machine_subtype == 20 || machine->machine_subtype == 22 ||
2875                              machine->machine_subtype == 24 || machine->machine_subtype == 26) {                              machine->machine_subtype == 24 || machine->machine_subtype == 26) {
2876                                  dev_ram_init(mem, 0x00000000, 0x10000, DEV_RAM_MIRROR, sgi_ram_offset);                                  dev_ram_init(machine, 0x00000000, 0x10000, DEV_RAM_MIRROR
2877                                  dev_ram_init(mem, 0x00050000, sgi_ram_offset-0x50000, DEV_RAM_MIRROR, sgi_ram_offset + 0x50000);                                      | DEV_RAM_MIGHT_POINT_TO_DEVICES, sgi_ram_offset);
2878                                    dev_ram_init(machine, 0x00050000, sgi_ram_offset-0x50000,
2879                                        DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES, sgi_ram_offset + 0x50000);
2880                          }                          }
2881    
2882                          /*  Special cases for IP28,30 memory offset:  */                          /*  Special cases for IP28,30 memory offset:  */
2883                          if (machine->machine_subtype == 28 || machine->machine_subtype == 30) {                          if (machine->machine_subtype == 28 || machine->machine_subtype == 30) {
2884                                  /*  TODO: length below should maybe not be 128MB?  */                                  /*  TODO: length below should maybe not be 128MB?  */
2885                                  dev_ram_init(mem, 0x00000000, 128*1048576, DEV_RAM_MIRROR, sgi_ram_offset);                                  dev_ram_init(machine, 0x00000000, 128*1048576, DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES, sgi_ram_offset);
2886                          }                          }
2887                  } else {                  } else {
2888                          cpu->byte_order = EMUL_LITTLE_ENDIAN;                          cpu->byte_order = EMUL_LITTLE_ENDIAN;
# Line 2889  void machine_setup(struct machine *machi Line 2893  void machine_setup(struct machine *machi
2893                  if (machine->machine_type == MACHINE_SGI) {                  if (machine->machine_type == MACHINE_SGI) {
2894                          /*  TODO:  Other SGI machine types?  */                          /*  TODO:  Other SGI machine types?  */
2895                          switch (machine->machine_subtype) {                          switch (machine->machine_subtype) {
2896                            case 10:
2897                                    strlcat(machine->machine_name, " (4D/25)", MACHINE_NAME_MAXBUF);
2898                                    /*  TODO  */
2899                                    break;
2900                          case 12:                          case 12:
2901                                  strlcat(machine->machine_name,                                  strlcat(machine->machine_name,
2902                                      " (Iris Indigo IP12)", MACHINE_NAME_MAXBUF);                                      " (Iris Indigo IP12)", MACHINE_NAME_MAXBUF);
# Line 2990  void machine_setup(struct machine *machi Line 2998  void machine_setup(struct machine *machi
2998    
2999  /*  /*
3000  Why is this here? TODO  Why is this here? TODO
3001                                  dev_ram_init(mem, 0x88000000ULL,                                  dev_ram_init(machine, 0x88000000ULL,
3002                                      128 * 1048576, DEV_RAM_MIRROR, 0x08000000);                                      128 * 1048576, DEV_RAM_MIRROR, 0x08000000);
3003  */  */
3004                                  machine->md_interrupt = sgi_ip22_interrupt;                                  machine->md_interrupt = sgi_ip22_interrupt;
# Line 3117  Why is this here? TODO Line 3125  Why is this here? TODO
3125                                  machine->md_int.sgi_ip30_data = dev_sgi_ip30_init(machine, mem, 0x0ff00000);                                  machine->md_int.sgi_ip30_data = dev_sgi_ip30_init(machine, mem, 0x0ff00000);
3126                                  machine->md_interrupt = sgi_ip30_interrupt;                                  machine->md_interrupt = sgi_ip30_interrupt;
3127    
3128                                  dev_ram_init(mem,    0xa0000000ULL,                                  dev_ram_init(machine,    0xa0000000ULL,
3129                                      128 * 1048576, DEV_RAM_MIRROR, 0x00000000);                                      128 * 1048576, DEV_RAM_MIRROR
3130                                        | DEV_RAM_MIGHT_POINT_TO_DEVICES,
3131                                        0x00000000);
3132    
3133                                  dev_ram_init(mem,    0x80000000ULL,                                  dev_ram_init(machine,    0x80000000ULL,
3134                                      32 * 1048576, DEV_RAM_RAM, 0x00000000);                                      32 * 1048576, DEV_RAM_RAM, 0x00000000);
3135    
3136                                  /*                                  /*
# Line 3152  Why is this here? TODO Line 3162  Why is this here? TODO
3162                                      " (O2)", MACHINE_NAME_MAXBUF);                                      " (O2)", MACHINE_NAME_MAXBUF);
3163    
3164                                  /*  TODO:  Find out where the physical ram is actually located.  */                                  /*  TODO:  Find out where the physical ram is actually located.  */
3165                                  dev_ram_init(mem, 0x07ffff00ULL,           256, DEV_RAM_MIRROR, 0x03ffff00);                                  dev_ram_init(machine, 0x07ffff00ULL,           256, DEV_RAM_MIRROR, 0x03ffff00);
3166                                  dev_ram_init(mem, 0x10000000ULL,           256, DEV_RAM_MIRROR, 0x00000000);                                  dev_ram_init(machine, 0x10000000ULL,           256, DEV_RAM_MIRROR, 0x00000000);
3167                                  dev_ram_init(mem, 0x11ffff00ULL,           256, DEV_RAM_MIRROR, 0x01ffff00);                                  dev_ram_init(machine, 0x11ffff00ULL,           256, DEV_RAM_MIRROR, 0x01ffff00);
3168                                  dev_ram_init(mem, 0x12000000ULL,           256, DEV_RAM_MIRROR, 0x02000000);                                  dev_ram_init(machine, 0x12000000ULL,           256, DEV_RAM_MIRROR, 0x02000000);
3169                                  dev_ram_init(mem, 0x17ffff00ULL,           256, DEV_RAM_MIRROR, 0x03ffff00);                                  dev_ram_init(machine, 0x17ffff00ULL,           256, DEV_RAM_MIRROR, 0x03ffff00);
3170                                  dev_ram_init(mem, 0x20000000ULL, 128 * 1048576, DEV_RAM_MIRROR, 0x00000000);                                  dev_ram_init(machine, 0x20000000ULL, 128 * 1048576, DEV_RAM_MIRROR, 0x00000000);
3171                                  dev_ram_init(mem, 0x40000000ULL, 128 * 1048576, DEV_RAM_MIRROR, 0x10000000);                                  dev_ram_init(machine, 0x40000000ULL, 128 * 1048576, DEV_RAM_MIRROR, 0x10000000);
3172    
3173                                  machine->md_int.ip32.crime_data = dev_crime_init(machine, mem, 0x14000000, 2, machine->use_x11);        /*  crime0  */                                  machine->md_int.ip32.crime_data = dev_crime_init(machine, mem, 0x14000000, 2, machine->use_x11);        /*  crime0  */
3174                                  dev_sgi_mte_init(mem, 0x15000000);                      /*  mte ??? memory thing  */                                  dev_sgi_mte_init(mem, 0x15000000);                      /*  mte ??? memory thing  */
# Line 3250  Why is this here? TODO Line 3260  Why is this here? TODO
3260                                   */                                   */
3261    
3262                                  pci_data = dev_macepci_init(mem, 0x1f080000, MACE_PCI_BRIDGE);  /*  macepci0  */                                  pci_data = dev_macepci_init(mem, 0x1f080000, MACE_PCI_BRIDGE);  /*  macepci0  */
3263                                  /*  bus_pci_add(machine, pci_data, mem, 0, 0, 0, pci_ne2000_init, pci_ne2000_rr);  TODO  */                                  /*  bus_pci_add(machine, pci_data, mem, 0, 0, 0, "ne2000");  TODO  */
3264    
3265                                  /*  TODO: make this nicer  */                                  /*  TODO: make this nicer  */
3266                                  if (diskimage_exist(machine, 0, DISKIMAGE_SCSI) ||                                  if (diskimage_exist(machine, 0, DISKIMAGE_SCSI) ||
# Line 3261  Why is this here? TODO Line 3271  Why is this here? TODO
3271                                      diskimage_exist(machine, 5, DISKIMAGE_SCSI) ||                                      diskimage_exist(machine, 5, DISKIMAGE_SCSI) ||
3272                                      diskimage_exist(machine, 6, DISKIMAGE_SCSI) ||                                      diskimage_exist(machine, 6, DISKIMAGE_SCSI) ||
3273                                      diskimage_exist(machine, 7, DISKIMAGE_SCSI))                                      diskimage_exist(machine, 7, DISKIMAGE_SCSI))
3274                                          bus_pci_add(machine, pci_data, mem, 0, 1, 0, pci_ahc_init, pci_ahc_rr);                                          bus_pci_add(machine, pci_data, mem, 0, 1, 0, "ahc");
3275    
3276                                  /*  TODO: second ahc  */                                  /*  TODO: second ahc  */
3277                                  /*  bus_pci_add(machine, pci_data, mem, 0, 2, 0, pci_ahc_init, pci_ahc_rr);  */                                  /*  bus_pci_add(machine, pci_data, mem, 0, 2, 0, "ahc");  */
3278    
3279                                  break;                                  break;
3280                          case 35:                          case 35:
# Line 3346  Why is this here? TODO Line 3356  Why is this here? TODO
3356                                  case MACHINE_ARC_NEC_RD94:                                  case MACHINE_ARC_NEC_RD94:
3357                                  case MACHINE_ARC_NEC_R94:                                  case MACHINE_ARC_NEC_R94:
3358                                          /*  PCI devices:  (NOTE: bus must be 0, device must be 3, 4, or 5, for NetBSD to accept interrupts)  */                                          /*  PCI devices:  (NOTE: bus must be 0, device must be 3, 4, or 5, for NetBSD to accept interrupts)  */
3359                                          bus_pci_add(machine, pci_data, mem, 0, 3, 0, pci_dec21030_init, pci_dec21030_rr);       /*  tga graphics  */                                          bus_pci_add(machine, pci_data, mem, 0, 3, 0, "dec21030");       /*  tga graphics  */
3360                                          break;                                          break;
3361                                  case MACHINE_ARC_NEC_R96:                                  case MACHINE_ARC_NEC_R96:
3362                                          dev_fb_init(machine, mem, 0x100e00000ULL,                                          dev_fb_init(machine, mem, 0x100e00000ULL,
# Line 3469  Why is this here? TODO Line 3479  Why is this here? TODO
3479                                          break;                                          break;
3480                                  case MACHINE_ARC_JAZZ_MAGNUM:                                  case MACHINE_ARC_JAZZ_MAGNUM:
3481                                          /*  PROM mirror?  */                                          /*  PROM mirror?  */
3482                                          dev_ram_init(mem, 0xfff00000, 0x100000,                                          dev_ram_init(machine, 0xfff00000, 0x100000,
3483                                              DEV_RAM_MIRROR, 0x1fc00000);                                              DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES, 0x1fc00000);
3484    
3485                                          /*  VXL. TODO  */                                          /*  VXL. TODO  */
3486                                          /*  control at 0x60100000?  */                                          /*  control at 0x60100000?  */
# Line 3920  Not yet. Line 3930  Not yet.
3930                                  cpu->byte_order = EMUL_BIG_ENDIAN;                                  cpu->byte_order = EMUL_BIG_ENDIAN;
3931                          }                          }
3932    
3933                          /*  ISA interrupt controllers:  */                          machine->md_interrupt = isa8_interrupt;
3934                          snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x18000020");                          machine->isa_pic_data.native_irq = 2;
3935                          machine->isa_pic_data.pic1 = device_add(machine, tmpstr);  
3936                          snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x180000a0");                          bus_isa(machine, 0, 0x18000000, 0x10000000, 8, 24);
                         machine->isa_pic_data.pic2 = device_add(machine, tmpstr);  
                         machine->md_interrupt = malta_interrupt;  
   
                         dev_mc146818_init(machine, mem, 0x18000070, 8 + 8, MC146818_PC_CMOS, 1);  
   
                         machine->main_console_handle = (size_t)  
                             device_add(machine, "ns16550 irq=12 addr=0x180003f8 name2=tty0");  
                         device_add(machine, "ns16550 irq=11 addr=0x180002f8 name2=tty1");  
3937    
3938                          snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=4 addr=0x%x name2=tty2", MALTA_CBUSUART);                          snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=4 addr=0x%x name2=tty2", MALTA_CBUSUART);
3939                          device_add(machine, tmpstr);                          device_add(machine, tmpstr);
3940                          /*  TODO: Irqs  */  
3941                          pci_data = dev_gt_init(machine, mem, 0x1be00000, 8+9, 8+9, 120);                          pci_data = dev_gt_init(machine, mem, 0x1be00000, 8+9, 8+9, 120);
3942    
3943                          /*  TODO: Haha, this is bogus. Just a cut&paste                          if (machine->use_x11) {
3944                              from the Cobalt emulation above.  */                                  if (strlen(machine->boot_string_argument) < 3)
3945                          bus_pci_add(machine, pci_data, mem, 0,  9, 0, pci_vt82c586_isa_init, pci_vt82c586_isa_rr);                                          fatal("WARNING: remember to use  -o 'console=tty0'  "
3946                          bus_pci_add(machine, pci_data, mem, 0,  9, 1, pci_vt82c586_ide_init, pci_vt82c586_ide_rr);                                              "if you are emulating Linux. (Not needed for NetBSD.)\n");
3947                                    bus_pci_add(machine, pci_data, mem, 0xc0, 8, 0, "s3_virge");
3948                            }
3949    
3950                            bus_pci_add(machine, pci_data, mem, 0,  9, 0, "i82371ab_isa");
3951                            bus_pci_add(machine, pci_data, mem, 0,  9, 1, "i82371ab_ide");
3952    
3953                          device_add(machine, "malta_lcd addr=0x1f000400");                          device_add(machine, "malta_lcd addr=0x1f000400");
3954                          break;                          break;
# Line 3959  Not yet. Line 3966  Not yet.
3966                  }                  }
3967    
3968                  if (machine->prom_emulation) {                  if (machine->prom_emulation) {
                         /*  This is just a test.  TODO  */  
                         for (i=0; i<32; i++)  
                                 cpu->cd.mips.gpr[i] =  
                                     0x01230000 + (i << 8) + 0x55;  
   
3969                          /*  NetBSD/evbmips wants these: (at least for Malta)  */                          /*  NetBSD/evbmips wants these: (at least for Malta)  */
3970    
3971                          /*  a0 = argc  */                          /*  a0 = argc  */
# Line 4042  Not yet. Line 4044  Not yet.
4044                              "------------------------------------------\n");                              "------------------------------------------\n");
4045    
4046                  /*  480 x 272 pixels framebuffer (512 bytes per line)  */                  /*  480 x 272 pixels framebuffer (512 bytes per line)  */
4047                  fb = dev_fb_init(machine, mem, 0x04000000, VFB_HPCMIPS,                  fb = dev_fb_init(machine, mem, 0x04000000, VFB_HPC,
4048                      480,272, 512,1088, -15, "Playstation Portable");                      480,272, 512,1088, -15, "Playstation Portable");
4049    
4050                  /*                  /*
# Line 4064  Not yet. Line 4066  Not yet.
4066                  cpu->cd.mips.gpr[MIPS_GPR_SP] = 0xfff0;                  cpu->cd.mips.gpr[MIPS_GPR_SP] = 0xfff0;
4067    
4068                  break;                  break;
4069    
4070            case MACHINE_ALGOR:
4071                    switch (machine->machine_subtype) {
4072                    case MACHINE_ALGOR_P4032:
4073                            machine->machine_name = "\"Algor\" P4032";
4074                            break;
4075                    case MACHINE_ALGOR_P5064:
4076                            machine->machine_name = "\"Algor\" P5064";
4077                            break;
4078                    default:fatal("Unimplemented Algor machine.\n");
4079                            exit(1);
4080                    }
4081    
4082                    machine->md_interrupt = isa8_interrupt;
4083                    machine->isa_pic_data.native_irq = 6;
4084    
4085                    /*  TODO: correct isa irq? 6 is just a bogus guess  */
4086    
4087                    bus_isa(machine, 0, 0x1d000000, 0xc0000000, 8, 24);
4088    
4089                    if (machine->prom_emulation) {
4090                            /*  NetBSD/algor wants these:  */
4091    
4092                            /*  a0 = argc  */
4093                            cpu->cd.mips.gpr[MIPS_GPR_A0] = 2;
4094    
4095                            /*  a1 = argv  */
4096                            cpu->cd.mips.gpr[MIPS_GPR_A1] = (int32_t)0x9fc01000;
4097                            store_32bit_word(cpu, (int32_t)0x9fc01000, 0x9fc01040);
4098                            store_32bit_word(cpu, (int32_t)0x9fc01004, 0x9fc01200);
4099                            store_32bit_word(cpu, (int32_t)0x9fc01008, 0);
4100    
4101                            bootstr = strdup(machine->boot_kernel_filename);
4102                            bootarg = strdup(machine->boot_string_argument);
4103                            store_string(cpu, (int32_t)0x9fc01040, bootstr);
4104                            store_string(cpu, (int32_t)0x9fc01200, bootarg);
4105    
4106                            /*  a2 = (yamon_env_var *)envp  */
4107                            cpu->cd.mips.gpr[MIPS_GPR_A2] = (int32_t)0x9fc01800;
4108                            {
4109                                    char tmps[50];
4110    
4111                                    store_32bit_word(cpu, (int32_t)0x9fc01800, 0x9fc01900);
4112                                    store_32bit_word(cpu, (int32_t)0x9fc01804, 0x9fc01a00);
4113                                    store_32bit_word(cpu, (int32_t)0x9fc01808, 0);
4114    
4115                                    snprintf(tmps, sizeof(tmps), "memsize=0x%08x",
4116                                        machine->physical_ram_in_mb * 1048576);
4117                                    store_string(cpu, (int)0x9fc01900, tmps);
4118                                    store_string(cpu, (int)0x9fc01a00, "ethaddr=10:20:30:30:20:10");
4119                            }
4120                    }
4121                    break;
4122  #endif  /*  ENABLE_MIPS  */  #endif  /*  ENABLE_MIPS  */
4123    
4124  #ifdef ENABLE_PPC  #ifdef ENABLE_PPC
# Line 4111  Not yet. Line 4166  Not yet.
4166                   */                   */
4167                  machine->machine_name = "Walnut evaluation board";                  machine->machine_name = "Walnut evaluation board";
4168    
4169                    /*  "OpenBIOS" entrypoint (?):  */
4170                    dev_ram_init(machine, 0xfffe0b50, 8, DEV_RAM_RAM, 0);
4171                    store_32bit_word(cpu, 0xfffe0b50, 0xfffe0b54);
4172                    store_32bit_word(cpu, 0xfffe0b54, 0x4e800020);  /*  blr  */
4173    
4174                  break;                  break;
4175    
4176          case MACHINE_PMPPC:          case MACHINE_PMPPC:
# Line 4118  Not yet. Line 4178  Not yet.
4178                   *  NetBSD/pmppc (http://www.netbsd.org/Ports/pmppc/)                   *  NetBSD/pmppc (http://www.netbsd.org/Ports/pmppc/)
4179                   */                   */
4180                  machine->machine_name = "Artesyn's PM/PPC board";                  machine->machine_name = "Artesyn's PM/PPC board";
4181                    machine->emulated_hz = 10000000;
4182    
4183                  dev_pmppc_init(mem);                  dev_pmppc_init(mem);
4184    
4185                  /*  com0 = 0xff600300, com1 = 0xff600400  */                  machine->md_int.cpc700_data = dev_cpc700_init(machine, mem);
4186                    machine->md_interrupt = cpc700_interrupt;
4187    
4188                    /*  RTC at "ext int 5" = "int 25" in IBM jargon, int
4189                        31-25 = 6 for the rest of us.  */
4190                    dev_mc146818_init(machine, mem, 0x7ff00000, 31-25, MC146818_PMPPC, 1);
4191    
4192                  machine->main_console_handle = (size_t)device_add(machine, "ns16550 irq=0 addr=0xff600300 name2=tty0");                  bus_pci_add(machine, machine->md_int.cpc700_data->pci_data,
4193                  device_add(machine, "ns16550 irq=0 addr=0xff600400 in_use=0 name2=tty1");                      mem, 0, 8, 0, "dec21143");
4194    
4195                  break;                  break;
4196    
# Line 4134  Not yet. Line 4200  Not yet.
4200                   */                   */
4201                  machine->machine_name = "Motorola Sandpoint";                  machine->machine_name = "Motorola Sandpoint";
4202    
4203                  {                  /*  r4 should point to first free byte after the loaded kernel:  */
4204                          int i;                  cpu->cd.ppc.gpr[4] = 6 * 1048576;
                         for (i=0; i<32; i++)  
                                 cpu->cd.ppc.gpr[i] =  
                                     0x12340000 + (i << 8) + 0x55;  
                 }  
4205    
4206                  break;                  break;
4207    
# Line 4149  Not yet. Line 4211  Not yet.
4211                   */                   */
4212                  machine->machine_name = "BeBox";                  machine->machine_name = "BeBox";
4213    
4214                  device_add(machine, "bebox");                  machine->md_int.bebox_data = device_add(machine, "bebox");
4215                    machine->isa_pic_data.native_irq = 5;
4216                  machine->main_console_handle = (size_t)                  machine->md_interrupt = isa32_interrupt;
                     device_add(machine, "ns16550 irq=0 addr=0x800003f8 name2=tty0");  
                 device_add(machine, "ns16550 irq=0 addr=0x800002f8 name2=tty1 in_use=0");  
4217    
4218                  dev_pckbc_init(machine, mem, 0x80000060, PCKBC_8042,                  pci_data = dev_eagle_init(machine, mem,
4219                      1, 12, machine->use_x11, 1);                      32 /*  isa irq base */, 0 /*  pci irq: TODO */);
4220    
4221                  if (machine->use_x11)                  bus_isa(machine, BUS_ISA_IDE0 | BUS_ISA_VGA,
4222                          dev_vga_init(machine, mem, 0xc00a0000ULL, 0x800003c0ULL,                      0x80000000, 0xc0000000, 32, 48);
                             machine->machine_name);  
4223    
4224                  if (machine->prom_emulation) {                  if (machine->prom_emulation) {
4225                            /*  According to the docs, and also used by NetBSD:  */
4226                          store_32bit_word(cpu, 0x3010, machine->physical_ram_in_mb * 1048576);                          store_32bit_word(cpu, 0x3010, machine->physical_ram_in_mb * 1048576);
4227    
4228                            /*  Used by Linux:  */
4229                            store_32bit_word(cpu, 0x32f8, machine->physical_ram_in_mb * 1048576);
4230    
4231                          /*  TODO: List of stuff, see http://www.beatjapan.org/                          /*  TODO: List of stuff, see http://www.beatjapan.org/
4232                              mirror/www.be.com/aboutbe/benewsletter/                              mirror/www.be.com/aboutbe/benewsletter/
4233                              Issue27.html#Cookbook  for the details.  */                              Issue27.html#Cookbook  for the details.  */
# Line 4173  Not yet. Line 4236  Not yet.
4236                          /*  NetBSD/bebox: r3 = startkernel, r4 = endkernel,                          /*  NetBSD/bebox: r3 = startkernel, r4 = endkernel,
4237                              r5 = args, r6 = ptr to bootinfo?  */                              r5 = args, r6 = ptr to bootinfo?  */
4238                          cpu->cd.ppc.gpr[3] = 0x3100;                          cpu->cd.ppc.gpr[3] = 0x3100;
4239                          cpu->cd.ppc.gpr[4] = 0x200000;                          cpu->cd.ppc.gpr[4] = 0x400000;
4240                          cpu->cd.ppc.gpr[5] = 0x2000;                          cpu->cd.ppc.gpr[5] = 0x2000;
4241                          store_string(cpu, cpu->cd.ppc.gpr[5], "-a");                          store_string(cpu, cpu->cd.ppc.gpr[5], "-a");
4242                          cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 - 0x100;                          cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 - 0x100;
# Line 4202  Not yet. Line 4265  Not yet.
4265                   *  NetBSD/prep (http://www.netbsd.org/Ports/prep/)                   *  NetBSD/prep (http://www.netbsd.org/Ports/prep/)
4266                   */                   */
4267                  machine->machine_name = "PowerPC Reference Platform";                  machine->machine_name = "PowerPC Reference Platform";
4268                    machine->emulated_hz = 20000000;
4269    
4270                    machine->md_int.bebox_data = device_add(machine, "prep");
4271                    machine->isa_pic_data.native_irq = 1;   /*  Semi-bogus  */
4272                    machine->md_interrupt = isa32_interrupt;
4273    
4274                    pci_data = dev_eagle_init(machine, mem,
4275                        32 /*  isa irq base */, 0 /*  pci irq: TODO */);
4276    
4277                    bus_isa(machine, BUS_ISA_IDE0 | BUS_ISA_IDE1,
4278                        0x80000000, 0xc0000000, 32, 48);
4279    
4280                    bus_pci_add(machine, pci_data, mem, 0, 13, 0, "dec21143");
4281    
4282                    if (machine->use_x11)
4283                            bus_pci_add(machine, pci_data, mem, 0, 14, 0, "s3_virge");
4284    
4285                  if (machine->prom_emulation) {                  if (machine->prom_emulation) {
4286                          /*  Linux on PReP has 0xdeadc0de at address 0? (See                          /*  Linux on PReP has 0xdeadc0de at address 0? (See
4287                              http://joshua.raleigh.nc.us/docs/linux-2.4.10_html/113568.html)  */                              http://joshua.raleigh.nc.us/docs/linux-2.4.10_html/113568.html)  */
4288                          store_32bit_word(cpu, 0, 0xdeadc0de);                          store_32bit_word(cpu, 0, 0xdeadc0de);
4289    
4290                          /*  r6 should point to "residual data"?  */                          /*  r4 should point to first free byte after the loaded kernel:  */
4291                          cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 - 0x1000;                          cpu->cd.ppc.gpr[4] = 6 * 1048576;
4292    
4293                            /*
4294                             *  r6 should point to bootinfo.
4295                             *  (See NetBSD's prep/include/bootinfo.h for details.)
4296                             */
4297                            cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 - 0x8000;
4298    
4299                            store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+ 0, 12);  /*  next  */
4300                            store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+ 4, 2);  /*  type: clock  */
4301                            store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+ 8, machine->emulated_hz);
4302    
4303                            store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+12, 20);  /*  next  */
4304                            store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+16, 1);  /*  type: console  */
4305                            store_buf(cpu, cpu->cd.ppc.gpr[6] + 20,
4306                                machine->use_x11? "vga" : "com", 4);
4307                            store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+24, 0x3f8);  /*  addr  */
4308                            store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+28, 9600);  /*  speed  */
4309    
4310                            store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+32, 0);  /*  next  */
4311                            store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+36, 0);  /*  type: residual  */
4312                            store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+40,    /*  addr of data  */
4313                                cpu->cd.ppc.gpr[6] + 0x100);
4314    
4315                            store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+0x100, 0x200);  /*  TODO: residual  */
4316                            /*  store_string(cpu, cpu->cd.ppc.gpr[6]+0x100+0x8, "IBM PPS Model 7248 (E)");  */
4317                            store_string(cpu, cpu->cd.ppc.gpr[6]+0x100+0x8, "IBM PPS Model 6050/6070 (E)");
4318    
4319                            store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+0x100+0x1f8, machine->physical_ram_in_mb * 1048576);  /*  memsize  */
4320                  }                  }
4321                  break;                  break;
4322    
# Line 4260  Not yet. Line 4367  Not yet.
4367                           *  r5 = OpenFirmware entry point.  NOTE: See                           *  r5 = OpenFirmware entry point.  NOTE: See
4368                           *  cpu_ppc.c for the rest of this semi-ugly hack.                           *  cpu_ppc.c for the rest of this semi-ugly hack.
4369                           */                           */
4370                          dev_ram_init(cpu->mem, cpu->cd.ppc.of_emul_addr,                          dev_ram_init(machine, cpu->cd.ppc.of_emul_addr,
4371                              0x1000, DEV_RAM_RAM, 0x0);                              0x1000, DEV_RAM_RAM, 0x0);
4372                          store_32bit_word(cpu, cpu->cd.ppc.of_emul_addr,                          store_32bit_word(cpu, cpu->cd.ppc.of_emul_addr,
4373                              0x44ee0002);                              0x44ee0002);
# Line 4587  Not yet. Line 4694  Not yet.
4694    
4695                  machine->md_int.footbridge_data =                  machine->md_int.footbridge_data =
4696                      device_add(machine, "footbridge addr=0x42000000");                      device_add(machine, "footbridge addr=0x42000000");
4697                  machine->md_interrupt = footbridge_interrupt;                  machine->md_interrupt = isa32_interrupt;
4698                    machine->isa_pic_data.native_irq = 10;
4699    
4700                  /*  NetBSD and OpenBSD clean their caches here:  */                  /*
4701                  dev_ram_init(mem, 0x50000000, 0x4000, DEV_RAM_RAM, 0);                   *  DC21285_ROM_BASE (0x41000000): "reboot" code. Works
4702                     *  with NetBSD.
4703                     */
4704                    dev_ram_init(machine, 0x41000000, 12, DEV_RAM_RAM, 0);
4705                    store_32bit_word(cpu, 0x41000008ULL, 0xef8c64ebUL);
4706    
4707                  /*  Interrupt ack space?  */                  /*  OpenBSD reboot needs 0xf??????? to be mapped to phys.:  */
4708                  dev_ram_init(mem, 0x80000000, 0x1000, DEV_RAM_RAM, 0);                  dev_ram_init(machine, 0xf0000000, 0x1000000,
4709                        DEV_RAM_MIRROR, 0x0);
4710    
4711                  snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c000020");                  /*  NetBSD and OpenBSD clean their caches here:  */
4712                  machine->isa_pic_data.pic1 = device_add(machine, tmpstr);                  dev_ram_init(machine, 0x50000000, 0x4000, DEV_RAM_RAM, 0);
                 snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c0000a0");  
                 machine->isa_pic_data.pic2 = device_add(machine, tmpstr);  
   
                 device_add(machine, "pccmos addr=0x7c000070");  
4713    
4714                  if (machine->use_x11) {                  /*  Interrupt ack space?  */
4715                          bus_pci_add(machine, machine->md_int.footbridge_data->pcibus,                  dev_ram_init(machine, 0x80000000, 0x1000, DEV_RAM_RAM, 0);
                             mem, 0xc0, 8, 0, pci_s3_virge_init, pci_s3_virge_rr);  
                         dev_vga_init(machine, mem, 0x800a0000ULL, 0x7c0003c0, machine->machine_name);  
                         j = dev_pckbc_init(machine, mem, 0x7c000060, PCKBC_8042,  
                             32 + 1, 32 + 12, machine->use_x11, 0);  
                         machine->main_console_handle = j;  
                 }  
4716    
4717                  device_add(machine, "ns16550 irq=36 addr=0x7c0003f8 name2=com0 in_use=0");                  bus_isa(machine, BUS_ISA_PCKBC_FORCE_USE | BUS_ISA_PCKBC_NONPCSTYLE,
4718                  device_add(machine, "ns16550 irq=35 addr=0x7c0002f8 name2=com1 in_use=0");                      0x7c000000, 0x80000000, 32, 48);
4719    
4720                  device_add(machine, "lpt irq=39 addr=0x7c000378 name2=lpt in_use=0");                  bus_pci_add(machine, machine->md_int.footbridge_data->pcibus,
4721                        mem, 0xc0, 8, 0, "s3_virge");
4722    
4723                  if (machine->prom_emulation) {                  if (machine->prom_emulation) {
4724                          struct ebsaboot ebsaboot;                          struct ebsaboot ebsaboot;
# Line 4653  Not yet. Line 4757  Not yet.
4757                          store_buf(cpu, cpu->cd.arm.r[0],                          store_buf(cpu, cpu->cd.arm.r[0],
4758                              (char *)&ebsaboot, sizeof(struct ebsaboot));                              (char *)&ebsaboot, sizeof(struct ebsaboot));
4759    
4760                          snprintf(bs, sizeof(bs), "(hd%i)%s%s%s",                          snprintf(bs, sizeof(bs), "(hd%i)%s root=/dev/wd%i%s%s",
4761                              boot_id, machine->boot_kernel_filename,                              boot_id, machine->boot_kernel_filename, boot_id,
4762                              (machine->boot_string_argument[0])? " " : "",                              (machine->boot_string_argument[0])? " " : "",
4763                              machine->boot_string_argument);                              machine->boot_string_argument);
4764    
# Line 4667  Not yet. Line 4771  Not yet.
4771                  break;                  break;
4772    
4773          case MACHINE_HPCARM:          case MACHINE_HPCARM:
4774                  machine->machine_name = "HPCarm";                  cpu->byte_order = EMUL_LITTLE_ENDIAN;
4775                  dev_ram_init(mem, 0xc0000000, 0x10000000, DEV_RAM_MIRROR, 0x0);                  memset(&hpc_bootinfo, 0, sizeof(hpc_bootinfo));
4776                    switch (machine->machine_subtype) {
4777                    case MACHINE_HPCARM_IPAQ:
4778                            /*  SA-1110 206MHz  */
4779                            machine->machine_name = "Compaq iPAQ H3600";
4780                            hpc_fb_addr = 0x48200000;       /*  TODO  */
4781                            hpc_fb_xsize = 240;
4782                            hpc_fb_ysize = 320;
4783                            hpc_fb_xsize_mem = 256;
4784                            hpc_fb_ysize_mem = 320;
4785                            hpc_fb_bits = 15;
4786                            hpc_fb_encoding = BIFB_D16_0000;
4787                            hpc_platid_cpu_arch = 3;        /*  ARM  */
4788                            hpc_platid_cpu_series = 1;      /*  StrongARM  */
4789                            hpc_platid_cpu_model = 2;       /*  SA-1110  */
4790                            hpc_platid_cpu_submodel = 0;
4791                            hpc_platid_vendor = 7;          /*  Compaq  */
4792                            hpc_platid_series = 4;          /*  IPAQ  */
4793                            hpc_platid_model = 2;           /*  H36xx  */
4794                            hpc_platid_submodel = 1;        /*  H3600  */
4795                            break;
4796                    case MACHINE_HPCARM_JORNADA720:
4797                            /*  SA-1110 206MHz  */
4798                            machine->machine_name = "Jornada 720";
4799                            hpc_fb_addr = 0x48200000;
4800                            hpc_fb_xsize = 640;
4801                            hpc_fb_ysize = 240;
4802                            hpc_fb_xsize_mem = 640;
4803                            hpc_fb_ysize_mem = 240;
4804                            hpc_fb_bits = 16;
4805                            hpc_fb_encoding = BIFB_D16_0000;
4806                            hpc_platid_cpu_arch = 3;        /*  ARM  */
4807                            hpc_platid_cpu_series = 1;      /*  StrongARM  */
4808                            hpc_platid_cpu_model = 2;       /*  SA-1110  */
4809                            hpc_platid_cpu_submodel = 0;
4810                            hpc_platid_vendor = 11;         /*  HP  */
4811                            hpc_platid_series = 2;          /*  Jornada  */
4812                            hpc_platid_model = 2;           /*  7xx  */
4813                            hpc_platid_submodel = 1;        /*  720  */
4814                            break;
4815                    default:
4816                            printf("Unimplemented hpcarm machine number.\n");
4817                            exit(1);
4818                    }
4819    
4820                  /*  TODO: Different models  */                  store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu,
4821                          (hpc_platid_cpu_arch << 26) + (hpc_platid_cpu_series << 20)
4822                        + (hpc_platid_cpu_model << 14) + (hpc_platid_cpu_submodel <<  8)
4823                        + hpc_platid_flags);
4824                    store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine,
4825                          (hpc_platid_vendor << 22) + (hpc_platid_series << 16)
4826                        + (hpc_platid_model <<  8) + hpc_platid_submodel);
4827    
4828                  if (machine->prom_emulation) {                  if (machine->prom_emulation) {
4829                          cpu->cd.arm.r[0] = 1;                          /*  NetBSD/hpcarm and possibly others expects the following:  */
4830                          cpu->cd.arm.r[ARM_SP] = 0xc000c000;  
4831                            cpu->cd.arm.r[0] = 1;   /*  argc  */
4832                            cpu->cd.arm.r[1] = machine->physical_ram_in_mb * 1048576 - 512; /*  argv  */
4833                            cpu->cd.arm.r[2] = machine->physical_ram_in_mb * 1048576 - 256; /*  ptr to hpc_bootinfo  */
4834    
4835                            bootstr = machine->boot_kernel_filename;
4836                            store_32bit_word(cpu, machine->physical_ram_in_mb * 1048576 - 512,
4837                                machine->physical_ram_in_mb * 1048576 - 512 + 16);
4838                            store_32bit_word(cpu, machine->physical_ram_in_mb * 1048576 - 512 + 4, 0);
4839                            store_string(cpu, machine->physical_ram_in_mb * 1048576 - 512 + 16, bootstr);
4840    
4841                            if (machine->boot_string_argument[0]) {
4842                                    cpu->cd.arm.r[0] ++;    /*  argc  */
4843    
4844                                    store_32bit_word(cpu, machine->physical_ram_in_mb * 1048576 - 512 + 4, machine->physical_ram_in_mb * 1048576 - 512 + 64);
4845                                    store_32bit_word(cpu, machine->physical_ram_in_mb * 1048576 - 512 + 8, 0);
4846    
4847                                    store_string(cpu, machine->physical_ram_in_mb * 1048576 - 512 + 64,
4848                                        machine->boot_string_argument);
4849    
4850                                    bootarg = machine->boot_string_argument;
4851                            }
4852    
4853                            store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.length, sizeof(hpc_bootinfo));
4854                            store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.magic, HPC_BOOTINFO_MAGIC);
4855                            store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_addr, hpc_fb_addr);
4856                            store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_line_bytes, hpc_fb_xsize_mem * (((hpc_fb_bits-1)|7)+1) / 8);
4857                            store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_width, hpc_fb_xsize);
4858                            store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_height, hpc_fb_ysize);
4859                            store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_type, hpc_fb_encoding);
4860                            store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.bi_cnuse,
4861                                machine->use_x11? BI_CNUSE_BUILTIN : BI_CNUSE_SERIAL);
4862    
4863                            store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.timezone, 0);
4864                            store_buf(cpu, machine->physical_ram_in_mb * 1048576 - 256, (char *)&hpc_bootinfo, sizeof(hpc_bootinfo));
4865    
4866                            /*
4867                             *  TODO: ugly hack, only works with small NetBSD
4868                             *        kernels!
4869                             */
4870                            cpu->cd.arm.r[ARM_SP] = 0xc02c0000;
4871                    }
4872    
4873                    /*  Physical RAM at 0xc0000000:  */
4874                    dev_ram_init(machine, 0xc0000000, 0x20000000,
4875                        DEV_RAM_MIRROR, 0x0);
4876    
4877                    /*  Cache flush region:  */
4878                    dev_ram_init(machine, 0xe0000000, 0x10000, DEV_RAM_RAM, 0x0);
4879    
4880                    if (hpc_fb_addr != 0) {
4881                            dev_fb_init(machine, mem, hpc_fb_addr, VFB_HPC,
4882                                hpc_fb_xsize, hpc_fb_ysize,
4883                                hpc_fb_xsize_mem, hpc_fb_ysize_mem,
4884                                hpc_fb_bits, machine->machine_name);
4885                  }                  }
4886                  break;                  break;
4887    
4888          case MACHINE_ZAURUS:          case MACHINE_ZAURUS:
4889                  machine->machine_name = "Zaurus";                  machine->machine_name = "Zaurus";
4890                  dev_ram_init(mem, 0xa0000000, 0x20000000, DEV_RAM_MIRROR, 0x0);                  dev_ram_init(machine, 0xa0000000, 0x20000000,
4891                        DEV_RAM_MIRROR, 0x0);
4892                    dev_ram_init(machine, 0xc0000000, 0x20000000,
4893                        DEV_RAM_MIRROR, 0x0);
4894    
4895                    /*  TODO: replace this with the correct device  */
4896                    dev_ram_init(machine, 0x40d00000, 0x1000, DEV_RAM_RAM, 0);
4897    
4898                  device_add(machine, "ns16550 irq=0 addr=0x40100000 addr_mult=4");                  device_add(machine, "ns16550 irq=0 addr=0x40100000 addr_mult=4");
4899                    device_add(machine, "ns16550 irq=0 addr=0xfd400000 addr_mult=4");
4900    
4901                  /*  TODO  */                  /*  TODO  */
4902                  if (machine->prom_emulation) {                  if (machine->prom_emulation) {
4903                          arm_setup_initial_translation_table(cpu, 0x4000);                          arm_setup_initial_translation_table(cpu, 0x4000);
# Line 4697  Not yet. Line 4913  Not yet.
4913    
4914                  machine->md_int.footbridge_data =                  machine->md_int.footbridge_data =
4915                      device_add(machine, "footbridge addr=0x42000000");                      device_add(machine, "footbridge addr=0x42000000");
4916                  machine->md_interrupt = footbridge_interrupt;                  machine->md_interrupt = isa32_interrupt;
4917                    machine->isa_pic_data.native_irq = 11;
4918    
4919                    bus_isa(machine, 0, 0x7c000000, 0x80000000, 32, 48);
4920    #if 0
4921                  snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c000020");                  snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c000020");
4922                  machine->isa_pic_data.pic1 = device_add(machine, tmpstr);                  machine->isa_pic_data.pic1 = device_add(machine, tmpstr);
4923                  snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c0000a0");                  snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c0000a0");
# Line 4707  Not yet. Line 4926  Not yet.
4926                  device_add(machine, "ns16550 irq=36 addr=0x7c0003f8 name2=com0");                  device_add(machine, "ns16550 irq=36 addr=0x7c0003f8 name2=com0");
4927                  device_add(machine, "ns16550 irq=35 addr=0x7c0002f8 name2=com1");                  device_add(machine, "ns16550 irq=35 addr=0x7c0002f8 name2=com1");
4928    
                 if (machine->use_x11) {  
                         bus_pci_add(machine, machine->md_int.footbridge_data->pcibus,  
                             mem, 0xc0, 8, 0, pci_igsfb_init, pci_igsfb_rr);  
4929                          dev_vga_init(machine, mem, 0x800a0000ULL, 0x7c0003c0, machine->machine_name);                          dev_vga_init(machine, mem, 0x800a0000ULL, 0x7c0003c0, machine->machine_name);
4930                          j = dev_pckbc_init(machine, mem, 0x7c000060, PCKBC_8042,                          j = dev_pckbc_init(machine, mem, 0x7c000060, PCKBC_8042,
4931                              32 + 1, 32 + 12, machine->use_x11, 0);                              32 + 1, 32 + 12, machine->use_x11, 0);
4932                          machine->main_console_handle = j;                          machine->main_console_handle = j;
4933    #endif
4934                    if (machine->use_x11) {
4935                            bus_pci_add(machine, machine->md_int.footbridge_data->pcibus,
4936                                mem, 0xc0, 8, 0, "igsfb");
4937                  }                  }
4938    
4939                  if (machine->prom_emulation) {                  if (machine->prom_emulation) {
# Line 4744  Not yet. Line 4964  Not yet.
4964                  cpu->cd.arm.coproc[6] = arm_coproc_i80321;                  cpu->cd.arm.coproc[6] = arm_coproc_i80321;
4965                  cpu->cd.arm.coproc[14] = arm_coproc_i80321_14;                  cpu->cd.arm.coproc[14] = arm_coproc_i80321_14;
4966                  device_add(machine, "ns16550 irq=0 addr=0xfe800000");                  device_add(machine, "ns16550 irq=0 addr=0xfe800000");
4967                  dev_ram_init(mem, 0xa0000000, 0x20000000, DEV_RAM_MIRROR, 0x0);  
4968                  dev_ram_init(mem, 0xc0000000, 0x20000000, DEV_RAM_MIRROR, 0x0);                  /*  Used by "Redboot":  */
4969                    dev_ram_init(machine, 0xa800024, 4, DEV_RAM_RAM, 0);
4970                    store_32bit_word(cpu, 0xa800024, 0x7fff);
4971                    device_add(machine, "ns16550 irq=0 addr=0x0d800000 addr_mult=4");
4972                    device_add(machine, "ns16550 irq=0 addr=0x0d800020 addr_mult=4");
4973    
4974                    /*  0xa0000000 = physical ram, 0xc0000000 = uncached  */
4975                    dev_ram_init(machine, 0xa0000000, 0x20000000,
4976                        DEV_RAM_MIRROR, 0x0);
4977                    dev_ram_init(machine, 0xc0000000, 0x20000000,
4978                        DEV_RAM_MIRROR, 0x0);
4979    
4980                    /*  0xe0000000 and 0xff000000 = cache flush regions  */
4981                    dev_ram_init(machine, 0xe0000000, 0x100000, DEV_RAM_RAM, 0x0);
4982                    dev_ram_init(machine, 0xff000000, 0x100000, DEV_RAM_RAM, 0x0);
4983    
4984                    device_add(machine, "i80321 addr=0xffffe000");
4985    
4986                  if (machine->prom_emulation) {                  if (machine->prom_emulation) {
4987                          arm_setup_initial_translation_table(cpu, 0x8000);                          arm_setup_initial_translation_table(cpu, 0x4000);
4988                            arm_translation_table_set_l1(cpu, 0xa0000000, 0xa0000000);
4989                            arm_translation_table_set_l1(cpu, 0xc0000000, 0xa0000000);
4990                            arm_translation_table_set_l1(cpu, 0xe0000000, 0xe0000000);
4991                            arm_translation_table_set_l1(cpu, 0xf0000000, 0xf0000000);
4992                  }                  }
4993                  break;                  break;
4994    
# Line 4755  Not yet. Line 4996  Not yet.
4996                  machine->machine_name = "Iyonix";                  machine->machine_name = "Iyonix";
4997                  cpu->cd.arm.coproc[6] = arm_coproc_i80321;                  cpu->cd.arm.coproc[6] = arm_coproc_i80321;
4998                  cpu->cd.arm.coproc[14] = arm_coproc_i80321_14;                  cpu->cd.arm.coproc[14] = arm_coproc_i80321_14;
4999    
5000                    device_add(machine, "ns16550 irq=0 addr=0xfe800000");
5001                    device_add(machine, "ns16550 irq=0 addr=0x900003f8");
5002                    device_add(machine, "ns16550 irq=0 addr=0x900002f8");
5003    
5004                    /*  0xa0000000 = physical ram, 0xc0000000 = uncached  */
5005                    dev_ram_init(machine, 0xa0000000, 0x20000000,
5006                        DEV_RAM_MIRROR, 0x0);
5007                    dev_ram_init(machine, 0xc0000000, 0x20000000,
5008                        DEV_RAM_MIRROR, 0x0);
5009                    dev_ram_init(machine, 0xf0000000, 0x08000000,
5010                        DEV_RAM_MIRROR, 0x0);
5011    
5012                    device_add(machine, "i80321 addr=0xffffe000");
5013    
5014                  if (machine->prom_emulation) {                  if (machine->prom_emulation) {
5015                          arm_setup_initial_translation_table(cpu,                          arm_setup_initial_translation_table(cpu,
5016                              machine->physical_ram_in_mb * 1048576 - 65536);                              machine->physical_ram_in_mb * 1048576 - 65536);
5017                            arm_translation_table_set_l1(cpu, 0xa0000000, 0xa0000000);
5018                            arm_translation_table_set_l1(cpu, 0xc0000000, 0xa0000000);
5019                            arm_translation_table_set_l1_b(cpu, 0xff000000, 0xff000000);
5020                  }                  }
5021                  break;                  break;
5022  #endif  /*  ENABLE_ARM  */  #endif  /*  ENABLE_ARM  */
# Line 4842  Not yet. Line 5101  Not yet.
5101                  else                  else
5102                          machine->machine_name = "Generic x86 PC";                          machine->machine_name = "Generic x86 PC";
5103    
                 /*  Interrupt controllers:  */  
                 snprintf(tmpstr, sizeof(tmpstr), "8259 irq=16 addr=0x%llx",  
                     (long long)(X86_IO_BASE + 0x20));  
                 machine->isa_pic_data.pic1 = device_add(machine, tmpstr);  
                 if (machine->machine_subtype != MACHINE_X86_XT) {  
                         snprintf(tmpstr, sizeof(tmpstr), "8259 irq=16 addr=0x%llx irq=2",  
                             (long long)(X86_IO_BASE + 0xa0));  
                         machine->isa_pic_data.pic2 = device_add(machine, tmpstr);  
                 }  
   
5104                  machine->md_interrupt = x86_pc_interrupt;                  machine->md_interrupt = x86_pc_interrupt;
5105    
5106                  /*  Timer:  */                  bus_isa(machine, BUS_ISA_IDE0 | BUS_ISA_IDE1 | BUS_ISA_VGA |
5107                  snprintf(tmpstr, sizeof(tmpstr), "8253 addr=0x%llx irq=0",                      BUS_ISA_PCKBC_FORCE_USE |
5108                      (long long)(X86_IO_BASE + 0x40));                      (machine->machine_subtype == MACHINE_X86_XT?
5109                  device_add(machine, tmpstr);                      BUS_ISA_NO_SECOND_PIC : 0) | BUS_ISA_FDC,
5110                        X86_IO_BASE, 0x00000000, 0, 16);
                 snprintf(tmpstr, sizeof(tmpstr), "pccmos addr=0x%llx",  
                     (long long)(X86_IO_BASE + 0x70));  
                 device_add(machine, tmpstr);  
   
                 /*  TODO: IRQ when emulating a PC XT?  */  
   
                 /*  IDE controllers:  */  
                 if (diskimage_exist(machine, 0, DISKIMAGE_IDE) ||  
                     diskimage_exist(machine, 1, DISKIMAGE_IDE)) {  
                         snprintf(tmpstr, sizeof(tmpstr), "wdc addr=0x%llx irq=%i",  
                             X86_IO_BASE + 0x1f0, 14);  
                         device_add(machine, tmpstr);  
                 }  
                 if (diskimage_exist(machine, 2, DISKIMAGE_IDE) ||  
                     diskimage_exist(machine, 3, DISKIMAGE_IDE)) {  
                         snprintf(tmpstr, sizeof(tmpstr), "wdc addr=0x%llx irq=%i",  
                             X86_IO_BASE + 0x170, 15);  
                         device_add(machine, tmpstr);  
                 }  
   
                 /*  Floppy controller at irq 6  */  
                 snprintf(tmpstr, sizeof(tmpstr), "fdc addr=0x%llx irq=6",  
                     (long long)(X86_IO_BASE + 0x3f0));  
                 device_add(machine, tmpstr);  
   
                 /*  TODO: sound blaster (eventually) at irq 7?  */  
   
                 /*  TODO: parallel port  */  
   
                 /*  Serial ports:  (TODO: 8250 for PC XT?)  */  
   
                 snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=4 addr=0x%llx name2=com1 in_use=0",  
                     (long long)X86_IO_BASE + 0x3f8);  
                 device_add(machine, tmpstr);  
                 snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=3 addr=0x%llx name2=com2 in_use=0",  
                     (long long)X86_IO_BASE + 0x2f8);  
                 device_add(machine, tmpstr);  
   
                 /*  VGA + keyboard:  */  
                 dev_vga_init(machine, mem, 0xa0000ULL, X86_IO_BASE + 0x3c0,  
                     "Generic x86 PC");  
                 machine->main_console_handle = dev_pckbc_init(machine,  
                     mem, X86_IO_BASE + 0x60, PCKBC_8042, 1, 12, 1, 1);  
5111    
5112                  if (machine->prom_emulation)                  if (machine->prom_emulation)
5113                          pc_bios_init(cpu);                          pc_bios_init(cpu);
# Line 4928  Not yet. Line 5134  Not yet.
5134                  debug(" (%.2f MHz)", (float)machine->emulated_hz / 1000000);                  debug(" (%.2f MHz)", (float)machine->emulated_hz / 1000000);
5135          debug("\n");          debug("\n");
5136    
5137            /*  Default fake speed: 5 MHz  */
5138          if (machine->emulated_hz < 1)          if (machine->emulated_hz < 1)
5139                  machine->emulated_hz = 1000000;                  machine->emulated_hz = 5000000;
5140    
5141          if (bootstr != NULL) {          if (bootstr != NULL) {
5142                  debug("bootstring%s: %s", (bootarg!=NULL &&                  debug("bootstring%s: %s", (bootarg!=NULL &&
# Line 5017  void machine_memsize_fix(struct machine Line 5224  void machine_memsize_fix(struct machine
5224                          }                          }
5225                          break;                          break;
5226                  case MACHINE_ALPHA:                  case MACHINE_ALPHA:
                         m->physical_ram_in_mb = 64;  
                         break;  
5227                  case MACHINE_BEBOX:                  case MACHINE_BEBOX:
5228                          m->physical_ram_in_mb = 64;                  case MACHINE_PREP:
                         break;  
5229                  case MACHINE_CATS:                  case MACHINE_CATS:
                         m->physical_ram_in_mb = 64;  
                         break;  
5230                  case MACHINE_ZAURUS:                  case MACHINE_ZAURUS:
5231                          m->physical_ram_in_mb = 64;                          m->physical_ram_in_mb = 64;
5232                          break;                          break;
# Line 5185  void machine_default_cputype(struct mach Line 5387  void machine_default_cputype(struct mach
5387          case MACHINE_PSP:          case MACHINE_PSP:
5388                  m->cpu_name = strdup("Allegrex");                  m->cpu_name = strdup("Allegrex");
5389                  break;                  break;
5390            case MACHINE_ALGOR:
5391                    m->cpu_name = strdup("RM5200");
5392                    break;
5393    
5394          /*  PowerPC:  */          /*  PowerPC:  */
5395          case MACHINE_BAREPPC:          case MACHINE_BAREPPC:
# Line 5213  void machine_default_cputype(struct mach Line 5418  void machine_default_cputype(struct mach
5418                  m->cpu_name = strdup("PPC603e");                  m->cpu_name = strdup("PPC603e");
5419                  break;                  break;
5420          case MACHINE_PREP:          case MACHINE_PREP:
5421                  /*  For NetBSD/prep. TODO  */                  /*  For NetBSD/prep. TODO: Differs between models!  */
5422                  m->cpu_name = strdup("PPC603e");                  m->cpu_name = strdup("PPC604");
5423                  break;                  break;
5424          case MACHINE_MACPPC:          case MACHINE_MACPPC:
5425                  switch (m->machine_subtype) {                  switch (m->machine_subtype) {
# Line 5377  void machine_dumpinfo(struct machine *m) Line 5582  void machine_dumpinfo(struct machine *m)
5582                  debug("Using X11");                  debug("Using X11");
5583                  if (m->x11_scaledown > 1)                  if (m->x11_scaledown > 1)
5584                          debug(", scaledown %i", m->x11_scaledown);                          debug(", scaledown %i", m->x11_scaledown);
5585                    if (m->x11_scaleup > 1)
5586                            debug(", scaleup %i", m->x11_scaleup);
5587                  if (m->x11_n_display_names > 0) {                  if (m->x11_n_display_names > 0) {
5588                          for (i=0; i<m->x11_n_display_names; i++) {                          for (i=0; i<m->x11_n_display_names; i++) {
5589                                  debug(i? ", " : " (");                                  debug(i? ", " : " (");
# Line 5532  void machine_list_available_types_and_cp Line 5739  void machine_list_available_types_and_cp
5739          debug_indentation(-iadd);          debug_indentation(-iadd);
5740    
5741          debug("\nMost of the machine types are bogus too. Please read the "          debug("\nMost of the machine types are bogus too. Please read the "
5742              "GXemul\ndocumentation for information about which machine"              "GXemul documentation\nfor information about which machine types "
5743              " types that actually\nwork. Use the alias when selecting a "                "that actually work. Use the alias\nwhen selecting a machine type "
5744              "machine type or subtype, not the\nreal name.\n");              "or subtype, not the real name.\n");
5745    
5746          debug("\n");          debug("\n");
5747    
# Line 5573  void machine_init(void) Line 5780  void machine_init(void)
5780          me->aliases[0] = "pc";          me->aliases[0] = "pc";
5781          me->aliases[1] = "x86";          me->aliases[1] = "x86";
5782          me->subtype[0] = machine_entry_subtype_new("Generic PC",          me->subtype[0] = machine_entry_subtype_new("Generic PC",
5783              MACHINE_X86_GENERIC, 1);              MACHINE_X86_GENERIC, 2);
5784          me->subtype[0]->aliases[0] = "generic";          me->subtype[0]->aliases[0] = "pc";
5785            me->subtype[0]->aliases[1] = "generic";
5786          me->subtype[1] = machine_entry_subtype_new("PC XT", MACHINE_X86_XT, 1);          me->subtype[1] = machine_entry_subtype_new("PC XT", MACHINE_X86_XT, 1);
5787          me->subtype[1]->aliases[0] = "xt";          me->subtype[1]->aliases[0] = "xt";
5788          if (cpu_family_ptr_by_number(ARCH_X86) != NULL) {          if (cpu_family_ptr_by_number(ARCH_X86) != NULL) {
# Line 6143  void machine_init(void) Line 6351  void machine_init(void)
6351          if (cpu_family_ptr_by_number(ARCH_ALPHA) != NULL) {          if (cpu_family_ptr_by_number(ARCH_ALPHA) != NULL) {
6352                  me->next = first_machine_entry; first_machine_entry = me;                  me->next = first_machine_entry; first_machine_entry = me;
6353          }          }
6354    
6355            /*  Algor evaluation board:  */
6356            me = machine_entry_new("Algor", ARCH_MIPS, MACHINE_ALGOR, 1, 2);
6357            me->aliases[0] = "algor";
6358            me->subtype[0] = machine_entry_subtype_new("P4032",
6359                MACHINE_ALGOR_P4032, 1);
6360            me->subtype[0]->aliases[0] = "p4032";
6361            me->subtype[1] = machine_entry_subtype_new("P5064",
6362                MACHINE_ALGOR_P5064, 1);
6363            me->subtype[1]->aliases[0] = "p5064";
6364            if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) {
6365                    me->next = first_machine_entry; first_machine_entry = me;
6366            }
6367  }  }
6368    

Legend:
Removed from v.16  
changed lines
  Added in v.20

  ViewVC Help
Powered by ViewVC 1.1.26