diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-02-10 01:20:01 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-03-20 04:12:12 -0500 |
commit | 7eae642f75e0f7fbce7c37b2dfe0641ff1e9ebfd (patch) | |
tree | bc308c82a5670163470b44b6f339d1b379a97347 /arch/sparc64/kernel/pci_sun4v.c | |
parent | bade5622167181844cd4e60087971c1f949e149f (diff) |
[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.c | 40 |
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 = { | |||
74 | static int pci_sun4v_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn, | 74 | static int pci_sun4v_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn, |
75 | int where, int size, u32 *value) | 75 | int where, int size, u32 *value) |
76 | { | 76 | { |
77 | /* XXX Implement me! XXX */ | 77 | struct pci_pbm_info *pbm = bus_dev->sysdata; |
78 | return 0; | 78 | unsigned long devhandle = pbm->devhandle; |
79 | unsigned int bus = bus_dev->number; | ||
80 | unsigned int device = PCI_SLOT(devfn); | ||
81 | unsigned int func = PCI_FUNC(devfn); | ||
82 | unsigned long ret; | ||
83 | |||
84 | ret = pci_sun4v_config_get(devhandle, | ||
85 | HV_PCI_DEVICE_BUILD(bus, device, func), | ||
86 | where, size); | ||
87 | switch (size) { | ||
88 | case 1: | ||
89 | *value = ret & 0xff; | ||
90 | break; | ||
91 | case 2: | ||
92 | *value = ret & 0xffff; | ||
93 | break; | ||
94 | case 4: | ||
95 | *value = ret & 0xffffffff; | ||
96 | break; | ||
97 | }; | ||
98 | |||
99 | |||
100 | return PCIBIOS_SUCCESSFUL; | ||
79 | } | 101 | } |
80 | 102 | ||
81 | static int pci_sun4v_write_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn, | 103 | static int pci_sun4v_write_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn, |
82 | int where, int size, u32 value) | 104 | int where, int size, u32 value) |
83 | { | 105 | { |
84 | /* XXX Implement me! XXX */ | 106 | struct pci_pbm_info *pbm = bus_dev->sysdata; |
85 | return 0; | 107 | unsigned long devhandle = pbm->devhandle; |
108 | unsigned int bus = bus_dev->number; | ||
109 | unsigned int device = PCI_SLOT(devfn); | ||
110 | unsigned int func = PCI_FUNC(devfn); | ||
111 | unsigned long ret; | ||
112 | |||
113 | ret = pci_sun4v_config_put(devhandle, | ||
114 | HV_PCI_DEVICE_BUILD(bus, device, func), | ||
115 | where, size, value); | ||
116 | |||
117 | return PCIBIOS_SUCCESSFUL; | ||
86 | } | 118 | } |
87 | 119 | ||
88 | static struct pci_ops pci_sun4v_ops = { | 120 | static struct pci_ops pci_sun4v_ops = { |