If we fail to attach, use the size determined by pci_mapreg_map() rather

than a constant, since this will be incorrect on some chips (MPI350) and
lead to a panic.
This commit is contained in:
rumble 2007-04-06 18:16:29 +00:00
parent f7d8f11391
commit e0d3b63ac3
2 changed files with 6 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: anreg.h,v 1.13 2006/02/19 08:20:46 dyoung Exp $ */ /* $NetBSD: anreg.h,v 1.14 2007/04/06 18:16:29 rumble Exp $ */
/* /*
* Copyright (c) 1997, 1998, 1999 * Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
@ -36,11 +36,6 @@
#ifndef _DEV_IC_ANREG_H #ifndef _DEV_IC_ANREG_H
#define _DEV_IC_ANREG_H #define _DEV_IC_ANREG_H
/*
* Size of Aironet I/O space.
*/
#define AN_IOSIZ 0x40
/* /*
* Hermes register definitions and what little I know about them. * Hermes register definitions and what little I know about them.
*/ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_an_pci.c,v 1.21 2006/11/16 01:33:08 christos Exp $ */ /* $NetBSD: if_an_pci.c,v 1.22 2007/04/06 18:16:29 rumble Exp $ */
/* /*
* Copyright (c) 2000 The NetBSD Foundation, Inc. * Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_an_pci.c,v 1.21 2006/11/16 01:33:08 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: if_an_pci.c,v 1.22 2007/04/06 18:16:29 rumble Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -127,6 +127,7 @@ an_pci_attach(struct device *parent, struct device *self, void *aux)
char devinfo[256]; char devinfo[256];
char const *intrstr; char const *intrstr;
pci_intr_handle_t ih; pci_intr_handle_t ih;
bus_size_t iosize;
u_int32_t csr; u_int32_t csr;
aprint_naive(": 802.11 controller\n"); aprint_naive(": 802.11 controller\n");
@ -136,7 +137,7 @@ an_pci_attach(struct device *parent, struct device *self, void *aux)
/* Map I/O registers */ /* Map I/O registers */
if (pci_mapreg_map(pa, AN_PCI_IOBA, PCI_MAPREG_TYPE_IO, 0, if (pci_mapreg_map(pa, AN_PCI_IOBA, PCI_MAPREG_TYPE_IO, 0,
&sc->sc_iot, &sc->sc_ioh, NULL, NULL) != 0) { &sc->sc_iot, &sc->sc_ioh, NULL, &iosize) != 0) {
aprint_error("%s: unable to map registers\n", self->dv_xname); aprint_error("%s: unable to map registers\n", self->dv_xname);
return; return;
} }
@ -168,6 +169,6 @@ an_pci_attach(struct device *parent, struct device *self, void *aux)
aprint_error("%s: failed to attach controller\n", aprint_error("%s: failed to attach controller\n",
self->dv_xname); self->dv_xname);
pci_intr_disestablish(pa->pa_pc, psc->sc_ih); pci_intr_disestablish(pa->pa_pc, psc->sc_ih);
bus_space_unmap(sc->sc_iot, sc->sc_ioh, AN_IOSIZ); bus_space_unmap(sc->sc_iot, sc->sc_ioh, iosize);
} }
} }