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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 24 - (hide annotations)
Mon Oct 8 16:19:56 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 14378 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.1256 2006/06/23 20:43:44 debug Exp $
20060219	Various minor updates. Removing the old MIPS16 skeleton code,
		because it will need to be rewritten for dyntrans anyway.
20060220-22	Removing the non-working dyntrans backend support.
		Continuing on the 64-bit dyntrans virtual memory generalization.
20060223	More work on the 64-bit vm generalization.
20060225	Beginning on MIPS dyntrans load/store instructions.
		Minor PPC updates (64-bit load/store, etc).
		Fixes for the variable-instruction-length framework, some
		minor AVR updates (a simple Hello World program works!).
		Beginning on a skeleton for automatically generating documen-
		tation (for devices etc.).
20060226	PPC updates (adding some more 64-bit instructions, etc).
		AVR updates (more instructions).
		FINALLY found and fixed the zs bug, making NetBSD/macppc
		accept the serial console.
20060301	Adding more AVR instructions.
20060304	Continuing on AVR-related stuff. Beginning on a framework for
		cycle-accurate device emulation. Adding an experimental "PAL
		TV" device (just a dummy so far).
20060305	Adding more AVR instructions.
		Adding a dummy epcom serial controller (for TS7200 emulation).
20060310	Removing the emul() command from configuration files, so only
		net() and machine() are supported.
		Minor progress on the MIPS dyntrans rewrite.
20060311	Continuing on the MIPS dyntrans rewrite (adding more
		instructions, etc).
20060315	Adding more instructions (sllv, srav, srlv, bgtz[l], blez[l],
		beql, bnel, slti[u], various loads and stores).
20060316	Removing the ALWAYS_SIGNEXTEND_32 option, since it was rarely
		used.
		Adding more MIPS dyntrans instructions, and fixing bugs.
20060318	Implementing fast loads/stores for MIPS dyntrans (big/little
		endian, 32-bit and 64-bit modes).
20060320	Making MIPS dyntrans the default configure option; use
		"--enable-oldmips" to use the old bintrans system.
		Adding MIPS dyntrans dmult[u]; minor updates.
20060322	Continuing... adding some more instructions.
		Adding a simple skeleton for demangling C++ "_ZN" symbols.
20060323	Moving src/debugger.c into a new directory (src/debugger/).
20060324	Fixing the hack used to load PPC ELFs (useful for relocated
		Linux/ppc kernels), and adding a dummy G3 machine mode.
20060325-26	Beginning to experiment with GDB remote serial protocol
		connections; adding a -G command line option for selecting
		which TCP port to listen to.
20060330	Beginning a major cleanup to replace things like "0x%016llx"
		with more correct "0x%016"PRIx64, etc.
		Continuing on the GDB remote serial protocol support.
20060331	More cleanup, and some minor GDB remote progress.
20060402	Adding a hack to the configure script, to allow compilation
		on systems that lack PRIx64 etc.
20060406	Removing the temporary FreeBSD/arm hack in dev_ns16550.c and
		replacing it with a better fix from Olivier Houchard.
20060407	A remote debugger (gdb or ddd) can now start and stop the
		emulator using the GDB remote serial protocol, and registers
		and memory can be read. MIPS only for now.
20060408	More GDB progress: single-stepping also works, and also adding
		support for ARM, PowerPC, and Alpha targets.
		Continuing on the delay-slot-across-page-boundary issue.
20060412	Minor update: beginning to add support for the SPARC target
		to the remote GDB functionality.
20060414	Various MIPS updates: adding more instructions for dyntrans
		(eret, add), and making some exceptions work. Fixing a bug
		in dmult[u].
		Implementing the first SPARC instructions (sethi, or).
20060415	Adding "magic trap" instructions so that PROM calls can be
		software emulated in MIPS dyntrans.
		Adding more MIPS dyntrans instructions (ddiv, dadd) and
		fixing another bug in dmult.
20060416	More MIPS dyntrans progress: adding [d]addi, movn, movz, dsllv,
		rfi, an ugly hack for supporting R2000/R3000 style faked caches,
		preliminary interrupt support, and various other updates and
		bugfixes.
20060417	Adding more SPARC instructions (add, sub, sll[x], sra[x],
		srl[x]), and useful SPARC header definitions.
		Adding the first (trivial) x86/AMD64 dyntrans instructions (nop,
		cli/sti, stc/clc, std/cld, simple mov, inc ax). Various other
		x86 updates related to variable instruction length stuff.
		Adding unaligned loads/stores to the MIPS dyntrans mode (but
		still using the pre-dyntrans (slow) imlementation).
20060419	Fixing a MIPS dyntrans exception-in-delay-slot bug.
		Removing the old "show opcode statistics" functionality, since
		it wasn't really useful and isn't implemented for dyntrans.
		Single-stepping (or running with instruction trace) now looks
		ok with dyntrans with delay-slot architectures.
20060420	Minor hacks (removing the -B command line option when compiled
		for non-bintrans, and some other very minor updates).
		Adding (slow) MIPS dyntrans load-linked/store-conditional.
20060422	Applying fixes for bugs discovered by Nils Weller's nwcc
		(static DEC memmap => now per machine, and adding an extern
		keyword in cpu_arm_instr.c).
		Finally found one of the MIPS dyntrans bugs that I've been
		looking for (copy/paste spelling error BIG vs LITTLE endian in
		cpu_mips_instr_loadstore.c for 16-bit fast stores).
		FINALLY found the major MIPS dyntrans bug: slti vs sltiu
		signed/unsigned code in cpu_mips_instr.c. :-)
		Adding more MIPS dyntrans instructions (lwc1, swc1, bgezal[l],
		ctc1, tlt[u], tge[u], tne, beginning on rdhwr).
		NetBSD/hpcmips can now reach userland when using dyntrans :-)
		Adding some more x86 dyntrans instructions.
		Finally removed the old Alpha-specific virtual memory code,
		and replaced it with the generic 64-bit version.
		Beginning to add disassembly support for SPECIAL3 MIPS opcodes.
20060423	Continuing on the delay-slot-across-page-boundary issue;
		adding an end_of_page2 ic slot (like I had planned before, but
		had removed for some reason).
		Adding a quick-and-dirty fallback to legacy coprocessor 1
		code (i.e. skipping dyntrans implementation for now).
		NetBSD/hpcmips and NetBSD/pmax (when running on an emulated
		R4400) can now be installed and run. :-)  (Many bugs left
		to fix, though.)
		Adding more MIPS dyntrans instructions: madd[u], msub[u].
		Cleaning up the SPECIAL2 vs R5900/TX79/C790 "MMI" opcode
		maps somewhat (disassembly and dyntrans instruction decoding).
20060424	Adding an isa_revision field to mips_cpu_types.h, and making
		sure that SPECIAL3 opcodes cause Reserved Instruction
		exceptions on MIPS32/64 revisions lower than 2.
		Adding the SPARC 'ba', 'call', 'jmpl/retl', 'and', and 'xor'
		instructions.
20060425	Removing the -m command line option ("run at most x 
		instructions") and -T ("single_step_on_bad_addr"), because
		they never worked correctly with dyntrans anyway.
		Freshening up the man page.
20060428	Adding more MIPS dyntrans instructions: bltzal[l], idle.
		Enabling MIPS dyntrans compare interrupts.
20060429	FINALLY found the weird dyntrans bug, causing NetBSD etc. to
		behave strangely: some floating point code (conditional
		coprocessor branches) could not be reused from the old
		non-dyntrans code. The "quick-and-dirty fallback" only appeared
		to work. Fixing by implementing bc1* for MIPS dyntrans.
		More MIPS instructions: [d]sub, sdc1, ldc1, dmtc1, dmfc1, cfc0.
		Freshening up MIPS floating point disassembly appearance.
20060430	Continuing on C790/R5900/TX79 disassembly; implementing 128-bit
		"por" and "pextlw".
20060504	Disabling -u (userland emulation) unless compiled as unstable
		development version.
		Beginning on freshening up the testmachine include files,
		to make it easier to reuse those files (placing them in
		src/include/testmachine/), and beginning on a set of "demos"
		or "tutorials" for the testmachine functionality.
		Minor updates to the MIPS GDB remote protocol stub.
		Refreshing doc/experiments.html and gdb_remote.html.
		Enabling Alpha emulation in the stable release configuration,
		even though no guest OSes for Alpha can run yet.
20060505	Adding a generic 'settings' object, which will contain
		references to settable variables (which will later be possible
		to access using the debugger).
20060506	Updating dev_disk and corresponding demo/documentation (and
		switching from SCSI to IDE disk types, so it actually works
		with current test machines :-).
20060510	Adding a -D_LARGEFILE_SOURCE hack for 64-bit Linux hosts,
		so that fseeko() doesn't give a warning.
		Updating the section about how dyntrans works (the "runnable
		IR") in doc/intro.html.
		Instruction updates (some x64=1 checks, some more R5900
		dyntrans stuff: better mul/mult separation from MIPS32/64,
		adding ei and di).
		Updating MIPS cpuregs.h to a newer one (from NetBSD).
		Adding more MIPS dyntrans instructions: deret, ehb.
20060514	Adding disassembly and beginning implementation of SPARC wr
		and wrpr instructions.
20060515	Adding a SUN SPARC machine mode, with dummy SS20 and Ultra1
		machines. Adding the 32-bit "rd psr" instruction.
20060517	Disassembly support for the general SPARC rd instruction.
		Partial implementation of the cmp (subcc) instruction.
		Some other minor updates (making sure that R5900 processors
		start up with the EIE bit enabled, otherwise Linux/playstation2
		receives no interrupts).
20060519	Minor MIPS updates/cleanups.
20060521	Moving the MeshCube machine into evbmips; this seems to work
		reasonably well with a snapshot of a NetBSD MeshCube kernel.
		Cleanup/fix of MIPS config0 register initialization.
20060529	Minor MIPS fixes, including a sign-extension fix to the
		unaligned load/store code, which makes NetBSD/pmax on R3000
		work better with dyntrans. (Ultrix and Linux/DECstation still
		don't work, though.)
20060530	Minor updates to the Alpha machine mode: adding an AlphaBook
		mode, an LCA bus (forwarding accesses to an ISA bus), etc.
20060531	Applying a bugfix for the MIPS dyntrans sc[d] instruction from
		Ondrej Palkovsky. (Many thanks.)
20060601	Minifix to allow ARM immediate msr instruction to not give
		an error for some valid values.
		More Alpha updates.
20060602	Some minor Alpha updates.
20060603	Adding the Alpha cmpbge instruction. NetBSD/alpha prints its
		first boot messages :-) on an emulated Alphabook 1.
20060612	Minor updates; adding a dev_ether.h include file for the
		testmachine ether device. Continuing the hunt for the dyntrans
		bug which makes Linux and Ultrix on DECstation behave
		strangely... FINALLY found it! It seems to be related to
		invalidation of the translation cache, on tlbw{r,i}. There
		also seems to be some remaining interrupt-related problems.
20060614	Correcting the implementation of ldc1/sdc1 for MIPS dyntrans
		(so that it uses 16 32-bit registers if the FR bit in the
		status register is not set).
20060616	REMOVING BINTRANS COMPLETELY!
		Removing the old MIPS interpretation mode.
		Removing the MFHILO_DELAY and instruction delay stuff, because
		they wouldn't work with dyntrans anyway.
20060617	Some documentation updates (adding "NetBSD-archive" to some
		URLs, and new Debian/DECstation installation screenshots).
		Removing the "tracenull" and "enable-caches" configure options.
		Improving MIPS dyntrans performance somewhat (only invalidate
		translations if necessary, on writes to the entryhi register,
		instead of doing it for all cop0 writes).
20060618	More cleanup after the removal of the old MIPS emulation.
		Trying to fix the MIPS dyntrans performance bugs/bottlenecks;
		only semi-successful so far (for R3000).
20060620	Minor update to allow clean compilation again on Tru64/Alpha.
20060622	MIPS cleanup and fixes (removing the pc_last stuff, which
		doesn't make sense with dyntrans anyway, and fixing a cross-
		page-delay-slot-with-exception case in end_of_page).
		Removing the old max_random_cycles_per_chunk stuff, and the
		concept of cycles vs instructions for MIPS emulation.
		FINALLY found and fixed the bug which caused NetBSD/pmax
		clocks to behave strangely (it was a load to the zero register,
		which was treated as a NOP; now it is treated as a load to a
		dummy scratch register).
20060623	Increasing the dyntrans chunk size back to
		N_SAFE_DYNTRANS_LIMIT, instead of N_SAFE_DYNTRANS_LIMIT/2.
		Preparing for a quick release, even though there are known
		bugs, and performance for non-R3000 MIPS emulation is very
		poor. :-/
		Reverting to half the dyntrans chunk size again, because
		NetBSD/cats seemed less stable with full size chunks. :(
		NetBSD/sgimips 3.0 can now run :-)  (With release 0.3.8, only
		NetBSD/sgimips 2.1 worked, not 3.0.)

==============  RELEASE 0.4.0  ==============


1 dpavlin 22 /*
2     * Copyright (C) 2003-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 24 * $Id: machine_arc.c,v 1.3 2006/03/24 05:53:17 debug Exp $
29 dpavlin 22 */
30    
31     #include <stdio.h>
32     #include <stdlib.h>
33     #include <string.h>
34    
35     #include "arcbios.h"
36     #include "bus_isa.h"
37     #include "cpu.h"
38     #include "device.h"
39     #include "devices.h"
40     #include "machine.h"
41     #include "machine_interrupts.h"
42     #include "memory.h"
43     #include "misc.h"
44    
45    
46     MACHINE_SETUP(arc)
47     {
48     struct pci_data *pci_data;
49     struct memory *mem = machine->memory;
50     char tmpstr[1000];
51     int i, j;
52     char *eaddr_string = "eaddr=10:20:30:40:50:60"; /* bogus */
53     unsigned char macaddr[6];
54    
55     machine->machine_name = malloc(MACHINE_NAME_MAXBUF);
56     if (machine->machine_name == NULL) {
57     fprintf(stderr, "out of memory\n");
58     exit(1);
59     }
60    
61     cpu->byte_order = EMUL_LITTLE_ENDIAN;
62     snprintf(machine->machine_name,
63     MACHINE_NAME_MAXBUF, "ARC");
64    
65     switch (machine->machine_subtype) {
66    
67     case MACHINE_ARC_NEC_RD94:
68     case MACHINE_ARC_NEC_R94:
69     case MACHINE_ARC_NEC_R96:
70     /*
71     * "NEC-RD94" (NEC RISCstation 2250)
72     * "NEC-R94" (NEC RISCstation 2200)
73     * "NEC-R96" (NEC Express RISCserver)
74     *
75     * http://mirror.aarnet.edu.au/pub/NetBSD/misc/chs/arcdiag.out
76     * (NEC-R96)
77     */
78    
79     switch (machine->machine_subtype) {
80     case MACHINE_ARC_NEC_RD94:
81     strlcat(machine->machine_name,
82     " (NEC-RD94, NEC RISCstation 2250)",
83     MACHINE_NAME_MAXBUF);
84     break;
85     case MACHINE_ARC_NEC_R94:
86 dpavlin 24 strlcat(machine->machine_name,
87     " (NEC-R94; NEC RISCstation 2200)",
88 dpavlin 22 MACHINE_NAME_MAXBUF);
89     break;
90     case MACHINE_ARC_NEC_R96:
91 dpavlin 24 strlcat(machine->machine_name,
92     " (NEC-R96; NEC Express RISCserver)",
93 dpavlin 22 MACHINE_NAME_MAXBUF);
94     break;
95     }
96    
97     /* TODO: interrupt controller! */
98    
99     pci_data = device_add(machine,
100     "rd94 addr=0x80000000, irq=0");
101    
102     device_add(machine, "sn addr=0x80001000 irq=0");
103     dev_mc146818_init(machine, mem, 0x80004000ULL, 0,
104     MC146818_ARC_NEC, 1);
105     i = dev_pckbc_init(machine, mem, 0x80005000ULL, PCKBC_8042,
106     0, 0, machine->use_x11, 0);
107    
108     snprintf(tmpstr, sizeof(tmpstr),
109     "ns16550 irq=3 addr=0x80006000 in_use=%i name2=tty0",
110     machine->use_x11? 0 : 1);
111     j = (size_t)device_add(machine, tmpstr);
112     snprintf(tmpstr, sizeof(tmpstr),
113     "ns16550 irq=0 addr=0x80007000 in_use=%i name2=tty1", 0);
114     device_add(machine, tmpstr);
115    
116     if (machine->use_x11)
117     machine->main_console_handle = i;
118     else
119     machine->main_console_handle = j;
120    
121     /* lpt at 0x80008000 */
122    
123     device_add(machine, "fdc addr=0x8000c000, irq=0");
124    
125     switch (machine->machine_subtype) {
126     case MACHINE_ARC_NEC_RD94:
127     case MACHINE_ARC_NEC_R94:
128     /* PCI devices: (NOTE: bus must be 0, device must be
129     3, 4, or 5, for NetBSD to accept interrupts) */
130     bus_pci_add(machine, pci_data, mem, 0, 3, 0,
131     "dec21030"); /* tga graphics */
132     break;
133     case MACHINE_ARC_NEC_R96:
134     dev_fb_init(machine, mem, 0x100e00000ULL,
135     VFB_GENERIC, 640,480, 1024,480,
136     8, "necvdfrb");
137     break;
138     }
139     break;
140    
141     case MACHINE_ARC_NEC_R98:
142     /*
143     * "NEC-R98" (NEC RISCserver 4200)
144     *
145     * According to http://mail-index.netbsd.org/port-arc/
146     * 2004/02/01/0001.html:
147     *
148 dpavlin 24 * Network adapter at "start: 0x 0 18600000, length:
149     * 0x1000, level: 4, vector: 9"
150     * Disk at "start: 0x 0 18c103f0, length: 0x1000, level:
151     * 5, vector: 6"
152     * Keyboard at "start: 0x 0 18c20060, length: 0x1000,
153     * level: 5, vector: 3"
154     * Serial at "start: 0x 0 18c103f8, length: 0x1000,
155     * level: 5, vector: 4"
156     * Serial at "start: 0x 0 18c102f8, length: 0x1000,
157     * level: 5, vector: 4"
158     * Parallel at "start: 0x 0 18c10278, length: 0x1000,
159     * level: 5, vector: 5"
160 dpavlin 22 */
161    
162     strlcat(machine->machine_name,
163     " (NEC-R98; NEC RISCserver 4200)", MACHINE_NAME_MAXBUF);
164    
165     /*
166     * Windows NT access stuff at these addresses:
167     *
168     * 19980308, 18000210, 18c0a008,
169     * 19022018, 19026010, andso on.
170     */
171     break;
172    
173     case MACHINE_ARC_JAZZ_PICA:
174     case MACHINE_ARC_JAZZ_MAGNUM:
175     /*
176     * "PICA-61"
177     *
178     * According to NetBSD 1.6.2:
179     *
180     * jazzio0 at mainbus0
181     * timer0 at jazzio0 addr 0xe0000228
182     * mcclock0 at jazzio0 addr 0xe0004000: mc146818 or compatible
183     * lpt at jazzio0 addr 0xe0008000 intr 0 not configured
184     * fdc at jazzio0 addr 0xe0003000 intr 1 not configured
185     * MAGNUM at jazzio0 addr 0xe000c000 intr 2 not configured
186     * ALI_S3 at jazzio0 addr 0xe0800000 intr 3 not configured
187     * sn0 at jazzio0 addr 0xe0001000 intr 4: SONIC Ethernet
188     * sn0: Ethernet address 69:6a:6b:6c:00:00
189     * asc0 at jazzio0 addr 0xe0002000 intr 5: NCR53C94, target 0
190     * pckbd at jazzio0 addr 0xe0005000 intr 6 not configured
191     * pms at jazzio0 addr 0xe0005000 intr 7 not configured
192 dpavlin 24 * com0 at jazzio0 addr 0xe0006000 intr 8: ns16550a,
193     * working fifo
194 dpavlin 22 * com at jazzio0 addr 0xe0007000 intr 9 not configured
195     * jazzisabr0 at mainbus0
196 dpavlin 24 * isa0 at jazzisabr0 isa_io_base 0xe2000000 isa_mem_base
197     * 0xe3000000
198 dpavlin 22 *
199     * "Microsoft-Jazz", "MIPS Magnum"
200     *
201     * timer0 at jazzio0 addr 0xe0000228
202     * mcclock0 at jazzio0 addr 0xe0004000: mc146818 or compatible
203     * lpt at jazzio0 addr 0xe0008000 intr 0 not configured
204     * fdc at jazzio0 addr 0xe0003000 intr 1 not configured
205     * MAGNUM at jazzio0 addr 0xe000c000 intr 2 not configured
206     * VXL at jazzio0 addr 0xe0800000 intr 3 not configured
207     * sn0 at jazzio0 addr 0xe0001000 intr 4: SONIC Ethernet
208     * sn0: Ethernet address 69:6a:6b:6c:00:00
209     * asc0 at jazzio0 addr 0xe0002000 intr 5: NCR53C94, target 0
210     * scsibus0 at asc0: 8 targets, 8 luns per target
211     * pckbd at jazzio0 addr 0xe0005000 intr 6 not configured
212     * pms at jazzio0 addr 0xe0005000 intr 7 not configured
213 dpavlin 24 * com0 at jazzio0 addr 0xe0006000 intr 8: ns16550a,
214     * working fifo
215 dpavlin 22 * com at jazzio0 addr 0xe0007000 intr 9 not configured
216     * jazzisabr0 at mainbus0
217 dpavlin 24 * isa0 at jazzisabr0 isa_io_base 0xe2000000 isa_mem_base
218     * 0xe3000000
219 dpavlin 22 */
220    
221     switch (machine->machine_subtype) {
222     case MACHINE_ARC_JAZZ_PICA:
223 dpavlin 24 strlcat(machine->machine_name,
224     " (Microsoft Jazz, Acer PICA-61)",
225 dpavlin 22 MACHINE_NAME_MAXBUF);
226     machine->stable = 1;
227     break;
228     case MACHINE_ARC_JAZZ_MAGNUM:
229 dpavlin 24 strlcat(machine->machine_name,
230     " (Microsoft Jazz, MIPS Magnum)",
231 dpavlin 22 MACHINE_NAME_MAXBUF);
232     break;
233     default:
234     fatal("error in machine.c. jazz\n");
235     exit(1);
236     }
237    
238 dpavlin 24 machine->md_int.jazz_data = device_add(machine,
239     "jazz addr=0x80000000");
240     machine->md_interrupt = jazz_interrupt;
241 dpavlin 22
242 dpavlin 24 i = dev_pckbc_init(machine, mem, 0x80005000ULL,
243     PCKBC_JAZZ, 8 + 6, 8 + 7,
244     machine->use_x11, 0);
245 dpavlin 22
246 dpavlin 24 snprintf(tmpstr, sizeof(tmpstr),
247     "ns16550 irq=16 addr=0x80006000 in_use=%i"
248     " name2=tty0", machine->use_x11? 0 : 1);
249     j = (size_t)device_add(machine, tmpstr);
250     snprintf(tmpstr, sizeof(tmpstr),
251     "ns16550 irq=17 addr=0x80007000 in_use=%i"
252     " name2=tty1", 0);
253     device_add(machine, tmpstr);
254 dpavlin 22
255 dpavlin 24 if (machine->use_x11)
256     machine->main_console_handle = i;
257     else
258     machine->main_console_handle = j;
259 dpavlin 22
260 dpavlin 24 switch (machine->machine_subtype) {
261     case MACHINE_ARC_JAZZ_PICA:
262     if (machine->use_x11) {
263     dev_vga_init(machine, mem, 0x400a0000ULL,
264     0x600003c0ULL, machine->machine_name);
265     arcbios_console_init(machine,
266     0x400b8000ULL, 0x600003c0ULL);
267     }
268     break;
269     case MACHINE_ARC_JAZZ_MAGNUM:
270     /* PROM mirror? */
271     dev_ram_init(machine, 0xfff00000, 0x100000,
272     DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES,
273     0x1fc00000);
274 dpavlin 22
275 dpavlin 24 /* VXL. TODO */
276     /* control at 0x60100000? */
277     dev_fb_init(machine, mem, 0x60200000ULL,
278     VFB_GENERIC, 1024,768, 1024,768, 8, "VXL");
279     break;
280     }
281 dpavlin 22
282 dpavlin 24 /* irq 8 + 4 */
283     device_add(machine, "sn addr=0x80001000 irq=12");
284 dpavlin 22
285 dpavlin 24 dev_asc_init(machine, mem, 0x80002000ULL, 8 + 5, NULL,
286     DEV_ASC_PICA, dev_jazz_dma_controller,
287     machine->md_int.jazz_data);
288 dpavlin 22
289 dpavlin 24 device_add(machine, "fdc addr=0x80003000, irq=0");
290 dpavlin 22
291 dpavlin 24 dev_mc146818_init(machine, mem,
292     0x80004000ULL, 2, MC146818_ARC_JAZZ, 1);
293 dpavlin 22
294     #if 0
295     Not yet.
296 dpavlin 24 /* irq = 8+16 + 14 */
297     device_add(machine, "wdc addr=0x900001f0, irq=38");
298 dpavlin 22 #endif
299    
300 dpavlin 24 break;
301 dpavlin 22
302 dpavlin 24 case MACHINE_ARC_JAZZ_M700:
303     /*
304     * "Microsoft-Jazz", "Olivetti M700"
305     *
306     * Different enough from Pica and Magnum to be
307     * separate here.
308     *
309     * http://mail-index.netbsd.org/port-arc/2000/10/18/0001.html
310     */
311 dpavlin 22
312 dpavlin 24 strlcat(machine->machine_name, " (Microsoft Jazz, "
313     "Olivetti M700)", MACHINE_NAME_MAXBUF);
314 dpavlin 22
315 dpavlin 24 machine->md_int.jazz_data = device_add(machine,
316     "jazz addr=0x80000000");
317     machine->md_interrupt = jazz_interrupt;
318 dpavlin 22
319 dpavlin 24 dev_mc146818_init(machine, mem,
320     0x80004000ULL, 2, MC146818_ARC_JAZZ, 1);
321 dpavlin 22
322 dpavlin 24 i = 0; /* TODO: Yuck! */
323 dpavlin 22 #if 0
324 dpavlin 24 i = dev_pckbc_init(machine, mem, 0x80005000ULL,
325     PCKBC_JAZZ, 8 + 6, 8 + 7, machine->use_x11, 0);
326 dpavlin 22 #endif
327    
328 dpavlin 24 snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=16 addr="
329     "0x80006000 in_use=%i name2=tty0", machine->use_x11? 0 : 1);
330     j = (size_t)device_add(machine, tmpstr);
331     snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=17 addr="
332     "0x80007000 in_use=%i name2=tty1", 0);
333     device_add(machine, tmpstr);
334 dpavlin 22
335 dpavlin 24 if (machine->use_x11)
336     machine->main_console_handle = i;
337     else
338     machine->main_console_handle = j;
339 dpavlin 22
340 dpavlin 24 dev_m700_fb_init(machine, mem, 0x180080000ULL, 0x100000000ULL);
341 dpavlin 22
342 dpavlin 24 break;
343 dpavlin 22
344 dpavlin 24 case MACHINE_ARC_DESKTECH_TYNE:
345     /*
346     * "Deskstation Tyne" (?)
347     *
348     * TODO
349     * http://mail-index.netbsd.org/port-arc/2000/10/14/0000.html
350     */
351 dpavlin 22
352     strlcat(machine->machine_name, " (Deskstation Tyne)",
353     MACHINE_NAME_MAXBUF);
354    
355     /* TODO: IRQs! */
356     bus_isa_init(machine, 0, 0x900000000ULL,
357     0x100000000ULL, 8, 24);
358     #if 0
359 dpavlin 24 snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr="
360     "0x9000003f8 in_use=%i name2=tty0", machine->use_x11? 0:1);
361 dpavlin 22 i = (size_t)device_add(machine, tmpstr);
362 dpavlin 24 device_add(machine, "ns16550 irq=0 addr=0x9000002f8 in_use=0"
363     " name2=tty1");
364 dpavlin 22 #endif
365 dpavlin 24 device_add(machine, "ns16550 irq=0 addr=0x9000003e8 "
366     "in_use=0 name2=tty2");
367     device_add(machine, "ns16550 irq=0 addr=0x9000002e8 "
368     "in_use=0 name2=tty3");
369 dpavlin 22 #if 0
370     dev_mc146818_init(machine, mem,
371     0x900000070ULL, 2, MC146818_PC_CMOS, 1);
372     /* TODO: irq, etc */
373     device_add(machine, "wdc addr=0x9000001f0, irq=0");
374     device_add(machine, "wdc addr=0x900000170, irq=0");
375    
376     /* PC kbd */
377     j = dev_pckbc_init(machine, mem, 0x900000060ULL,
378     PCKBC_8042, 0, 0, machine->use_x11, 0);
379    
380     if (machine->use_x11)
381     machine->main_console_handle = j;
382     else
383     machine->main_console_handle = i;
384     #endif
385    
386     if (machine->use_x11) {
387     dev_vga_init(machine, mem, 0x1000a0000ULL,
388     0x9000003c0ULL, machine->machine_name);
389     arcbios_console_init(machine,
390     0x1000b8000ULL, 0x9000003c0ULL);
391     }
392     break;
393    
394     default:fatal("Unimplemented ARC machine type %i\n",
395     machine->machine_subtype);
396     exit(1);
397     }
398    
399     /*
400     * NOTE: ARCBIOS shouldn't be used before this point. (The only
401     * exception is that arcbios_console_init() may be called.)
402     */
403    
404     if (!machine->prom_emulation)
405     return;
406    
407     arcbios_init(machine, 0, 0, eaddr_string, macaddr);
408     }
409    
410    
411     MACHINE_DEFAULT_CPU(arc)
412     {
413     switch (machine->machine_subtype) {
414     case MACHINE_ARC_JAZZ_PICA:
415     machine->cpu_name = strdup("R4000");
416     break;
417     default:
418     machine->cpu_name = strdup("R4400");
419     }
420     }
421    
422    
423     MACHINE_DEFAULT_RAM(arc)
424     {
425     machine->physical_ram_in_mb = 64;
426     }
427    
428    
429     MACHINE_REGISTER(arc)
430     {
431     MR_DEFAULT(arc, "ARC", ARCH_MIPS, MACHINE_ARC, 1, 8);
432    
433     me->set_default_ram = machine_default_ram_arc;
434    
435     me->aliases[0] = "arc";
436    
437     me->subtype[0] = machine_entry_subtype_new(
438     "Acer PICA-61", MACHINE_ARC_JAZZ_PICA, 3);
439     me->subtype[0]->aliases[0] = "pica-61";
440     me->subtype[0]->aliases[1] = "acer pica";
441     me->subtype[0]->aliases[2] = "pica";
442    
443     me->subtype[1] = machine_entry_subtype_new(
444     "Deskstation Tyne", MACHINE_ARC_DESKTECH_TYNE, 3);
445     me->subtype[1]->aliases[0] = "deskstation tyne";
446     me->subtype[1]->aliases[1] = "desktech";
447     me->subtype[1]->aliases[2] = "tyne";
448    
449     me->subtype[2] = machine_entry_subtype_new(
450     "Jazz Magnum", MACHINE_ARC_JAZZ_MAGNUM, 2);
451     me->subtype[2]->aliases[0] = "magnum";
452     me->subtype[2]->aliases[1] = "jazz magnum";
453    
454     me->subtype[3] = machine_entry_subtype_new(
455     "NEC-R94", MACHINE_ARC_NEC_R94, 2);
456     me->subtype[3]->aliases[0] = "nec-r94";
457     me->subtype[3]->aliases[1] = "r94";
458    
459     me->subtype[4] = machine_entry_subtype_new(
460     "NEC-RD94", MACHINE_ARC_NEC_RD94, 2);
461     me->subtype[4]->aliases[0] = "nec-rd94";
462     me->subtype[4]->aliases[1] = "rd94";
463    
464     me->subtype[5] = machine_entry_subtype_new(
465     "NEC-R96", MACHINE_ARC_NEC_R96, 2);
466     me->subtype[5]->aliases[0] = "nec-r96";
467     me->subtype[5]->aliases[1] = "r96";
468    
469     me->subtype[6] = machine_entry_subtype_new(
470     "NEC-R98", MACHINE_ARC_NEC_R98, 2);
471     me->subtype[6]->aliases[0] = "nec-r98";
472     me->subtype[6]->aliases[1] = "r98";
473    
474     me->subtype[7] = machine_entry_subtype_new(
475     "Olivetti M700", MACHINE_ARC_JAZZ_M700, 2);
476     me->subtype[7]->aliases[0] = "olivetti";
477     me->subtype[7]->aliases[1] = "m700";
478    
479     machine_entry_add(me, ARCH_MIPS);
480     }
481    

  ViewVC Help
Powered by ViewVC 1.1.26