From owner-p4-projects@FreeBSD.ORG Fri Oct 31 17:37:24 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C4E6916A4D0; Fri, 31 Oct 2003 17:37:23 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9EA3616A4CE for ; Fri, 31 Oct 2003 17:37:23 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 205F443FDD for ; Fri, 31 Oct 2003 17:37:23 -0800 (PST) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id hA11bMXJ046428 for ; Fri, 31 Oct 2003 17:37:22 -0800 (PST) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id hA11bMDC046425 for perforce@freebsd.org; Fri, 31 Oct 2003 17:37:22 -0800 (PST) (envelope-from sam@freebsd.org) Date: Fri, 31 Oct 2003 17:37:22 -0800 (PST) Message-Id: <200311010137.hA11bMDC046425@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 41035 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2003 01:37:24 -0000 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; }