[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / arch / mips / pci / ops-mace.c
blob8008e31c5e81ce3ff17adac4aef6c98655c9182b
1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
6 * Copyright (C) 2000, 2001 Keith M Wesolowski
7 */
8 #include <linux/kernel.h>
9 #include <linux/init.h>
10 #include <linux/pci.h>
11 #include <linux/types.h>
12 #include <asm/pci.h>
13 #include <asm/ip32/mace.h>
15 #if 0
16 # define DPRINTK(args...) printk(args);
17 #else
18 # define DPRINTK(args...)
19 #endif
22 * O2 has up to 5 PCI devices connected into the MACE bridge. The device
23 * map looks like this:
25 * 0 aic7xxx 0
26 * 1 aic7xxx 1
27 * 2 expansion slot
28 * 3 N/C
29 * 4 N/C
32 #define chkslot(_bus,_devfn) \
33 do { \
34 if ((_bus)->number > 0 || PCI_SLOT (_devfn) < 1 \
35 || PCI_SLOT (_devfn) > 3) \
36 return PCIBIOS_DEVICE_NOT_FOUND; \
37 } while (0)
39 #define mkaddr(_devfn, _reg) \
40 ((((_devfn) & 0xffUL) << 8) | ((_reg) & 0xfcUL))
42 static int
43 mace_pci_read_config(struct pci_bus *bus, unsigned int devfn,
44 int reg, int size, u32 *val)
46 chkslot(bus, devfn);
47 mace->pci.config_addr = mkaddr(devfn, reg);
48 switch (size) {
49 case 1:
50 *val = mace->pci.config_data.b[(reg & 3) ^ 3];
51 break;
52 case 2:
53 *val = mace->pci.config_data.w[((reg >> 1) & 1) ^ 1];
54 break;
55 case 4:
56 *val = mace->pci.config_data.l;
57 break;
60 DPRINTK("read%d: reg=%08x,val=%02x\n", size * 8, reg, *val);
62 return PCIBIOS_SUCCESSFUL;
65 static int
66 mace_pci_write_config(struct pci_bus *bus, unsigned int devfn,
67 int reg, int size, u32 val)
69 chkslot(bus, devfn);
70 mace->pci.config_addr = mkaddr(devfn, reg);
71 switch (size) {
72 case 1:
73 mace->pci.config_data.b[(reg & 3) ^ 3] = val;
74 break;
75 case 2:
76 mace->pci.config_data.w[((reg >> 1) & 1) ^ 1] = val;
77 break;
78 case 4:
79 mace->pci.config_data.l = val;
80 break;
83 DPRINTK("write%d: reg=%08x,val=%02x\n", size * 8, reg, val);
85 return PCIBIOS_SUCCESSFUL;
88 struct pci_ops mace_pci_ops = {
89 .read = mace_pci_read_config,
90 .write = mace_pci_write_config,