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

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

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

revision 41 by dpavlin, Mon Oct 8 16:21:53 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: machine_arc.c,v 1.14 2007/03/24 06:40:15 debug Exp $   *  $Id: machine_arc.c,v 1.20 2007/06/15 18:08:10 debug Exp $
29     *
30     *  COMMENT: ARC (Advanced RISC Computing) machines
31   */   */
32    
33  #include <stdio.h>  #include <stdio.h>
# Line 33  Line 35 
35  #include <string.h>  #include <string.h>
36    
37  #include "arcbios.h"  #include "arcbios.h"
 #include "bus_isa.h"  
38  #include "cpu.h"  #include "cpu.h"
39  #include "device.h"  #include "device.h"
40  #include "devices.h"  #include "devices.h"
# Line 46  Line 47 
47    
48  MACHINE_SETUP(arc)  MACHINE_SETUP(arc)
49  {  {
         struct pci_data *pci_data;  
50          void *jazz_data;          void *jazz_data;
51          struct memory *mem = machine->memory;          struct memory *mem = machine->memory;
52          char tmpstr[1000];          char tmpstr[1000];
# Line 55  MACHINE_SETUP(arc) Line 55  MACHINE_SETUP(arc)
55          char *eaddr_string = "eaddr=10:20:30:40:50:60";         /*  bogus  */          char *eaddr_string = "eaddr=10:20:30:40:50:60";         /*  bogus  */
56          unsigned char macaddr[6];          unsigned char macaddr[6];
57    
58          machine->machine_name = malloc(MACHINE_NAME_MAXBUF);          CHECK_ALLOCATION(machine->machine_name = malloc(MACHINE_NAME_MAXBUF));
         if (machine->machine_name == NULL) {  
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
59    
60          cpu->byte_order = EMUL_LITTLE_ENDIAN;          cpu->byte_order = EMUL_LITTLE_ENDIAN;
61          snprintf(machine->machine_name, MACHINE_NAME_MAXBUF, "ARC");          snprintf(machine->machine_name, MACHINE_NAME_MAXBUF, "ARC");
62    
63          switch (machine->machine_subtype) {          switch (machine->machine_subtype) {
64    
         case MACHINE_ARC_NEC_RD94:  
         case MACHINE_ARC_NEC_R94:  
         case MACHINE_ARC_NEC_R96:  
                 /*  
                  *  "NEC-RD94" (NEC RISCstation 2250)  
                  *  "NEC-R94" (NEC RISCstation 2200)  
                  *  "NEC-R96" (NEC Express RISCserver)  
                  *  
                  *  http://mirror.aarnet.edu.au/pub/NetBSD/misc/chs/arcdiag.out  
                  *  (NEC-R96)  
                  */  
   
                 switch (machine->machine_subtype) {  
                 case MACHINE_ARC_NEC_RD94:  
                         strlcat(machine->machine_name,  
                             " (NEC-RD94, NEC RISCstation 2250)",  
                             MACHINE_NAME_MAXBUF);  
                         break;  
                 case MACHINE_ARC_NEC_R94:  
                         strlcat(machine->machine_name,  
                             " (NEC-R94; NEC RISCstation 2200)",  
                             MACHINE_NAME_MAXBUF);  
                         break;  
                 case MACHINE_ARC_NEC_R96:  
                         strlcat(machine->machine_name,  
                             " (NEC-R96; NEC Express RISCserver)",  
                             MACHINE_NAME_MAXBUF);  
                         break;  
                 }  
   
                 /*  TODO: interrupt controller!  */  
   
                 pci_data = device_add(machine,  
                     "rd94 addr=0x80000000, irq=0");  
   
                 device_add(machine, "sn addr=0x80001000 irq=0");  
                 dev_mc146818_init(machine, mem, 0x80004000ULL, 0,  
                     MC146818_ARC_NEC, 1);  
   
 fatal("TODO: legacy rewrite\n");  
 abort();  
 //              i = dev_pckbc_init(machine, mem, 0x80005000ULL, PCKBC_8042,  
 //                  0, 0, machine->use_x11, 0);  
 i = 0;  
   
                 snprintf(tmpstr, sizeof(tmpstr),  
                     "ns16550 irq=3 addr=0x80006000 in_use=%i name2=tty0",  
                     machine->use_x11? 0 : 1);  
                 j = (size_t)device_add(machine, tmpstr);  
                 snprintf(tmpstr, sizeof(tmpstr),  
                     "ns16550 irq=0 addr=0x80007000 in_use=%i name2=tty1", 0);  
                 device_add(machine, tmpstr);  
   
                 if (machine->use_x11)  
                         machine->main_console_handle = i;  
                 else  
                         machine->main_console_handle = j;  
   
                 /*  lpt at 0x80008000  */  
   
                 device_add(machine, "fdc addr=0x8000c000, irq=0");  
   
                 switch (machine->machine_subtype) {  
                 case MACHINE_ARC_NEC_RD94:  
                 case MACHINE_ARC_NEC_R94:  
                         /*  PCI devices:  (NOTE: bus must be 0, device must be  
                             3, 4, or 5, for NetBSD to accept interrupts)  */  
                         bus_pci_add(machine, pci_data, mem, 0, 3, 0,  
                             "dec21030");        /*  tga graphics  */  
                         break;  
                 case MACHINE_ARC_NEC_R96:  
                         dev_fb_init(machine, mem, 0x100e00000ULL,  
                             VFB_GENERIC, 640,480, 1024,480,  
                             8, "necvdfrb");  
                         break;  
                 }  
                 break;  
   
         case MACHINE_ARC_NEC_R98:  
                 /*  
                  *  "NEC-R98" (NEC RISCserver 4200)  
                  *  
                  *  According to http://mail-index.netbsd.org/port-arc/  
                  *      2004/02/01/0001.html:  
                  *  
                  *  Network adapter at "start: 0x 0 18600000, length:  
                  *      0x1000, level: 4, vector: 9"  
                  *  Disk at "start: 0x 0 18c103f0, length: 0x1000, level:  
                  *      5, vector: 6"  
                  *  Keyboard at "start: 0x 0 18c20060, length: 0x1000,  
                  *      level: 5, vector: 3"  
                  *  Serial at "start: 0x 0 18c103f8, length: 0x1000,  
                  *      level: 5, vector: 4"  
                  *  Serial at "start: 0x 0 18c102f8, length: 0x1000,  
                  *      level: 5, vector: 4"  
                  *  Parallel at "start: 0x 0 18c10278, length: 0x1000,  
                  *      level: 5, vector: 5"  
                  */  
   
                 strlcat(machine->machine_name,  
                     " (NEC-R98; NEC RISCserver 4200)", MACHINE_NAME_MAXBUF);  
   
                 /*  
                  *  Windows NT access stuff at these addresses:  
                  *  
                  *  19980308, 18000210, 18c0a008,  
                  *  19022018, 19026010, andso on.  
                  */  
                 break;  
   
65          case MACHINE_ARC_JAZZ_PICA:          case MACHINE_ARC_JAZZ_PICA:
66          case MACHINE_ARC_JAZZ_MAGNUM:          case MACHINE_ARC_JAZZ_MAGNUM:
67                  /*                  /*
# Line 229  i = 0; Line 115  i = 0;
115                          strlcat(machine->machine_name,                          strlcat(machine->machine_name,
116                              " (Microsoft Jazz, Acer PICA-61)",                              " (Microsoft Jazz, Acer PICA-61)",
117                              MACHINE_NAME_MAXBUF);                              MACHINE_NAME_MAXBUF);
                         machine->stable = 1;  
118                          break;                          break;
119                  case MACHINE_ARC_JAZZ_MAGNUM:                  case MACHINE_ARC_JAZZ_MAGNUM:
120                          strlcat(machine->machine_name,                          strlcat(machine->machine_name,
# Line 252  i = 0; Line 137  i = 0;
137                      machine->bootstrap_cpu);                      machine->bootstrap_cpu);
138                  i = dev_pckbc_init(machine, mem, 0x80005000ULL,                  i = dev_pckbc_init(machine, mem, 0x80005000ULL,
139                      PCKBC_JAZZ, tmpstr, tmpstr2,                      PCKBC_JAZZ, tmpstr, tmpstr2,
140                      machine->use_x11, 0);                      machine->x11_md.in_use, 0);
141    
142                  /*  Serial controllers at JAZZ irq 8 and 9:  */                  /*  Serial controllers at JAZZ irq 8 and 9:  */
143                  snprintf(tmpstr, sizeof(tmpstr),                  snprintf(tmpstr, sizeof(tmpstr),
144                      "ns16550 irq=%s.cpu[%i].jazz.8 addr=0x80006000"                      "ns16550 irq=%s.cpu[%i].jazz.8 addr=0x80006000"
145                      " in_use=%i name2=tty0", machine->path,                      " in_use=%i name2=tty0", machine->path,
146                      machine->bootstrap_cpu, machine->use_x11? 0 : 1);                      machine->bootstrap_cpu, machine->x11_md.in_use? 0 : 1);
147                  j = (size_t)device_add(machine, tmpstr);                  j = (size_t)device_add(machine, tmpstr);
148                  snprintf(tmpstr, sizeof(tmpstr),                  snprintf(tmpstr, sizeof(tmpstr),
149                      "ns16550 irq=%s.cpu[%i].jazz.9 addr=0x80007000"                      "ns16550 irq=%s.cpu[%i].jazz.9 addr=0x80007000"
# Line 266  i = 0; Line 151  i = 0;
151                      machine->bootstrap_cpu);                      machine->bootstrap_cpu);
152                  device_add(machine, tmpstr);                  device_add(machine, tmpstr);
153    
154                  if (machine->use_x11)                  if (machine->x11_md.in_use)
155                          machine->main_console_handle = i;                          machine->main_console_handle = i;
156                  else                  else
157                          machine->main_console_handle = j;                          machine->main_console_handle = j;
158    
159                  switch (machine->machine_subtype) {                  switch (machine->machine_subtype) {
160                  case MACHINE_ARC_JAZZ_PICA:                  case MACHINE_ARC_JAZZ_PICA:
161                          if (machine->use_x11) {                          if (machine->x11_md.in_use) {
162                                  dev_vga_init(machine, mem, 0x400a0000ULL,                                  dev_vga_init(machine, mem, 0x400a0000ULL,
163                                      0x600003c0ULL, machine->machine_name);                                      0x600003c0ULL, machine->machine_name);
164                                  arcbios_console_init(machine,                                  arcbios_console_init(machine,
# Line 345  Not yet. Line 230  Not yet.
230  MACHINE_DEFAULT_CPU(arc)  MACHINE_DEFAULT_CPU(arc)
231  {  {
232          switch (machine->machine_subtype) {          switch (machine->machine_subtype) {
233    
234          case MACHINE_ARC_JAZZ_PICA:          case MACHINE_ARC_JAZZ_PICA:
235                  machine->cpu_name = strdup("R4000");                  CHECK_ALLOCATION(machine->cpu_name = strdup("R4000"));
236                  break;                  break;
237    
238          default:          default:
239                  machine->cpu_name = strdup("R4400");                  CHECK_ALLOCATION(machine->cpu_name = strdup("R4400"));
240          }          }
241  }  }
242    
# Line 371  MACHINE_REGISTER(arc) Line 258  MACHINE_REGISTER(arc)
258          machine_entry_add_subtype(me, "Acer PICA-61", MACHINE_ARC_JAZZ_PICA,          machine_entry_add_subtype(me, "Acer PICA-61", MACHINE_ARC_JAZZ_PICA,
259              "pica-61", "acer pica", "pica", NULL);              "pica-61", "acer pica", "pica", NULL);
260    
         machine_entry_add_subtype(me, "Deskstation Tyne",  
             MACHINE_ARC_DESKTECH_TYNE,  
             "deskstation tyne", "desktech", "tyne", NULL);  
   
261          machine_entry_add_subtype(me, "Jazz Magnum", MACHINE_ARC_JAZZ_MAGNUM,          machine_entry_add_subtype(me, "Jazz Magnum", MACHINE_ARC_JAZZ_MAGNUM,
262              "magnum", "jazz magnum", NULL);              "magnum", "jazz magnum", NULL);
   
         machine_entry_add_subtype(me, "NEC-R94", MACHINE_ARC_NEC_R94,  
             "nec-r94", "r94", NULL);  
   
         machine_entry_add_subtype(me, "NEC-RD94", MACHINE_ARC_NEC_RD94,  
             "nec-rd94", "rd94", NULL);  
   
         machine_entry_add_subtype(me, "NEC-R96", MACHINE_ARC_NEC_R96,  
             "nec-r96", "r96", NULL);  
   
         machine_entry_add_subtype(me, "NEC-R98", MACHINE_ARC_NEC_R98,  
             "nec-r98", "r98", NULL);  
   
         machine_entry_add_subtype(me, "Olivetti M700", MACHINE_ARC_JAZZ_M700,  
             "olivetti", "m700", NULL);  
263  }  }
264    

Legend:
Removed from v.41  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.26