diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/if_sf_pci.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/sys/dev/pci/if_sf_pci.c b/sys/dev/pci/if_sf_pci.c index 742347e9170..2860b501ef4 100644 --- a/sys/dev/pci/if_sf_pci.c +++ b/sys/dev/pci/if_sf_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sf_pci.c,v 1.4 2007/10/22 23:00:45 fgsch Exp $ */ +/* $OpenBSD: if_sf_pci.c,v 1.5 2007/10/29 12:20:32 fgsch Exp $ */ /* $NetBSD: if_sf_pci.c,v 1.10 2006/06/17 23:34:27 christos Exp $ */ /*- @@ -113,6 +113,7 @@ sf_pci_attach(struct device *parent, struct device *self, void *aux) bus_space_tag_t iot, memt; bus_space_handle_t ioh, memh; int state, ioh_valid, memh_valid; + bus_size_t iosize, memsize; pcireg_t reg; state = pci_set_powerstate(pa->pa_pc, pa->pa_tag, PCI_PMCSR_STATE_D0); @@ -130,7 +131,7 @@ sf_pci_attach(struct device *parent, struct device *self, void *aux) case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT: case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_64BIT: memh_valid = (pci_mapreg_map(pa, SF_PCI_MEMBA, - reg, 0, &memt, &memh, NULL, NULL, 0) == 0); + reg, 0, &memt, &memh, &memsize, NULL, 0) == 0); break; default: memh_valid = 0; @@ -140,7 +141,7 @@ sf_pci_attach(struct device *parent, struct device *self, void *aux) (reg == (PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_64BIT)) ? SF_PCI_IOBA : SF_PCI_IOBA - 0x04, PCI_MAPREG_TYPE_IO, 0, - &iot, &ioh, NULL, NULL, 0) == 0); + &iot, &ioh, &iosize, NULL, 0) == 0); if (memh_valid) { sc->sc_st = memt; @@ -151,8 +152,7 @@ sf_pci_attach(struct device *parent, struct device *self, void *aux) sc->sc_sh = ioh; sc->sc_iomapped = 1; } else { - printf("%s: unable to map device registers\n", - sc->sc_dev.dv_xname); + printf(": unable to map device registers\n"); return; } @@ -167,18 +167,18 @@ sf_pci_attach(struct device *parent, struct device *self, void *aux) * Map and establish our interrupt. */ if (pci_intr_map(pa, &ih)) { - printf("%s: unable to map interrupt\n", sc->sc_dev.dv_xname); - return; + printf(": unable to map interrupt\n"); + goto out; } intrstr = pci_intr_string(pa->pa_pc, ih); psc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_NET, sf_intr, sc, self->dv_xname); if (psc->sc_ih == NULL) { - printf("%s: unable to establish interrupt", - sc->sc_dev.dv_xname); + printf(": unable to establish interrupt"); if (intrstr != NULL) printf(" at %s", intrstr); - return; + printf("\n"); + goto out; } printf(": %s", intrstr); @@ -186,4 +186,11 @@ sf_pci_attach(struct device *parent, struct device *self, void *aux) * Finish off the attach. */ sf_attach(sc); + return; + + out: + if (ioh_valid) + bus_space_unmap(iot, ioh, iosize); + if (memh_valid) + bus_space_unmap(memt, memh, memsize); } |