xref: /illumos-gate/usr/src/man/man4i/sesio.4i (revision 899b7fc7762875c5244567fbc6bb4ccace75d6f7)
1bbf21555SRichard Lowe.\"  Copyright (c) 1997, Sun Microsystems, Inc.  All Rights Reserved
2bbf21555SRichard Lowe.\"  Copyright (c) 2017, Joyent, Inc.
3bbf21555SRichard Lowe.\" The contents of this file are subject to the terms of the
4bbf21555SRichard Lowe.\" Common Development and Distribution License (the "License").
5bbf21555SRichard Lowe.\" You may not use this file except in compliance with the License.
6bbf21555SRichard Lowe.\"
7bbf21555SRichard Lowe.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8bbf21555SRichard Lowe.\" or http://www.opensolaris.org/os/licensing.
9bbf21555SRichard Lowe.\" See the License for the specific language governing permissions
10bbf21555SRichard Lowe.\" and limitations under the License.
11bbf21555SRichard Lowe.\"
12bbf21555SRichard Lowe.\" When distributing Covered Code, include this CDDL HEADER in each
13bbf21555SRichard Lowe.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
14bbf21555SRichard Lowe.\" If applicable, add the following below this CDDL HEADER, with the
15bbf21555SRichard Lowe.\" fields enclosed by brackets "[]" replaced with your own identifying
16bbf21555SRichard Lowe.\" information: Portions Copyright [yyyy] [name of copyright owner]
17*899b7fc7SPeter Tribble.Dd March 13, 2022
18bbf21555SRichard Lowe.Dt SESIO 4I
19bbf21555SRichard Lowe.Os
20bbf21555SRichard Lowe.Sh NAME
21bbf21555SRichard Lowe.Nm sesio
22bbf21555SRichard Lowe.Nd enclosure services device driver interface
23bbf21555SRichard Lowe.Sh SYNOPSIS
24bbf21555SRichard Lowe.In sys/scsi/targets/sesio.h
25bbf21555SRichard Lowe.Sh DESCRIPTION
26bbf21555SRichard LoweThe
27bbf21555SRichard Lowe.Nm ses
28bbf21555SRichard Lowedevice driver provides the following ioctls as a means to access
29bbf21555SRichard LoweSCSI enclosure services devices.
30bbf21555SRichard Lowe.Sh IOCTLS
31bbf21555SRichard LoweThe
32bbf21555SRichard Lowe.Nm ses
33bbf21555SRichard Lowedriver supports the following ioctls:
34bbf21555SRichard Lowe.Bl -tag -width SES_IOCTL_GETSTATE
35bbf21555SRichard Lowe.It Dv SES_IOCTL_GETSTATE
36bbf21555SRichard LoweThis ioctl obtains enclosure state in the
37bbf21555SRichard Lowe.Vt ses_ioctl
38bbf21555SRichard Lowestructure.
39bbf21555SRichard Lowe.It Dv SES_IOCTL_SETSTATE
40bbf21555SRichard LoweThis ioctl is used to set parameters on the enclosure services device.
41bbf21555SRichard LoweThe
42bbf21555SRichard Lowe.Vt ses_ioctl
43bbf21555SRichard Lowestructure is used to pass information into the driver.
44bbf21555SRichard Lowe.El
45bbf21555SRichard Lowe.Sh EXAMPLES
46bbf21555SRichard Lowe.Bl -tag -width "Example 1"
47bbf21555SRichard Lowe.It Sy "Example 1"
48bbf21555SRichard LoweUsing the
49bbf21555SRichard Lowe.Dv SES_IOCTL_GETSTATE
50bbf21555SRichard Loweioctl
51bbf21555SRichard Lowe.El
52bbf21555SRichard Lowe.Pp
53bbf21555SRichard LoweThe following example uses the
54bbf21555SRichard Lowe.Dv SES_IOCTL_GETSTATE
55bbf21555SRichard Loweioctl to recover 20 bytes of page 4 from a previously opened device.
56bbf21555SRichard Lowe.Bd -literal -offset 2n
57bbf21555SRichard Lowechar   abuf[30];
58bbf21555SRichard Lowestruct ses_ioctl *sesp;
59bbf21555SRichard Loweint    status;
60bbf21555SRichard Lowe
61bbf21555SRichard Lowesesp = (ses_ioctl *)abuf;
62bbf21555SRichard Lowesesp->size = 20;
63bbf21555SRichard Lowesesp->page_code = 4;
64bbf21555SRichard Lowestatus = ioctl(fd, SES_IOCTL_GETSTATE, abuf);
65bbf21555SRichard Lowe.Ed
66bbf21555SRichard Lowe.Sh ERRORS
67bbf21555SRichard Lowe.Bl -tag -width ENOTTY
68bbf21555SRichard Lowe.It Er EIO
69bbf21555SRichard LoweThe
70bbf21555SRichard Lowe.Nm ses
71bbf21555SRichard Lowedriver was unable to obtain data from the enclosure services
72bbf21555SRichard Lowedevice or the  data transfer could not be completed.
73bbf21555SRichard Lowe.It Er ENOTTY
74bbf21555SRichard LoweThe
75bbf21555SRichard Lowe.Nm ses
76bbf21555SRichard Lowedriver does not support the requested ioctl function.
77bbf21555SRichard Lowe.It Er ENXIO
78bbf21555SRichard LoweThe enclosure services device does not exist.
79bbf21555SRichard Lowe.It Er EFAULT
80bbf21555SRichard LoweThe user specified a bad data length.
81bbf21555SRichard Lowe.El
82bbf21555SRichard Lowe.Sh STRUCTURES
83bbf21555SRichard LoweThe
84bbf21555SRichard Lowe.Vt ses_ioctl
85bbf21555SRichard Lowestructure has the following fields:
86bbf21555SRichard Lowe.Bd -literal -offset 2n
87bbf21555SRichard Loweuint32_t page_size;      /* Size of buffer that follows */
88bbf21555SRichard Loweuint8_t  page_code:      /* Page to be read/written */
89bbf21555SRichard Loweuint8_t  reserved[3];    /* Reserved; Set to 0 */
90bbf21555SRichard Lowe.Ed
91bbf21555SRichard Lowe.Sh ARCHITECTURE
92bbf21555SRichard LoweSPARC
93*899b7fc7SPeter TribbleX86
94bbf21555SRichard Lowe.Sh SEE ALSO
95*899b7fc7SPeter Tribble.Xr ioctl 2 ,
96*899b7fc7SPeter Tribble.Xr ses 4D
97