Author Topic: is there any comprehensive doc for pATA commands?  (Read 1390 times)

0 Members and 1 Guest are viewing this topic.

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 5093
  • Country: gb
is there any comprehensive doc for pATA commands?
« on: February 09, 2025, 04:12:01 pm »
hi
I am writing a monitor program (with a built-in gdb-stub) and would like to use microdrives and parallel ATA disks.
I googled, but I was not able to find comphrensive documentation with detailed "ATA command" and parameters, with use examples if it's possible.

Code: [Select]
/* ATA device commands */
        ATA_CMD_DEV_RESET       = 0x08, /* ATAPI device reset */
        ATA_CMD_CHK_POWER       = 0xE5, /* check power mode */
        ATA_CMD_STANDBY         = 0xE2, /* place in standby power mode */
        ATA_CMD_IDLE            = 0xE3, /* place in idle power mode */
        ATA_CMD_EDD             = 0x90, /* execute device diagnostic */
        ATA_CMD_DOWNLOAD_MICRO  = 0x92,
        ATA_CMD_DOWNLOAD_MICRO_DMA = 0x93,
        ATA_CMD_NOP             = 0x00,
        ATA_CMD_FLUSH           = 0xE7,
        ATA_CMD_FLUSH_EXT       = 0xEA,
        ATA_CMD_ID_ATA          = 0xEC,
        ATA_CMD_ID_ATAPI        = 0xA1,
        ATA_CMD_SERVICE         = 0xA2,
        ATA_CMD_READ            = 0xC8,
        ATA_CMD_READ_EXT        = 0x25,
        ATA_CMD_READ_QUEUED     = 0x26,
        ATA_CMD_READ_STREAM_EXT = 0x2B,
        ATA_CMD_READ_STREAM_DMA_EXT = 0x2A,
        ATA_CMD_WRITE           = 0xCA,
        ATA_CMD_WRITE_EXT       = 0x35,
        ATA_CMD_WRITE_QUEUED    = 0x36,
        ATA_CMD_WRITE_STREAM_EXT = 0x3B,
        ATA_CMD_WRITE_STREAM_DMA_EXT = 0x3A,
        ATA_CMD_WRITE_FUA_EXT   = 0x3D,
        ATA_CMD_WRITE_QUEUED_FUA_EXT = 0x3E,
        ATA_CMD_FPDMA_READ      = 0x60,
        ATA_CMD_FPDMA_WRITE     = 0x61,
        ATA_CMD_NCQ_NON_DATA    = 0x63,
        ATA_CMD_FPDMA_SEND      = 0x64,
        ATA_CMD_FPDMA_RECV      = 0x65,
        ATA_CMD_PIO_READ        = 0x20,
        ATA_CMD_PIO_READ_EXT    = 0x24,
        ATA_CMD_PIO_WRITE       = 0x30,
        ATA_CMD_PIO_WRITE_EXT   = 0x34,
        ATA_CMD_READ_MULTI      = 0xC4,
        ATA_CMD_READ_MULTI_EXT  = 0x29,
        ATA_CMD_WRITE_MULTI     = 0xC5,
        ATA_CMD_WRITE_MULTI_EXT = 0x39,
        ATA_CMD_WRITE_MULTI_FUA_EXT = 0xCE,
        ATA_CMD_SET_FEATURES    = 0xEF,
        ATA_CMD_SET_MULTI       = 0xC6,
        ATA_CMD_PACKET          = 0xA0,
        ATA_CMD_VERIFY          = 0x40,
        ATA_CMD_VERIFY_EXT      = 0x42,
        ATA_CMD_WRITE_UNCORR_EXT = 0x45,
        ATA_CMD_STANDBYNOW1     = 0xE0,
        ATA_CMD_IDLEIMMEDIATE   = 0xE1,
        ATA_CMD_SLEEP           = 0xE6,
        ATA_CMD_INIT_DEV_PARAMS = 0x91,
        ATA_CMD_READ_NATIVE_MAX = 0xF8,
        ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
        ATA_CMD_SET_MAX         = 0xF9,
        ATA_CMD_SET_MAX_EXT     = 0x37,
        ATA_CMD_READ_LOG_EXT    = 0x2F,
        ATA_CMD_WRITE_LOG_EXT   = 0x3F,
        ATA_CMD_READ_LOG_DMA_EXT = 0x47,
        ATA_CMD_WRITE_LOG_DMA_EXT = 0x57,
        ATA_CMD_TRUSTED_NONDATA = 0x5B,
        ATA_CMD_TRUSTED_RCV     = 0x5C,
        ATA_CMD_TRUSTED_RCV_DMA = 0x5D,
        ATA_CMD_TRUSTED_SND     = 0x5E,
        ATA_CMD_TRUSTED_SND_DMA = 0x5F,
        ATA_CMD_PMP_READ        = 0xE4,
        ATA_CMD_PMP_READ_DMA    = 0xE9,
        ATA_CMD_PMP_WRITE       = 0xE8,
        ATA_CMD_PMP_WRITE_DMA   = 0xEB,
        ATA_CMD_CONF_OVERLAY    = 0xB1,
        ATA_CMD_SEC_SET_PASS    = 0xF1,
        ATA_CMD_SEC_UNLOCK      = 0xF2,
        ATA_CMD_SEC_ERASE_PREP  = 0xF3,
        ATA_CMD_SEC_ERASE_UNIT  = 0xF4,
        ATA_CMD_SEC_FREEZE_LOCK = 0xF5,
        ATA_CMD_SEC_DISABLE_PASS = 0xF6,
        ATA_CMD_CONFIG_STREAM   = 0x51,
        ATA_CMD_SMART           = 0xB0,
        ATA_CMD_MEDIA_LOCK      = 0xDE,
        ATA_CMD_MEDIA_UNLOCK    = 0xDF,
        ATA_CMD_DSM             = 0x06,
        ATA_CMD_CHK_MED_CRD_TYP = 0xD1,
        ATA_CMD_CFA_REQ_EXT_ERR = 0x03,
        ATA_CMD_CFA_WRITE_NE    = 0x38,
        ATA_CMD_CFA_TRANS_SECT  = 0x87,
        ATA_CMD_CFA_ERASE       = 0xC0,
        ATA_CMD_CFA_WRITE_MULT_NE = 0xCD,
        ATA_CMD_REQ_SENSE_DATA  = 0x0B,
        ATA_CMD_SANITIZE_DEVICE = 0xB4,
        ATA_CMD_ZAC_MGMT_IN     = 0x4A,
        ATA_CMD_ZAC_MGMT_OUT    = 0x9F,

        /* marked obsolete in the ATA/ATAPI-7 spec */
        ATA_CMD_RESTORE         = 0x10,
(from ata.h, Linux kernel)

The alternative is to extract information from the linux kernel sources, only that they are quite messed up, as usual.
Or from uboot sources, which is inspired by the linux kernel, and therefore the same level of confusion...


Code: [Select]
#define ATA_CMD_READ_PIO           0x20 // works on Hitachi 4G, CF1G, panics on Seagate 5G!!!!
#define ATA_CMD_READ_PIO_EXT       0x24 // not used
#define ATA_CMD_READ_DMA           0xC8 // not used
#define ATA_CMD_READ_DMA_EXT       0x25 // not used
#define ATA_CMD_WRITE_PIO          0x30 //  works on Hitachi 4G, CF1G, panics on Seagate 5G!!!!
#define ATA_CMD_WRITE_PIO_EXT      0x34 // not used
#define ATA_CMD_WRITE_DMA          0xCA // not used
#define ATA_CMD_WRITE_DMA_EXT      0x35 // not used
#define ATA_CMD_CACHE_FLUSH        0xE7 // does not work with MicroDrive Seagate 5Gbyte
#define ATA_CMD_CACHE_FLUSH_EXT    0xEA // not used
#define ATA_CMD_PACKET             0xA0 // not used, wtf?
#define ATA_CMD_IDENTIFY_PACKET    0xA1 // not used, wtf?
#define ATA_CMD_IDENTIFY           0xEC // works!!!
#define ATA_CMD_SPINSDOWN          0xE0 // does nothing?!?
#define ATA_CMD_SPINSUP            0xE1 // does not work with MicroDrive Seagate 5Gbyte
This is what i have already implemented.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1919
  • Country: gb
Re: is there any comprehensive doc for pATA commands?
« Reply #1 on: February 10, 2025, 01:54:41 pm »
Why not just refer directly to the specification itself? There are PDF copies on archive.org linked from the PATA Wikipedia article.
 

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 5093
  • Country: gb
Re: is there any comprehensive doc for pATA commands?
« Reply #2 on: February 10, 2025, 04:07:13 pm »
ATA, ATAPI, etc, info here
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf