summaryrefslogtreecommitdiff
path: root/arch/sparc64/kernel/pci_sun4v.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-02-10 09:20:01 +0300
committerDavid S. Miller <davem@sunset.davemloft.net>2006-03-20 12:12:12 +0300
commit7eae642f75e0f7fbce7c37b2dfe0641ff1e9ebfd (patch)
treebc308c82a5670163470b44b6f339d1b379a97347 /arch/sparc64/kernel/pci_sun4v.c
parentbade5622167181844cd4e60087971c1f949e149f (diff)
downloadlinux-7eae642f75e0f7fbce7c37b2dfe0641ff1e9ebfd.tar.xz
[SPARC64]: Implement SUN4V PCI config space access.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/pci_sun4v.c')
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index 1d61353e2644..abd9bfb245cb 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -74,15 +74,47 @@ struct pci_iommu_ops pci_sun4v_iommu_ops = {
static int pci_sun4v_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
int where, int size, u32 *value)
{
- /* XXX Implement me! XXX */
- return 0;
+ struct pci_pbm_info *pbm = bus_dev->sysdata;
+ unsigned long devhandle = pbm->devhandle;
+ unsigned int bus = bus_dev->number;
+ unsigned int device = PCI_SLOT(devfn);
+ unsigned int func = PCI_FUNC(devfn);
+ unsigned long ret;
+
+ ret = pci_sun4v_config_get(devhandle,
+ HV_PCI_DEVICE_BUILD(bus, device, func),
+ where, size);
+ switch (size) {
+ case 1:
+ *value = ret & 0xff;
+ break;
+ case 2:
+ *value = ret & 0xffff;
+ break;
+ case 4:
+ *value = ret & 0xffffffff;
+ break;
+ };
+
+
+ return PCIBIOS_SUCCESSFUL;
}
static int pci_sun4v_write_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
int where, int size, u32 value)
{
- /* XXX Implement me! XXX */
- return 0;
+ struct pci_pbm_info *pbm = bus_dev->sysdata;
+ unsigned long devhandle = pbm->devhandle;
+ unsigned int bus = bus_dev->number;
+ unsigned int device = PCI_SLOT(devfn);
+ unsigned int func = PCI_FUNC(devfn);
+ unsigned long ret;
+
+ ret = pci_sun4v_config_put(devhandle,
+ HV_PCI_DEVICE_BUILD(bus, device, func),
+ where, size, value);
+
+ return PCIBIOS_SUCCESSFUL;
}
static struct pci_ops pci_sun4v_ops = {