From owner-svn-src-all@FreeBSD.ORG Tue Nov 8 22:50:29 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 2B740106566C; Tue, 8 Nov 2011 22:50:29 +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 1ACBD8FC15; Tue, 8 Nov 2011 22:50:29 +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 pA8MoSQl052860; Tue, 8 Nov 2011 22:50:28 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA8MoSMi052856; Tue, 8 Nov 2011 22:50:28 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201111082250.pA8MoSMi052856@svn.freebsd.org> From: Adrian Chadd Date: Tue, 8 Nov 2011 22:50:28 +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: r227365 - in head/sys/dev/ath: . ath_hal 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: Tue, 08 Nov 2011 22:50:29 -0000 Author: adrian Date: Tue Nov 8 22:50:28 2011 New Revision: 227365 URL: http://svn.freebsd.org/changeset/base/227365 Log: Fix the KTR option to compile by default - it was referencing some unmerged interrupt status debugging code from my branch. * Add ah_intrstate[8] which will have the record of the last call to ath_hal_getintr(). * Wrap the KTR code behind ATH_KTR_INTR_DEBUG. * Add the HAL interrupt debugging behind AH_INTERRUPT_DEBUGGING. This is only done for the AR5416 and later NICs but it will be trivial to add to the earlier NICs if required. Neither are enabled by default, although to minimise HAL binary API differences, the ah_intrstate[] array is always compiled into the ath_hal struct. Modified: head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Tue Nov 8 22:43:13 2011 (r227364) +++ head/sys/dev/ath/ath_hal/ah.h Tue Nov 8 22:50:28 2011 (r227365) @@ -810,6 +810,8 @@ struct ath_hal { uint16_t *ah_eepromdata; /* eeprom buffer, if needed */ + uint32_t ah_intrstate[8]; /* last int state */ + HAL_OPS_CONFIG ah_config; const HAL_RATE_TABLE *__ahdecl(*ah_getRateTable)(struct ath_hal *, u_int mode); Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Tue Nov 8 22:43:13 2011 (r227364) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Tue Nov 8 22:50:28 2011 (r227365) @@ -70,6 +70,13 @@ ar5416GetPendingInterrupts(struct ath_ha uint32_t isr, isr0, isr1, sync_cause = 0; HAL_CAPABILITIES *pCap = &AH_PRIVATE(ah)->ah_caps; +#ifdef AH_INTERRUPT_DEBUGGING + /* + * Blank the interrupt debugging area regardless. + */ + bzero(&ah->ah_intrstate, sizeof(ah->ah_intrstate)); +#endif + /* * Verify there's a mac interrupt and the RTC is on. */ @@ -90,6 +97,16 @@ ar5416GetPendingInterrupts(struct ath_ha return AH_FALSE; } +#ifdef AH_INTERRUPT_DEBUGGING + ah->ah_intrstate[0] = isr; + ah->ah_intrstate[1] = OS_REG_READ(ah, AR_ISR_S0); + ah->ah_intrstate[2] = OS_REG_READ(ah, AR_ISR_S1); + ah->ah_intrstate[3] = OS_REG_READ(ah, AR_ISR_S2); + ah->ah_intrstate[4] = OS_REG_READ(ah, AR_ISR_S3); + ah->ah_intrstate[5] = OS_REG_READ(ah, AR_ISR_S4); + ah->ah_intrstate[6] = OS_REG_READ(ah, AR_ISR_S5); +#endif + if (isr != 0) { struct ath_hal_5212 *ahp = AH5212(ah); uint32_t mask2; Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Tue Nov 8 22:43:13 2011 (r227364) +++ head/sys/dev/ath/if_ath.c Tue Nov 8 22:50:28 2011 (r227365) @@ -1376,6 +1376,7 @@ ath_intr(void *arg) ath_hal_getisr(ah, &status); /* NB: clears ISR too */ DPRINTF(sc, ATH_DEBUG_INTR, "%s: status 0x%x\n", __func__, status); CTR1(ATH_KTR_INTR, "ath_intr: mask=0x%.8x", status); +#ifdef ATH_KTR_INTR_DEBUG CTR5(ATH_KTR_INTR, "ath_intr: ISR=0x%.8x, ISR_S0=0x%.8x, ISR_S1=0x%.8x, ISR_S2=0x%.8x, ISR_S5=0x%.8x", ah->ah_intrstate[0], @@ -1383,6 +1384,7 @@ ath_intr(void *arg) ah->ah_intrstate[2], ah->ah_intrstate[3], ah->ah_intrstate[6]); +#endif status &= sc->sc_imask; /* discard unasked for bits */ /* Short-circuit un-handled interrupts */