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,
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;
......
......@@ -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");
......
......@@ -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 */
......@@ -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);
......
......@@ -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 */
......@@ -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 */
......
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