machine_mvme88k.cc Source File

Back to the index.

machine_mvme88k.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2014 Anders Gavare. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. The name of the author may not be used to endorse or promote products
13  * derived from this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  *
28  * COMMENT: MVME88K machines (MVME187)
29  *
30  * This is for experiments with OpenBSD/mvme88k.
31  *
32  * MVME187 according to http://mcg.motorola.com/us/products/docs/pdf/187igd.pdf
33  * ("MVME187 RISC Single Board Computer Installation Guide"):
34  *
35  * 88100 MPU, two MC88200 or MC88204 CMMUs (one for data cache and
36  * one for instruction cache).
37  * 82596CA LAN Ethernet
38  * 53C710 SCSI
39  * CD2401 SCC SERIAL IO
40  * PRINTER PORT
41  * MK48T08 BBRAM & CLOCK
42  * EPROM
43  * VME bus
44  *
45  * ... and more details from OpenBSD/mvme88k sources:
46  *
47  * 0xff800000 .. 0xffbfffff = BUG PROM
48  * 0xffe00000 .. 0xffe1ffff = BUG SRAM
49  * 0xfff00000 = PCCTWO
50  * 0xfff40000 = VME bus
51  * 0xfff43000 = MEMC040 (Memory controller)
52  * 0xfff45000 = CD2401 SCC SERIAL IO (cl0)
53  * 0xfff46000 = 82596 Ethernet (ie0)
54  * 0xfff47000 = 53C710 SCSI (osiop0)
55  * 0xfffc0000 = MK48T08 (nvram0)
56  *
57  * Note: It may turn out to be easier to support Lance ethernet (via VME)
58  * than to support the 82596 ethernet controller.
59  */
60 
61 #include <stdio.h>
62 #include <stdlib.h>
63 #include <string.h>
64 
65 #include "cpu.h"
66 #include "device.h"
67 #include "devices.h"
68 #include "machine.h"
69 #include "memory.h"
70 #include "misc.h"
71 
72 #include "thirdparty/mvme187.h"
73 #include "thirdparty/mvme88k_vme.h"
75 
76 
77 MACHINE_SETUP(mvme88k)
78 {
79  char tmpstr[300];
80 
81  switch (machine->machine_subtype) {
82 
84  machine->machine_name = strdup("MVME187");
85 
86  /* The mvme187 device contains 187-specific stuff, such
87  as motherboard registers, and the memory controller: */
88  device_add(machine, "mvme187");
89 
90  /* PCC2 bus at 0xfff00000: */
91  snprintf(tmpstr, sizeof(tmpstr), "pcc2 addr=0x%x", PCC2_BASE);
92  device_add(machine, tmpstr);
93 
94  /* VME2 bus at 0xfff40000: */
95  snprintf(tmpstr, sizeof(tmpstr), "vme addr=0x%x", VME2_BASE);
96  device_add(machine, tmpstr);
97 
98  /* Cirrus Logic serial console at 0xfff45000: */
99  snprintf(tmpstr, sizeof(tmpstr), "clmpcc irq=%s.cpu[%i].pcc2 "
100  "addr=0x%08x name2=cl0", machine->path,
101  machine->bootstrap_cpu, 0xfff45000);
103  (size_t) device_add(machine, tmpstr);
104 
105  /* ie0 ethernet: TODO */
106  device_add(machine, "unreadable addr=0xfff46000 len=0x1000");
107 
108  /* 53C710 SCSI at 0xfff47000: */
109  snprintf(tmpstr, sizeof(tmpstr), "osiop irq=%s.cpu[%i].pcc2.%i "
110  "addr=0x%08x", machine->path,
111  machine->bootstrap_cpu, PCC2V_SCSI, 0xfff47000);
112  device_add(machine, tmpstr);
113 
114  /* MK48T08 clock/nvram at 0xfffc0000: */
115  snprintf(tmpstr, sizeof(tmpstr),
116  "mk48txx addr=0x%x", 0xfffc0000);
117  device_add(machine, tmpstr);
118 
119  /* VMES (?): TODO */
120  device_add(machine, "unreadable addr=0xff780000 len=0x80000");
121 
122  /* VME devices: TODO */
123  device_add(machine, "unreadable addr=0xffff0000 len=0x10000");
124 
125  break;
126 
127  case MACHINE_MVME88K_188:
128  machine->machine_name = strdup("MVME188");
129  /* TODO */
130  break;
131 
132  case MACHINE_MVME88K_197:
133  machine->machine_name = strdup("MVME197");
134  /* TODO */
135  break;
136 
137  default:fatal("Unimplemented MVME88K machine subtype %i\n",
139  exit(1);
140  }
141 
142  if (!machine->prom_emulation)
143  return;
144 
145 
147 
148  /*
149  * Boot loader args, according to OpenBSD/mvme88k's locore.S:
150  *
151  * r2 = boot flags
152  * r3 = boot controller physical address
153  * r4 = esym
154  * r5 = start of miniroot
155  * r6 = end of miniroot
156  * r7 = ((Clun << 8) | Dlun): encoded bootdev
157  * r8 = board type (0x187, 0x188, 0x197)
158  */
159 
160  /* Some address beyond the loaded kernel: */
161  cpu->cd.m88k.r[4] = 6 * 1048576;
162 
163  switch (machine->machine_subtype) {
164  case MACHINE_MVME88K_187: cpu->cd.m88k.r[8] = 0x187; break;
165  case MACHINE_MVME88K_188: cpu->cd.m88k.r[8] = 0x188; break;
166  case MACHINE_MVME88K_197: cpu->cd.m88k.r[8] = 0x197; break;
167  }
168 
169  /* TODO: r3 and r7 must be set correctly to let
170  OpenBSD/mvme88k detect correct boot device. */
171 }
172 
173 
175 {
176  switch (machine->machine_subtype) {
177 
178  case MACHINE_MVME88K_187:
179  case MACHINE_MVME88K_188:
180  machine->cpu_name = strdup("88100");
181  break;
182 
183  case MACHINE_MVME88K_197:
184  machine->cpu_name = strdup("88110");
185  break;
186 
187  default:fatal("Unimplemented MVME88K machine subtype %i\n",
189  exit(1);
190  }
191 }
192 
193 
195 {
197 }
198 
199 
201 {
202  MR_DEFAULT(mvme88k, "MVME88K", ARCH_M88K, MACHINE_MVME88K);
203 
204  machine_entry_add_alias(me, "mvme88k");
205 
207  "mvme187old", NULL);
208 
210  "mvme188", NULL);
211 
213  "mvme197", NULL);
214 
215  me->set_default_ram = machine_default_ram_mvme88k;
216 }
217 
void fatal(const char *fmt,...)
Definition: main.cc:152
MACHINE_DEFAULT_RAM(mvme88k)
int prom_emulation
Definition: machine.h:149
char * cpu_name
Definition: machine.h:133
int main_console_handle
Definition: machine.h:128
#define MACHINE_MVME88K_197
Definition: machine.h:330
union cpu::@1 cd
#define VME2_BASE
Definition: mvme88k_vme.h:44
uint32_t r[N_M88K_REGS+1]
Definition: cpu_m88k.h:235
void * device_add(struct machine *machine, const char *name_and_params)
Definition: device.cc:252
MACHINE_DEFAULT_CPU(mvme88k)
int physical_ram_in_mb
Definition: machine.h:147
char * path
Definition: machine.h:108
int bootstrap_cpu
Definition: machine.h:136
void machine_entry_add_subtype(struct machine_entry *me, const char *name, int oldstyle_subtype,...)
Definition: machine.cc:717
void machine_entry_add_alias(struct machine_entry *me, const char *name)
Definition: machine.cc:697
#define ARCH_M88K
Definition: machine.h:208
MACHINE_REGISTER(mvme88k)
Definition: cpu.h:326
MACHINE_SETUP(mvme88k)
#define PCC2_BASE
#define PCC2V_SCSI
#define MACHINE_MVME88K
Definition: machine.h:258
void mvmeprom_init(struct machine *machine)
Definition: mvmeprom.cc:55
int machine_subtype
Definition: machine.h:112
struct m88k_cpu m88k
Definition: cpu.h:442
#define MACHINE_MVME88K_188
Definition: machine.h:329
#define MR_DEFAULT(x, name, arch, type)
Definition: machine.h:370
const char * machine_name
Definition: machine.h:115
#define MACHINE_MVME88K_187
Definition: machine.h:328

Generated on Sun Sep 30 2018 16:05:18 for GXemul by doxygen 1.8.13