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 */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to