21 #include <linux/sched.h>
22 #include <linux/pci.h>
28 #include <asm/segment.h>
32 #include <asm/hw_irq.h>
35 #define PCIE_CAP_OFFSET 0x100
38 #define PCIE_VNDR_CAP_ID_FIXED_BAR 0x00
39 #define PCI_FIXED_BAR_0_SIZE 0x04
40 #define PCI_FIXED_BAR_1_SIZE 0x08
41 #define PCI_FIXED_BAR_2_SIZE 0x0c
42 #define PCI_FIXED_BAR_3_SIZE 0x10
43 #define PCI_FIXED_BAR_4_SIZE 0x14
44 #define PCI_FIXED_BAR_5_SIZE 0x1c
46 static int pci_soc_mode = 0;
59 u32 pcie_cap = 0, cap_data;
68 devfn, pos, 4, &pcie_cap))
77 devfn, pos + 4, 4, &cap_data);
88 static int pci_device_update_fixed(
struct pci_bus *
bus,
unsigned int devfn,
98 if (val == ~0 && len == 4) {
102 offset + 8 + (bar * 4), 4, &size);
107 decode |= decode >> 1;
108 decode |= decode >> 2;
109 decode |= decode >> 4;
110 decode |= decode >> 8;
111 decode |= decode >> 16;
113 decode = ~(decode - 1);
142 static bool type1_access_ok(
unsigned int bus,
unsigned int devfn,
int reg)
153 if (bus == 0 && (devfn ==
PCI_DEVFN(2, 0)
160 static int pci_read(
struct pci_bus *bus,
unsigned int devfn,
int where,
163 if (type1_access_ok(bus->
number, devfn, where))
165 devfn, where, size, value);
167 devfn, where, size, value);
170 static int pci_write(
struct pci_bus *bus,
unsigned int devfn,
int where,
187 offset = fixed_bar_cap(bus, devfn);
190 return pci_device_update_fixed(bus, devfn, where, size, value,
199 if (type1_access_ok(bus->
number, devfn, where))
201 devfn, where, size, value);
206 static int mrst_pci_irq_enable(
struct pci_dev *
dev)
217 irq_attr.ioapic_pin = dev->
irq;
218 irq_attr.trigger = 1;
219 irq_attr.polarity = 1;
292 offset = fixed_bar_cap(dev->
bus, dev->
devfn);
298 pci_read_config_dword(dev, offset + 8 + (i * 4), &size);