Andreas Herrmann | 23ac4ae | 2010-09-17 18:03:43 +0200 | [diff] [blame] | 1 | #ifndef _ASM_X86_AMD_NB_H |
| 2 | #define _ASM_X86_AMD_NB_H |
Andi Kleen | a32073b | 2006-06-26 13:56:40 +0200 | [diff] [blame] | 3 | |
| 4 | #include <linux/pci.h> |
| 5 | |
Jan Beulich | 24d9b70 | 2011-01-10 16:20:23 +0000 | [diff] [blame] | 6 | struct amd_nb_bus_dev_range { |
| 7 | u8 bus; |
| 8 | u8 dev_base; |
| 9 | u8 dev_limit; |
| 10 | }; |
| 11 | |
Jan Beulich | 691269f | 2011-02-09 08:26:53 +0000 | [diff] [blame] | 12 | extern const struct pci_device_id amd_nb_misc_ids[]; |
Jan Beulich | 24d9b70 | 2011-01-10 16:20:23 +0000 | [diff] [blame] | 13 | extern const struct amd_nb_bus_dev_range amd_nb_bus_dev_ranges[]; |
Andi Kleen | a32073b | 2006-06-26 13:56:40 +0200 | [diff] [blame] | 14 | |
Borislav Petkov | 84fd1d3 | 2011-03-03 12:59:32 +0100 | [diff] [blame] | 15 | extern bool early_is_amd_nb(u32 value); |
Hans Rosenfeld | 9653a5c | 2010-10-29 17:14:31 +0200 | [diff] [blame] | 16 | extern int amd_cache_northbridges(void); |
Hans Rosenfeld | eec1d4f | 2010-10-29 17:14:30 +0200 | [diff] [blame] | 17 | extern void amd_flush_garts(void); |
Tejun Heo | 940fed2 | 2011-02-16 12:13:06 +0100 | [diff] [blame] | 18 | extern int amd_numa_init(void); |
Hans Rosenfeld | cabb5bd | 2011-02-07 18:10:39 +0100 | [diff] [blame] | 19 | extern int amd_get_subcaches(int); |
| 20 | extern int amd_set_subcaches(int, int); |
Andi Kleen | a32073b | 2006-06-26 13:56:40 +0200 | [diff] [blame] | 21 | |
Hans Rosenfeld | 9653a5c | 2010-10-29 17:14:31 +0200 | [diff] [blame] | 22 | struct amd_northbridge { |
| 23 | struct pci_dev *misc; |
Hans Rosenfeld | 41b2610 | 2011-01-24 16:05:42 +0100 | [diff] [blame] | 24 | struct pci_dev *link; |
Hans Rosenfeld | 9653a5c | 2010-10-29 17:14:31 +0200 | [diff] [blame] | 25 | }; |
| 26 | |
Hans Rosenfeld | eec1d4f | 2010-10-29 17:14:30 +0200 | [diff] [blame] | 27 | struct amd_northbridge_info { |
Andreas Herrmann | 900f9ac | 2010-09-17 18:02:54 +0200 | [diff] [blame] | 28 | u16 num; |
Hans Rosenfeld | 9653a5c | 2010-10-29 17:14:31 +0200 | [diff] [blame] | 29 | u64 flags; |
| 30 | struct amd_northbridge *nb; |
Andreas Herrmann | 900f9ac | 2010-09-17 18:02:54 +0200 | [diff] [blame] | 31 | }; |
Hans Rosenfeld | eec1d4f | 2010-10-29 17:14:30 +0200 | [diff] [blame] | 32 | extern struct amd_northbridge_info amd_northbridges; |
Andreas Herrmann | 900f9ac | 2010-09-17 18:02:54 +0200 | [diff] [blame] | 33 | |
Borislav Petkov | 84fd1d3 | 2011-03-03 12:59:32 +0100 | [diff] [blame] | 34 | #define AMD_NB_GART BIT(0) |
| 35 | #define AMD_NB_L3_INDEX_DISABLE BIT(1) |
| 36 | #define AMD_NB_L3_PARTITIONING BIT(2) |
Hans Rosenfeld | 9653a5c | 2010-10-29 17:14:31 +0200 | [diff] [blame] | 37 | |
Andreas Herrmann | 23ac4ae | 2010-09-17 18:03:43 +0200 | [diff] [blame] | 38 | #ifdef CONFIG_AMD_NB |
Borislav Petkov | ade029e | 2010-04-24 09:56:53 +0200 | [diff] [blame] | 39 | |
Borislav Petkov | 84fd1d3 | 2011-03-03 12:59:32 +0100 | [diff] [blame] | 40 | static inline u16 amd_nb_num(void) |
Jaswinder Singh Rajput | b206525 | 2009-04-14 23:04:37 +0530 | [diff] [blame] | 41 | { |
Hans Rosenfeld | 9653a5c | 2010-10-29 17:14:31 +0200 | [diff] [blame] | 42 | return amd_northbridges.num; |
| 43 | } |
| 44 | |
Borislav Petkov | 84fd1d3 | 2011-03-03 12:59:32 +0100 | [diff] [blame] | 45 | static inline bool amd_nb_has_feature(unsigned feature) |
Hans Rosenfeld | 9653a5c | 2010-10-29 17:14:31 +0200 | [diff] [blame] | 46 | { |
| 47 | return ((amd_northbridges.flags & feature) == feature); |
| 48 | } |
| 49 | |
| 50 | static inline struct amd_northbridge *node_to_amd_nb(int node) |
| 51 | { |
| 52 | return (node < amd_northbridges.num) ? &amd_northbridges.nb[node] : NULL; |
Jaswinder Singh Rajput | b206525 | 2009-04-14 23:04:37 +0530 | [diff] [blame] | 53 | } |
Borislav Petkov | ade029e | 2010-04-24 09:56:53 +0200 | [diff] [blame] | 54 | |
Andreas Herrmann | afd9fce | 2009-04-09 15:16:17 +0200 | [diff] [blame] | 55 | #else |
Borislav Petkov | ade029e | 2010-04-24 09:56:53 +0200 | [diff] [blame] | 56 | |
Hans Rosenfeld | 9653a5c | 2010-10-29 17:14:31 +0200 | [diff] [blame] | 57 | #define amd_nb_num(x) 0 |
| 58 | #define amd_nb_has_feature(x) false |
| 59 | #define node_to_amd_nb(x) NULL |
| 60 | |
Andreas Herrmann | afd9fce | 2009-04-09 15:16:17 +0200 | [diff] [blame] | 61 | #endif |
| 62 | |
| 63 | |
Andreas Herrmann | 23ac4ae | 2010-09-17 18:03:43 +0200 | [diff] [blame] | 64 | #endif /* _ASM_X86_AMD_NB_H */ |