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

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

revision 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2005-2006  Anders Gavare.  All rights reserved.   *  Copyright (C) 2005-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_evbmips.c,v 1.2 2006/01/08 11:05:03 debug Exp $   *  $Id: machine_evbmips.c,v 1.27 2007/06/15 18:08:10 debug Exp $
29     *
30     *  COMMENT: MIPS evaluation boards (e.g. Malta)
31   */   */
32    
33  #include <stdio.h>  #include <stdio.h>
# Line 38  Line 40 
40  #include "device.h"  #include "device.h"
41  #include "devices.h"  #include "devices.h"
42  #include "machine.h"  #include "machine.h"
 #include "machine_interrupts.h"  
43  #include "memory.h"  #include "memory.h"
44  #include "misc.h"  #include "misc.h"
45    
# Line 47  Line 48 
48    
49  MACHINE_SETUP(evbmips)  MACHINE_SETUP(evbmips)
50  {  {
51          char tmpstr[1000];          char tmpstr[1000], tmpstr2[1000];
         char tmps[50];  
         uint64_t env, tmpptr;  
52          struct pci_data *pci_data;          struct pci_data *pci_data;
53          int i;          int i;
54    
55          /*  See http://www.netbsd.org/Ports/evbmips/ for more info.  */          /*  See http://www.netbsd.org/ports/evbmips/ for more info.  */
56    
57          switch (machine->machine_subtype) {          switch (machine->machine_subtype) {
58          case MACHINE_EVBMIPS_MALTA:          case MACHINE_EVBMIPS_MALTA:
59          case MACHINE_EVBMIPS_MALTA_BE:          case MACHINE_EVBMIPS_MALTA_BE:
60                    if (machine->emulated_hz == 0)
61                            machine->emulated_hz = 33000000;
62                  cpu->byte_order = EMUL_LITTLE_ENDIAN;                  cpu->byte_order = EMUL_LITTLE_ENDIAN;
63                  machine->machine_name = "MALTA (evbmips, little endian)";                  machine->machine_name = "MALTA (evbmips, little endian)";
                 machine->stable = 1;  
64    
65                  if (machine->machine_subtype == MACHINE_EVBMIPS_MALTA_BE) {                  if (machine->machine_subtype == MACHINE_EVBMIPS_MALTA_BE) {
66                          machine->machine_name = "MALTA (evbmips, big endian)";                          machine->machine_name = "MALTA (evbmips, big endian)";
67                          cpu->byte_order = EMUL_BIG_ENDIAN;                          cpu->byte_order = EMUL_BIG_ENDIAN;
68                  }                  }
69    
70                  machine->md_interrupt = isa8_interrupt;                  /*  ISA bus at MIPS irq 2:  */
71                  machine->isa_pic_data.native_irq = 2;                  snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2",
72                        machine->path, machine->bootstrap_cpu);
73                  bus_isa_init(machine, 0, 0x18000000, 0x10000000, 8, 24);                  bus_isa_init(machine, tmpstr, 0, 0x18000000, 0x10000000);
74    
75                  snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=4 addr=0x%x"                  snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%s.cpu[%i].4 "
76                      " name2=tty2 in_use=0", MALTA_CBUSUART);                      "addr=0x%x name2=tty2 in_use=0", machine->path,
77                        machine->bootstrap_cpu, MALTA_CBUSUART);
78                  device_add(machine, tmpstr);                  device_add(machine, tmpstr);
79    
80                    /*  Add a GT controller; timer interrupts at ISA irq 9:  */
81                    snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2.isa.9",
82                        machine->path, machine->bootstrap_cpu);
83                    snprintf(tmpstr2, sizeof(tmpstr2), "%s.cpu[%i].2",
84                        machine->path, machine->bootstrap_cpu);
85                  pci_data = dev_gt_init(machine, machine->memory, 0x1be00000,                  pci_data = dev_gt_init(machine, machine->memory, 0x1be00000,
86                      8+9, 8+9, 120);                      tmpstr, tmpstr2, 120);
87    
88                  if (machine->use_x11) {                  if (machine->x11_md.in_use) {
89                          if (strlen(machine->boot_string_argument) < 3) {                          if (strlen(machine->boot_string_argument) < 3) {
90                                  fatal("WARNING: remember to use  -o 'console="                                  fatal("WARNING: remember to use  -o 'console="
91                                      "tty0'  if you are emulating Linux. (Not"                                      "tty0'  if you are emulating Linux. (Not"
# Line 94  MACHINE_SETUP(evbmips) Line 100  MACHINE_SETUP(evbmips)
100                  bus_pci_add(machine, pci_data, machine->memory,                  bus_pci_add(machine, pci_data, machine->memory,
101                      0, 9, 1, "piix4_ide");                      0, 9, 1, "piix4_ide");
102    
103                  device_add(machine, "malta_lcd addr=0x1f000400");                  /*  pcn: Not yet, since it is just a bogus device, so far.  */
104                  break;                  /*  bus_pci_add(machine, pci_data, machine->memory,
105                        0, 11, 0, "pcn");  */
106    
107          case MACHINE_EVBMIPS_PB1000:                  device_add(machine, "malta_lcd addr=0x1f000400");
                 machine->machine_name = "PB1000 (evbmips)";  
                 cpu->byte_order = EMUL_BIG_ENDIAN;  
   
                 machine->md_interrupt = au1x00_interrupt;  
                 machine->md_int.au1x00_ic_data = dev_au1x00_init(machine,  
                     machine->memory);  
                 /*  TODO  */  
108                  break;                  break;
109    
110          default:fatal("Unimplemented EVBMIPS model.\n");          default:fatal("Unimplemented EVBMIPS model.\n");
# Line 134  MACHINE_SETUP(evbmips) Line 134  MACHINE_SETUP(evbmips)
134          /*  a2 = (yamon_env_var *)envp  */          /*  a2 = (yamon_env_var *)envp  */
135          cpu->cd.mips.gpr[MIPS_GPR_A2] = (int32_t)0x9fc01800;          cpu->cd.mips.gpr[MIPS_GPR_A2] = (int32_t)0x9fc01800;
136    
137          env = cpu->cd.mips.gpr[MIPS_GPR_A2];          yamon_machine_setup(machine, cpu->cd.mips.gpr[MIPS_GPR_A2]);
         tmpptr = 0xffffffff9fc01c00ULL;  
   
         snprintf(tmps, sizeof(tmps), "0x%08x", machine->physical_ram_in_mb<<20);  
         add_environment_string_dual(cpu, &env, &tmpptr, "memsize", tmps);  
   
         add_environment_string_dual(cpu, &env, &tmpptr, "yamonrev", "02.06");  
   
         /*  End of env:  */  
         tmpptr = 0;  
         add_environment_string_dual(cpu,  
                     &env, &tmpptr, NULL, NULL);  
138    
139          /*  a3 = memsize  */          /*  a3 = memsize  */
140          cpu->cd.mips.gpr[MIPS_GPR_A3] = machine->physical_ram_in_mb * 1048576;          cpu->cd.mips.gpr[MIPS_GPR_A3] = machine->physical_ram_in_mb * 1048576;
# Line 165  MACHINE_SETUP(evbmips) Line 154  MACHINE_SETUP(evbmips)
154          for (i=0; i<0x100; i+=4)          for (i=0; i<0x100; i+=4)
155                  store_32bit_word(cpu, (int64_t)(int32_t)0x9fc00500 + i,                  store_32bit_word(cpu, (int64_t)(int32_t)0x9fc00500 + i,
156                      (int64_t)(int32_t)0x9fc00800 + i);                      (int64_t)(int32_t)0x9fc00800 + i);
157    
158            /*  "Magic trap" PROM instructions at 0x9fc008xx:  */
159            for (i=0; i<0x100; i+=4)
160                    store_32bit_word(cpu, (int64_t)(int32_t)0x9fc00800 + i,
161                        0x00c0de0c);
162  }  }
163    
164    
165  MACHINE_DEFAULT_CPU(evbmips)  MACHINE_DEFAULT_CPU(evbmips)
166  {  {
167          switch (machine->machine_subtype) {          switch (machine->machine_subtype) {
168    
169          case MACHINE_EVBMIPS_MALTA:          case MACHINE_EVBMIPS_MALTA:
170          case MACHINE_EVBMIPS_MALTA_BE:          case MACHINE_EVBMIPS_MALTA_BE:
171                    /*  5Kc = MIPS64 rev 1, 5KE = MIPS64 rev 2  */
172                  machine->cpu_name = strdup("5Kc");                  machine->cpu_name = strdup("5Kc");
173                  break;                  break;
174          case MACHINE_EVBMIPS_PB1000:  
                 machine->cpu_name = strdup("AU1000");  
                 break;  
175          default:fatal("Unimplemented evbmips subtype.\n");          default:fatal("Unimplemented evbmips subtype.\n");
176                  exit(1);                  exit(1);
177          }          }
# Line 192  MACHINE_DEFAULT_RAM(evbmips) Line 186  MACHINE_DEFAULT_RAM(evbmips)
186    
187  MACHINE_REGISTER(evbmips)  MACHINE_REGISTER(evbmips)
188  {  {
189          MR_DEFAULT(evbmips, "MIPS evaluation boards (evbmips)", ARCH_MIPS,          MR_DEFAULT(evbmips, "MIPS evaluation boards (evbmips)",
190              MACHINE_EVBMIPS, 1, 3);              ARCH_MIPS, MACHINE_EVBMIPS);
191          me->aliases[0] = "evbmips";  
192          me->subtype[0] = machine_entry_subtype_new("Malta",          machine_entry_add_alias(me, "evbmips");
193              MACHINE_EVBMIPS_MALTA, 1);  
194          me->subtype[0]->aliases[0] = "malta";          machine_entry_add_subtype(me, "Malta", MACHINE_EVBMIPS_MALTA,
195          me->subtype[1] = machine_entry_subtype_new("Malta (Big-Endian)",              "malta", NULL);
196              MACHINE_EVBMIPS_MALTA_BE, 1);  
197          me->subtype[1]->aliases[0] = "maltabe";          machine_entry_add_subtype(me, "Malta (Big-Endian)",
198          me->subtype[2] = machine_entry_subtype_new("PB1000",              MACHINE_EVBMIPS_MALTA_BE, "maltabe", NULL);
199              MACHINE_EVBMIPS_PB1000, 1);  
         me->subtype[2]->aliases[0] = "pb1000";  
         machine_entry_add(me, ARCH_MIPS);  
200          me->set_default_ram = machine_default_ram_evbmips;          me->set_default_ram = machine_default_ram_evbmips;
         machine_entry_add(me, ARCH_ARM);  
201  }  }
202    

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

  ViewVC Help
Powered by ViewVC 1.1.26