/[gxemul]/trunk/src/machines/machine_bebox.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_bebox.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: 4338 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_bebox.c,v 1.3 2006/06/24 10:19:19 debug Exp $
29 dpavlin 24 *
30     * Experimental machine for running NetBSD/bebox (see
31     * http://www.netbsd.org/Ports/bebox/ for more info.)
32 dpavlin 22 */
33    
34     #include <stdio.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     MACHINE_SETUP(bebox)
49     {
50     struct pci_data *pci_data;
51    
52     machine->machine_name = "BeBox";
53    
54     machine->md_int.bebox_data = device_add(machine, "bebox");
55     machine->isa_pic_data.native_irq = 5;
56     machine->md_interrupt = isa32_interrupt;
57    
58     pci_data = dev_eagle_init(machine, machine->memory,
59     32 /* isa irq base */, 0 /* pci irq: TODO */);
60    
61     bus_isa_init(machine, BUS_ISA_IDE0 | BUS_ISA_VGA,
62     0x80000000, 0xc0000000, 32, 48);
63    
64     if (!machine->prom_emulation)
65     return;
66    
67     /* According to the docs, and also used by NetBSD: */
68     store_32bit_word(cpu, 0x3010, machine->physical_ram_in_mb * 1048576);
69    
70     /* Used by Linux: */
71     store_32bit_word(cpu, 0x32f8, machine->physical_ram_in_mb * 1048576);
72    
73     /* TODO: List of stuff, see http://www.beatjapan.org/
74     mirror/www.be.com/aboutbe/benewsletter/
75     Issue27.html#Cookbook for the details. */
76     store_32bit_word(cpu, 0x301c, 0);
77    
78     /* NetBSD/bebox: r3 = startkernel, r4 = endkernel,
79     r5 = args, r6 = ptr to bootinfo? */
80     cpu->cd.ppc.gpr[3] = 0x3100;
81     cpu->cd.ppc.gpr[4] = 0x400000;
82     cpu->cd.ppc.gpr[5] = 0x2000;
83     store_string(cpu, cpu->cd.ppc.gpr[5], "-a");
84     cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 - 0x100;
85    
86     /* See NetBSD's bebox/include/bootinfo.h for details */
87     store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 0, 12); /* next */
88     store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 4, 0); /* mem */
89     store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 8,
90     machine->physical_ram_in_mb * 1048576);
91    
92     store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 12, 20); /* next */
93     store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 16, 1); /* console */
94     store_buf(cpu, cpu->cd.ppc.gpr[6] + 20,
95     machine->use_x11? "vga" : "com", 4);
96     store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 24, 0x3f8);/* addr */
97     store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 28, 9600);/* speed */
98    
99     store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 32, 0); /* next */
100     store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 36, 2); /* clock */
101     store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 40, 100);
102     }
103    
104    
105     MACHINE_DEFAULT_CPU(bebox)
106     {
107     /* For NetBSD/bebox. Dual 133 MHz 603e CPUs, for example. */
108     machine->cpu_name = strdup("PPC603e");
109     }
110    
111    
112     MACHINE_DEFAULT_RAM(bebox)
113     {
114     machine->physical_ram_in_mb = 64;
115     }
116    
117    
118     MACHINE_REGISTER(bebox)
119     {
120 dpavlin 26 MR_DEFAULT(bebox, "BeBox", ARCH_PPC, MACHINE_BEBOX);
121    
122     machine_entry_add_alias(me, "bebox");
123    
124 dpavlin 22 me->set_default_ram = machine_default_ram_bebox;
125     }
126    

  ViewVC Help
Powered by ViewVC 1.1.26