From owner-svn-src-head@FreeBSD.ORG Sun Sep 28 05:28:11 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E1C2BC5C; Sun, 28 Sep 2014 05:28:11 +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 CDF38241; Sun, 28 Sep 2014 05:28:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8S5SBLu012766; Sun, 28 Sep 2014 05:28:11 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8S5SBm5012765; Sun, 28 Sep 2014 05:28:11 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201409280528.s8S5SBm5012765@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 28 Sep 2014 05:28:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272237 - head/sys/mips/atheros 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.18-1 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: Sun, 28 Sep 2014 05:28:12 -0000 Author: adrian Date: Sun Sep 28 05:28:11 2014 New Revision: 272237 URL: http://svnweb.freebsd.org/changeset/base/272237 Log: Fix the ar724x PCI config space register read. It was doing incorrect things with masks. This was fixed in the AR71xx codebase but it wasn't yet fixed in the AR724x code. This ended up having config space reads return larger/incorrect values in some situations. Tested: * AR7240 TODO: * test ar7241, AR7242, and AR934x. Modified: head/sys/mips/atheros/ar724x_pci.c Modified: head/sys/mips/atheros/ar724x_pci.c ============================================================================== --- head/sys/mips/atheros/ar724x_pci.c Sun Sep 28 01:53:02 2014 (r272236) +++ head/sys/mips/atheros/ar724x_pci.c Sun Sep 28 05:28:11 2014 (r272237) @@ -122,8 +122,12 @@ ar724x_pci_read_config(device_t dev, u_i /* Register access is 32-bit aligned */ shift = (reg & 3) * 8; - if (shift) - mask = (1 << shift) - 1; + + /* Create a mask based on the width, post-shift */ + if (bytes == 2) + mask = 0xffff; + else if (bytes == 1) + mask = 0xff; else mask = 0xffffffff; @@ -337,7 +341,6 @@ ar724x_pci_slot_fixup(device_t dev) return; } - device_printf(dev, "found EEPROM at 0x%lx on %d.%d.%d\n", flash_addr, 0, 0, 0); ar724x_pci_fixup(dev, flash_addr, size); @@ -486,7 +489,6 @@ ar724x_pci_alloc_resource(device_t bus, } } - return (rv); }