说明:本人现在从事存储产品的开发,涉及到SAS协议族,对协议的理解还不是很明白。此处只是为了记载便于以后查阅,随着理解的加深,以后会对不对之处进行更改。
同时现公司使用的LSI同时提供的芯片,包括SAS 2008 controler ,2*36 port expander。其中跟SES相关的代码处理在expander中实现。
1:什么是SCSI Enclosure Services ?
Enclosures may provide power, cooling, and protection for devices. In addition, enclosures may provide external indicators about the state of the enclosure and devices. The indicators may identify the enclosure,identify proper operation of the devices and enclosure elements, provide indications of the state of RAID devices in the enclosure, and provide failure and maintenance information. Some of the individual elements of an enclosure may be removable and replaceable while the enclosure continues to operate. An enclosure
services process typically manages all these enclosure elements and communicates with the SCSI application client. All those elements managed by the enclosure services process are in the enclosure domainof that process.
The application client has two mechanisms for accessing the enclosure services process, both using the RECEIVE DIAGNOSTIC RESULTS and SEND DIAGNOSTIC commands (see SPC-4):
The application client uses the SEND DIAGNOSTICcommand and the SES control-type diagnostic pages (see 6.1) to set various indicators and states within the enclosure domain, allowing the enclosure to provide the most appropriate environment for the other SCSI devices contained within it. Similarly, the application client requests information from the enclosure services process using theRECEIVE DIAGNOSTIC RESULTScommand and the SES status-type diagnostic pages (see 6.1) to examine various status and warning
information available from the enclosure.
An application client uses the SEND DIAGNOSTIC command to transmit control information to the enclosure services process. The control information may include internal and external state indicators as well as instructions to the enclosure to perform certain operations or to modify its operating mode
An application client uses the RECEIVE DIAGNOSTIC RESULTS command with the PCV bit set to one to obtain many kinds of enclosure status information. The information shall indicate the actual state of the enclosure. The actual state is a vendor specific combination of the indications set by the instructions from application clients and the indications established by the enclosure services process.
以上唯一想表明就是:control --->send diagnostic,status --->receive diagnostic。发送控制信息使用send diagnostic,接受状态信息使用receive diagnostic。
主要就是:管理和控制enclosure中所包含的elements或者获取elements的状态信息,方法是通过send diagnostic和receive diagnostic方式来进行,就表明了信息的获取或者控制必须按照SPC4中所定义的命令格式来进行通信。
其中一个enclosure中有哪些elements? 对于elements可以参考SES3中的第7章的介绍。
elements按照类型不同可以有一下几种:
a) control elements in the Enclosure Control diagnostic page (see 6.1.3); 即控制elements 如:cooling
b) status elements in the Enclosure Status diagnostic page (see 6.1.4);即状态elements 如:Temperature Sensor
c) threshold control elements in the Threshold Out diagnostic page (see 6.1.8); and
d) threshold status elements in the Threshold In diagnostic page (see 6.1.9).threshold表示此类elements有一定的门限值,如Voltage Sensor,Current Sensor。
2:SES中所包含的Diagnostic page codes for enclosure service devices
2.1这些page code都是用在对enclosure中的elements进行control或者status的。
上面的“control or status”一栏说明了此项page code是操作类型,是控制类型还是状态类型,也就决定使用send diagnostic还是receive diagnostic。
2.2:SES之page code Configuration diagnostic page
从上面的page code中可以知道,是状态类型的page code只有receive diagnostic没有send diagnostic即只能接受elements的信息而不能对elements进行控制。
The Configuration diagnostic page returns information about the enclosure, including the list of elements in the enclosure. The element list shall include all elements with defined element status or controls and may list any other elements in the enclosure. The Configuration diagnostic page provides enclosure descriptor information and parameters. The Configuration diagnostic page may provide descriptive text identifying element types in more detail
此page code用来返回有关enclosure的信息,这些信息包括enclosure中所包含的elements,这些elements包括了所有已经定义的status和control 元素。同时提供了enclosure的描述符和参数信息(descriptor information and parameters)
The Configuration diagnostic page is read by the RECEIVE DIAGNOSTIC RESULTS command with a PCV bit set to one and a PAGE CODE field set to 01h.
通过设置RECEIVE DIAGNOSTIC RESULTS command 中的PCV为1,page code为01h来对Configuration diagnostic page 进行读操作。
receive diagnostic命令格式如下:
如果application现在发送send diagnostic,其中pcv=1,page code=01,enclosure management service 需要返回 Configuration diagnostic page 所定义的格式的数据包给application。configuration diagnostic page 数据包格式定义如下:
接下来主要关注就是数据包格式中的:Enclosure descriptor,Type descriptor header list.....即第8个字节之后的数据信息。
Enclosure descriptor的数据包格式如下:
在上面的格式中可以自定用户自己的数据。
其他命令的处理基本类型,认真阅读SCSI Enclosure Services - 3 (SES-3)基本都能明白,个人觉得SES是SAS协议族中最好理解的。
3:SES中的elements
前面已经提到了elements,包括的elements如下:
由于有四种类型的elements,因此就有四种类型的elements数据包格式。
可以参见SES3中的第7章
7.2.2 Control element format
7.2.3 Status element format
7.2.4 Threshold control element format
7.2.5 Threshold status element format
下面以elements中的 Cooling element为例说说,application通过send diagnostic和receive diagnostic对Cooling element的控制和状态信息的获取。
The Cooling element manages a fan, blower, or other cooling mechanism.
数据包中的RQST IDENT:
当RQST IDENT=1时:enclosure需要通过一定的方式来identify自己本身,这里的identify表示通过已经的方式能使cooling elements这个被认为的发现。如:使某个led发光表示已经identify自己本身了。当RQST IDENT=0时:跟等于1执行相反的操作。
RQST FAIL,RQST ON等参数的意思,主要根据值是1还是0,做出相应的操作。如:led的打开或者关闭。
REQUESTED SPEED CODE:根据speed code的值,设置enclosure中的cool的转速。
通过receive diagnostic来获取cooling elements的状态信息,Cooling status element定义如下:
status elements主要就返回此elements本身的状态信息,如上面的cooling的转速。跟control是相反的操作。一个write,一个read,一个set,一个get。