Help in accessing SATA device
Hi all
I want to know the basics of SATA driver and how the sata devices are communicated to the driver. In PATA we have ports to access the devices.is there anything for SATA.As in a beginner stage can anyone help me? Thanks in advance. |
check this out ok. http://en.wikipedia.org/wiki/SATA
|
in linux it is loaded as a scsi and linux assigns the device a sda and for every partition it is
sda1 or 2 or 3 then the next drive is sdb. the modules are built into the kernel and are detected at boot up then are ported into the loop.after this I am out of my league. |
Thanks Drakeo.
Suppose if i have SATA device connected to the system , in that i have installed Linux and i want to get the serial number of the hard disk. Usually in PATA we issue identify drive command to get the device details to the port address where it is connected. But incase of SATA how can issue the command ....what is the structure for sending the commands. |
Well I know one way to get the serial number, you can use 'smartctl' if your drive supports SMART.
|
I have found site that tells about sending ATA commands to SATA device using sg ioctl. I have filled the sg structure with the below value.I am running this program in Fedora4
sg_io.interface_id = 'S'; sg_io.cmdp = cdb; sg_io.cmd_len = sizeof(cdb); sg_io.dxferp = data_in_buffer; sg_io.dxfer_len = 512;//data_in_length; // sg_io.dxfer_direction = SG_DXFER_FROM_DEV; sg_io.sbp = sense; sg_io.mx_sb_len = sizeof(sense); sg_io.timeout = 15000; and CDB structure is, cdb[0] = 0x85; // ATA pass-through 12 cdb[1] = (4 << 1); // data-in cdb[2] = 0x2e; // data-in cdb[4] = 0x00; // ATA feature ID cdb[6] = 1; // number of sector cdb[7] = 0x00; //lba_low >> 8; cdb[8] = 0x00; //lba_low; cdb[9] = 0x00; //lba_mid >> 8; cdb[10] = 0x00; //lba_mid; cdb[11] = 0x00; //lba_high >> 8; cdb[12] = 0x00; //lba_high; cdb[14] = 0xEC; // ATA command ID I have checked CDB values which i am passing with the document "ATA over scsi standard passthru implementation." I am creating the handle for /dev/sda. After passing the ioctl i am getting wrong values in sense buffer. sense buffer[0]:0x70 sense buffer[1]:0x00 sense buffer[2]:0x05 sense buffer[3]:0x00 sense buffer[4]:0x00 sense buffer[5]:0x00 sense buffer[6]:0x00 sense buffer[7]:0x06 sense buffer[8]:0x00 sense buffer[9]:0x00 sense buffer[10]:0x00. As per program, these values are not valid. I dont know how they have defined like this. Can anyone help me regarding the sense buffer values. |
cat /proc/ide/ide0/hda/model
this will tell you the name and model. if you want to know if your device smart that is old stuff but still used set it to smart. when you boot the bios will read out smart drive capable and using it . if the drive is smart drive when you boot you and is not set to smart. then it willread out smart drive but not enabled good luck. sorry I do not have a sat drive but you can find the cat /proc/ / / comand very useful. |
cat /proc/scsi/scsi this will list your scis devices and info linuz sees sata as scsi.
|
All times are GMT -5. The time now is 10:44 PM. |