svn commit: r234306 - head/sys/mips/atheros
Adrian Chadd
adrian at FreeBSD.org
Sun Apr 15 02:38:02 UTC 2012
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;
More information about the svn-src-head
mailing list