15
15
#include <linux/pci_ids.h>
16
16
#include <asm/amd_nb.h>
17
17
18
- #define PCI_DEVICE_ID_AMD_17H_ROOT 0x1450
19
- #define PCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0
20
- #define PCI_DEVICE_ID_AMD_17H_M30H_ROOT 0x1480
21
- #define PCI_DEVICE_ID_AMD_17H_M60H_ROOT 0x1630
22
- #define PCI_DEVICE_ID_AMD_17H_MA0H_ROOT 0x14b5
23
- #define PCI_DEVICE_ID_AMD_19H_M10H_ROOT 0x14a4
24
- #define PCI_DEVICE_ID_AMD_19H_M40H_ROOT 0x14b5
25
- #define PCI_DEVICE_ID_AMD_19H_M60H_ROOT 0x14d8
26
- #define PCI_DEVICE_ID_AMD_19H_M70H_ROOT 0x14e8
27
- #define PCI_DEVICE_ID_AMD_1AH_M00H_ROOT 0x153a
28
- #define PCI_DEVICE_ID_AMD_1AH_M20H_ROOT 0x1507
29
- #define PCI_DEVICE_ID_AMD_1AH_M60H_ROOT 0x1122
30
- #define PCI_DEVICE_ID_AMD_MI200_ROOT 0x14bb
31
- #define PCI_DEVICE_ID_AMD_MI300_ROOT 0x14f8
32
-
33
18
/* Protect the PCI config register pairs used for SMN. */
34
19
static DEFINE_MUTEX (smn_mutex );
35
20
36
21
static u32 * flush_words ;
37
22
38
- static const struct pci_device_id amd_root_ids [] = {
39
- { PCI_DEVICE (PCI_VENDOR_ID_AMD , PCI_DEVICE_ID_AMD_17H_ROOT ) },
40
- { PCI_DEVICE (PCI_VENDOR_ID_AMD , PCI_DEVICE_ID_AMD_17H_M10H_ROOT ) },
41
- { PCI_DEVICE (PCI_VENDOR_ID_AMD , PCI_DEVICE_ID_AMD_17H_M30H_ROOT ) },
42
- { PCI_DEVICE (PCI_VENDOR_ID_AMD , PCI_DEVICE_ID_AMD_17H_M60H_ROOT ) },
43
- { PCI_DEVICE (PCI_VENDOR_ID_AMD , PCI_DEVICE_ID_AMD_17H_MA0H_ROOT ) },
44
- { PCI_DEVICE (PCI_VENDOR_ID_AMD , PCI_DEVICE_ID_AMD_19H_M10H_ROOT ) },
45
- { PCI_DEVICE (PCI_VENDOR_ID_AMD , PCI_DEVICE_ID_AMD_19H_M40H_ROOT ) },
46
- { PCI_DEVICE (PCI_VENDOR_ID_AMD , PCI_DEVICE_ID_AMD_19H_M60H_ROOT ) },
47
- { PCI_DEVICE (PCI_VENDOR_ID_AMD , PCI_DEVICE_ID_AMD_19H_M70H_ROOT ) },
48
- { PCI_DEVICE (PCI_VENDOR_ID_AMD , PCI_DEVICE_ID_AMD_1AH_M00H_ROOT ) },
49
- { PCI_DEVICE (PCI_VENDOR_ID_AMD , PCI_DEVICE_ID_AMD_1AH_M20H_ROOT ) },
50
- { PCI_DEVICE (PCI_VENDOR_ID_AMD , PCI_DEVICE_ID_AMD_1AH_M60H_ROOT ) },
51
- { PCI_DEVICE (PCI_VENDOR_ID_AMD , PCI_DEVICE_ID_AMD_MI200_ROOT ) },
52
- { PCI_DEVICE (PCI_VENDOR_ID_AMD , PCI_DEVICE_ID_AMD_MI300_ROOT ) },
53
- {}
54
- };
55
-
56
23
static const struct pci_device_id amd_nb_misc_ids [] = {
57
24
{ PCI_DEVICE (PCI_VENDOR_ID_AMD , PCI_DEVICE_ID_AMD_K8_NB_MISC ) },
58
25
{ PCI_DEVICE (PCI_VENDOR_ID_AMD , PCI_DEVICE_ID_AMD_10H_NB_MISC ) },
@@ -85,11 +52,6 @@ static const struct pci_device_id amd_nb_misc_ids[] = {
85
52
{}
86
53
};
87
54
88
- static const struct pci_device_id hygon_root_ids [] = {
89
- { PCI_DEVICE (PCI_VENDOR_ID_HYGON , PCI_DEVICE_ID_AMD_17H_ROOT ) },
90
- {}
91
- };
92
-
93
55
static const struct pci_device_id hygon_nb_misc_ids [] = {
94
56
{ PCI_DEVICE (PCI_VENDOR_ID_HYGON , PCI_DEVICE_ID_AMD_17H_DF_F3 ) },
95
57
{}
@@ -222,19 +184,15 @@ EXPORT_SYMBOL_GPL(amd_smn_write);
222
184
static int amd_cache_northbridges (void )
223
185
{
224
186
const struct pci_device_id * misc_ids = amd_nb_misc_ids ;
225
- const struct pci_device_id * root_ids = amd_root_ids ;
226
- struct pci_dev * root , * misc ;
187
+ struct pci_dev * misc ;
227
188
struct amd_northbridge * nb ;
228
- u16 roots_per_misc = 0 ;
229
189
u16 misc_count = 0 ;
230
- u16 root_count = 0 ;
231
- u16 i , j ;
190
+ u16 i ;
232
191
233
192
if (amd_northbridges .num )
234
193
return 0 ;
235
194
236
195
if (boot_cpu_data .x86_vendor == X86_VENDOR_HYGON ) {
237
- root_ids = hygon_root_ids ;
238
196
misc_ids = hygon_nb_misc_ids ;
239
197
}
240
198
@@ -245,49 +203,19 @@ static int amd_cache_northbridges(void)
245
203
if (!misc_count )
246
204
return - ENODEV ;
247
205
248
- root = NULL ;
249
- while ((root = next_northbridge (root , root_ids )))
250
- root_count ++ ;
251
-
252
- if (root_count ) {
253
- roots_per_misc = root_count / misc_count ;
254
-
255
- /*
256
- * There should be _exactly_ N roots for each DF/SMN
257
- * interface.
258
- */
259
- if (!roots_per_misc || (root_count % roots_per_misc )) {
260
- pr_info ("Unsupported AMD DF/PCI configuration found\n" );
261
- return - ENODEV ;
262
- }
263
- }
264
-
265
206
nb = kcalloc (misc_count , sizeof (struct amd_northbridge ), GFP_KERNEL );
266
207
if (!nb )
267
208
return - ENOMEM ;
268
209
269
210
amd_northbridges .nb = nb ;
270
211
amd_northbridges .num = misc_count ;
271
212
272
- misc = root = NULL ;
213
+ misc = NULL ;
273
214
for (i = 0 ; i < amd_northbridges .num ; i ++ ) {
274
- node_to_amd_nb (i )-> root = root =
275
- next_northbridge (root , root_ids );
215
+ node_to_amd_nb (i )-> root = amd_node_get_root (i );
276
216
node_to_amd_nb (i )-> misc = misc =
277
217
next_northbridge (misc , misc_ids );
278
218
node_to_amd_nb (i )-> link = amd_node_get_func (i , 4 );
279
-
280
- /*
281
- * If there are more PCI root devices than data fabric/
282
- * system management network interfaces, then the (N)
283
- * PCI roots per DF/SMN interface are functionally the
284
- * same (for DF/SMN access) and N-1 are redundant. N-1
285
- * PCI roots should be skipped per DF/SMN interface so
286
- * the following DF/SMN interfaces get mapped to
287
- * correct PCI roots.
288
- */
289
- for (j = 1 ; j < roots_per_misc ; j ++ )
290
- root = next_northbridge (root , root_ids );
291
219
}
292
220
293
221
if (amd_gart_present ())
0 commit comments