xref: /onnv-gate/usr/src/uts/common/sys/pcmcia/pcata.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef _SYS_PCATA_H
28*0Sstevel@tonic-gate #define	_SYS_PCATA_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef	__cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #define	FALSE	0
37*0Sstevel@tonic-gate #define	TRUE	1
38*0Sstevel@tonic-gate 
39*0Sstevel@tonic-gate #if defined(DEBUG)
40*0Sstevel@tonic-gate #define	ATA_DEBUG 	1
41*0Sstevel@tonic-gate #endif	/* defined(DEBUG) */
42*0Sstevel@tonic-gate 
43*0Sstevel@tonic-gate /*
44*0Sstevel@tonic-gate  * port offsets from base address ioaddr1
45*0Sstevel@tonic-gate  */
46*0Sstevel@tonic-gate #define	AT_DATA		0x00	/* data register			*/
47*0Sstevel@tonic-gate #define	AT_ERROR	0x01	/* error register (read)		*/
48*0Sstevel@tonic-gate #define	AT_FEATURE	0x01	/* feature (write)			*/
49*0Sstevel@tonic-gate #define	AT_COUNT	0x02	/* sector count				*/
50*0Sstevel@tonic-gate #define	AT_SECT		0x03	/* sector number			*/
51*0Sstevel@tonic-gate #define	AT_LCYL		0x04	/* cylinder low byte			*/
52*0Sstevel@tonic-gate #define	AT_HCYL		0x05	/* cylinder high byte			*/
53*0Sstevel@tonic-gate #define	AT_DRVHD	0x06	/* drive/head register			*/
54*0Sstevel@tonic-gate #define	AT_STATUS	0x07	/* status/command register		*/
55*0Sstevel@tonic-gate #define	AT_CMD		0x07	/* status/command register		*/
56*0Sstevel@tonic-gate 
57*0Sstevel@tonic-gate /*
58*0Sstevel@tonic-gate  * port offsets from base address ioaddr2
59*0Sstevel@tonic-gate  */
60*0Sstevel@tonic-gate #define	AT_ALTSTATUS	0x0E	/* alternate status (read)		*/
61*0Sstevel@tonic-gate #define	AT_DEVCTL	0x0E	/* device control (write)		*/
62*0Sstevel@tonic-gate #define	AT_DRVADDR	0x0F	/* drive address (read)			*/
63*0Sstevel@tonic-gate 
64*0Sstevel@tonic-gate 
65*0Sstevel@tonic-gate /*
66*0Sstevel@tonic-gate  *	Device control register
67*0Sstevel@tonic-gate  */
68*0Sstevel@tonic-gate 
69*0Sstevel@tonic-gate #define	AT_NIEN		0x02	/* disable interrupts			*/
70*0Sstevel@tonic-gate #define	AT_SRST		0x04	/* controller reset			*/
71*0Sstevel@tonic-gate #define	AT_DEVCTL_D3	0x08	/* bit 3 is always set, see spec */
72*0Sstevel@tonic-gate 
73*0Sstevel@tonic-gate #define	ENABLE_INTERRUPT	AT_DEVCTL_D3	/* clear AT_NIEN bit 	*/
74*0Sstevel@tonic-gate #define	DISABLE_INTERRUPT	AT_DEVCTL_D3|AT_NIEN
75*0Sstevel@tonic-gate 
76*0Sstevel@tonic-gate /*
77*0Sstevel@tonic-gate  * Status bits from AT_STATUS register
78*0Sstevel@tonic-gate  */
79*0Sstevel@tonic-gate #define	ATS_BSY		0x80	/* controller busy			*/
80*0Sstevel@tonic-gate #define	ATS_DRDY	0x40	/* drive ready				*/
81*0Sstevel@tonic-gate #define	ATS_DWF		0x20	/* write fault				*/
82*0Sstevel@tonic-gate #define	ATS_DSC		0x10	/* seek operation complete		*/
83*0Sstevel@tonic-gate #define	ATS_DRQ		0x08	/* data request				*/
84*0Sstevel@tonic-gate #define	ATS_CORR	0x04	/* ECC correction applied		*/
85*0Sstevel@tonic-gate #define	ATS_IDX		0x02	/* disk revolution index		*/
86*0Sstevel@tonic-gate #define	ATS_ERR		0x01	/* error flag				*/
87*0Sstevel@tonic-gate 
88*0Sstevel@tonic-gate /*
89*0Sstevel@tonic-gate  * Status bits from AT_ERROR register
90*0Sstevel@tonic-gate  */
91*0Sstevel@tonic-gate #define	ATE_AMNF	0x01	/* address mark not found		*/
92*0Sstevel@tonic-gate #define	ATE_TKONF	0x02	/* track 0 not found			*/
93*0Sstevel@tonic-gate #define	ATE_ABORT	0x04	/* aborted command			*/
94*0Sstevel@tonic-gate #define	ATE_IDNF	0x10	/* ID not found				*/
95*0Sstevel@tonic-gate #define	ATE_UNC		0x40	/* uncorrectable data error		*/
96*0Sstevel@tonic-gate #define	ATE_BBK		0x80	/* bad block detected			*/
97*0Sstevel@tonic-gate 
98*0Sstevel@tonic-gate /*
99*0Sstevel@tonic-gate  * Drive selectors for AT_DRVHD register
100*0Sstevel@tonic-gate  */
101*0Sstevel@tonic-gate #define	ATDH_DRIVE0	0xa0	/* or into AT_DRVHD to select drive 0	*/
102*0Sstevel@tonic-gate #define	ATDH_DRIVE1	0xb0	/* or into AT_DRVHD to select drive 1	*/
103*0Sstevel@tonic-gate 
104*0Sstevel@tonic-gate /*
105*0Sstevel@tonic-gate  * ATA commands.
106*0Sstevel@tonic-gate  */
107*0Sstevel@tonic-gate #define	ATC_DIAG	0x90	/* diagnose command			*/
108*0Sstevel@tonic-gate #define	ATC_RECAL	0x10	/* restore cmd, bottom 4 bits step rate	*/
109*0Sstevel@tonic-gate #define	ATC_SEEK	0x70	/* seek cmd, bottom 4 bits step rate	*/
110*0Sstevel@tonic-gate #define	ATC_RDVER	0x40	/* read verify cmd			*/
111*0Sstevel@tonic-gate #define	ATC_RDSEC	0x20	/* read sector cmd			*/
112*0Sstevel@tonic-gate #define	ATC_RDLONG	0x23	/* read long without retry		*/
113*0Sstevel@tonic-gate #define	ATC_WRSEC	0x30	/* write sector cmd			*/
114*0Sstevel@tonic-gate #define	ATC_SETMULT	0xc6	/* set multiple mode			*/
115*0Sstevel@tonic-gate #define	ATC_RDMULT	0xc4	/* read multiple			*/
116*0Sstevel@tonic-gate #define	ATC_WRMULT	0xc5	/* write multiple			*/
117*0Sstevel@tonic-gate #define	ATC_FORMAT	0x50	/* format track command			*/
118*0Sstevel@tonic-gate #define	ATC_SETPARAM	0x91	/* set parameters command		*/
119*0Sstevel@tonic-gate #define	ATC_READPARMS	0xec	/* Read Parameters command		*/
120*0Sstevel@tonic-gate #define	ATC_READDEFECTS	0xa0	/* Read defect list			*/
121*0Sstevel@tonic-gate #define	ATC_SET_FEAT	0xef	/* set features				*/
122*0Sstevel@tonic-gate #define	ATC_IDLE_IMMED	0xe1	/* idle immediate			*/
123*0Sstevel@tonic-gate #define	ATC_STANDBY_IM	0xe0	/* standby immediate			*/
124*0Sstevel@tonic-gate #define	ATC_ACK_MC	0xdb	/* acknowledge media change		*/
125*0Sstevel@tonic-gate #define	ATC_DOOR_LOCK	0xde	/* door lock				*/
126*0Sstevel@tonic-gate #define	ATC_DOOR_UNLOCK	0xdf	/* door unlock				*/
127*0Sstevel@tonic-gate #define	ATC_PI_SRESET	0x08    /* ATAPI soft reset			*/
128*0Sstevel@tonic-gate #define	ATC_PI_ID_DEV	0xa1	/* ATAPI identify device		*/
129*0Sstevel@tonic-gate #define	ATC_PI_PKT	0xa0	/* ATAPI packet command 		*/
130*0Sstevel@tonic-gate 
131*0Sstevel@tonic-gate /*
132*0Sstevel@tonic-gate  * ata device type
133*0Sstevel@tonic-gate  */
134*0Sstevel@tonic-gate #define	ATA_DEV_NONE	0
135*0Sstevel@tonic-gate #define	ATA_DEV_DISK	1
136*0Sstevel@tonic-gate #define	ATA_DEV_12	2 /* atapi 1.2 spec unit */
137*0Sstevel@tonic-gate #define	ATA_DEV_17	3 /* atapi 1.7B spec unit */
138*0Sstevel@tonic-gate 
139*0Sstevel@tonic-gate /*
140*0Sstevel@tonic-gate  * write into config. opt. reg to configure level interrupt and
141*0Sstevel@tonic-gate  * I/O mapped addressing.
142*0Sstevel@tonic-gate  */
143*0Sstevel@tonic-gate #define	LEVEL_MODE_IO_MAP	0x41
144*0Sstevel@tonic-gate 
145*0Sstevel@tonic-gate 
146*0Sstevel@tonic-gate /*
147*0Sstevel@tonic-gate  * Low bits for Read/Write commands...
148*0Sstevel@tonic-gate  */
149*0Sstevel@tonic-gate #define	ATCM_ECCRETRY	0x01	/* Enable ECC and RETRY by controller	*/
150*0Sstevel@tonic-gate 				/* enabled if bit is CLEARED!!!		*/
151*0Sstevel@tonic-gate #define	ATCM_LONGMODE	0x02	/* Use Long Mode (get/send data & ECC)	*/
152*0Sstevel@tonic-gate 				/* enabled if bit is SET!!!		*/
153*0Sstevel@tonic-gate 
154*0Sstevel@tonic-gate /*
155*0Sstevel@tonic-gate  * direction bits
156*0Sstevel@tonic-gate  * for ac_direction
157*0Sstevel@tonic-gate  */
158*0Sstevel@tonic-gate #define	AT_NO_DATA	0		/* No data transfer */
159*0Sstevel@tonic-gate #define	AT_OUT		1		/* for writes */
160*0Sstevel@tonic-gate #define	AT_IN		2		/* for reads */
161*0Sstevel@tonic-gate 
162*0Sstevel@tonic-gate /*
163*0Sstevel@tonic-gate  * status bits for ab_ctl_status
164*0Sstevel@tonic-gate  */
165*0Sstevel@tonic-gate #define	ATA_ONLINE	0
166*0Sstevel@tonic-gate #define	ATA_OFFLINE	1
167*0Sstevel@tonic-gate #define	ATA_PRESENT	2
168*0Sstevel@tonic-gate 
169*0Sstevel@tonic-gate #define	B_PASSTHRU	0x1000000
170*0Sstevel@tonic-gate 
171*0Sstevel@tonic-gate /*
172*0Sstevel@tonic-gate  * timeout and timing parameters
173*0Sstevel@tonic-gate  *
174*0Sstevel@tonic-gate  */
175*0Sstevel@tonic-gate #define	MS2HZ(time)		drv_usectohz(time * 1000)
176*0Sstevel@tonic-gate #define	PCATA_READY_TIMEOUT	(MS2HZ(6000))  /* card ready */
177*0Sstevel@tonic-gate #define	PCATA_READYWAIT_TIMEOUT	(MS2HZ(8000))	/* wait for ready in open */
178*0Sstevel@tonic-gate 
179*0Sstevel@tonic-gate /* for non attached driver or when instance is unknown */
180*0Sstevel@tonic-gate #define	PCATA_BIO_TIMEOUT1	(MS2HZ(100))	/* sometimes we need it fast */
181*0Sstevel@tonic-gate 
182*0Sstevel@tonic-gate /* for attached driver or when instance is known */
183*0Sstevel@tonic-gate #define	PCATA_BIO_TIMEOUT2	(MS2HZ(200))	/* pcata bio timeout */
184*0Sstevel@tonic-gate 
185*0Sstevel@tonic-gate /* for non attached driver or when instance is unknown */
186*0Sstevel@tonic-gate #define	PCATA_BIOTIMEOUT_CNT1	10		/* maximum of 10 pkts id */
187*0Sstevel@tonic-gate 
188*0Sstevel@tonic-gate /* for attached driver or when instance is known */
189*0Sstevel@tonic-gate #define	PCATA_BIOTIMEOUT_CNT2	40		/* maximum of 40 pkts id */
190*0Sstevel@tonic-gate 
191*0Sstevel@tonic-gate #define	PCATA_DRIVESETUP_TIMEOUT MS2HZ(1000)	/* drive setup timeout */
192*0Sstevel@tonic-gate #define	PCATA_DRIVESETUP_CNT	2		/* only two instances for now */
193*0Sstevel@tonic-gate 
194*0Sstevel@tonic-gate struct ata_cmpkt {
195*0Sstevel@tonic-gate 	struct ata_cmpkt *pkt_forw; 	/* link in chain of packets */
196*0Sstevel@tonic-gate 
197*0Sstevel@tonic-gate 	struct ata_unit	*cp_ctl_private; /* link to struct ata_unit	*/
198*0Sstevel@tonic-gate 	struct	buf	*cp_bp;		/* link to buf structure	*/
199*0Sstevel@tonic-gate 	caddr_t		ac_start_v_addr; /* start memory I/O address	*/
200*0Sstevel@tonic-gate 	daddr_t		cp_srtsec;	/* starting sector number	*/
201*0Sstevel@tonic-gate 	int		cp_bytexfer;	/* bytes xfer in this operation */
202*0Sstevel@tonic-gate 
203*0Sstevel@tonic-gate 	char		ac_cdb;		/* target driver command	*/
204*0Sstevel@tonic-gate 	char		ac_scb;		/* controller status aft cmd	*/
205*0Sstevel@tonic-gate 	ushort_t	ac_flags;	/* controller flags		*/
206*0Sstevel@tonic-gate 
207*0Sstevel@tonic-gate 	int		ac_bytes_per_block; /* blk mode factor per xfer	*/
208*0Sstevel@tonic-gate 	caddr_t		ac_v_addr;	/* I/O should be done to/from 	*/
209*0Sstevel@tonic-gate 
210*0Sstevel@tonic-gate 	int		cp_resid;	/* data bytes not transferred	*/
211*0Sstevel@tonic-gate 	int		cp_reason;	/* error status */
212*0Sstevel@tonic-gate 	int		cp_flags;
213*0Sstevel@tonic-gate 	void		*cp_passthru;
214*0Sstevel@tonic-gate 	char		ac_direction;	/* AT_IN - read AT_OUT - write	*/
215*0Sstevel@tonic-gate 	int		cp_retry;
216*0Sstevel@tonic-gate 	/*
217*0Sstevel@tonic-gate 	 * task file registers setting
218*0Sstevel@tonic-gate 	 */
219*0Sstevel@tonic-gate 					/* sec count in ac_pkt		*/
220*0Sstevel@tonic-gate #ifdef NOT_USED
221*0Sstevel@tonic-gate 	uchar_t		ac_devctl;
222*0Sstevel@tonic-gate 	uchar_t		ac_sec;
223*0Sstevel@tonic-gate 	uchar_t		ac_count;
224*0Sstevel@tonic-gate 	uchar_t		ac_lwcyl;
225*0Sstevel@tonic-gate 	uchar_t		ac_hicyl;
226*0Sstevel@tonic-gate 	uchar_t		ac_hd;
227*0Sstevel@tonic-gate #endif
228*0Sstevel@tonic-gate 	uchar_t		ac_cmd;
229*0Sstevel@tonic-gate 
230*0Sstevel@tonic-gate 	/*
231*0Sstevel@tonic-gate 	 * error status
232*0Sstevel@tonic-gate 	 */
233*0Sstevel@tonic-gate 	uchar_t		ac_error;
234*0Sstevel@tonic-gate 	uchar_t		ac_status;
235*0Sstevel@tonic-gate };
236*0Sstevel@tonic-gate 
237*0Sstevel@tonic-gate 
238*0Sstevel@tonic-gate 
239*0Sstevel@tonic-gate 
240*0Sstevel@tonic-gate /*	structure of 'Read Parameters' command 				*/
241*0Sstevel@tonic-gate struct atarpbuf {
242*0Sstevel@tonic-gate /*  					WORD				*/
243*0Sstevel@tonic-gate /* 					OFFSET COMMENT			*/
244*0Sstevel@tonic-gate 	ushort_t atarp_config;		/*  0 general configuration bits */
245*0Sstevel@tonic-gate 	ushort_t atarp_fixcyls;		/*  1 # of fixed cylinders */
246*0Sstevel@tonic-gate 	ushort_t atarp_remcyls;		/*  2 # of removable cylinders */
247*0Sstevel@tonic-gate 	ushort_t atarp_heads;		/*  3 # of heads */
248*0Sstevel@tonic-gate 	ushort_t atarp_trksiz;		/*  4 # of unformatted bytes/track */
249*0Sstevel@tonic-gate 	ushort_t atarp_secsiz;		/*  5 # of unformatted bytes/sector */
250*0Sstevel@tonic-gate 	ushort_t atarp_sectors;		/*  6 # of sectors/track */
251*0Sstevel@tonic-gate 	ushort_t atarp_resv1[3];	/*  7 "Vendor Unique" */
252*0Sstevel@tonic-gate 	char	atarp_drvser[20];	/* 10 Serial number */
253*0Sstevel@tonic-gate 	ushort_t atarp_buftype;		/* 20 Buffer type */
254*0Sstevel@tonic-gate 	ushort_t atarp_bufsz;		/* 21 Buffer size in 512 byte incr */
255*0Sstevel@tonic-gate 	ushort_t atarp_ecc;		/* 22 # of ecc bytes avail on rd/wr */
256*0Sstevel@tonic-gate 	char	atarp_fw[8];		/* 23 Firmware revision */
257*0Sstevel@tonic-gate 	char	atarp_model[40];	/* 27 Model # */
258*0Sstevel@tonic-gate 	ushort_t atarp_mult1;		/* 47 Multiple command flags */
259*0Sstevel@tonic-gate 	ushort_t atarp_dwcap;		/* 48 Doubleword capabilities */
260*0Sstevel@tonic-gate 	ushort_t atarp_cap;		/* 49 Capabilities */
261*0Sstevel@tonic-gate 	ushort_t atarp_resv2;		/* 50 Reserved */
262*0Sstevel@tonic-gate 	ushort_t atarp_piomode;		/* 51 PIO timing mode */
263*0Sstevel@tonic-gate 	ushort_t atarp_dmamode;		/* 52 DMA timing mode */
264*0Sstevel@tonic-gate 	ushort_t atarp_validinfo;	/* 53 bit0: wds 54-58, bit1: 64-70 */
265*0Sstevel@tonic-gate 	ushort_t atarp_curcyls;		/* 54 # of current cylinders */
266*0Sstevel@tonic-gate 	ushort_t atarp_curheads;	/* 55 # of current heads */
267*0Sstevel@tonic-gate 	ushort_t atarp_cursectrk;	/* 56 # of current sectors/track */
268*0Sstevel@tonic-gate 	ushort_t atarp_cursccp[2];	/* 57 current sectors capacity */
269*0Sstevel@tonic-gate 	ushort_t atarp_mult2;		/* 59 multiple sectors info */
270*0Sstevel@tonic-gate 	ushort_t atarp_addrsec[2];	/* 60 LBA only: no of addr secs */
271*0Sstevel@tonic-gate 	ushort_t atarp_sworddma;	/* 62 single word dma modes */
272*0Sstevel@tonic-gate 	ushort_t atarp_dworddma;	/* 63 double word dma modes */
273*0Sstevel@tonic-gate 	ushort_t atarp_advpiomode;	/* 64 advanced PIO modes supported */
274*0Sstevel@tonic-gate 	ushort_t atarp_minmwdma;	/* 65 min multi-word dma cycle info */
275*0Sstevel@tonic-gate 	ushort_t atarp_recmwdma;	/* 66 rec multi-word dma cycle info */
276*0Sstevel@tonic-gate 	ushort_t atarp_minpio;		/* 67 min PIO cycle info */
277*0Sstevel@tonic-gate 	ushort_t atarp_minpioflow;	/* 68 min PIO cycle info w/flow ctl */
278*0Sstevel@tonic-gate };
279*0Sstevel@tonic-gate 
280*0Sstevel@tonic-gate /*	direct coupled disk driver command				*/
281*0Sstevel@tonic-gate #define	DCMD_READ	1	/* Read Sectors/Blocks			*/
282*0Sstevel@tonic-gate #define	DCMD_WRITE	2	/* Write Sectors/Blocks			*/
283*0Sstevel@tonic-gate #define	DCMD_FMTTRK	3	/* Format Track				*/
284*0Sstevel@tonic-gate #define	DCMD_FMTDRV	4	/* Format entire drive			*/
285*0Sstevel@tonic-gate #define	DCMD_RECAL	5	/* Recalibrate				*/
286*0Sstevel@tonic-gate #define	DCMD_SEEK	6	/* Seek to Cylinder			*/
287*0Sstevel@tonic-gate #define	DCMD_RDVER	7	/* Read Verify sectors on disk		*/
288*0Sstevel@tonic-gate #define	DCMD_GETDEF	8	/* Read manufacturers defect list	*/
289*0Sstevel@tonic-gate 
290*0Sstevel@tonic-gate /*	driver error code						*/
291*0Sstevel@tonic-gate #define	DERR_SUCCESS	0	/* success				*/
292*0Sstevel@tonic-gate #define	DERR_AMNF	1	/* address mark not found		*/
293*0Sstevel@tonic-gate #define	DERR_TKONF	2	/* track 0 not found			*/
294*0Sstevel@tonic-gate #define	DERR_ABORT	3	/* aborted command			*/
295*0Sstevel@tonic-gate #define	DERR_DWF	4	/* write fault				*/
296*0Sstevel@tonic-gate #define	DERR_IDNF	5	/* ID not found				*/
297*0Sstevel@tonic-gate #define	DERR_BUSY	6	/* drive busy				*/
298*0Sstevel@tonic-gate #define	DERR_UNC	7	/* uncorrectable data error		*/
299*0Sstevel@tonic-gate #define	DERR_BBK	8	/* bad block detected			*/
300*0Sstevel@tonic-gate #define	DERR_INVCDB	9	/* invalid cdb				*/
301*0Sstevel@tonic-gate 
302*0Sstevel@tonic-gate /*	reason code for completion status				*/
303*0Sstevel@tonic-gate #define	CPS_SUCCESS	0		/* command completes with no err */
304*0Sstevel@tonic-gate #define	CPS_FAILURE	1		/* command fails		*/
305*0Sstevel@tonic-gate #define	CPS_CHKERR	2		/* command fails with status	*/
306*0Sstevel@tonic-gate #define	CPS_ABORTED	3		/* command aborted		*/
307*0Sstevel@tonic-gate 
308*0Sstevel@tonic-gate /*	flags definitions						*/
309*0Sstevel@tonic-gate #define	CPF_NOINTR	0x0001		/* polling mode			*/
310*0Sstevel@tonic-gate 
311*0Sstevel@tonic-gate 
312*0Sstevel@tonic-gate /*	debug	definitions 						*/
313*0Sstevel@tonic-gate #ifdef ATA_DEBUG
314*0Sstevel@tonic-gate 
315*0Sstevel@tonic-gate #define	DENT	0x0001
316*0Sstevel@tonic-gate #define	DPKT	0x0002
317*0Sstevel@tonic-gate #define	DIO	0x0004
318*0Sstevel@tonic-gate #define	DDAT	0x0008
319*0Sstevel@tonic-gate #define	DPCM	0x0010
320*0Sstevel@tonic-gate #define	DLBL	0x0020			/* disk label routines		*/
321*0Sstevel@tonic-gate #define	DINT	0x0040
322*0Sstevel@tonic-gate #define	DINIT	0x0080
323*0Sstevel@tonic-gate #define	DOPEN	0x0100
324*0Sstevel@tonic-gate #define	DMKDEV	0x0200			/* creation of devices		*/
325*0Sstevel@tonic-gate #define	DERR	0x0400			/* Error Condition		*/
326*0Sstevel@tonic-gate #define	DMUTEX	0x0800			/* mutex entry/exit		*/
327*0Sstevel@tonic-gate #define	DVOLD	0x1000			/* volmgt debug			*/
328*0Sstevel@tonic-gate #endif /* ATA_DEBUG */
329*0Sstevel@tonic-gate 
330*0Sstevel@tonic-gate 
331*0Sstevel@tonic-gate /*
332*0Sstevel@tonic-gate  * misc	definition
333*0Sstevel@tonic-gate  */
334*0Sstevel@tonic-gate #define	ATA_LOOP_CNT	10000	/* for looping on registers */
335*0Sstevel@tonic-gate #define	DDI_XSUSPEND	1
336*0Sstevel@tonic-gate #define	DDI_XRESUME	2
337*0Sstevel@tonic-gate #define	CFLAG_ERROR	1
338*0Sstevel@tonic-gate #define	CFLAG_FREE	2
339*0Sstevel@tonic-gate #define	CTL_SEND_FAILURE	1
340*0Sstevel@tonic-gate #define	CTL_SEND_SUCCESS	0
341*0Sstevel@tonic-gate #define	RETRY_CNT	10
342*0Sstevel@tonic-gate #define	PCATA_GO_RETRY	1
343*0Sstevel@tonic-gate #define	PCATA_WAIT_CNT	100
344*0Sstevel@tonic-gate #define	ROUNDUP(a, n)	(((a) + ((n) - 1)) & ~((n) - 1))
345*0Sstevel@tonic-gate #define	LPART(dev)	(((getminor(dev) & 0x1F) % NUM_PARTS))
346*0Sstevel@tonic-gate #define	PCIDE_OUTB(a, b, c)	csx_Put8(a, b, c);\
347*0Sstevel@tonic-gate 				drv_usecwait(5);
348*0Sstevel@tonic-gate 
349*0Sstevel@tonic-gate /*
350*0Sstevel@tonic-gate  * XXX/lcl - LPART uses 5 bits, shouldn't unit shift right 5?
351*0Sstevel@tonic-gate  * also UNIT seems to be incompatible with PCATA_SETMINOR
352*0Sstevel@tonic-gate  * also in sysmacros.h O_MAXMIN seems to be 0xff which means << 10 is bad
353*0Sstevel@tonic-gate  */
354*0Sstevel@tonic-gate #define	UNIT(dev)	(getminor(dev)>>2 &1)
355*0Sstevel@tonic-gate 
356*0Sstevel@tonic-gate #define	PCATA_SOCKET(dev)		((getminor(dev) >> 10) & 0x3f)
357*0Sstevel@tonic-gate #define	PCATA_SETMINOR(skt, part)	((skt<<10) | (part))
358*0Sstevel@tonic-gate 
359*0Sstevel@tonic-gate #define	MAX_SLICES	16
360*0Sstevel@tonic-gate #define	NUM_PARTS	(MAX_SLICES + FD_NUMPART + 1)
361*0Sstevel@tonic-gate #define	PCATA_NAME	"pcata"
362*0Sstevel@tonic-gate #define	FDISK_OFFSET	MAX_SLICES	/* vtoc slice 16 == fdisk partition 0 */
363*0Sstevel@tonic-gate #if defined(_SUNOS_VTOC_16)
364*0Sstevel@tonic-gate #define	VTOC_OFFSET	1
365*0Sstevel@tonic-gate #elif defined(_SUNOS_VTOC_8)
366*0Sstevel@tonic-gate #define	VTOC_OFFSET	0
367*0Sstevel@tonic-gate #else
368*0Sstevel@tonic-gate #error No VTOC format defined.
369*0Sstevel@tonic-gate #endif
370*0Sstevel@tonic-gate #define	USLICE_WHOLE	2
371*0Sstevel@tonic-gate 
372*0Sstevel@tonic-gate typedef struct	{
373*0Sstevel@tonic-gate 	kmutex_t		mutex;
374*0Sstevel@tonic-gate 	struct dk_label		ondsklbl;
375*0Sstevel@tonic-gate 	struct partition	pmap[NUM_PARTS];
376*0Sstevel@tonic-gate 	struct dk_map		un_map[NDKMAP];	/* logical partitions */
377*0Sstevel@tonic-gate 	int			fdiskpresent;	/* fdisk present	*/
378*0Sstevel@tonic-gate 	int			uidx;		/* UNIX partition number */
379*0Sstevel@tonic-gate 	} dsk_label_t;
380*0Sstevel@tonic-gate 
381*0Sstevel@tonic-gate /*
382*0Sstevel@tonic-gate  * linked list of drives on this controller
383*0Sstevel@tonic-gate  */
384*0Sstevel@tonic-gate typedef struct ata_unit {
385*0Sstevel@tonic-gate 	struct ata_soft	*a_blkp;	/* controller structure */
386*0Sstevel@tonic-gate 
387*0Sstevel@tonic-gate 	uchar_t		au_targ;
388*0Sstevel@tonic-gate 	uchar_t		au_drive_bits;
389*0Sstevel@tonic-gate 	uchar_t		au_ctl_bits;
390*0Sstevel@tonic-gate 	int		au_cyl;		/* cylinders */
391*0Sstevel@tonic-gate 	int		au_acyl;	/* alternate cylinders */
392*0Sstevel@tonic-gate 	int		au_hd;
393*0Sstevel@tonic-gate 	int		au_sec;
394*0Sstevel@tonic-gate 	int		au_blksz;
395*0Sstevel@tonic-gate 	short		au_block_factor;
396*0Sstevel@tonic-gate 	short		au_bytes_per_block;
397*0Sstevel@tonic-gate 	uchar_t		au_rd_cmd;
398*0Sstevel@tonic-gate 	uchar_t		au_wr_cmd;
399*0Sstevel@tonic-gate 	buf_t		*un_sbufp;
400*0Sstevel@tonic-gate 	struct atarpbuf *au_rpbuf;
401*0Sstevel@tonic-gate 
402*0Sstevel@tonic-gate 	struct ata_unit	*a_forw;	/* linked list for all ata's 	*/
403*0Sstevel@tonic-gate 	dsk_label_t	lbl;		/* per targer label information */
404*0Sstevel@tonic-gate } ata_unit_t;
405*0Sstevel@tonic-gate 
406*0Sstevel@tonic-gate /*
407*0Sstevel@tonic-gate  * pcata_cftable_t and pcata_cftable_params_t structures are used
408*0Sstevel@tonic-gate  *	to store values from the CISTPL_CFTABLE_ENTRY tuples.
409*0Sstevel@tonic-gate  */
410*0Sstevel@tonic-gate typedef struct pcata_cftable_params_t {
411*0Sstevel@tonic-gate 	uchar_t		config_index;
412*0Sstevel@tonic-gate 	uint32_t	addr_lines;	/* IO addr lines decoded */
413*0Sstevel@tonic-gate 	uint32_t	ata_length[2];	/* length of first IO range */
414*0Sstevel@tonic-gate 	uint32_t	pin;		/* PRR bits valid mask */
415*0Sstevel@tonic-gate 	uint32_t	ata_vcc;
416*0Sstevel@tonic-gate 	uint32_t	ata_vpp1;
417*0Sstevel@tonic-gate 	uint32_t	ata_vpp2;
418*0Sstevel@tonic-gate 	uint32_t	ata_base[2];	/* base of IO range ata registers */
419*0Sstevel@tonic-gate 	int		ranges;		/* number of IO range		*/
420*0Sstevel@tonic-gate } pcata_cftable_params_t;
421*0Sstevel@tonic-gate 
422*0Sstevel@tonic-gate typedef struct pcata_cftable_t {
423*0Sstevel@tonic-gate 	uint32_t		desireability;	/* desireability factor */
424*0Sstevel@tonic-gate 	pcata_cftable_params_t	p;		/* parameters */
425*0Sstevel@tonic-gate 	struct pcata_cftable_t	*prev;
426*0Sstevel@tonic-gate 	struct pcata_cftable_t	*next;
427*0Sstevel@tonic-gate } pcata_cftable_t;
428*0Sstevel@tonic-gate 
429*0Sstevel@tonic-gate 
430*0Sstevel@tonic-gate 
431*0Sstevel@tonic-gate typedef struct pcata_cis_vars_t {
432*0Sstevel@tonic-gate 	uint32_t	present;	/* config register present flags */
433*0Sstevel@tonic-gate 	uint32_t	pin;		/* PRR bits valid mask */
434*0Sstevel@tonic-gate 	char		prod_strings[CISTPL_VERS_1_MAX_PROD_STRINGS]
435*0Sstevel@tonic-gate 					[CIS_MAX_TUPLE_DATA_LEN];
436*0Sstevel@tonic-gate 	uint32_t	major_revision;	/* card major revision level */
437*0Sstevel@tonic-gate 	uint32_t	minor_revision;	/* card minor revision level */
438*0Sstevel@tonic-gate 	uint32_t	manufacturer_id; /* manufacturer ID */
439*0Sstevel@tonic-gate 	uint32_t	card_id;	/* card ID */
440*0Sstevel@tonic-gate 	uint32_t	config_base;	/* base offset of config registers */
441*0Sstevel@tonic-gate 	uint32_t	ata_base[2];	/* base offset of ata registers */
442*0Sstevel@tonic-gate 	uint32_t	ata_length[2];
443*0Sstevel@tonic-gate 	uchar_t		config_index;
444*0Sstevel@tonic-gate 	uint32_t	addr_lines;	/* number of IO addr lines decoded */
445*0Sstevel@tonic-gate 	/* misc card requirements */
446*0Sstevel@tonic-gate 	uint32_t	ata_vcc;
447*0Sstevel@tonic-gate 	uint32_t	ata_vpp1;
448*0Sstevel@tonic-gate 	uint32_t	ata_vpp2;
449*0Sstevel@tonic-gate 	pcata_cftable_t	cftable;	/* active CFTABLE_ENTRY values */
450*0Sstevel@tonic-gate } pcata_cis_vars_t;
451*0Sstevel@tonic-gate 
452*0Sstevel@tonic-gate typedef struct pcata_biotimeout {
453*0Sstevel@tonic-gate 	timeout_id_t    timeout_id;
454*0Sstevel@tonic-gate 	buf_t		*bp;
455*0Sstevel@tonic-gate } pcata_biotimeout_t;
456*0Sstevel@tonic-gate 
457*0Sstevel@tonic-gate #define	ATA_MAXDRIVE	8
458*0Sstevel@tonic-gate 
459*0Sstevel@tonic-gate /*
460*0Sstevel@tonic-gate  * soft state structure
461*0Sstevel@tonic-gate  */
462*0Sstevel@tonic-gate typedef struct ata_soft  {
463*0Sstevel@tonic-gate 	int 		flags;		/* misc state info		*/
464*0Sstevel@tonic-gate 	int 		sn;		/* socket number		*/
465*0Sstevel@tonic-gate 
466*0Sstevel@tonic-gate 	enum dkio_state	media_state;	/* up-to-date media state	*/
467*0Sstevel@tonic-gate 	int		checkmedia_flag;
468*0Sstevel@tonic-gate 	int		ejected_media_flag;
469*0Sstevel@tonic-gate 
470*0Sstevel@tonic-gate 	int		instance;	/* instantiation of ourselves	*/
471*0Sstevel@tonic-gate 	struct	buf	*crashbuf;	/* dumping to root device	*/
472*0Sstevel@tonic-gate 	uint32_t	card_state;	/* like it says			*/
473*0Sstevel@tonic-gate 	int		ejected_while_mounted;
474*0Sstevel@tonic-gate 	int		chr_open;	/* open in character mode	*/
475*0Sstevel@tonic-gate 	int		blk_open;	/* open in block mode		*/
476*0Sstevel@tonic-gate 	int		lyr_open[NUM_PARTS]; /* open in layered mode 	*/
477*0Sstevel@tonic-gate 	client_handle_t	client_handle;	/* client handle for socket	*/
478*0Sstevel@tonic-gate 	acc_handle_t	handle;		/* pcata registers handle	*/
479*0Sstevel@tonic-gate 	ddi_iblock_cookie_t soft_blk_cookie;	/* soft intr cookie	*/
480*0Sstevel@tonic-gate 	ddi_softintr_t	softint_id;
481*0Sstevel@tonic-gate 	timeout_id_t	ready_timeout_id;
482*0Sstevel@tonic-gate 	timeout_id_t	readywait_timeout_id;
483*0Sstevel@tonic-gate 	dev_info_t	*dip;		/* pointer to device node	*/
484*0Sstevel@tonic-gate 	kmutex_t	hi_mutex;	/* protect hi-level interrupt	*/
485*0Sstevel@tonic-gate 	kmutex_t	ata_mutex;
486*0Sstevel@tonic-gate 	kmutex_t	event_hilock;	/* protects hi-level events	*/
487*0Sstevel@tonic-gate 			/*
488*0Sstevel@tonic-gate 			 * wait for cv_broadcast of condvar_mediastate
489*0Sstevel@tonic-gate 			 * in pcata_check_media
490*0Sstevel@tonic-gate 			 */
491*0Sstevel@tonic-gate 	kcondvar_t	condvar_mediastate; /* for DKIOCSTATE ioctl()   */
492*0Sstevel@tonic-gate 	kcondvar_t	readywait_cv;
493*0Sstevel@tonic-gate 	pcata_cis_vars_t cis_vars; 	/* saved things ATA's CIS	*/
494*0Sstevel@tonic-gate 	int		intr_pending;	/* an interrupt is pending	*/
495*0Sstevel@tonic-gate 	int		softint_pending;
496*0Sstevel@tonic-gate 	int		write_in_progress;
497*0Sstevel@tonic-gate 	uint32_t	flash;
498*0Sstevel@tonic-gate 	struct ata_unit	*ab_link;	/* linked units			*/
499*0Sstevel@tonic-gate 	struct ata_cmpkt *ab_active;	/* outstanding requests		*/
500*0Sstevel@tonic-gate 	kmutex_t 	ab_mutex;
501*0Sstevel@tonic-gate 	void		*ab_lkarg;
502*0Sstevel@tonic-gate 	ushort_t	ab_status_flag;
503*0Sstevel@tonic-gate 	ushort_t	ab_resv;
504*0Sstevel@tonic-gate 
505*0Sstevel@tonic-gate 	/*
506*0Sstevel@tonic-gate 	 * Even though we can only have 2 targets, we need 8 slots
507*0Sstevel@tonic-gate 	 * for the generic code
508*0Sstevel@tonic-gate 	 */
509*0Sstevel@tonic-gate 	struct atarpbuf	*ab_rpbp[ATA_MAXDRIVE];
510*0Sstevel@tonic-gate 	uchar_t		ab_dev_type[ATA_MAXDRIVE];
511*0Sstevel@tonic-gate 	dev_info_t	*ab_dip;
512*0Sstevel@tonic-gate 	/*
513*0Sstevel@tonic-gate 	 * port addresses associated with ioaddr1
514*0Sstevel@tonic-gate 	 */
515*0Sstevel@tonic-gate 	uint32_t	ab_data;	/* data register 		*/
516*0Sstevel@tonic-gate 	uint32_t	ab_error;	/* error register (read)	*/
517*0Sstevel@tonic-gate 	uint32_t	ab_feature;	/* features (write)		*/
518*0Sstevel@tonic-gate 	uint32_t	ab_count;	/* sector count 		*/
519*0Sstevel@tonic-gate 	uint32_t	ab_sect;	/* sector number 		*/
520*0Sstevel@tonic-gate 	uint32_t	ab_lcyl;	/* cylinder low byte 		*/
521*0Sstevel@tonic-gate 	uint32_t	ab_hcyl;	/* cylinder high byte 		*/
522*0Sstevel@tonic-gate 	uint32_t	ab_drvhd;	/* drive/head register 		*/
523*0Sstevel@tonic-gate 	uint32_t	ab_status;	/* status/command register 	*/
524*0Sstevel@tonic-gate 	uint32_t	ab_cmd;		/* status/command register 	*/
525*0Sstevel@tonic-gate 
526*0Sstevel@tonic-gate 	/*
527*0Sstevel@tonic-gate 	 * port addresses associated with ioaddr2
528*0Sstevel@tonic-gate 	 */
529*0Sstevel@tonic-gate 	uint32_t	ab_altstatus;	/* alternate status (read)	*/
530*0Sstevel@tonic-gate 	uint32_t	ab_devctl;	/* device control (write)	*/
531*0Sstevel@tonic-gate 	uint32_t	ab_drvaddr;	/* drive address (read)		*/
532*0Sstevel@tonic-gate 
533*0Sstevel@tonic-gate 	int		ab_block_factor[2]; /* hold dev blk factor 	*/
534*0Sstevel@tonic-gate 				/* until unit structure is alloc	*/
535*0Sstevel@tonic-gate 	uchar_t		ab_rd_cmd[2];	/* hold read command until	*/
536*0Sstevel@tonic-gate 					/* unit structure is alloc	*/
537*0Sstevel@tonic-gate 	uchar_t		ab_wr_cmd[2];	/* hold write command until	*/
538*0Sstevel@tonic-gate 					/* unit structure is alloc	*/
539*0Sstevel@tonic-gate 	int		ab_max_transfer;
540*0Sstevel@tonic-gate 
541*0Sstevel@tonic-gate 	struct ata_cmpkt *ab_head;	/* linked list of I/O requests	*/
542*0Sstevel@tonic-gate 	struct ata_cmpkt *ab_last;
543*0Sstevel@tonic-gate 	kmutex_t	label_mutex;	/* protect dsk_label_t		*/
544*0Sstevel@tonic-gate } ata_soft_t;
545*0Sstevel@tonic-gate 
546*0Sstevel@tonic-gate 
547*0Sstevel@tonic-gate /*
548*0Sstevel@tonic-gate  * flags in ata_soft.flags field
549*0Sstevel@tonic-gate  */
550*0Sstevel@tonic-gate #define	PCATA_DIDLOCKS		0x00000001	/* cv/mutex_init in attach */
551*0Sstevel@tonic-gate #define	PCATA_REGCLIENT		0x00000002	/* RegisterClient is OK */
552*0Sstevel@tonic-gate #define	PCATA_REQSOCKMASK	0x00000004	/* RequestSocketMask is OK */
553*0Sstevel@tonic-gate #define	PCATA_SOFTINTROK	0x00000008	/* added to interrupt chain */
554*0Sstevel@tonic-gate #define	PCATA_ATTACHOK		0x00000010	/* made it through attach(OK) */
555*0Sstevel@tonic-gate #define	PCATA_REQUESTIO		0x00000020	/* did RequestIO */
556*0Sstevel@tonic-gate #define	PCATA_REQUESTIRQ	0x00000040	/* did RequestIRQ */
557*0Sstevel@tonic-gate #define	PCATA_REQUESTCONFIG	0x00000080	/* did RequestConfiguration */
558*0Sstevel@tonic-gate #define	PCATA_MAKEDEVICENODE	0x00000100	/* did MakeDeviceNode */
559*0Sstevel@tonic-gate #define	PCATA_SUSPENDED		0x00000200	/* device is suspended ? */
560*0Sstevel@tonic-gate #define	PCATA_READY		0x00000400	/* device is ready to be used */
561*0Sstevel@tonic-gate #define	PCATA_VALID_IO_INFO	0x00000800	/* have valid IO info frm CIS */
562*0Sstevel@tonic-gate #define	PCATA_DIDLOCKS2		0x00001000	/* cv/mutex_init in attach */
563*0Sstevel@tonic-gate #define	PCATA_LABELLOCK		0x00002000	/* Disk label lock */
564*0Sstevel@tonic-gate #define	PCATA_DIDLOCKS3		0x00004000	/* ata_mutex initialized */
565*0Sstevel@tonic-gate 
566*0Sstevel@tonic-gate /*
567*0Sstevel@tonic-gate  * flags in card_state field
568*0Sstevel@tonic-gate  */
569*0Sstevel@tonic-gate #define	PCATA_CARD_INSERTED	0x00000001	/* card is here */
570*0Sstevel@tonic-gate #define	PCATA_WAIT_FOR_READY	0x00000002	/* waiting for card ready */
571*0Sstevel@tonic-gate #define	PCATA_CARD_IS_READY	0x00000004	/* card is ready */
572*0Sstevel@tonic-gate #define	PCATA_READY_WAIT	0x00000008	/* waiting for READY */
573*0Sstevel@tonic-gate #define	PCATA_HAS_WINDOW	0x00000010	/* we have a register window */
574*0Sstevel@tonic-gate #define	PCATA_WAITINIT		0x00000020	/* initialization in progress */
575*0Sstevel@tonic-gate 
576*0Sstevel@tonic-gate #define	CARD_PRESENT_VALID(pm)	((pm)->card_state & PCATA_CARD_INSERTED)
577*0Sstevel@tonic-gate 
578*0Sstevel@tonic-gate /*
579*0Sstevel@tonic-gate  * UNTIMEOUT() macro to make sure we're not trying untimeout a bogus timeout
580*0Sstevel@tonic-gate  */
581*0Sstevel@tonic-gate #define	UNTIMEOUT(utt)	{		\
582*0Sstevel@tonic-gate 	if (utt) {			\
583*0Sstevel@tonic-gate 		(void) untimeout(utt);	\
584*0Sstevel@tonic-gate 		utt = 0;		\
585*0Sstevel@tonic-gate 	}				\
586*0Sstevel@tonic-gate }
587*0Sstevel@tonic-gate 
588*0Sstevel@tonic-gate /*
589*0Sstevel@tonic-gate  * global variables
590*0Sstevel@tonic-gate  */
591*0Sstevel@tonic-gate /*
592*0Sstevel@tonic-gate  * linkage to soft state structures by instance (see ddi_get_soft_state)
593*0Sstevel@tonic-gate  */
594*0Sstevel@tonic-gate extern	void			*pcata_soft;
595*0Sstevel@tonic-gate extern	char			*pcata_name;
596*0Sstevel@tonic-gate extern	int			pcata_debug;
597*0Sstevel@tonic-gate extern	struct cb_ops		pcata_cb_ops;
598*0Sstevel@tonic-gate 
599*0Sstevel@tonic-gate /*
600*0Sstevel@tonic-gate  * pcata.c
601*0Sstevel@tonic-gate  */
602*0Sstevel@tonic-gate int pcata_event(event_t event, int priority, event_callback_args_t *eca);
603*0Sstevel@tonic-gate int pcata_card_removal(ata_soft_t *softp, int priority);
604*0Sstevel@tonic-gate int pcata_parse_cis(ata_soft_t *softp, pcata_cftable_t **cftable);
605*0Sstevel@tonic-gate void pcata_destroy_cftable_list(pcata_cftable_t **cftable);
606*0Sstevel@tonic-gate char	*pcata_CS_etext(int ret);
607*0Sstevel@tonic-gate int pcata_readywait(ata_soft_t *softp);
608*0Sstevel@tonic-gate void pcata_minor_wait(ata_soft_t *softp);
609*0Sstevel@tonic-gate int pcata_getinfo(dev_info_t *dip, ddi_info_cmd_t cmd, void *arg,
610*0Sstevel@tonic-gate 	void **result);
611*0Sstevel@tonic-gate 
612*0Sstevel@tonic-gate /*
613*0Sstevel@tonic-gate  * pcide.c
614*0Sstevel@tonic-gate  */
615*0Sstevel@tonic-gate int _init(void);
616*0Sstevel@tonic-gate int _fini(void);
617*0Sstevel@tonic-gate int _info(struct modinfo *modinfop);
618*0Sstevel@tonic-gate int pcata_start(ata_unit_t *, buf_t *, int);
619*0Sstevel@tonic-gate int pcata_intr_hi(ata_soft_t *softp);
620*0Sstevel@tonic-gate uint32_t pcata_intr(char *softp);
621*0Sstevel@tonic-gate int pcata_getedt(ata_soft_t *ata_blkp, int dmax);
622*0Sstevel@tonic-gate void pcata_byte_swap(char *buf, int n);
623*0Sstevel@tonic-gate int pcata_set_rw_multiple(ata_soft_t *ata_blkp, int drive);
624*0Sstevel@tonic-gate void pcata_min(buf_t *bp);
625*0Sstevel@tonic-gate int pcata_spinup(ata_soft_t *softp, int slot);
626*0Sstevel@tonic-gate 
627*0Sstevel@tonic-gate /*
628*0Sstevel@tonic-gate  * pcdisk.c
629*0Sstevel@tonic-gate  */
630*0Sstevel@tonic-gate int pcata_strategy(buf_t *bp);
631*0Sstevel@tonic-gate int pcata_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cred_p,
632*0Sstevel@tonic-gate 	int *rval_p);
633*0Sstevel@tonic-gate int pcata_lbl_ioctl(dev_t dev, int cmd, intptr_t arg, int flag);
634*0Sstevel@tonic-gate int pcata_open(dev_t *dev_p, int flag, int otyp, cred_t *cred_p);
635*0Sstevel@tonic-gate int pcata_close(dev_t dev, int flag, int otyp, cred_t *cred_p);
636*0Sstevel@tonic-gate int pcata_update_vtoc(ata_soft_t *softp, dev_t dev);
637*0Sstevel@tonic-gate int pcata_write_dskvtoc(ata_soft_t *softp, dev_t dev, dsk_label_t *lblp,
638*0Sstevel@tonic-gate 	struct vtoc *vtocp);
639*0Sstevel@tonic-gate int pcata_prop_op(dev_t dev, dev_info_t *dip, ddi_prop_op_t prop_op,
640*0Sstevel@tonic-gate     int mod_flags, char *name, caddr_t valuep, int *lengthp);
641*0Sstevel@tonic-gate 
642*0Sstevel@tonic-gate /*
643*0Sstevel@tonic-gate  * pclabel.c
644*0Sstevel@tonic-gate  */
645*0Sstevel@tonic-gate int pcfdisk_parse(buf_t *bp, ata_unit_t *unitp);
646*0Sstevel@tonic-gate int pcfdisk_read(buf_t *bp, ata_unit_t *unitp);
647*0Sstevel@tonic-gate int pcdsklbl_wrvtoc(dsk_label_t *lblp, struct vtoc *vtocp, buf_t *bp);
648*0Sstevel@tonic-gate void pcdsklbl_ondsklabel_to_vtoc(dsk_label_t *lblp, struct vtoc *vtocp);
649*0Sstevel@tonic-gate void pcdsklbl_vtoc_to_ondsklabel(dsk_label_t *lblp, struct vtoc *vtocp);
650*0Sstevel@tonic-gate void pcdsklbl_dgtoug(struct dk_geom *up, struct dk_label *dp);
651*0Sstevel@tonic-gate void pcdsklbl_ugtodg(struct dk_geom *up, struct dk_label *dp);
652*0Sstevel@tonic-gate void pcinit_pmap(ata_unit_t *unitp);
653*0Sstevel@tonic-gate 
654*0Sstevel@tonic-gate #ifdef	__cplusplus
655*0Sstevel@tonic-gate }
656*0Sstevel@tonic-gate #endif
657*0Sstevel@tonic-gate 
658*0Sstevel@tonic-gate #endif /* _SYS_PCATA_H */
659