diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-04-13 14:44:42 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-04-13 14:44:42 +0000 |
commit | 5ad6ade5e85987b54b0e14483b27ed413a39ff2d (patch) | |
tree | 994b39a0991f3c1555628c557e4dc57865e79b78 /sys | |
parent | 05c098915e64978c768534c33db5f8902e731788 (diff) |
The integrated Atheros NICs found in IBM/Lenovo ThinkPads use the same
device ID for old AR5212-based 32bit and new AR5424-based 64bit (PCI
Express Mini Card) interfaces. Use an extra check to look if the card
is 64bit and attach it as a single chip device. This prevents a panic
when attaching the device on some laptops like the T60.
Tested on a T42 (old AR5212 Mini PCI interface),
Tested on a T60 (new AR5424 Mini Card interface)
Nevertheless, the AR5424 does not work yet.
Thanks to Stefan Konrath
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/ar5xxx.c | 24 | ||||
-rw-r--r-- | sys/dev/ic/ar5xxx.h | 4 | ||||
-rw-r--r-- | sys/dev/ic/ath.c | 5 | ||||
-rw-r--r-- | sys/dev/ic/athvar.h | 5 | ||||
-rw-r--r-- | sys/dev/pci/if_ath_pci.c | 4 |
5 files changed, 31 insertions, 11 deletions
diff --git a/sys/dev/ic/ar5xxx.c b/sys/dev/ic/ar5xxx.c index ee5d132810c..89cffa45279 100644 --- a/sys/dev/ic/ar5xxx.c +++ b/sys/dev/ic/ar5xxx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar5xxx.c,v 1.39 2007/03/12 01:04:52 reyk Exp $ */ +/* $OpenBSD: ar5xxx.c,v 1.40 2007/04/13 14:44:41 reyk Exp $ */ /* * Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org> @@ -22,7 +22,6 @@ */ #include <dev/pci/pcidevs.h> - #include <dev/ic/ar5xxx.h> extern ar5k_attach_t ar5k_ar5210_attach; @@ -148,9 +147,10 @@ ath_hal_probe(u_int16_t vendor, u_int16_t device) * Fills in the HAL structure and initialises the device */ struct ath_hal * -ath_hal_attach(u_int16_t device, void *sc, bus_space_tag_t st, - bus_space_handle_t sh, int *status) +ath_hal_attach(u_int16_t device, void *arg, bus_space_tag_t st, + bus_space_handle_t sh, u_int is_64bit, int *status) { + struct ath_softc *sc = (struct ath_softc *)arg; struct ath_hal *hal = NULL; ar5k_attach_t *attach = NULL; u_int8_t mac[IEEE80211_ADDR_LEN]; @@ -213,6 +213,22 @@ ath_hal_attach(u_int16_t device, void *sc, bus_space_tag_t st, */ hal->ah_single_chip = AH_TRUE; break; + case PCI_PRODUCT_ATHEROS_AR5212_IBM: + /* + * IBM ThinkPads use the same device ID for different + * chipset versions. Ugh. + */ + if (is_64bit) { + /* + * PCI Express "Mini Card" interface based on the + * AR5424 chipset + */ + hal->ah_single_chip = AH_TRUE; + } else { + /* Classic Mini PCI interface based on AR5212 */ + hal->ah_single_chip = AH_FALSE; + } + break; default: /* * Multi chip solutions diff --git a/sys/dev/ic/ar5xxx.h b/sys/dev/ic/ar5xxx.h index 5b1692c7197..eca6daac97f 100644 --- a/sys/dev/ic/ar5xxx.h +++ b/sys/dev/ic/ar5xxx.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ar5xxx.h,v 1.39 2007/03/12 01:04:52 reyk Exp $ */ +/* $OpenBSD: ar5xxx.h,v 1.40 2007/04/13 14:44:41 reyk Exp $ */ /* * Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org> @@ -1937,7 +1937,7 @@ __BEGIN_DECLS const char *ath_hal_probe(u_int16_t, u_int16_t); struct ath_hal *ath_hal_attach(u_int16_t, void *, bus_space_tag_t, - bus_space_handle_t, HAL_STATUS *); + bus_space_handle_t, u_int, HAL_STATUS *); u_int16_t ath_hal_computetxtime(struct ath_hal *, const HAL_RATE_TABLE *, u_int32_t, u_int16_t, HAL_BOOL); diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c index a99e5cf017f..13afb34b201 100644 --- a/sys/dev/ic/ath.c +++ b/sys/dev/ic/ath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ath.c,v 1.61 2007/01/03 18:16:43 claudio Exp $ */ +/* $OpenBSD: ath.c,v 1.62 2007/04/13 14:44:41 reyk Exp $ */ /* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */ /*- @@ -221,7 +221,8 @@ ath_attach(u_int16_t devid, struct ath_softc *sc) bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); sc->sc_flags &= ~ATH_ATTACHED; /* make sure that it's not attached */ - ah = ath_hal_attach(devid, sc, sc->sc_st, sc->sc_sh, &status); + ah = ath_hal_attach(devid, sc, sc->sc_st, sc->sc_sh, sc->sc_64bit, + &status); if (ah == NULL) { printf("%s: unable to attach hardware; HAL status %d\n", ifp->if_xname, status); diff --git a/sys/dev/ic/athvar.h b/sys/dev/ic/athvar.h index 75fbb2fae81..dade9abc274 100644 --- a/sys/dev/ic/athvar.h +++ b/sys/dev/ic/athvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: athvar.h,v 1.18 2006/06/23 21:53:01 reyk Exp $ */ +/* $OpenBSD: athvar.h,v 1.19 2007/04/13 14:44:41 reyk Exp $ */ /* $NetBSD: athvar.h,v 1.10 2004/08/10 01:03:53 dyoung Exp $ */ /*- @@ -231,7 +231,8 @@ struct ath_softc { sc_doani : 1, /* dynamic noise immunity */ sc_veol : 1, /* tx VEOL support */ sc_softled : 1, /* GPIO software LED */ - sc_probing : 1; /* probing AP on beacon miss */ + sc_probing : 1, /* probing AP on beacon miss */ + sc_64bit : 1; /* indicates PCI Express */ u_int sc_nchan; /* number of valid channels */ const HAL_RATE_TABLE *sc_rates[IEEE80211_MODE_MAX]; const HAL_RATE_TABLE *sc_currates; /* current rate table */ diff --git a/sys/dev/pci/if_ath_pci.c b/sys/dev/pci/if_ath_pci.c index 190fbc74c24..3da62148cd2 100644 --- a/sys/dev/pci/if_ath_pci.c +++ b/sys/dev/pci/if_ath_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ath_pci.c,v 1.13 2006/08/03 02:29:33 brad Exp $ */ +/* $OpenBSD: if_ath_pci.c,v 1.14 2007/04/13 14:44:41 reyk Exp $ */ /* $NetBSD: if_ath_pci.c,v 1.7 2004/06/30 05:58:17 mycroft Exp $ */ /*- @@ -148,6 +148,8 @@ ath_pci_attach(struct device *parent, struct device *self, void *aux) printf(": bad PCI register type %d\n", (int)mem_type); goto bad; } + if (mem_type == PCI_MAPREG_MEM_TYPE_64BIT) + sc->sc_64bit = 1; if (pci_mapreg_map(pa, ATH_BAR0, mem_type, 0, &iot, &ioh, NULL, NULL, 0)) { printf(": cannot map register space\n"); |