Below is a an example specified by standard body (these command are OS agnostic):
https://github.com/gcastigl/SO2C2011TP2/blob/master/doc/ATA%20-%20ATAPI%20Command%20Set.pdf
Look at all the "ATA_CMD_*" command here:
Look at all the "ATA_CMD_*" command here:
So the drivers just literally concatenate these command into a string and send it over to the device.
for example in drivers/ata/libata-core.c:
static int ata_read_native_max_address(struct ata_device *dev, u64 *max_sectors)
{
unsigned int err_mask;
struct ata_taskfile tf;
int lba48 = ata_id_has_lba48(dev->id);
ata_tf_init(dev, &tf);
/* always clear all address registers */
tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
if (lba48) {
tf.command = ATA_CMD_READ_NATIVE_MAX_EXT;
tf.flags |= ATA_TFLAG_LBA48;
} else
tf.command = ATA_CMD_READ_NATIVE_MAX;
the tf.command data within is ultimately send by port I/O operation. BUT.....not sure of details, corrections welcome :-).
On Thu, Feb 7, 2013 at 4:19 PM, horseriver <horserivers@xxxxxxxxx> wrote:
hi:)
I am curious about how hd controller work .
When user am reaing/writing hd ,it was implemented by sending command
to hd controller's special port.Then ,how does the controller know
a new command has received?
In this procedure , what work does the hd driver do ?
thanks!
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Regards,
Peter Teoh
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies