Opening remarks:
I personally think that the entire SAS protocol family is large, and there are many concepts that are hard to understand. I can only study the actual code at work while reading the protocol in detail. In this way, we can better understand the SAS protocol.
It is the best way to understand the protocol according to the code. Think about all the protocols for data transmission. The communication can be understood by understanding the communication format between the two parties.
1: Transport Layer Overview
The Transport Layer defines frame formats and how frames are processed by this layer. Transport Layer state machines interface to the application layer and port layer and
Construct and parse frame contents. For SSP, the transport layer only has es frames from the port layer for which an ACK is going to be transmitted by the link layer.
This layer in SAS is mainly used to define the frame data format and how frames are transmitted and parsed.
There are three frame formats in this layer: SSP, STP, and SMP. These three data frames are important for Data Control and status information retrieval.
2: SSP Transport Layer
SSP frame formats include the following:
The above five frame formats are defined. The above definition shows the data transmission direction, initiator to target or target to initiator, and the role of each frame.
Among them, command data and task frames are important because data transmission between initiator and target is indispensable.
In the LSI code, the frame format is defined as follows:
/* * Union of all IUs */typedef union _SAS_IU{ COMMAND_IU CommandIU; TASK_IU TaskIU; XFER_RDY_IU XferRdyIU; DATA_IU DataIU; RESPONSE_IU ResponseIU;} SAS_IU, *PTR_SAS_IU;
2.1 command Frame
Command frame definition: a command frame is sent by an SSP initiator port to request that a command be processed by the device server in a logical unit.
That is, the command frame is sent by the sspinitiator port to request the command processing from the server.
In the preceding frame format, the important part is the CDB data segment. CDB contains commands defined in SPC, such as send diagnostic and receivediagnostic.
A complete SSP data packet format is defined as follows: The Code represents a better image.
Typedef struct _ ssp_frame {u8 frametype;/* 0x00 */hashed_sas_address hasheddestinationsasaddress;/* 0x01 */u8 reserved04;/* 0x04 */hashed_sas_address hashedsourcesasaddress; /* 0x05 */u8 reserved08;/* 0x08 */u8 reserved09;/* 0x09 */# ifdef PPC/* POWERPC (sas1078) */u8 reserved0abits2to7: 6;/* 0x0a */u8 retransmit: 1; u8 reserved0abit0: 1; u8 reserved0bbits2to7: 6;/* 0x0b */u8 numbero Ffillbytes: 2; # else/* arm (sas1064/1068) */u32 reserved0abit0: 1;/* 0x0a */u32 retransmit: 1; u32 limit: 6; u32 numberoffillbytes: 2;/* 0x0b */u32 reserved0bbits2to7: 6; # endif u32 reserved0cto0f;/* 0x0c */2017-11-tag;/* 0x10 */2010targetporttransfertag; /* 0x12 */u32 dataoffset;/* 0x14 */sas_iu informationunit;/* 0x18 */} ssp_frame, * ptr_ssp_frame; // The format can be referred: table 117-s in SPL SP frame format. sas_iu must have the following rules: typedef union _ sas_iu {command_iu commandiu; task_iu taskiu; xfer_rdy_iu xferrdyiu; data_iu dataiu; response_iu responseiu;} sas_iu, * ptr_sas_iu; the command frame column is downloaded: command_iu must have the following options: typedef struct _ command_iu {sas_logical_unit logicalunitnumber;/* 0x00 */u8 reserved08;/* 0x08 */# ifdef PPC/* POWERPC (sas1078) * // u8 reserved09bits3to7: 5;/* 0x09 * // added efb bit u8 enablefirs Tburst: 1;/* 0x09 */u8 taskpriority: 4; u8 taskattriity: 3; u8 reserved0a;/* 0x0a */u8 additionalcdblength: 6; /* 0x0b */u8 reserved0bbits0to1: 2; # else/* arm (sas1064/1068) */u32 taskattriity: 3;/* 0x09 */u8 taskpriority: 4; u8 enablefirstburst: 1; // u32 reserved09bits3to7: 5; u8 reserved0a;/* 0x0a */u32 Timeout: 2;/* 0x0b */u32 additionalcdblength: 6; # endif u8 CDB [sas_co Optional];/* 0x0c */u32 additionalcdbbytes [1];/* 0x1c * // * Note: additionalcdbbytes is variable and may be 0 to 0x3f Dwords */} command_iu, * ptr_command_iu; // For the format definition, see the CDB format definition in 8.2.2.1 command framecommand_iu in spcl. Take inquiry command and receive diagnostic in SPC as an example. The inquiry command is defined as follows: typedef struct {u8 opcode; u8 lun_evpd; u8 evpdpagecode; b2allocationlength; u8 controlbyte;} identifier; The evpdpagecode defined above refers to the vital product data (VPD ). the definition and content of the VPD data are as follows: the vital product data (VPD) Page Structure and the VPD pages (see Table 517) that are applicable to all SCSI devices. the VPD pages are returned by an inquiry command with the evpd bit set toone (see 6.4) And contain Vendor Specific product information about a logical unit and SCSI target device. the vitalproduct data may include vendor identification, product identification, unit serial numbers, device operating definitions, manufacturing data, field replaceable unit information, and other vendor specific information. receive diagnostic is defined as follows: typedef _ packed struct _ receive_diag_reslt_command {/* BYT E0 */u8 cmd;/* byte1 */u8 PCV: 1; u8 rsvd: 7;/* byte2 */u8 pagecode;/* byte3 & 4 */2010alloclen; /* byte5 */u8 cntrl;} receive_diag_reslt_command, * ptr_receive_diag_reslt_command; defined in receive_diag_reslt_command: pagecode, commonly used in SES, for example: 01 H configuration diagnostic page uses this page code to obtain the enclosure configuration information in SES 02 h enclosure control diagnostic page. controls elements in SES. such as fan and power. The above data packet layering mechanism is similar to that of TCP/IP. Different layers have different data headers.
2.2 data frame
During a write command or a bidirectional command (see 8.2.3.4 and 8.2.3.6), one or more write data frames are sent by an SSP initiator port to deliver write data.
During a READ command or a bidirectional command (see 8.2.3.5 and 8.2.3.6), one or more read data frames are sent by an SSP target port to deliver read data.
I am not sure about this command. If any of you know this, please contact me and I am very grateful. In my opinion, there may be errors: they are mainly used to read and write data. These formats are used to read and write data to disks.
The command is defined in SBC.
Continue tomorrow