pccbb.c (86908) | pccbb.c (87975) |
---|---|
1/* 2 * Copyright (c) 2000,2001 Jonathan Chen. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * | 1/* 2 * Copyright (c) 2000,2001 Jonathan Chen. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/dev/pccbb/pccbb.c 86908 2001-11-26 07:17:09Z imp $ | 28 * $FreeBSD: head/sys/dev/pccbb/pccbb.c 87975 2001-12-15 05:58:28Z imp $ |
29 */ 30 31/* 32 * Driver for PCI to Cardbus Bridge chips 33 * 34 * References: 35 * TI Datasheets: 36 * http://www-s.ti.com/cgi-bin/sc/generic2.cgi?family=PCI+CARDBUS+CONTROLLERS --- 2054 unchanged lines hidden (view full) --- 2091{ 2092 /* 2093 * Pass through to the next ppb up the chain (i.e. our grandparent). 2094 */ 2095 PCIB_WRITE_CONFIG(device_get_parent(device_get_parent(brdev)), 2096 b, s, f, reg, val, width); 2097} 2098 | 29 */ 30 31/* 32 * Driver for PCI to Cardbus Bridge chips 33 * 34 * References: 35 * TI Datasheets: 36 * http://www-s.ti.com/cgi-bin/sc/generic2.cgi?family=PCI+CARDBUS+CONTROLLERS --- 2054 unchanged lines hidden (view full) --- 2091{ 2092 /* 2093 * Pass through to the next ppb up the chain (i.e. our grandparent). 2094 */ 2095 PCIB_WRITE_CONFIG(device_get_parent(device_get_parent(brdev)), 2096 b, s, f, reg, val, width); 2097} 2098 |
2099static int 2100pccbb_suspend(device_t self) 2101{ 2102 int error = 0; 2103 struct pccbb_softc* sc = device_get_softc(self); 2104 2105 bus_teardown_intr(self, sc->sc_irq_res, sc->sc_intrhand); 2106 error = bus_generic_suspend(self); 2107 return (error); 2108} 2109 2110static int 2111pccbb_resume(device_t self) 2112{ 2113 int error = 0; 2114 struct pccbb_softc *sc = (struct pccbb_softc *)device_get_softc(self); 2115 u_int32_t tmp; 2116 2117 pci_write_config(self, PCCBBR_SOCKBASE, 2118 rman_get_start(sc->sc_base_res), 4); 2119 DEVPRINTF((self, "PCI Memory allocated: %08lx\n", 2120 rman_get_start(sc->sc_base_res))); 2121 2122 pccbb_chipinit(sc); 2123 2124 /* CSC Interrupt: Card detect interrupt on */ 2125 sc->sc_socketreg->socket_mask |= PCCBB_SOCKET_MASK_CD; 2126 2127 /* reset interrupt */ 2128 tmp = sc->sc_socketreg->socket_event; 2129 sc->sc_socketreg->socket_event = tmp; 2130 2131 /* re-establish the interrupt. */ 2132 if (bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO, pccbb_intr, sc, 2133 &(sc->sc_intrhand))) { 2134 device_printf(self, "couldn't re-establish interrupt"); 2135 bus_release_resource(self, SYS_RES_IRQ, 0, sc->sc_irq_res); 2136 bus_release_resource(self, SYS_RES_MEMORY, PCCBBR_SOCKBASE, 2137 sc->sc_base_res); 2138 mtx_destroy(&sc->sc_mtx); 2139 error = ENOMEM; 2140 } 2141 bus_generic_resume(self); 2142 2143 /* wakeup thread */ 2144 if (!error) { 2145 mtx_lock(&sc->sc_mtx); 2146 wakeup(sc); 2147 mtx_unlock(&sc->sc_mtx); 2148 } 2149 return (error); 2150} 2151 |
|
2099static device_method_t pccbb_methods[] = { 2100 /* Device interface */ 2101 DEVMETHOD(device_probe, pccbb_probe), 2102 DEVMETHOD(device_attach, pccbb_attach), 2103 DEVMETHOD(device_detach, pccbb_detach), 2104 DEVMETHOD(device_shutdown, pccbb_shutdown), | 2152static device_method_t pccbb_methods[] = { 2153 /* Device interface */ 2154 DEVMETHOD(device_probe, pccbb_probe), 2155 DEVMETHOD(device_attach, pccbb_attach), 2156 DEVMETHOD(device_detach, pccbb_detach), 2157 DEVMETHOD(device_shutdown, pccbb_shutdown), |
2105 DEVMETHOD(device_suspend, bus_generic_suspend), 2106 DEVMETHOD(device_resume, bus_generic_resume), | 2158 DEVMETHOD(device_suspend, pccbb_suspend), 2159 DEVMETHOD(device_resume, pccbb_resume), |
2107 2108 /* bus methods */ 2109 DEVMETHOD(bus_print_child, bus_generic_print_child), 2110 DEVMETHOD(bus_read_ivar, pccbb_read_ivar), 2111 DEVMETHOD(bus_write_ivar, pccbb_write_ivar), 2112 DEVMETHOD(bus_alloc_resource, pccbb_alloc_resource), 2113 DEVMETHOD(bus_release_resource, pccbb_release_resource), 2114 DEVMETHOD(bus_activate_resource, pccbb_activate_resource), --- 33 unchanged lines hidden --- | 2160 2161 /* bus methods */ 2162 DEVMETHOD(bus_print_child, bus_generic_print_child), 2163 DEVMETHOD(bus_read_ivar, pccbb_read_ivar), 2164 DEVMETHOD(bus_write_ivar, pccbb_write_ivar), 2165 DEVMETHOD(bus_alloc_resource, pccbb_alloc_resource), 2166 DEVMETHOD(bus_release_resource, pccbb_release_resource), 2167 DEVMETHOD(bus_activate_resource, pccbb_activate_resource), --- 33 unchanged lines hidden --- |