/[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 10 - (show annotations)
Mon Oct 8 16:18:27 2007 UTC (13 years, 3 months ago) by dpavlin
File MIME type: text/plain
File size: 25334 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.815 2005/06/27 23:04:35 debug Exp $
20050617	Experimenting some more with netbooting OpenBSD/sgi. Adding
		a hack which allows emulated ethernet networks to be
		distributed across multiple emulator processes.
20050618	Minor updates (documentation, dummy YAMON emulation, etc).
20050620	strcpy/strcat -> strlcpy/strlcat updates.
		Some more progress on evbmips (Malta).
20050621	Adding a section to doc/configfiles.html about ethernet
		emulation across multiple hosts.
		Beginning the work on the ARM translation engine (using the
		dynamic-but-not-binary translation method).
		Fixing a bintrans bug: 0x9fc00000 should always be treated as
		PROM area, just as 0xbfc00000 is.
		Minor progress on Malta emulation (the PCI-ISA bus).
20050622	NetBSD/evbmips can now be installed (using another emulated
		machine) and run (including userland and so on). :-)
		Spliting up the bintrans haddr_entry field into two (one for
		read, one for write). Probably not much of a speed increase,
		though.
		Updating some NetBSD 2.0 -> 2.0.2 in the documentation.
20050623	Minor updates (documentation, the TODO file, etc).
		gzipped kernels are now always automagically gunzipped when
		loaded.
20050624	Adding a dummy Playstation Portable (PSP) mode, just barely
		enough to run Hello World (in weird colors :-).
		Removing the -b command line option; old bintrans is enabled
		by default instead. It makes more sense.
		Trying to finally fix the non-working performance measurement
		thing (instr/second etc).
20050625	Continuing on the essential basics for ARM emulation. Two
		instructions seem to work, a branch and a simple "mov". (The
		mov arguments are not correct yet.) Performance is definitely
		reasonable.
		Various other minor updates.
		Adding the ARM "bl" instruction.
		Adding support for combining multiple ARM instructions into one
		function call. ("mov" + "mov" is the only one implemented so
		far, but it seems to work.)
		Cleaning up some IP32 interrupt things (crime/mace); disabling
		the PS/2 keyboard controller on IP32, so that NetBSD/sgimips
		boots into userland again.
20050626	Finally! NetBSD/sgimips netboots. Adding instructions to
		doc/guestoses.html on how to set up an nfs server etc.
		Various other minor fixes.
		Playstation Portable ".pbp" files can now be used directly.
		(The ELF part of the .pbp is extracted transparently.)
		Converting some sprintf -> snprintf.
		Adding some more instructions to the ARM disassembler.
20050627	More ARM updates. Adding some simple ldr(b), str(b),
		cmps, and conditional branch instructions, enough to run
		a simple Hello World program.
		All ARM instructions are now inlined/generated for all possible
		condition codes.
		Adding add and sub, and more load/store instructions.
		Removing dummy files: cpu_alpha.c, cpu_hppa.c, and cpu_sparc.c.
		Some minor documentation updates; preparing for a 0.3.4
		release. Updating some URLs.

==============  RELEASE 0.3.4  ==============


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

  ViewVC Help
Powered by ViewVC 1.1.26