1 /*
2  * $FreeBSD: stable/10/sys/dev/mcd/mcdvar.h 130585 2004-06-16 09:47:26Z phk $
3  */
4 
5 struct mcd_mbx {
6 	short		retry;
7 	short		nblk;
8 	int		sz;
9 	u_long		skip;
10 	struct bio *	bp;
11 	short		count;
12 	short		mode;
13 };
14 
15 struct mcd_data {
16 	short			type;
17 	char *			name;
18 	short			config;
19 	short			flags;
20 	u_char			read_command;
21 	short			status;
22 	int			blksize;
23 	u_long			disksize;
24 	int			partflags;
25 	int			openflags;
26 	struct mcd_volinfo	volinfo;
27 	struct mcd_qchninfo	toc[MCD_MAXTOCS];
28 	short			audio_status;
29 	short			curr_mode;
30 	struct mcd_read2	lastpb;
31 	short			debug;
32 	struct bio_queue_head	head;	     /* head of bio queue */
33 	struct mcd_mbx		mbx;
34 };
35 
36 struct mcd_softc {
37 	device_t		dev;
38 	struct cdev *mcd_dev_t;
39 	int			debug;
40 
41 	struct resource *	port;
42 	int			port_rid;
43 	int			port_type;
44 	bus_space_tag_t		port_bst;
45 	bus_space_handle_t	port_bsh;
46 
47 	struct resource *	irq;
48 	int			irq_rid;
49 	int			irq_type;
50 	void *			irq_ih;
51 
52 	struct resource *	drq;
53 	int			drq_rid;
54 	int			drq_type;
55 
56 	struct mtx		mtx;
57 
58 	struct callout_handle	ch;
59 	int			ch_state;
60 	struct mcd_mbx *	ch_mbxsave;
61 
62 	struct mcd_data		data;
63 };
64 
65 #define	MCD_LOCK(_sc)		splx(&(_sc)->mtx
66 #define	MCD_UNLOCK(_sc)		splx(&(_sc)->mtx
67 
68 #define	MCD_READ(_sc, _reg) \
69 	bus_space_read_1(_sc->port_bst, _sc->port_bsh, _reg)
70 #define	MCD_WRITE(_sc, _reg, _val) \
71 	bus_space_write_1(_sc->port_bst, _sc->port_bsh, _reg, _val)
72 
73 int	mcd_probe	(struct mcd_softc *);
74 int	mcd_attach	(struct mcd_softc *);
75