The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/mips/rmi/ehcivar.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: ehcivar.h,v 1.19 2005/04/29 15:04:29 augustss Exp $    */
    2 /*      $FreeBSD: releng/8.4/sys/mips/rmi/ehcivar.h 215938 2010-11-27 12:26:40Z jchandra $      */
    3 
    4 /*-
    5  * Copyright (c) 2001 The NetBSD Foundation, Inc.
    6  * All rights reserved.
    7  *
    8  * This code is derived from software contributed to The NetBSD Foundation
    9  * by Lennart Augustsson (lennart@augustsson.net).
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice, this list of conditions and the following disclaimer.
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  * 3. All advertising materials mentioning features or use of this software
   20  *    must display the following acknowledgement:
   21  *        This product includes software developed by the NetBSD
   22  *        Foundation, Inc. and its contributors.
   23  * 4. Neither the name of The NetBSD Foundation nor the names of its
   24  *    contributors may be used to endorse or promote products derived
   25  *    from this software without specific prior written permission.
   26  *
   27  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   28  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   29  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   30  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   31  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   34  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   35  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   37  * POSSIBILITY OF SUCH DAMAGE.
   38  */
   39 
   40 typedef struct ehci_soft_qtd {
   41         ehci_qtd_t qtd;
   42         struct ehci_soft_qtd *nextqtd;  /* mirrors nextqtd in TD */
   43         ehci_physaddr_t physaddr;
   44         usbd_xfer_handle xfer;
   45                          LIST_ENTRY(ehci_soft_qtd) hnext;
   46         u_int16_t len;
   47 }             ehci_soft_qtd_t;
   48 
   49 #define EHCI_SQTD_SIZE ((sizeof (struct ehci_soft_qtd) + EHCI_QTD_ALIGN - 1) / EHCI_QTD_ALIGN * EHCI_QTD_ALIGN)
   50 #define EHCI_SQTD_CHUNK (EHCI_PAGE_SIZE / EHCI_SQTD_SIZE)
   51 
   52 typedef struct ehci_soft_qh {
   53         ehci_qh_t qh;
   54         struct ehci_soft_qh *next;
   55         struct ehci_soft_qh *prev;
   56         struct ehci_soft_qtd *sqtd;
   57         ehci_physaddr_t physaddr;
   58         int islot;              /* Interrupt list slot. */
   59 }            ehci_soft_qh_t;
   60 
   61 #define EHCI_SQH_SIZE ((sizeof (struct ehci_soft_qh) + EHCI_QH_ALIGN - 1) / EHCI_QH_ALIGN * EHCI_QH_ALIGN)
   62 #define EHCI_SQH_CHUNK (EHCI_PAGE_SIZE / EHCI_SQH_SIZE)
   63 
   64 struct ehci_xfer {
   65         struct usbd_xfer xfer;
   66         struct usb_task abort_task;
   67                  LIST_ENTRY(ehci_xfer) inext;   /* list of active xfers */
   68         ehci_soft_qtd_t *sqtdstart;
   69         ehci_soft_qtd_t *sqtdend;
   70         u_int32_t ehci_xfer_flags;
   71 #ifdef DIAGNOSTIC
   72         int isdone;
   73 #endif
   74 };
   75 
   76 #define EHCI_XFER_ABORTING      0x0001  /* xfer is aborting. */
   77 #define EHCI_XFER_ABORTWAIT     0x0002  /* abort completion is being awaited. */
   78 
   79 #define EXFER(xfer) ((struct ehci_xfer *)(xfer))
   80 
   81 /*
   82  * Information about an entry in the interrupt list.
   83  */
   84 struct ehci_soft_islot {
   85         ehci_soft_qh_t *sqh;    /* Queue Head. */
   86 };
   87 
   88 #define EHCI_FRAMELIST_MAXCOUNT 1024
   89 #define EHCI_IPOLLRATES         8       /* Poll rates (1ms, 2, 4, 8 ... 128) */
   90 #define EHCI_INTRQHS            ((1 << EHCI_IPOLLRATES) - 1)
   91 #define EHCI_MAX_POLLRATE       (1 << (EHCI_IPOLLRATES - 1))
   92 #define EHCI_IQHIDX(lev, pos)   \
   93     ((((pos) & ((1 << (lev)) - 1)) | (1 << (lev))) - 1)
   94 #define EHCI_ILEV_IVAL(lev)     (1 << (lev))
   95 
   96 #define EHCI_HASH_SIZE 128
   97 #define EHCI_COMPANION_MAX 8
   98 
   99 #define EHCI_SCFLG_DONEINIT     0x0001  /* ehci_init() has been called. */
  100 #define EHCI_SCFLG_LOSTINTRBUG  0x0002  /* workaround for VIA / ATI chipsets */
  101 
  102 typedef struct ehci_softc {
  103         struct usbd_bus sc_bus; /* base device */
  104         int sc_flags;
  105         bus_space_tag_t iot;
  106         bus_space_handle_t ioh;
  107         bus_size_t sc_size;
  108 #if defined(__FreeBSD__)
  109         void *ih;
  110 
  111         struct resource *io_res;
  112         struct resource *irq_res;
  113 #endif
  114         u_int sc_offs;          /* offset to operational regs */
  115 
  116         char sc_vendor[32];     /* vendor string for root hub */
  117         int sc_id_vendor;       /* vendor ID for root hub */
  118 
  119         u_int32_t sc_cmd;       /* shadow of cmd reg during suspend */
  120 #if defined(__NetBSD__) || defined(__OpenBSD__)
  121         void *sc_powerhook;     /* cookie from power hook */
  122         void *sc_shutdownhook;  /* cookie from shutdown hook */
  123 #endif
  124 
  125         u_int sc_ncomp;
  126         u_int sc_npcomp;
  127         struct usbd_bus *sc_comps[EHCI_COMPANION_MAX];
  128 
  129         usb_dma_t sc_fldma;
  130         ehci_link_t *sc_flist;
  131         u_int sc_flsize;
  132 #ifndef __FreeBSD__
  133         u_int sc_rand;          /* XXX need proper intr scheduling */
  134 #endif
  135 
  136         struct ehci_soft_islot sc_islots[EHCI_INTRQHS];
  137 
  138                         LIST_HEAD(, ehci_xfer) sc_intrhead;
  139 
  140         ehci_soft_qh_t *sc_freeqhs;
  141         ehci_soft_qtd_t *sc_freeqtds;
  142 
  143         int sc_noport;
  144         u_int8_t sc_addr;       /* device address */
  145         u_int8_t sc_conf;       /* device configuration */
  146         usbd_xfer_handle sc_intrxfer;
  147         char sc_isreset;
  148 #ifdef USB_USE_SOFTINTR
  149         char sc_softwake;
  150 #endif                          /* USB_USE_SOFTINTR */
  151 
  152         u_int32_t sc_eintrs;
  153         ehci_soft_qh_t *sc_async_head;
  154 
  155                        SIMPLEQ_HEAD(, usbd_xfer) sc_free_xfers; /* free xfers */
  156 
  157         struct lock sc_doorbell_lock;
  158 
  159         usb_callout_t sc_tmo_pcd;
  160         usb_callout_t sc_tmo_intrlist;
  161 
  162 #if defined(__NetBSD__) || defined(__OpenBSD__)
  163         device_ptr_t sc_child;  /* /dev/usb# device */
  164 #endif
  165         char sc_dying;
  166 #if defined(__NetBSD__)
  167         struct usb_dma_reserve sc_dma_reserve;
  168 #endif
  169 }          ehci_softc_t;
  170 
  171 #define EREAD1(sc, a) bus_space_read_1((sc)->iot, (sc)->ioh, (a))
  172 #define EREAD2(sc, a) bus_space_read_2((sc)->iot, (sc)->ioh, (a))
  173 #define EREAD4(sc, a) bus_space_read_4((sc)->iot, (sc)->ioh, (a))
  174 #define EWRITE1(sc, a, x) bus_space_write_1((sc)->iot, (sc)->ioh, (a), (x))
  175 #define EWRITE2(sc, a, x) bus_space_write_2((sc)->iot, (sc)->ioh, (a), (x))
  176 #define EWRITE4(sc, a, x) bus_space_write_4((sc)->iot, (sc)->ioh, (a), (x))
  177 #define EOREAD1(sc, a) bus_space_read_1((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a))
  178 #define EOREAD2(sc, a) bus_space_read_2((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a))
  179 #define EOREAD4(sc, a) bus_space_read_4((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a))
  180 #define EOWRITE1(sc, a, x) bus_space_write_1((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a), (x))
  181 #define EOWRITE2(sc, a, x) bus_space_write_2((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a), (x))
  182 #define EOWRITE4(sc, a, x) bus_space_write_4((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a), (x))
  183 
  184 usbd_status ehci_init(ehci_softc_t *);
  185 int ehci_intr(void *);
  186 int ehci_detach(ehci_softc_t *, int);
  187 
  188 #if defined(__NetBSD__) || defined(__OpenBSD__)
  189 int ehci_activate(device_ptr_t, enum devact);
  190 
  191 #endif
  192 void ehci_power(int state, void *priv);
  193 void ehci_shutdown(void *v);
  194 
  195 #define MS_TO_TICKS(ms) ((ms) * hz / 1000)

Cache object: 2a957aec18d782f08e9f303596a3ec34


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.