at the lowest level, SCSI/IDE/SATA all shared a common command base (perhaps with variations) - which is ATA command (because in drivers/ata/*.c u can find the symbol ATA_XXX_CMD in all the three different hardware architecture):
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: https://github.com/Scorpiion/Renux_u-boot/blob/master/include/ata.h 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 <[email protected]> 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 > [email protected] > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > -- Regards, Peter Teoh
_______________________________________________ Kernelnewbies mailing list [email protected] http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
