[150] | 1 | ; Project name : XTIDE Universal BIOS
|
---|
[3] | 2 | ; Description : Equates for IDE registers, flags and commands.
|
---|
| 3 | %ifndef IDEREGISTERS_INC
|
---|
| 4 | %define IDEREGISTERS_INC
|
---|
| 5 |
|
---|
| 6 | ; IDE Register offsets from Command Block base port
|
---|
[150] | 7 | DATA_REGISTER EQU 0
|
---|
| 8 | ERROR_REGISTER_in EQU 1 ; Read only
|
---|
| 9 | FEATURES_REGISTER_out EQU 1 ; Write only, ATA1+
|
---|
| 10 | ;WRITE_PRECOMPENSATION_out EQU 1 ; Write only, Obsolete on ATA1+
|
---|
| 11 | SECTOR_COUNT_REGISTER EQU 2
|
---|
| 12 | SECTOR_NUMBER_REGISTER EQU 3 ; LBA Low Register
|
---|
| 13 | LOW_CYLINDER_REGISTER EQU 4 ; LBA Middle Register
|
---|
| 14 | HIGH_CYLINDER_REGISTER EQU 5 ; LBA High Register
|
---|
| 15 | LBA_LOW_REGISTER EQU 3 ; LBA 7...0, LBA48 31...24
|
---|
| 16 | LBA_MIDDLE_REGISTER EQU 4 ; LBA 15...8, LBA48 39...32
|
---|
| 17 | LBA_HIGH_REGISTER EQU 5 ; LBA 23...16, LBA48 47...40
|
---|
| 18 | DRIVE_AND_HEAD_SELECT_REGISTER EQU 6 ; LBA28 27...24
|
---|
| 19 | STATUS_REGISTER_in EQU 7 ; Read only
|
---|
| 20 | COMMAND_REGISTER_out EQU 7 ; Write only
|
---|
[158] | 21 | ;XTIDE_DATA_HIGH_REGISTER EQU 8 ; Non-standard (actually first Control Block reg)
|
---|
[3] | 22 |
|
---|
| 23 | ; IDE Register offsets from Control Block base port
|
---|
| 24 | ; (usually Command Block base port + 200h)
|
---|
[150] | 25 | ALTERNATE_STATUS_REGISTER_in EQU 6 ; Read only
|
---|
| 26 | DEVICE_CONTROL_REGISTER_out EQU 6 ; Write only
|
---|
| 27 | ;DRIVE_ADDRESS_REGISTER EQU 7 ; Obsolete on ATA2+
|
---|
[3] | 28 |
|
---|
[150] | 29 | ; Bit mask for XTIDE mod with reversed A0 and A3 address lines
|
---|
| 30 | MASK_A3_AND_A0_ADDRESS_LINES EQU ((1<<3) | (1<<0))
|
---|
[3] | 31 |
|
---|
| 32 | ; Bit definitions for IDE Error Register
|
---|
[150] | 33 | FLG_ERROR_BBK EQU (1<<7) ; Bad Block Detected (reserved on ATA2+, command dependent on ATA4+)
|
---|
| 34 | FLG_ERROR_UNC EQU (1<<6) ; Uncorrectable Data Error (command dependent on ATA4+)
|
---|
| 35 | FLG_ERROR_MC EQU (1<<5) ; Media Changed (command dependent on ATA4+)
|
---|
| 36 | FLG_ERROR_IDNF EQU (1<<4) ; ID Not Found (command dependent on ATA4+)
|
---|
| 37 | FLG_ERROR_MCR EQU (1<<3) ; Media Change Request (command dependent on ATA4+)
|
---|
| 38 | FLG_ERROR_ABRT EQU (1<<2) ; Command Aborted
|
---|
| 39 | FLG_ERROR_TK0NF EQU (1<<1) ; Track 0 Not Found (command dependent on ATA4+)
|
---|
| 40 | FLG_ERROR_AMNF EQU (1<<0) ; Address Mark Not Found (command dependent on ATA4+)
|
---|
[3] | 41 |
|
---|
| 42 | ; Bit definitions for IDE Drive and Head Select Register
|
---|
[150] | 43 | FLG_DRVNHEAD_LBA EQU (1<<6) ; LBA Addressing enabled (instead of CHS)
|
---|
| 44 | FLG_DRVNHEAD_DRV EQU (1<<4) ; Drive Select (0=Master, 1=Slave)
|
---|
| 45 | MASK_DRVNHEAD_HEAD EQU 0Fh ; Head select bits (bits 0...3)
|
---|
| 46 | MASK_DRVNHEAD_SET EQU 0A0h ; Bits that must be set to 1 on ATA1 (reserved on ATA2+)
|
---|
[3] | 47 |
|
---|
| 48 | ; Bit definitions for IDE Status Register
|
---|
[150] | 49 | FLG_STATUS_BSY EQU (1<<7) ; Busy (other flags undefined when set)
|
---|
| 50 | FLG_STATUS_DRDY EQU (1<<6) ; Device Ready
|
---|
| 51 | FLG_STATUS_DF EQU (1<<5) ; Device Fault (command dependent on ATA4+)
|
---|
| 52 | FLG_STATUS_DSC EQU (1<<4) ; Device Seek Complete (command dependent on ATA4+)
|
---|
| 53 | FLG_STATUS_DRQ EQU (1<<3) ; Data Request
|
---|
| 54 | FLG_STATUS_CORR EQU (1<<2) ; Corrected Data (obsolete on ATA4+)
|
---|
| 55 | FLG_STATUS_IDX EQU (1<<1) ; Index (vendor specific on ATA2+, obsolete on ATA4+)
|
---|
| 56 | FLG_STATUS_ERR EQU (1<<0) ; Error
|
---|
[3] | 57 |
|
---|
| 58 | ; Bit definitions for IDE Device Control Register
|
---|
| 59 | ; Bit 0 must be zero, unlisted bits are reserved.
|
---|
[158] | 60 | ;FLG_DEVCONTROL_HOB EQU (1<<7) ; High Order Byte (ATA6+)
|
---|
[150] | 61 | ;FLG_DEVCONTROL_O8H EQU (1<<3) ; Drive has more than 8 heads (pre-ATA only, 1 on ATA1, reserved on ATA2+)
|
---|
| 62 | FLG_DEVCONTROL_SRST EQU (1<<2) ; Software Reset
|
---|
| 63 | FLG_DEVCONTROL_nIEN EQU (1<<1) ; Negated Interrupt Enable (IRQ disabled when set)
|
---|
[3] | 64 |
|
---|
| 65 | ; Commands for IDE Controller
|
---|
[150] | 66 | COMMAND_READ_SECTORS EQU 20h
|
---|
| 67 | COMMAND_READ_SECTORS_EXT EQU 24h ; LBA48
|
---|
| 68 | COMMAND_WRITE_SECTORS EQU 30h
|
---|
| 69 | COMMAND_WRITE_SECTORS_EXT EQU 34h ; LBA48
|
---|
| 70 | COMMAND_VERIFY_SECTORS EQU 40h
|
---|
| 71 | COMMAND_VERIFY_SECTORS_EXT EQU 42h ; LBA48
|
---|
| 72 | COMMAND_SEEK EQU 70h
|
---|
| 73 | COMMAND_INITIALIZE_DEVICE_PARAMETERS EQU 91h
|
---|
| 74 | COMMAND_SET_MULTIPLE_MODE EQU 0C6h ; Block mode
|
---|
| 75 | COMMAND_READ_MULTIPLE EQU 0C4h ; Block mode
|
---|
| 76 | COMMAND_READ_MULTIPLE_EXT EQU 29h ; LBA48, Block mode
|
---|
| 77 | COMMAND_WRITE_MULTIPLE EQU 0C5h ; Block mode
|
---|
| 78 | COMMAND_WRITE_MULTIPLE_EXT EQU 39h ; LBA48, Block mode
|
---|
| 79 | COMMAND_IDENTIFY_DEVICE EQU 0ECh
|
---|
| 80 | COMMAND_SET_FEATURES EQU 0EFh
|
---|
[3] | 81 |
|
---|
| 82 |
|
---|
[276] | 83 | ; Subcommands for COMMAND_SET_FEATURES
|
---|
| 84 | FEATURE_ENABLE_WRITE_CACHE EQU 02h
|
---|
| 85 | FEATURE_DISABLE_WRITE_CACHE EQU 82h ; Can also be used to flush cache
|
---|
| 86 |
|
---|
| 87 |
|
---|
[3] | 88 | %endif ; IDEREGISTERS_INC
|
---|