bloggerads

2014年3月5日 星期三

SATA Spec

1. 介紹SATA的四個Layer:


•Application Layer:  
  • Overall  ATA  command  execution

•Transport Layer:  
  • Placing control information and data to be transferred between the host and device in a packet/frame (FIS)

•Link Layer:  
  • Taking data from the constructed  frames, encoding  or  decoding each byte using 8b/10b, and inserting control characters such that the 10-bit stream of data may be decoded correctly

•Physical Layer: 
  • Transmitting and receiving the encoded information as a serial data stream on the wire
2. Primitive
    用來控制和提供串列線路的狀態,由4個Byte所組成

3. BURST:  
  • OOB signaling is a pattern of ALIGNP primitives or Dwords composed of D24.3 characters and idle time and is used to initialize the Serial ATA interface (由特定的Primitive或4個D24.3所組成)
4. OOB信號:
  • COMRESET (Originate from Host)/ COMINIT (Originate from Device)
  • COMWAKE (for both host & device)
  • Consists of 6 bursts with different time gap

5. Speed negotiation:



6. SATA FIS:





2 則留言:

  1. 您好我想請問一下,我想要讓硬碟進入Standby mode,不過我怎麼作都不會成功,大大是否可以傳授一下,下面是我寫的code.謝謝!
    Kenny


    ATA_PASS_THROUGH_EX aptx;

    pdx = (PDEVICE_EXTENSION)filterDeviceObject->DeviceExtension;
    DeviceObject = pdx->TargetDeviceObject;
    KeInitializeEvent(&event, NotificationEvent, FALSE);

    RtlZeroMemory((char*)&aptx,sizeof(aptx));

    aptx.PathId = 0;
    aptx.TargetId = 0;
    aptx.Lun = 0;
    aptx.Length = sizeof(aptx);
    aptx.AtaFlags = ATA_FLAGS_DRDY_REQUIRED;
    aptx.DataTransferLength = 6;
    aptx.TimeOutValue = 0;

    aptx.CurrentTaskFile[0] = 0x00;//0x00;
    aptx.CurrentTaskFile[1] = 0x08;//0x00;
    aptx.CurrentTaskFile[2] = 0x4c;//0x00;
    aptx.CurrentTaskFile[3] = 0x4e;//0x00;
    aptx.CurrentTaskFile[4] = 0x55;//0x00;
    aptx.CurrentTaskFile[5] = 0xe0;//0xA1;
    aptx.CurrentTaskFile[6] = ATA_CMD;



    Irp = IoBuildDeviceIoControlRequest(IOCTL_ATA_PASS_THROUGH, DeviceObject,
    &aptx, sizeof(aptx),&aptx, sizeof(aptx), FALSE, &event, &iosb);

    /*
    Irp = IoBuildDeviceIoControlRequest(IOCTL_ATA_PASS_THROUGH, DeviceObject,
    &aptx, sizeof(aptx), NULL, 0 , FALSE, &event, &iosb);
    */

    if(!Irp)
    {

    KDF_DebugPrint(DBG_POWER,
    DBG_TRACE,
    __FUNCTION__"KDF_StopDisk: Unable to Build Irp\n");
    return(CSTATUS_IRP_ALLOCATION_FAIL);
    }
    status = IoCallDriver(DeviceObject, Irp);

    回覆刪除
    回覆
    1. 你應該是想透過IOCTL_ATA_PASS_THROUGH 對硬碟下 ATA command 的 Standby Immediate 吧? 網路上有很多類似的範例,建議你可以先參考如何下Identify command,然後再改成下不帶資料的Standby Immediate command

      刪除