xref: /original-bsd/sys/luna68k/dev/device.h (revision 3705696b)
1 /*
2  * Copyright (c) 1982, 1990, 1992, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)device.h	8.1 (Berkeley) 06/10/93
8  */
9 
10 struct driver {
11 	int	(*d_init)();
12 	char	*d_name;
13 	int	(*d_start)();
14 	int	(*d_go)();
15 	int	(*d_intr)();
16 	int	(*d_done)();
17 };
18 
19 struct hp_ctlr {
20 	struct driver	*hp_driver;
21 	int		hp_unit;
22 	int		hp_alive;
23 	char		*hp_addr;
24 	int		hp_flags;
25 	int		hp_ipl;
26 };
27 
28 struct hp_device {
29 	struct driver	*hp_driver;
30 	struct driver	*hp_cdriver;
31 	int		hp_unit;
32 	int		hp_ctlr;
33 	int		hp_slave;
34 	char		*hp_addr;
35 	int		hp_dk;
36 	int		hp_flags;
37 	int		hp_alive;
38 	int		hp_ipl;
39 };
40 
41 struct	devqueue {
42 	struct	devqueue *dq_forw;
43 	struct	devqueue *dq_back;
44 	int	dq_ctlr;
45 	int	dq_unit;
46 	int	dq_slave;
47 	struct	driver *dq_driver;
48 };
49 
50 #define	MAXCTLRS	16	/* Size of HW table (arbitrary) */
51 #define	MAXSLAVES	8	/* Slaves per controller (HPIB/SCSI limit) */
52 
53 struct hp_hw {
54 	caddr_t	hw_pa;		/* physical address of control space */
55 	int	hw_size;	/* size of control space */
56 	caddr_t	hw_kva;		/* kernel virtual address of control space */
57 	short	hw_id;		/* HW returned id */
58 	short	hw_secid;	/* secondary HW id (displays) */
59 	short	hw_type;	/* type (defined below) */
60 	short	hw_sc;		/* select code (if applicable) */
61 };
62 
63 /* bus types */
64 #define	B_MASK		0xE000
65 #define	B_DIO		0x2000
66 #define B_DIOII		0x4000
67 #define B_VME		0x6000
68 /* controller types */
69 #define	C_MASK		0x8F
70 #define C_FLAG		0x80
71 #define	C_HPIB		0x81
72 #define C_SCSI		0x82
73 #define C_VME		0x83
74 /* device types (controllers with no slaves) */
75 #define D_MASK		0x8F
76 #define	D_BITMAP	0x01
77 #define	D_LAN		0x02
78 #define	D_FPA		0x03
79 #define	D_KEYBOARD	0x04
80 #define	D_COMMDCA	0x05
81 #define	D_COMMDCM	0x06
82 #define	D_COMMDCL	0x07
83 #define	D_PPORT		0x08
84 #define	D_SIO		0x09
85 #define	D_BMC		0x0A
86 #define	D_MISC		0x7F
87 
88 #define HW_ISCTLR(hw)	((hw)->hw_type & C_FLAG)
89 #define HW_ISDIOII(hw)	((hw)->hw_type & B_DIOII)
90 #define HW_ISHPIB(hw)	(((hw)->hw_type & C_MASK) == C_HPIB)
91 #define HW_ISSCSI(hw)	(((hw)->hw_type & C_MASK) == C_SCSI)
92 #define HW_ISDEV(hw,d)	(((hw)->hw_type & D_MASK) == (d))
93 
94 #ifdef KERNEL
95 extern struct hp_hw sc_table[];
96 extern struct hp_ctlr hp_cinit[];
97 extern struct hp_device hp_dinit[];
98 extern caddr_t sctova(), sctopa(), iomap();
99 #endif
100