svn commit: r272237 - head/sys/mips/atheros

Adrian Chadd adrian at FreeBSD.org
Sun Sep 28 05:28:12 UTC 2014


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);
 }
 


More information about the svn-src-head mailing list