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

Contents of /trunk/src/machines/machine_mvmeppc.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 26 - (show annotations)
Mon Oct 8 16:20:10 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 6201 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.1264 2006/06/25 11:08:04 debug Exp $
20060624	Replacing the error-prone machine type initialization stuff
		with something more reasonable.
		Finally removing the old "cpu_run" kludge; moving around stuff
		in machine.c and emul.c to better suit the dyntrans system.
		Various minor dyntrans cleanups (renaming translate_address to
		translate_v2p, and experimenting with template physpages).
20060625	Removing the speed hack which separated the vph entries into
		two halves (code vs data); things seem a lot more stable now.
		Minor performance hack: R2000/R3000 cache isolation now only
		clears address translations when going into isolation, not
		when going out of it.
		Fixing the MIPS interrupt problems by letting mtc0 immediately
		cause interrupts.

==============  RELEASE 0.4.0.1  ==============


1 /*
2 * Copyright (C) 2006 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 * $Id: machine_mvmeppc.c,v 1.9 2006/06/24 10:19:19 debug Exp $
29 *
30 * MVMEPPC machines (for experimenting with NetBSD/mvmeppc or RTEMS).
31 * (ftp://ftp.netbsd.org/pub/NetBSD/arch/mvmeppc/snapshot/20020302/README)
32 *
33 * Note: MVME machines that really adhere to the PReP standard should be
34 * in machine_prep.c instead.
35 *
36 *
37 * TODO: This is mostly bogus.
38 */
39
40 #include <stdio.h>
41 #include <stdlib.h>
42 #include <string.h>
43
44 #include "bus_isa.h"
45 #include "bus_pci.h"
46 #include "cpu.h"
47 #include "device.h"
48 #include "devices.h"
49 #include "diskimage.h"
50 #include "machine.h"
51 #include "machine_interrupts.h"
52 #include "memory.h"
53 #include "misc.h"
54
55
56 MACHINE_SETUP(mvmeppc)
57 {
58 struct pci_data *pci_data = NULL;
59
60 switch (machine->machine_subtype) {
61
62 case MACHINE_MVMEPPC_1600:
63 machine->machine_name = "MVME1600";
64
65 machine->md_int.prep_data = device_add(machine, "prep");
66 machine->isa_pic_data.native_irq = 1; /* Semi-bogus */
67 machine->md_interrupt = isa32_interrupt;
68
69 pci_data = dev_eagle_init(machine, machine->memory,
70 32 /* isa irq base */, 0 /* pci irq: TODO */);
71
72 bus_isa_init(machine, BUS_ISA_LPTBASE_3BC,
73 0x80000000, 0xc0000000, 32, 48);
74
75 bus_pci_add(machine, pci_data, machine->memory,
76 0, 14, 0, "dec21143");
77
78 device_add(machine, "nvram addr=0x80000074 name2=mvme1600");
79
80 /*
81 * "DRAM size register": TODO: turn this into a device?
82 * See the definition of p160x_dram_size in NetBSD's
83 * .../arch/mvmeppc/platform_160x.c for details.
84 *
85 * 0x11 = two banks of 32 MB each.
86 */
87 dev_ram_init(machine, 0x80000804, 1, DEV_RAM_RAM, 0);
88 store_byte(cpu, 0x80000804, 0x11);
89
90 break;
91
92 case MACHINE_MVMEPPC_2100:
93 machine->machine_name = "MVME2100";
94
95 /* 0xfe000000 isa bus space */
96 /* 0xfec00000 pci indirect addr */
97 /* 0xfee00000 pci indirect data */
98
99 /* TODO: irq */
100 device_add(machine, "ns16550 irq=0 addr=0xffe10000");
101
102 break;
103
104 case MACHINE_MVMEPPC_5500:
105 machine->machine_name = "MVME5500";
106
107 /* GT64260 interrupt and PCI controller: */
108 pci_data = dev_gt_init(machine, machine->memory,
109 0xf1000000, 0 /* TODO: irq */, 0 /* TODO: pciirq */, 260);
110
111 /* TODO: irq */
112 device_add(machine, "ns16550 irq=0 addr=0xf1120000");
113
114 break;
115
116 default:fatal("Unimplemented MVMEPPC machine subtype %i\n",
117 machine->machine_subtype);
118 exit(1);
119 }
120
121 if (!machine->prom_emulation)
122 return;
123
124 /* r3 = start of kernel, r4 = end of kernel (for NetBSD/mvmeppc) */
125 cpu->cd.ppc.gpr[3] = 0;
126 cpu->cd.ppc.gpr[4] = 1048576 * 10;
127 cpu->cd.ppc.gpr[5] = machine->physical_ram_in_mb * 1048576-0x100;
128 store_string(cpu, cpu->cd.ppc.gpr[5]+ 44, "PC16550");
129 store_32bit_word(cpu, cpu->cd.ppc.gpr[5]+ 68, 9600);
130 store_32bit_word(cpu, cpu->cd.ppc.gpr[5]+ 72, 0);
131
132 store_16bit_word(cpu, cpu->cd.ppc.gpr[5]+ 76, 0x1600);
133 store_32bit_word(cpu, cpu->cd.ppc.gpr[5]+ 80,
134 machine->physical_ram_in_mb * 1048576);
135 store_32bit_word(cpu, cpu->cd.ppc.gpr[5]+ 84, 33 * 1000000);
136 store_32bit_word(cpu, cpu->cd.ppc.gpr[5]+ 88, 33 * 1000000);
137 #if 0
138 0 u_int32_t bi_boothowto;
139 4 u_int32_t bi_bootaddr;
140 8 u_int16_t bi_bootclun;
141 10 u_int16_t bi_bootdlun;
142 12 char bi_bootline[BOOTLINE_LEN]; (32)
143 44 char bi_consoledev[CONSOLEDEV_LEN]; (16)
144 60 u_int32_t bi_consoleaddr;
145 64 u_int32_t bi_consolechan;
146 68 u_int32_t bi_consolespeed;
147 72 u_int32_t bi_consolecflag;
148 76 u_int16_t bi_modelnumber;
149 80 u_int32_t bi_memsize;
150 84 u_int32_t bi_mpuspeed;
151 88 u_int32_t bi_busspeed;
152 92 u_int32_t bi_clocktps;
153 #endif
154 }
155
156
157 MACHINE_DEFAULT_CPU(mvmeppc)
158 {
159 switch (machine->machine_subtype) {
160
161 case MACHINE_MVMEPPC_1600:
162 /* Suitable for NetBSD/mvmeppc: */
163 machine->cpu_name = strdup("PPC603e");
164 break;
165
166 case MACHINE_MVMEPPC_2100:
167 machine->cpu_name = strdup("PPC603e");
168 break;
169
170 case MACHINE_MVMEPPC_5500:
171 machine->cpu_name = strdup("PPC750");
172 break;
173
174 default:fatal("Unimplemented MVMEPPC machine subtype %i\n",
175 machine->machine_subtype);
176 exit(1);
177 }
178 }
179
180
181 MACHINE_DEFAULT_RAM(mvmeppc)
182 {
183 machine->physical_ram_in_mb = 64;
184 }
185
186
187 MACHINE_REGISTER(mvmeppc)
188 {
189 MR_DEFAULT(mvmeppc, "MVME", ARCH_PPC, MACHINE_MVMEPPC);
190
191 machine_entry_add_alias(me, "mvmeppc");
192
193 machine_entry_add_subtype(me, "MVME1600", MACHINE_MVMEPPC_1600,
194 "mvme1600", NULL);
195
196 machine_entry_add_subtype(me, "MVME2100", MACHINE_MVMEPPC_2100,
197 "mvme2100", NULL);
198
199 machine_entry_add_subtype(me, "MVME5500", MACHINE_MVMEPPC_5500,
200 "mvme5500", NULL);
201
202 me->set_default_ram = machine_default_ram_mvmeppc;
203 }
204

  ViewVC Help
Powered by ViewVC 1.1.26