source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Inc/IdeRegisters.inc@ 276

Last change on this file since 276 was 276, checked in by aitotat@…, 13 years ago

Changes to XTIDE Universal BIOS:

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