]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - arch/sparc64/kernel/psycho_common.h
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
[mv-sheeva.git] / arch / sparc64 / kernel / psycho_common.h
index b53aa8dcad2c2d80c82fa6ece093ad13cc35c19c..092c278ef28dce5e575daa94723e3e8bd807f758 100644 (file)
@@ -1,6 +1,31 @@
 #ifndef _PSYCHO_COMMON_H
 #define _PSYCHO_COMMON_H
 
+/* U2P Programmer's Manual, page 13-55, configuration space
+ * address format:
+ * 
+ *  32             24 23 16 15    11 10       8 7   2  1 0
+ * ---------------------------------------------------------
+ * |0 0 0 0 0 0 0 0 1| bus | device | function | reg | 0 0 |
+ * ---------------------------------------------------------
+ */
+#define PSYCHO_CONFIG_BASE(PBM)        \
+       ((PBM)->config_space | (1UL << 24))
+#define PSYCHO_CONFIG_ENCODE(BUS, DEVFN, REG)  \
+       (((unsigned long)(BUS)   << 16) |       \
+        ((unsigned long)(DEVFN) << 8)  |       \
+        ((unsigned long)(REG)))
+
+static inline void *psycho_pci_config_mkaddr(struct pci_pbm_info *pbm,
+                                            unsigned char bus,
+                                            unsigned int devfn,
+                                            int where)
+{
+       return (void *)
+               (PSYCHO_CONFIG_BASE(pbm) |
+                PSYCHO_CONFIG_ENCODE(bus, devfn, where));
+}
+
 enum psycho_error_type {
        UE_ERR, CE_ERR, PCI_ERR
 };