Serial Advanced Technology Attachment
(SATA)
Application Layer
Improving Networks Worldwide.
SATA Application Layer
Application Layer
• SATA Software Settings Preservation (SSP)
– Description of SSP
– SET FEATURES
– Preserved Settings Across COMRESET
• SATA Native Command Queuing (NCQ)
– How NCQ Works
– Description of NCQ
– Definitions
* SSP and NCQ are SATA specific features that were added because of increased capability. These features are often tested by OEMs and the SATA-IO certification program.
2
SATA Application Layer
Description of SSP
• Host configures a device when it is recognized using commands like SET
FEATURES and SSP commands
• Software settings are retained after a software reset
• When a COMRESET occurs, not all settings are necessarily preserved as a
COMRESET is essentially a hardware reset
3
SATA Application Layer
Description of SSP
• If there is an asynchronous loss of signal, a COMRESET is sent, some software settings are lost
• Without legacy mode drivers, SSP ensures that settings are maintained after a COMRESET
4
SATA Application Layer
Application Layer
• SATA Software Settings Preservation (SSP)
– Description of SSP
– SET FEATURES
– Preserved Settings Across COMRESET
• SATA Native Command Queuing (NCQ)
– How NCQ Works
– Description of NCQ
– Definitions
5
SATA Application Layer
SET FEATURES
• SET FEATURES Definition
• Features Enable / Disable Values
• Feature Identification Values
1.
Enable / Disable Non-Zero Offsets in DMA Setup
2.
Enable / Disable DMA Setup FIS Auto-Activate
Optimization
3.
Enable / Disable Device-Initiated Interface Power State
Transitions
4.
Enable / Disable Guaranteed in-Order Data Delivery
5.
Enable / Disable Asynchronous Notification
6.
Enable / Disable Software Settings Preservation
7.
Enable / Disable Device Automatic Partial to Slumber
Transitions
6
SATA Application Layer
SET FEATURES Definition
• SET FEATURES commands inform the device about host capabilities
• Features can be enabled and disabled
• The control of these features is designated by SET FEATURES
7
SATA Application Layer
Features Enable / Disable
Values
Features(7:0)
Value
10h
Description
Enable use of Serial ATA feature
90h Disable use of Serial ATA feature
•
(7:0) contains the specific SATA feature that is being either enabled or disabled. These features are defined on the following slide.
8
SATA Application Layer
Feature Identification Values
Count(7:0) Value
00h
01h
02h
03h
04h
05h
06h
07h
08h - FFh
Description
Reserved
Non-zero buffer offset in DMA Setup FIS
DMA Setup FIS Auto-Activate optimization
Device-initiated interface power state transitions
Guaranteed In-Order Data Delivery
Asynchronous Notification
Software Settings Preservation
Device Automatic Partial to Slumber transitions
Reserved for future Serial ATA definition
9
SATA Application Layer
Enable / Disable Non-Zero
Offsets in DMA Setup
• Enables or disables non-zero buffer offsets in the DMA Setup FIS if device uses the First-party DMA mechanism
• When enabled, useful for completing incorrectly ordered data delivery
10
SATA Application Layer
• Used to automatically activate the transfer of the first Data FIS from the host to the device
• Allows FIS operation to immediately activate, eliminating the need for a separate DMA Activation FIS
11
SATA Application Layer
• Allows host to enable or disable initiation of power state transitions for the device
• When interface power state transitions is favorable, host can enable for the device
12
SATA Application Layer
• Capture shows device response to PMREQ_P when
IPM (Interface Power Management) is enabled
13
SATA Application Layer
• Capture shows device response to PMREQ_S when
IPM (Interface Power Management) is NOT enabled
14
SATA Application Layer
Enable / Disable Guaranteed in-Order Data Delivery
• Host can enable or disable guaranteed in-order data delivery when a Firstparty DMA mechanism and non-zero buffer offsets are used
• Helpful for segmenting cumbersome
I/O processes into multiple data phases while keeping complexity at a minimum
15
SATA Application Layer
Enable / Disable
Asynchronous Notification
• Allows host to control asynchronous notification
• Disabled by default, when enabled allows the device to request attention without polling the host
16
SATA Application Layer
Enable / Disable Software
Settings Preservation
• Software Settings Preservation can be enabled or disabled by the host
• Supported by default at start up
17
SATA Application Layer
• Host can enable or disable Device
Automatic Partial to Slumber transitions
• Not enabled if the Device-Initiated
Interface Power State transitions have been disabled
18
SATA Application Layer
Application Layer
• SATA Software Settings Preservation (SSP)
– Description of SSP
– SET FEATURES
– Preserved Settings Across COMRESET
• SATA Native Command Queuing (NCQ)
– How NCQ Works
– Description of NCQ
– Definitions
19
SATA Application Layer
Preserved Settings Across
COMRESET
The following settings are reserved across a
COMRESET when a device has SSP enabled.
• INITIALIZE DEVICE PARAMETERS: Device settings established with the INITIALIZE DEVICE PARAMETERS command. This command is obsolete in the ATA8-ACS standard, and was last defined in the ATA/ATAPI-5 standard.
• Power Management Feature Set Standby Timer: The Standby timer used in the Power Management feature set.
• Read/Write Stream Error Log: The Read Stream Error Log and
Write Stream Error Logs (accessed using the GPL feature set commands).
20
SATA Application Layer
Preserved Settings Across
COMRESET
• Security mode state: The security mode state established by
Security Mode feature set commands (refer to the ATA8-ACS standard). The device shall not transition to a different security mode state based on a COMRESET. For example, the device shall not transition from the SEC5: Unlocked / not Frozen state to state SEC4: Security enabled / Locked when a COMRESET occurs, instead the device shall remain in the SEC5: Unlocked / not Frozen state.
• SECURITY FREEZE LOCK: The Frozen mode setting established by the SECURITY FREEZE LOCK command.
21
SATA Application Layer
Preserved Settings Across
COMRESET
• SECURITY UNLOCK: The unlock counter that is decrement as part of a failed SECURITY UNLOCK command attempt.
• SET MAX ADDRESS (EXT): The maximum LBA specified in
SET MAX ADDRESS of SET MAX ADDRESS EXT.
• SET FEATURES (Write Cache Enable/Disable): The write cache enable/disable setting established by the SET FEATURES command with subcommand code of 02h or 82h.
22
SATA Application Layer
Preserved Settings Across
COMRESET
• SET FEATURES (Set Transfer Mode): PIO, Multiword, and
UDMA transfer mode settings established by the SET
FEATURES command with subcommand code of 03h.
• SET FEATURES (Advanced Power Management
Enable/Disable): The advanced power management enable/disable setting established by the SET FEATURES command with subcommand code of 05h or 85h. The advanced power management level established in the Count(7:0) register when advanced power management is enabled (SET
FEATURES subcommand code 05h) shall also be preserved.
23
SATA Application Layer
Preserved Settings Across
COMRESET
• SET FEATURES (Read Look-Ahead): The read look-ahead enable/disable setting established by the SET FEATURES command with subcommand code of 55h or AAh.
• SET FEATURES (Release Interrupt): The release interrupt enable/disable setting established by the SET FEATURES command with a subcommand code of 5Dh or DDh.
• SET FEATURES (SERVICE Interrupt): The SERVICE interrupt enable/disable setting established by the SET FEATURES command
24
SATA Application Layer
Preserved Settings Across
COMRESET
• SET FEATURES (Reverting to Defaults): The reverting to power-on defaults enable/disable setting established by the SET
FEATURES command with a subcommand code of CCH or 66h.
• SET MULTIPLE MODE: The block size established with the
SET MULTIPLE MODE command.
25
SATA Application Layer
Preserved Settings Across
COMRESET
• NCQ QUEUE MANAGEMENT (Deadline Handling): The state of WDNC and RDNC.
• Write-Read-Verify feature set: The contents of IDENTIFY
DEVICE data word 120 bit 1, words 210-211, and word 220 bits
(7:0). The device shall not return to its Write-Read-verify factory default setting after processing a COMRESET
26
SATA Application Layer
Application Layer
• SATA Software Settings Preservation (SSP)
– Description of SSP
– SET FEATURES
– Preserved Settings Across COMRESET
• SATA Native Command Queuing (NCQ)
– How NCQ Works
– Description of NCQ
– Definitions
27
SATA Application Layer
How NCQ Works
• When drive receives multiple commands from an application, NCQ optimizes how the commands will be completed
• Drive must intelligently and internally assess the destination of the logic block addresses and then order the commands to optimize the workload
28
SATA Application Layer
How NCQ Works
• This is due to the fact that the mechanical movement needed to position the read / write head is relevant
• This improves performance and minimizes the mechanical positioning for the drive
29
SATA Application Layer
How NCQ Works
• Commands are ordered in the queue to minimize mechanical movement
30
SATA Application Layer
Application Layer
• SATA Software Settings Preservation (SSP)
– Description of SSP
– SET FEATURES
– Preserved Settings Across COMRESET
• SATA Native Command Queuing (NCQ)
– How NCQ Works
– Description of NCQ
– Definitions
31
SATA Application Layer
Description of NCQ
• The reserved 32 bit field in the Set Device Bits
FIS is used to show the status for outstanding commands, one command per bit
• BSY bit in the Status register shows only if the device is ready to receive another command
32
SATA Application Layer
Description of NCQ
• When a new command is received the BSY bit is set to zero
• Data sent to the device uses the First Party
DMA mechanism to allow the host to select the appropriate destination memory buffer for transfer
• Host cannot issue new commands from the reception of a DMA Setup FIS until either the the associated transfer count is exhausted OR the ERR bit in the Status register is set
33
SATA Application Layer
Description of NCQ
QuickTime™ and a
decompressor are needed to see this picture.
• DMA Setup FIS for memory buffer selection
34
SATA Application Layer
Description of NCQ
QuickTime™ and a
decompressor are needed to see this picture.
• Set Device Bits FIS for successful READ
FPDMA QUEUED command
35
SATA Application Layer
Description of NCQ
QuickTime™ and a
decompressor are needed to see this picture.
• Set Device Bits FIS with error notification and command completions
36
SATA Application Layer
Description of NCQ
QuickTime™ and a
decompressor are needed to see this picture.
• Set Device Bits FIS aborting all outstanding commands
37
SATA Application Layer
Description of NCQ
• Successful completion of this process is updated in the Set Device Bits FIS 32 bit array
• If process fails, the process is halted and allows software or controller firmware to resolve the failure
38
SATA Application Layer
Application Layer
• SATA Software Settings Preservation (SSP)
– Description of SSP
– SET FEATURES
– Preserved Settings Across COMRESET
• SATA Native Command Queuing (NCQ)
– How NCQ Works
– Description of NCQ
– Definitions
39
SATA Application Layer
Definitions
• Command Issue Mechanism
• Data Delivery Mechanism
• Status Return Mechanism
• Priority
• Unload
40
SATA Application Layer
Command Issue Mechanism
• New commands can only be attempted when the BSY bit has been cleared to zero
• BSY bit in the Shadow Status register is checked before a new command is issued
• Commands are deferred if BSY bit is set to one
41
SATA Application Layer
Command Issue Mechanism
• It is favorable for a device to minimize deferred commands, so the BSY bit should be cleared as soon as possible
• NCQ issues a tag that identifies a command
• Tag range is from 0 to 31
42
SATA Application Layer
Command Issue Mechanism
• For devices that show a value less than 31 in their IDENTIFY DEVICE word 75, the host issues tags that are less than or equal to the reported value
• When a new NCQ command is issued the bit in the SActive register corresponding to the tag is set to one
43
SATA Application Layer
Command Issue Mechanism
• If command is accepted, the BSY bit is set to zero
44
SATA Application Layer
Data Delivery Mechanism
• DMA Setup FIS is used by the device in order to choose the correct transfer buffer
• Multiple DMA Setup FIS transmission are not required, even if the transfer spans more than one Data FIS
45
SATA Application Layer
Data Delivery Mechanism
• The DMA Mechanism is optimized to eliminate one transaction
• Requested data is immediately sent after a request without the need for a DMA Activate
FIS
46
SATA Application Layer
Data Delivery Mechanism
• A device may return data for a command out of order if:
1.
Host controller supports non-zero buffering and is enabled
2.
AND if guaranteed in order data deliver is not supported OR is disabled
47
SATA Application Layer
Data Delivery Mechanism
• The device may send more than one DMA
Setup FIS to complete a particular I/O process if:
1.
The host supports non-zero buffer offsets
2.
Use of non-zero offsets is enabled
3.
The device supports and has guaranteed inorder data delivery enabled
48
SATA Application Layer
Data Delivery Mechanism
QuickTime™ and a
decompressor are needed to see this picture.
• DMA Setup FIS definition for memory buffer selection
49
SATA Application Layer
Status Return Mechanism
• Is not interlocked with other commands
• Relies on one active command bit (ACT), the
32 protocol specific bits in the Set Device Bits
FIS, to convey status of outstanding commands
• SActive field conveys command completion information for updating the ACT bit array
50
SATA Application Layer
Status Return Mechanism
• Possible for multiple commands to indicate completion by the time the host checks the status
• Successful commands use these mechanism to indicate status
• The Queued Error Log is used to indicate failed commands
51
SATA Application Layer
Priority
• Two values for NCQ commands: normal and high
• When the host needs a higher quality of service for a command, priority is set to high
• Preference is given to high priority commands; these commands are completed in a more timely fashion than normal commands
52
SATA Application Layer
Priority
• Devices do not have to process all high priority commands before normal priority commands
• However, high priority requests should be processed in a more quickly than normal isochronous requests
53
SATA Application Layer
Unload
• If a device is dropped, a mechanism must be in place to park the heads when NCQ commands are still outstanding
• This could cause physical damage to the heads or disks in the hard drive. The disks could break or shatter from an impact
• If the drive is writing at the time of impact, data could be corrupted
54
SATA Application Layer
Unload
• A device can accept the IDLE IMMEDIATE command with the Unload Feature. If this command is received the device shall:
1.
Unload/park the heads immediately
2.
Respond to the host with a Register - Device to
Host FIS with the ERR bit set to one in the Status register since this is a non-queued command
55
SATA Application Layer
Unload
• When an error is acknowledged, the host should read the Queued Error Log to see if the error was in receiving or executing the
UNLOAD
• After the Error Log is read the NCQ error is cleared
56
SATA Application Layer
Intermixing Non-Native Queued
Commands and Native Queue
Commands
• Host cannot issue a non-native queued command while a NCQ command is unfinished
• If a command is received while a NCQ command is outstanding, and error condition is sent (ERR and ABRT bits are set to one)
57
SATA Application Layer
Intermixing Non-Native Queued Commands and Native Queue Commands
• All outstanding NCQ commands are aborted after an error and the device performs a clean up state
• All bits in the SActive field are set to one when the register is cleared
• After reading the error log, the device executes all queued commands regardless of errors
58
SATA Application Layer
Application Layer
• SATA Software Settings Preservation (SSP)
– Description of SSP
– SET FEATURES
– Preserved Settings Across COMRESET
• SATA Native Command Queuing (NCQ)
– How NCQ Works
– Description of NCQ
– Definitions
59