Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _LINUX_FDREG_H
0003 #define _LINUX_FDREG_H
0004 /*
0005  * This file contains some defines for the floppy disk controller.
0006  * Various sources. Mostly "IBM Microcomputers: A Programmers
0007  * Handbook", Sanches and Canton.
0008  */
0009 
0010 /* 82077's auxiliary status registers A & B (R) */
0011 #define FD_SRA      0
0012 #define FD_SRB      1
0013 
0014 /* Digital Output Register */
0015 #define FD_DOR      2
0016 
0017 /* 82077's tape drive register (R/W) */
0018 #define FD_TDR      3
0019 
0020 /* 82077's data rate select register (W) */
0021 #define FD_DSR      4
0022 
0023 /* Fd controller regs. S&C, about page 340 */
0024 #define FD_STATUS   4
0025 #define FD_DATA     5
0026 
0027 /* Digital Input Register (read) */
0028 #define FD_DIR      7
0029 
0030 /* Diskette Control Register (write)*/
0031 #define FD_DCR      7
0032 
0033 /* Bits of main status register */
0034 #define STATUS_BUSYMASK 0x0F        /* drive busy mask */
0035 #define STATUS_BUSY 0x10        /* FDC busy */
0036 #define STATUS_DMA  0x20        /* 0- DMA mode */
0037 #define STATUS_DIR  0x40        /* 0- cpu->fdc */
0038 #define STATUS_READY    0x80        /* Data reg ready */
0039 
0040 /* Bits of FD_ST0 */
0041 #define ST0_DS      0x03        /* drive select mask */
0042 #define ST0_HA      0x04        /* Head (Address) */
0043 #define ST0_NR      0x08        /* Not Ready */
0044 #define ST0_ECE     0x10        /* Equipment check error */
0045 #define ST0_SE      0x20        /* Seek end */
0046 #define ST0_INTR    0xC0        /* Interrupt code mask */
0047 
0048 /* Bits of FD_ST1 */
0049 #define ST1_MAM     0x01        /* Missing Address Mark */
0050 #define ST1_WP      0x02        /* Write Protect */
0051 #define ST1_ND      0x04        /* No Data - unreadable */
0052 #define ST1_OR      0x10        /* OverRun */
0053 #define ST1_CRC     0x20        /* CRC error in data or addr */
0054 #define ST1_EOC     0x80        /* End Of Cylinder */
0055 
0056 /* Bits of FD_ST2 */
0057 #define ST2_MAM     0x01        /* Missing Address Mark (again) */
0058 #define ST2_BC      0x02        /* Bad Cylinder */
0059 #define ST2_SNS     0x04        /* Scan Not Satisfied */
0060 #define ST2_SEH     0x08        /* Scan Equal Hit */
0061 #define ST2_WC      0x10        /* Wrong Cylinder */
0062 #define ST2_CRC     0x20        /* CRC error in data field */
0063 #define ST2_CM      0x40        /* Control Mark = deleted */
0064 
0065 /* Bits of FD_ST3 */
0066 #define ST3_HA      0x04        /* Head (Address) */
0067 #define ST3_DS      0x08        /* drive is double-sided */
0068 #define ST3_TZ      0x10        /* Track Zero signal (1=track 0) */
0069 #define ST3_RY      0x20        /* drive is ready */
0070 #define ST3_WP      0x40        /* Write Protect */
0071 #define ST3_FT      0x80        /* Drive Fault */
0072 
0073 /* Values for FD_COMMAND */
0074 #define FD_RECALIBRATE      0x07    /* move to track 0 */
0075 #define FD_SEEK         0x0F    /* seek track */
0076 #define FD_READ         0xE6    /* read with MT, MFM, SKip deleted */
0077 #define FD_WRITE        0xC5    /* write with MT, MFM */
0078 #define FD_SENSEI       0x08    /* Sense Interrupt Status */
0079 #define FD_SPECIFY      0x03    /* specify HUT etc */
0080 #define FD_FORMAT       0x4D    /* format one track */
0081 #define FD_VERSION      0x10    /* get version code */
0082 #define FD_CONFIGURE        0x13    /* configure FIFO operation */
0083 #define FD_PERPENDICULAR    0x12    /* perpendicular r/w mode */
0084 #define FD_GETSTATUS        0x04    /* read ST3 */
0085 #define FD_DUMPREGS     0x0E    /* dump the contents of the fdc regs */
0086 #define FD_READID       0xEA    /* prints the header of a sector */
0087 #define FD_UNLOCK       0x14    /* Fifo config unlock */
0088 #define FD_LOCK         0x94    /* Fifo config lock */
0089 #define FD_RSEEK_OUT        0x8f    /* seek out (i.e. to lower tracks) */
0090 #define FD_RSEEK_IN     0xcf    /* seek in (i.e. to higher tracks) */
0091 
0092 /* the following commands are new in the 82078. They are not used in the
0093  * floppy driver, except the first three. These commands may be useful for apps
0094  * which use the FDRAWCMD interface. For doc, get the 82078 spec sheets at
0095  * http://www.intel.com/design/archives/periphrl/docs/29046803.htm */
0096 
0097 #define FD_PARTID       0x18    /* part id ("extended" version cmd) */
0098 #define FD_SAVE         0x2e    /* save fdc regs for later restore */
0099 #define FD_DRIVESPEC        0x8e    /* drive specification: Access to the
0100                      * 2 Mbps data transfer rate for tape
0101                      * drives */
0102 
0103 #define FD_RESTORE      0x4e    /* later restore */
0104 #define FD_POWERDOWN        0x27    /* configure FDC's powersave features */
0105 #define FD_FORMAT_N_WRITE   0xef    /* format and write in one go. */
0106 #define FD_OPTION       0x33    /* ISO format (which is a clean way to
0107                      * pack more sectors on a track) */
0108 
0109 /* DMA commands */
0110 #define DMA_READ    0x46
0111 #define DMA_WRITE   0x4A
0112 
0113 /* FDC version return types */
0114 #define FDC_NONE    0x00
0115 #define FDC_UNKNOWN 0x10    /* DO NOT USE THIS TYPE EXCEPT IF IDENTIFICATION
0116                    FAILS EARLY */
0117 #define FDC_8272A   0x20    /* Intel 8272a, NEC 765 */
0118 #define FDC_765ED   0x30    /* Non-Intel 1MB-compatible FDC, can't detect */
0119 #define FDC_82072   0x40    /* Intel 82072; 8272a + FIFO + DUMPREGS */
0120 #define FDC_82072A  0x45    /* 82072A (on Sparcs) */
0121 #define FDC_82077_ORIG  0x51    /* Original version of 82077AA, sans LOCK */
0122 #define FDC_82077   0x52    /* 82077AA-1 */
0123 #define FDC_82078_UNKN  0x5f    /* Unknown 82078 variant */
0124 #define FDC_82078   0x60    /* 44pin 82078 or 64pin 82078SL */
0125 #define FDC_82078_1 0x61    /* 82078-1 (2Mbps fdc) */
0126 #define FDC_S82078B 0x62    /* S82078B (first seen on Adaptec AVA-2825 VLB
0127                  * SCSI/EIDE/Floppy controller) */
0128 #define FDC_87306   0x63    /* National Semiconductor PC 87306 */
0129 
0130 /*
0131  * Beware: the fdc type list is roughly sorted by increasing features.
0132  * Presence of features is tested by comparing the FDC version id with the
0133  * "oldest" version that has the needed feature.
0134  * If during FDC detection, an obscure test fails late in the sequence, don't
0135  * assign FDC_UNKNOWN. Else the FDC will be treated as a dumb 8272a, or worse.
0136  * This is especially true if the tests are unneeded.
0137  */
0138 
0139 #define FD_RESET_DELAY 20
0140 #endif