5 #include <linux/types.h>
7 #include <linux/string.h>
34 static int __cpuinit cmp_range(
const void *x1,
const void *x2)
40 start1 = r1->
start >> 32;
41 start2 = r2->
start >> 32;
43 return start1 - start2;
46 #define MMCONF_UNIT (1ULL << FAM10H_MMIO_CONF_BASE_SHIFT)
47 #define MMCONF_MASK (~(MMCONF_UNIT - 1))
48 #define MMCONF_SIZE (MMCONF_UNIT << 8)
50 #define FAM10H_PCI_MMCONF_BASE (0xfcULL<<32)
51 #define BASE_VALID(b) ((b) + MMCONF_SIZE <= (0xfdULL<<32) || (b) >= (1ULL<<40))
52 static void __cpuinit get_fam10h_pci_mmconf_base(
void)
65 struct range range[8];
68 if (fam10h_pci_mmconf_base)
80 bus = pci_probes[
i].bus;
81 slot = pci_probes[
i].slot;
85 device = (
id>>16) & 0xffff;
86 if (pci_probes[i].vendor == vendor &&
87 pci_probes[i].device == device) {
101 if (!(val & (1<<21))) {
106 rdmsrl(address, val);
107 tom2 =
max(val & 0xffffff800000ULL, 1ULL << 32);
118 for (i = 0; i < 8; i++) {
126 start = (
u64)(reg & 0xffffff00) << 8;
128 end = ((
u64)(reg & 0xffffff00) << 8) | 0xffff;
134 range[hi_mmio_num].
end =
end;
142 sort(range, hi_mmio_num,
sizeof(
struct range), cmp_range,
NULL);
144 if (range[hi_mmio_num - 1].
end < base)
157 for (i = 1; i < hi_mmio_num; i++) {
166 fam10h_pci_mmconf_base = base;
178 rdmsrl(address, val);
190 if (!fam10h_pci_mmconf_base) {
191 fam10h_pci_mmconf_base = base;
193 }
else if (fam10h_pci_mmconf_base == base)
202 get_fam10h_pci_mmconf_base();
203 if (!fam10h_pci_mmconf_base) {
204 pci_probe &= ~PCI_CHECK_ENABLE_AMD_MMCONF;
212 FAM10H_MMIO_CONF_ENABLE;
213 wrmsrl(address, val);
224 .callback = set_check_enable_amd_mmconf,
225 .ident =
"Sun Microsystems Machine",