13
13
static u32 *flush_words;
15
struct pci_device_id amd_nb_misc_ids[] = {
15
const struct pci_device_id amd_nb_misc_ids[] = {
16
16
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) },
17
17
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) },
18
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_MISC) },
18
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F3) },
21
21
EXPORT_SYMBOL(amd_nb_misc_ids);
23
static struct pci_device_id amd_nb_link_ids[] = {
24
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
23
28
const struct amd_nb_bus_dev_range amd_nb_bus_dev_ranges[] __initconst = {
24
29
{ 0x00, 0x18, 0x20 },
25
30
{ 0xff, 0x00, 0x20 },
64
69
amd_northbridges.nb = nb;
65
70
amd_northbridges.num = i;
68
73
for (i = 0; i != amd_nb_num(); i++) {
69
74
node_to_amd_nb(i)->misc = misc =
70
75
next_northbridge(misc, amd_nb_misc_ids);
76
node_to_amd_nb(i)->link = link =
77
next_northbridge(link, amd_nb_link_ids);
73
80
/* some CPU families (e.g. family 0x11) do not support GART */
85
92
boot_cpu_data.x86_mask >= 0x1))
86
93
amd_northbridges.flags |= AMD_NB_L3_INDEX_DISABLE;
95
if (boot_cpu_data.x86 == 0x15)
96
amd_northbridges.flags |= AMD_NB_L3_INDEX_DISABLE;
98
/* L3 cache partitioning is supported on family 0x15 */
99
if (boot_cpu_data.x86 == 0x15)
100
amd_northbridges.flags |= AMD_NB_L3_PARTITIONING;
90
104
EXPORT_SYMBOL_GPL(amd_cache_northbridges);
92
/* Ignores subdevice/subvendor but as far as I can figure out
93
they're useless anyways */
94
int __init early_is_amd_nb(u32 device)
107
* Ignores subdevice/subvendor but as far as I can figure out
108
* they're useless anyways
110
bool __init early_is_amd_nb(u32 device)
96
struct pci_device_id *id;
112
const struct pci_device_id *id;
97
113
u32 vendor = device & 0xffff;
99
116
for (id = amd_nb_misc_ids; id->vendor; id++)
100
117
if (vendor == id->vendor && device == id->device)
122
int amd_get_subcaches(int cpu)
124
struct pci_dev *link = node_to_amd_nb(amd_get_nb_id(cpu))->link;
128
if (!amd_nb_has_feature(AMD_NB_L3_PARTITIONING))
131
pci_read_config_dword(link, 0x1d4, &mask);
134
cuid = cpu_data(cpu).compute_unit_id;
136
return (mask >> (4 * cuid)) & 0xf;
139
int amd_set_subcaches(int cpu, int mask)
141
static unsigned int reset, ban;
142
struct amd_northbridge *nb = node_to_amd_nb(amd_get_nb_id(cpu));
146
if (!amd_nb_has_feature(AMD_NB_L3_PARTITIONING) || mask > 0xf)
149
/* if necessary, collect reset state of L3 partitioning and BAN mode */
151
pci_read_config_dword(nb->link, 0x1d4, &reset);
152
pci_read_config_dword(nb->misc, 0x1b8, &ban);
156
/* deactivate BAN mode if any subcaches are to be disabled */
158
pci_read_config_dword(nb->misc, 0x1b8, ®);
159
pci_write_config_dword(nb->misc, 0x1b8, reg & ~0x180000);
163
cuid = cpu_data(cpu).compute_unit_id;
166
mask |= (0xf ^ (1 << cuid)) << 26;
168
pci_write_config_dword(nb->link, 0x1d4, mask);
170
/* reset BAN mode if L3 partitioning returned to reset state */
171
pci_read_config_dword(nb->link, 0x1d4, ®);
173
pci_read_config_dword(nb->misc, 0x1b8, ®);
175
pci_write_config_dword(nb->misc, 0x1b8, reg | ban);
105
int amd_cache_gart(void)
181
static int amd_cache_gart(void)
109
185
if (!amd_nb_has_feature(AMD_NB_GART))