machine_cobalt.cc Source File

Back to the index.

machine_cobalt.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003-2009 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  * COMMENT: Cobalt (MIPS-based)
29  */
30 
31 #include <stdio.h>
32 #include <stdlib.h>
33 #include <string.h>
34 
35 #include "bus_isa.h"
36 #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 
46 {
47  char tmpstr[500], tmpstr2[500];
48  struct pci_data *pci_data;
49  struct memory *mem = machine->memory;
50 
52  machine->machine_name = strdup("Cobalt");
53 
54  /*
55  * Interrupts seem to be the following:
56  * (according to http://www.funet.fi/pub/Linux/PEOPLE/Linus/v2.4/
57  * patch-html/patch-2.4.19/linux-2.4.19_arch_mips_cobalt_irq.c.html)
58  *
59  * 2 Galileo chip (timer)
60  * 3 Tulip 0 + NCR SCSI
61  * 4 Tulip 1
62  * 5 16550 UART (serial console)
63  * 6 VIA southbridge PIC
64  * 7 PCI (Note: Not used. The PCI controller
65  * interrupts at ISA interrupt 9.)
66  */
67 
68  /* ISA bus at MIPS irq 6: */
69  snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].6",
71  bus_isa_init(machine, tmpstr, 0, 0x10000000, 0x14000000 /* TODO */);
72 
73  snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%s.cpu[%i].5"
74  " addr=0x1c800000 name2=tty0 in_use=1",
76  machine->main_console_handle = (size_t) device_add(machine, tmpstr);
77 
78 
79  /*
80  * According to NetBSD/cobalt:
81  *
82  * pchb0 at pci0 dev 0 function 0: Galileo GT-64111 System Controller,
83  * rev 1 (NOTE: added by dev_gt_init())
84  * tlp0 at pci0 dev 7 function 0: DECchip 21143 Ethernet, pass 4.1
85  * Symbios Logic 53c860 (SCSI mass storage, revision 0x02) at pci0
86  * dev 8
87  * pcib0 at pci0 dev 9 function 0, VIA Technologies VT82C586 (Apollo
88  * VP) PCI-ISA Bridge, rev 37
89  * pciide0 at pci0 dev 9 function 1: VIA Technologies VT82C586 (Apollo
90  * VP) ATA33 cr
91  * tlp1 at pci0 dev 12 function 0: DECchip 21143 Ethernet, pass 4.1
92  *
93  * The PCI controller interrupts at ISA interrupt 9. (TODO?)
94  */
95  snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2",
97  snprintf(tmpstr2, sizeof(tmpstr2), "%s.cpu[%i].6",
99  pci_data = dev_gt_init(machine, mem, 0x14000000, tmpstr,
100  tmpstr2, 11);
101  /* bus_pci_add(machine, pci_data, mem, 0, 7, 0, "dec21143"); */
102  /* bus_pci_add(machine, pci_data, mem, 0, 8, 0, "symbios_860");
103  PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_860 */
104  bus_pci_add(machine, pci_data, mem, 0, 9, 0, "vt82c586_isa");
105  bus_pci_add(machine, pci_data, mem, 0, 9, 1, "vt82c586_ide");
106  /* bus_pci_add(machine, pci_data, mem, 0, 12, 0, "dec21143"); */
107 
108  if (!machine->prom_emulation)
109  return;
110 
111 
112  /*
113  * NetBSD/cobalt expects memsize in a0, but it seems that what
114  * it really wants is the end of memory + 0x80000000.
115  *
116  * The bootstring is stored 512 bytes before the end of
117  * physical ram.
118  */
120  machine->physical_ram_in_mb * 1048576 + 0xffffffff80000000ULL;
121  machine->bootstr = strdup("root=/dev/hda1 ro");
122  /* bootstr = "nfsroot=/usr/cobalt/"; */
123  /* TODO: bootarg, and/or automagic boot device detection */
125  machine->bootstr);
126 }
127 
128 
130 {
131  machine->cpu_name = strdup("RM5200");
132 }
133 
134 
136 {
138 }
139 
140 
142 {
143  MR_DEFAULT(cobalt, "Cobalt", ARCH_MIPS, MACHINE_COBALT);
144 
145  machine_entry_add_alias(me, "cobalt");
146 }
147 
MACHINE_COBALT
#define MACHINE_COBALT
Definition: machine.h:214
MIPS_GPR_A0
#define MIPS_GPR_A0
Definition: cpu_mips.h:138
machine::bootstrap_cpu
int bootstrap_cpu
Definition: machine.h:136
memory
Definition: memory.h:75
bus_isa.h
MACHINE_DEFAULT_CPU
MACHINE_DEFAULT_CPU(cobalt)
Definition: machine_cobalt.cc:129
MACHINE_SETUP
MACHINE_SETUP(cobalt)
Definition: machine_cobalt.cc:45
cpu::byte_order
uint8_t byte_order
Definition: cpu.h:347
machine::prom_emulation
int prom_emulation
Definition: machine.h:149
cpu::mips
struct mips_cpu mips
Definition: cpu.h:446
device.h
dev_gt_init
struct pci_data * dev_gt_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, const char *timer_irq_path, const char *isa_irq_path, int type)
Definition: dev_gt.cc:225
ARCH_MIPS
#define ARCH_MIPS
Definition: machine.h:203
machine::cpu_name
char * cpu_name
Definition: machine.h:133
misc.h
cpu::cd
union cpu::@1 cd
device_add
void * device_add(struct machine *machine, const char *name_and_params)
Definition: device.cc:252
machine.h
machine
Definition: machine.h:97
machine::main_console_handle
int main_console_handle
Definition: machine.h:128
MR_DEFAULT
#define MR_DEFAULT(x, name, arch, type)
Definition: machine.h:373
store_string
void store_string(struct cpu *cpu, uint64_t addr, const char *s)
Definition: memory.cc:695
cpu.h
machine::path
char * path
Definition: machine.h:108
MACHINE_DEFAULT_RAM
MACHINE_DEFAULT_RAM(cobalt)
Definition: machine_cobalt.cc:135
machine::memory
struct memory * memory
Definition: machine.h:126
bus_pci.h
bus_isa_init
struct bus_isa_data * bus_isa_init(struct machine *machine, char *interrupt_base_path, uint32_t bus_isa_flags, uint64_t isa_portbase, uint64_t isa_membase)
Definition: bus_isa.cc:174
machine::physical_ram_in_mb
uint32_t physical_ram_in_mb
Definition: machine.h:147
EMUL_LITTLE_ENDIAN
#define EMUL_LITTLE_ENDIAN
Definition: misc.h:164
mips_cpu::gpr
uint64_t gpr[N_MIPS_GPRS]
Definition: cpu_mips.h:209
machine::bootstr
char * bootstr
Definition: machine.h:155
MACHINE_REGISTER
MACHINE_REGISTER(cobalt)
Definition: machine_cobalt.cc:141
devices.h
machine::machine_name
const char * machine_name
Definition: machine.h:115
cpu
Definition: cpu.h:326
machine_entry_add_alias
void machine_entry_add_alias(struct machine_entry *me, const char *name)
Definition: machine.cc:697
bus_pci_add
void bus_pci_add(struct machine *machine, struct pci_data *pci_data, struct memory *mem, int bus, int device, int function, const char *name)
Definition: bus_pci.cc:216
memory.h

Generated on Tue Aug 25 2020 19:25:06 for GXemul by doxygen 1.8.18