15#if defined(SARCH_PC98)
16#define IDX_IO1_i_Data 0x00
17#define IDX_IO1_i_Error 0x02
18#define IDX_IO1_i_BlockCount 0x04
19#define IDX_IO1_i_BlockNumber 0x06
20#define IDX_IO1_i_CylinderLow 0x08
21#define IDX_IO1_i_CylinderHigh 0x0A
22#define IDX_IO1_i_DriveSelect 0x0C
23#define IDX_IO1_i_Status 0x0E
25#define IDX_IO2_i_AltStatus 0x10C
26#define IDX_IO2_i_DriveAddress 0x10E
27#define IDE_IO_i_Bank 0x432
29#define IDX_IO1_o_Data 0x00
30#define IDX_IO1_o_Feature 0x02
31#define IDX_IO1_o_BlockCount 0x04
32#define IDX_IO1_o_BlockNumber 0x06
33#define IDX_IO1_o_CylinderLow 0x08
34#define IDX_IO1_o_CylinderHigh 0x0A
35#define IDX_IO1_o_DriveSelect 0x0C
36#define IDX_IO1_o_Command 0x0E
38#define IDX_IO2_o_Control 0x10C
39#define IDE_IO_o_BankSelect 0x432
41#define IDX_IO1_i_Data 0x00
42#define IDX_IO1_i_Error 0x01
43#define IDX_IO1_i_BlockCount 0x02
44#define IDX_IO1_i_BlockNumber 0x03
45#define IDX_IO1_i_CylinderLow 0x04
46#define IDX_IO1_i_CylinderHigh 0x05
47#define IDX_IO1_i_DriveSelect 0x06
48#define IDX_IO1_i_Status 0x07
50#define IDX_IO2_i_AltStatus 0x206
51#define IDX_IO2_i_DriveAddress 0x207
53#define IDX_IO1_o_Data 0x00
54#define IDX_IO1_o_Feature 0x01
55#define IDX_IO1_o_BlockCount 0x02
56#define IDX_IO1_o_BlockNumber 0x03
57#define IDX_IO1_o_CylinderLow 0x04
58#define IDX_IO1_o_CylinderHigh 0x05
59#define IDX_IO1_o_DriveSelect 0x06
60#define IDX_IO1_o_Command 0x07
62#define IDX_IO2_o_Control 0x206
68#if defined(SARCH_PC98)
69#define IDX_ATAPI_IO1_i_Data 0x00
70#define IDX_ATAPI_IO1_i_Error 0x02
71#define IDX_ATAPI_IO1_i_InterruptReason 0x04
72#define IDX_ATAPI_IO1_i_Unused1 0x06
73#define IDX_ATAPI_IO1_i_ByteCountLow 0x08
74#define IDX_ATAPI_IO1_i_ByteCountHigh 0x0A
75#define IDX_ATAPI_IO1_i_DriveSelect 0x0C
76#define IDX_ATAPI_IO1_i_Status 0x0E
78#define IDX_ATAPI_IO1_o_Data 0x00
79#define IDX_ATAPI_IO1_o_Feature 0x02
80#define IDX_ATAPI_IO1_o_Unused0 0x04
81#define IDX_ATAPI_IO1_o_Unused1 0x06
82#define IDX_ATAPI_IO1_o_ByteCountLow 0x08
83#define IDX_ATAPI_IO1_o_ByteCountHigh 0x0A
84#define IDX_ATAPI_IO1_o_DriveSelect 0x0C
85#define IDX_ATAPI_IO1_o_Command 0x0E
87#define IDX_ATAPI_IO1_i_Data 0x00
88#define IDX_ATAPI_IO1_i_Error 0x01
89#define IDX_ATAPI_IO1_i_InterruptReason 0x02
90#define IDX_ATAPI_IO1_i_Unused1 0x03
91#define IDX_ATAPI_IO1_i_ByteCountLow 0x04
92#define IDX_ATAPI_IO1_i_ByteCountHigh 0x05
93#define IDX_ATAPI_IO1_i_DriveSelect 0x06
94#define IDX_ATAPI_IO1_i_Status 0x07
96#define IDX_ATAPI_IO1_o_Data 0x00
97#define IDX_ATAPI_IO1_o_Feature 0x01
98#define IDX_ATAPI_IO1_o_Unused0 0x02
99#define IDX_ATAPI_IO1_o_Unused1 0x03
100#define IDX_ATAPI_IO1_o_ByteCountLow 0x04
101#define IDX_ATAPI_IO1_o_ByteCountHigh 0x05
102#define IDX_ATAPI_IO1_o_DriveSelect 0x06
103#define IDX_ATAPI_IO1_o_Command 0x07
109#define IDE_STATUS_SUCCESS 0x00
110#define IDE_STATUS_ERROR 0x01
111#define IDE_STATUS_INDEX 0x02
112#define IDE_STATUS_CORRECTED_ERROR 0x04
113#define IDE_STATUS_DRQ 0x08
114#define IDE_STATUS_DSC 0x10
115#define IDE_STATUS_DMA 0x20
116#define IDE_STATUS_DWF 0x20
117#define IDE_STATUS_DRDY 0x40
118#define IDE_STATUS_IDLE 0x50
119#define IDE_STATUS_BUSY 0x80
121#define IDE_STATUS_WRONG 0xff
122#define IDE_STATUS_MASK 0xff
127#define IDE_DRIVE_SELECT 0xA0
128#define IDE_DRIVE_1 0x00
129#define IDE_DRIVE_2 0x10
130#define IDE_DRIVE_SELECT_1 (IDE_DRIVE_SELECT | IDE_DRIVE_1)
131#define IDE_DRIVE_SELECT_2 (IDE_DRIVE_SELECT | IDE_DRIVE_2)
132#define IDE_DRIVE_MASK (IDE_DRIVE_SELECT_1 | IDE_DRIVE_SELECT_2)
133#define IDE_USE_LBA 0x40
138#define IDE_DC_DISABLE_INTERRUPTS 0x02
139#define IDE_DC_RESET_CONTROLLER 0x04
140#define IDE_DC_A_4BIT 0x80
141#define IDE_DC_USE_HOB 0x80
142#define IDE_DC_REENABLE_CONTROLLER 0x00
147#define IDE_ERROR_ICRC 0x80
148#define IDE_ERROR_BAD_BLOCK 0x80
149#define IDE_ERROR_DATA_ERROR 0x40
150#define IDE_ERROR_MEDIA_CHANGE 0x20
151#define IDE_ERROR_ID_NOT_FOUND 0x10
152#define IDE_ERROR_MEDIA_CHANGE_REQ 0x08
153#define IDE_ERROR_COMMAND_ABORTED 0x04
154#define IDE_ERROR_END_OF_MEDIA 0x02
155#define IDE_ERROR_NO_MEDIA 0x02
156#define IDE_ERROR_ILLEGAL_LENGTH 0x01
284#define IDENTIFY_DATA_SIZE sizeof(IDENTIFY_DATA)
286#define ATAPI_MAGIC_LSB 0x14
287#define ATAPI_MAGIC_MSB 0xEB
288#define MAXIMUM_CDROM_SIZE 804
303#define ATA_DEVICE_ATAPI (1 << 0)
304#define ATA_DEVICE_NO_MEDIA (1 << 1)
305#define ATA_DEVICE_NOT_READY (1 << 2)
306#define ATA_DEVICE_LBA48 (1 << 3)
307#define ATA_DEVICE_LBA (1 << 4)
308#define ATA_DEVICE_CHS (1 << 5)
struct _IDENTIFY_DATA * PIDENTIFY_DATA
PDEVICE_UNIT AtaGetDevice(IN UCHAR UnitNumber)
struct _IDENTIFY_DATA IDENTIFY_DATA
struct _DEVICE_UNIT * PDEVICE_UNIT
struct _DEVICE_UNIT DEVICE_UNIT
BOOLEAN AtaAtapiReadLogicalSectorsLBA(IN OUT PDEVICE_UNIT DeviceUnit, IN ULONGLONG SectorNumber, IN ULONG SectorCount, OUT PVOID Buffer)
BOOLEAN AtaInit(OUT PUCHAR DetectedCount)
IDENTIFY_DATA IdentifyData
USHORT NumberOfCurrentCylinders
USHORT UnformattedBytesPerSector
USHORT SingleWordDMASupport
USHORT NumberOfCurrentHeads
ULONG UserAddressableSectors
struct _IDENTIFY_DATA::@176 FeaturesEnabled
USHORT MultiWordDMASupport
ULONGLONG UserAddressableSectors48
struct _IDENTIFY_DATA::@176 FeaturesSupport
USHORT CurrentSectorsPerTrack
USHORT CurrentMultiSectorSetting
USHORT TranslationFieldsValid
USHORT ReleaseTimeServiceCommand
UCHAR ReadWriteMultipleSupport
USHORT UnformattedBytesPerTrack
USHORT SingleWordDMAActive
USHORT FirmwareRevision[4]
USHORT MultiWordDMAActive
USHORT RecommendedMWXferCycleTime
USHORT MinimumPIOCycleTimeIORDY
USHORT MinimumMWXferCycleTime
USHORT ReleaseTimeOverlapped
ULONG CurrentSectorCapacity
USHORT MinimumPIOCycleTime