FreeBSD kernel usb device Code
ustorage_fs.c File Reference
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
#include <sys/sysctl.h>
#include <sys/sx.h>
#include <sys/unistd.h>
#include <sys/callout.h>
#include <sys/malloc.h>
#include <sys/priv.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include "usbdevs.h"
#include "usb_if.h"
#include <dev/usb/usb_debug.h>
Include dependency graph for ustorage_fs.c:

Go to the source code of this file.

Data Structures

struct  __packed
 
struct  ustorage_fs_lun
 
struct  ustorage_fs_softc
 

Macros

#define USB_DEBUG_VAR   ustorage_fs_debug
 
#define USTORAGE_FS_BULK_SIZE   (1U << 17) /* bytes */
 
#define USTORAGE_FS_MAX_LUN   8 /* units */
 
#define USTORAGE_QDATA_MAX   40 /* bytes */
 
#define USTORAGE_FS_ID_STRING
 
#define USTORAGE_FS_RAM_SECT   (1UL << 13)
 
#define USTORAGE_FS_T_BBB_COMMAND   0
 
#define USTORAGE_FS_T_BBB_DATA_DUMP   1
 
#define USTORAGE_FS_T_BBB_DATA_READ   2
 
#define USTORAGE_FS_T_BBB_DATA_WRITE   3
 
#define USTORAGE_FS_T_BBB_STATUS   4
 
#define USTORAGE_FS_T_BBB_MAX   5
 
#define DIR_NONE   0
 
#define DIR_READ   1
 
#define DIR_WRITE   2
 
#define UR_BBB_RESET   0xff /* Bulk-Only reset */
 
#define UR_BBB_GET_MAX_LUN   0xfe /* Get maximum lun */
 
#define CBWSIGNATURE   0x43425355
 
#define CBWFLAGS_OUT   0x00
 
#define CBWFLAGS_IN   0x80
 
#define CBWCDBLENGTH   16
 
#define USTORAGE_FS_BBB_CBW_SIZE   31
 
#define CSWSIGNATURE   0x53425355
 
#define CSWSTATUS_GOOD   0x0
 
#define CSWSTATUS_FAILED   0x1
 
#define CSWSTATUS_PHASE   0x2
 
#define USTORAGE_FS_BBB_CSW_SIZE   13
 
#define SC_FORMAT_UNIT   0x04
 
#define SC_INQUIRY   0x12
 
#define SC_MODE_SELECT_6   0x15
 
#define SC_MODE_SELECT_10   0x55
 
#define SC_MODE_SENSE_6   0x1a
 
#define SC_MODE_SENSE_10   0x5a
 
#define SC_PREVENT_ALLOW_MEDIUM_REMOVAL   0x1e
 
#define SC_READ_6   0x08
 
#define SC_READ_10   0x28
 
#define SC_READ_12   0xa8
 
#define SC_READ_CAPACITY   0x25
 
#define SC_READ_FORMAT_CAPACITIES   0x23
 
#define SC_RELEASE   0x17
 
#define SC_REQUEST_SENSE   0x03
 
#define SC_RESERVE   0x16
 
#define SC_SEND_DIAGNOSTIC   0x1d
 
#define SC_START_STOP_UNIT   0x1b
 
#define SC_SYNCHRONIZE_CACHE   0x35
 
#define SC_TEST_UNIT_READY   0x00
 
#define SC_VERIFY   0x2f
 
#define SC_WRITE_6   0x0a
 
#define SC_WRITE_10   0x2a
 
#define SC_WRITE_12   0xaa
 
#define SS_NO_SENSE   0
 
#define SS_COMMUNICATION_FAILURE   0x040800
 
#define SS_INVALID_COMMAND   0x052000
 
#define SS_INVALID_FIELD_IN_CDB   0x052400
 
#define SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE   0x052100
 
#define SS_LOGICAL_UNIT_NOT_SUPPORTED   0x052500
 
#define SS_MEDIUM_NOT_PRESENT   0x023a00
 
#define SS_MEDIUM_REMOVAL_PREVENTED   0x055302
 
#define SS_NOT_READY_TO_READY_TRANSITION   0x062800
 
#define SS_RESET_OCCURRED   0x062900
 
#define SS_SAVING_PARAMETERS_NOT_SUPPORTED   0x053900
 
#define SS_UNRECOVERED_READ_ERROR   0x031100
 
#define SS_WRITE_ERROR   0x030c02
 
#define SS_WRITE_PROTECTED   0x072700
 
#define SK(x)   ((uint8_t) ((x) >> 16)) /* Sense Key byte, etc. */
 
#define ASC(x)   ((uint8_t) ((x) >> 8))
 
#define ASCQ(x)   ((uint8_t) (x))
 

Functions

static void ustorage_fs_transfer_start (struct ustorage_fs_softc *sc, uint8_t xfer_index)
 
static void ustorage_fs_transfer_stop (struct ustorage_fs_softc *sc)
 
static uint8_t ustorage_fs_verify (struct ustorage_fs_softc *sc)
 
static uint8_t ustorage_fs_inquiry (struct ustorage_fs_softc *sc)
 
static uint8_t ustorage_fs_request_sense (struct ustorage_fs_softc *sc)
 
static uint8_t ustorage_fs_read_capacity (struct ustorage_fs_softc *sc)
 
static uint8_t ustorage_fs_mode_sense (struct ustorage_fs_softc *sc)
 
static uint8_t ustorage_fs_start_stop (struct ustorage_fs_softc *sc)
 
static uint8_t ustorage_fs_prevent_allow (struct ustorage_fs_softc *sc)
 
static uint8_t ustorage_fs_read_format_capacities (struct ustorage_fs_softc *sc)
 
static uint8_t ustorage_fs_mode_select (struct ustorage_fs_softc *sc)
 
static uint8_t ustorage_fs_min_len (struct ustorage_fs_softc *sc, uint32_t len, uint32_t mask)
 
static uint8_t ustorage_fs_read (struct ustorage_fs_softc *sc)
 
static uint8_t ustorage_fs_write (struct ustorage_fs_softc *sc)
 
static uint8_t ustorage_fs_check_cmd (struct ustorage_fs_softc *sc, uint8_t cmd_size, uint16_t mask, uint8_t needs_medium)
 
static uint8_t ustorage_fs_do_cmd (struct ustorage_fs_softc *sc)
 
 DRIVER_MODULE (ustorage_fs, uhub, ustorage_fs_driver, ustorage_fs_devclass, NULL, 0)
 
 MODULE_VERSION (ustorage_fs, 0)
 
 MODULE_DEPEND (ustorage_fs, usb, 1, 1, 1)
 
static int ustorage_fs_probe (device_t dev)
 
static int ustorage_fs_attach (device_t dev)
 
static int ustorage_fs_detach (device_t dev)
 
static int ustorage_fs_suspend (device_t dev)
 
static int ustorage_fs_resume (device_t dev)
 
static int ustorage_fs_handle_request (device_t dev, const void *preq, void **pptr, uint16_t *plen, uint16_t offset, uint8_t *pstate)
 
static void ustorage_fs_t_bbb_command_callback (struct usb_xfer *xfer, usb_error_t error)
 
static void ustorage_fs_t_bbb_data_dump_callback (struct usb_xfer *xfer, usb_error_t error)
 
static void ustorage_fs_t_bbb_data_read_callback (struct usb_xfer *xfer, usb_error_t error)
 
static void ustorage_fs_t_bbb_data_write_callback (struct usb_xfer *xfer, usb_error_t error)
 
static void ustorage_fs_t_bbb_status_callback (struct usb_xfer *xfer, usb_error_t error)
 
static uint16_t get_be16 (uint8_t *buf)
 
static uint32_t get_be32 (uint8_t *buf)
 
static void put_be16 (uint8_t *buf, uint16_t val)
 
static void put_be32 (uint8_t *buf, uint32_t val)
 
static uint8_t ustorage_fs_synchronize_cache (struct ustorage_fs_softc *sc)
 

Variables

static uint8_t * ustorage_fs_ramdisk
 
static device_probe_t ustorage_fs_probe
 
static device_attach_t ustorage_fs_attach
 
static device_detach_t ustorage_fs_detach
 
static device_suspend_t ustorage_fs_suspend
 
static device_resume_t ustorage_fs_resume
 
static usb_handle_request_t ustorage_fs_handle_request
 
static usb_callback_t ustorage_fs_t_bbb_command_callback
 
static usb_callback_t ustorage_fs_t_bbb_data_dump_callback
 
static usb_callback_t ustorage_fs_t_bbb_data_read_callback
 
static usb_callback_t ustorage_fs_t_bbb_data_write_callback
 
static usb_callback_t ustorage_fs_t_bbb_status_callback
 
static device_method_t ustorage_fs_methods []
 
static driver_t ustorage_fs_driver
 
static devclass_t ustorage_fs_devclass
 
static struct usb_config ustorage_fs_bbb_config [USTORAGE_FS_T_BBB_MAX]
 

Macro Definition Documentation

◆ ASC

#define ASC (   x)    ((uint8_t) ((x) >> 8))

Definition at line 892 of file ustorage_fs.c.

◆ ASCQ

#define ASCQ (   x)    ((uint8_t) (x))

Definition at line 893 of file ustorage_fs.c.

◆ CBWCDBLENGTH

#define CBWCDBLENGTH   16

Definition at line 147 of file ustorage_fs.c.

◆ CBWFLAGS_IN

#define CBWFLAGS_IN   0x80

Definition at line 144 of file ustorage_fs.c.

◆ CBWFLAGS_OUT

#define CBWFLAGS_OUT   0x00

Definition at line 143 of file ustorage_fs.c.

◆ CBWSIGNATURE

#define CBWSIGNATURE   0x43425355

Definition at line 139 of file ustorage_fs.c.

◆ CSWSIGNATURE

#define CSWSIGNATURE   0x53425355

Definition at line 156 of file ustorage_fs.c.

◆ CSWSTATUS_FAILED

#define CSWSTATUS_FAILED   0x1

Definition at line 161 of file ustorage_fs.c.

◆ CSWSTATUS_GOOD

#define CSWSTATUS_GOOD   0x0

Definition at line 160 of file ustorage_fs.c.

◆ CSWSTATUS_PHASE

#define CSWSTATUS_PHASE   0x2

Definition at line 162 of file ustorage_fs.c.

◆ DIR_NONE

#define DIR_NONE   0

Definition at line 127 of file ustorage_fs.c.

◆ DIR_READ

#define DIR_READ   1

Definition at line 128 of file ustorage_fs.c.

◆ DIR_WRITE

#define DIR_WRITE   2

Definition at line 129 of file ustorage_fs.c.

◆ SC_FORMAT_UNIT

#define SC_FORMAT_UNIT   0x04

Definition at line 851 of file ustorage_fs.c.

◆ SC_INQUIRY

#define SC_INQUIRY   0x12

Definition at line 852 of file ustorage_fs.c.

◆ SC_MODE_SELECT_10

#define SC_MODE_SELECT_10   0x55

Definition at line 854 of file ustorage_fs.c.

◆ SC_MODE_SELECT_6

#define SC_MODE_SELECT_6   0x15

Definition at line 853 of file ustorage_fs.c.

◆ SC_MODE_SENSE_10

#define SC_MODE_SENSE_10   0x5a

Definition at line 856 of file ustorage_fs.c.

◆ SC_MODE_SENSE_6

#define SC_MODE_SENSE_6   0x1a

Definition at line 855 of file ustorage_fs.c.

◆ SC_PREVENT_ALLOW_MEDIUM_REMOVAL

#define SC_PREVENT_ALLOW_MEDIUM_REMOVAL   0x1e

Definition at line 857 of file ustorage_fs.c.

◆ SC_READ_10

#define SC_READ_10   0x28

Definition at line 859 of file ustorage_fs.c.

◆ SC_READ_12

#define SC_READ_12   0xa8

Definition at line 860 of file ustorage_fs.c.

◆ SC_READ_6

#define SC_READ_6   0x08

Definition at line 858 of file ustorage_fs.c.

◆ SC_READ_CAPACITY

#define SC_READ_CAPACITY   0x25

Definition at line 861 of file ustorage_fs.c.

◆ SC_READ_FORMAT_CAPACITIES

#define SC_READ_FORMAT_CAPACITIES   0x23

Definition at line 862 of file ustorage_fs.c.

◆ SC_RELEASE

#define SC_RELEASE   0x17

Definition at line 863 of file ustorage_fs.c.

◆ SC_REQUEST_SENSE

#define SC_REQUEST_SENSE   0x03

Definition at line 864 of file ustorage_fs.c.

◆ SC_RESERVE

#define SC_RESERVE   0x16

Definition at line 865 of file ustorage_fs.c.

◆ SC_SEND_DIAGNOSTIC

#define SC_SEND_DIAGNOSTIC   0x1d

Definition at line 866 of file ustorage_fs.c.

◆ SC_START_STOP_UNIT

#define SC_START_STOP_UNIT   0x1b

Definition at line 867 of file ustorage_fs.c.

◆ SC_SYNCHRONIZE_CACHE

#define SC_SYNCHRONIZE_CACHE   0x35

Definition at line 868 of file ustorage_fs.c.

◆ SC_TEST_UNIT_READY

#define SC_TEST_UNIT_READY   0x00

Definition at line 869 of file ustorage_fs.c.

◆ SC_VERIFY

#define SC_VERIFY   0x2f

Definition at line 870 of file ustorage_fs.c.

◆ SC_WRITE_10

#define SC_WRITE_10   0x2a

Definition at line 872 of file ustorage_fs.c.

◆ SC_WRITE_12

#define SC_WRITE_12   0xaa

Definition at line 873 of file ustorage_fs.c.

◆ SC_WRITE_6

#define SC_WRITE_6   0x0a

Definition at line 871 of file ustorage_fs.c.

◆ SK

#define SK (   x)    ((uint8_t) ((x) >> 16)) /* Sense Key byte, etc. */

Definition at line 891 of file ustorage_fs.c.

◆ SS_COMMUNICATION_FAILURE

#define SS_COMMUNICATION_FAILURE   0x040800

Definition at line 877 of file ustorage_fs.c.

◆ SS_INVALID_COMMAND

#define SS_INVALID_COMMAND   0x052000

Definition at line 878 of file ustorage_fs.c.

◆ SS_INVALID_FIELD_IN_CDB

#define SS_INVALID_FIELD_IN_CDB   0x052400

Definition at line 879 of file ustorage_fs.c.

◆ SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE

#define SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE   0x052100

Definition at line 880 of file ustorage_fs.c.

◆ SS_LOGICAL_UNIT_NOT_SUPPORTED

#define SS_LOGICAL_UNIT_NOT_SUPPORTED   0x052500

Definition at line 881 of file ustorage_fs.c.

◆ SS_MEDIUM_NOT_PRESENT

#define SS_MEDIUM_NOT_PRESENT   0x023a00

Definition at line 882 of file ustorage_fs.c.

◆ SS_MEDIUM_REMOVAL_PREVENTED

#define SS_MEDIUM_REMOVAL_PREVENTED   0x055302

Definition at line 883 of file ustorage_fs.c.

◆ SS_NO_SENSE

#define SS_NO_SENSE   0

Definition at line 876 of file ustorage_fs.c.

◆ SS_NOT_READY_TO_READY_TRANSITION

#define SS_NOT_READY_TO_READY_TRANSITION   0x062800

Definition at line 884 of file ustorage_fs.c.

◆ SS_RESET_OCCURRED

#define SS_RESET_OCCURRED   0x062900

Definition at line 885 of file ustorage_fs.c.

◆ SS_SAVING_PARAMETERS_NOT_SUPPORTED

#define SS_SAVING_PARAMETERS_NOT_SUPPORTED   0x053900

Definition at line 886 of file ustorage_fs.c.

◆ SS_UNRECOVERED_READ_ERROR

#define SS_UNRECOVERED_READ_ERROR   0x031100

Definition at line 887 of file ustorage_fs.c.

◆ SS_WRITE_ERROR

#define SS_WRITE_ERROR   0x030c02

Definition at line 888 of file ustorage_fs.c.

◆ SS_WRITE_PROTECTED

#define SS_WRITE_PROTECTED   0x072700

Definition at line 889 of file ustorage_fs.c.

◆ UR_BBB_GET_MAX_LUN

#define UR_BBB_GET_MAX_LUN   0xfe /* Get maximum lun */

Definition at line 134 of file ustorage_fs.c.

◆ UR_BBB_RESET

#define UR_BBB_RESET   0xff /* Bulk-Only reset */

Definition at line 133 of file ustorage_fs.c.

◆ USB_DEBUG_VAR

#define USB_DEBUG_VAR   ustorage_fs_debug

Definition at line 68 of file ustorage_fs.c.

◆ USTORAGE_FS_BBB_CBW_SIZE

#define USTORAGE_FS_BBB_CBW_SIZE   31

Definition at line 151 of file ustorage_fs.c.

◆ USTORAGE_FS_BBB_CSW_SIZE

#define USTORAGE_FS_BBB_CSW_SIZE   13

Definition at line 165 of file ustorage_fs.c.

◆ USTORAGE_FS_BULK_SIZE

#define USTORAGE_FS_BULK_SIZE   (1U << 17) /* bytes */

Definition at line 84 of file ustorage_fs.c.

◆ USTORAGE_FS_ID_STRING

#define USTORAGE_FS_ID_STRING
Value:
"FreeBSD " /* 8 */ \
"File-Stor Gadget" /* 16 */ \
"0101" /* 4 */

Definition at line 100 of file ustorage_fs.c.

◆ USTORAGE_FS_MAX_LUN

#define USTORAGE_FS_MAX_LUN   8 /* units */

Definition at line 88 of file ustorage_fs.c.

◆ USTORAGE_FS_RAM_SECT

#define USTORAGE_FS_RAM_SECT   (1UL << 13)

Definition at line 111 of file ustorage_fs.c.

◆ USTORAGE_FS_T_BBB_COMMAND

#define USTORAGE_FS_T_BBB_COMMAND   0

Definition at line 118 of file ustorage_fs.c.

◆ USTORAGE_FS_T_BBB_DATA_DUMP

#define USTORAGE_FS_T_BBB_DATA_DUMP   1

Definition at line 119 of file ustorage_fs.c.

◆ USTORAGE_FS_T_BBB_DATA_READ

#define USTORAGE_FS_T_BBB_DATA_READ   2

Definition at line 120 of file ustorage_fs.c.

◆ USTORAGE_FS_T_BBB_DATA_WRITE

#define USTORAGE_FS_T_BBB_DATA_WRITE   3

Definition at line 121 of file ustorage_fs.c.

◆ USTORAGE_FS_T_BBB_MAX

#define USTORAGE_FS_T_BBB_MAX   5

Definition at line 123 of file ustorage_fs.c.

◆ USTORAGE_FS_T_BBB_STATUS

#define USTORAGE_FS_T_BBB_STATUS   4

Definition at line 122 of file ustorage_fs.c.

◆ USTORAGE_QDATA_MAX

#define USTORAGE_QDATA_MAX   40 /* bytes */

Definition at line 92 of file ustorage_fs.c.

Function Documentation

◆ DRIVER_MODULE()

DRIVER_MODULE ( ustorage_fs  ,
uhub  ,
ustorage_fs_driver  ,
ustorage_fs_devclass  ,
NULL  ,
 
)

◆ get_be16()

static uint16_t get_be16 ( uint8_t *  buf)
static

Definition at line 898 of file ustorage_fs.c.

Referenced by ustorage_fs_do_cmd(), ustorage_fs_read(), ustorage_fs_verify(), and ustorage_fs_write().

Here is the caller graph for this function:

◆ get_be32()

static uint32_t get_be32 ( uint8_t *  buf)
static

Definition at line 904 of file ustorage_fs.c.

Referenced by ustorage_fs_do_cmd(), ustorage_fs_read(), ustorage_fs_read_capacity(), ustorage_fs_verify(), and ustorage_fs_write().

Here is the caller graph for this function:

◆ MODULE_DEPEND()

MODULE_DEPEND ( ustorage_fs  ,
usb  ,
,
,
 
)

◆ MODULE_VERSION()

MODULE_VERSION ( ustorage_fs  ,
 
)

◆ put_be16()

static void put_be16 ( uint8_t *  buf,
uint16_t  val 
)
static

Definition at line 911 of file ustorage_fs.c.

References val.

Referenced by ustorage_fs_mode_sense().

Here is the caller graph for this function:

◆ put_be32()

static void put_be32 ( uint8_t *  buf,
uint32_t  val 
)
static

Definition at line 918 of file ustorage_fs.c.

References val.

Referenced by ustorage_fs_read_capacity(), ustorage_fs_read_format_capacities(), and ustorage_fs_request_sense().

Here is the caller graph for this function:

◆ ustorage_fs_attach()

◆ ustorage_fs_check_cmd()

◆ ustorage_fs_detach()

static int ustorage_fs_detach ( device_t  dev)
static

Definition at line 432 of file ustorage_fs.c.

References dev, ustorage_fs_softc::sc_mtx, ustorage_fs_softc::sc_xfer, usbd_transfer_unsetup(), and USTORAGE_FS_T_BBB_MAX.

Here is the call graph for this function:

◆ ustorage_fs_do_cmd()

◆ ustorage_fs_handle_request()

static int ustorage_fs_handle_request ( device_t  dev,
const void *  preq,
void **  pptr,
uint16_t *  plen,
uint16_t  offset,
uint8_t *  pstate 
)
static

◆ ustorage_fs_inquiry()

static uint8_t ustorage_fs_inquiry ( struct ustorage_fs_softc sc)
static

Definition at line 989 of file ustorage_fs.c.

References ustorage_fs_softc::currlun, ustorage_fs_softc::data_ptr, ustorage_fs_lun::removable, ustorage_fs_softc::sc_transfer, USTORAGE_FS_ID_STRING, and ustorage_fs_min_len().

Referenced by ustorage_fs_do_cmd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ustorage_fs_min_len()

◆ ustorage_fs_mode_select()

static uint8_t ustorage_fs_mode_select ( struct ustorage_fs_softc sc)
static

Definition at line 1327 of file ustorage_fs.c.

References ustorage_fs_softc::currlun, ustorage_fs_softc::sc_transfer, ustorage_fs_lun::sense_data, and SS_INVALID_COMMAND.

Referenced by ustorage_fs_do_cmd().

Here is the caller graph for this function:

◆ ustorage_fs_mode_sense()

static uint8_t ustorage_fs_mode_sense ( struct ustorage_fs_softc sc)
static

◆ ustorage_fs_prevent_allow()

static uint8_t ustorage_fs_prevent_allow ( struct ustorage_fs_softc sc)
static

◆ ustorage_fs_probe()

static int ustorage_fs_probe ( device_t  dev)
static

Definition at line 331 of file ustorage_fs.c.

References dev, id, usb_attach_arg::iface, UICLASS_MASS, UIPROTO_MASS_BBB, UISUBCLASS_SCSI, usb_attach_arg::usb_mode, USB_MODE_DEVICE, and usbd_get_interface_descriptor().

Here is the call graph for this function:

◆ ustorage_fs_read()

◆ ustorage_fs_read_capacity()

static uint8_t ustorage_fs_read_capacity ( struct ustorage_fs_softc sc)
static

◆ ustorage_fs_read_format_capacities()

static uint8_t ustorage_fs_read_format_capacities ( struct ustorage_fs_softc sc)
static

Definition at line 1296 of file ustorage_fs.c.

References ustorage_fs_softc::currlun, ustorage_fs_softc::data_ptr, ustorage_fs_lun::num_sectors, put_be32(), ustorage_fs_softc::sc_transfer, and ustorage_fs_min_len().

Referenced by ustorage_fs_do_cmd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ustorage_fs_request_sense()

static uint8_t ustorage_fs_request_sense ( struct ustorage_fs_softc sc)
static

◆ ustorage_fs_resume()

static int ustorage_fs_resume ( device_t  dev)
static

Definition at line 453 of file ustorage_fs.c.

References dev.

◆ ustorage_fs_start_stop()

static uint8_t ustorage_fs_start_stop ( struct ustorage_fs_softc sc)
static

◆ ustorage_fs_suspend()

static int ustorage_fs_suspend ( device_t  dev)
static

Definition at line 446 of file ustorage_fs.c.

References dev.

◆ ustorage_fs_synchronize_cache()

static uint8_t ustorage_fs_synchronize_cache ( struct ustorage_fs_softc sc)
static

Definition at line 1344 of file ustorage_fs.c.

References ustorage_fs_softc::currlun, ustorage_fs_softc::sc_transfer, ustorage_fs_lun::sense_data, and SS_WRITE_ERROR.

Referenced by ustorage_fs_do_cmd().

Here is the caller graph for this function:

◆ ustorage_fs_t_bbb_command_callback()

◆ ustorage_fs_t_bbb_data_dump_callback()

◆ ustorage_fs_t_bbb_data_read_callback()

◆ ustorage_fs_t_bbb_data_write_callback()

◆ ustorage_fs_t_bbb_status_callback()

◆ ustorage_fs_transfer_start()

static void ustorage_fs_transfer_start ( struct ustorage_fs_softc sc,
uint8_t  xfer_index 
)
static

◆ ustorage_fs_transfer_stop()

static void ustorage_fs_transfer_stop ( struct ustorage_fs_softc sc)
static

Definition at line 473 of file ustorage_fs.c.

References ustorage_fs_softc::sc_last_xfer_index, ustorage_fs_softc::sc_mtx, ustorage_fs_softc::sc_xfer, usbd_transfer_drain(), and usbd_transfer_stop().

Referenced by ustorage_fs_handle_request().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ustorage_fs_verify()

static uint8_t ustorage_fs_verify ( struct ustorage_fs_softc sc)
static

◆ ustorage_fs_write()

Variable Documentation

◆ ustorage_fs_attach

device_attach_t ustorage_fs_attach
static

Definition at line 219 of file ustorage_fs.c.

◆ ustorage_fs_bbb_config

struct usb_config ustorage_fs_bbb_config[USTORAGE_FS_T_BBB_MAX]
static

Definition at line 275 of file ustorage_fs.c.

Referenced by ustorage_fs_attach().

◆ ustorage_fs_detach

device_detach_t ustorage_fs_detach
static

Definition at line 220 of file ustorage_fs.c.

Referenced by ustorage_fs_attach().

◆ ustorage_fs_devclass

devclass_t ustorage_fs_devclass
static

Definition at line 269 of file ustorage_fs.c.

◆ ustorage_fs_driver

driver_t ustorage_fs_driver
static
Initial value:
= {
.name = "ustorage_fs",
.methods = ustorage_fs_methods,
.size = sizeof(struct ustorage_fs_softc),
}
static device_method_t ustorage_fs_methods[]
Definition: ustorage_fs.c:249

Definition at line 263 of file ustorage_fs.c.

◆ ustorage_fs_handle_request

usb_handle_request_t ustorage_fs_handle_request
static

Definition at line 223 of file ustorage_fs.c.

◆ ustorage_fs_methods

device_method_t ustorage_fs_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, ustorage_fs_probe),
DEVMETHOD(device_attach, ustorage_fs_attach),
DEVMETHOD(device_detach, ustorage_fs_detach),
DEVMETHOD(device_suspend, ustorage_fs_suspend),
DEVMETHOD(device_resume, ustorage_fs_resume),
DEVMETHOD_END
}
static usb_error_t usb_handle_request(struct usb_xfer *)
static device_attach_t ustorage_fs_attach
Definition: ustorage_fs.c:219
static usb_handle_request_t ustorage_fs_handle_request
Definition: ustorage_fs.c:223
static device_probe_t ustorage_fs_probe
Definition: ustorage_fs.c:218
static device_detach_t ustorage_fs_detach
Definition: ustorage_fs.c:220
static device_suspend_t ustorage_fs_suspend
Definition: ustorage_fs.c:221
static device_resume_t ustorage_fs_resume
Definition: ustorage_fs.c:222

Definition at line 249 of file ustorage_fs.c.

◆ ustorage_fs_probe

device_probe_t ustorage_fs_probe
static

Definition at line 218 of file ustorage_fs.c.

◆ ustorage_fs_ramdisk

uint8_t* ustorage_fs_ramdisk
static

Definition at line 114 of file ustorage_fs.c.

Referenced by ustorage_fs_attach().

◆ ustorage_fs_resume

device_resume_t ustorage_fs_resume
static

Definition at line 222 of file ustorage_fs.c.

◆ ustorage_fs_suspend

device_suspend_t ustorage_fs_suspend
static

Definition at line 221 of file ustorage_fs.c.

◆ ustorage_fs_t_bbb_command_callback

usb_callback_t ustorage_fs_t_bbb_command_callback
static

Definition at line 225 of file ustorage_fs.c.

◆ ustorage_fs_t_bbb_data_dump_callback

usb_callback_t ustorage_fs_t_bbb_data_dump_callback
static

Definition at line 226 of file ustorage_fs.c.

◆ ustorage_fs_t_bbb_data_read_callback

usb_callback_t ustorage_fs_t_bbb_data_read_callback
static

Definition at line 227 of file ustorage_fs.c.

◆ ustorage_fs_t_bbb_data_write_callback

usb_callback_t ustorage_fs_t_bbb_data_write_callback
static

Definition at line 228 of file ustorage_fs.c.

◆ ustorage_fs_t_bbb_status_callback

usb_callback_t ustorage_fs_t_bbb_status_callback
static

Definition at line 229 of file ustorage_fs.c.