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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 40 - (hide annotations)
Mon Oct 8 16:22:11 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 5032 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.1539 2007/05/01 04:03:51 debug Exp $
20070415	Landisk PCLOCK should be 33.33 MHz, not 50 MHz. (This makes
		the clock run at correct speed.)
		FINALLY found and fixed the bug which caused OpenBSD/landisk
		to randomly bug out: an &-sign was missing in the special case
		handling of FPSCR in the 'LDS.L @Rm+,FPSCR' instruction.
		Adding similar special case handling for 'LDC.L @Rm+,SR'
		(calling sh_update_sr() instead of just loading).
		Implementing the 'FCNVSD FPUL,DRn' and 'FCNVDS DRm,FPUL'
		SuperH instructions.
		The 'LDC Rm,SR' instruction now immediately breaks out of the
		dyntrans loop if an interrupt is to be triggered.
20070416	In memory_rw.c, if mapping a page as writable, make sure to
		invalidate code translations even if the data access was a
		read.
		Minor SuperH updates.
20070418	Removing the dummy M68K emulation mode.
		Minor SH update (turning unnecessary sts_mach_rn, sts_macl_rn,
		and sts_pr_rn instruction handlers into mov_rm_rn).
20070419	Beginning to add a skeleton for an M88K mode: Adding a hack to
		allow OpenBSD/m88k a.out binaries to be loaded, and disassembly
		of a few simple 88K instructions.
		Commenting out the 'LDC Rm,SR' fix from a few days ago, because
		it made Linux/dreamcast bug out.
		Adding a hack to dev_sh4.c (an extra translation cache
		invalidation), which allows OpenBSD/landisk to boot ok after
		an install. Upgrading the Landisk machine mode to stable,
		updating documentation, etc.
20070420	Experimenting with adding a PCI controller (pcic) to dev_sh4.
		Adding a dummy Realtek 8139C+ skeleton device (dev_rtl8139c).
		Implementing the first M88K instructions (br, or[.u] imm), and
		adding disassembly of some more instructions.
20070421	Continuing a little on dev_rtl8139c.
20070422	Implementing the 9346 EEPROM "read" command for dev_rtl8139c.
		Finally found and fixed an old bug in the log n symbol search
		(it sometimes missed symbols). Debug trace (-i, -t etc) should
		now show more symbols. :-)
20070423	Continuing a little on M88K disassembly.
20070428	Fixing a memset arg order bug in src/net/net.c (thanks to
		Nigel Horne for noticing the bug).
		Applying parts of a patch from Carl van Schaik to clear out
		bottom bits of MIPS addresses more correctly, when using large
		page sizes, and doing some other minor cleanup/refactoring.
		Fixing a couple of warnings given by gcc with the -W option (a
		few more warnings than just plain -Wall).
		Reducing SuperH dyntrans physical address space from 64-bit to
		32-bit (since SH5/SH64 isn't imlemented yet anyway).
		Adding address-to-symbol annotation to a few more instructions
		in the SuperH instruction trace output.
		Beginning regression testing for the next release.
		Reverting the value of SCIF_DELAYED_TX_VALUE from 1 to 2,
		because OpenBSD/landisk may otherwise hang randomly.
20070429	The ugly hack/workaround to get OpenBSD/landisk booting without
		crashing does NOT work anymore (with the April 21 snapshot
		of OpenBSD/landisk). Strangely enough, removing the hack
		completely causes OpenBSD/landisk to work (!).
		More regression testing (re-testing everything SuperH-related,
		and some other things).
		Cobalt interrupts were actually broken; fixing by commenting
		out the DEC21143s in the Cobalt machine.
20070430	More regression testing.
20070501	Updating the OpenBSD/landisk install instructions to use
		4.1 instead of the current snapshot.
		GAAAH! OpenBSD/landisk 4.1 _needs_ the ugly hack/workaround;
		reintroducing it again. (The 4.1 kernel is actually from
		2007-03-11.)
		Simplifying the NetBSD/evbarm install instructions a bit.
		More regression testing.

==============  RELEASE 0.4.5.1  ==============


1 dpavlin 22 /*
2 dpavlin 34 * Copyright (C) 2003-2007 Anders Gavare. All rights reserved.
3 dpavlin 22 *
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 40 * $Id: machine_cobalt.c,v 1.10 2007/04/29 13:44:14 debug Exp $
29 dpavlin 22 */
30    
31     #include <stdio.h>
32 dpavlin 34 #include <stdlib.h>
33 dpavlin 22 #include <string.h>
34    
35 dpavlin 34 #include "bus_isa.h"
36 dpavlin 22 #include "bus_pci.h"
37     #include "cpu.h"
38     #include "device.h"
39     #include "devices.h"
40     #include "machine.h"
41     #include "memory.h"
42     #include "misc.h"
43    
44    
45     MACHINE_SETUP(cobalt)
46     {
47 dpavlin 34 char tmpstr[500], tmpstr2[500];
48 dpavlin 22 struct pci_data *pci_data;
49     struct memory *mem = machine->memory;
50    
51     cpu->byte_order = EMUL_LITTLE_ENDIAN;
52     machine->machine_name = "Cobalt";
53     machine->stable = 1;
54    
55     /*
56     * Interrupts seem to be the following:
57     * (according to http://www.funet.fi/pub/Linux/PEOPLE/Linus/v2.4/
58     * patch-html/patch-2.4.19/linux-2.4.19_arch_mips_cobalt_irq.c.html)
59     *
60     * 2 Galileo chip (timer)
61     * 3 Tulip 0 + NCR SCSI
62     * 4 Tulip 1
63     * 5 16550 UART (serial console)
64     * 6 VIA southbridge PIC
65     * 7 PCI (Note: Not used. The PCI controller
66     * interrupts at ISA interrupt 9.)
67     */
68    
69 dpavlin 34 /* ISA bus at MIPS irq 6: */
70     snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].6",
71     machine->path, machine->bootstrap_cpu);
72     bus_isa_init(machine, tmpstr, 0, 0x10000000, 0x14000000 /* TODO */);
73 dpavlin 22
74 dpavlin 34 snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%s.cpu[%i].5"
75     " addr=0x1c800000 name2=tty0 in_use=1",
76     machine->path, machine->bootstrap_cpu);
77     machine->main_console_handle = (size_t) device_add(machine, tmpstr);
78 dpavlin 22
79    
80     /*
81     * According to NetBSD/cobalt:
82     *
83     * pchb0 at pci0 dev 0 function 0: Galileo GT-64111 System Controller,
84     * rev 1 (NOTE: added by dev_gt_init())
85     * tlp0 at pci0 dev 7 function 0: DECchip 21143 Ethernet, pass 4.1
86     * Symbios Logic 53c860 (SCSI mass storage, revision 0x02) at pci0
87     * dev 8
88     * pcib0 at pci0 dev 9 function 0, VIA Technologies VT82C586 (Apollo
89     * VP) PCI-ISA Bridge, rev 37
90     * pciide0 at pci0 dev 9 function 1: VIA Technologies VT82C586 (Apollo
91     * VP) ATA33 cr
92     * tlp1 at pci0 dev 12 function 0: DECchip 21143 Ethernet, pass 4.1
93     *
94 dpavlin 34 * The PCI controller interrupts at ISA interrupt 9. (TODO?)
95 dpavlin 22 */
96 dpavlin 34 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2",
97     machine->path, machine->bootstrap_cpu);
98     snprintf(tmpstr2, sizeof(tmpstr2), "%s.cpu[%i].6",
99     machine->path, machine->bootstrap_cpu);
100     pci_data = dev_gt_init(machine, mem, 0x14000000, tmpstr,
101     tmpstr2, 11);
102 dpavlin 40 /* bus_pci_add(machine, pci_data, mem, 0, 7, 0, "dec21143"); */
103 dpavlin 22 /* bus_pci_add(machine, pci_data, mem, 0, 8, 0, "symbios_860");
104     PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_860 */
105     bus_pci_add(machine, pci_data, mem, 0, 9, 0, "vt82c586_isa");
106     bus_pci_add(machine, pci_data, mem, 0, 9, 1, "vt82c586_ide");
107 dpavlin 40 /* bus_pci_add(machine, pci_data, mem, 0, 12, 0, "dec21143"); */
108 dpavlin 22
109     if (!machine->prom_emulation)
110     return;
111    
112    
113     /*
114     * NetBSD/cobalt expects memsize in a0, but it seems that what
115     * it really wants is the end of memory + 0x80000000.
116     *
117     * The bootstring is stored 512 bytes before the end of
118     * physical ram.
119     */
120     cpu->cd.mips.gpr[MIPS_GPR_A0] =
121     machine->physical_ram_in_mb * 1048576 + 0xffffffff80000000ULL;
122     machine->bootstr = "root=/dev/hda1 ro";
123     /* bootstr = "nfsroot=/usr/cobalt/"; */
124     /* TODO: bootarg, and/or automagic boot device detection */
125     store_string(cpu, cpu->cd.mips.gpr[MIPS_GPR_A0] - 512,
126     machine->bootstr);
127     }
128    
129    
130     MACHINE_DEFAULT_CPU(cobalt)
131     {
132     machine->cpu_name = strdup("RM5200");
133     }
134    
135    
136 dpavlin 30 MACHINE_DEFAULT_RAM(cobalt)
137     {
138     machine->physical_ram_in_mb = 64;
139     }
140    
141    
142 dpavlin 22 MACHINE_REGISTER(cobalt)
143     {
144 dpavlin 26 MR_DEFAULT(cobalt, "Cobalt", ARCH_MIPS, MACHINE_COBALT);
145    
146     machine_entry_add_alias(me, "cobalt");
147 dpavlin 22 }
148    

  ViewVC Help
Powered by ViewVC 1.1.26