Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Files I forgot to remove in last commit.



details:   https://anonhg.NetBSD.org/src/rev/6213efdcc029
branches:  trunk
changeset: 519797:6213efdcc029
user:      augustss <augustss%NetBSD.org@localhost>
date:      Thu Dec 27 11:23:56 2001 +0000

description:
Files I forgot to remove in last commit.

diffstat:

 sys/dev/usb/umassbus.c |  641 -------------------------------------------------
 sys/dev/usb/umassbus.h |   77 -----
 2 files changed, 0 insertions(+), 718 deletions(-)

diffs (truncated from 726 to 300 lines):

diff -r 25f0abe5daec -r 6213efdcc029 sys/dev/usb/umassbus.c
--- a/sys/dev/usb/umassbus.c    Thu Dec 27 11:07:23 2001 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,641 +0,0 @@
-/*     $NetBSD: umassbus.c,v 1.18 2001/12/22 13:21:59 gehenna Exp $    */
-
-/*
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Lennart Augustsson (lennart%augustsson.net@localhost) at
- * Carlstedt Research & Technology.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umassbus.c,v 1.18 2001/12/22 13:21:59 gehenna Exp $");
-
-#include "atapibus.h"
-#include "scsibus.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/malloc.h>
-
-#include <dev/usb/usb.h>
-#include <dev/usb/usbdi.h>
-#include <dev/usb/usbdi_util.h>
-#include <dev/usb/usbdevs.h>
-
-
-#include <dev/usb/umassbus.h>
-#include <dev/usb/umassvar.h>
-
-
-#define UMASS_SCSIID_HOST      0x00
-#define UMASS_SCSIID_DEVICE    0x01
-
-#define UMASS_ATAPI_DRIVE      0
-
-Static void umass_scsipi_request(struct scsipi_channel *,
-                                       scsipi_adapter_req_t, void *);
-Static void umass_scsipi_minphys(struct buf *bp);
-Static int umass_scsipi_ioctl(struct scsipi_channel *, u_long,
-                                  caddr_t, int, struct proc *);
-Static int umass_scsipi_getgeom(struct scsipi_periph *periph,
-                             struct disk_parms *, u_long sectors);
-
-Static void umass_scsipi_cb(struct umass_softc *sc, void *priv,
-                                    int residue, int status);
-Static void umass_scsipi_sense_cb(struct umass_softc *sc, void *priv,
-                                      int residue, int status);
-
-Static int scsipiprint(void *aux, const char *pnp);
-#if NATAPIBUS > 0
-Static void umass_atapi_probe_device(struct atapibus_softc *, int);
-
-const struct scsipi_bustype umass_atapi_bustype = {
-       SCSIPI_BUSTYPE_ATAPI,
-       atapi_scsipi_cmd,
-       atapi_interpret_sense,
-       atapi_print_addr,
-       scsi_kill_pending,
-};
-#endif
-
-
-int
-umass_attach_bus(struct umass_softc *sc)
-{
-       usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
-                          USBDEV(sc->sc_dev));
-
-       /*
-        * Fill in the adapter.
-        */
-       memset(&sc->bus.sc_adapter, 0, sizeof(sc->bus.sc_adapter));
-       sc->bus.sc_adapter.adapt_dev = &sc->sc_dev;
-       sc->bus.sc_adapter.adapt_nchannels = 1;
-       sc->bus.sc_adapter.adapt_request = umass_scsipi_request;
-       sc->bus.sc_adapter.adapt_minphys = umass_scsipi_minphys;
-       sc->bus.sc_adapter.adapt_ioctl = umass_scsipi_ioctl;
-       sc->bus.sc_adapter.adapt_getgeom = umass_scsipi_getgeom;
-#if NATAPIBUS > 0
-       sc->bus.sc_atapi_adapter.atapi_probe_device =  umass_atapi_probe_device;
-#endif
-
-       /* fill in the channel */
-       memset(&sc->bus.sc_channel, 0, sizeof(sc->bus.sc_channel));
-       sc->bus.sc_channel.chan_adapter = &sc->bus.sc_adapter;
-       sc->bus.sc_channel.chan_channel = 0;
-       sc->bus.sc_channel.chan_flags = SCSIPI_CHAN_OPENINGS;
-       sc->bus.sc_channel.chan_openings = 1;
-       sc->bus.sc_channel.chan_max_periph = 1;
-
-       
-       switch (sc->sc_cmd) {
-       case UMASS_CPROTO_RBC:
-       case UMASS_CPROTO_SCSI:
-#if NSCSIBUS > 0
-               sc->bus.sc_channel.chan_bustype = &scsi_bustype;
-               sc->bus.sc_channel.chan_ntargets = UMASS_SCSIID_DEVICE + 1;
-               sc->bus.sc_channel.chan_nluns = sc->maxlun + 1;
-               sc->bus.sc_channel.chan_id = UMASS_SCSIID_HOST;
-               DPRINTF(UDMASS_USB, ("%s: umass_attach_bus: SCSI\n",
-                                    USBDEVNAME(sc->sc_dev)));
-               sc->bus.sc_child =
-                   config_found(&sc->sc_dev, &sc->bus.sc_channel, scsipiprint);
-#else
-               printf("%s: scsibus not configured\n", USBDEVNAME(sc->sc_dev));
-#endif
-               break;
-
-       case UMASS_CPROTO_UFI:
-       case UMASS_CPROTO_ATAPI:
-#if NATAPIBUS > 0
-               sc->bus.sc_channel.chan_bustype = &umass_atapi_bustype;
-               sc->bus.sc_channel.chan_ntargets = 2;
-               sc->bus.sc_channel.chan_nluns = 1;
-
-               if (sc->sc_quirks & UMASS_QUIRK_NO_TEST_UNIT_READY)
-                       sc->bus.sc_channel.chan_defquirks |= PQUIRK_NOTUR;
-               if (sc->sc_quirks & UMASS_QUIRK_NO_REQUEST_SENSE)
-                       sc->bus.sc_channel.chan_defquirks |= PQUIRK_NOSENSE;
-               DPRINTF(UDMASS_USB, ("%s: umass_attach_bus: ATAPI\n",
-                                    USBDEVNAME(sc->sc_dev)));
-               sc->bus.sc_child =
-                   config_found(&sc->sc_dev, &sc->bus.sc_channel, scsipiprint);
-#else
-               printf("%s: atapibus not configured\n", USBDEVNAME(sc->sc_dev));
-#endif
-               break;
-
-       default:
-               printf("%s: cmd proto=0x%x not supported yet\n", 
-                      USBDEVNAME(sc->sc_dev), sc->sc_cmd);
-               return (1);
-       }
-
-       if (sc->bus.sc_child == NULL) {
-               /* Not an error, just not a complete success. */
-               return (1);
-       }
-
-       return (0);
-}
-
-Static int
-scsipiprint(void *aux, const char *pnp)
-{
-       struct scsipi_channel *chan = aux;
-
-       if (chan->chan_bustype->bustype_type == SCSIPI_BUSTYPE_SCSI) {
-#if NSCSIBUS > 0
-               return (scsiprint(aux, pnp));
-#else
-               if (pnp)
-                       printf("scsibus at %s", pnp);
-               return (UNCONF);
-#endif
-       } else {
-#if NATAPIBUS > 0
-               return (atapiprint(aux, pnp));
-#else
-               if (pnp)
-                       printf("atapibus at %s", pnp);
-               return (UNCONF);
-#endif
-       }
-}
-
-int
-umass_detach_bus(struct umass_softc *sc, int flags)
-{
-       if (sc->bus.sc_child != NULL)
-               return config_detach(sc->bus.sc_child, flags);
-       else
-               return 0;
-}
-
-int
-umass_activate(struct device *self, enum devact act)
-{
-       struct umass_softc *sc = (struct umass_softc *) self;
-       int rv = 0;
-
-       DPRINTF(UDMASS_USB, ("%s: umass_activate: %d\n",
-           USBDEVNAME(sc->sc_dev), act));
-
-       switch (act) {
-       case DVACT_ACTIVATE:
-               rv = EOPNOTSUPP;
-               break;
-
-       case DVACT_DEACTIVATE:
-               if (sc->bus.sc_child == NULL)
-                       break;
-               rv = config_deactivate(sc->bus.sc_child);
-               DPRINTF(UDMASS_USB, ("%s: umass_activate: child "
-                   "returned %d\n", USBDEVNAME(sc->sc_dev), rv));
-               if (rv == 0)
-                       sc->sc_dying = 1;
-               break;
-       }
-       return (rv);
-}
-
-Static void
-umass_scsipi_request(struct scsipi_channel *chan,
-               scsipi_adapter_req_t req, void *arg)
-{
-       struct scsipi_adapter *adapt = chan->chan_adapter;
-       struct scsipi_periph *periph;
-       struct scsipi_xfer *xs;
-       struct umass_softc *sc = (void *)adapt->adapt_dev;
-       struct scsipi_generic *cmd, trcmd;
-       int cmdlen;
-       int dir;
-#ifdef UMASS_DEBUG
-       microtime(&sc->tv);
-#endif
-       switch(req) {
-       case ADAPTER_REQ_RUN_XFER:
-               xs = arg;
-               periph = xs->xs_periph;
-               DIF(UDMASS_UPPER, periph->periph_dbflags |= SCSIPI_DEBUG_FLAGS);
-
-               DPRINTF(UDMASS_CMD, ("%s: umass_scsi_cmd: at %lu.%06lu: %d:%d "
-                   "xs=%p cmd=0x%02x datalen=%d (quirks=0x%x, poll=%d)\n",
-                   USBDEVNAME(sc->sc_dev), sc->tv.tv_sec, sc->tv.tv_usec,
-                   periph->periph_target, periph->periph_lun,
-                   xs, xs->cmd->opcode, xs->datalen,
-                   periph->periph_quirks, xs->xs_control & XS_CTL_POLL));
-#if defined(USB_DEBUG) && defined(SCSIPI_DEBUG)
-               if (umassdebug & UDMASS_SCSI)
-                       show_scsipi_xs(xs);
-               else if (umassdebug & ~UDMASS_CMD)
-                       show_scsipi_cmd(xs);
-#endif
-
-               if (sc->sc_dying) {
-                       xs->error = XS_DRIVER_STUFFUP;
-                       goto done;
-               }
-
-#ifdef UMASS_DEBUG
-               if (chan->chan_bustype->bustype_type == SCSIPI_BUSTYPE_ATAPI ?
-                   periph->periph_target != UMASS_ATAPI_DRIVE :
-                   periph->periph_target != UMASS_SCSIID_DEVICE) {
-                       DPRINTF(UDMASS_SCSI, ("%s: wrong SCSI ID %d\n",
-                           USBDEVNAME(sc->sc_dev),
-                           periph->periph_target));
-                       xs->error = XS_DRIVER_STUFFUP;
-                       goto done;
-               }
-#endif
-
-               cmd = xs->cmd;
-               cmdlen = xs->cmdlen;
-
-               /* XXX should use transform */
-
-               if (cmd->opcode == START_STOP &&
-                   (sc->sc_quirks & UMASS_QUIRK_NO_START_STOP)) {
-                       /*printf("%s: START_STOP\n", USBDEVNAME(sc->sc_dev));*/
-                       xs->error = XS_NOERROR;
-                       goto done;



Home | Main Index | Thread Index | Old Index