;Table 9 - Command codes and parameters ;|-------|-----------------------------------|------|---------|------------------------- ;| | | | | Parameters used | ;| | | | Command |------------------------- ;| Class | Command name | type | code | FR | SC | SN | CY | DH | ;|-------| ----------------------------------|------|---------|----|----|----|--- |----| ;| 1 | Acknowledge media change | O | #DB | | | | | D | ;| 1 | Boot - post-boot | O | #DC | | | | | D | ;| 1 | Boot - pre-boot | O | #DD | | | | | D | ;| 1 | Check power mode | O | #98 #E5 | | y | | | D | ;| 1 | Door lock | O | #DE | | | | | D | ;| 1 | Door unlock | O | #DF | | | | | D | ;| 1 | Execute drive diagnostic | M | #90 | | | | | D* | ;| 2 | Format track | M | #50 | * | y | | y | y | ;| 1 | Identify drive | O | #EC | | | | | D | ;| 1 | Idle | O | #97 #E3 | | y | | | D | ;| 1 | Idle immediate | O | #95 #E1 | | | | | D | ;| 1 | Initialize drive parameters | M | #91 | | y | | | y | ;| 1 | NOP | O | #00 | | | | | y | ;| 1 | Read buffer | O | #E4 | | | | | D | ;| 1 | Read DMA (w/retry) | O | #C8 | | y | y | y | y | ;| 1 | Read DMA (w/o retry) | O | #C9 | | y | y | y | y | ;| 1 | Read long (w/retry) | M | 22 | | y | y | y | y | ;| 1 | Read long (w/o retry) | M | 23 | | y | y | y | y | ;| 1 | Read multiple | O | #C4 | | y | y | y | y | ;| 1 | Read sector(s) (w/retry) | M | 20 | | y | y | y | y | ;| 1 | Read sector(s) (w/o retry) | M | 21 | | y | y | y | y | ;| 1 | Read verify sector(s) (w/retry) | M | 40 | | y | y | y | y | ;| 1 | Read verify sector(s) (w/o retry) | M | 41 | | y | y | y | y | ;| 1 | Recalibrate | M | #1x | | | | | D | ;| 1 | Seek | M | #7x | | | y | y | y | ;| 1 | Set features | O | #EF | y | | | | D | ;| 1 | Set multiple mode | O | #C6 | | y | | | D | ;| 1 | Sleep | O | #99 #E6 | | | | | D | ;| 1 | Standby | O | #96 #E2 | | y | | | D | ;| 1 | Standby immediate | O | #94 #E0 | | | | | D | ;| 2 | Write buffer | O | #E8 | | | | | D | ;| 3 | Write DMA (w/retry) | O | #CA | | y | y | y | y | ;| 3 | Write DMA (w/o retry) | O | #CB | | y | y | y | y | ;| 2 | Write long (w/retry) | M | 32 | * | y | y | y | y | ;| 2 | Write long (w/o retry) | M | 33 | * | y | y | y | y | ;| 3 | Write multiple | O | #C5 | * | y | y | y | y | ;| 3 | Write same | O | #E9 | y | y | y | y | y | ;| 2 | Write sector(s) (w/retry) | M | 30 | * | y | y | y | y | ;| 2 | Write sector(s) (w/o retry) | M | 31 | * | y | y | y | y | ;| 3 | Write verify | O | #3C | * | y | y | y | y | ;| | Vendor unique | V | #9A | | | | | | ;| | Vendor unique | V | #C0-#C3 | | | | | | ;| | Vendor unique | V | #8x | | | | | | ;| | Vendor unique | V | #F0-#FF | | | | | | ;| | Reserved: all remaining codes | | | | | | | | ;| ----- | ----------------------------------| ---- | ------- |----|----|--- |--- |--- | ;| CY = Cylinder registers SC = Sector count register ;| DH = Drive/head register SN = Sector number register ;| FR = Features register (see command descriptions for use) ;| y - the register contains a valid parameter for this command. For the drive/head ;| register, y means both the drive and head parameters are used. ;| D - only the drive parameter is valid and not the head parameter. ;| D* - Addressed to drive 0 but both drives execute it. ;| * - Maintained for compatibility (see 7.2.10) ; ; The drive shall implement all mandatory commands as identified by an M, and may ; implement the optional commands identified by an O. V - a Vendor Specific command code. ; ATA-2 commands ************************ ATA_EXECUTE_DEVICE_DIAGNOSTIC EQU #90 ATA_IDENTIFY_DEVICE EQU #EC ATA_INITIALIZE_DEVICE_PARAMETERS EQU #91 ATA_READ_SECTORS EQU #20 ; WITH RETRY ATA_READ_VERIFY_SECTORS EQU #40 ; WITH RETRY ; EQU #70-#7f ATA_SEEK EQU #70 ATA_WRITE_SECTORS EQU #30 ; WITH RETRY ; ****** additional commands ************ ATA_ACKNOWLEDGE_MEDIA_CHANGE EQU #db ATA_POST_BOOT EQU #dc ATA_PRE_BOOT EQU #dd ATA_CHECK_POWER_MODE EQU #98 ATA_CHECK_POWER_MODE2 EQU #e5 ATA_DOOR_LOCK EQU #de ATA_DOOR_UNLOCK EQU #df ATA_DOWNLOAD_MICROCODE EQU #92 ATA_IDLE EQU #97 ATA_IDLE2 EQU #e3 ATA_IDLE_IMMEDIATE EQU #95 ATA_IDLE_IMMEDIATE2 EQU #e1 ATA_MEDIA_EJECT EQU #ed ATA_NOP EQU #00 ATA_READ_BUFFER EQU #e4 ATA_READ_DMA EQU #c8 ATA_READ_LONG EQU #22 ATA_READ_MULTIPLE EQU #c4 ; EQU #10-#1f ATA_RECALIBRATE EQU #10 ATA_SET_FEATURES EQU #ef ATA_SET_MULTIPLE_MODE EQU #c6 ATA_SLEEP EQU #99 ATA_SLEEP2 EQU #e6 ATA_STANDBY EQU #96 ATA_STANDBY2 EQU #e2 ATA_STANDBY_IMMEDIATE EQU #94 ATA_STANDBY2_IMMEDIATE EQU #e0 ATA_WRITE_BUFFER EQU #e8 ATA_WRITE_DMA EQU #ca ATA_WRITE_LONG EQU #32 ATA_WRITE_MULTIPLY EQU #c5 ATA_WRITE_SAME EQU #e9 ATA_WRITE_VERIFY EQU #3c ; **** device specific commands ************* ; !TODO remap command ATA_FORMAT_TRACK EQU #50 ; command modificators ; for ATA_READ_SECTORS, ATA_WRITE_SECTORS, ATA_VERIFY_SECTORS, ; ATA_READ_DMA, ATA_WRITE_DMA, ATA_READ_LONG, ATA_WRITE_LONG ATA_WITHOUT_RETRY EQU #01 ; ATA registers ***************************** ; command registers ; ATA_DATA_REG EQU 0 ; ATA_ERROR_REG EQU 1 ; ATA_FEATURES_REG EQU 1 ; ATA_SECTOR_COUNT EQU 2 ; ATA_SECTOR_NUMBER EQU 3 ; ATA_CYLINDER_LOW EQU 4 ; ATA_CYLINDER_HIGH EQU 5 ; ATA_DEVICE_HEAD EQU 6 ; ATA_STATUS EQU 7 ; ATA_COMMAND EQU 7 ; control registers ; ATA_ALTERNATE_STATUS EQU #16 ; ATA_DEVICE_CONTROL EQU #16 ; ATA_DRIVE_ADDRESS EQU #17 ; status register bits ; ATA_BUSY EQU #80 ; ATA_READY EQU #40 ; ATA_FAULT EQU #20 ; ATA_SEEK_COMPLETE EQU #10 ; ATA_DATA_REQUEST EQU #08 ; ATA_CORRECTED_DATA EQU #04 ; ATA_INDEX EQU #02 ; ATA_ERROR EQU #01 ; device/head register bits ; ATA_LBA EQU #40 ; ATA_DEVICE EQU #10 ; device control register bits ; ATA_SOFT_RESET EQU #04 ; ATA_INTERRUPT_DISABLE EQU #02 ; error register bits ; ATA_UNCORRECTABLE EQU #40 ; ATA_MEDIA_CHANGED EQU #20 ; ATA_ID_NOT_FOUND EQU #10 ; ATA_ABORTED EQU #08 ; ATA_MEDIA_CHANGE_REQUESTED EQU #04 ; ATA_TRACK_0_NOT_FOUND EQU #02 ; ATA_ADDERSS_MARK_NOT_FOUND EQU #01 ;