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