aac_pci.c (254004) | aac_pci.c (254005) |
---|---|
1/*- 2 * Copyright (c) 2000 Michael Smith 3 * Copyright (c) 2001 Scott Long 4 * Copyright (c) 2000 BSDi 5 * Copyright (c) 2001 Adaptec, Inc. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2000 Michael Smith 3 * Copyright (c) 2001 Scott Long 4 * Copyright (c) 2000 BSDi 5 * Copyright (c) 2001 Adaptec, Inc. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/aac/aac_pci.c 254004 2013-08-06 18:55:59Z marius $"); | 31__FBSDID("$FreeBSD: head/sys/dev/aac/aac_pci.c 254005 2013-08-06 19:14:02Z marius $"); |
32 33/* 34 * PCI bus interface and resource allocation. 35 */ 36 37#include "opt_aac.h" 38 39#include <sys/param.h> --- 380 unchanged lines hidden (view full) --- 420 sc->aac_btag1 = sc->aac_btag0; 421 sc->aac_bhandle1 = sc->aac_bhandle0; 422 } 423 424 /* 425 * Allocate the interrupt. 426 */ 427 rid = 0; | 32 33/* 34 * PCI bus interface and resource allocation. 35 */ 36 37#include "opt_aac.h" 38 39#include <sys/param.h> --- 380 unchanged lines hidden (view full) --- 420 sc->aac_btag1 = sc->aac_btag0; 421 sc->aac_bhandle1 = sc->aac_bhandle0; 422 } 423 424 /* 425 * Allocate the interrupt. 426 */ 427 rid = 0; |
428 count = 0; 429 if (aac_enable_msi != 0 && (sc->flags & AAC_FLAGS_NOMSI) == 0 && 430 (count = pci_msi_count(dev)) != 0) { 431 if (count > 1) 432 count = 1; 433 else 434 count = 0; 435 if (count == 1 && pci_alloc_msi(dev, &count) == 0) | 428 if (aac_enable_msi != 0 && (sc->flags & AAC_FLAGS_NOMSI) == 0) { 429 count = 1; 430 if (pci_alloc_msi(dev, &count) == 0) |
436 rid = 1; 437 } 438 if ((sc->aac_irq = bus_alloc_resource_any(sc->aac_dev, SYS_RES_IRQ, | 431 rid = 1; 432 } 433 if ((sc->aac_irq = bus_alloc_resource_any(sc->aac_dev, SYS_RES_IRQ, |
439 &rid, RF_ACTIVE | (count != 0 ? 0 : RF_SHAREABLE))) == NULL) { | 434 &rid, RF_ACTIVE | (rid != 0 ? 0 : RF_SHAREABLE))) == NULL) { |
440 device_printf(dev, "can't allocate interrupt\n"); 441 goto out; 442 } 443 444 /* 445 * Allocate the parent bus DMA tag appropriate for our PCI interface. 446 * 447 * Note that some of these controllers are 64-bit capable. --- 36 unchanged lines hidden (view full) --- 484static device_method_t aacch_methods[] = { 485 /* Device interface */ 486 DEVMETHOD(device_probe, aacch_probe), 487 DEVMETHOD(device_attach, aacch_attach), 488 DEVMETHOD(device_detach, aacch_detach), 489 DEVMETHOD_END 490}; 491 | 435 device_printf(dev, "can't allocate interrupt\n"); 436 goto out; 437 } 438 439 /* 440 * Allocate the parent bus DMA tag appropriate for our PCI interface. 441 * 442 * Note that some of these controllers are 64-bit capable. --- 36 unchanged lines hidden (view full) --- 479static device_method_t aacch_methods[] = { 480 /* Device interface */ 481 DEVMETHOD(device_probe, aacch_probe), 482 DEVMETHOD(device_attach, aacch_attach), 483 DEVMETHOD(device_detach, aacch_detach), 484 DEVMETHOD_END 485}; 486 |
492struct aacch_softc { 493 device_t dev; 494}; 495 | |
496static driver_t aacch_driver = { 497 "aacch", 498 aacch_methods, | 487static driver_t aacch_driver = { 488 "aacch", 489 aacch_methods, |
499 sizeof(struct aacch_softc) | 490 1 /* no softc */ |
500}; 501 502static devclass_t aacch_devclass; 503DRIVER_MODULE(aacch, pci, aacch_driver, aacch_devclass, NULL, NULL); 504 505static int 506aacch_probe(device_t dev) 507{ 508 509 if ((pci_get_vendor(dev) != 0x9005) || 510 (pci_get_device(dev) != 0x00c5)) 511 return (ENXIO); 512 513 device_set_desc(dev, "AAC RAID Channel"); 514 return (-10); 515} 516 517static int | 491}; 492 493static devclass_t aacch_devclass; 494DRIVER_MODULE(aacch, pci, aacch_driver, aacch_devclass, NULL, NULL); 495 496static int 497aacch_probe(device_t dev) 498{ 499 500 if ((pci_get_vendor(dev) != 0x9005) || 501 (pci_get_device(dev) != 0x00c5)) 502 return (ENXIO); 503 504 device_set_desc(dev, "AAC RAID Channel"); 505 return (-10); 506} 507 508static int |
518aacch_attach(device_t dev) | 509aacch_attach(device_t dev __unused) |
519{ | 510{ |
520 struct aacch_softc *sc; | |
521 | 511 |
522 sc = device_get_softc(dev); 523 524 sc->dev = dev; 525 | |
526 return (0); 527} 528 529static int | 512 return (0); 513} 514 515static int |
530aacch_detach(device_t dev) | 516aacch_detach(device_t dev __unused) |
531{ 532 533 return (0); 534} | 517{ 518 519 return (0); 520} |