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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 26 - (hide annotations)
Mon Oct 8 16:20:10 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 5359 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_cats.c,v 1.5 2006/06/24 10:19:19 debug Exp $
29 dpavlin 22 */
30    
31     #include <stdio.h>
32     #include <string.h>
33    
34     #include "bus_isa.h"
35     #include "bus_pci.h"
36     #include "cpu.h"
37     #include "device.h"
38     #include "devices.h"
39     #include "machine.h"
40     #include "machine_interrupts.h"
41     #include "memory.h"
42     #include "misc.h"
43    
44     #include "cyclone_boot.h"
45    
46    
47     MACHINE_SETUP(cats)
48     {
49     struct ebsaboot ebsaboot;
50     char bs[300];
51     int boot_id = machine->bootdev_id >= 0? machine->bootdev_id : 0;
52    
53     machine->machine_name = "CATS evaluation board";
54     machine->stable = 1;
55    
56     if (machine->emulated_hz == 0)
57     machine->emulated_hz = 50000000;
58    
59     if (machine->physical_ram_in_mb > 256)
60     fprintf(stderr, "WARNING! Real CATS machines cannot"
61     " have more than 256 MB RAM. Continuing anyway.\n");
62    
63     machine->md_int.footbridge_data =
64     device_add(machine, "footbridge addr=0x42000000");
65     machine->md_interrupt = isa32_interrupt;
66     machine->isa_pic_data.native_irq = 10;
67    
68     /* DC21285_ROM_BASE (256 KB at 0x41000000) */
69     dev_ram_init(machine, 0x41000000, 256 * 1024, DEV_RAM_RAM, 0);
70    
71     /* NetBSD, OpenBSD, and Linux (?) clean their caches here: */
72     dev_ram_init(machine, 0x50000000, 0x10000, DEV_RAM_RAM, 0);
73    
74     /* Interrupt ack space? */
75     dev_ram_init(machine, 0x80000000, 0x1000, DEV_RAM_RAM, 0);
76    
77     /* Linux uses 0xc0000000 as phys.: */
78     dev_ram_init(machine, 0xc0000000, 0x20000000, DEV_RAM_MIRROR, 0x0);
79    
80     /* OpenBSD reboot needs 0xf??????? to be mapped to phys.: */
81     dev_ram_init(machine, 0xf0000000, 0x1000000, DEV_RAM_MIRROR, 0x0);
82    
83     bus_isa_init(machine, BUS_ISA_PCKBC_FORCE_USE |
84     BUS_ISA_PCKBC_NONPCSTYLE, 0x7c000000, 0x80000000, 32, 48);
85    
86     bus_pci_add(machine, machine->md_int.footbridge_data->pcibus,
87     machine->memory, 0xc0, 8, 0, "s3_virge");
88    
89     if (!machine->prom_emulation)
90     return;
91    
92     /* See cyclone_boot.h for details. */
93    
94     /* DC21285_ROM_BASE "reboot" code: (works with NetBSD) */
95     store_32bit_word(cpu, 0x41000008ULL, 0xef8c64ebUL);
96    
97     cpu->cd.arm.r[0] = /* machine->physical_ram_in_mb */
98     7 * 1048576 - 0x1000;
99    
100     memset(&ebsaboot, 0, sizeof(struct ebsaboot));
101     store_32bit_word_in_host(cpu, (unsigned char *)
102     &(ebsaboot.bt_magic), BT_MAGIC_NUMBER_CATS);
103     store_32bit_word_in_host(cpu, (unsigned char *)
104     &(ebsaboot.bt_vargp), 0);
105     store_32bit_word_in_host(cpu, (unsigned char *)
106     &(ebsaboot.bt_pargp), 0);
107     store_32bit_word_in_host(cpu, (unsigned char *)
108     &(ebsaboot.bt_args), cpu->cd.arm.r[0]
109     + sizeof(struct ebsaboot));
110     store_32bit_word_in_host(cpu, (unsigned char *)
111     &(ebsaboot.bt_l1), 7 * 1048576 - 32768);
112     store_32bit_word_in_host(cpu, (unsigned char *)
113     &(ebsaboot.bt_memstart), 0);
114     store_32bit_word_in_host(cpu, (unsigned char *)
115     &(ebsaboot.bt_memend),
116     machine->physical_ram_in_mb * 1048576);
117     store_32bit_word_in_host(cpu, (unsigned char *)
118     &(ebsaboot.bt_memavail), 7 * 1048576);
119     store_32bit_word_in_host(cpu, (unsigned char *)
120     &(ebsaboot.bt_fclk), 50 * 1000000);
121     store_32bit_word_in_host(cpu, (unsigned char *)
122     &(ebsaboot.bt_pciclk), 66 * 1000000);
123     /* TODO: bt_vers */
124     /* TODO: bt_features */
125    
126     store_buf(cpu, cpu->cd.arm.r[0],
127     (char *)&ebsaboot, sizeof(struct ebsaboot));
128    
129     snprintf(bs, sizeof(bs), "(hd%i)%s root=/dev/wd%i%s%s",
130     boot_id, machine->boot_kernel_filename, boot_id,
131     (machine->boot_string_argument[0])? " " : "",
132     machine->boot_string_argument);
133    
134     store_string(cpu, cpu->cd.arm.r[0]+sizeof(struct ebsaboot), bs);
135    
136     arm_setup_initial_translation_table(cpu, 7 * 1048576 - 32768);
137     }
138    
139    
140     MACHINE_DEFAULT_CPU(cats)
141     {
142     machine->cpu_name = strdup("SA110");
143     }
144    
145    
146     MACHINE_DEFAULT_RAM(cats)
147     {
148     machine->physical_ram_in_mb = 64;
149     }
150    
151    
152     MACHINE_REGISTER(cats)
153     {
154     MR_DEFAULT(cats, "CATS evaluation board", ARCH_ARM,
155 dpavlin 26 MACHINE_CATS);
156    
157     machine_entry_add_alias(me, "cats");
158    
159 dpavlin 22 me->set_default_ram = machine_default_ram_cats;
160     }
161    

  ViewVC Help
Powered by ViewVC 1.1.26