pci.c (5c34202b8bf942da411b6599668a76b07449bbfd) pci.c (5516b540e98de6f7474a4e7149470ad6a0bbc54a)
1/*
2 * CHRP pci routines.
3 */
4
5#include <linux/kernel.h>
6#include <linux/pci.h>
7#include <linux/delay.h>
8#include <linux/string.h>

--- 85 unchanged lines hidden (view full) ---

94 * Access functions for PCI config space using RTAS calls.
95 */
96int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
97 int len, u32 *val)
98{
99 struct pci_controller *hose = bus->sysdata;
100 unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
101 | (((bus->number - hose->first_busno) & 0xff) << 16)
1/*
2 * CHRP pci routines.
3 */
4
5#include <linux/kernel.h>
6#include <linux/pci.h>
7#include <linux/delay.h>
8#include <linux/string.h>

--- 85 unchanged lines hidden (view full) ---

94 * Access functions for PCI config space using RTAS calls.
95 */
96int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
97 int len, u32 *val)
98{
99 struct pci_controller *hose = bus->sysdata;
100 unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
101 | (((bus->number - hose->first_busno) & 0xff) << 16)
102 | (hose->index << 24);
102 | (hose->global_number << 24);
103 int ret = -1;
104 int rval;
105
106 rval = rtas_call(rtas_token("read-pci-config"), 2, 2, &ret, addr, len);
107 *val = ret;
108 return rval? PCIBIOS_DEVICE_NOT_FOUND: PCIBIOS_SUCCESSFUL;
109}
110
111int rtas_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
112 int len, u32 val)
113{
114 struct pci_controller *hose = bus->sysdata;
115 unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
116 | (((bus->number - hose->first_busno) & 0xff) << 16)
103 int ret = -1;
104 int rval;
105
106 rval = rtas_call(rtas_token("read-pci-config"), 2, 2, &ret, addr, len);
107 *val = ret;
108 return rval? PCIBIOS_DEVICE_NOT_FOUND: PCIBIOS_SUCCESSFUL;
109}
110
111int rtas_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
112 int len, u32 val)
113{
114 struct pci_controller *hose = bus->sysdata;
115 unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
116 | (((bus->number - hose->first_busno) & 0xff) << 16)
117 | (hose->index << 24);
117 | (hose->global_number << 24);
118 int rval;
119
120 rval = rtas_call(rtas_token("write-pci-config"), 3, 1, NULL,
121 addr, len, val);
122 return rval? PCIBIOS_DEVICE_NOT_FOUND: PCIBIOS_SUCCESSFUL;
123}
124
125static struct pci_ops rtas_pci_ops =

--- 215 unchanged lines hidden ---
118 int rval;
119
120 rval = rtas_call(rtas_token("write-pci-config"), 3, 1, NULL,
121 addr, len, val);
122 return rval? PCIBIOS_DEVICE_NOT_FOUND: PCIBIOS_SUCCESSFUL;
123}
124
125static struct pci_ops rtas_pci_ops =

--- 215 unchanged lines hidden ---