camcontrol cmd -c - for listing EVPD 0x83

Douglas Gilbert dgilbert at interlog.com
Wed Oct 9 16:33:23 UTC 2013


On 13-10-09 11:57 AM, Kenneth D. Merry wrote:
> On Wed, Oct 09, 2013 at 14:20:34 +0200, Bj?rn Larsson wrote:
>> Dear All,
>>
>>
>>
>> I am trying to use ?camcontrol cmd ?c? to send a scsi inquiry command that
>> lists 0x83 (device identification) data instead of the standard output given
>> by the ?camcontrol inquiry? but I cannot get it to work properly. This could
>> be due to that I am not understanding the hex format, so hopefully someone
>> out there can point me in the right direction? The only information I am
>> looking for is the WWN identifier of the SAS target.
>>
>>
>>
>> I have tried to create a SCSI CDB command according the information on:
>> <http://en.wikipedia.org/wiki/SCSI_Inquiry_Command>
>> http://en.wikipedia.org/wiki/SCSI_Inquiry_Command and come up with the
>> following command:
>>
>>
>>
>> # camcontrol cmd da0 ?c 0x009600830112 ?i 96 ?
>>
>>
>>
>> 12 is inquiry
>>
>> 01 EVPD bit is set
>>
>> 83 VPD Page
>>
>> 00 MSB length
>>
>> 96 LSB length
>>
>> 00 reserved
>
> The command isn't one hexadecimal number, but rather individual hexadecimal
> numbers for each byte in the CDB.
>
> You also need to specify either "-" to direct the output to stdout, or
> specify the output format.
>
> For example:
>
> # camcontrol cmd da16 -v -c "12 1 83 0 ff 0" -i 0xff - |hd
> 00000000  00 83 00 48 01 03 00 08  50 00 c5 00 10 3f 70 23  |...H....P....?p#|
> 00000010  61 93 00 08 50 00 c5 00  10 3f 70 21 61 94 00 04  |a...P....?p!a...|
> 00000020  00 00 00 01 61 a3 00 08  50 00 c5 00 10 3f 70 20  |....a...P....?p |
> 00000030  03 28 00 18 6e 61 61 2e  35 30 30 30 43 35 30 30  |.(..naa.5000C500|
> 00000040  31 30 33 46 37 30 32 30  00 00 00 00 00 00 00 00  |103F7020........|
> 00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
> *
> 000000f0
>
> Or, if you want nicer output, try installing the sg3_utils package.  It
> will fully decode page 0x83:
>
> # sg_inq -i da16
> VPD INQUIRY: Device Identification page
>    Designation descriptor number 1, descriptor length: 12
>      designator_type: NAA,  code_set: Binary
>      associated with the addressed logical unit
>        NAA 5, IEEE Company_id: 0xc50
>        Vendor Specific Identifier: 0x103f7023
>        [0x5000c500103f7023]
>    Designation descriptor number 2, descriptor length: 12
>      transport: Serial Attached SCSI (SAS)
>      designator_type: NAA,  code_set: Binary
>      associated with the target port
>        NAA 5, IEEE Company_id: 0xc50
>        Vendor Specific Identifier: 0x103f7021
>        [0x5000c500103f7021]
>    Designation descriptor number 3, descriptor length: 8
>      transport: Serial Attached SCSI (SAS)
>      designator_type: Relative target port,  code_set: Binary
>      associated with the target port
>        Relative target port: 0x1
>    Designation descriptor number 4, descriptor length: 12
>      transport: Serial Attached SCSI (SAS)
>      designator_type: NAA,  code_set: Binary
>      associated with the target device that contains addressed lu
>        NAA 5, IEEE Company_id: 0xc50
>        Vendor Specific Identifier: 0x103f7020
>        [0x5000c500103f7020]
>    Designation descriptor number 5, descriptor length: 28
>      designator_type: SCSI name string,  code_set: UTF-8
>      associated with the target device that contains addressed lu
>        SCSI name string:
>        naa.5000C500103F7020

More and more information is being placed in SCSI VPD pages
(and in some cases removed from other non-obvious places).
So sg3_utils has a utility specifically for looking at
VPD pages: sg_vpd . sg_vpd also decodes some vendor specific
VPD pages.

So these days the VPD pages in sg_inq are in legacy mode
while sg_vpd and sdparm (in a package called sdparm) have
up to date VPD pages.

That said, important and long standing VPD pages like the
device identification VPD page (0x83) are kept up to date
in sg_inq, sg_vpd and sdparm.

sg_vpd (and sdparm) will also break down the device
identification VPD page into component parts.
'sg_vpd -i <dev>', 'sg_vpd -p di <dev>' and
'sg_vpd -p 0x83 <dev>' output all of the DI page. For
smaller pieces:

   # sg_vpd -p di_lu da0
Device Identification VPD page:
   Addressed logical unit:
     designator type: NAA,  code set: Binary
       0x5000c50005b32003

   # sg_vpd -p di_port da0
Device Identification VPD page:
   Target port:
     designator type: NAA,  code set: Binary
      transport: Serial Attached SCSI Protocol (SPL-2)
       0x5000c50005b32001
     designator type: Relative target port,  code set: Binary
      transport: Serial Attached SCSI Protocol (SPL-2)
       Relative target port: 0x1

   # sdparm -p di_target da0
Device Identification VPD page:
   Target device that contains addressed lu:
     designator type: NAA,  code set: Binary
      transport: Serial Attached SCSI Protocol (SPL-2)
       0x5000c50005b32000
     designator type: SCSI name string,  code set: UTF-8
       SCSI name string:
       naa.5000C50005B32000


And to suppress the verbosity:
   ]# sg_vpd -iq /dev/da0
0x5000c50005b32003
0x5000c50005b32001,0x1
0x5000c50005b32000
naa.5000C50005B32000


Doug Gilbert




More information about the freebsd-scsi mailing list