aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fdreg.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/fdreg.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/linux/fdreg.h')
-rw-r--r--include/linux/fdreg.h137
1 files changed, 137 insertions, 0 deletions
diff --git a/include/linux/fdreg.h b/include/linux/fdreg.h
new file mode 100644
index 000000000000..c2eeb63b72db
--- /dev/null
+++ b/include/linux/fdreg.h
@@ -0,0 +1,137 @@
1#ifndef _LINUX_FDREG_H
2#define _LINUX_FDREG_H
3/*
4 * This file contains some defines for the floppy disk controller.
5 * Various sources. Mostly "IBM Microcomputers: A Programmers
6 * Handbook", Sanches and Canton.
7 */
8
9#ifdef FDPATCHES
10#define FD_IOPORT fdc_state[fdc].address
11#else
12/* It would be a lot saner just to force fdc_state[fdc].address to always
13 be set ! FIXME */
14#define FD_IOPORT 0x3f0
15#endif
16
17/* Fd controller regs. S&C, about page 340 */
18#define FD_STATUS (4 + FD_IOPORT )
19#define FD_DATA (5 + FD_IOPORT )
20
21/* Digital Output Register */
22#define FD_DOR (2 + FD_IOPORT )
23
24/* Digital Input Register (read) */
25#define FD_DIR (7 + FD_IOPORT )
26
27/* Diskette Control Register (write)*/
28#define FD_DCR (7 + FD_IOPORT )
29
30/* Bits of main status register */
31#define STATUS_BUSYMASK 0x0F /* drive busy mask */
32#define STATUS_BUSY 0x10 /* FDC busy */
33#define STATUS_DMA 0x20 /* 0- DMA mode */
34#define STATUS_DIR 0x40 /* 0- cpu->fdc */
35#define STATUS_READY 0x80 /* Data reg ready */
36
37/* Bits of FD_ST0 */
38#define ST0_DS 0x03 /* drive select mask */
39#define ST0_HA 0x04 /* Head (Address) */
40#define ST0_NR 0x08 /* Not Ready */
41#define ST0_ECE 0x10 /* Equipment check error */
42#define ST0_SE 0x20 /* Seek end */
43#define ST0_INTR 0xC0 /* Interrupt code mask */
44
45/* Bits of FD_ST1 */
46#define ST1_MAM 0x01 /* Missing Address Mark */
47#define ST1_WP 0x02 /* Write Protect */
48#define ST1_ND 0x04 /* No Data - unreadable */
49#define ST1_OR 0x10 /* OverRun */
50#define ST1_CRC 0x20 /* CRC error in data or addr */
51#define ST1_EOC 0x80 /* End Of Cylinder */
52
53/* Bits of FD_ST2 */
54#define ST2_MAM 0x01 /* Missing Address Mark (again) */
55#define ST2_BC 0x02 /* Bad Cylinder */
56#define ST2_SNS 0x04 /* Scan Not Satisfied */
57#define ST2_SEH 0x08 /* Scan Equal Hit */
58#define ST2_WC 0x10 /* Wrong Cylinder */
59#define ST2_CRC 0x20 /* CRC error in data field */
60#define ST2_CM 0x40 /* Control Mark = deleted */
61
62/* Bits of FD_ST3 */
63#define ST3_HA 0x04 /* Head (Address) */
64#define ST3_DS 0x08 /* drive is double-sided */
65#define ST3_TZ 0x10 /* Track Zero signal (1=track 0) */
66#define ST3_RY 0x20 /* drive is ready */
67#define ST3_WP 0x40 /* Write Protect */
68#define ST3_FT 0x80 /* Drive Fault */
69
70/* Values for FD_COMMAND */
71#define FD_RECALIBRATE 0x07 /* move to track 0 */
72#define FD_SEEK 0x0F /* seek track */
73#define FD_READ 0xE6 /* read with MT, MFM, SKip deleted */
74#define FD_WRITE 0xC5 /* write with MT, MFM */
75#define FD_SENSEI 0x08 /* Sense Interrupt Status */
76#define FD_SPECIFY 0x03 /* specify HUT etc */
77#define FD_FORMAT 0x4D /* format one track */
78#define FD_VERSION 0x10 /* get version code */
79#define FD_CONFIGURE 0x13 /* configure FIFO operation */
80#define FD_PERPENDICULAR 0x12 /* perpendicular r/w mode */
81#define FD_GETSTATUS 0x04 /* read ST3 */
82#define FD_DUMPREGS 0x0E /* dump the contents of the fdc regs */
83#define FD_READID 0xEA /* prints the header of a sector */
84#define FD_UNLOCK 0x14 /* Fifo config unlock */
85#define FD_LOCK 0x94 /* Fifo config lock */
86#define FD_RSEEK_OUT 0x8f /* seek out (i.e. to lower tracks) */
87#define FD_RSEEK_IN 0xcf /* seek in (i.e. to higher tracks) */
88
89/* the following commands are new in the 82078. They are not used in the
90 * floppy driver, except the first three. These commands may be useful for apps
91 * which use the FDRAWCMD interface. For doc, get the 82078 spec sheets at
92 * http://www-techdoc.intel.com/docs/periph/fd_contr/datasheets/ */
93
94#define FD_PARTID 0x18 /* part id ("extended" version cmd) */
95#define FD_SAVE 0x2e /* save fdc regs for later restore */
96#define FD_DRIVESPEC 0x8e /* drive specification: Access to the
97 * 2 Mbps data transfer rate for tape
98 * drives */
99
100#define FD_RESTORE 0x4e /* later restore */
101#define FD_POWERDOWN 0x27 /* configure FDC's powersave features */
102#define FD_FORMAT_N_WRITE 0xef /* format and write in one go. */
103#define FD_OPTION 0x33 /* ISO format (which is a clean way to
104 * pack more sectors on a track) */
105
106/* DMA commands */
107#define DMA_READ 0x46
108#define DMA_WRITE 0x4A
109
110/* FDC version return types */
111#define FDC_NONE 0x00
112#define FDC_UNKNOWN 0x10 /* DO NOT USE THIS TYPE EXCEPT IF IDENTIFICATION
113 FAILS EARLY */
114#define FDC_8272A 0x20 /* Intel 8272a, NEC 765 */
115#define FDC_765ED 0x30 /* Non-Intel 1MB-compatible FDC, can't detect */
116#define FDC_82072 0x40 /* Intel 82072; 8272a + FIFO + DUMPREGS */
117#define FDC_82072A 0x45 /* 82072A (on Sparcs) */
118#define FDC_82077_ORIG 0x51 /* Original version of 82077AA, sans LOCK */
119#define FDC_82077 0x52 /* 82077AA-1 */
120#define FDC_82078_UNKN 0x5f /* Unknown 82078 variant */
121#define FDC_82078 0x60 /* 44pin 82078 or 64pin 82078SL */
122#define FDC_82078_1 0x61 /* 82078-1 (2Mbps fdc) */
123#define FDC_S82078B 0x62 /* S82078B (first seen on Adaptec AVA-2825 VLB
124 * SCSI/EIDE/Floppy controller) */
125#define FDC_87306 0x63 /* National Semiconductor PC 87306 */
126
127/*
128 * Beware: the fdc type list is roughly sorted by increasing features.
129 * Presence of features is tested by comparing the FDC version id with the
130 * "oldest" version that has the needed feature.
131 * If during FDC detection, an obscure test fails late in the sequence, don't
132 * assign FDC_UNKNOWN. Else the FDC will be treated as a dumb 8272a, or worse.
133 * This is especially true if the tests are unneeded.
134 */
135
136#define FD_RESET_DELAY 20
137#endif