Lines 30-39
static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn)
Link Here
|
30 |
struct acpi_mcfg_allocation *cfg; |
30 |
struct acpi_mcfg_allocation *cfg; |
31 |
int cfg_num; |
31 |
int cfg_num; |
32 |
|
32 |
|
33 |
if (seg == 0 && bus < PCI_MMCFG_MAX_CHECK_BUS && |
|
|
34 |
test_bit(PCI_SLOT(devfn) + 32*bus, pci_mmcfg_fallback_slots)) |
35 |
return 0; |
36 |
|
37 |
for (cfg_num = 0; cfg_num < pci_mmcfg_config_num; cfg_num++) { |
33 |
for (cfg_num = 0; cfg_num < pci_mmcfg_config_num; cfg_num++) { |
38 |
cfg = &pci_mmcfg_config[cfg_num]; |
34 |
cfg = &pci_mmcfg_config[cfg_num]; |
39 |
if (cfg->pci_segment == seg && |
35 |
if (cfg->pci_segment == seg && |
Lines 68-80
static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
Link Here
|
68 |
u32 base; |
64 |
u32 base; |
69 |
|
65 |
|
70 |
if ((bus > 255) || (devfn > 255) || (reg > 4095)) { |
66 |
if ((bus > 255) || (devfn > 255) || (reg > 4095)) { |
71 |
*value = -1; |
67 |
err: *value = -1; |
72 |
return -EINVAL; |
68 |
return -EINVAL; |
73 |
} |
69 |
} |
74 |
|
70 |
|
|
|
71 |
if (reg < 256) |
72 |
return pci_conf1_read(seg,bus,devfn,reg,len,value); |
73 |
|
75 |
base = get_base_addr(seg, bus, devfn); |
74 |
base = get_base_addr(seg, bus, devfn); |
76 |
if (!base) |
75 |
if (!base) |
77 |
return pci_conf1_read(seg,bus,devfn,reg,len,value); |
76 |
goto err; |
78 |
|
77 |
|
79 |
spin_lock_irqsave(&pci_config_lock, flags); |
78 |
spin_lock_irqsave(&pci_config_lock, flags); |
80 |
|
79 |
|
Lines 105-113
static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
Link Here
|
105 |
if ((bus > 255) || (devfn > 255) || (reg > 4095)) |
104 |
if ((bus > 255) || (devfn > 255) || (reg > 4095)) |
106 |
return -EINVAL; |
105 |
return -EINVAL; |
107 |
|
106 |
|
|
|
107 |
if (reg < 256) |
108 |
return pci_conf1_write(seg,bus,devfn,reg,len,value); |
109 |
|
108 |
base = get_base_addr(seg, bus, devfn); |
110 |
base = get_base_addr(seg, bus, devfn); |
109 |
if (!base) |
111 |
if (!base) |
110 |
return pci_conf1_write(seg,bus,devfn,reg,len,value); |
112 |
return -EINVAL; |
111 |
|
113 |
|
112 |
spin_lock_irqsave(&pci_config_lock, flags); |
114 |
spin_lock_irqsave(&pci_config_lock, flags); |
113 |
|
115 |
|
Lines 134-145
static struct pci_raw_ops pci_mmcfg = {
Link Here
|
134 |
.write = pci_mmcfg_write, |
136 |
.write = pci_mmcfg_write, |
135 |
}; |
137 |
}; |
136 |
|
138 |
|
137 |
int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus, |
|
|
138 |
unsigned int devfn) |
139 |
{ |
140 |
return get_base_addr(seg, bus, devfn) != 0; |
141 |
} |
142 |
|
143 |
int __init pci_mmcfg_arch_init(void) |
139 |
int __init pci_mmcfg_arch_init(void) |
144 |
{ |
140 |
{ |
145 |
printk(KERN_INFO "PCI: Using MMCONFIG\n"); |
141 |
printk(KERN_INFO "PCI: Using MMCONFIG\n"); |