/[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 4 - (show annotations)
Mon Oct 8 16:18:00 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 24702 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.707 2005/04/27 16:37:33 debug Exp $
20050408	Some minor updates to the wdc. Linux now doesn't complain
		anymore if a disk is non-present.
20050409	Various minor fixes (a bintrans bug, and some other things).
		The wdc seems to work with Playstation2 emulation, but there
		is a _long_ annoying delay when disks are detected.
		Fixing a really important bintrans bug (when devices and RAM
		are mixed within 4KB pages), which was triggered with
		NetBSD/playstation2 kernels.
20050410	Adding a dummy dev_ps2_ether (just so that NetBSD doesn't
		complain as much during bootup).
		Symbols starting with '$' are now ignored.
		Renaming dev_ps2_ohci.c to dev_ohci.c, etc.
20050411	Moving the bintrans-cache-isolation check from cpu_mips.c to
		cpu_mips_coproc.c. (I thought this would give a speedup, but
		it's not noticable.)
		Better playstation2 sbus interrupt code.
		Skip ahead many ticks if the count register is read manually.
		(This increases the speed of delay-loops that simply read
		the count register.)
20050412	Updates to the playstation2 timer/interrupt code.
		Some other minor updates.
20050413	NetBSD/cobalt runs from a disk image :-) including userland;
		updating the documentation on how to install NetBSD/cobalt
		using NetBSD/pmax (!).
		Some minor bintrans updates (no real speed improvement) and
		other minor updates (playstation2 now uses the -o options).
20050414	Adding a dummy x86 (and AMD64) mode.
20050415	Adding some (32-bit and 16-bit) x86 instructions.
		Adding some initial support for non-SCSI, non-IDE floppy
		images. (The x86 mode can boot from these, more or less.)
		Moving the devices/ and include/ directories to src/devices/
		and src/include/, respectively.
20050416	Continuing on the x86 stuff. (Adding pc_bios.c and some simple
		support for software interrupts in 16-bit mode.)
20050417	Ripping out most of the x86 instruction decoding stuff, trying
		to rewrite it in a cleaner way.
		Disabling some of the least working CPU families in the
		configure script (sparc, x86, alpha, hppa), so that they are
		not enabled by default.
20050418	Trying to fix the bug which caused problems when turning on
		and off bintrans interactively, by flushing the bintrans cache
		whenever bintrans is manually (re)enabled.
20050419	Adding the 'lswi' ppc instruction.
		Minor updates to the x86 instruction decoding.
20050420	Renaming x86 register name indices from R_xx to X86_R_xx (this
		makes building on Tru64 nicer).
20050422	Adding a check for duplicate MIPS TLB entries on tlbwr/tlbwi.
20050427	Adding screenshots to guestoses.html.
		Some minor fixes and testing for the next release.

==============  RELEASE 0.3.2  ==============


1 #ifndef DEVICES_H
2 #define DEVICES_H
3
4 /*
5 * Copyright (C) 2003-2005 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.162 2005/04/11 20:44:40 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
47 /* #ifdef WITH_X11
48 #include <X11/Xlib.h>
49 #endif */
50
51
52 /* dev_dec_ioasic.c: */
53 #define DEV_DEC_IOASIC_LENGTH 0x80100
54 #define N_DEC_IOASIC_REGS (0x1f0 / 0x10)
55 #define MAX_IOASIC_DMA_FUNCTIONS 8
56 struct dec_ioasic_data {
57 uint32_t reg[N_DEC_IOASIC_REGS];
58 int (*(dma_func[MAX_IOASIC_DMA_FUNCTIONS]))(struct cpu *, void *, uint64_t addr, size_t dma_len, int tx);
59 void *dma_func_extra[MAX_IOASIC_DMA_FUNCTIONS];
60 int rackmount_flag;
61 };
62 int dev_dec_ioasic_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
63 struct dec_ioasic_data *dev_dec_ioasic_init(struct cpu *cpu, struct memory *mem, uint64_t baseaddr, int rackmount_flag);
64
65 /* dev_asc.c: */
66 #define DEV_ASC_DEC_LENGTH 0x40000
67 #define DEV_ASC_PICA_LENGTH 0x1000
68 #define DEV_ASC_DEC 1
69 #define DEV_ASC_PICA 2
70 int dev_asc_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
71 void dev_asc_init(struct machine *machine, struct memory *mem, uint64_t baseaddr,
72 int irq_nr, void *turbochannel, int mode,
73 size_t (*dma_controller)(void *dma_controller_data,
74 unsigned char *data, size_t len, int writeflag),
75 void *dma_controller_data);
76
77 /* dev_au1x00.c: */
78 struct au1x00_ic_data {
79 int ic_nr;
80 uint32_t request0_int;
81 uint32_t request1_int;
82 uint32_t config0;
83 uint32_t config1;
84 uint32_t config2;
85 uint32_t source;
86 uint32_t assign_request;
87 uint32_t wakeup;
88 uint32_t mask;
89 };
90
91 int dev_au1x00_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
92 struct au1x00_ic_data *dev_au1x00_init(struct machine *machine, struct memory *mem);
93
94 /* dev_bt431.c: */
95 #define DEV_BT431_LENGTH 0x20
96 #define DEV_BT431_NREGS 0x800 /* ? */
97 int dev_bt431_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
98 struct vfb_data;
99 void dev_bt431_init(struct memory *mem, uint64_t baseaddr, struct vfb_data *vfb_data, int color_fb_flag);
100
101 /* dev_bt455.c: */
102 #define DEV_BT455_LENGTH 0x20
103 int dev_bt455_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
104 struct vfb_data;
105 void dev_bt455_init(struct memory *mem, uint64_t baseaddr, struct vfb_data *vfb_data);
106
107 /* dev_bt459.c: */
108 #define DEV_BT459_LENGTH 0x20
109 #define DEV_BT459_NREGS 0x1000
110 #define BT459_PX 1 /* px[g] */
111 #define BT459_BA 2 /* cfb */
112 #define BT459_BBA 3 /* sfb */
113 int dev_bt459_access(struct cpu *cpu, struct memory *mem,
114 uint64_t relative_addr, unsigned char *data, size_t len,
115 int writeflag, void *);
116 struct vfb_data;
117 void dev_bt459_init(struct machine *machine, struct memory *mem,
118 uint64_t baseaddr, uint64_t baseaddr_irq, struct vfb_data *vfb_data,
119 int color_fb_flag, int irq_nr, int type);
120
121 /* dev_cons.c: */
122 #define DEV_CONS_ADDRESS 0x0000000010000000
123 #define DEV_CONS_LENGTH 0x0000000000000020
124 #define DEV_CONS_PUTGETCHAR 0x0000
125 #define DEV_CONS_HALT 0x0010
126 int dev_cons_access(struct cpu *cpu, struct memory *mem,
127 uint64_t relative_addr, unsigned char *data, size_t len,
128 int writeflag, void *);
129 int dev_cons_init(struct machine *machine, struct memory *mem,
130 uint64_t baseaddr, char *name, int irq_nr);
131
132 /* dev_colorplanemask.c: */
133 #define DEV_COLORPLANEMASK_LENGTH 0x0000000000000010
134 int dev_colorplanemask_access(struct cpu *cpu, struct memory *mem,
135 uint64_t relative_addr, unsigned char *data, size_t len,
136 int writeflag, void *);
137 void dev_colorplanemask_init(struct memory *mem, uint64_t baseaddr,
138 unsigned char *color_plane_mask);
139
140 /* dev_dc7085.c: */
141 #define DEV_DC7085_LENGTH 0x0000000000000080
142 /* see dc7085.h for more info */
143 void dev_dc7085_tick(struct cpu *cpu, void *);
144 int dev_dc7085_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
145 int dev_dc7085_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, int use_fb);
146
147 /* dev_dec5800.c: */
148 #define DEV_DEC5800_LENGTH 0x1000 /* ? */
149 struct dec5800_data {
150 uint32_t csr;
151 uint32_t vector_0x50;
152 };
153 int dev_dec5800_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
154 struct dec5800_data *dev_dec5800_init(struct machine *machine, struct memory *mem, uint64_t baseaddr);
155 /* 16 slots, 0x2000 bytes each */
156 #define DEV_DECBI_LENGTH 0x20000
157 int dev_decbi_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
158 void dev_decbi_init(struct memory *mem, uint64_t baseaddr);
159 #define DEV_DECCCA_LENGTH 0x10000 /* ? */
160 #define DEC_DECCCA_BASEADDR 0x19000000 /* ? I just made this up */
161 int dev_deccca_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
162 void dev_deccca_init(struct memory *mem, uint64_t baseaddr);
163 #define DEV_DECXMI_LENGTH 0x800000
164 int dev_decxmi_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
165 void dev_decxmi_init(struct memory *mem, uint64_t baseaddr);
166
167 /* dev_fb.c: */
168 #define DEV_FB_LENGTH 0x3c0000 /* 3c0000 to not colide with turbochannel rom, otherwise size = (4*1024*1024) */
169 #define VFB_GENERIC 0
170 #define VFB_HPCMIPS 1
171 #define VFB_DEC_VFB01 2
172 #define VFB_DEC_VFB02 3
173 #define VFB_DEC_MAXINE 4
174 #define VFB_PLAYSTATION2 5
175 struct vfb_data {
176 int vfb_type;
177
178 int vfb_scaledown;
179
180 int xsize;
181 int ysize;
182 int bit_depth;
183 int color32k;
184
185 unsigned char color_plane_mask;
186
187 int bytes_per_line; /* cached */
188
189 int visible_xsize;
190 int visible_ysize;
191
192 size_t framebuffer_size;
193 int x11_xsize, x11_ysize;
194
195 int update_x1, update_y1, update_x2, update_y2;
196
197 /* RGB palette for <= 8 bit modes: (r,g,b bytes for each) */
198 unsigned char rgb_palette[256 * 3];
199
200 /* These should always be in sync: */
201 unsigned char *framebuffer;
202 struct fb_window *fb_window;
203 };
204 #define VFB_MFB_BT455 0x100000
205 #define VFB_MFB_BT431 0x180000
206 #define VFB_MFB_VRAM 0x200000
207 #define VFB_CFB_BT459 0x200000
208 void set_grayscale_palette(struct vfb_data *d, int ncolors);
209 void dev_fb_setcursor(struct vfb_data *d, int cursor_x, int cursor_y, int on,
210 int cursor_xsize, int cursor_ysize);
211 void framebuffer_blockcopyfill(struct vfb_data *d, int fillflag, int fill_r,
212 int fill_g, int fill_b, int x1, int y1, int x2, int y2,
213 int from_x, int from_y);
214 void dev_fb_tick(struct cpu *, void *);
215 int dev_fb_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
216 struct vfb_data *dev_fb_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int vfb_type,
217 int visible_xsize, int visible_ysize, int xsize, int ysize, int bit_depth, char *name, int logo);
218
219 /* dev_gt.c: */
220 #define DEV_GT_LENGTH 0x0000000000001000
221 int dev_gt_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
222 struct pci_data *dev_gt_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, int pciirq);
223
224 /* dev_jazz.c: */
225 #define DEV_JAZZ_LENGTH 0x280
226 struct jazz_data {
227 struct cpu *cpu;
228
229 /* Jazz stuff: */
230 uint32_t int_enable_mask;
231 uint32_t int_asserted;
232
233 /* ISA stuff: */
234 uint32_t isa_int_enable_mask;
235 uint32_t isa_int_asserted;
236
237 int interval;
238 int interval_start;
239
240 int jazz_timer_value;
241 int jazz_timer_current;
242
243 uint64_t dma_translation_table_base;
244 uint64_t dma_translation_table_limit;
245
246 uint32_t dma0_mode;
247 uint32_t dma0_enable;
248 uint32_t dma0_count;
249 uint32_t dma0_addr;
250
251 uint32_t dma1_mode;
252 /* same for dma1,2,3 actually (TODO) */
253
254 int led;
255 };
256 size_t dev_jazz_dma_controller(void *dma_controller_data,
257 unsigned char *data, size_t len, int writeflag);
258
259 /* dev_kn01.c: */
260 #define DEV_KN01_CSR_LENGTH 0x0000000000000004
261 int dev_kn01_csr_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
262 void dev_kn01_csr_init(struct memory *mem, uint64_t baseaddr, int color_fb);
263 #define DEV_VDAC_LENGTH 0x20
264 #define DEV_VDAC_MAPWA 0x00
265 #define DEV_VDAC_MAP 0x04
266 #define DEV_VDAC_MASK 0x08
267 #define DEV_VDAC_MAPRA 0x0c
268 #define DEV_VDAC_OVERWA 0x10
269 #define DEV_VDAC_OVER 0x14
270 #define DEV_VDAC_OVERRA 0x1c
271 int dev_vdac_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
272 void dev_vdac_init(struct memory *mem, uint64_t baseaddr, unsigned char *rgb_palette, int color_fb_flag);
273
274 /* dev_kn02.c: */
275 struct kn02_csr {
276 uint8_t csr[sizeof(uint32_t)];
277 uint8_t filler[4096 - sizeof(uint32_t)]; /* for bintrans mapping */
278 };
279 int dev_kn02_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
280 struct kn02_csr *dev_kn02_init(struct cpu *cpu, struct memory *mem,
281 uint64_t baseaddr);
282
283 /* dev_kn220.c: */
284 #define DEV_DEC5500_IOBOARD_LENGTH 0x100000
285 int dev_dec5500_ioboard_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
286 struct dec5500_ioboard_data *dev_dec5500_ioboard_init(struct cpu *cpu, struct memory *mem, uint64_t baseaddr);
287 #define DEV_SGEC_LENGTH 0x1000
288 int dev_sgec_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
289 void dev_sgec_init(struct memory *mem, uint64_t baseaddr, int irq_nr);
290
291 /* dev_kn230.c: */
292 struct kn230_csr {
293 uint32_t csr;
294 };
295
296 /* dev_le.c: */
297 #define DEV_LE_LENGTH 0x1c0200
298 int dev_le_access(struct cpu *cpu, struct memory *mem,
299 uint64_t relative_addr, unsigned char *data, size_t len,
300 int writeflag, void *);
301 void dev_le_init(struct machine *machine, struct memory *mem,
302 uint64_t baseaddr, uint64_t buf_start, uint64_t buf_end,
303 int irq_nr, int len);
304
305 /* dev_m700_fb.c: */
306 #define DEV_M700_FB_LENGTH 0x10000 /* TODO? */
307 int dev_m700_fb_access(struct cpu *cpu, struct memory *mem,
308 uint64_t relative_addr, unsigned char *data, size_t len,
309 int writeflag, void *);
310 void dev_m700_fb_init(struct machine *machine, struct memory *mem,
311 uint64_t baseaddr, uint64_t baseaddr2);
312
313 /* dev_ns16550.c: */
314 #define DEV_NS16550_LENGTH 0x0000000000000008
315 /* see comreg.h and ns16550reg.h for more info */
316 int dev_ns16550_access(struct cpu *cpu, struct memory *mem,
317 uint64_t relative_addr, unsigned char *data, size_t len,
318 int writeflag, void *);
319 int dev_ns16550_init(struct machine *machine, struct memory *mem,
320 uint64_t baseaddr, int irq_nr, int addrmult, int in_use, char *name);
321
322 /* dev_mc146818.c: */
323 #define DEV_MC146818_LENGTH 0x0000000000000100
324 #define MC146818_DEC 0
325 #define MC146818_PC_CMOS 1
326 #define MC146818_ARC_NEC 2
327 #define MC146818_ARC_JAZZ 3
328 #define MC146818_SGI 4
329 /* see mc146818reg.h for more info */
330 void dev_mc146818_tick(struct cpu *cpu, void *);
331 int dev_mc146818_access(struct cpu *cpu, struct memory *mem,
332 uint64_t relative_addr, unsigned char *data, size_t len,
333 int writeflag, void *);
334 void dev_mc146818_init(struct machine *machine, struct memory *mem,
335 uint64_t baseaddr, int irq_nr, int access_style, int addrdiv);
336
337 /* dev_pckbc.c: */
338 #define DEV_PCKBC_LENGTH 0x10
339 #define PCKBC_8042 0
340 #define PCKBC_8242 1
341 #define PCKBC_JAZZ 3
342 int dev_pckbc_access(struct cpu *cpu, struct memory *mem,
343 uint64_t relative_addr, unsigned char *data, size_t len,
344 int writeflag, void *);
345 int dev_pckbc_init(struct machine *machine, struct memory *mem,
346 uint64_t baseaddr, int type, int keyboard_irqnr, int mouse_irqnr,
347 int in_use);
348
349 /* dev_pmppc.c: */
350 int dev_pmppc_board_access(struct cpu *cpu, struct memory *mem,
351 uint64_t relative_addr, unsigned char *data, size_t len, int writeflag,
352 void *);
353 void dev_pmppc_init(struct memory *mem);
354
355 /* dev_ps2_spd.c: */
356 #define DEV_PS2_SPD_LENGTH 0x800
357 int dev_ps2_spd_access(struct cpu *cpu, struct memory *mem,
358 uint64_t relative_addr, unsigned char *data, size_t len,
359 int writeflag, void *);
360 void dev_ps2_spd_init(struct machine *machine, struct memory *mem,
361 uint64_t baseaddr);
362
363 /* dev_ps2_stuff.c: */
364 #include "ps2_dmacreg.h"
365 #define N_PS2_DMA_CHANNELS 10
366 #define N_PS2_TIMERS 4
367 struct ps2_data {
368 uint32_t timer_count[N_PS2_TIMERS];
369 uint32_t timer_comp[N_PS2_TIMERS];
370 uint32_t timer_mode[N_PS2_TIMERS];
371 uint32_t timer_hold[N_PS2_TIMERS]; /* NOTE: only 0 and 1 are valid */
372
373 uint64_t dmac_reg[DMAC_REGSIZE / 0x10];
374
375 uint64_t other_memory_base[N_PS2_DMA_CHANNELS];
376
377 uint32_t intr;
378 uint32_t imask;
379 uint32_t sbus_smflg;
380 };
381 #define DEV_PS2_STUFF_LENGTH 0x10000
382 int dev_ps2_stuff_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
383 struct ps2_data *dev_ps2_stuff_init(struct machine *machine, struct memory *mem, uint64_t baseaddr);
384
385 /* dev_pmagja.c: */
386 #define DEV_PMAGJA_LENGTH 0x3c0000
387 int dev_pmagja_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
388 void dev_pmagja_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr);
389
390 /* dev_px.c: */
391 struct px_data {
392 struct memory *fb_mem;
393 struct vfb_data *vfb_data;
394 int type;
395 char *px_name;
396 int irq_nr;
397 int bitdepth;
398 int xconfig;
399 int yconfig;
400
401 uint32_t intr;
402 unsigned char sram[128 * 1024];
403 };
404 /* TODO: perhaps these types are wrong? */
405 #define DEV_PX_TYPE_PX 0
406 #define DEV_PX_TYPE_PXG 1
407 #define DEV_PX_TYPE_PXGPLUS 2
408 #define DEV_PX_TYPE_PXGPLUSTURBO 3
409 #define DEV_PX_LENGTH 0x3c0000
410 int dev_px_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
411 void dev_px_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int px_type, int irq_nr);
412
413 /* dev_ram.c: */
414 #define DEV_RAM_RAM 0
415 #define DEV_RAM_MIRROR 1
416 int dev_ram_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
417 void dev_ram_init(struct memory *mem, uint64_t baseaddr, uint64_t length, int mode, uint64_t otheraddr);
418
419 /* dev_scc.c: */
420 #define DEV_SCC_LENGTH 0x1000
421 int dev_scc_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
422 int dev_scc_dma_func(struct cpu *cpu, void *extra, uint64_t addr, size_t dma_len, int tx);
423 void *dev_scc_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, int use_fb, int scc_nr, int addrmul);
424
425 /* dev_sfb.c: */
426 #define DEV_SFB_LENGTH 0x400000
427 int dev_sfb_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
428 void dev_sfb_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, struct vfb_data *vfb_data);
429
430 /* dev_sgi_gbe.c: */
431 #define DEV_SGI_GBE_LENGTH 0x1000000
432 int dev_sgi_gbe_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
433 void dev_sgi_gbe_init(struct machine *machine, struct memory *mem, uint64_t baseaddr);
434
435 /* dev_sgi_ip20.c: */
436 #define DEV_SGI_IP20_LENGTH 0x40
437 #define DEV_SGI_IP20_BASE 0x1fb801c0
438 struct sgi_ip20_data {
439 int dummy;
440 };
441 int dev_sgi_ip20_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
442 struct sgi_ip20_data *dev_sgi_ip20_init(struct cpu *cpu, struct memory *mem, uint64_t baseaddr);
443
444 /* dev_sgi_ip22.c: */
445 #define DEV_SGI_IP22_LENGTH 0x100
446 #define DEV_SGI_IP22_IMC_LENGTH 0x100
447 #define DEV_SGI_IP22_UNKNOWN2_LENGTH 0x100
448 #define IP22_IMC_BASE 0x1fa00000
449 #define IP22_UNKNOWN2_BASE 0x1fb94000
450 struct sgi_ip22_data {
451 int guiness_flag;
452 uint32_t reg[DEV_SGI_IP22_LENGTH / 4];
453 uint32_t imc_reg[DEV_SGI_IP22_IMC_LENGTH / 4];
454 uint32_t unknown2_reg[DEV_SGI_IP22_UNKNOWN2_LENGTH / 4];
455 uint32_t unknown_timer;
456 };
457 int dev_sgi_ip22_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
458 struct sgi_ip22_data *dev_sgi_ip22_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int guiness_flag);
459
460 /* dev_sgi_ip30.c: */
461 #define DEV_SGI_IP30_LENGTH 0x80000
462 struct sgi_ip30_data {
463 /* ip30: */
464 uint64_t imask0; /* 0x10000 */
465 uint64_t reg_0x10018;
466 uint64_t isr; /* 0x10030 */
467 uint64_t reg_0x20000;
468 uint64_t reg_0x30000;
469
470 /* ip30_2: */
471 uint64_t reg_0x0029c;
472
473 /* ip30_3: */
474 uint64_t reg_0x00284;
475
476 /* ip30_4: */
477 uint64_t reg_0x000b0;
478
479 /* ip30_5: */
480 uint64_t reg_0x00000;
481 };
482 int dev_sgi_ip30_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
483 struct sgi_ip30_data *dev_sgi_ip30_init(struct machine *machine, struct memory *mem, uint64_t baseaddr);
484
485 /* dev_sgi_ip32.c: */
486 #define DEV_CRIME_LENGTH 0x0000000000001000
487 struct crime_data {
488 unsigned char reg[DEV_CRIME_LENGTH];
489 int irq_nr;
490 int use_fb;
491 };
492 int dev_crime_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
493 struct crime_data *dev_crime_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, int use_fb);
494 #define DEV_MACE_LENGTH 0x100
495 struct mace_data {
496 unsigned char reg[DEV_MACE_LENGTH];
497 int irqnr;
498 };
499 int dev_mace_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
500 struct mace_data *dev_mace_init(struct memory *mem, uint64_t baseaddr, int irqnr);
501 #define DEV_MACEPCI_LENGTH 0x1000
502 int dev_macepci_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
503 struct pci_data *dev_macepci_init(struct memory *mem, uint64_t baseaddr, int pciirq);
504 #define DEV_SGI_MEC_LENGTH 0x1000
505 int dev_sgi_mec_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
506 void dev_sgi_mec_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, unsigned char *macaddr);
507 #define DEV_SGI_UST_LENGTH 0x10000
508 int dev_sgi_ust_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
509 void dev_sgi_ust_init(struct memory *mem, uint64_t baseaddr);
510 #define DEV_SGI_MTE_LENGTH 0x10000
511 int dev_sgi_mte_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
512 void dev_sgi_mte_init(struct memory *mem, uint64_t baseaddr);
513
514 /* dev_sii.c: */
515 #define DEV_SII_LENGTH 0x100
516 void dev_sii_tick(struct cpu *cpu, void *);
517 int dev_sii_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
518 void dev_sii_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, uint64_t buf_start, uint64_t buf_end, int irq_nr);
519
520 /* dev_ssc.c: */
521 #define DEV_SSC_LENGTH 0x1000
522 int dev_ssc_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
523 void dev_ssc_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, int use_fb, uint32_t *);
524
525 /* dev_turbochannel.c: */
526 #define DEV_TURBOCHANNEL_LEN 0x0470
527 int dev_turbochannel_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
528 void dev_turbochannel_init(struct machine *machine, struct memory *mem, int slot_nr, uint64_t baseaddr, uint64_t endaddr, char *device_name, int irq);
529
530 /* dev_vga.c: */
531 int dev_vga_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr,
532 unsigned char *data, size_t len, int writeflag, void *);
533 void dev_vga_init(struct machine *machine, struct memory *mem,
534 uint64_t videomem_base, uint64_t control_base, int max_x, int max_y,
535 char *name);
536
537 /* dev_vr41xx.c: */
538 #define DEV_VR41XX_LENGTH 0x800 /* TODO? */
539 struct vr41xx_data {
540 int cpumodel;
541
542 int kiu_console_handle;
543 int kiu_offset;
544 int kiu_irq_nr;
545 int kiu_int_assert;
546 int d0;
547 int d1;
548 int d2;
549 int d3;
550 int d4;
551 int d5;
552 int dont_clear_next;
553 int escape_state;
554
555 /* See icureg.h in NetBSD for more info. */
556 uint16_t sysint1;
557 uint16_t msysint1;
558 uint16_t giuint;
559 uint16_t giumask;
560 uint16_t sysint2;
561 uint16_t msysint2;
562 };
563
564 int dev_vr41xx_access(struct cpu *cpu, struct memory *mem,
565 uint64_t relative_addr, unsigned char *data, size_t len,
566 int writeflag, void *);
567 struct vr41xx_data *dev_vr41xx_init(struct machine *machine,
568 struct memory *mem, int cpumodel);
569
570 /* dev_wdc.c: */
571 #define DEV_WDC_LENGTH 0x8
572 int dev_wdc_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
573 void dev_wdc_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int irq_nr, int base_drive);
574
575 /* dev_wdsc.c: */
576 #define DEV_WDSC_NREGS 0x100 /* 8-bit register select */
577 #define DEV_WDSC_LENGTH 0x10
578 int dev_wdsc_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr, unsigned char *data, size_t len, int writeflag, void *);
579 void dev_wdsc_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, int controller_nr, int irq_nr);
580
581 /* dev_zs.c: */
582 #define DEV_ZS_LENGTH 0x10
583 int dev_zs_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr,
584 unsigned char *data, size_t len, int writeflag, void *);
585 int dev_zs_init(struct machine *machine, struct memory *mem, uint64_t baseaddr,
586 int irq_nr, int addrmult, char *name);
587
588 /* lk201.c: */
589 struct lk201_data {
590 int use_fb;
591 int console_handle;
592
593 void (*add_to_rx_queue)(void *,int,int);
594 void *add_data;
595
596 unsigned char keyb_buf[8];
597 int keyb_buf_pos;
598
599 int mouse_mode;
600 int mouse_revision; /* 0..15 */
601 int mouse_x, mouse_y, mouse_buttons;
602
603 int old_host_mouse_x;
604 int old_host_mouse_y;
605 int old_host_mouse_stays_put;
606 int mouse_check_interval;
607 int mouse_check_interval_reset;
608 };
609 void lk201_tick(struct lk201_data *);
610 void lk201_tx_data(struct lk201_data *, int port, int idata);
611 void lk201_init(struct lk201_data *d, int use_fb,
612 void (*add_to_rx_queue)(void *,int,int), int console_handle, void *);
613
614
615 #endif /* DEVICES_H */
616

  ViewVC Help
Powered by ViewVC 1.1.26