xref: /freebsd/share/man/man4/cfumass.4 (revision 74d9553e43cfafc29448d0bb836916aa21dea0de)
1.\" Copyright (c) 2017 The FreeBSD Foundation
2.\" All rights reserved.
3.\"
4.\" This software was developed by Edward Tomasz Napierala under sponsorship
5.\" from the FreeBSD Foundation.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\" $FreeBSD$
29.Dd January 27, 2017
30.Dt CFUMASS 4
31.Os
32.Sh NAME
33.Nm cfumass
34.Nd USB device side support for Mass Storage Class Transport
35.Sh SYNOPSIS
36This driver can be compiled into the kernel by placing these lines in
37the kernel configuration file:
38.Bd -ragged -offset indent
39.Cd "device usb"
40.Cd "device usb_template"
41.Cd "device iscsi"
42.Cd "device ctl"
43.Cd "device cfumass"
44.Ed
45.Pp
46The driver module can also be loaded at boot by adding this line to
47.Xr loader.conf 5 :
48.Bd -literal -offset indent
49cfumass_load="YES"
50.Ed
51.Sh DESCRIPTION
52The
53.Nm
54driver provides device side support for emulating an USB mass storage
55device compliant with the USB Mass Storage Class Bulk-Only (BBB) Transport
56specification, implemented as a
57.Xr ctl 4
58frontend driver.
59.Pp
60To use
61.Nm :
62.Bl -bullet
63.It
64.Xr cfumass 4
65must be loaded as a module or compiled into the kernel.
66.It
67The USB Mass Storage template must be chosen by setting the
68.Va hw.usb.template
69sysctl to 0.
70.It
71The USB OTG port must be working in USB device-side mode.
72This happens automatically upon connection to a USB host.
73.It
74There must be a
75.Xr ctl
76LUN configured for the
77.Pa cfumass
78port.
79.El
80.Pp
81Upon loading, the driver creates a
82.Xr ctl 4
83port named
84.Pa cfumass ,
85presenting the first LUN mapped for that port - usually LUN 0 - to
86the USB host.
87See
88.Xr ctl.conf 5
89and
90.Xr ctld 8
91for details on configuring the LUN.
92.Sh SYSCTL VARIABLES
93These variables are available as both
94.Xr sysctl 8
95variables and
96.Xr loader 8
97tunables:
98.Bl -tag -width indent
99.It Va hw.usb.cfumass.debug
100Verbosity level for log messages from the
101.Nm
102driver.
103Set to 0 to disable logging or 1 to warn about potential problems.
104Larger values enable debugging output.
105Defaults to 1.
106.It Va hw.usb.cfumass.ignore_stop
107Ignore START STOP UNIT SCSI commands with START and LOEJ bits cleared.
108Some initiators send that command to stop the target when the user
109attempts to gracefully eject the drive, but fail to start it when the
110drive is reconnected.
111Set to 0 to handle the command in a standards-compliant way,
1121 to ignore it and log a warning, or 2 to ignore it silently.
113Defaults to 1.
114.It Va hw.usb.cfumass.max_lun
115Max LUN number to report to the initiator (USB host).
116Must be between 0 and 15.
117Some initiators incorrectly handle values larger than 0.
118Defaults to 0.
119.El
120.Sh SEE ALSO
121.Xr ctl 4 ,
122.Xr umass 4 ,
123.Xr usb 4 ,
124.Xr usb_template 4 ,
125.Xr ctl.conf 5 ,
126.Xr ctld 8
127.Sh HISTORY
128The
129.Nm
130driver first appeared in
131.Fx 11.1 .
132.Sh AUTHORS
133The
134.Nm
135driver was developed by
136.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
137under sponsorship from the FreeBSD Foundation.
138