From owner-svn-src-all@FreeBSD.ORG Wed Sep 19 12:27:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 811F91065670; Wed, 19 Sep 2012 12:27:24 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BDA48FC17; Wed, 19 Sep 2012 12:27:24 +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 q8JCROhm090975; Wed, 19 Sep 2012 12:27:24 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8JCRO97090969; Wed, 19 Sep 2012 12:27:24 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201209191227.q8JCRO97090969@svn.freebsd.org> From: Gavin Atkinson Date: Wed, 19 Sep 2012 12:27:24 +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: r240693 - in head/sys/dev: ahci alc cxgbe e1000 re 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: Wed, 19 Sep 2012 12:27:24 -0000 Author: gavin Date: Wed Sep 19 12:27:23 2012 New Revision: 240693 URL: http://svn.freebsd.org/changeset/base/240693 Log: Switch some PCI register reads from using magic numbers to using the names defined in pcireg.h MFC after: 1 week Modified: head/sys/dev/ahci/ahci.c head/sys/dev/alc/if_alc.c head/sys/dev/cxgbe/osdep.h head/sys/dev/e1000/if_em.c head/sys/dev/re/if_re.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Wed Sep 19 11:54:32 2012 (r240692) +++ head/sys/dev/ahci/ahci.c Wed Sep 19 12:27:23 2012 (r240693) @@ -543,7 +543,7 @@ ahci_ctlr_reset(device_t dev) struct ahci_controller *ctlr = device_get_softc(dev); int timeout; - if (pci_read_config(dev, 0x00, 4) == 0x28298086 && + if (pci_read_config(dev, PCIR_DEVVENDOR, 4) == 0x28298086 && (pci_read_config(dev, 0x92, 1) & 0xfe) == 0x04) pci_write_config(dev, 0x92, 0x01, 1); /* Enable AHCI mode */ Modified: head/sys/dev/alc/if_alc.c ============================================================================== --- head/sys/dev/alc/if_alc.c Wed Sep 19 11:54:32 2012 (r240692) +++ head/sys/dev/alc/if_alc.c Wed Sep 19 12:27:23 2012 (r240693) @@ -694,10 +694,10 @@ alc_aspm(struct alc_softc *sc, int media if ((sc->alc_flags & ALC_FLAG_APS) != 0) { /* Disable extended sync except AR8152 B v1.0 */ - linkcfg &= ~0x80; + linkcfg &= ~PCIEM_LINK_CTL_EXTENDED_SYNC; if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B && sc->alc_rev == ATHEROS_AR8152_B_V10) - linkcfg |= 0x80; + linkcfg |= PCIEM_LINK_CTL_EXTENDED_SYNC; CSR_WRITE_2(sc, sc->alc_expcap + PCIER_LINK_CTL, linkcfg); pmcfg &= ~(PM_CFG_EN_BUFS_RX_L0S | PM_CFG_SA_DLY_ENB | @@ -834,15 +834,15 @@ alc_attach(device_t dev) cap = CSR_READ_2(sc, base + PCIER_LINK_CAP); if ((cap & PCIEM_LINK_CAP_ASPM) != 0) { ctl = CSR_READ_2(sc, base + PCIER_LINK_CTL); - if ((ctl & 0x08) != 0) + if ((ctl & PCIEM_LINK_CTL_RCB) != 0) sc->alc_rcb = DMA_CFG_RCB_128; if (bootverbose) device_printf(dev, "RCB %u bytes\n", sc->alc_rcb == DMA_CFG_RCB_64 ? 64 : 128); - state = ctl & 0x03; - if (state & 0x01) + state = ctl & PCIEM_LINK_CTL_ASPMC; + if (state & PCIEM_LINK_CTL_ASPMC_L0S) sc->alc_flags |= ALC_FLAG_L0S; - if (state & 0x02) + if (state & PCIEM_LINK_CTL_ASPMC_L1) sc->alc_flags |= ALC_FLAG_L1S; if (bootverbose) device_printf(sc->alc_dev, "ASPM %s %s\n", Modified: head/sys/dev/cxgbe/osdep.h ============================================================================== --- head/sys/dev/cxgbe/osdep.h Wed Sep 19 11:54:32 2012 (r240692) +++ head/sys/dev/cxgbe/osdep.h Wed Sep 19 12:27:23 2012 (r240693) @@ -125,7 +125,7 @@ typedef boolean_t bool; #define PCI_EXP_LNKSTA PCIER_LINK_STA #define PCI_EXP_LNKSTA_CLS PCIEM_LINK_STA_SPEED #define PCI_EXP_LNKSTA_NLW PCIEM_LINK_STA_WIDTH -#define PCI_EXP_DEVCTL2 0x28 +#define PCI_EXP_DEVCTL2 PCIER_DEVICE_CTL2 static inline int ilog2(long x) Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Wed Sep 19 11:54:32 2012 (r240692) +++ head/sys/dev/e1000/if_em.c Wed Sep 19 12:27:23 2012 (r240693) @@ -5119,7 +5119,7 @@ em_disable_aspm(struct adapter *adapter) return; reg = base + PCIER_LINK_CTL; link_ctrl = pci_read_config(dev, reg, 2); - link_ctrl &= 0xFFFC; /* turn off bit 1 and 2 */ + link_ctrl &= ~PCIEM_LINK_CTL_ASPMC; pci_write_config(dev, reg, link_ctrl, 2); return; } Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Wed Sep 19 11:54:32 2012 (r240692) +++ head/sys/dev/re/if_re.c Wed Sep 19 12:27:23 2012 (r240693) @@ -1347,8 +1347,8 @@ re_attach(device_t dev) if ((cap & PCIEM_LINK_CAP_ASPM) != 0) { ctl = pci_read_config(dev, sc->rl_expcap + PCIER_LINK_CTL, 2); - if ((ctl & 0x0003) != 0) { - ctl &= ~0x0003; + if ((ctl & PCIEM_LINK_CTL_ASPMC) != 0) { + ctl &= ~PCIEM_LINK_CTL_ASPMC; pci_write_config(dev, sc->rl_expcap + PCIER_LINK_CTL, ctl, 2); device_printf(dev, "ASPM disabled\n");