/[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 28 by dpavlin, Mon Oct 8 16:20:26 2007 UTC revision 34 by dpavlin, Mon Oct 8 16:21:17 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2003-2006  Anders Gavare.  All rights reserved.   *  Copyright (C) 2003-2007  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: machine_arc.c,v 1.5 2006/06/30 20:22:54 debug Exp $   *  $Id: machine_arc.c,v 1.13 2007/02/10 14:21:10 debug Exp $
29   */   */
30    
31  #include <stdio.h>  #include <stdio.h>
# Line 38  Line 38 
38  #include "device.h"  #include "device.h"
39  #include "devices.h"  #include "devices.h"
40  #include "machine.h"  #include "machine.h"
 #include "machine_interrupts.h"  
41  #include "memory.h"  #include "memory.h"
42  #include "misc.h"  #include "misc.h"
43    
# Line 48  Line 47 
47  MACHINE_SETUP(arc)  MACHINE_SETUP(arc)
48  {  {
49          struct pci_data *pci_data;          struct pci_data *pci_data;
50            void *jazz_data;
51          struct memory *mem = machine->memory;          struct memory *mem = machine->memory;
52          char tmpstr[1000];          char tmpstr[1000];
53            char tmpstr2[1000];
54          int i, j;          int i, j;
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];
# Line 103  MACHINE_SETUP(arc) Line 104  MACHINE_SETUP(arc)
104                  device_add(machine, "sn addr=0x80001000 irq=0");                  device_add(machine, "sn addr=0x80001000 irq=0");
105                  dev_mc146818_init(machine, mem, 0x80004000ULL, 0,                  dev_mc146818_init(machine, mem, 0x80004000ULL, 0,
106                      MC146818_ARC_NEC, 1);                      MC146818_ARC_NEC, 1);
107                  i = dev_pckbc_init(machine, mem, 0x80005000ULL, PCKBC_8042,  
108                      0, 0, machine->use_x11, 0);  fatal("TODO: legacy rewrite\n");
109    abort();
110    //              i = dev_pckbc_init(machine, mem, 0x80005000ULL, PCKBC_8042,
111    //                  0, 0, machine->use_x11, 0);
112    
113                  snprintf(tmpstr, sizeof(tmpstr),                  snprintf(tmpstr, sizeof(tmpstr),
114                      "ns16550 irq=3 addr=0x80006000 in_use=%i name2=tty0",                      "ns16550 irq=3 addr=0x80006000 in_use=%i name2=tty0",
# Line 236  MACHINE_SETUP(arc) Line 240  MACHINE_SETUP(arc)
240                          exit(1);                          exit(1);
241                  }                  }
242    
243                  machine->md_int.jazz_data = device_add(machine,                  jazz_data = device_add(machine, "jazz addr=0x80000000");
                     "jazz addr=0x80000000");  
                 machine->md_interrupt = jazz_interrupt;  
244    
245                    /*  Keyboard IRQ is jazz.6, mouse is jazz.7  */
246                    snprintf(tmpstr, sizeof(tmpstr),
247                        "%s.cpu[%i].jazz.6", machine->path,
248                        machine->bootstrap_cpu);
249                    snprintf(tmpstr2, sizeof(tmpstr2),
250                        "%s.cpu[%i].jazz.7", machine->path,
251                        machine->bootstrap_cpu);
252                  i = dev_pckbc_init(machine, mem, 0x80005000ULL,                  i = dev_pckbc_init(machine, mem, 0x80005000ULL,
253                      PCKBC_JAZZ, 8 + 6, 8 + 7,                      PCKBC_JAZZ, tmpstr, tmpstr2,
254                      machine->use_x11, 0);                      machine->use_x11, 0);
255    
256                    /*  Serial controllers at JAZZ irq 8 and 9:  */
257                  snprintf(tmpstr, sizeof(tmpstr),                  snprintf(tmpstr, sizeof(tmpstr),
258                      "ns16550 irq=16 addr=0x80006000 in_use=%i"                      "ns16550 irq=%s.cpu[%i].jazz.8 addr=0x80006000"
259                      " name2=tty0", machine->use_x11? 0 : 1);                      " in_use=%i name2=tty0", machine->path,
260                        machine->bootstrap_cpu, machine->use_x11? 0 : 1);
261                  j = (size_t)device_add(machine, tmpstr);                  j = (size_t)device_add(machine, tmpstr);
262                  snprintf(tmpstr, sizeof(tmpstr),                  snprintf(tmpstr, sizeof(tmpstr),
263                      "ns16550 irq=17 addr=0x80007000 in_use=%i"                      "ns16550 irq=%s.cpu[%i].jazz.9 addr=0x80007000"
264                      " name2=tty1", 0);                      " in_use=0 name2=tty1", machine->path,
265                        machine->bootstrap_cpu);
266                  device_add(machine, tmpstr);                  device_add(machine, tmpstr);
267    
268                  if (machine->use_x11)                  if (machine->use_x11)
# Line 280  MACHINE_SETUP(arc) Line 292  MACHINE_SETUP(arc)
292                          break;                          break;
293                  }                  }
294    
295                  /*  irq 8 + 4  */                  /*  SN at JAZZ irq 4  */
296                  device_add(machine, "sn addr=0x80001000 irq=12");                  snprintf(tmpstr, sizeof(tmpstr),
297                        "sn addr=0x80001000 irq=%s.cpu[%i].jazz.4",
298                        machine->path, machine->bootstrap_cpu);
299                    device_add(machine, tmpstr);
300    
301                  dev_asc_init(machine, mem, 0x80002000ULL, 8 + 5, NULL,                  /*  ASC at JAZZ irq 5  */
302                      DEV_ASC_PICA, dev_jazz_dma_controller,                  snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].jazz.5",
303                      machine->md_int.jazz_data);                      machine->path, machine->bootstrap_cpu);
304                    dev_asc_init(machine, mem, 0x80002000ULL, tmpstr, NULL,
305                        DEV_ASC_PICA, dev_jazz_dma_controller, jazz_data);
306    
307                  device_add(machine, "fdc addr=0x80003000, irq=0");                  /*  FDC at JAZZ irq 1  */
308                    snprintf(tmpstr, sizeof(tmpstr),
309                        "fdc addr=0x80003000 irq=%s.cpu[%i].jazz.1",
310                        machine->path, machine->bootstrap_cpu);
311                    device_add(machine, tmpstr);
312    
313                    /*  MC146818 at MIPS irq 2:  */
314                    snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2",
315                        machine->path, machine->bootstrap_cpu);
316                  dev_mc146818_init(machine, mem,                  dev_mc146818_init(machine, mem,
317                      0x80004000ULL, 2, MC146818_ARC_JAZZ, 1);                      0x80004000ULL, tmpstr, MC146818_ARC_JAZZ, 1);
318    
319  #if 0  #if 0
320  Not yet.  Not yet.
321                  /*  irq = 8+16 + 14  */                  /*  WDC at ISA irq 14  */
322                  device_add(machine, "wdc addr=0x900001f0, irq=38");                  device_add(machine, "wdc addr=0x900001f0, irq=38");
323  #endif  #endif
324    
325                  break;                  break;
326    
         case MACHINE_ARC_JAZZ_M700:  
                 /*  
                  *  "Microsoft-Jazz", "Olivetti M700"  
                  *  
                  *  Different enough from Pica and Magnum to be  
                  *  separate here.  
                  *  
                  *  http://mail-index.netbsd.org/port-arc/2000/10/18/0001.html  
                  */  
   
                 strlcat(machine->machine_name, " (Microsoft Jazz, "  
                     "Olivetti M700)", MACHINE_NAME_MAXBUF);  
   
                 machine->md_int.jazz_data = device_add(machine,  
                     "jazz addr=0x80000000");  
                 machine->md_interrupt = jazz_interrupt;  
   
                 dev_mc146818_init(machine, mem,  
                     0x80004000ULL, 2, MC146818_ARC_JAZZ, 1);  
   
                 i = 0;          /*  TODO: Yuck!  */  
 #if 0  
                 i = dev_pckbc_init(machine, mem, 0x80005000ULL,  
                     PCKBC_JAZZ, 8 + 6, 8 + 7, machine->use_x11, 0);  
 #endif  
   
                 snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=16 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=17 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;  
   
                 dev_m700_fb_init(machine, mem, 0x180080000ULL, 0x100000000ULL);  
   
                 break;  
   
         case MACHINE_ARC_DESKTECH_TYNE:  
                 /*  
                  *  "Deskstation Tyne" (?)  
                  *  
                  *  TODO  
                  *  http://mail-index.netbsd.org/port-arc/2000/10/14/0000.html  
                  */  
   
                 strlcat(machine->machine_name, " (Deskstation Tyne)",  
                     MACHINE_NAME_MAXBUF);  
   
                 /*  TODO: IRQs!  */  
                 bus_isa_init(machine, 0, 0x900000000ULL,  
                     0x100000000ULL, 8, 24);  
 #if 0  
                 snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr="  
                     "0x9000003f8 in_use=%i name2=tty0", machine->use_x11? 0:1);  
                 i = (size_t)device_add(machine, tmpstr);  
                 device_add(machine, "ns16550 irq=0 addr=0x9000002f8 in_use=0"  
                     " name2=tty1");  
 #endif  
                 device_add(machine, "ns16550 irq=0 addr=0x9000003e8 "  
                     "in_use=0 name2=tty2");  
                 device_add(machine, "ns16550 irq=0 addr=0x9000002e8 "  
                     "in_use=0 name2=tty3");  
 #if 0  
                 dev_mc146818_init(machine, mem,  
                     0x900000070ULL, 2, MC146818_PC_CMOS, 1);  
                 /*  TODO: irq, etc  */  
                 device_add(machine, "wdc addr=0x9000001f0, irq=0");  
                 device_add(machine, "wdc addr=0x900000170, irq=0");  
   
                 /*  PC kbd  */  
                 j = dev_pckbc_init(machine, mem, 0x900000060ULL,  
                     PCKBC_8042, 0, 0, machine->use_x11, 0);  
   
                 if (machine->use_x11)  
                         machine->main_console_handle = j;  
                 else  
                         machine->main_console_handle = i;  
 #endif  
   
                 if (machine->use_x11) {  
                         dev_vga_init(machine, mem, 0x1000a0000ULL,  
                             0x9000003c0ULL, machine->machine_name);  
                         arcbios_console_init(machine,  
                             0x1000b8000ULL, 0x9000003c0ULL);  
                 }  
                 break;  
   
327          default:fatal("Unimplemented ARC machine type %i\n",          default:fatal("Unimplemented ARC machine type %i\n",
328                      machine->machine_subtype);                      machine->machine_subtype);
329                  exit(1);                  exit(1);

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

  ViewVC Help
Powered by ViewVC 1.1.26