summaryrefslogtreecommitdiffstats
path: root/sys/dev/mcd/mcdvar.h
blob: adfd4a4f419117a7e4939ee5738ecfb45d7e015d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
 * $FreeBSD$
 */

struct mcd_mbx {
	short		retry;
	short		nblk;
	int		sz;
	u_long		skip;
	struct bio *	bp;
	short		count;
	short		mode;
};

struct mcd_data {
	short			type;
	char *			name;
	short			config;
	short			flags;
	u_char			read_command;
	short			status;
	int			blksize;
	u_long			disksize;
	int			partflags;
	int			openflags;
	struct mcd_volinfo	volinfo;   
	struct mcd_qchninfo	toc[MCD_MAXTOCS]; 
	short			audio_status;
	short			curr_mode;
	struct mcd_read2	lastpb;
	short			debug;
	struct bio_queue_head	head;	     /* head of bio queue */
	struct mcd_mbx		mbx;
};

struct mcd_softc {
	device_t		dev;
	struct cdev *mcd_dev_t;
	int			debug;

	struct resource *	port;
	int			port_rid;
	int			port_type;
	bus_space_tag_t		port_bst;
	bus_space_handle_t	port_bsh;

	struct resource *	irq;
	int			irq_rid;
	int			irq_type;
	void *			irq_ih;

	struct resource *	drq;
	int			drq_rid;
	int			drq_type;

	struct mtx		mtx;

	struct callout_handle	ch;
	int			ch_state;
	struct mcd_mbx *	ch_mbxsave;

	struct mcd_data		data;
};

#define	MCD_LOCK(_sc)		splx(&(_sc)->mtx
#define	MCD_UNLOCK(_sc)		splx(&(_sc)->mtx

#define	MCD_READ(_sc, _reg) \
	bus_space_read_1(_sc->port_bst, _sc->port_bsh, _reg)
#define	MCD_WRITE(_sc, _reg, _val) \
	bus_space_write_1(_sc->port_bst, _sc->port_bsh, _reg, _val)

int	mcd_probe	(struct mcd_softc *);
int	mcd_attach	(struct mcd_softc *);
OpenPOWER on IntegriCloud