Date: Sun, 15 Apr 2012 02:38:01 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r234306 - head/sys/mips/atheros Message-ID: <201204150238.q3F2c1Hh060784@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Sun Apr 15 02:38:01 2012 New Revision: 234306 URL: http://svn.freebsd.org/changeset/base/234306 Log: Fix the mask logic when reading PCI configuration space registers. Modified: head/sys/mips/atheros/ar71xx_pci.c Modified: head/sys/mips/atheros/ar71xx_pci.c ============================================================================== --- head/sys/mips/atheros/ar71xx_pci.c Sun Apr 15 01:40:22 2012 (r234305) +++ head/sys/mips/atheros/ar71xx_pci.c Sun Apr 15 02:38:01 2012 (r234306) @@ -204,8 +204,12 @@ ar71xx_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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204150238.q3F2c1Hh060784>