diff options
-rw-r--r-- | arch/x86/include/asm/amd_nb.h | 34 | ||||
-rw-r--r-- | arch/x86/kernel/amd_nb.c | 109 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/intel_cacheinfo.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/pci-gart_64.c | 24 | ||||
-rw-r--r-- | drivers/char/agp/amd64-agp.c | 29 | ||||
-rw-r--r-- | drivers/edac/amd64_edac.c | 4 |
6 files changed, 118 insertions, 88 deletions
diff --git a/arch/x86/include/asm/amd_nb.h b/arch/x86/include/asm/amd_nb.h index 35b17a821e34..4d7ec7df7de2 100644 --- a/arch/x86/include/asm/amd_nb.h +++ b/arch/x86/include/asm/amd_nb.h | |||
@@ -3,36 +3,52 @@ | |||
3 | 3 | ||
4 | #include <linux/pci.h> | 4 | #include <linux/pci.h> |
5 | 5 | ||
6 | extern struct pci_device_id amd_nb_ids[]; | 6 | extern struct pci_device_id amd_nb_misc_ids[]; |
7 | struct bootnode; | 7 | struct bootnode; |
8 | 8 | ||
9 | extern int early_is_amd_nb(u32 value); | 9 | extern int early_is_amd_nb(u32 value); |
10 | extern int cache_amd_northbridges(void); | 10 | extern int amd_cache_northbridges(void); |
11 | extern void amd_flush_garts(void); | 11 | extern void amd_flush_garts(void); |
12 | extern int amd_get_nodes(struct bootnode *nodes); | 12 | extern int amd_get_nodes(struct bootnode *nodes); |
13 | extern int amd_numa_init(unsigned long start_pfn, unsigned long end_pfn); | 13 | extern int amd_numa_init(unsigned long start_pfn, unsigned long end_pfn); |
14 | extern int amd_scan_nodes(void); | 14 | extern int amd_scan_nodes(void); |
15 | 15 | ||
16 | struct amd_northbridge { | ||
17 | struct pci_dev *misc; | ||
18 | }; | ||
19 | |||
16 | struct amd_northbridge_info { | 20 | struct amd_northbridge_info { |
17 | u16 num; | 21 | u16 num; |
18 | u8 gart_supported; | 22 | u64 flags; |
19 | struct pci_dev **nb_misc; | 23 | struct amd_northbridge *nb; |
20 | }; | 24 | }; |
21 | extern struct amd_northbridge_info amd_northbridges; | 25 | extern struct amd_northbridge_info amd_northbridges; |
22 | 26 | ||
27 | #define AMD_NB_GART 0x1 | ||
28 | |||
23 | #ifdef CONFIG_AMD_NB | 29 | #ifdef CONFIG_AMD_NB |
24 | 30 | ||
25 | static inline struct pci_dev *node_to_amd_nb_misc(int node) | 31 | static inline int amd_nb_num(void) |
26 | { | 32 | { |
27 | return (node < amd_northbridges.num) ? amd_northbridges.nb_misc[node] : NULL; | 33 | return amd_northbridges.num; |
28 | } | 34 | } |
29 | 35 | ||
30 | #else | 36 | static inline int amd_nb_has_feature(int feature) |
37 | { | ||
38 | return ((amd_northbridges.flags & feature) == feature); | ||
39 | } | ||
31 | 40 | ||
32 | static inline struct pci_dev *node_to_amd_nb_misc(int node) | 41 | static inline struct amd_northbridge *node_to_amd_nb(int node) |
33 | { | 42 | { |
34 | return NULL; | 43 | return (node < amd_northbridges.num) ? &amd_northbridges.nb[node] : NULL; |
35 | } | 44 | } |
45 | |||
46 | #else | ||
47 | |||
48 | #define amd_nb_num(x) 0 | ||
49 | #define amd_nb_has_feature(x) false | ||
50 | #define node_to_amd_nb(x) NULL | ||
51 | |||
36 | #endif | 52 | #endif |
37 | 53 | ||
38 | 54 | ||
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c index c46df406a2a9..63c8b4f2c1ad 100644 --- a/arch/x86/kernel/amd_nb.c +++ b/arch/x86/kernel/amd_nb.c | |||
@@ -12,74 +12,65 @@ | |||
12 | 12 | ||
13 | static u32 *flush_words; | 13 | static u32 *flush_words; |
14 | 14 | ||
15 | struct pci_device_id amd_nb_ids[] = { | 15 | struct pci_device_id amd_nb_misc_ids[] = { |
16 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) }, | 16 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) }, |
17 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) }, | 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_MISC) }, |
19 | {} | 19 | {} |
20 | }; | 20 | }; |
21 | EXPORT_SYMBOL(amd_nb_ids); | 21 | EXPORT_SYMBOL(amd_nb_misc_ids); |
22 | 22 | ||
23 | struct amd_northbridge_info amd_northbridges; | 23 | struct amd_northbridge_info amd_northbridges; |
24 | EXPORT_SYMBOL(amd_northbridges); | 24 | EXPORT_SYMBOL(amd_northbridges); |
25 | 25 | ||
26 | static struct pci_dev *next_amd_northbridge(struct pci_dev *dev) | 26 | static struct pci_dev *next_northbridge(struct pci_dev *dev, |
27 | struct pci_device_id *ids) | ||
27 | { | 28 | { |
28 | do { | 29 | do { |
29 | dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev); | 30 | dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev); |
30 | if (!dev) | 31 | if (!dev) |
31 | break; | 32 | break; |
32 | } while (!pci_match_id(&amd_nb_ids[0], dev)); | 33 | } while (!pci_match_id(ids, dev)); |
33 | return dev; | 34 | return dev; |
34 | } | 35 | } |
35 | 36 | ||
36 | int cache_amd_northbridges(void) | 37 | int amd_cache_northbridges(void) |
37 | { | 38 | { |
38 | int i; | 39 | int i = 0; |
39 | struct pci_dev *dev; | 40 | struct amd_northbridge *nb; |
41 | struct pci_dev *misc; | ||
40 | 42 | ||
41 | if (amd_northbridges.num) | 43 | if (amd_nb_num()) |
42 | return 0; | 44 | return 0; |
43 | 45 | ||
44 | dev = NULL; | 46 | misc = NULL; |
45 | while ((dev = next_amd_northbridge(dev)) != NULL) | 47 | while ((misc = next_northbridge(misc, amd_nb_misc_ids)) != NULL) |
46 | amd_northbridges.num++; | 48 | i++; |
47 | 49 | ||
48 | /* some CPU families (e.g. family 0x11) do not support GART */ | 50 | if (i == 0) |
49 | if (boot_cpu_data.x86 == 0xf || boot_cpu_data.x86 == 0x10 || | 51 | return 0; |
50 | boot_cpu_data.x86 == 0x15) | ||
51 | amd_northbridges.gart_supported = 1; | ||
52 | 52 | ||
53 | amd_northbridges.nb_misc = kmalloc((amd_northbridges.num + 1) * | 53 | nb = kzalloc(i * sizeof(struct amd_northbridge), GFP_KERNEL); |
54 | sizeof(void *), GFP_KERNEL); | 54 | if (!nb) |
55 | if (!amd_northbridges.nb_misc) | ||
56 | return -ENOMEM; | 55 | return -ENOMEM; |
57 | 56 | ||
58 | if (!amd_northbridges.num) { | 57 | amd_northbridges.nb = nb; |
59 | amd_northbridges.nb_misc[0] = NULL; | 58 | amd_northbridges.num = i; |
60 | return 0; | ||
61 | } | ||
62 | 59 | ||
63 | if (amd_northbridges.gart_supported) { | 60 | misc = NULL; |
64 | flush_words = kmalloc(amd_northbridges.num * sizeof(u32), | 61 | for (i = 0; i != amd_nb_num(); i++) { |
65 | GFP_KERNEL); | 62 | node_to_amd_nb(i)->misc = misc = |
66 | if (!flush_words) { | 63 | next_northbridge(misc, amd_nb_misc_ids); |
67 | kfree(amd_northbridges.nb_misc); | 64 | } |
68 | return -ENOMEM; | 65 | |
69 | } | 66 | /* some CPU families (e.g. family 0x11) do not support GART */ |
70 | } | 67 | if (boot_cpu_data.x86 == 0xf || boot_cpu_data.x86 == 0x10 || |
68 | boot_cpu_data.x86 == 0x15) | ||
69 | amd_northbridges.flags |= AMD_NB_GART; | ||
71 | 70 | ||
72 | dev = NULL; | ||
73 | i = 0; | ||
74 | while ((dev = next_amd_northbridge(dev)) != NULL) { | ||
75 | amd_northbridges.nb_misc[i] = dev; | ||
76 | if (amd_northbridges.gart_supported) | ||
77 | pci_read_config_dword(dev, 0x9c, &flush_words[i++]); | ||
78 | } | ||
79 | amd_northbridges.nb_misc[i] = NULL; | ||
80 | return 0; | 71 | return 0; |
81 | } | 72 | } |
82 | EXPORT_SYMBOL_GPL(cache_amd_northbridges); | 73 | EXPORT_SYMBOL_GPL(amd_cache_northbridges); |
83 | 74 | ||
84 | /* Ignores subdevice/subvendor but as far as I can figure out | 75 | /* Ignores subdevice/subvendor but as far as I can figure out |
85 | they're useless anyways */ | 76 | they're useless anyways */ |
@@ -88,19 +79,39 @@ int __init early_is_amd_nb(u32 device) | |||
88 | struct pci_device_id *id; | 79 | struct pci_device_id *id; |
89 | u32 vendor = device & 0xffff; | 80 | u32 vendor = device & 0xffff; |
90 | device >>= 16; | 81 | device >>= 16; |
91 | for (id = amd_nb_ids; id->vendor; id++) | 82 | for (id = amd_nb_misc_ids; id->vendor; id++) |
92 | if (vendor == id->vendor && device == id->device) | 83 | if (vendor == id->vendor && device == id->device) |
93 | return 1; | 84 | return 1; |
94 | return 0; | 85 | return 0; |
95 | } | 86 | } |
96 | 87 | ||
88 | int amd_cache_gart(void) | ||
89 | { | ||
90 | int i; | ||
91 | |||
92 | if (!amd_nb_has_feature(AMD_NB_GART)) | ||
93 | return 0; | ||
94 | |||
95 | flush_words = kmalloc(amd_nb_num() * sizeof(u32), GFP_KERNEL); | ||
96 | if (!flush_words) { | ||
97 | amd_northbridges.flags &= ~AMD_NB_GART; | ||
98 | return -ENOMEM; | ||
99 | } | ||
100 | |||
101 | for (i = 0; i != amd_nb_num(); i++) | ||
102 | pci_read_config_dword(node_to_amd_nb(i)->misc, 0x9c, | ||
103 | &flush_words[i]); | ||
104 | |||
105 | return 0; | ||
106 | } | ||
107 | |||
97 | void amd_flush_garts(void) | 108 | void amd_flush_garts(void) |
98 | { | 109 | { |
99 | int flushed, i; | 110 | int flushed, i; |
100 | unsigned long flags; | 111 | unsigned long flags; |
101 | static DEFINE_SPINLOCK(gart_lock); | 112 | static DEFINE_SPINLOCK(gart_lock); |
102 | 113 | ||
103 | if (!amd_northbridges.gart_supported) | 114 | if (!amd_nb_has_feature(AMD_NB_GART)) |
104 | return; | 115 | return; |
105 | 116 | ||
106 | /* Avoid races between AGP and IOMMU. In theory it's not needed | 117 | /* Avoid races between AGP and IOMMU. In theory it's not needed |
@@ -109,16 +120,16 @@ void amd_flush_garts(void) | |||
109 | that it doesn't matter to serialize more. -AK */ | 120 | that it doesn't matter to serialize more. -AK */ |
110 | spin_lock_irqsave(&gart_lock, flags); | 121 | spin_lock_irqsave(&gart_lock, flags); |
111 | flushed = 0; | 122 | flushed = 0; |
112 | for (i = 0; i < amd_northbridges.num; i++) { | 123 | for (i = 0; i < amd_nb_num(); i++) { |
113 | pci_write_config_dword(amd_northbridges.nb_misc[i], 0x9c, | 124 | pci_write_config_dword(node_to_amd_nb(i)->misc, 0x9c, |
114 | flush_words[i]|1); | 125 | flush_words[i] | 1); |
115 | flushed++; | 126 | flushed++; |
116 | } | 127 | } |
117 | for (i = 0; i < amd_northbridges.num; i++) { | 128 | for (i = 0; i < amd_nb_num(); i++) { |
118 | u32 w; | 129 | u32 w; |
119 | /* Make sure the hardware actually executed the flush*/ | 130 | /* Make sure the hardware actually executed the flush*/ |
120 | for (;;) { | 131 | for (;;) { |
121 | pci_read_config_dword(amd_northbridges.nb_misc[i], | 132 | pci_read_config_dword(node_to_amd_nb(i)->misc, |
122 | 0x9c, &w); | 133 | 0x9c, &w); |
123 | if (!(w & 1)) | 134 | if (!(w & 1)) |
124 | break; | 135 | break; |
@@ -135,11 +146,15 @@ static __init int init_amd_nbs(void) | |||
135 | { | 146 | { |
136 | int err = 0; | 147 | int err = 0; |
137 | 148 | ||
138 | err = cache_amd_northbridges(); | 149 | err = amd_cache_northbridges(); |
139 | 150 | ||
140 | if (err < 0) | 151 | if (err < 0) |
141 | printk(KERN_NOTICE "AMD NB: Cannot enumerate AMD northbridges.\n"); | 152 | printk(KERN_NOTICE "AMD NB: Cannot enumerate AMD northbridges.\n"); |
142 | 153 | ||
154 | if (amd_cache_gart() < 0) | ||
155 | printk(KERN_NOTICE "AMD NB: Cannot initialize GART flush words, " | ||
156 | "GART support disabled.\n"); | ||
157 | |||
143 | return err; | 158 | return err; |
144 | } | 159 | } |
145 | 160 | ||
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index 92512ed380e7..6b8ea7434972 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
@@ -333,7 +333,7 @@ static void __cpuinit amd_calc_l3_indices(struct amd_l3_cache *l3) | |||
333 | static struct amd_l3_cache * __cpuinit amd_init_l3_cache(int node) | 333 | static struct amd_l3_cache * __cpuinit amd_init_l3_cache(int node) |
334 | { | 334 | { |
335 | struct amd_l3_cache *l3; | 335 | struct amd_l3_cache *l3; |
336 | struct pci_dev *dev = node_to_amd_nb_misc(node); | 336 | struct pci_dev *dev = node_to_amd_nb(node)->misc; |
337 | 337 | ||
338 | l3 = kzalloc(sizeof(struct amd_l3_cache), GFP_ATOMIC); | 338 | l3 = kzalloc(sizeof(struct amd_l3_cache), GFP_ATOMIC); |
339 | if (!l3) { | 339 | if (!l3) { |
@@ -370,7 +370,7 @@ static void __cpuinit amd_check_l3_disable(struct _cpuid4_info_regs *this_leaf, | |||
370 | return; | 370 | return; |
371 | 371 | ||
372 | /* not in virtualized environments */ | 372 | /* not in virtualized environments */ |
373 | if (amd_northbridges.num == 0) | 373 | if (amd_nb_num() == 0) |
374 | return; | 374 | return; |
375 | 375 | ||
376 | /* | 376 | /* |
@@ -378,7 +378,7 @@ static void __cpuinit amd_check_l3_disable(struct _cpuid4_info_regs *this_leaf, | |||
378 | * never freed but this is done only on shutdown so it doesn't matter. | 378 | * never freed but this is done only on shutdown so it doesn't matter. |
379 | */ | 379 | */ |
380 | if (!l3_caches) { | 380 | if (!l3_caches) { |
381 | int size = amd_northbridges.num * sizeof(struct amd_l3_cache *); | 381 | int size = amd_nb_num() * sizeof(struct amd_l3_cache *); |
382 | 382 | ||
383 | l3_caches = kzalloc(size, GFP_ATOMIC); | 383 | l3_caches = kzalloc(size, GFP_ATOMIC); |
384 | if (!l3_caches) | 384 | if (!l3_caches) |
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c index 63317c5694d7..c01ffa5b9b87 100644 --- a/arch/x86/kernel/pci-gart_64.c +++ b/arch/x86/kernel/pci-gart_64.c | |||
@@ -561,11 +561,11 @@ static void enable_gart_translations(void) | |||
561 | { | 561 | { |
562 | int i; | 562 | int i; |
563 | 563 | ||
564 | if (!amd_northbridges.gart_supported) | 564 | if (!amd_nb_has_feature(AMD_NB_GART)) |
565 | return; | 565 | return; |
566 | 566 | ||
567 | for (i = 0; i < amd_northbridges.num; i++) { | 567 | for (i = 0; i < amd_nb_num(); i++) { |
568 | struct pci_dev *dev = amd_northbridges.nb_misc[i]; | 568 | struct pci_dev *dev = node_to_amd_nb(i)->misc; |
569 | 569 | ||
570 | enable_gart_translation(dev, __pa(agp_gatt_table)); | 570 | enable_gart_translation(dev, __pa(agp_gatt_table)); |
571 | } | 571 | } |
@@ -596,13 +596,13 @@ static void gart_fixup_northbridges(struct sys_device *dev) | |||
596 | if (!fix_up_north_bridges) | 596 | if (!fix_up_north_bridges) |
597 | return; | 597 | return; |
598 | 598 | ||
599 | if (!amd_northbridges.gart_supported) | 599 | if (!amd_nb_has_feature(AMD_NB_GART)) |
600 | return; | 600 | return; |
601 | 601 | ||
602 | pr_info("PCI-DMA: Restoring GART aperture settings\n"); | 602 | pr_info("PCI-DMA: Restoring GART aperture settings\n"); |
603 | 603 | ||
604 | for (i = 0; i < amd_northbridges.num; i++) { | 604 | for (i = 0; i < amd_nb_num(); i++) { |
605 | struct pci_dev *dev = amd_northbridges.nb_misc[i]; | 605 | struct pci_dev *dev = node_to_amd_nb(i)->misc; |
606 | 606 | ||
607 | /* | 607 | /* |
608 | * Don't enable translations just yet. That is the next | 608 | * Don't enable translations just yet. That is the next |
@@ -656,8 +656,8 @@ static __init int init_amd_gatt(struct agp_kern_info *info) | |||
656 | 656 | ||
657 | aper_size = aper_base = info->aper_size = 0; | 657 | aper_size = aper_base = info->aper_size = 0; |
658 | dev = NULL; | 658 | dev = NULL; |
659 | for (i = 0; i < amd_northbridges.num; i++) { | 659 | for (i = 0; i < amd_nb_num(); i++) { |
660 | dev = amd_northbridges.nb_misc[i]; | 660 | dev = node_to_amd_nb(i)->misc; |
661 | new_aper_base = read_aperture(dev, &new_aper_size); | 661 | new_aper_base = read_aperture(dev, &new_aper_size); |
662 | if (!new_aper_base) | 662 | if (!new_aper_base) |
663 | goto nommu; | 663 | goto nommu; |
@@ -725,13 +725,13 @@ static void gart_iommu_shutdown(void) | |||
725 | if (!no_agp) | 725 | if (!no_agp) |
726 | return; | 726 | return; |
727 | 727 | ||
728 | if (!amd_northbridges.gart_supported) | 728 | if (!amd_nb_has_feature(AMD_NB_GART)) |
729 | return; | 729 | return; |
730 | 730 | ||
731 | for (i = 0; i < amd_northbridges.num; i++) { | 731 | for (i = 0; i < amd_nb_num(); i++) { |
732 | u32 ctl; | 732 | u32 ctl; |
733 | 733 | ||
734 | dev = amd_northbridges.nb_misc[i]; | 734 | dev = node_to_amd_nb(i)->misc; |
735 | pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &ctl); | 735 | pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &ctl); |
736 | 736 | ||
737 | ctl &= ~GARTEN; | 737 | ctl &= ~GARTEN; |
@@ -749,7 +749,7 @@ int __init gart_iommu_init(void) | |||
749 | unsigned long scratch; | 749 | unsigned long scratch; |
750 | long i; | 750 | long i; |
751 | 751 | ||
752 | if (!amd_northbridges.gart_supported) | 752 | if (!amd_nb_has_feature(AMD_NB_GART)) |
753 | return 0; | 753 | return 0; |
754 | 754 | ||
755 | #ifndef CONFIG_AGP_AMD64 | 755 | #ifndef CONFIG_AGP_AMD64 |
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index b1f8bb53941a..9252e85706ef 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -124,7 +124,7 @@ static int amd64_fetch_size(void) | |||
124 | u32 temp; | 124 | u32 temp; |
125 | struct aper_size_info_32 *values; | 125 | struct aper_size_info_32 *values; |
126 | 126 | ||
127 | dev = amd_northbridges.nb_misc[0]; | 127 | dev = node_to_amd_nb(0)->misc; |
128 | if (dev==NULL) | 128 | if (dev==NULL) |
129 | return 0; | 129 | return 0; |
130 | 130 | ||
@@ -181,14 +181,13 @@ static int amd_8151_configure(void) | |||
181 | unsigned long gatt_bus = virt_to_phys(agp_bridge->gatt_table_real); | 181 | unsigned long gatt_bus = virt_to_phys(agp_bridge->gatt_table_real); |
182 | int i; | 182 | int i; |
183 | 183 | ||
184 | if (!amd_northbridges.gart_supported) | 184 | if (!amd_nb_has_feature(AMD_NB_GART)) |
185 | return 0; | 185 | return 0; |
186 | 186 | ||
187 | /* Configure AGP regs in each x86-64 host bridge. */ | 187 | /* Configure AGP regs in each x86-64 host bridge. */ |
188 | for (i = 0; i < amd_northbridges.num; i++) { | 188 | for (i = 0; i < amd_nb_num(); i++) { |
189 | agp_bridge->gart_bus_addr = | 189 | agp_bridge->gart_bus_addr = |
190 | amd64_configure(amd_northbridges.nb_misc[i], | 190 | amd64_configure(node_to_amd_nb(i)->misc, gatt_bus); |
191 | gatt_bus); | ||
192 | } | 191 | } |
193 | amd_flush_garts(); | 192 | amd_flush_garts(); |
194 | return 0; | 193 | return 0; |
@@ -200,11 +199,11 @@ static void amd64_cleanup(void) | |||
200 | u32 tmp; | 199 | u32 tmp; |
201 | int i; | 200 | int i; |
202 | 201 | ||
203 | if (!amd_northbridges.gart_supported) | 202 | if (!amd_nb_has_feature(AMD_NB_GART)) |
204 | return; | 203 | return; |
205 | 204 | ||
206 | for (i = 0; i < amd_northbridges.num; i++) { | 205 | for (i = 0; i < amd_nb_num(); i++) { |
207 | struct pci_dev *dev = amd_northbridges.nb_misc[i]; | 206 | struct pci_dev *dev = node_to_amd_nb(i)->misc; |
208 | /* disable gart translation */ | 207 | /* disable gart translation */ |
209 | pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &tmp); | 208 | pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &tmp); |
210 | tmp &= ~GARTEN; | 209 | tmp &= ~GARTEN; |
@@ -331,15 +330,15 @@ static __devinit int cache_nbs(struct pci_dev *pdev, u32 cap_ptr) | |||
331 | { | 330 | { |
332 | int i; | 331 | int i; |
333 | 332 | ||
334 | if (cache_amd_northbridges() < 0) | 333 | if (amd_cache_northbridges() < 0) |
335 | return -ENODEV; | 334 | return -ENODEV; |
336 | 335 | ||
337 | if (!amd_northbridges.gart_supported) | 336 | if (!amd_nb_has_feature(AMD_NB_GART)) |
338 | return -ENODEV; | 337 | return -ENODEV; |
339 | 338 | ||
340 | i = 0; | 339 | i = 0; |
341 | for (i = 0; i < amd_northbridges.num; i++) { | 340 | for (i = 0; i < amd_nb_num(); i++) { |
342 | struct pci_dev *dev = amd_northbridges.nb_misc[i]; | 341 | struct pci_dev *dev = node_to_amd_nb(i)->misc; |
343 | if (fix_northbridge(dev, pdev, cap_ptr) < 0) { | 342 | if (fix_northbridge(dev, pdev, cap_ptr) < 0) { |
344 | dev_err(&dev->dev, "no usable aperture found\n"); | 343 | dev_err(&dev->dev, "no usable aperture found\n"); |
345 | #ifdef __x86_64__ | 344 | #ifdef __x86_64__ |
@@ -416,7 +415,7 @@ static int __devinit uli_agp_init(struct pci_dev *pdev) | |||
416 | } | 415 | } |
417 | 416 | ||
418 | /* shadow x86-64 registers into ULi registers */ | 417 | /* shadow x86-64 registers into ULi registers */ |
419 | pci_read_config_dword (amd_northbridges.nb_misc[0], AMD64_GARTAPERTUREBASE, | 418 | pci_read_config_dword (node_to_amd_nb(0)->misc, AMD64_GARTAPERTUREBASE, |
420 | &httfea); | 419 | &httfea); |
421 | 420 | ||
422 | /* if x86-64 aperture base is beyond 4G, exit here */ | 421 | /* if x86-64 aperture base is beyond 4G, exit here */ |
@@ -484,7 +483,7 @@ static int nforce3_agp_init(struct pci_dev *pdev) | |||
484 | pci_write_config_dword(dev1, NVIDIA_X86_64_1_APSIZE, tmp); | 483 | pci_write_config_dword(dev1, NVIDIA_X86_64_1_APSIZE, tmp); |
485 | 484 | ||
486 | /* shadow x86-64 registers into NVIDIA registers */ | 485 | /* shadow x86-64 registers into NVIDIA registers */ |
487 | pci_read_config_dword (amd_northbridges.nb_misc[0], AMD64_GARTAPERTUREBASE, | 486 | pci_read_config_dword (node_to_amd_nb(0)->misc, AMD64_GARTAPERTUREBASE, |
488 | &apbase); | 487 | &apbase); |
489 | 488 | ||
490 | /* if x86-64 aperture base is beyond 4G, exit here */ | 489 | /* if x86-64 aperture base is beyond 4G, exit here */ |
@@ -778,7 +777,7 @@ int __init agp_amd64_init(void) | |||
778 | } | 777 | } |
779 | 778 | ||
780 | /* First check that we have at least one AMD64 NB */ | 779 | /* First check that we have at least one AMD64 NB */ |
781 | if (!pci_dev_present(amd_nb_ids)) | 780 | if (!pci_dev_present(amd_nb_misc_ids)) |
782 | return -ENODEV; | 781 | return -ENODEV; |
783 | 782 | ||
784 | /* Look for any AGP bridge */ | 783 | /* Look for any AGP bridge */ |
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 8b144ccf08aa..774f950b08ab 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
@@ -2917,7 +2917,7 @@ static int __init amd64_edac_init(void) | |||
2917 | 2917 | ||
2918 | opstate_init(); | 2918 | opstate_init(); |
2919 | 2919 | ||
2920 | if (cache_amd_northbridges() < 0) | 2920 | if (amd_cache_northbridges() < 0) |
2921 | goto err_ret; | 2921 | goto err_ret; |
2922 | 2922 | ||
2923 | msrs = msrs_alloc(); | 2923 | msrs = msrs_alloc(); |
@@ -2934,7 +2934,7 @@ static int __init amd64_edac_init(void) | |||
2934 | * to finish initialization of the MC instances. | 2934 | * to finish initialization of the MC instances. |
2935 | */ | 2935 | */ |
2936 | err = -ENODEV; | 2936 | err = -ENODEV; |
2937 | for (nb = 0; nb < amd_northbridges.num; nb++) { | 2937 | for (nb = 0; nb < amd_nb_num(); nb++) { |
2938 | if (!pvt_lookup[nb]) | 2938 | if (!pvt_lookup[nb]) |
2939 | continue; | 2939 | continue; |
2940 | 2940 | ||