xref: /titanic_44/usr/src/uts/common/sys/i8272A.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1995 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_I8272A_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_I8272A_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate /*
37*7c478bd9Sstevel@tonic-gate  * i/o port numbers
38*7c478bd9Sstevel@tonic-gate  */
39*7c478bd9Sstevel@tonic-gate #define	FCR_BASE	0x3f0	/* default i/o base address */
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate #define	FCR_SRA		0x000	/* only 82077AA (not AT mode) or SMC */
42*7c478bd9Sstevel@tonic-gate #define	FCR_SRB		0x001	/* only 82077AA (not AT mode) or SMC */
43*7c478bd9Sstevel@tonic-gate #define	FCR_DOR		0x002
44*7c478bd9Sstevel@tonic-gate #define	FCR_MSR		0x004
45*7c478bd9Sstevel@tonic-gate #define	FCR_DSR		0x004	/* only enhanced controllers */
46*7c478bd9Sstevel@tonic-gate #define	FCR_DATA	0x005
47*7c478bd9Sstevel@tonic-gate #define	FCR_DIR		0x007
48*7c478bd9Sstevel@tonic-gate #define	FCR_CCR		0x007	/* 82077AA term; == DSR on PC/AT */
49*7c478bd9Sstevel@tonic-gate 
50*7c478bd9Sstevel@tonic-gate /*  SRA : values for Configuration Select Register for SMC FDC37C66xGT */
51*7c478bd9Sstevel@tonic-gate #define	FSA_ENA5	0x55	/*  enable config mode, issue twice */
52*7c478bd9Sstevel@tonic-gate #define	FSA_ENA6	0x44	/*  enable config mode, issue twice */
53*7c478bd9Sstevel@tonic-gate #define	FSA_DISB	0xAA	/*  disable config mode */
54*7c478bd9Sstevel@tonic-gate #define	FSA_CR5		0x05	/*  select config register 5 */
55*7c478bd9Sstevel@tonic-gate 
56*7c478bd9Sstevel@tonic-gate /*  SRB : Configuration Data Register for SMC FDC37C66xGT */
57*7c478bd9Sstevel@tonic-gate #define	FSB_DSDEF	0xE7	/*  bit mask for density select in reg 5 */
58*7c478bd9Sstevel@tonic-gate #define	FSB_DSLO	0x10	/*  density select = LOW (300 rpm) */
59*7c478bd9Sstevel@tonic-gate #define	FSB_DSHI	0x18	/*  density select = HIGH (360 rpm) */
60*7c478bd9Sstevel@tonic-gate 
61*7c478bd9Sstevel@tonic-gate /*  DOR : Digital Output Register */
62*7c478bd9Sstevel@tonic-gate #define	FD_DMTREN	0xF0
63*7c478bd9Sstevel@tonic-gate #define	FD_D3MTR	0x80
64*7c478bd9Sstevel@tonic-gate #define	FD_D2MTR	0x40
65*7c478bd9Sstevel@tonic-gate #define	FD_DBMTR	0x20
66*7c478bd9Sstevel@tonic-gate #define	FD_DAMTR	0x10
67*7c478bd9Sstevel@tonic-gate #define	FD_ENABLE	0x08	/* DMA gate */
68*7c478bd9Sstevel@tonic-gate #define	FD_RSETZ	0x04
69*7c478bd9Sstevel@tonic-gate #define	FD_DRSEL	0x03
70*7c478bd9Sstevel@tonic-gate #define	FD_DBSEL	0x01
71*7c478bd9Sstevel@tonic-gate #define	FD_DASEL	0x00
72*7c478bd9Sstevel@tonic-gate 
73*7c478bd9Sstevel@tonic-gate #define	ENAB_MCA_INT	0x00
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate /* MSR - Main Status Register */
77*7c478bd9Sstevel@tonic-gate #define	MS_RQM		0x80	/* request for master - chip needs attention */
78*7c478bd9Sstevel@tonic-gate #define	MS_DIO		0x40	/* data in/out, 1 = remove bytes from fifo */
79*7c478bd9Sstevel@tonic-gate #define	MS_NDM		0x20	/* non-dma mode - 1 during execution phase */
80*7c478bd9Sstevel@tonic-gate #define	MS_CB		0x10	/* controller busy, command in progress */
81*7c478bd9Sstevel@tonic-gate #define	MS_D3B		0x08	/* drive 3 busy */
82*7c478bd9Sstevel@tonic-gate #define	MS_D2B		0x04	/* drive 2 busy */
83*7c478bd9Sstevel@tonic-gate #define	MS_DBB		0x02	/* drive B busy */
84*7c478bd9Sstevel@tonic-gate #define	MS_DAB		0x01	/* drive A busy */
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate #define	FDC_RQM_RETRY	300
87*7c478bd9Sstevel@tonic-gate 
88*7c478bd9Sstevel@tonic-gate 
89*7c478bd9Sstevel@tonic-gate /*  DIR : Digital Input Register */
90*7c478bd9Sstevel@tonic-gate #define	FDI_DKCHG	0x80	/* this is inverted in Model 30 mode */
91*7c478bd9Sstevel@tonic-gate #define	FDI_DMAGAT	0x08	/* Model 30: DMA gate */
92*7c478bd9Sstevel@tonic-gate #define	FDI_NOPREC	0x04	/* Model 30 only */
93*7c478bd9Sstevel@tonic-gate #define	FDI_DRATE	0x03	/* Model 30: selected datarate mask */
94*7c478bd9Sstevel@tonic-gate 
95*7c478bd9Sstevel@tonic-gate 
96*7c478bd9Sstevel@tonic-gate /*  DSR : Datarate Select Register on 82072 and 82077AA */
97*7c478bd9Sstevel@tonic-gate #define	FSR_SWR		0x80	/* software reset */
98*7c478bd9Sstevel@tonic-gate #define	FSR_PD		0x40	/* power down */
99*7c478bd9Sstevel@tonic-gate #define	FSR_PRECP	0x1C	/* precomp mask */
100*7c478bd9Sstevel@tonic-gate #define	FSR_DRATE	0x3	/* datarate select mask */
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate 
103*7c478bd9Sstevel@tonic-gate /*  CCR : Configuration Control Register, aka Datarate Select Register */
104*7c478bd9Sstevel@tonic-gate #define	FCC_NOPREC	0x4	/* Model 30 only */
105*7c478bd9Sstevel@tonic-gate #define	FCC_DRATE	0x3	/* datarate select mask */
106*7c478bd9Sstevel@tonic-gate 
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate /*
109*7c478bd9Sstevel@tonic-gate  * Floppy controller command opcodes
110*7c478bd9Sstevel@tonic-gate  */
111*7c478bd9Sstevel@tonic-gate #define	FO_MODE		0x01	/* National PC8477 types only */
112*7c478bd9Sstevel@tonic-gate #define	FO_RDTRK	0x02
113*7c478bd9Sstevel@tonic-gate #define	FO_SPEC		0x03
114*7c478bd9Sstevel@tonic-gate #define	FO_SDRV		0x04	/* read status register 3 */
115*7c478bd9Sstevel@tonic-gate #define	FO_WRDAT	0x05
116*7c478bd9Sstevel@tonic-gate #define	FO_RDDAT	0x06
117*7c478bd9Sstevel@tonic-gate #define	FO_RECAL	0x07
118*7c478bd9Sstevel@tonic-gate #define	FO_SINT		0x08
119*7c478bd9Sstevel@tonic-gate #define	FO_WRDEL	0x09
120*7c478bd9Sstevel@tonic-gate #define	FO_RDID		0x0A
121*7c478bd9Sstevel@tonic-gate #define	FO_RDDEL	0x0C
122*7c478bd9Sstevel@tonic-gate #define	FO_FRMT		0x0D
123*7c478bd9Sstevel@tonic-gate #define	FO_SEEK		0x0F
124*7c478bd9Sstevel@tonic-gate #define	FO_VRSN		0x10	/* get version */
125*7c478bd9Sstevel@tonic-gate #define	FO_PERP		0x12	/* perpendicular mode */
126*7c478bd9Sstevel@tonic-gate #define	FO_CNFG		0x13	/* configure */
127*7c478bd9Sstevel@tonic-gate #define	FO_NSC		0x18	/* identify National chip */
128*7c478bd9Sstevel@tonic-gate 
129*7c478bd9Sstevel@tonic-gate 				/* option bits */
130*7c478bd9Sstevel@tonic-gate #define	FO_MT		0x80	/* multi-track operation */
131*7c478bd9Sstevel@tonic-gate #define	FO_MFM		0x40	/* double & high density disks */
132*7c478bd9Sstevel@tonic-gate #define	FO_FM		0x00	/* single density disks */
133*7c478bd9Sstevel@tonic-gate #define	FO_SK		0x20	/* skip deleted adr mark */
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate 
136*7c478bd9Sstevel@tonic-gate #define	S0_ICMASK	0xC0	/* status register 0 */
137*7c478bd9Sstevel@tonic-gate #define	S0_XRDY		0xC0
138*7c478bd9Sstevel@tonic-gate #define	S0_IVCMD	0x80
139*7c478bd9Sstevel@tonic-gate #define	S0_ABTERM	0x40
140*7c478bd9Sstevel@tonic-gate #define	S0_SEKEND	0x20
141*7c478bd9Sstevel@tonic-gate #define	S0_ECHK		0x10
142*7c478bd9Sstevel@tonic-gate #define	S0_NOTRDY	0x08
143*7c478bd9Sstevel@tonic-gate 
144*7c478bd9Sstevel@tonic-gate #define	S1_EOCYL	0x80	/* status register 1 */
145*7c478bd9Sstevel@tonic-gate #define	S1_CRCER	0x20
146*7c478bd9Sstevel@tonic-gate #define	S1_OVRUN	0x10
147*7c478bd9Sstevel@tonic-gate #define	S1_NODATA	0x04
148*7c478bd9Sstevel@tonic-gate #define	S1_MADMK	0x01
149*7c478bd9Sstevel@tonic-gate 
150*7c478bd9Sstevel@tonic-gate #define	S3_FAULT	0x80	/* status register 3 */
151*7c478bd9Sstevel@tonic-gate #define	S3_WPROT	0x40
152*7c478bd9Sstevel@tonic-gate #define	S3_DRRDY	0x20
153*7c478bd9Sstevel@tonic-gate #define	S3_TRK0		0x10
154*7c478bd9Sstevel@tonic-gate #define	S3_2SIDE	0x08
155*7c478bd9Sstevel@tonic-gate #define	S3_HEAD		0x04
156*7c478bd9Sstevel@tonic-gate #define	S3_UNIT		0x03
157*7c478bd9Sstevel@tonic-gate 
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate /*
160*7c478bd9Sstevel@tonic-gate  * controller chip values
161*7c478bd9Sstevel@tonic-gate  */
162*7c478bd9Sstevel@tonic-gate #define	i8272A		0x8272
163*7c478bd9Sstevel@tonic-gate #define	uPD72064	0x72064		/* NEC */
164*7c478bd9Sstevel@tonic-gate /* enhanced floppy controllers */
165*7c478bd9Sstevel@tonic-gate #define	i82077		0x82077
166*7c478bd9Sstevel@tonic-gate #define	PC87322		0x87322		/* National Semiconducter */
167*7c478bd9Sstevel@tonic-gate #define	FDC37C665	0x37c665	/* SMC */
168*7c478bd9Sstevel@tonic-gate #define	FDC37C666	0x37c666	/* SMC */
169*7c478bd9Sstevel@tonic-gate 
170*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
171*7c478bd9Sstevel@tonic-gate }
172*7c478bd9Sstevel@tonic-gate #endif
173*7c478bd9Sstevel@tonic-gate 
174*7c478bd9Sstevel@tonic-gate #endif	/* !_SYS_I8272A_H */
175