12 #include <asm/sn/arch.h>
13 #include <asm/sn/intr.h>
20 static u32 emulate_ioc3_cfg(
int where,
int size)
22 if (size == 1 && where == 0x3d)
24 else if (size == 2 && where == 0x3c)
26 else if (size == 4 && where == 0x3c)
43 static int pci_conf0_read_config(
struct pci_bus *
bus,
unsigned int devfn,
82 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) {
83 *value = emulate_ioc3_cfg(where, size);
96 shift = ((where & 3) << 3);
97 mask = (0xffffffff
U >> ((4 -
size) << 3));
98 *value = (cf >> shift) & mask;
103 static int pci_conf1_read_config(
struct pci_bus *bus,
unsigned int devfn,
104 int where,
int size,
u32 * value)
115 bridge->
b_pci_cfg = (busno << 16) | (slot << 11);
127 bridge->
b_pci_cfg = (busno << 16) | (slot << 11);
128 addr = &bridge->
b_type1_cfg.
c[(fn << 8) | (where ^ (4 - size))];
145 if ((where >= 0x14 && where < 0x40) || (where >= 0x48)) {
146 *value = emulate_ioc3_cfg(where, size);
154 bridge->
b_pci_cfg = (busno << 16) | (slot << 11);
160 shift = ((where & 3) << 3);
161 mask = (0xffffffff
U >> ((4 -
size) << 3));
162 *value = (cf >> shift) & mask;
167 static int pci_read_config(
struct pci_bus *bus,
unsigned int devfn,
168 int where,
int size,
u32 * value)
171 return pci_conf1_read_config(bus, devfn, where, size, value);
173 return pci_conf0_read_config(bus, devfn, where, size, value);
176 static int pci_conf0_write_config(
struct pci_bus *bus,
unsigned int devfn,
177 int where,
int size,
u32 value)
202 }
else if (size == 2) {
219 if ((where >= 0x14 && where < 0x40) || (where >= 0x48))
231 shift = ((where & 3) << 3);
232 mask = (0xffffffff
U >> ((4 -
size) << 3));
233 smask = mask << shift;
235 cf = (cf & ~smask) | ((value & mask) << shift);
242 static int pci_conf1_write_config(
struct pci_bus *bus,
unsigned int devfn,
243 int where,
int size,
u32 value)
254 bridge->
b_pci_cfg = (busno << 16) | (slot << 11);
266 addr = &bridge->
b_type1_cfg.
c[(fn << 8) | (where ^ (4 - size))];
270 }
else if (size == 2) {
287 if ((where >= 0x14 && where < 0x40) || (where >= 0x48))
299 shift = ((where & 3) << 3);
300 mask = (0xffffffff
U >> ((4 -
size) << 3));
301 smask = mask << shift;
303 cf = (cf & ~smask) | ((value & mask) << shift);
310 static int pci_write_config(
struct pci_bus *bus,
unsigned int devfn,
311 int where,
int size,
u32 value)
314 return pci_conf1_write_config(bus, devfn, where, size, value);
316 return pci_conf0_write_config(bus, devfn, where, size, value);
320 .read = pci_read_config,
321 .write = pci_write_config,