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

Annotation of /trunk/src/machines/machine_prep.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 26 - (hide annotations)
Mon Oct 8 16:20:10 2007 UTC (16 years, 7 months ago) by dpavlin
File MIME type: text/plain
File size: 5888 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 dpavlin 22 /*
2     * Copyright (C) 2005-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 dpavlin 26 * $Id: machine_prep.c,v 1.8 2006/06/24 11:03:20 debug Exp $
29 dpavlin 22 *
30     * Machines conforming to the PowerPC Reference Platform specs.
31     */
32    
33     #include <stdio.h>
34     #include <stdlib.h>
35     #include <string.h>
36    
37     #include "bus_isa.h"
38     #include "bus_pci.h"
39     #include "cpu.h"
40     #include "device.h"
41     #include "devices.h"
42     #include "machine.h"
43     #include "machine_interrupts.h"
44     #include "memory.h"
45     #include "misc.h"
46    
47    
48    
49     MACHINE_SETUP(prep)
50     {
51     struct pci_data *pci_data;
52     char *model_name = "";
53    
54     switch (machine->machine_subtype) {
55    
56     case MACHINE_PREP_IBM6050:
57     machine->machine_name =
58     "PowerPC Reference Platform, IBM 6050/6070";
59     machine->stable = 1;
60     model_name = "IBM PPS Model 6050/6070 (E)";
61    
62     if (machine->emulated_hz == 0)
63     machine->emulated_hz = 20000000;
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_IDE0 | BUS_ISA_IDE1,
73     0x80000000, 0xc0000000, 32, 48);
74    
75     bus_pci_add(machine, pci_data, machine->memory,
76     0, 13, 0, "dec21143");
77    
78     if (machine->use_x11) {
79     bus_pci_add(machine, pci_data, machine->memory,
80     0, 14, 0, "s3_virge");
81     }
82     break;
83    
84     case MACHINE_PREP_MVME2400:
85     machine->machine_name = "PowerPC Reference Platform, MVME2400";
86    
87     /* TODO: _EXACT_ model name for mvme2400? */
88     model_name = "MOT MVME2400";
89    
90     machine->md_int.prep_data = device_add(machine, "prep");
91     machine->isa_pic_data.native_irq = 1; /* Semi-bogus */
92     machine->md_interrupt = isa32_interrupt;
93    
94     pci_data = dev_eagle_init(machine, machine->memory,
95     32 /* isa irq base */, 0 /* pci irq: TODO */);
96    
97     bus_isa_init(machine, BUS_ISA_IDE0 | BUS_ISA_IDE1,
98     0x80000000, 0xc0000000, 32, 48);
99    
100     break;
101    
102     default:fatal("Unimplemented PReP machine subtype %i\n",
103     machine->machine_subtype);
104     exit(1);
105     }
106    
107     if (!machine->prom_emulation)
108     return;
109    
110    
111     /* Linux on PReP has 0xdeadc0de at address 0? (See
112     http://joshua.raleigh.nc.us/docs/linux-2.4.10_html/
113     113568.html) */
114     store_32bit_word(cpu, 0, 0xdeadc0de);
115    
116     /*
117     * r4 should point to first free byte after the loaded kernel.
118     * r6 should point to bootinfo.
119     */
120     cpu->cd.ppc.gpr[4] = 6 * 1048576;
121     cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb*1048576-0x8000;
122    
123     /*
124     * (See NetBSD's prep/include/bootinfo.h for details.)
125     *
126     * 32-bit "next" offset;
127     * 32-bit "type";
128     * type-specific data...
129     */
130    
131     /* type: clock */
132     store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+ 0, 12);
133     store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+ 4, 2);
134     store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+ 8, machine->emulated_hz);
135    
136     /* type: console */
137     store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+12, 20);
138     store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+16, 1);
139     store_buf(cpu, cpu->cd.ppc.gpr[6]+20, machine->use_x11? "vga":"com", 4);
140     store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+24, 0x3f8);/* addr */
141     store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+28, 9600);/* speed */
142    
143     /* type: residual */
144     store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+32, 0);
145     store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+36, 0);
146     store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+40,/* addr of data */
147     cpu->cd.ppc.gpr[6] + 0x100);
148    
149     /* Residual data: (TODO) */
150     store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+0x100, 0x200);
151     store_string(cpu, cpu->cd.ppc.gpr[6]+0x100+0x8, model_name);
152     store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+0x100+0x1f8,
153     machine->physical_ram_in_mb * 1048576); /* memsize */
154     }
155    
156    
157     MACHINE_DEFAULT_CPU(prep)
158     {
159     switch (machine->machine_subtype) {
160    
161     case MACHINE_PREP_IBM6050:
162     machine->cpu_name = strdup("PPC604");
163     break;
164    
165     case MACHINE_PREP_MVME2400:
166     machine->cpu_name = strdup("PPC750");
167     break;
168    
169     default:fatal("Unimplemented PReP machine subtype %i\n",
170     machine->machine_subtype);
171     exit(1);
172     }
173     }
174    
175    
176     MACHINE_DEFAULT_RAM(prep)
177     {
178     machine->physical_ram_in_mb = 64;
179     }
180    
181    
182     MACHINE_REGISTER(prep)
183     {
184 dpavlin 26 MR_DEFAULT(prep, "PowerPC Reference Platform", ARCH_PPC, MACHINE_PREP);
185 dpavlin 22
186 dpavlin 26 machine_entry_add_alias(me, "prep");
187     me->set_default_ram = machine_default_ram_prep;
188 dpavlin 22
189 dpavlin 26 machine_entry_add_subtype(me, "IBM 6050/6070", MACHINE_PREP_IBM6050,
190     "ibm6050", "ibm6070", NULL);
191 dpavlin 22
192 dpavlin 26 machine_entry_add_subtype(me, "MVME2400", MACHINE_PREP_MVME2400,
193     "mvme2400", NULL);
194 dpavlin 22 }
195    

  ViewVC Help
Powered by ViewVC 1.1.26