Home | History | Annotate | Line # | Download | only in usb
ehci.c revision 1.1
      1 /*	$NetBSD: ehci.c,v 1.1 2000/12/24 06:39:02 augustss Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2000 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Lennart Augustsson (lennart (at) augustsson.net).
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *        This product includes software developed by the NetBSD
     21  *        Foundation, Inc. and its contributors.
     22  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  *    contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37  */
     38 
     39 /*
     40  * USB Enhanced Host Controller Driver.
     41  *
     42  * http://developer.intel.com/technology/usb/download/ehci-r095.pdf
     43  *
     44  * This is just a stub.
     45  */
     46 
     47 #include <sys/param.h>
     48 #include <sys/systm.h>
     49 #include <sys/kernel.h>
     50 #include <sys/malloc.h>
     51 #include <sys/device.h>
     52 #include <sys/select.h>
     53 #include <sys/proc.h>
     54 #include <sys/queue.h>
     55 
     56 #include <machine/bus.h>
     57 #include <machine/endian.h>
     58 
     59 #include <dev/usb/usb.h>
     60 #include <dev/usb/usbdi.h>
     61 #include <dev/usb/usbdivar.h>
     62 #include <dev/usb/usb_mem.h>
     63 #include <dev/usb/usb_quirks.h>
     64 
     65 #include <dev/usb/ehcireg.h>
     66 #include <dev/usb/ehcivar.h>
     67 
     68 #ifdef EHCI_DEBUG
     69 #define DPRINTF(x)	if (ehcidebug) printf x
     70 #define DPRINTFN(n,x)	if (ehcidebug>(n)) printf x
     71 int ehcidebug = 0;
     72 int ehcinoloop = 0;
     73 #define bitmask_snprintf(q,f,b,l) snprintf((b), (l), "%b", (q), (f))
     74 #else
     75 #define DPRINTF(x)
     76 #define DPRINTFN(n,x)
     77 #endif
     78 
     79 usbd_status
     80 ehci_init(ehci_softc_t *sc)
     81 {
     82 	printf("EHCI not supported yet.\n");
     83 	return (USBD_IOERROR);
     84 }
     85 
     86 int
     87 ehci_intr(void *v)
     88 {
     89 	return (0);
     90 }
     91 
     92 int
     93 ehci_detach(struct ehci_softc *sc, int flags)
     94 {
     95 	int rv = 0;
     96 
     97 	if (sc->sc_child != NULL)
     98 		rv = config_detach(sc->sc_child, flags);
     99 
    100 	if (rv != 0)
    101 		return (rv);
    102 
    103 	if (sc->sc_powerhook != NULL)
    104 		powerhook_disestablish(sc->sc_powerhook);
    105 	if (sc->sc_shutdownhook != NULL)
    106 		shutdownhook_disestablish(sc->sc_shutdownhook);
    107 
    108 	/* XXX free other data structures XXX */
    109 
    110 	return (rv);
    111 }
    112 
    113 
    114 int
    115 ehci_activate(device_ptr_t self, enum devact act)
    116 {
    117 	struct ehci_softc *sc = (struct ehci_softc *)self;
    118 	int rv = 0;
    119 
    120 	switch (act) {
    121 	case DVACT_ACTIVATE:
    122 		return (EOPNOTSUPP);
    123 		break;
    124 
    125 	case DVACT_DEACTIVATE:
    126 		if (sc->sc_child != NULL)
    127 			rv = config_deactivate(sc->sc_child);
    128 		break;
    129 	}
    130 	return (rv);
    131 }
    132 
    133