xref: /openbsd-src/share/man/man4/vscsi.4 (revision d13be5d47e4149db2549a9828e244d59dbc43f15)
1.\"	$OpenBSD: vscsi.4,v 1.8 2010/09/07 12:33:09 jmc Exp $
2.\"
3.\" Copyright (c) 2008 David Gwynne <dlg@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: September 7 2010 $
18.Dt VSCSI 4
19.Os
20.Sh NAME
21.Nm vscsi
22.Nd virtual SCSI controller
23.Sh SYNOPSIS
24.Cd "vscsi0 at root"
25.Cd "scsibus* at vscsi?"
26.Pp
27.Fd #include <sys/types.h>
28.Fd #include <sys/ioctl.h>
29.Fd #include <scsi/scsi_all.h>
30.Fd #include <dev/vscsivar.h>
31.Sh DESCRIPTION
32The
33.Nm
34device takes commands from the kernel SCSI midlayer and makes them available
35to userland for handling.
36Using this interface it is possible to implement virtual SCSI devices that are
37usable by the kernel.
38.Pp
39The following
40.Xr ioctl 2
41commands are provided to allow userland to dequeue SCSI commands and reply to
42them:
43.Pp
44.Bl -tag -width Ds -compact
45.It VSCSI_I2T (struct vscsi_ioc_i2t *)
46Dequeue a SCSI command.
47.Bd -literal -offset indent
48struct vscsi_ioc_i2t {
49	int			tag;
50
51	u_int			target;
52	u_int			lun;
53
54	struct scsi_generic	cmd;
55	size_t			cmdlen;
56
57	size_t			datalen;
58	int			direction;
59#define VSCSI_DIR_NONE		0
60#define VSCSI_DIR_READ		1
61#define VSCSI_DIR_WRITE		2
62};
63.Ed
64.Pp
65.It VSCSI_DATA_READ (struct vscsi_ioc_data *)
66.It VSCSI_DATA_WRITE (struct vscsi_ioc_data *)
67Read or write data in response to a SCSI command identified by tag.
68.Bd -literal -offset indent
69struct vscsi_ioc_data {
70	int			tag;
71
72	void *			data;
73	size_t			datalen;
74};
75.Ed
76.Pp
77.It VSCSI_T2I (struct vscsi_ioc_t2i *)
78Signal completion of a SCSI command identified by tag.
79.Bd -literal -offset indent
80struct vscsi_ioc_t2i {
81	int			tag;
82
83	int			status;
84#define VSCSI_STAT_DONE		0
85#define VSCSI_STAT_SENSE	1
86#define VSCSI_STAT_ERR		2
87	struct scsi_sense_data	sense;
88};
89.Ed
90.Pp
91.It VSCSI_REQPROBE (struct vscsi_ioc_devevent *)
92.It VSCSI_REQDETACH (struct vscsi_ioc_devevent *)
93Request a probe or a detach of the device at the addresses specified by the
94target and lun fields.
95.Bd -literal -offset indent
96struct vscsi_ioc_devevent {
97	u_int			target;
98	u_int			lun;
99};
100.Ed
101.El
102.Sh FILES
103.Bl -tag -width /dev/vscsi0
104.It /dev/vscsi0
105.El
106.Sh SEE ALSO
107.Xr ioctl 2 ,
108.Xr intro 4 ,
109.Xr scsi 4
110.Sh HISTORY
111The
112.Nm
113driver first appeared in
114.Ox 4.5 .
115.Sh AUTHORS
116.An David Gwynne Aq dlg@openbsd.org .
117