powerpc: eliminate DsaAddr from pci_dn
authorStephen Rothwell <sfr@canb.auug.org.au>
Fri, 14 Oct 2005 06:49:58 +0000 (16:49 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 14 Oct 2005 06:49:58 +0000 (16:49 +1000)
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
arch/powerpc/platforms/iseries/iommu.c
arch/powerpc/platforms/iseries/pci.c
arch/powerpc/platforms/iseries/pci.h
arch/powerpc/platforms/iseries/vpdinfo.c
include/asm-ppc64/iSeries/HvCallPci.h
include/asm-ppc64/pci-bridge.h

index 533d9b4674028d034727cd59da78b67046fc937f..1db26d8be64023aa24450a3dd5680aad2e757e89 100644 (file)
@@ -124,7 +124,7 @@ static void iommu_table_getparms(struct pci_dn *pdn,
 
        memset(parms, 0, sizeof(*parms));
 
-       parms->itc_busno = pdn->DsaAddr.Dsa.busNumber;
+       parms->itc_busno = pdn->busno;
        parms->itc_slotno = pdn->LogicalSlot;
        parms->itc_virtbus = 0;
 
index fe34d1175818f779a22d49fcfa780906c4263c2f..d14e9d9d77972e9991c7eaad11a12140472e2c51 100644 (file)
@@ -223,13 +223,8 @@ static struct device_node *build_device_node(HvBusNumber Bus,
        node->data = pdn;
        pdn->node = node;
        list_add_tail(&pdn->Device_List, &iSeries_Global_Device_List);
-#if 0
-       pdn->DsaAddr = ((u64)Bus << 48) + ((u64)SubBus << 40) + ((u64)0x10 << 32);
-#endif
-       pdn->DsaAddr.DsaAddr = 0;
-       pdn->DsaAddr.Dsa.busNumber = Bus;
-       pdn->DsaAddr.Dsa.subBusNumber = SubBus;
-       pdn->DsaAddr.Dsa.deviceId = 0x10;
+       pdn->busno = Bus;
+       pdn->bussubno = SubBus;
        pdn->devfn = PCI_DEVFN(ISERIES_ENCODE_DEVICE(AgentId), Function);
        return node;
 }
@@ -554,8 +549,7 @@ static struct device_node *find_Device_Node(int bus, int devfn)
        struct pci_dn *pdn;
 
        list_for_each_entry(pdn, &iSeries_Global_Device_List, Device_List) {
-               if ((bus == pdn->DsaAddr.Dsa.busNumber) &&
-                               (devfn == pdn->devfn))
+               if ((bus == pdn->busno) && (devfn == pdn->devfn))
                        return pdn->node;
        }
        return NULL;
@@ -612,7 +606,7 @@ static int iSeries_pci_read_config(struct pci_bus *bus, unsigned int devfn,
        }
 
        fn = hv_cfg_read_func[(size - 1) & 3];
-       HvCall3Ret16(fn, &ret, PCI_DN(node)->DsaAddr.DsaAddr, offset, 0);
+       HvCall3Ret16(fn, &ret, iseries_ds_addr(node), offset, 0);
 
        if (ret.rc != 0) {
                *val = ~0;
@@ -640,7 +634,7 @@ static int iSeries_pci_write_config(struct pci_bus *bus, unsigned int devfn,
                return PCIBIOS_BAD_REGISTER_NUMBER;
 
        fn = hv_cfg_write_func[(size - 1) & 3];
-       ret = HvCall4(fn, PCI_DN(node)->DsaAddr.DsaAddr, offset, val, 0);
+       ret = HvCall4(fn, iseries_ds_addr(node), offset, val, 0);
 
        if (ret != 0)
                return PCIBIOS_DEVICE_NOT_FOUND;
@@ -671,7 +665,7 @@ static int CheckReturnCode(char *TextHdr, struct device_node *DevNode,
                ++Pci_Error_Count;
                (*retry)++;
                printk("PCI: %s: Device 0x%04X:%02X  I/O Error(%2d): 0x%04X\n",
-                               TextHdr, pdn->DsaAddr.Dsa.busNumber, pdn->devfn,
+                               TextHdr, pdn->busno, pdn->devfn,
                                *retry, (int)ret);
                /*
                 * Bump the retry and check for retry count exceeded.
@@ -712,7 +706,7 @@ static inline struct device_node *xlate_iomm_address(
 
        if (DevNode != NULL) {
                int barnum = iobar_table[TableIndex];
-               *dsaptr = PCI_DN(DevNode)->DsaAddr.DsaAddr | (barnum << 24);
+               *dsaptr = iseries_ds_addr(DevNode) | (barnum << 24);
                *BarOffsetPtr = BaseIoAddr % IOMM_TABLE_ENTRY_SIZE;
        } else
                panic("PCI: Invalid PCI IoAddress detected!\n");
index 94b4bfdceadf5d54d727df5a2ae0a757b5f47849..33a8489fde54c636260781a944aa82b2549348e7 100644 (file)
@@ -30,6 +30,8 @@
  * End Change Activity
  */
 
+#include <asm/pci-bridge.h>
+
 struct pci_dev;                                /* For Forward Reference */
 
 /*
@@ -45,6 +47,17 @@ struct pci_dev;                              /* For Forward Reference */
 #define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus)         ((subbus >> 5) & 0x7)
 #define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus)       ((subbus >> 2) & 0x7)
 
+/*
+ * Generate a Direct Select Address for the Hypervisor
+ */
+static inline u64 iseries_ds_addr(struct device_node *node)
+{
+       struct pci_dn *pdn = PCI_DN(node);
+
+       return ((u64)pdn->busno << 48) + ((u64)pdn->bussubno << 40)
+                       + ((u64)0x10 << 32);
+}
+
 extern void    iSeries_Device_Information(struct pci_dev*, int);
 
 #endif /* _PLATFORMS_ISERIES_PCI_H */
index dcdac995565c5a90fab1024433a7beab554e34c4..a03984e19c13023b18f65c79c6977dc3657ea618 100644 (file)
@@ -258,8 +258,8 @@ void __init iSeries_Device_Information(struct pci_dev *PciDev, int count)
        }
 
        pdn = PCI_DN(DevNode);
-       bus = pdn->DsaAddr.Dsa.busNumber;
-       subbus = pdn->DsaAddr.Dsa.subBusNumber;
+       bus = pdn->busno;
+       subbus = pdn->bussubno;
        agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus),
                        ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus));
        iSeries_Get_Location_Code(bus, agent, &frame, card);
index c8d675c40f5efcde0e41a95684ac79a630b328e2..17b4840b64b28fc38472a7cc5b0b6e96a4d91850 100644 (file)
@@ -126,25 +126,6 @@ enum HvCallPci_VpdType {
 #define HvCallPciUnmaskInterrupts      HvCallPci + 49
 #define HvCallPciGetBusUnitInfo                HvCallPci + 50
 
-static inline u64 HvCallPci_configLoad8(u16 busNumber, u8 subBusNumber,
-               u8 deviceId, u32 offset, u8 *value)
-{
-       struct HvCallPci_DsaAddr dsa;
-       struct HvCallPci_LoadReturn retVal;
-
-       *((u64*)&dsa) = 0;
-
-       dsa.busNumber = busNumber;
-       dsa.subBusNumber = subBusNumber;
-       dsa.deviceId = deviceId;
-
-       HvCall3Ret16(HvCallPciConfigLoad8, &retVal, *(u64 *)&dsa, offset, 0);
-
-       *value = retVal.value;
-
-       return retVal.rc;
-}
-
 static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber,
                u8 deviceId, u32 offset, u16 *value)
 {
@@ -164,25 +145,6 @@ static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber,
        return retVal.rc;
 }
 
-static inline u64 HvCallPci_configLoad32(u16 busNumber, u8 subBusNumber,
-               u8 deviceId, u32 offset, u32 *value)
-{
-       struct HvCallPci_DsaAddr dsa;
-       struct HvCallPci_LoadReturn retVal;
-
-       *((u64*)&dsa) = 0;
-
-       dsa.busNumber = busNumber;
-       dsa.subBusNumber = subBusNumber;
-       dsa.deviceId = deviceId;
-
-       HvCall3Ret16(HvCallPciConfigLoad32, &retVal, *(u64 *)&dsa, offset, 0);
-
-       *value = retVal.value;
-
-       return retVal.rc;
-}
-
 static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber,
                u8 deviceId, u32 offset, u8 value)
 {
@@ -197,186 +159,6 @@ static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber,
        return HvCall4(HvCallPciConfigStore8, *(u64 *)&dsa, offset, value, 0);
 }
 
-static inline u64 HvCallPci_configStore16(u16 busNumber, u8 subBusNumber,
-               u8 deviceId, u32 offset, u16 value)
-{
-       struct HvCallPci_DsaAddr dsa;
-
-       *((u64*)&dsa) = 0;
-
-       dsa.busNumber = busNumber;
-       dsa.subBusNumber = subBusNumber;
-       dsa.deviceId = deviceId;
-
-       return HvCall4(HvCallPciConfigStore16, *(u64 *)&dsa, offset, value, 0);
-}
-
-static inline u64 HvCallPci_configStore32(u16 busNumber, u8 subBusNumber,
-               u8 deviceId, u32 offset, u32 value)
-{
-       struct HvCallPci_DsaAddr dsa;
-
-       *((u64*)&dsa) = 0;
-
-       dsa.busNumber = busNumber;
-       dsa.subBusNumber = subBusNumber;
-       dsa.deviceId = deviceId;
-
-       return HvCall4(HvCallPciConfigStore32, *(u64 *)&dsa, offset, value, 0);
-}
-
-static inline u64 HvCallPci_barLoad8(u16 busNumberParm, u8 subBusParm,
-               u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
-               u8 *valueParm)
-{
-       struct HvCallPci_DsaAddr dsa;
-       struct HvCallPci_LoadReturn retVal;
-
-       *((u64*)&dsa) = 0;
-
-       dsa.busNumber = busNumberParm;
-       dsa.subBusNumber = subBusParm;
-       dsa.deviceId = deviceIdParm;
-       dsa.barNumber = barNumberParm;
-
-       HvCall3Ret16(HvCallPciBarLoad8, &retVal, *(u64 *)&dsa, offsetParm, 0);
-
-       *valueParm = retVal.value;
-
-       return retVal.rc;
-}
-
-static inline u64 HvCallPci_barLoad16(u16 busNumberParm, u8 subBusParm,
-               u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
-               u16 *valueParm)
-{
-       struct HvCallPci_DsaAddr dsa;
-       struct HvCallPci_LoadReturn retVal;
-
-       *((u64*)&dsa) = 0;
-
-       dsa.busNumber = busNumberParm;
-       dsa.subBusNumber = subBusParm;
-       dsa.deviceId = deviceIdParm;
-       dsa.barNumber = barNumberParm;
-
-       HvCall3Ret16(HvCallPciBarLoad16, &retVal, *(u64 *)&dsa, offsetParm, 0);
-
-       *valueParm = retVal.value;
-
-       return retVal.rc;
-}
-
-static inline u64 HvCallPci_barLoad32(u16 busNumberParm, u8 subBusParm,
-               u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
-               u32 *valueParm)
-{
-       struct HvCallPci_DsaAddr dsa;
-       struct HvCallPci_LoadReturn retVal;
-
-       *((u64*)&dsa) = 0;
-
-       dsa.busNumber = busNumberParm;
-       dsa.subBusNumber = subBusParm;
-       dsa.deviceId = deviceIdParm;
-       dsa.barNumber = barNumberParm;
-
-       HvCall3Ret16(HvCallPciBarLoad32, &retVal, *(u64 *)&dsa, offsetParm, 0);
-
-       *valueParm = retVal.value;
-
-       return retVal.rc;
-}
-
-static inline u64 HvCallPci_barLoad64(u16 busNumberParm, u8 subBusParm,
-               u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
-               u64 *valueParm)
-{
-       struct HvCallPci_DsaAddr dsa;
-       struct HvCallPci_LoadReturn retVal;
-
-       *((u64*)&dsa) = 0;
-
-       dsa.busNumber = busNumberParm;
-       dsa.subBusNumber = subBusParm;
-       dsa.deviceId = deviceIdParm;
-       dsa.barNumber = barNumberParm;
-
-       HvCall3Ret16(HvCallPciBarLoad64, &retVal, *(u64 *)&dsa, offsetParm, 0);
-
-       *valueParm = retVal.value;
-
-       return retVal.rc;
-}
-
-static inline u64 HvCallPci_barStore8(u16 busNumberParm, u8 subBusParm,
-               u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
-               u8 valueParm)
-{
-       struct HvCallPci_DsaAddr dsa;
-
-       *((u64*)&dsa) = 0;
-
-       dsa.busNumber = busNumberParm;
-       dsa.subBusNumber = subBusParm;
-       dsa.deviceId = deviceIdParm;
-       dsa.barNumber = barNumberParm;
-
-       return HvCall4(HvCallPciBarStore8, *(u64 *)&dsa, offsetParm,
-                       valueParm, 0);
-}
-
-static inline u64 HvCallPci_barStore16(u16 busNumberParm, u8 subBusParm,
-               u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
-               u16 valueParm)
-{
-       struct HvCallPci_DsaAddr dsa;
-
-       *((u64*)&dsa) = 0;
-
-       dsa.busNumber = busNumberParm;
-       dsa.subBusNumber = subBusParm;
-       dsa.deviceId = deviceIdParm;
-       dsa.barNumber = barNumberParm;
-
-       return HvCall4(HvCallPciBarStore16, *(u64 *)&dsa, offsetParm,
-                       valueParm, 0);
-}
-
-static inline u64 HvCallPci_barStore32(u16 busNumberParm, u8 subBusParm,
-               u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
-               u32 valueParm)
-{
-       struct HvCallPci_DsaAddr dsa;
-
-       *((u64*)&dsa) = 0;
-
-       dsa.busNumber = busNumberParm;
-       dsa.subBusNumber = subBusParm;
-       dsa.deviceId = deviceIdParm;
-       dsa.barNumber = barNumberParm;
-
-       return HvCall4(HvCallPciBarStore32, *(u64 *)&dsa, offsetParm,
-                       valueParm, 0);
-}
-
-static inline u64 HvCallPci_barStore64(u16 busNumberParm, u8 subBusParm,
-               u8 deviceIdParm, u8 barNumberParm, u64 offsetParm,
-               u64 valueParm)
-{
-       struct HvCallPci_DsaAddr dsa;
-
-       *((u64*)&dsa) = 0;
-
-       dsa.busNumber = busNumberParm;
-       dsa.subBusNumber = subBusParm;
-       dsa.deviceId = deviceIdParm;
-       dsa.barNumber = barNumberParm;
-
-       return HvCall4(HvCallPciBarStore64, *(u64 *)&dsa, offsetParm,
-                       valueParm, 0);
-}
-
 static inline u64 HvCallPci_eoi(u16 busNumberParm, u8 subBusParm,
                u8 deviceIdParm)
 {
@@ -437,20 +219,6 @@ static inline u64 HvCallPci_unmaskFisr(u16 busNumberParm, u8 subBusParm,
        return HvCall2(HvCallPciUnmaskFisr, *(u64*)&dsa, fisrMask);
 }
 
-static inline u64 HvCallPci_setSlotReset(u16 busNumberParm, u8 subBusParm,
-               u8 deviceIdParm, u64 onNotOff)
-{
-       struct HvCallPci_DsaAddr dsa;
-
-       *((u64*)&dsa) = 0;
-
-       dsa.busNumber = busNumberParm;
-       dsa.subBusNumber = subBusParm;
-       dsa.deviceId = deviceIdParm;
-
-       return HvCall2(HvCallPciSetSlotReset, *(u64*)&dsa, onNotOff);
-}
-
 static inline u64 HvCallPci_getDeviceInfo(u16 busNumberParm, u8 subBusParm,
                u8 deviceNumberParm, u64 parms, u32 sizeofParms)
 {
@@ -519,15 +287,4 @@ static inline int HvCallPci_getBusVpd(u16 busNumParm, u64 destParm,
                return xRc & 0xFFFF;
 }
 
-static inline int HvCallPci_getBusAdapterVpd(u16 busNumParm, u64 destParm,
-               u16 sizeParm)
-{
-       u64 xRc = HvCall4(HvCallPciGetCardVpd, busNumParm, destParm,
-                       sizeParm, HvCallPci_BusAdapterVpd);
-       if (xRc == -1)
-               return -1;
-       else
-               return xRc & 0xFFFF;
-}
-
 #endif /* _HVCALLPCI_H */
index 01bffca61f8935a58aed5cc898a2fc2a79111c9b..0474bdbf556c3cc4ecb8b06018ffbd680f2a0691 100644 (file)
@@ -77,9 +77,6 @@ struct pci_dn {
        struct  device_node *node;      /* back-pointer to the device_node */
 #ifdef CONFIG_PPC_ISERIES
        struct  list_head Device_List;
-       union HvDsaMap  DsaAddr;        /* Direct Select Address */
-                                       /* busNumber, subBusNumber, */
-                                       /* deviceId, barNumber */
        int             Irq;            /* Assigned IRQ */
        int             Flags;          /* Possible flags(disable/bist)*/
        u8              LogicalSlot;    /* Hv Slot Index for Tces */