From owner-svn-src-head@FreeBSD.ORG Wed Apr 9 03:51:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 38774DBA; Wed, 9 Apr 2014 03:51:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BBF911E1; Wed, 9 Apr 2014 03:51:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s393p5SG044556; Wed, 9 Apr 2014 03:51:05 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s393p5PF044555; Wed, 9 Apr 2014 03:51:05 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201404090351.s393p5PF044555@svn.freebsd.org> From: Adrian Chadd Date: Wed, 9 Apr 2014 03:51:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264292 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Apr 2014 03:51:06 -0000 Author: adrian Date: Wed Apr 9 03:51:05 2014 New Revision: 264292 URL: http://svnweb.freebsd.org/changeset/base/264292 Log: Add a function to check whether the given register can be accessed whilst the chip is asleep. It's AR5416 and later specific; I'll add a HAL method to generalise it later. Tested: * AR5416, STA mode Modified: head/sys/dev/ath/ah_osdep.c Modified: head/sys/dev/ath/ah_osdep.c ============================================================================== --- head/sys/dev/ath/ah_osdep.c Wed Apr 9 03:46:04 2014 (r264291) +++ head/sys/dev/ath/ah_osdep.c Wed Apr 9 03:51:05 2014 (r264292) @@ -138,6 +138,24 @@ ath_hal_ether_sprintf(const u_int8_t *ma #ifdef AH_DEBUG +/* + * XXX This is highly relevant only for the AR5416 and later + * PCI/PCIe NICs. It'll need adjustment for other hardware + * variations. + */ +static int +ath_hal_reg_whilst_asleep(struct ath_hal *ah, uint32_t reg) +{ + + if (reg >= 0x4000 && reg < 0x5000) + return (1); + if (reg >= 0x6000 && reg < 0x7000) + return (1); + if (reg >= 0x7000 && reg < 0x8000) + return (1); + return (0); +} + void DO_HALDEBUG(struct ath_hal *ah, u_int mask, const char* fmt, ...) { @@ -254,7 +272,8 @@ ath_hal_reg_write(struct ath_hal *ah, u_ bus_space_handle_t h = ah->ah_sh; /* Debug - complain if we haven't fully waken things up */ - if (ah->ah_powerMode != HAL_PM_AWAKE) { + if (! ath_hal_reg_whilst_asleep(ah, reg) && + ah->ah_powerMode != HAL_PM_AWAKE) { ath_hal_printf(ah, "%s: reg=0x%08x, val=0x%08x, pm=%d\n", __func__, reg, val, ah->ah_powerMode); } @@ -285,7 +304,8 @@ ath_hal_reg_read(struct ath_hal *ah, u_i u_int32_t val; /* Debug - complain if we haven't fully waken things up */ - if (ah->ah_powerMode != HAL_PM_AWAKE) { + if (! ath_hal_reg_whilst_asleep(ah, reg) && + ah->ah_powerMode != HAL_PM_AWAKE) { ath_hal_printf(ah, "%s: reg=0x%08x, pm=%d\n", __func__, reg, ah->ah_powerMode); } @@ -343,7 +363,8 @@ ath_hal_reg_write(struct ath_hal *ah, u_ bus_space_handle_t h = ah->ah_sh; /* Debug - complain if we haven't fully waken things up */ - if (ah->ah_powerMode != HAL_PM_AWAKE) { + if (! ath_hal_reg_whilst_asleep(ah, reg) && + ah->ah_powerMode != HAL_PM_AWAKE) { ath_hal_printf(ah, "%s: reg=0x%08x, val=0x%08x, pm=%d\n", __func__, reg, val, ah->ah_powerMode); } @@ -363,7 +384,8 @@ ath_hal_reg_read(struct ath_hal *ah, u_i u_int32_t val; /* Debug - complain if we haven't fully waken things up */ - if (ah->ah_powerMode != HAL_PM_AWAKE) { + if (! ath_hal_reg_whilst_asleep(ah, reg) && + ah->ah_powerMode != HAL_PM_AWAKE) { ath_hal_printf(ah, "%s: reg=0x%08x, pm=%d\n", __func__, reg, ah->ah_powerMode); }