/[gxemul]/trunk/src/include/devices.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/src/include/devices.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (show annotations)
Mon Oct 8 16:20:58 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 26293 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.1421 2006/11/06 05:32:37 debug Exp $
20060816	Adding a framework for emulated/virtual timers (src/timer.c),
		using only setitimer().
		Rewriting the mc146818 to use the new timer framework.
20060817	Adding a call to gettimeofday() every now and then (once every
		second, at the moment) to resynch the timer if it drifts.
		Beginning to convert the ISA timer interrupt mechanism (8253
		and 8259) to use the new timer framework.
		Removing the -I command line option.
20060819	Adding the -I command line option again, with new semantics.
		Working on Footbridge timer interrupts; NetBSD/NetWinder and
		NetBSD/CATS now run at correct speed, but unfortunately with
		HUGE delays during bootup.
20060821	Some minor m68k updates. Adding the first instruction: nop. :)
		Minor Alpha emulation updates.
20060822	Adding a FreeBSD development specific YAMON environment
		variable ("khz") (as suggested by Bruce M. Simpson).
		Moving YAMON environment variable initialization from
		machine_evbmips.c into promemul/yamon.c, and adding some more
		variables.
		Continuing on the LCA PCI bus controller (for Alpha machines).
20060823	Continuing on the timer stuff: experimenting with MIPS count/
		compare interrupts connected to the timer framework.
20060825	Adding bogus SCSI commands 0x51 (SCSICDROM_READ_DISCINFO) and
		0x52 (SCSICDROM_READ_TRACKINFO) to the SCSI emulation layer,
		to allow NetBSD/pmax 4.0_BETA to be installed from CDROM.
		Minor updates to the LCA PCI controller.
20060827	Implementing a CHIP8 cpu mode, and a corresponding CHIP8
		machine, for fun. Disassembly support for all instructions,
		and most of the common instructions have been implemented: mvi,
		mov_imm, add_imm, jmp, rand, cls, sprite, skeq_imm, jsr,
		skne_imm, bcd, rts, ldr, str, mov, or, and, xor, add, sub,
		font, ssound, sdelay, gdelay, bogus skup/skpr, skeq, skne.
20060828	Beginning to convert the CHIP8 cpu in the CHIP8 machine to a
		(more correct) RCA 180x cpu. (Disassembly for all 1802
		instructions has been implemented, but no execution yet, and
		no 1805 extended instructions.)
20060829	Minor Alpha emulation updates.
20060830	Beginning to experiment a little with PCI IDE for SGI O2.
		Fixing the cursor key mappings for MobilePro 770 emulation.
		Fixing the LK201 warning caused by recent NetBSD/pmax.
		The MIPS R41xx standby, suspend, and hibernate instructions now
		behave like the RM52xx/MIPS32/MIPS64 wait instruction.
		Fixing dev_wdc so it calculates correct (64-bit) offsets before
		giving them to diskimage_access().
20060831	Continuing on Alpha emulation (OSF1 PALcode).
20060901	Minor Alpha updates; beginning on virtual memory pagetables.
		Removed the limit for max nr of devices (in preparation for
		allowing devices' base addresses to be changed during runtime).
		Adding a hack for MIPS [d]mfc0 select 0 (except the count
		register), so that the coproc register is simply copied.
		The MIPS suspend instruction now exits the emulator, instead
		of being treated as a wait instruction (this causes NetBSD/
		hpcmips to get correct 'halt' behavior).
		The VR41xx RTC now returns correct time.
		Connecting the VR41xx timer to the timer framework (fixed at
		128 Hz, for now).
		Continuing on SPARC emulation, adding more instructions:
		restore, ba_xcc, ble. The rectangle drawing demo works :)
		Removing the last traces of the old ENABLE_CACHE_EMULATION
		MIPS stuff (not usable with dyntrans anyway).
20060902	Splitting up src/net.c into several smaller files in its own
		subdirectory (src/net/).
20060903	Cleanup of the files in src/net/, to make them less ugly.
20060904	Continuing on the 'settings' subsystem.
		Minor progress on the SPARC emulation mode.
20060905	Cleanup of various things, and connecting the settings
		infrastructure to various subsystems (emul, machine, cpu, etc).
		Changing the lk201 mouse update routine to not rely on any
		emulated hardware framebuffer cursor coordinates, but instead
		always do (semi-usable) relative movements.
20060906	Continuing on the lk201 mouse stuff. Mouse behaviour with
		multiple framebuffers (which was working in Ultrix) is now
		semi-broken (but it still works, in a way).
		Moving the documentation about networking into its own file
		(networking.html), and refreshing it a bit. Adding an example
		of how to use ethernet frame direct-access (udp_snoop).
20060907	Continuing on the settings infrastructure.
20060908	Minor updates to SH emulation: for 32-bit emulation: delay
		slots and the 'jsr @Rn' instruction. I'm putting 64-bit SH5 on
		ice, for now.
20060909-10	Implementing some more 32-bit SH instructions. Removing the
		64-bit mode completely. Enough has now been implemented to run
		the rectangle drawing demo. :-)
20060912	Adding more SH instructions.
20060916	Continuing on SH emulation (some more instructions: div0u,
		div1, rotcl/rotcr, more mov instructions, dt, braf, sets, sett,
		tst_imm, dmuls.l, subc, ldc_rm_vbr, movt, clrt, clrs, clrmac).
		Continuing on the settings subsystem (beginning on reading/
		writing settings, removing bugs, and connecting more cpus to
		the framework).
20060919	More work on SH emulation; adding an ldc banked instruction,
		and attaching a 640x480 framebuffer to the Dreamcast machine
		mode (NetBSD/dreamcast prints the NetBSD copyright banner :-),
		and then panics).
20060920	Continuing on the settings subsystem.
20060921	Fixing the Footbridge timer stuff so that NetBSD/cats and
		NetBSD/netwinder boot up without the delays.
20060922	Temporarily hardcoding MIPS timer interrupt to 100 Hz. With
		'wait' support disabled, NetBSD/malta and Linux/malta run at
		correct speed.
20060923	Connecting dev_gt to the timer framework, so that NetBSD/cobalt
		runs at correct speed.
		Moving SH4-specific memory mapped registers into its own
		device (dev_sh4.c).
		Running with -N now prints "idling" instead of bogus nr of
		instrs/second (which isn't valid anyway) while idling.
20060924	Algor emulation should now run at correct speed.
		Adding disassembly support for some MIPS64 revision 2
		instructions: ext, dext, dextm, dextu.
20060926	The timer framework now works also when the MIPS wait
		instruction is used.
20060928	Re-implementing checks for coprocessor availability for MIPS
		cop0 instructions. (Thanks to Carl van Schaik for noticing the
		lack of cop0 availability checks.)
20060929	Implementing an instruction combination hack which treats
		NetBSD/pmax' idle loop as a wait-like instruction.
20060930	The ENTRYHI_R_MASK was missing in (at least) memory_mips_v2p.c,
		causing TLB lookups to sometimes succeed when they should have
		failed. (A big thank you to Juli Mallett for noticing the
		problem.)
		Adding disassembly support for more MIPS64 revision 2 opcodes
		(seb, seh, wsbh, jalr.hb, jr.hb, synci, ins, dins, dinsu,
		dinsm, dsbh, dshd, ror, dror, rorv, drorv, dror32). Also
		implementing seb, seh, dsbh, dshd, and wsbh.
		Implementing an instruction combination hack for Linux/pmax'
		idle loop, similar to the NetBSD/pmax case.
20061001	Changing the NetBSD/sgimips install instructions to extract
		files from an iso image, instead of downloading them via ftp.
20061002	More-than-31-bit userland addresses in memory_mips_v2p.c were
		not actually working; applying a fix from Carl van Schaik to
		enable them to work + making some other updates (adding kuseg
		support).
		Fixing hpcmips (vr41xx) timer initialization.
		Experimenting with O(n)->O(1) reduction in the MIPS TLB lookup
		loop. Seems to work both for R3000 and non-R3000.
20061003	Continuing a little on SH emulation (adding more control
		registers; mini-cleanup of memory_sh.c).
20061004	Beginning on a dev_rtc, a clock/timer device for the test
		machines; also adding a demo, and some documentation.
		Fixing a bug in SH "mov.w @(disp,pc),Rn" (the result wasn't
		sign-extended), and adding the addc and ldtlb instructions.
20061005	Contining on SH emulation: virtual to physical address
		translation, and a skeleton exception mechanism.
20061006	Adding more SH instructions (various loads and stores, rte,
		negc, muls.w, various privileged register-move instructions).
20061007	More SH instructions: various move instructions, trapa, div0s,
		float, fdiv, ftrc.
		Continuing on dev_rtc; removing the rtc demo.
20061008	Adding a dummy Dreamcast PROM module. (Homebrew Dreamcast
		programs using KOS libs need this.)
		Adding more SH instructions: "stc vbr,rn", rotl, rotr, fsca,
		fmul, fadd, various floating-point moves, etc. A 256-byte
		demo for Dreamcast runs :-)
20061012	Adding the SH "lds Rm,pr" and bsr instructions.
20061013	More SH instructions: "sts fpscr,rn", tas.b, and some more
		floating point instructions, cmp/str, and more moves.
		Adding a dummy dev_pvr (Dreamcast graphics controller).
20061014	Generalizing the expression evaluator (used in the built-in
		debugger) to support parentheses and +-*/%^&|.
20061015	Removing the experimental tlb index hint code in
		mips_memory_v2p.c, since it didn't really have any effect.
20061017	Minor SH updates; adding the "sts pr,Rn", fcmp/gt, fneg,
		frchg, and some other instructions. Fixing missing sign-
		extension in an 8-bit load instruction.
20061019	Adding a simple dev_dreamcast_rtc.
		Implementing memory-mapped access to the SH ITLB/UTLB arrays.
20061021	Continuing on various SH and Dreamcast things: sh4 timers,
		debug messages for dev_pvr, fixing some virtual address
		translation bugs, adding the bsrf instruction.
		The NetBSD/dreamcast GENERIC_MD kernel now reaches userland :)
		Adding a dummy dev_dreamcast_asic.c (not really useful yet).
		Implementing simple support for Store Queues.
		Beginning on the PVR Tile Accelerator.
20061022	Generalizing the PVR framebuffer to support off-screen drawing,
		multiple bit-depths, etc. (A small speed penalty, but most
		likely worth it.)
		Adding more SH instructions (mulu.w, fcmp/eq, fsub, fmac,
		fschg, and some more); correcting bugs in "fsca" and "float".
20061024	Adding the SH ftrv (matrix * vector) instruction. Marcus
		Comstedt's "tatest" example runs :) (wireframe only).
		Correcting disassembly for SH floating point instructions that
		use the xd* registers.
		Adding the SH fsts instruction.
		In memory_device_dyntrans_access(), only the currently used
		range is now invalidated, and not the entire device range.
20061025	Adding a dummy AVR32 cpu mode skeleton.
20061026	Various Dreamcast updates; beginning on a Maple bus controller.
20061027	Continuing on the Maple bus. A bogus Controller, Keyboard, and
		Mouse can now be detected by NetBSD and KOS homebrew programs.
		Cleaning up the SH4 Timer Management Unit, and beginning on
		SH4 interrupts.
		Implementing the Dreamcast SYSASIC.
20061028	Continuing on the SYSASIC.
		Adding the SH fsqrt instruction.
		memory_sh.c now actually scans the ITLB.
		Fixing a bug in dev_sh4.c, related to associative writes into
		the memory-mapped UTLB array. NetBSD/dreamcast now reaches
		userland stably, and prints the "Terminal type?" message :-]
		Implementing enough of the Dreamcast keyboard to make NetBSD
		accept it for input.
		Enabling SuperH for stable (non-development) builds.
		Adding NetBSD/dreamcast to the documentation, although it
		doesn't support root-on-nfs yet.
20061029	Changing usleep(1) calls in the debugger to to usleep(10000)
		(according to Brian Foley, this makes GXemul run better on
		MacOS X).
		Making the Maple "Controller" do something (enough to barely
		interact with dcircus.elf).
20061030-31	Some progress on the PVR. More test programs start running (but
		with strange output).
		Various other SH4-related updates.
20061102	Various Dreamcast and SH4 updates; more KOS demos run now.
20061104	Adding a skeleton dev_mb8696x.c (the Dreamcast's LAN adapter).
20061105	Continuing on the MB8696x; NetBSD/dreamcast detects it as mbe0.
		Testing for the release.

==============  RELEASE 0.4.3  ==============


1 #ifndef DEVICES_H
2 #define DEVICES_H
3
4 /*
5 * Copyright (C) 2003-2006 Anders Gavare. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 *
31 * $Id: devices.h,v 1.218 2006/10/02 09:26:53 debug Exp $
32 *
33 * Memory mapped devices.
34 *
35 * TODO: Separate into lots of smaller files? That might speed up a compile,
36 * but I'm not sure that it's a price worth paying.
37 */
38
39 #include <sys/types.h>
40 #include <inttypes.h>
41
42 struct cpu;
43 struct machine;
44 struct memory;
45 struct pci_data;
46 struct timer;
47
48 /* #ifdef WITH_X11
49 #include <X11/Xlib.h>
50 #endif */
51
52 /* dev_8259.c: */
53 struct pic8259_data {
54 int irq_nr; /* if connected to another 8259 */
55
56 int irq_base;
57 int current_command;
58
59 int init_state;
60
61 int priority_reg;
62 uint8_t irr; /* interrupt request register */
63 uint8_t isr; /* interrupt in-service register */
64 uint8_t ier; /* interrupt enable register */
65 };
66
67 /* dev_dec_ioasic.c: */
68 #define DEV_DEC_IOASIC_LENGTH 0x80100
69 #define N_DEC_IOASIC_REGS (0x1f0 / 0x10)
70 #define MAX_IOASIC_DMA_FUNCTIONS 8
71 struct dec_ioasic_data {
72 uint32_t reg[N_DEC_IOASIC_REGS];
73 int (*(dma_func[MAX_IOASIC_DMA_FUNCTIONS]))(struct cpu *, void *, uint64_t addr, size_t dma_len, int tx);
74 void *dma_func_extra[MAX_IOASIC_DMA_FUNCTIONS];
75 int rackmount_flag;
76 };
77 int dev_dec_ioasic_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
78 struct dec_ioasic_data *dev_dec_ioasic_init(struct cpu *cpu, struct memory *mem, uint64_t baseaddr, int rackmount_flag);
79
80 /* dev_algor.c: */
81 struct algor_data {
82 uint64_t base_addr;
83 };
84
85 /* dev_asc.c: */
86 #define DEV_ASC_DEC_LENGTH 0x40000
87 #define DEV_ASC_PICA_LENGTH 0x1000
88 #define DEV_ASC_DEC 1
89 #define DEV_ASC_PICA 2
90 int dev_asc_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
91 void dev_asc_init(struct machine *machine, struct memory *mem, uint64_t baseaddr,
92 int irq_nr, void *turbochannel, int mode,
93 size_t (*dma_controller)(void *dma_controller_data,
94 unsigned char *data, size_t len, int writeflag),
95 void *dma_controller_data);
96
97 /* dev_au1x00.c: */
98 struct au1x00_ic_data {
99 int ic_nr;
100 uint32_t request0_int;
101 uint32_t request1_int;
102 uint32_t config0;
103 uint32_t config1;
104 uint32_t config2;
105 uint32_t source;
106 uint32_t assign_request;
107 uint32_t wakeup;
108 uint32_t mask;
109 };
110
111 int dev_au1x00_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
112 struct au1x00_ic_data *dev_au1x00_init(struct machine *machine, struct memory *mem);
113
114 /* dev_bebox.c: */
115 struct bebox_data {
116 /* The 5 motherboard registers: */
117 uint32_t cpu0_int_mask;
118 uint32_t cpu1_int_mask;
119 uint32_t int_status;
120 uint32_t xpi;
121 uint32_t resets;
122 };
123
124 /* dev_bt431.c: */
125 #define DEV_BT431_LENGTH 0x20
126 #define DEV_BT431_NREGS 0x800 /* ? */
127 int dev_bt431_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
128 struct vfb_data;
129 void dev_bt431_init(struct memory *mem, uint64_t baseaddr, struct vfb_data *vfb_data, int color_fb_flag);
130
131 /* dev_bt455.c: */
132 #define DEV_BT455_LENGTH 0x20
133 int dev_bt455_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
134 struct vfb_data;
135 void dev_bt455_init(struct memory *mem, uint64_t baseaddr, struct vfb_data *vfb_data);
136
137 /* dev_bt459.c: */
138 #define DEV_BT459_LENGTH 0x20
139 #define DEV_BT459_NREGS 0x1000
140 #define BT459_PX 1 /* px[g] */
141 #define BT459_BA 2 /* cfb */
142 #define BT459_BBA 3 /* sfb */
143 int dev_bt459_access(struct cpu *cpu, struct memory *mem,
144 uint64_t relative_addr, unsigned char *data, size_t len,
145 int writeflag, void *);
146 struct vfb_data;
147 void dev_bt459_init(struct machine *machine, struct memory *mem,
148 uint64_t baseaddr, uint64_t baseaddr_irq, struct vfb_data *vfb_data,
149 int color_fb_flag, int irq_nr, int type);
150
151 /* dev_cons.c: */
152 struct cons_data {
153 int console_handle;
154 int irq_nr;
155 int in_use;
156 };
157
158 /* dev_colorplanemask.c: */
159 #define DEV_COLORPLANEMASK_LENGTH 0x0000000000000010
160 int dev_colorplanemask_access(struct cpu *cpu, struct memory *mem,
161 uint64_t relative_addr, unsigned char *data, size_t len,
162 int writeflag, void *);
163 void dev_colorplanemask_init(struct memory *mem, uint64_t baseaddr,
164 unsigned char *color_plane_mask);
165
166 /* dev_cpc700.c: */
167 struct cpc700_data {
168 struct pci_data *pci_data;
169 uint32_t sr; /* Status register (interrupt) */
170 uint32_t er; /* Enable register */
171 };
172 struct cpc700_data *dev_cpc700_init(struct machine *, struct memory *);
173
174 /* dev_dc7085.c: */
175 #define DEV_DC7085_LENGTH 0x0000000000000080
176 /* see dc7085.h for more info */
177 void dev_dc7085_tick(struct cpu *cpu, void *);
178 int dev_dc7085_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
179 int dev_dc7085_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, int use_fb);
180
181 /* dev_dec5800.c: */
182 #define DEV_DEC5800_LENGTH 0x1000 /* ? */
183 struct dec5800_data {
184 uint32_t csr;
185 uint32_t vector_0x50;
186 };
187 int dev_dec5800_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
188 struct dec5800_data *dev_dec5800_init(struct machine *machine, struct memory *mem, uint64_t baseaddr);
189 /* 16 slots, 0x2000 bytes each */
190 #define DEV_DECBI_LENGTH 0x20000
191 int dev_decbi_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
192 void dev_decbi_init(struct memory *mem, uint64_t baseaddr);
193 #define DEV_DECCCA_LENGTH 0x10000 /* ? */
194 #define DEC_DECCCA_BASEADDR 0x19000000 /* ? I just made this up */
195 int dev_deccca_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
196 void dev_deccca_init(struct memory *mem, uint64_t baseaddr);
197 #define DEV_DECXMI_LENGTH 0x800000
198 int dev_decxmi_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
199 void dev_decxmi_init(struct memory *mem, uint64_t baseaddr);
200
201 /* dev_eagle.c: */
202 struct pci_data *dev_eagle_init(struct machine *machine, struct memory *mem,
203 int irqbase, int pciirq);
204
205 /* dev_fb.c: */
206 #define DEV_FB_LENGTH 0x3c0000 /* 3c0000 to not colide with */
207 /* turbochannel rom, */
208 /* otherwise size = 4MB */
209 /* Type: */
210 #define VFB_GENERIC 0
211 #define VFB_HPC 1
212 #define VFB_DEC_VFB01 2
213 #define VFB_DEC_VFB02 3
214 #define VFB_DEC_MAXINE 4
215 #define VFB_PLAYSTATION2 5
216 /* Extra flags: */
217 #define VFB_REVERSE_START 0x10000
218 struct vfb_data {
219 struct memory *memory;
220 int vfb_type;
221
222 int vfb_scaledown;
223
224 int xsize;
225 int ysize;
226 int bit_depth;
227 int color32k; /* hack for 16-bit HPCmips */
228 int psp_15bit; /* playstation portable hack */
229
230 unsigned char color_plane_mask;
231
232 int bytes_per_line; /* cached */
233
234 int visible_xsize;
235 int visible_ysize;
236
237 size_t framebuffer_size;
238 int x11_xsize, x11_ysize;
239
240 int update_x1, update_y1, update_x2, update_y2;
241
242 /* RGB palette for <= 8 bit modes: (r,g,b bytes for each) */
243 unsigned char rgb_palette[256 * 3];
244
245 char *name;
246 char title[100];
247
248 void (*redraw_func)(struct vfb_data *, int, int);
249
250 /* These should always be in sync: */
251 unsigned char *framebuffer;
252 struct fb_window *fb_window;
253 };
254 #define VFB_MFB_BT455 0x100000
255 #define VFB_MFB_BT431 0x180000
256 #define VFB_MFB_VRAM 0x200000
257 #define VFB_CFB_BT459 0x200000
258 void set_grayscale_palette(struct vfb_data *d, int ncolors);
259 void dev_fb_resize(struct vfb_data *d, int new_xsize, int new_ysize);
260 void dev_fb_setcursor(struct vfb_data *d, int cursor_x, int cursor_y, int on,
261 int cursor_xsize, int cursor_ysize);
262 void framebuffer_blockcopyfill(struct vfb_data *d, int fillflag, int fill_r,
263 int fill_g, int fill_b, int x1, int y1, int x2, int y2,
264 int from_x, int from_y);
265 void dev_fb_tick(struct cpu *, void *);
266 int dev_fb_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr,
267 unsigned char *data, size_t len, int writeflag, void *);
268 struct vfb_data *dev_fb_init(struct machine *machine, struct memory *mem,
269 uint64_t baseaddr, int vfb_type, int visible_xsize, int visible_ysize,
270 int xsize, int ysize, int bit_depth, char *name);
271
272 /* dev_footbridge: */
273 #define N_FOOTBRIDGE_TIMERS 4
274 struct footbridge_data {
275 struct pci_data *pcibus;
276
277 int console_handle;
278
279 int timer_tick_countdown[N_FOOTBRIDGE_TIMERS];
280 uint32_t timer_load[N_FOOTBRIDGE_TIMERS];
281 uint32_t timer_value[N_FOOTBRIDGE_TIMERS];
282 uint32_t timer_control[N_FOOTBRIDGE_TIMERS];
283
284 struct timer *timer[N_FOOTBRIDGE_TIMERS];
285 int pending_timer_interrupts[N_FOOTBRIDGE_TIMERS];
286
287 uint32_t irq_status;
288 uint32_t irq_enable;
289
290 uint32_t fiq_status;
291 uint32_t fiq_enable;
292 };
293
294 /* dev_gc.c: */
295 struct gc_data {
296 int reassert_irq;
297 uint32_t status_hi;
298 uint32_t status_lo;
299 uint32_t enable_hi;
300 uint32_t enable_lo;
301 };
302 struct gc_data *dev_gc_init(struct machine *, struct memory *, uint64_t addr,
303 int reassert_irq);
304
305 /* dev_gt.c: */
306 #define DEV_GT_LENGTH 0x1000
307 int dev_gt_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr,
308 unsigned char *data, size_t len, int writeflag, void *);
309 struct pci_data *dev_gt_init(struct machine *machine, struct memory *mem,
310 uint64_t baseaddr, int irq_nr, int pciirq, int type);
311
312 /* dev_i80321.c: */
313 struct i80321_data {
314 /* Interrupt Controller */
315 int reassert_irq;
316 uint32_t status;
317 uint32_t enable;
318
319 uint32_t pci_addr;
320 struct pci_data *pci_bus;
321
322 /* Memory Controller: */
323 uint32_t mcu_reg[0x100 / sizeof(uint32_t)];
324 };
325
326 /* dev_jazz.c: */
327 #define DEV_JAZZ_LENGTH 0x280
328 struct jazz_data {
329 struct cpu *cpu;
330
331 /* Jazz stuff: */
332 uint32_t int_enable_mask;
333 uint32_t int_asserted;
334
335 /* ISA stuff: */
336 uint32_t isa_int_enable_mask;
337 uint32_t isa_int_asserted;
338
339 int interval;
340 int interval_start;
341
342 int jazz_timer_value;
343 int jazz_timer_current;
344
345 uint64_t dma_translation_table_base;
346 uint64_t dma_translation_table_limit;
347
348 uint32_t dma0_mode;
349 uint32_t dma0_enable;
350 uint32_t dma0_count;
351 uint32_t dma0_addr;
352
353 uint32_t dma1_mode;
354 /* same for dma1,2,3 actually (TODO) */
355
356 int led;
357 };
358 size_t dev_jazz_dma_controller(void *dma_controller_data,
359 unsigned char *data, size_t len, int writeflag);
360
361 /* dev_kn01.c: */
362 #define DEV_KN01_CSR_LENGTH 0x0000000000000004
363 int dev_kn01_csr_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
364 void dev_kn01_csr_init(struct memory *mem, uint64_t baseaddr, int color_fb);
365 #define DEV_VDAC_LENGTH 0x20
366 #define DEV_VDAC_MAPWA 0x00
367 #define DEV_VDAC_MAP 0x04
368 #define DEV_VDAC_MASK 0x08
369 #define DEV_VDAC_MAPRA 0x0c
370 #define DEV_VDAC_OVERWA 0x10
371 #define DEV_VDAC_OVER 0x14
372 #define DEV_VDAC_OVERRA 0x1c
373 int dev_vdac_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
374 void dev_vdac_init(struct memory *mem, uint64_t baseaddr, unsigned char *rgb_palette, int color_fb_flag);
375
376 /* dev_kn02.c: */
377 struct kn02_csr {
378 uint8_t csr[sizeof(uint32_t)];
379 uint8_t filler[4096 - sizeof(uint32_t)]; /* for dyntrans mapping */
380 };
381 int dev_kn02_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
382 struct kn02_csr *dev_kn02_init(struct cpu *cpu, struct memory *mem,
383 uint64_t baseaddr);
384
385 /* dev_kn220.c: */
386 #define DEV_DEC5500_IOBOARD_LENGTH 0x100000
387 int dev_dec5500_ioboard_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
388 struct dec5500_ioboard_data *dev_dec5500_ioboard_init(struct cpu *cpu, struct memory *mem, uint64_t baseaddr);
389 #define DEV_SGEC_LENGTH 0x1000
390 int dev_sgec_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
391 void dev_sgec_init(struct memory *mem, uint64_t baseaddr, int irq_nr);
392
393 /* dev_kn230.c: */
394 struct kn230_csr {
395 uint32_t csr;
396 };
397
398 /* dev_le.c: */
399 #define DEV_LE_LENGTH 0x1c0200
400 int dev_le_access(struct cpu *cpu, struct memory *mem,
401 uint64_t relative_addr, unsigned char *data, size_t len,
402 int writeflag, void *);
403 void dev_le_init(struct machine *machine, struct memory *mem,
404 uint64_t baseaddr, uint64_t buf_start, uint64_t buf_end,
405 int irq_nr, int len);
406
407 /* dev_m700_fb.c: */
408 #define DEV_M700_FB_LENGTH 0x10000 /* TODO? */
409 int dev_m700_fb_access(struct cpu *cpu, struct memory *mem,
410 uint64_t relative_addr, unsigned char *data, size_t len,
411 int writeflag, void *);
412 void dev_m700_fb_init(struct machine *machine, struct memory *mem,
413 uint64_t baseaddr, uint64_t baseaddr2);
414
415 /* dev_malta.c: */
416 struct malta_data {
417 uint8_t assert_lo;
418 uint8_t assert_hi;
419 uint8_t disable_lo;
420 uint8_t disable_hi;
421 int poll_mode;
422 };
423
424 /* dev_mc146818.c: */
425 #define DEV_MC146818_LENGTH 0x0000000000000100
426 #define MC146818_DEC 0
427 #define MC146818_PC_CMOS 1
428 #define MC146818_ARC_NEC 2
429 #define MC146818_ARC_JAZZ 3
430 #define MC146818_SGI 4
431 #define MC146818_CATS 5
432 #define MC146818_ALGOR 6
433 #define MC146818_PMPPC 7
434 /* see mc146818reg.h for more info */
435 void dev_mc146818_tick(struct cpu *cpu, void *);
436 int dev_mc146818_access(struct cpu *cpu, struct memory *mem,
437 uint64_t relative_addr, unsigned char *data, size_t len,
438 int writeflag, void *);
439 void dev_mc146818_init(struct machine *machine, struct memory *mem,
440 uint64_t baseaddr, int irq_nr, int access_style, int addrdiv);
441
442 /* dev_pckbc.c: */
443 #define DEV_PCKBC_LENGTH 0x10
444 #define PCKBC_8042 0
445 #define PCKBC_8242 1
446 #define PCKBC_JAZZ 3
447 int dev_pckbc_access(struct cpu *cpu, struct memory *mem,
448 uint64_t relative_addr, unsigned char *data, size_t len,
449 int writeflag, void *);
450 int dev_pckbc_init(struct machine *machine, struct memory *mem,
451 uint64_t baseaddr, int type, int keyboard_irqnr, int mouse_irqnr,
452 int in_use, int pc_style_flag);
453
454 /* dev_pmppc.c: */
455 int dev_pmppc_board_access(struct cpu *cpu, struct memory *mem,
456 uint64_t relative_addr, unsigned char *data, size_t len, int writeflag,
457 void *);
458 void dev_pmppc_init(struct memory *mem);
459
460 /* dev_ps2_spd.c: */
461 #define DEV_PS2_SPD_LENGTH 0x800
462 int dev_ps2_spd_access(struct cpu *cpu, struct memory *mem,
463 uint64_t relative_addr, unsigned char *data, size_t len,
464 int writeflag, void *);
465 void dev_ps2_spd_init(struct machine *machine, struct memory *mem,
466 uint64_t baseaddr);
467
468 /* dev_ps2_stuff.c: */
469 #include "ps2_dmacreg.h"
470 #define N_PS2_DMA_CHANNELS 10
471 #define N_PS2_TIMERS 4
472 struct ps2_data {
473 uint32_t timer_count[N_PS2_TIMERS];
474 uint32_t timer_comp[N_PS2_TIMERS];
475 uint32_t timer_mode[N_PS2_TIMERS];
476 uint32_t timer_hold[N_PS2_TIMERS]; /* NOTE: only 0 and 1 are valid */
477
478 uint64_t dmac_reg[DMAC_REGSIZE / 0x10];
479
480 uint64_t other_memory_base[N_PS2_DMA_CHANNELS];
481
482 uint32_t intr;
483 uint32_t imask;
484 uint32_t sbus_smflg;
485 };
486 #define DEV_PS2_STUFF_LENGTH 0x10000
487 int dev_ps2_stuff_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
488 struct ps2_data *dev_ps2_stuff_init(struct machine *machine, struct memory *mem, uint64_t baseaddr);
489
490 /* dev_pmagja.c: */
491 #define DEV_PMAGJA_LENGTH 0x3c0000
492 int dev_pmagja_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
493 void dev_pmagja_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr);
494
495 /* dev_prep.c: */
496 struct prep_data {
497 uint32_t int_status;
498 };
499
500 /* dev_px.c: */
501 struct px_data {
502 struct memory *fb_mem;
503 struct vfb_data *vfb_data;
504 int type;
505 char *px_name;
506 int irq_nr;
507 int bitdepth;
508 int xconfig;
509 int yconfig;
510
511 uint32_t intr;
512 unsigned char sram[128 * 1024];
513 };
514 /* TODO: perhaps these types are wrong? */
515 #define DEV_PX_TYPE_PX 0
516 #define DEV_PX_TYPE_PXG 1
517 #define DEV_PX_TYPE_PXGPLUS 2
518 #define DEV_PX_TYPE_PXGPLUSTURBO 3
519 #define DEV_PX_LENGTH 0x3c0000
520 int dev_px_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr,
521 unsigned char *data, size_t len, int writeflag, void *);
522 void dev_px_init(struct machine *machine, struct memory *mem, uint64_t baseaddr,
523 int px_type, int irq_nr);
524
525 /* dev_ram.c: */
526 #define DEV_RAM_RAM 0
527 #define DEV_RAM_MIRROR 1
528 #define DEV_RAM_MIGHT_POINT_TO_DEVICES 0x10
529 int dev_ram_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr,
530 unsigned char *data, size_t len, int writeflag, void *);
531 void dev_ram_init(struct machine *machine, uint64_t baseaddr, uint64_t length,
532 int mode, uint64_t otheraddr);
533
534 /* dev_scc.c: */
535 #define DEV_SCC_LENGTH 0x1000
536 int dev_scc_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr,
537 unsigned char *data, size_t len, int writeflag, void *);
538 int dev_scc_dma_func(struct cpu *cpu, void *extra, uint64_t addr,
539 size_t dma_len, int tx);
540 void *dev_scc_init(struct machine *machine, struct memory *mem,
541 uint64_t baseaddr, int irq_nr, int use_fb, int scc_nr, int addrmul);
542
543 /* dev_sfb.c: */
544 #define DEV_SFB_LENGTH 0x400000
545 int dev_sfb_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr,
546 unsigned char *data, size_t len, int writeflag, void *);
547 void dev_sfb_init(struct machine *machine, struct memory *mem,
548 uint64_t baseaddr, struct vfb_data *vfb_data);
549
550 /* dev_sgi_gbe.c: */
551 #define DEV_SGI_GBE_LENGTH 0x1000000
552 int dev_sgi_gbe_access(struct cpu *cpu, struct memory *mem,
553 uint64_t relative_addr, unsigned char *data, size_t len, int writeflag,
554 void *);
555 void dev_sgi_gbe_init(struct machine *machine, struct memory *mem,
556 uint64_t baseaddr);
557
558 /* dev_sgi_ip20.c: */
559 #define DEV_SGI_IP20_LENGTH 0x40
560 #define DEV_SGI_IP20_BASE 0x1fb801c0
561 struct sgi_ip20_data {
562 int dummy;
563 };
564 int dev_sgi_ip20_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
565 struct sgi_ip20_data *dev_sgi_ip20_init(struct cpu *cpu, struct memory *mem, uint64_t baseaddr);
566
567 /* dev_sgi_ip22.c: */
568 #define DEV_SGI_IP22_LENGTH 0x100
569 #define DEV_SGI_IP22_IMC_LENGTH 0x100
570 #define DEV_SGI_IP22_UNKNOWN2_LENGTH 0x100
571 #define IP22_IMC_BASE 0x1fa00000
572 #define IP22_UNKNOWN2_BASE 0x1fb94000
573 struct sgi_ip22_data {
574 int guiness_flag;
575 uint32_t reg[DEV_SGI_IP22_LENGTH / 4];
576 uint32_t imc_reg[DEV_SGI_IP22_IMC_LENGTH / 4];
577 uint32_t unknown2_reg[DEV_SGI_IP22_UNKNOWN2_LENGTH / 4];
578 uint32_t unknown_timer;
579 };
580 int dev_sgi_ip22_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
581 struct sgi_ip22_data *dev_sgi_ip22_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int guiness_flag);
582
583 /* dev_sgi_ip30.c: */
584 #define DEV_SGI_IP30_LENGTH 0x80000
585 struct sgi_ip30_data {
586 /* ip30: */
587 uint64_t imask0; /* 0x10000 */
588 uint64_t reg_0x10018;
589 uint64_t isr; /* 0x10030 */
590 uint64_t reg_0x20000;
591 uint64_t reg_0x30000;
592
593 /* ip30_2: */
594 uint64_t reg_0x0029c;
595
596 /* ip30_3: */
597 uint64_t reg_0x00284;
598
599 /* ip30_4: */
600 uint64_t reg_0x000b0;
601
602 /* ip30_5: */
603 uint64_t reg_0x00000;
604 };
605 int dev_sgi_ip30_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
606 struct sgi_ip30_data *dev_sgi_ip30_init(struct machine *machine, struct memory *mem, uint64_t baseaddr);
607
608 /* dev_sgi_ip32.c: */
609 #define DEV_CRIME_LENGTH 0x0000000000001000
610 struct crime_data {
611 unsigned char reg[DEV_CRIME_LENGTH];
612 int irq_nr;
613 int use_fb;
614 };
615 int dev_crime_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
616 struct crime_data *dev_crime_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, int use_fb);
617 #define DEV_MACE_LENGTH 0x100
618 struct mace_data {
619 unsigned char reg[DEV_MACE_LENGTH];
620 int irqnr;
621 };
622 int dev_mace_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
623 struct mace_data *dev_mace_init(struct memory *mem, uint64_t baseaddr, int irqnr);
624 #define DEV_MACEPCI_LENGTH 0x1000
625 int dev_macepci_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
626 struct pci_data *dev_macepci_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int pciirq);
627 #define DEV_SGI_MEC_LENGTH 0x1000
628 int dev_sgi_mec_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
629 void dev_sgi_mec_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, unsigned char *macaddr);
630 #define DEV_SGI_UST_LENGTH 0x10000
631 int dev_sgi_ust_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
632 void dev_sgi_ust_init(struct memory *mem, uint64_t baseaddr);
633 #define DEV_SGI_MTE_LENGTH 0x10000
634 int dev_sgi_mte_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
635 void dev_sgi_mte_init(struct memory *mem, uint64_t baseaddr);
636
637 /* dev_sii.c: */
638 #define DEV_SII_LENGTH 0x100
639 void dev_sii_tick(struct cpu *cpu, void *);
640 int dev_sii_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
641 void dev_sii_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, uint64_t buf_start, uint64_t buf_end, int irq_nr);
642
643 /* dev_ssc.c: */
644 #define DEV_SSC_LENGTH 0x1000
645 int dev_ssc_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
646 void dev_ssc_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, int use_fb, uint32_t *);
647
648 /* dev_turbochannel.c: */
649 #define DEV_TURBOCHANNEL_LEN 0x0470
650 int dev_turbochannel_access(struct cpu *cpu, struct memory *mem,
651 uint64_t relative_addr, unsigned char *data, size_t len,
652 int writeflag, void *);
653 void dev_turbochannel_init(struct machine *machine, struct memory *mem,
654 int slot_nr, uint64_t baseaddr, uint64_t endaddr, char *device_name,
655 int irq);
656
657 /* dev_uninorth.c: */
658 struct pci_data *dev_uninorth_init(struct machine *machine, struct memory *mem,
659 uint64_t addr, int irqbase, int pciirq);
660
661 /* dev_v3.c: */
662 struct v3_data {
663 struct pci_data *pci_data;
664 uint16_t lb_map0;
665 };
666 struct v3_data *dev_v3_init(struct machine *, struct memory *);
667
668 /* dev_vga.c: */
669 int dev_vga_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr,
670 unsigned char *data, size_t len, int writeflag, void *);
671 void dev_vga_init(struct machine *machine, struct memory *mem,
672 uint64_t videomem_base, uint64_t control_base, char *name);
673
674 /* dev_vr41xx.c: */
675 #define DEV_VR41XX_LENGTH 0x800 /* TODO? */
676 struct vr41xx_data {
677 int cpumodel;
678
679 int kiu_console_handle;
680 uint32_t kiu_offset;
681 int kiu_irq_nr;
682 int kiu_int_assert;
683 int d0;
684 int d1;
685 int d2;
686 int d3;
687 int d4;
688 int d5;
689 int dont_clear_next;
690 int escape_state;
691
692 int pending_timer_interrupts;
693 struct timer *timer;
694
695 /* See icureg.h in NetBSD for more info. */
696 uint16_t sysint1;
697 uint16_t msysint1;
698 uint16_t giuint;
699 uint16_t giumask;
700 uint16_t sysint2;
701 uint16_t msysint2;
702 };
703
704 int dev_vr41xx_access(struct cpu *cpu, struct memory *mem,
705 uint64_t relative_addr, unsigned char *data, size_t len,
706 int writeflag, void *);
707 struct vr41xx_data *dev_vr41xx_init(struct machine *machine,
708 struct memory *mem, int cpumodel);
709
710 /* dev_wdsc.c: */
711 #define DEV_WDSC_NREGS 0x100 /* 8-bit register select */
712 #define DEV_WDSC_LENGTH 0x10
713 int dev_wdsc_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
714 void dev_wdsc_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int controller_nr, int irq_nr);
715
716 /* lk201.c: */
717 struct lk201_data {
718 int use_fb;
719 int console_handle;
720
721 void (*add_to_rx_queue)(void *,int,int);
722 void *add_data;
723
724 unsigned char keyb_buf[8];
725 int keyb_buf_pos;
726
727 int mouse_mode;
728 int mouse_revision; /* 0..15 */
729 int mouse_x, mouse_y, mouse_buttons;
730 };
731 void lk201_tick(struct machine *, struct lk201_data *);
732 void lk201_tx_data(struct lk201_data *, int port, int idata);
733 void lk201_init(struct lk201_data *d, int use_fb,
734 void (*add_to_rx_queue)(void *,int,int), int console_handle, void *);
735
736
737 #endif /* DEVICES_H */
738

  ViewVC Help
Powered by ViewVC 1.1.26