1. Background
    1. Programming Methods
      1. Legacy Method
      2. AHCI
        1. Advanced Host Controller Interface
      3. Register Access
    2. Layer Definition
      1. Application Layer
        1. Programming interface
      2. Transport Layer
        1. Construct and deliver the frames
      3. Manage virtually all of the link protocol
        1. Transmission
          1. Generate CRC for each FIS
          2. Scramble the FIS to reduce EMI
          3. Generate the Primitives used in the SATA protocol
        2. Reception
          1. Inverse operations
      4. Physical Layer
        1. Provide the SerDes
        2. Transceiver functions
        3. Link initialization
        4. Speed detection
  2. STP Support SATA
    1. SATA Link Layer performs many of the functions provided by the SAS Phy Layer
    2. STP essentially combines the SAS Link and Phy Layers into the STP Link Layer
    3. The STP Concept
      1. STP must simulate the SATA directly-connected host-to-drive topology
      2. Connected to
        1. Initiator
          1. Detect this condition during the OOB sequence
          2. The link simply operates using SATA protocol
          3. Not need for a connection
          4. No need for the use of STP
        2. Expander
          1. First establish a connection that use the STP
  3. Application Layer
  4. Transport Layer
    1. Main responsibility
      1. Construct outgoing frames
      2. Parse incoming frames
    2. Difference between SATA FIS and SSP
      1. FIS can carry up to 8KB of data
      2. Only 1KB for SSP
  5. Link Layer (STP)
    1. Link Layer Serial Support
    2. CRC Generation and Checking
      1. Outgoing Frames
      2. Incoming Frames
    3. Scrambling
      1. STP needs two scramblers
        1. FIS Scrambler
          1. Reduce EMI for each FIS
        2. Primitive Suppression Scrambler
          1. Reduce EMI for repeated primitives
          2. Only two are listed in the standard
          3. SATA_PMACK
          4. SATA_PMNAK
        3. Continued primitives
          1. At least 2 same primitive to be repeated
          2. Followed by the continue primitive "SATA_CONT"
          3. Use the Primitive Suppression scrambler to send scrambled data dwords
          4. Ignored by the receiver
        4. Reason
          1. Allow the main transmitter scrambler and receiver descrambler to maintain their states
  6. Connection Management
    1. STP Connections
      1. Half-duplex
        1. Allow frames to go one way at a time
        2. The other direction on the link carries feedback about the progress of the frame
      2. Little-endian
      3. Different flow control
    2. One the connection established
      1. Recognize the SATA flow control primitives
      2. Recognize the CLOSE primitive from the initiator
    3. Sending a FIS
    4. Acknowledging the FIS
    5. Closing the Connection
    6. Affliations
      1. Many initiators might access the same SATA target
        1. Save Nexus Info
          1. STP target keeps track of the source address for all of the initiators that access the port
          2. Allow multiple initiators to access the SATA device
          3. Keep some memory of the equivalent I_T_L_Q nexus information
        2. Affiliation
          1. STP target automatically store the source address of the initiator whenever it accepts a connection request
          2. Only allowing access by that initiator until the affiliation is cleared
    7. XRDY/XRDY Collision
    8. Throttling and SSC (Spread-Spectrum Clocking)
  7. Phy Layer
    1. Clock Management
      1. The number of ALIGNs fro SATA target is 2 within every 256 dwords
    2. 8/b10b Encoding and Decoding
  8. Endianess
    1. PCIe, SAS, IB
      1. Big-endian bytes
      2. Little-endian bits
    2. SATA
      1. Little-endian bytes
      2. Little-endian bits
    3. The primitives for SAS and SATA are both big endian
  9. SATA II
    1. Port Multipliers
      1. Allow one host port to access up to 15 target devices (0~14)
      2. Can't be cascaded
      3. App. set the port value to 15, send that device a software reset
    2. Port Selector
      1. Allow a SATA device to operate somewhat like a dual-ported device
      2. Allow two hosts to access one device to provide a fail-over mechanism
      3. Detected by the host during OOB when the response to the COMRESET
    3. Enclosure Management
    4. Native Command Queuing(NCQ)
      1. Permit the target device to re-order queued commands
      2. Better performance
      3. Both hardware and software support must be in place
      4. The use of a Port Multiplier limits the usefulness of NCQs
  10. Initiation
    1. Hardware Initialization
      1. Detect the presence of an attached device
        1. OOB signaling
          1. Transmission
          2. COMWAKE
          3. COMINIT/COMRESET
          4. Reception
          5. SATA OOB Protocol
          6. COMRESET/COMINIT
          7. Host → Target: COMRESET
          8. Reset the target
          9. Target → Host: COMINIT
          10. Indicate readiness for the next step
      2. Negotiate the highest common transmission rate supported by both devices
        1. Send a pattern at the desired rate to the neighbor and listen for the response
        2. Roles During Speed Negotiation
          1. Target controls this process
          2. Host as the responder
          3. Target has sent COMWAKE
          4. Target begins speed negotiation by sending ALIGN at the fastest rate
          5. If no correct response from host
          6. Switch to the next lower speed it supports
          7. If correct response from host
          8. Host sends ALIGNs back to the target
          9. Host send D10.2 repeatedly
          10. Until recognize ALIGN
          11. Only one version ALIGN(0)
        3. D10.2 Used as a Dial Tone
          1. 010101 0101
      3. SATA Link Initialization Example
    2. Software Initialization