Deleted Added
full compact
102c102
< __FBSDID("$FreeBSD: head/sys/dev/msk/if_msk.c 165138 2006-12-13 02:30:11Z yongari $");
---
> __FBSDID("$FreeBSD: head/sys/dev/msk/if_msk.c 165611 2006-12-29 03:33:33Z yongari $");
342d341
< { SYS_RES_IRQ, 0, RF_ACTIVE | RF_SHAREABLE },
347a347,350
> { -1, 0, 0 }
> };
>
> static struct resource_spec msk_irq_spec_legacy[] = {
351a355,360
> static struct resource_spec msk_irq_spec_msi[] = {
> { SYS_RES_IRQ, 1, RF_ACTIVE },
> { SYS_RES_IRQ, 2, RF_ACTIVE },
> { -1, 0, 0 }
> };
>
1549,1567c1558
< /* Allocate resources */
< sc->msk_msi = 0;
< msic = pci_msi_count(dev);
< if (bootverbose)
< device_printf(dev, "MSI count : %d\n", msic);
< /*
< * Due to a unknown reason Yukon II reports it can handle two
< * messages even if it can handle just one message. Forcing
< * to allocate 1 message seems to work but reloading kernel
< * module after unloading the driver fails. Only use MSI when
< * it reports 1 message until we have better understanding
< * for the hardware.
< */
< if (msic == 1 && msi_disable == 0 && pci_alloc_msi(dev, &msic) == 0) {
< sc->msk_msi = 1;
< /* Set rid to 1 for SYS_RES_IRQ to use MSI. */
< msk_res_spec_io[1].rid = 1;
< msk_res_spec_mem[1].rid = 1;
< }
---
> /* Allocate I/O resource */
1712a1704,1733
> /* Allocate IRQ resources. */
> msic = pci_msi_count(dev);
> if (bootverbose)
> device_printf(dev, "MSI count : %d\n", msic);
> /*
> * The Yukon II reports it can handle two messages, one for each
> * possible port. We go ahead and allocate two messages and only
> * setup a handler for both if we have a dual port card.
> *
> * XXX: I haven't untangled the interrupt handler to handle dual
> * port cards with separate MSI messages, so for now I disable MSI
> * on dual port cards.
> */
> if (msic == 2 && msi_disable == 0 && sc->msk_num_port == 1 &&
> pci_alloc_msi(dev, &msic) == 0) {
> if (msic == 2) {
> sc->msk_msi = 1;
> sc->msk_irq_spec = msk_irq_spec_msi;
> } else {
> pci_release_msi(dev);
> sc->msk_irq_spec = msk_irq_spec_legacy;
> }
> }
>
> error = bus_alloc_resources(dev, sc->msk_irq_spec, sc->msk_irq);
> if (error) {
> device_printf(dev, "couldn't allocate IRQ resources\n");
> goto fail;
> }
>
1773,1774c1794,1795
< error = bus_setup_intr(dev, sc->msk_res[1], INTR_TYPE_NET |
< INTR_MPSAFE | INTR_FAST, msk_intr, sc, &sc->msk_intrhand);
---
> error = bus_setup_intr(dev, sc->msk_irq[0], INTR_TYPE_NET |
> INTR_MPSAFE | INTR_FAST, msk_intr, sc, &sc->msk_intrhand[0]);
1887,1889c1908,1910
< if (sc->msk_intrhand) {
< bus_teardown_intr(dev, sc->msk_res[1], sc->msk_intrhand);
< sc->msk_intrhand = NULL;
---
> if (sc->msk_intrhand[0]) {
> bus_teardown_intr(dev, sc->msk_irq[0], sc->msk_intrhand[0]);
> sc->msk_intrhand[0] = NULL;
1890a1912,1916
> if (sc->msk_intrhand[1]) {
> bus_teardown_intr(dev, sc->msk_irq[0], sc->msk_intrhand[0]);
> sc->msk_intrhand[1] = NULL;
> }
> bus_release_resources(dev, sc->msk_irq_spec, sc->msk_irq);