1/* 2 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa 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 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. All advertising materials mentioning features or use of this software 14 * must display the acknowledgement as bellow: 15 * 16 * This product includes software developed by K. Kobayashi and H. SHimokawa 17 * 18 * 4. The name of the author may not be used to endorse or promote products 19 * derived from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 *
| 1/* 2 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa 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 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. All advertising materials mentioning features or use of this software 14 * must display the acknowledgement as bellow: 15 * 16 * This product includes software developed by K. Kobayashi and H. SHimokawa 17 * 18 * 4. The name of the author may not be used to endorse or promote products 19 * derived from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 *
|
33 * $FreeBSD: head/sys/dev/firewire/fwohci_pci.c 107653 2002-12-06 02:17:30Z simokawa $
| 33 * $FreeBSD: head/sys/dev/firewire/fwohci_pci.c 108281 2002-12-26 06:50:09Z simokawa $
|
34 */ 35 36#include <sys/param.h> 37#include <sys/systm.h> 38#include <sys/kernel.h> 39#include <sys/module.h> 40#include <sys/bus.h> 41#include <sys/queue.h> 42#include <machine/bus.h> 43#include <sys/rman.h> 44#include <machine/resource.h> 45 46#include <pci/pcivar.h> 47#include <pci/pcireg.h> 48 49#include <dev/firewire/firewire.h> 50#include <dev/firewire/firewirebusreg.h> 51#include <dev/firewire/firewirereg.h> 52 53#include <dev/firewire/fwohcireg.h> 54#include <dev/firewire/fwohcivar.h> 55 56static int fwohci_pci_attach(device_t self); 57static int fwohci_pci_detach(device_t self); 58 59/* 60 * The probe routine. 61 */ 62static int 63fwohci_pci_probe( device_t dev ) 64{ 65#if 1 66 if ((pci_get_vendor(dev) == FW_VENDORID_NEC) && 67 (pci_get_device(dev) == FW_DEVICE_UPD861)) { 68 device_set_desc(dev, "NEC uPD72861"); 69 return 0; 70 } 71 if ((pci_get_vendor(dev) == FW_VENDORID_TI) && 72 (pci_get_device(dev) == FW_DEVICE_TITSB22)) { 73 device_set_desc(dev, "Texas Instruments TSB12LV22"); 74 return 0; 75 } 76 if ((pci_get_vendor(dev) == FW_VENDORID_TI) && 77 (pci_get_device(dev) == FW_DEVICE_TITSB23)) { 78 device_set_desc(dev, "Texas Instruments TSB12LV23"); 79 return 0; 80 } 81 if ((pci_get_vendor(dev) == FW_VENDORID_TI) && 82 (pci_get_device(dev) == FW_DEVICE_TITSB26)) { 83 device_set_desc(dev, "Texas Instruments TSB12LV26"); 84 return 0; 85 } 86 if ((pci_get_vendor(dev) == FW_VENDORID_TI) && 87 (pci_get_device(dev) == FW_DEVICE_TITSB43)) { 88 device_set_desc(dev, "Texas Instruments TSB43AA22"); 89 return 0; 90 } 91 if ((pci_get_vendor(dev) == FW_VENDORID_SONY) && 92 (pci_get_device(dev) == FW_DEVICE_CX3022)) { 93 device_set_desc(dev, "SONY CX3022"); 94 return 0; 95 } 96 if ((pci_get_vendor(dev) == FW_VENDORID_VIA) && 97 (pci_get_device(dev) == FW_DEVICE_VT6306)) { 98 device_set_desc(dev, "VIA VT6306"); 99 return 0; 100 } 101 if ((pci_get_vendor(dev) == FW_VENDORID_RICOH) && 102 (pci_get_device(dev) == FW_DEVICE_R5C552)) { 103 device_set_desc(dev, "Ricoh R5C552"); 104 return 0; 105 } 106 if ((pci_get_vendor(dev) == FW_VENDORID_APPLE) && 107 (pci_get_device(dev) == FW_DEVICE_PANGEA)) { 108 device_set_desc(dev, "Apple Pangea"); 109 return 0; 110 } 111 if ((pci_get_vendor(dev) == FW_VENDORID_APPLE) && 112 (pci_get_device(dev) == FW_DEVICE_UNINORTH)) { 113 device_set_desc(dev, "Apple UniNorth"); 114 return 0; 115 } 116 if ((pci_get_vendor(dev) == FW_VENDORID_LUCENT) && 117 (pci_get_device(dev) == FW_DEVICE_FW322)) { 118 device_set_desc(dev, "Lucent FW322/323"); 119 return 0; 120 } 121#endif 122 if (pci_get_class(dev) == PCIC_SERIALBUS 123 && pci_get_subclass(dev) == PCIS_SERIALBUS_FW 124 && pci_get_progif(dev) == PCI_INTERFACE_OHCI) { 125 printf("XXXfw: vendid=%x, dev=%x\n", pci_get_vendor(dev), 126 pci_get_device(dev)); 127 device_set_desc(dev, "1394 Open Host Controller Interface"); 128 return 0; 129 } 130 131 return ENXIO; 132} 133 134#if __FreeBSD_version < 500000 135static void 136fwohci_dummy_intr(void *arg) 137{ 138 /* XXX do nothing */ 139} 140#endif 141 142static int 143fwohci_pci_attach(device_t self) 144{ 145 fwohci_softc_t *sc = device_get_softc(self); 146 int err; 147 int rid; 148 int latency, cache_line; 149 u_int16_t cmd; 150#if __FreeBSD_version < 500000 151 int intr; 152 /* For the moment, put in a message stating what is wrong */ 153 intr = pci_read_config(self, PCIR_INTLINE, 1); 154 if (intr == 0 || intr == 255) { 155 device_printf(self, "Invalid irq %d\n", intr); 156#ifdef __i386__ 157 device_printf(self, "Please switch PNP-OS to 'No' in BIOS\n"); 158#endif 159#if 0 160 return ENXIO; 161#endif 162 } 163#endif 164 165 cmd = pci_read_config(self, PCIR_COMMAND, 2); 166 cmd |= PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN | PCIM_CMD_MWRICEN; 167 pci_write_config(self, PCIR_COMMAND, cmd, 2); 168 169 latency = pci_read_config(self, PCIR_LATTIMER, 1); 170#define DEF_LATENCY 250 /* Derived from Max Bulk Transfer size 512 Bytes*/ 171 if( latency < DEF_LATENCY ) { 172 latency = DEF_LATENCY; 173 device_printf(self, "PCI bus latency was changing to"); 174 pci_write_config(self, PCIR_LATTIMER,latency, 1); 175 } else 176 { 177 device_printf(self, "PCI bus latency is"); 178 } 179 printf(" %d.\n", (int) latency); 180 cache_line = pci_read_config(self, PCIR_CACHELNSZ, 1); 181#if 0 182#define DEF_CACHE_LINE 0xc 183 cache_line = DEF_CACHE_LINE; 184 pci_write_config(self, PCIR_CACHELNSZ, cache_line, 1); 185#endif 186 if (bootverbose) 187 device_printf(self, "cache size %d.\n", (int) cache_line); 188/**/ 189 rid = PCI_CBMEM; 190 sc->bsr = bus_alloc_resource(self, SYS_RES_MEMORY, &rid, 191 0, ~0, 1, RF_ACTIVE); 192 if (!sc->bsr) { 193 device_printf(self, "Could not map memory\n"); 194 return ENXIO; 195 } 196 197 sc->bst = rman_get_bustag(sc->bsr); 198 sc->bsh = rman_get_bushandle(sc->bsr); 199 200 rid = 0; 201 sc->irq_res = bus_alloc_resource(self, SYS_RES_IRQ, &rid, 0, ~0, 1, 202 RF_SHAREABLE | RF_ACTIVE); 203 if (sc->irq_res == NULL) { 204 device_printf(self, "Could not allocate irq\n"); 205 fwohci_pci_detach(self); 206 return ENXIO; 207 } 208 209 sc->fc.bdev = device_add_child(self, "firewire", -1); 210 if (!sc->fc.bdev) { 211 device_printf(self, "Could not add firewire device\n"); 212 fwohci_pci_detach(self); 213 return ENOMEM; 214 } 215 device_set_ivars(sc->fc.bdev, sc); 216 217 err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_NET, 218 (driver_intr_t *) fwohci_intr, sc, &sc->ih); 219#if __FreeBSD_version < 500000 220 /* XXX splcam() should mask this irq for sbp.c*/ 221 err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_CAM, 222 (driver_intr_t *) fwohci_dummy_intr, sc, &sc->ih_cam); 223#endif 224 if (err) { 225 device_printf(self, "Could not setup irq, %d\n", err); 226 fwohci_pci_detach(self); 227 return ENXIO; 228 } 229 230 err = fwohci_init(sc, self); 231 232 if (!err) 233 err = device_probe_and_attach(sc->fc.bdev); 234 235 if (err) {
| 34 */ 35 36#include <sys/param.h> 37#include <sys/systm.h> 38#include <sys/kernel.h> 39#include <sys/module.h> 40#include <sys/bus.h> 41#include <sys/queue.h> 42#include <machine/bus.h> 43#include <sys/rman.h> 44#include <machine/resource.h> 45 46#include <pci/pcivar.h> 47#include <pci/pcireg.h> 48 49#include <dev/firewire/firewire.h> 50#include <dev/firewire/firewirebusreg.h> 51#include <dev/firewire/firewirereg.h> 52 53#include <dev/firewire/fwohcireg.h> 54#include <dev/firewire/fwohcivar.h> 55 56static int fwohci_pci_attach(device_t self); 57static int fwohci_pci_detach(device_t self); 58 59/* 60 * The probe routine. 61 */ 62static int 63fwohci_pci_probe( device_t dev ) 64{ 65#if 1 66 if ((pci_get_vendor(dev) == FW_VENDORID_NEC) && 67 (pci_get_device(dev) == FW_DEVICE_UPD861)) { 68 device_set_desc(dev, "NEC uPD72861"); 69 return 0; 70 } 71 if ((pci_get_vendor(dev) == FW_VENDORID_TI) && 72 (pci_get_device(dev) == FW_DEVICE_TITSB22)) { 73 device_set_desc(dev, "Texas Instruments TSB12LV22"); 74 return 0; 75 } 76 if ((pci_get_vendor(dev) == FW_VENDORID_TI) && 77 (pci_get_device(dev) == FW_DEVICE_TITSB23)) { 78 device_set_desc(dev, "Texas Instruments TSB12LV23"); 79 return 0; 80 } 81 if ((pci_get_vendor(dev) == FW_VENDORID_TI) && 82 (pci_get_device(dev) == FW_DEVICE_TITSB26)) { 83 device_set_desc(dev, "Texas Instruments TSB12LV26"); 84 return 0; 85 } 86 if ((pci_get_vendor(dev) == FW_VENDORID_TI) && 87 (pci_get_device(dev) == FW_DEVICE_TITSB43)) { 88 device_set_desc(dev, "Texas Instruments TSB43AA22"); 89 return 0; 90 } 91 if ((pci_get_vendor(dev) == FW_VENDORID_SONY) && 92 (pci_get_device(dev) == FW_DEVICE_CX3022)) { 93 device_set_desc(dev, "SONY CX3022"); 94 return 0; 95 } 96 if ((pci_get_vendor(dev) == FW_VENDORID_VIA) && 97 (pci_get_device(dev) == FW_DEVICE_VT6306)) { 98 device_set_desc(dev, "VIA VT6306"); 99 return 0; 100 } 101 if ((pci_get_vendor(dev) == FW_VENDORID_RICOH) && 102 (pci_get_device(dev) == FW_DEVICE_R5C552)) { 103 device_set_desc(dev, "Ricoh R5C552"); 104 return 0; 105 } 106 if ((pci_get_vendor(dev) == FW_VENDORID_APPLE) && 107 (pci_get_device(dev) == FW_DEVICE_PANGEA)) { 108 device_set_desc(dev, "Apple Pangea"); 109 return 0; 110 } 111 if ((pci_get_vendor(dev) == FW_VENDORID_APPLE) && 112 (pci_get_device(dev) == FW_DEVICE_UNINORTH)) { 113 device_set_desc(dev, "Apple UniNorth"); 114 return 0; 115 } 116 if ((pci_get_vendor(dev) == FW_VENDORID_LUCENT) && 117 (pci_get_device(dev) == FW_DEVICE_FW322)) { 118 device_set_desc(dev, "Lucent FW322/323"); 119 return 0; 120 } 121#endif 122 if (pci_get_class(dev) == PCIC_SERIALBUS 123 && pci_get_subclass(dev) == PCIS_SERIALBUS_FW 124 && pci_get_progif(dev) == PCI_INTERFACE_OHCI) { 125 printf("XXXfw: vendid=%x, dev=%x\n", pci_get_vendor(dev), 126 pci_get_device(dev)); 127 device_set_desc(dev, "1394 Open Host Controller Interface"); 128 return 0; 129 } 130 131 return ENXIO; 132} 133 134#if __FreeBSD_version < 500000 135static void 136fwohci_dummy_intr(void *arg) 137{ 138 /* XXX do nothing */ 139} 140#endif 141 142static int 143fwohci_pci_attach(device_t self) 144{ 145 fwohci_softc_t *sc = device_get_softc(self); 146 int err; 147 int rid; 148 int latency, cache_line; 149 u_int16_t cmd; 150#if __FreeBSD_version < 500000 151 int intr; 152 /* For the moment, put in a message stating what is wrong */ 153 intr = pci_read_config(self, PCIR_INTLINE, 1); 154 if (intr == 0 || intr == 255) { 155 device_printf(self, "Invalid irq %d\n", intr); 156#ifdef __i386__ 157 device_printf(self, "Please switch PNP-OS to 'No' in BIOS\n"); 158#endif 159#if 0 160 return ENXIO; 161#endif 162 } 163#endif 164 165 cmd = pci_read_config(self, PCIR_COMMAND, 2); 166 cmd |= PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN | PCIM_CMD_MWRICEN; 167 pci_write_config(self, PCIR_COMMAND, cmd, 2); 168 169 latency = pci_read_config(self, PCIR_LATTIMER, 1); 170#define DEF_LATENCY 250 /* Derived from Max Bulk Transfer size 512 Bytes*/ 171 if( latency < DEF_LATENCY ) { 172 latency = DEF_LATENCY; 173 device_printf(self, "PCI bus latency was changing to"); 174 pci_write_config(self, PCIR_LATTIMER,latency, 1); 175 } else 176 { 177 device_printf(self, "PCI bus latency is"); 178 } 179 printf(" %d.\n", (int) latency); 180 cache_line = pci_read_config(self, PCIR_CACHELNSZ, 1); 181#if 0 182#define DEF_CACHE_LINE 0xc 183 cache_line = DEF_CACHE_LINE; 184 pci_write_config(self, PCIR_CACHELNSZ, cache_line, 1); 185#endif 186 if (bootverbose) 187 device_printf(self, "cache size %d.\n", (int) cache_line); 188/**/ 189 rid = PCI_CBMEM; 190 sc->bsr = bus_alloc_resource(self, SYS_RES_MEMORY, &rid, 191 0, ~0, 1, RF_ACTIVE); 192 if (!sc->bsr) { 193 device_printf(self, "Could not map memory\n"); 194 return ENXIO; 195 } 196 197 sc->bst = rman_get_bustag(sc->bsr); 198 sc->bsh = rman_get_bushandle(sc->bsr); 199 200 rid = 0; 201 sc->irq_res = bus_alloc_resource(self, SYS_RES_IRQ, &rid, 0, ~0, 1, 202 RF_SHAREABLE | RF_ACTIVE); 203 if (sc->irq_res == NULL) { 204 device_printf(self, "Could not allocate irq\n"); 205 fwohci_pci_detach(self); 206 return ENXIO; 207 } 208 209 sc->fc.bdev = device_add_child(self, "firewire", -1); 210 if (!sc->fc.bdev) { 211 device_printf(self, "Could not add firewire device\n"); 212 fwohci_pci_detach(self); 213 return ENOMEM; 214 } 215 device_set_ivars(sc->fc.bdev, sc); 216 217 err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_NET, 218 (driver_intr_t *) fwohci_intr, sc, &sc->ih); 219#if __FreeBSD_version < 500000 220 /* XXX splcam() should mask this irq for sbp.c*/ 221 err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_CAM, 222 (driver_intr_t *) fwohci_dummy_intr, sc, &sc->ih_cam); 223#endif 224 if (err) { 225 device_printf(self, "Could not setup irq, %d\n", err); 226 fwohci_pci_detach(self); 227 return ENXIO; 228 } 229 230 err = fwohci_init(sc, self); 231 232 if (!err) 233 err = device_probe_and_attach(sc->fc.bdev); 234 235 if (err) {
|
236 device_printf(self, "Firewire init failed\n");
| 236 device_printf(self, "FireWire init failed\n");
|
237 fwohci_pci_detach(self); 238 return EIO; 239 } 240 241 return 0; 242} 243 244static int 245fwohci_pci_detach(device_t self) 246{ 247 fwohci_softc_t *sc = device_get_softc(self); 248 int s; 249 250 251 s = splfw(); 252 bus_generic_detach(self); 253 254 /* disable interrupts that might have been switched on */ 255 if (sc->bst && sc->bsh) 256 bus_space_write_4(sc->bst, sc->bsh, 257 FWOHCI_INTMASKCLR, OHCI_INT_EN); 258 259 if (sc->irq_res) { 260 int err = bus_teardown_intr(self, sc->irq_res, sc->ih); 261 if (err) 262 /* XXX or should we panic? */ 263 device_printf(self, "Could not tear down irq, %d\n", 264 err); 265#if __FreeBSD_version < 500000 266 err = bus_teardown_intr(self, sc->irq_res, sc->ih_cam); 267#endif 268 sc->ih = NULL; 269 } 270 271 if (sc->fc.bdev) { 272 device_delete_child(self, sc->fc.bdev); 273 sc->fc.bdev = NULL; 274 } 275 276 if (sc->irq_res) { 277 bus_release_resource(self, SYS_RES_IRQ, 0, sc->irq_res); 278 sc->irq_res = NULL; 279 } 280 281 if (sc->bsr) { 282 bus_release_resource(self, SYS_RES_MEMORY,PCI_CBMEM,sc->bsr); 283 sc->bsr = NULL; 284 sc->bst = 0; 285 sc->bsh = 0; 286 } 287 splx(s); 288 289 return 0; 290} 291 292static int 293fwohci_pci_suspend(device_t dev) 294{ 295 device_printf(dev, "fwoch_pci_suspend\n"); 296 return 0; 297} 298 299static int 300fwohci_pci_resume(device_t dev) 301{ 302 device_printf(dev, "fwoch_pci_resume\n"); 303 return 0; 304} 305 306static device_method_t fwohci_methods[] = { 307 /* Device interface */ 308 DEVMETHOD(device_probe, fwohci_pci_probe), 309 DEVMETHOD(device_attach, fwohci_pci_attach), 310 DEVMETHOD(device_detach, fwohci_pci_detach), 311 DEVMETHOD(device_shutdown, bus_generic_shutdown), 312 DEVMETHOD(device_suspend, fwohci_pci_suspend), 313 DEVMETHOD(device_resume, fwohci_pci_resume), 314 315 /* Bus interface */ 316 DEVMETHOD(bus_print_child, bus_generic_print_child), 317 318 { 0, 0 } 319}; 320 321static driver_t fwohci_driver = { 322 "fwohci", 323 fwohci_methods, 324 sizeof(fwohci_softc_t), 325}; 326 327static devclass_t fwohci_devclass; 328 329DRIVER_MODULE(fwohci, pci, fwohci_driver, fwohci_devclass, 0, 0); 330DRIVER_MODULE(fwohci, cardbus, fwohci_driver, fwohci_devclass, 0, 0);
| 237 fwohci_pci_detach(self); 238 return EIO; 239 } 240 241 return 0; 242} 243 244static int 245fwohci_pci_detach(device_t self) 246{ 247 fwohci_softc_t *sc = device_get_softc(self); 248 int s; 249 250 251 s = splfw(); 252 bus_generic_detach(self); 253 254 /* disable interrupts that might have been switched on */ 255 if (sc->bst && sc->bsh) 256 bus_space_write_4(sc->bst, sc->bsh, 257 FWOHCI_INTMASKCLR, OHCI_INT_EN); 258 259 if (sc->irq_res) { 260 int err = bus_teardown_intr(self, sc->irq_res, sc->ih); 261 if (err) 262 /* XXX or should we panic? */ 263 device_printf(self, "Could not tear down irq, %d\n", 264 err); 265#if __FreeBSD_version < 500000 266 err = bus_teardown_intr(self, sc->irq_res, sc->ih_cam); 267#endif 268 sc->ih = NULL; 269 } 270 271 if (sc->fc.bdev) { 272 device_delete_child(self, sc->fc.bdev); 273 sc->fc.bdev = NULL; 274 } 275 276 if (sc->irq_res) { 277 bus_release_resource(self, SYS_RES_IRQ, 0, sc->irq_res); 278 sc->irq_res = NULL; 279 } 280 281 if (sc->bsr) { 282 bus_release_resource(self, SYS_RES_MEMORY,PCI_CBMEM,sc->bsr); 283 sc->bsr = NULL; 284 sc->bst = 0; 285 sc->bsh = 0; 286 } 287 splx(s); 288 289 return 0; 290} 291 292static int 293fwohci_pci_suspend(device_t dev) 294{ 295 device_printf(dev, "fwoch_pci_suspend\n"); 296 return 0; 297} 298 299static int 300fwohci_pci_resume(device_t dev) 301{ 302 device_printf(dev, "fwoch_pci_resume\n"); 303 return 0; 304} 305 306static device_method_t fwohci_methods[] = { 307 /* Device interface */ 308 DEVMETHOD(device_probe, fwohci_pci_probe), 309 DEVMETHOD(device_attach, fwohci_pci_attach), 310 DEVMETHOD(device_detach, fwohci_pci_detach), 311 DEVMETHOD(device_shutdown, bus_generic_shutdown), 312 DEVMETHOD(device_suspend, fwohci_pci_suspend), 313 DEVMETHOD(device_resume, fwohci_pci_resume), 314 315 /* Bus interface */ 316 DEVMETHOD(bus_print_child, bus_generic_print_child), 317 318 { 0, 0 } 319}; 320 321static driver_t fwohci_driver = { 322 "fwohci", 323 fwohci_methods, 324 sizeof(fwohci_softc_t), 325}; 326 327static devclass_t fwohci_devclass; 328 329DRIVER_MODULE(fwohci, pci, fwohci_driver, fwohci_devclass, 0, 0); 330DRIVER_MODULE(fwohci, cardbus, fwohci_driver, fwohci_devclass, 0, 0);
|