xref: /openbsd/sys/arch/luna88k/cbus/cbusvar.h (revision aec57fdb)
1 /*	$OpenBSD: cbusvar.h,v 1.6 2024/06/01 00:48:16 aoyama Exp $	*/
2 
3 /*
4  * Copyright (c) 2014 Kenji Aoyama.
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /*
20  * PC-9801 extension board slot bus ('C-bus') driver for LUNA-88K2.
21  */
22 
23 #include <sys/evcount.h>
24 #include <sys/queue.h>
25 
26 #include <arch/luna88k/include/board.h>
27 
28 #define	PCEXMEM_BASE	PC_BASE
29 #define	PCEXIO_BASE	(PC_BASE + 0x1000000)
30 
31 /*
32  * Currently 7 level C-bus interrupts (INT0 - INT6) are supported.
33  */
34 #define NCBUSISR	7
35 
36 /*
37  * C-bus interrupt handler
38  */
39 struct cbus_isr_t {
40 	int		(*isr_func)(void *);
41 	void		*isr_arg;
42 	int		isr_intlevel;
43 	int		isr_ipl;
44 	struct evcount	isr_count;
45 };
46 
47 int	cbus_isrlink(int (*)(void *), void *, int, int, const char *);
48 int	cbus_isrunlink(int (*)(void *), int);
49 u_int8_t	cbus_intr_registered(void);
50 
51 struct cbus_attach_args {
52 	char		*ca_name;
53 	u_int32_t	ca_iobase;
54 	u_int32_t	ca_iosize;
55 	u_int32_t	ca_maddr;
56 	u_int32_t	ca_msize;
57 	u_int32_t	ca_int;
58 };
59 
60 #define	cf_iobase	cf_loc[0]
61 #define	cf_iosize	cf_loc[1]
62 #define	cf_maddr	cf_loc[2]
63 #define	cf_msize	cf_loc[3]
64 #define	cf_int		cf_loc[4]
65