Date: Fri, 31 Oct 2003 17:37:22 -0800 (PST) From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 41035 for review Message-ID: <200311010137.hA11bMDC046425@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=41035 Change 41035 by sam@sam_ebb on 2003/10/31 17:37:19 o replace calculate checksum by a static HAL ABI version o print HAL version when !bootverbose (otherwise it's printed by the ath_hal module) Affected files ... .. //depot/projects/netperf/sys/dev/ath/if_ath.c#31 edit Differences ... ==== //depot/projects/netperf/sys/dev/ath/if_ath.c#31 (text+ko) ==== @@ -174,33 +174,6 @@ #define DPRINTF2(X) #endif -/* - * Calculate a "checksum" that the driver can use to - * check for ABI compatibility. We just sum the offsets - * of all the function pointers which are assumed to - * start with ah_getRateTable and continue sequentially - * to the end of the structure. If a new method is added - * or moved this will be detected. This will not, however - * catch methods being moved around or some number added - * while an equal number are replaced, or arguments being - * changed, or lots of other things. - * - * This is stopgap. Improvements are welcome. - */ -static u_int32_t -ath_calcsum(void) -{ - u_int32_t sum = 0; - u_int32_t off; - - off = offsetof(struct ath_hal, ah_getRateTable); - while (off < sizeof(struct ath_hal)) { - sum += off; - off += sizeof(void (*)(void)); - } - return sum; -} - int ath_attach(u_int16_t devid, struct ath_softc *sc) { @@ -223,9 +196,17 @@ error = ENXIO; goto bad; } - if (ah->ah_checksum != ath_calcsum()) { - if_printf(ifp, "HAL ABI mismatch detected (%u != %u)\n", - ah->ah_checksum, ath_calcsum()); + if (!bootverbose) { + /* + * The ath_hal module prints the version string + * with bootverbose so only do it here for the + * other case. + */ + if_printf(ifp, "hal %s\n", ath_hal_version); + } + if (ah->ah_abi != HAL_ABI_VERSION) { + if_printf(ifp, "HAL ABI mismatch detected (0x%x != 0x%x)\n", + ah->ah_abi, HAL_ABI_VERSION); error = ENXIO; goto bad; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311010137.hA11bMDC046425>