summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/i8272A.h
blob: 9ecf11aadc2c41a1c828e56b4f9a7471cbf3f94a (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright (c) 1995 by Sun Microsystems, Inc.
 * All rights reserved.
 */

#ifndef	_SYS_I8272A_H
#define	_SYS_I8272A_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#ifdef	__cplusplus
extern "C" {
#endif

/*
 * i/o port numbers
 */
#define	FCR_BASE	0x3f0	/* default i/o base address */

#define	FCR_SRA		0x000	/* only 82077AA (not AT mode) or SMC */
#define	FCR_SRB		0x001	/* only 82077AA (not AT mode) or SMC */
#define	FCR_DOR		0x002
#define	FCR_MSR		0x004
#define	FCR_DSR		0x004	/* only enhanced controllers */
#define	FCR_DATA	0x005
#define	FCR_DIR		0x007
#define	FCR_CCR		0x007	/* 82077AA term; == DSR on PC/AT */

/*  SRA : values for Configuration Select Register for SMC FDC37C66xGT */
#define	FSA_ENA5	0x55	/*  enable config mode, issue twice */
#define	FSA_ENA6	0x44	/*  enable config mode, issue twice */
#define	FSA_DISB	0xAA	/*  disable config mode */
#define	FSA_CR5		0x05	/*  select config register 5 */

/*  SRB : Configuration Data Register for SMC FDC37C66xGT */
#define	FSB_DSDEF	0xE7	/*  bit mask for density select in reg 5 */
#define	FSB_DSLO	0x10	/*  density select = LOW (300 rpm) */
#define	FSB_DSHI	0x18	/*  density select = HIGH (360 rpm) */

/*  DOR : Digital Output Register */
#define	FD_DMTREN	0xF0
#define	FD_D3MTR	0x80
#define	FD_D2MTR	0x40
#define	FD_DBMTR	0x20
#define	FD_DAMTR	0x10
#define	FD_ENABLE	0x08	/* DMA gate */
#define	FD_RSETZ	0x04
#define	FD_DRSEL	0x03
#define	FD_DBSEL	0x01
#define	FD_DASEL	0x00

#define	ENAB_MCA_INT	0x00


/* MSR - Main Status Register */
#define	MS_RQM		0x80	/* request for master - chip needs attention */
#define	MS_DIO		0x40	/* data in/out, 1 = remove bytes from fifo */
#define	MS_NDM		0x20	/* non-dma mode - 1 during execution phase */
#define	MS_CB		0x10	/* controller busy, command in progress */
#define	MS_D3B		0x08	/* drive 3 busy */
#define	MS_D2B		0x04	/* drive 2 busy */
#define	MS_DBB		0x02	/* drive B busy */
#define	MS_DAB		0x01	/* drive A busy */

#define	FDC_RQM_RETRY	300


/*  DIR : Digital Input Register */
#define	FDI_DKCHG	0x80	/* this is inverted in Model 30 mode */
#define	FDI_DMAGAT	0x08	/* Model 30: DMA gate */
#define	FDI_NOPREC	0x04	/* Model 30 only */
#define	FDI_DRATE	0x03	/* Model 30: selected datarate mask */


/*  DSR : Datarate Select Register on 82072 and 82077AA */
#define	FSR_SWR		0x80	/* software reset */
#define	FSR_PD		0x40	/* power down */
#define	FSR_PRECP	0x1C	/* precomp mask */
#define	FSR_DRATE	0x3	/* datarate select mask */


/*  CCR : Configuration Control Register, aka Datarate Select Register */
#define	FCC_NOPREC	0x4	/* Model 30 only */
#define	FCC_DRATE	0x3	/* datarate select mask */


/*
 * Floppy controller command opcodes
 */
#define	FO_MODE		0x01	/* National PC8477 types only */
#define	FO_RDTRK	0x02
#define	FO_SPEC		0x03
#define	FO_SDRV		0x04	/* read status register 3 */
#define	FO_WRDAT	0x05
#define	FO_RDDAT	0x06
#define	FO_RECAL	0x07
#define	FO_SINT		0x08
#define	FO_WRDEL	0x09
#define	FO_RDID		0x0A
#define	FO_RDDEL	0x0C
#define	FO_FRMT		0x0D
#define	FO_SEEK		0x0F
#define	FO_VRSN		0x10	/* get version */
#define	FO_PERP		0x12	/* perpendicular mode */
#define	FO_CNFG		0x13	/* configure */
#define	FO_NSC		0x18	/* identify National chip */

				/* option bits */
#define	FO_MT		0x80	/* multi-track operation */
#define	FO_MFM		0x40	/* double & high density disks */
#define	FO_FM		0x00	/* single density disks */
#define	FO_SK		0x20	/* skip deleted adr mark */


#define	S0_ICMASK	0xC0	/* status register 0 */
#define	S0_XRDY		0xC0
#define	S0_IVCMD	0x80
#define	S0_ABTERM	0x40
#define	S0_SEKEND	0x20
#define	S0_ECHK		0x10
#define	S0_NOTRDY	0x08

#define	S1_EOCYL	0x80	/* status register 1 */
#define	S1_CRCER	0x20
#define	S1_OVRUN	0x10
#define	S1_NODATA	0x04
#define	S1_MADMK	0x01

#define	S3_FAULT	0x80	/* status register 3 */
#define	S3_WPROT	0x40
#define	S3_DRRDY	0x20
#define	S3_TRK0		0x10
#define	S3_2SIDE	0x08
#define	S3_HEAD		0x04
#define	S3_UNIT		0x03


/*
 * controller chip values
 */
#define	i8272A		0x8272
#define	uPD72064	0x72064		/* NEC */
/* enhanced floppy controllers */
#define	i82077		0x82077
#define	PC87322		0x87322		/* National Semiconducter */
#define	FDC37C665	0x37c665	/* SMC */
#define	FDC37C666	0x37c666	/* SMC */

#ifdef	__cplusplus
}
#endif

#endif	/* !_SYS_I8272A_H */