Commit 20f48ccf authored by Stephen Rothwell's avatar Stephen Rothwell

powerpc: eliminate DsaAddr from pci_dn

Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
parent bffa8fc3
...@@ -124,7 +124,7 @@ static void iommu_table_getparms(struct pci_dn *pdn, ...@@ -124,7 +124,7 @@ static void iommu_table_getparms(struct pci_dn *pdn,
memset(parms, 0, sizeof(*parms)); memset(parms, 0, sizeof(*parms));
parms->itc_busno = pdn->DsaAddr.Dsa.busNumber; parms->itc_busno = pdn->busno;
parms->itc_slotno = pdn->LogicalSlot; parms->itc_slotno = pdn->LogicalSlot;
parms->itc_virtbus = 0; parms->itc_virtbus = 0;
......
...@@ -223,13 +223,8 @@ static struct device_node *build_device_node(HvBusNumber Bus, ...@@ -223,13 +223,8 @@ static struct device_node *build_device_node(HvBusNumber Bus,
node->data = pdn; node->data = pdn;
pdn->node = node; pdn->node = node;
list_add_tail(&pdn->Device_List, &iSeries_Global_Device_List); list_add_tail(&pdn->Device_List, &iSeries_Global_Device_List);
#if 0 pdn->busno = Bus;
pdn->DsaAddr = ((u64)Bus << 48) + ((u64)SubBus << 40) + ((u64)0x10 << 32); pdn->bussubno = SubBus;
#endif
pdn->DsaAddr.DsaAddr = 0;
pdn->DsaAddr.Dsa.busNumber = Bus;
pdn->DsaAddr.Dsa.subBusNumber = SubBus;
pdn->DsaAddr.Dsa.deviceId = 0x10;
pdn->devfn = PCI_DEVFN(ISERIES_ENCODE_DEVICE(AgentId), Function); pdn->devfn = PCI_DEVFN(ISERIES_ENCODE_DEVICE(AgentId), Function);
return node; return node;
} }
...@@ -554,8 +549,7 @@ static struct device_node *find_Device_Node(int bus, int devfn) ...@@ -554,8 +549,7 @@ static struct device_node *find_Device_Node(int bus, int devfn)
struct pci_dn *pdn; struct pci_dn *pdn;
list_for_each_entry(pdn, &iSeries_Global_Device_List, Device_List) { list_for_each_entry(pdn, &iSeries_Global_Device_List, Device_List) {
if ((bus == pdn->DsaAddr.Dsa.busNumber) && if ((bus == pdn->busno) && (devfn == pdn->devfn))
(devfn == pdn->devfn))
return pdn->node; return pdn->node;
} }
return NULL; return NULL;
...@@ -612,7 +606,7 @@ static int iSeries_pci_read_config(struct pci_bus *bus, unsigned int devfn, ...@@ -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]; 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) { if (ret.rc != 0) {
*val = ~0; *val = ~0;
...@@ -640,7 +634,7 @@ static int iSeries_pci_write_config(struct pci_bus *bus, unsigned int devfn, ...@@ -640,7 +634,7 @@ static int iSeries_pci_write_config(struct pci_bus *bus, unsigned int devfn,
return PCIBIOS_BAD_REGISTER_NUMBER; return PCIBIOS_BAD_REGISTER_NUMBER;
fn = hv_cfg_write_func[(size - 1) & 3]; 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) if (ret != 0)
return PCIBIOS_DEVICE_NOT_FOUND; return PCIBIOS_DEVICE_NOT_FOUND;
...@@ -671,7 +665,7 @@ static int CheckReturnCode(char *TextHdr, struct device_node *DevNode, ...@@ -671,7 +665,7 @@ static int CheckReturnCode(char *TextHdr, struct device_node *DevNode,
++Pci_Error_Count; ++Pci_Error_Count;
(*retry)++; (*retry)++;
printk("PCI: %s: Device 0x%04X:%02X I/O Error(%2d): 0x%04X\n", 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); *retry, (int)ret);
/* /*
* Bump the retry and check for retry count exceeded. * Bump the retry and check for retry count exceeded.
...@@ -712,7 +706,7 @@ static inline struct device_node *xlate_iomm_address( ...@@ -712,7 +706,7 @@ static inline struct device_node *xlate_iomm_address(
if (DevNode != NULL) { if (DevNode != NULL) {
int barnum = iobar_table[TableIndex]; 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; *BarOffsetPtr = BaseIoAddr % IOMM_TABLE_ENTRY_SIZE;
} else } else
panic("PCI: Invalid PCI IoAddress detected!\n"); panic("PCI: Invalid PCI IoAddress detected!\n");
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
* End Change Activity * End Change Activity
*/ */
#include <asm/pci-bridge.h>
struct pci_dev; /* For Forward Reference */ struct pci_dev; /* For Forward Reference */
/* /*
...@@ -45,6 +47,17 @@ 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_DEVICE_FROM_SUBBUS(subbus) ((subbus >> 5) & 0x7)
#define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus) ((subbus >> 2) & 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); extern void iSeries_Device_Information(struct pci_dev*, int);
#endif /* _PLATFORMS_ISERIES_PCI_H */ #endif /* _PLATFORMS_ISERIES_PCI_H */
...@@ -258,8 +258,8 @@ void __init iSeries_Device_Information(struct pci_dev *PciDev, int count) ...@@ -258,8 +258,8 @@ void __init iSeries_Device_Information(struct pci_dev *PciDev, int count)
} }
pdn = PCI_DN(DevNode); pdn = PCI_DN(DevNode);
bus = pdn->DsaAddr.Dsa.busNumber; bus = pdn->busno;
subbus = pdn->DsaAddr.Dsa.subBusNumber; subbus = pdn->bussubno;
agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus), agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus),
ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus)); ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus));
iSeries_Get_Location_Code(bus, agent, &frame, card); iSeries_Get_Location_Code(bus, agent, &frame, card);
......
...@@ -126,25 +126,6 @@ enum HvCallPci_VpdType { ...@@ -126,25 +126,6 @@ enum HvCallPci_VpdType {
#define HvCallPciUnmaskInterrupts HvCallPci + 49 #define HvCallPciUnmaskInterrupts HvCallPci + 49
#define HvCallPciGetBusUnitInfo HvCallPci + 50 #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, static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber,
u8 deviceId, u32 offset, u16 *value) u8 deviceId, u32 offset, u16 *value)
{ {
...@@ -164,25 +145,6 @@ static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber, ...@@ -164,25 +145,6 @@ static inline u64 HvCallPci_configLoad16(u16 busNumber, u8 subBusNumber,
return retVal.rc; 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, static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber,
u8 deviceId, u32 offset, u8 value) u8 deviceId, u32 offset, u8 value)
{ {
...@@ -197,186 +159,6 @@ static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber, ...@@ -197,186 +159,6 @@ static inline u64 HvCallPci_configStore8(u16 busNumber, u8 subBusNumber,
return HvCall4(HvCallPciConfigStore8, *(u64 *)&dsa, offset, value, 0); 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, static inline u64 HvCallPci_eoi(u16 busNumberParm, u8 subBusParm,
u8 deviceIdParm) u8 deviceIdParm)
{ {
...@@ -437,20 +219,6 @@ static inline u64 HvCallPci_unmaskFisr(u16 busNumberParm, u8 subBusParm, ...@@ -437,20 +219,6 @@ static inline u64 HvCallPci_unmaskFisr(u16 busNumberParm, u8 subBusParm,
return HvCall2(HvCallPciUnmaskFisr, *(u64*)&dsa, fisrMask); 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, static inline u64 HvCallPci_getDeviceInfo(u16 busNumberParm, u8 subBusParm,
u8 deviceNumberParm, u64 parms, u32 sizeofParms) u8 deviceNumberParm, u64 parms, u32 sizeofParms)
{ {
...@@ -519,15 +287,4 @@ static inline int HvCallPci_getBusVpd(u16 busNumParm, u64 destParm, ...@@ -519,15 +287,4 @@ static inline int HvCallPci_getBusVpd(u16 busNumParm, u64 destParm,
return xRc & 0xFFFF; 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 */ #endif /* _HVCALLPCI_H */
...@@ -77,9 +77,6 @@ struct pci_dn { ...@@ -77,9 +77,6 @@ struct pci_dn {
struct device_node *node; /* back-pointer to the device_node */ struct device_node *node; /* back-pointer to the device_node */
#ifdef CONFIG_PPC_ISERIES #ifdef CONFIG_PPC_ISERIES
struct list_head Device_List; struct list_head Device_List;
union HvDsaMap DsaAddr; /* Direct Select Address */
/* busNumber, subBusNumber, */
/* deviceId, barNumber */
int Irq; /* Assigned IRQ */ int Irq; /* Assigned IRQ */
int Flags; /* Possible flags(disable/bist)*/ int Flags; /* Possible flags(disable/bist)*/
u8 LogicalSlot; /* Hv Slot Index for Tces */ u8 LogicalSlot; /* Hv Slot Index for Tces */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment