/*-1* Copyright (c) 2014 Hans Petter Selasky <[email protected]>2* All rights reserved.3*4* This software was developed by SRI International and the University of5* Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)6* ("CTSRD"), as part of the DARPA CRASH research programme.7*8* Redistribution and use in source and binary forms, with or without9* modification, are permitted provided that the following conditions10* are met:11* 1. Redistributions of source code must retain the above copyright12* notice, this list of conditions and the following disclaimer.13* 2. Redistributions in binary form must reproduce the above copyright14* notice, this list of conditions and the following disclaimer in the15* documentation and/or other materials provided with the distribution.16*17* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND18* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE19* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE20* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE21* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL22* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS23* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)24* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT25* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY26* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF27* SUCH DAMAGE.28*/2930#include USB_GLOBAL_INCLUDE_FILE3132#include "umass_common.h"3334struct usb_attach_arg umass_uaa;3536static device_probe_t umass_probe;37static device_attach_t umass_attach;38static device_detach_t umass_detach;3940static device_method_t umass_methods[] = {41/* Device interface */42DEVMETHOD(device_probe, umass_probe),43DEVMETHOD(device_attach, umass_attach),44DEVMETHOD(device_detach, umass_detach),4546DEVMETHOD_END47};4849static driver_t umass_driver = {50.name = "umass",51.methods = umass_methods,52};5354DRIVER_MODULE(umass, uhub, umass_driver, NULL, 0);5556static int57umass_probe(device_t dev)58{59struct usb_attach_arg *uaa = device_get_ivars(dev);6061if (uaa->usb_mode != USB_MODE_HOST ||62uaa->info.bInterfaceClass != UICLASS_MASS ||63uaa->info.bInterfaceSubClass != UISUBCLASS_SCSI ||64uaa->info.bInterfaceProtocol != UIPROTO_MASS_BBB ||65device_get_unit(dev) != 0)66return (ENXIO);67return (0);68}6970static int71umass_attach(device_t dev)72{73struct usb_attach_arg *uaa = device_get_ivars(dev);74umass_uaa = *uaa;75return (0); /* success */76}7778static int79umass_detach(device_t dev)80{8182#ifdef USB_DEBUG83memset(&umass_uaa, 0, sizeof(umass_uaa));84#endif85return (0);86}878889