Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Mar 2009 20:40:09 +0000 (UTC)
From:      Sam Leffler <sam@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r189456 - head/sys/arm/xscale/ixp425
Message-ID:  <200903062040.n26Ke9iZ028583@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sam
Date: Fri Mar  6 20:40:09 2009
New Revision: 189456
URL: http://svn.freebsd.org/changeset/base/189456

Log:
  o simplify code in ixppcib_conf_setup
  o fixup debug printfs

Modified:
  head/sys/arm/xscale/ixp425/ixp425_pci.c

Modified: head/sys/arm/xscale/ixp425/ixp425_pci.c
==============================================================================
--- head/sys/arm/xscale/ixp425/ixp425_pci.c	Fri Mar  6 20:17:16 2009	(r189455)
+++ head/sys/arm/xscale/ixp425/ixp425_pci.c	Fri Mar  6 20:40:09 2009	(r189456)
@@ -352,21 +352,15 @@ ixppcib_conf_setup(struct ixppcib_softc 
     int reg)
 {
 	if (bus == 0) {
-		if (slot == 0 && func == 0) {
-			PCI_CSR_WRITE_4(sc, PCI_NP_AD, (reg & ~3));
-		} else {
-			bus &= 0xff;
-			slot &= 0x1f;
-			func &= 0x07;
-			/* configuration type 0 */
-			PCI_CSR_WRITE_4(sc, PCI_NP_AD, (1U << (32 - slot)) |
-				(func << 8) | (reg & ~3));
-		}
+		/* configuration type 0 */
+		PCI_CSR_WRITE_4(sc, PCI_NP_AD,
+		    (1U << (32 - (slot & 0x1f))) |
+		    ((func & 0x7) << 8) | (reg & ~3));
 	} else {
-			/* configuration type 1 */
+		/* configuration type 1 */
 		PCI_CSR_WRITE_4(sc, PCI_NP_AD,
-			(bus << 16) | (slot << 11) |
-			(func << 8) | (reg & ~3) | 1);
+		    (bus << 16) | (slot << 11) |
+		    (func << 8) | (reg & ~3) | 1);
 	}
 
 }
@@ -392,9 +386,9 @@ ixppcib_read_config(device_t dev, u_int 
 	ret >>= (reg & 3) * 8;
 	ret &= 0xffffffff >> ((4 - bytes) * 8);
 #if 0
-	device_printf(dev, "read config: %u:%u:%u %#x(%d) = %#x\n", bus, slot, func, reg, bytes, ret);
+	device_printf(dev, "%s: %u:%u:%u %#x(%d) = %#x\n",
+	    __func__, bus, slot, func, reg, bytes, ret);
 #endif
-
 	/* check & clear PCI abort */
 	data = PCI_CSR_READ_4(sc, PCI_ISR);
 	if (data & ISR_PFE) {
@@ -414,9 +408,9 @@ ixppcib_write_config(device_t dev, u_int
 	u_int32_t data;
 
 #if 0
-	device_printf(dev, "write config: %u:%u:%u %#x(%d) = %#x\n", bus, slot, func, reg, bytes, val);
+	device_printf(dev, "%s: %u:%u:%u %#x(%d) = %#x\n",
+	    __func__, bus, slot, func, reg, bytes, val);
 #endif
-
 	ixppcib_conf_setup(sc, bus, slot, func, reg & ~3);
 
 	/* Byte enables are active low, so not them first */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903062040.n26Ke9iZ028583>