From owner-svn-src-all@FreeBSD.ORG Thu May 5 03:42:04 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBAD4106566B; Thu, 5 May 2011 03:42:04 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C96CE8FC08; Thu, 5 May 2011 03:42:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p453g4le080190; Thu, 5 May 2011 03:42:04 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p453g4E7080188; Thu, 5 May 2011 03:42:04 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105050342.p453g4E7080188@svn.freebsd.org> From: Adrian Chadd Date: Thu, 5 May 2011 03:42:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221480 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2011 03:42:05 -0000 Author: adrian Date: Thu May 5 03:42:04 2011 New Revision: 221480 URL: http://svn.freebsd.org/changeset/base/221480 Log: Fix up the chipset checks for the AR5416 and later silicon. The checks should function as follows: * AR_SREV_ : check macVersion matches that version id * AR_SREV__ : check macVersion and macRevision match the version / revision respectively * AR_SREV___OR_LATER: check that + if the chip silicon version == macVersion, enforce revision >= macRevision + if the chip silicon version > macVersion, allow it. For example, AR_SREV_MERLIN() only matches AR9280 (any revision), AR_SREV_MERLIN_10() would only match AR9280 version 1.0, but AR_SREV_MERLIN_20_OR_LATER() matches AR9280 version >= 2.0 _AND_ any subsequent MAC (So AR9285, AR9287, etc.) The specific fixes which may impact users: * if there is Merlin hardware > revision 2.0, it'll now be correctly matched by AR_SREV_MERLIN_20_OR_LATER() - the older code simply would match on either Merlin 2.0 or a subsequent MAC (AR9285, AR9287, etc.) * Kite version 1.1/1.2 should now correctly match. As these macros are used in the AR9285 reset/attach path, and it's assumed that the hardware is kite anyway, the behaviour shouldn't change. It'll only change if these macros are used in other codepaths shared with older silicon. Obtained from: Linux ath9k, Atheros Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Thu May 5 02:59:31 2011 (r221479) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Thu May 5 03:42:04 2011 (r221480) @@ -625,56 +625,83 @@ #define AR_XSREV_REVISION_KITE_11 1 /* Kite 1.1 */ #define AR_XSREV_REVISION_KITE_12 2 /* Kite 1.2 */ +/* Owl (AR5416) */ #define AR_SREV_OWL(_ah) \ ((AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_OWL_PCI) || \ (AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_OWL_PCIE)) #define AR_SREV_OWL_20_OR_LATER(_ah) \ - ((AR_SREV_OWL(_ah) && AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_OWL_20) || \ - AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_HOWL) + ((AR_SREV_OWL(_ah) && \ + AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_OWL_20) || \ + AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_HOWL) + #define AR_SREV_OWL_22_OR_LATER(_ah) \ - ((AR_SREV_OWL(_ah) && AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_OWL_22) || \ - AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_HOWL) + ((AR_SREV_OWL(_ah) && \ + AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_OWL_22) || \ + AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_HOWL) + +/* Howl (AR9130) */ #define AR_SREV_HOWL(_ah) \ (AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_HOWL) + #define AR_SREV_9100(_ah) AR_SREV_HOWL(_ah) +/* Sowl (AR9160) */ + #define AR_SREV_SOWL(_ah) \ (AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_SOWL) + #define AR_SREV_SOWL_10_OR_LATER(_ah) \ (AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_SOWL) + #define AR_SREV_SOWL_11(_ah) \ (AR_SREV_SOWL(_ah) && \ AH_PRIVATE((_ah))->ah_macRev == AR_XSREV_REVISION_SOWL_11) +/* Merlin (AR9280) */ + #define AR_SREV_MERLIN(_ah) \ (AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_MERLIN) + #define AR_SREV_MERLIN_10_OR_LATER(_ah) \ (AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_MERLIN) + #define AR_SREV_MERLIN_20(_ah) \ (AR_SREV_MERLIN(_ah) && \ AH_PRIVATE((_ah))->ah_macRev == AR_XSREV_REVISION_MERLIN_20) + #define AR_SREV_MERLIN_20_OR_LATER(_ah) \ - (AR_SREV_MERLIN_20(_ah) || \ - AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_MERLIN) + ((AH_PRIVATE((_ah))->ah_macVersion > AR_XSREV_VERSION_MERLIN) || \ + (AR_SREV_MERLIN((_ah)) && \ + AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_MERLIN_20)) + +/* Kite (AR9285) */ #define AR_SREV_KITE(_ah) \ (AH_PRIVATE((_ah))->ah_macVersion == AR_XSREV_VERSION_KITE) + #define AR_SREV_KITE_10_OR_LATER(_ah) \ (AH_PRIVATE((_ah))->ah_macVersion >= AR_XSREV_VERSION_KITE) + #define AR_SREV_KITE_11(_ah) \ (AR_SREV_KITE(ah) && \ AH_PRIVATE((_ah))->ah_macRev == AR_XSREV_REVISION_KITE_11) + #define AR_SREV_KITE_11_OR_LATER(_ah) \ - (AR_SREV_KITE_11(_ah) || \ - AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_KITE_11) + ((AH_PRIVATE((_ah))->ah_macVersion > AR_XSREV_VERSION_KITE) || \ + (AR_SREV_KITE((_ah)) && \ + AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_KITE_11)) + #define AR_SREV_KITE_12(_ah) \ (AR_SREV_KITE(ah) && \ AH_PRIVATE((_ah))->ah_macRev == AR_XSREV_REVISION_KITE_12) + #define AR_SREV_KITE_12_OR_LATER(_ah) \ - (AR_SREV_KITE_12(_ah) || \ - AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_KITE_12) + ((AH_PRIVATE((_ah))->ah_macVersion > AR_XSREV_VERSION_KITE) || \ + (AR_SREV_KITE((_ah)) && \ + AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_KITE_12)) + #define AR_SREV_9285E_20(_ah) \ (AR_SREV_KITE_12_OR_LATER(_ah) && \ ((OS_REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1))