xref: /aosp_15_r20/external/sg3_utils/README.solaris (revision 44704f698541f6367e81f991ef8bb54ccbf3fc18)
1*44704f69SBart Van AsschePlease Note:
2*44704f69SBart Van Assche>>> Up to and including sg3_utils-1.33 the Solaris code was built
3*44704f69SBart Van Assche>>> and tested on an OpenSolaris VM run with VirtualBox on Ubuntu
4*44704f69SBart Van Assche>>> 11.10 . Now with Ubuntu 12.04 those VMs crash immediately when
5*44704f69SBart Van Assche>>> started with VirtualBox. Further, Oracle (who owns SUN and thus
6*44704f69SBart Van Assche>>> Solaris) no longer supports OpenSolaris and its package
7*44704f69SBart Van Assche>>> repository has been withdrawn. The author can find no generic VMs
8*44704f69SBart Van Assche>>> for Oracle Solaris 11 that run on VirtualBox or VMWare. The author
9*44704f69SBart Van Assche>>> is also displeased with the withdrawal of the Open Software
10*44704f69SBart Van Assche>>> OS and is disinclined to build a Solaris 11 system just to
11*44704f69SBart Van Assche>>> virtualize it.
12*44704f69SBart Van Assche>>> So as of sg3_utils-1.34 the Solaris port is provided "as-is" without
13*44704f69SBart Van Assche>>> testing on a Solaris platform.
14*44704f69SBart Van Assche
15*44704f69SBart Van AsscheDouglas Gilbert
16*44704f69SBart Van Assche13th October 2012
17*44704f69SBart Van Assche
18*44704f69SBart Van Assche
19*44704f69SBart Van Assche
20*44704f69SBart Van AsscheIntroduction
21*44704f69SBart Van Assche============
22*44704f69SBart Van AsscheThe Solaris port of sg3_utils contains those utilities that are
23*44704f69SBart Van Assche_not_ specific to Linux.
24*44704f69SBart Van Assche
25*44704f69SBart Van AsscheThe dd variants from the sg3_utils package (e.g. sg_dd) rely on too many
26*44704f69SBart Van AsscheLinux idiosyncrasies to be easily ported. A new package called 'ddpt'
27*44704f69SBart Van Asschecontains a utility with similar functionality to sg_dd and is available
28*44704f69SBart Van Asschefor Solaris.
29*44704f69SBart Van Assche
30*44704f69SBart Van AsscheSupported Utilities
31*44704f69SBart Van Assche===================
32*44704f69SBart Van AsscheHere is a list of utilities that have been ported:
33*44704f69SBart Van Assche    sg_bg_ctl
34*44704f69SBart Van Assche    sg_compare_and_write
35*44704f69SBart Van Assche    sg_decode_sense
36*44704f69SBart Van Assche    sg_format
37*44704f69SBart Van Assche    sg_get_config
38*44704f69SBart Van Assche    sg_get_elem_status
39*44704f69SBart Van Assche    sg_get_lba_status
40*44704f69SBart Van Assche    sg_ident
41*44704f69SBart Van Assche    sg_inq          [dropped ATA IDENTIFY DEVICE capability]
42*44704f69SBart Van Assche    sg_logs
43*44704f69SBart Van Assche    sg_luns
44*44704f69SBart Van Assche    sg_modes
45*44704f69SBart Van Assche    sg_persist
46*44704f69SBart Van Assche    sg_opcodes
47*44704f69SBart Van Assche    sg_prevent
48*44704f69SBart Van Assche    sg_raw
49*44704f69SBart Van Assche    sg_rdac
50*44704f69SBart Van Assche    sg_read_block_limts
51*44704f69SBart Van Assche    sg_read_buffer
52*44704f69SBart Van Assche    sg_read_long
53*44704f69SBart Van Assche    sg_readcap
54*44704f69SBart Van Assche    sg_reassign
55*44704f69SBart Van Assche    sg_referrals
56*44704f69SBart Van Assche    sg_rep_pip
57*44704f69SBart Van Assche    sg_rep_zones
58*44704f69SBart Van Assche    sg_requests
59*44704f69SBart Van Assche    sg_rmsn
60*44704f69SBart Van Assche    sg_rtpg
61*44704f69SBart Van Assche    sg_safte
62*44704f69SBart Van Assche    sg_sanitize
63*44704f69SBart Van Assche    sg_sat_identify
64*44704f69SBart Van Assche    sg_sat_phy_event
65*44704f69SBart Van Assche    sg_sat_set_features
66*44704f69SBart Van Assche    sg_seek
67*44704f69SBart Van Assche    sg_senddiag
68*44704f69SBart Van Assche    sg_ses
69*44704f69SBart Van Assche    sg_start
70*44704f69SBart Van Assche    sg_stpg
71*44704f69SBart Van Assche    sg_stream_ctl
72*44704f69SBart Van Assche    sg_sync
73*44704f69SBart Van Assche    sg_turs
74*44704f69SBart Van Assche    sg_unmap
75*44704f69SBart Van Assche    sg_verify
76*44704f69SBart Van Assche    sg_vpd
77*44704f69SBart Van Assche    sg_wr_mode
78*44704f69SBart Van Assche    sg_write_buffer
79*44704f69SBart Van Assche    sg_write_long
80*44704f69SBart Van Assche    sg_write_same
81*44704f69SBart Van Assche    sg_write_verify
82*44704f69SBart Van Assche    sg_write_x
83*44704f69SBart Van Assche    sg_zone
84*44704f69SBart Van Assche
85*44704f69SBart Van AsscheMost utility names are indicative of the main SCSI command
86*44704f69SBart Van Asschethat they execute.  Some utilities are slightly higher level, for
87*44704f69SBart Van Asscheexample sg_ses fetches SCSI Enclosure Services (SES) status pages and
88*44704f69SBart Van Asschecan send control pages. Each utility has a man page (placed in
89*44704f69SBart Van Asschesection 8). An overview of sg3_utils can be found at:
90*44704f69SBart Van Asschehttps://sg.danny.cz/sg/sg3_utils.html .
91*44704f69SBart Van AsscheA copy of the "sg3_utils.html" file is in the "doc" subdirectory.
92*44704f69SBart Van Assche
93*44704f69SBart Van Assche
94*44704f69SBart Van AsscheThe executables and library can be built from the source code in
95*44704f69SBart Van Asschethe tarball and installed with the familiar
96*44704f69SBart Van Assche"./configure ; make ; make install" sequence. If this fails try
97*44704f69SBart Van Asscherunning the "./autogen.sh" script prior to that sequence. There
98*44704f69SBart Van Asscheare generic instruction on configure and friend in the INSTALL file.
99*44704f69SBart Van Assche
100*44704f69SBart Van AsscheSome man pages have examples which use Linux device names which
101*44704f69SBart Van Asschehopefully will not confuse the Solaris users.
102*44704f69SBart Van Assche
103*44704f69SBart Van AsscheDevice naming
104*44704f69SBart Van Assche=============
105*44704f69SBart Van AsscheIn Solaris, SCSI device names below the '/dev' directory have a
106*44704f69SBart Van Asscheform like: c5t4d3s2 where the number following "c" is the controller
107*44704f69SBart Van Assche(HBA) number, the number following "t" is the target number (from
108*44704f69SBart Van Asschethe SCSI parallel interface days) and the number following "d" is
109*44704f69SBart Van Asschethe LUN. Following the "s" is the slice number which is related to
110*44704f69SBart Van Asschea partition and by convention "s2" is the whole disk.
111*44704f69SBart Van Assche
112*44704f69SBart Van AsscheOpenSolaris also has a c5t4d3p2 form where the number following
113*44704f69SBart Van Asschethe "p" is the partition number apart from "p0" which is the whole
114*44704f69SBart Van Asschedisk. So a whole disk may be referred to as either:
115*44704f69SBart Van Assche  - c5t4d3
116*44704f69SBart Van Assche  - c5t4d3s2
117*44704f69SBart Van Assche  - c5t4d3p0
118*44704f69SBart Van Assche
119*44704f69SBart Van AsscheAnd these device names are duplicated in the /dev/dsk and /dev/rdsk
120*44704f69SBart Van Asschedirectories. The former is the block device name and the latter
121*44704f69SBart Van Asscheis for "raw" (or char device) access which is what sg3_utils needs.
122*44704f69SBart Van AsscheSo in OpenSolaris something of the form:
123*44704f69SBart Van Assche   sg_inq /dev/rdsk/c5t4d3p0
124*44704f69SBart Van Asscheshould work. If it doesn't add a '-vvv' option. If that is attempted
125*44704f69SBart Van Asscheon the /dev/dsk/c5t4d3p0 variant an inappropriate ioctl for device
126*44704f69SBart Van Asscheerror will result.
127*44704f69SBart Van Assche
128*44704f69SBart Van AsscheThe device names within the /dev directory are typically symbolic
129*44704f69SBart Van Asschelinks to much longer topological names in the /device directory.
130*44704f69SBart Van Assche
131*44704f69SBart Van AsscheIn Solaris cd/dvd/bd players seem to be treated as disks and so are
132*44704f69SBart Van Asschefound in the /dev/rdsk directory. Tape drives appear in the /dev/rmt
133*44704f69SBart Van Asschedirectory.
134*44704f69SBart Van Assche
135*44704f69SBart Van AsscheThere is also a sgen (SCSI generic) driver which by default does not
136*44704f69SBart Van Asscheattach to any device. See the /kernel/drv/sgen.conf file to control
137*44704f69SBart Van Asschewhat is attached. Any attached device will have a device name of
138*44704f69SBart Van Asschethe form /dev/scsi/c5t4d3 .
139*44704f69SBart Van Assche
140*44704f69SBart Van AsscheListing available SCSI devices in Solaris seems to be a challenge.
141*44704f69SBart Van Assche"Use the 'format' command" advice works but seems a very dangerous
142*44704f69SBart Van Asscheway to list devices. [It does prompt again before doing any damage.]
143*44704f69SBart Van Assche'devfsadm -Cv' cleans out the clutter in the /dev/rdsk directory,
144*44704f69SBart Van Asscheonly leaving what is "live". The "cfgadm -v" command looks promising.
145*44704f69SBart Van Assche
146*44704f69SBart Van AsscheDetails
147*44704f69SBart Van Assche=======
148*44704f69SBart Van AsscheThe ported utilities listed above, all use SCSI command functions
149*44704f69SBart Van Asschedeclared in sg_cmds_basic.h and sg_cmds_extra.h . Those SCSI command
150*44704f69SBart Van Asschefunctions are implemented in the corresponding ".c" files. The ".c"
151*44704f69SBart Van Asschefiles pass SCSI commands to the host operating system via an interface
152*44704f69SBart Van Asschedeclared in sg_pt.h . There are currently five implementations of that
153*44704f69SBart Van Asscheinterface depending on the host operating system:
154*44704f69SBart Van Assche  - sg_pt_linux.c
155*44704f69SBart Van Assche  - sg_pt_freebsd.c
156*44704f69SBart Van Assche  - sg_pt_osf1.c  [Tru64]
157*44704f69SBart Van Assche  - sg_pt_solaris.c
158*44704f69SBart Van Assche  - sg_pt_win32.c
159*44704f69SBart Van Assche
160*44704f69SBart Van AsscheThe sg_pt_solaris.c file uses the "uscsi" SCSI pass through mechanism. There
161*44704f69SBart Van Asscheseems to be no corresponding ATA pass through and recent SATA disks do not
162*44704f69SBart Van Asscheseem to have a SAT layer in front of them (within Solaris). If SAT is
163*44704f69SBart Van Asschepresent (perhaps externally or within a HBA) then that would allow SATA
164*44704f69SBart Van Asschedisks to accept SCSI commands including the SCSI ATA PASS THROUGH commands.
165*44704f69SBart Van Assche
166*44704f69SBart Van Assche
167*44704f69SBart Van AsscheDouglas Gilbert
168*44704f69SBart Van Assche5th June 2020
169