diff options
author | Hans Rosenfeld <hans.rosenfeld@amd.com> | 2010-10-29 11:14:31 -0400 |
---|---|---|
committer | Borislav Petkov <borislav.petkov@amd.com> | 2010-11-18 09:53:05 -0500 |
commit | 9653a5c76c8677b05b45b3b999d3b39988d2a064 (patch) | |
tree | 9224748c69296fc6ac50beae72f20e6e2ae16aca /arch/x86/include/asm/amd_nb.h | |
parent | eec1d4fa00c6552ae2fdf71d59f1eded7c88dd89 (diff) |
x86, amd-nb: Cleanup AMD northbridge caching code
Support more than just the "Misc Control" part of the northbridges.
Support more flags by turning "gart_supported" into a single bit flag
that is stored in a flags member. Clean up related code by using a set
of functions (amd_nb_num(), amd_nb_has_feature() and node_to_amd_nb())
instead of accessing the NB data structures directly. Reorder the
initialization code and put the GART flush words caching in a separate
function.
Signed-off-by: Hans Rosenfeld <hans.rosenfeld@amd.com>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'arch/x86/include/asm/amd_nb.h')
-rw-r--r-- | arch/x86/include/asm/amd_nb.h | 34 |
1 files changed, 25 insertions, 9 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 | ||