blob: 67f87f25761169a54e99795cecab98fed034aca7 [file] [log] [blame]
Andreas Herrmann23ac4ae2010-09-17 18:03:43 +02001#ifndef _ASM_X86_AMD_NB_H
2#define _ASM_X86_AMD_NB_H
Andi Kleena32073b2006-06-26 13:56:40 +02003
4#include <linux/pci.h>
5
Jan Beulich24d9b702011-01-10 16:20:23 +00006struct amd_nb_bus_dev_range {
7 u8 bus;
8 u8 dev_base;
9 u8 dev_limit;
10};
11
Jan Beulich691269f2011-02-09 08:26:53 +000012extern const struct pci_device_id amd_nb_misc_ids[];
Jan Beulich24d9b702011-01-10 16:20:23 +000013extern const struct amd_nb_bus_dev_range amd_nb_bus_dev_ranges[];
Andi Kleena32073b2006-06-26 13:56:40 +020014
Borislav Petkov84fd1d32011-03-03 12:59:32 +010015extern bool early_is_amd_nb(u32 value);
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020016extern int amd_cache_northbridges(void);
Hans Rosenfeldeec1d4f2010-10-29 17:14:30 +020017extern void amd_flush_garts(void);
Tejun Heo940fed22011-02-16 12:13:06 +010018extern int amd_numa_init(void);
Hans Rosenfeldcabb5bd2011-02-07 18:10:39 +010019extern int amd_get_subcaches(int);
20extern int amd_set_subcaches(int, int);
Andi Kleena32073b2006-06-26 13:56:40 +020021
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020022struct amd_northbridge {
23 struct pci_dev *misc;
Hans Rosenfeld41b26102011-01-24 16:05:42 +010024 struct pci_dev *link;
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020025};
26
Hans Rosenfeldeec1d4f2010-10-29 17:14:30 +020027struct amd_northbridge_info {
Andreas Herrmann900f9ac2010-09-17 18:02:54 +020028 u16 num;
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020029 u64 flags;
30 struct amd_northbridge *nb;
Andreas Herrmann900f9ac2010-09-17 18:02:54 +020031};
Hans Rosenfeldeec1d4f2010-10-29 17:14:30 +020032extern struct amd_northbridge_info amd_northbridges;
Andreas Herrmann900f9ac2010-09-17 18:02:54 +020033
Borislav Petkov84fd1d32011-03-03 12:59:32 +010034#define AMD_NB_GART BIT(0)
35#define AMD_NB_L3_INDEX_DISABLE BIT(1)
36#define AMD_NB_L3_PARTITIONING BIT(2)
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020037
Andreas Herrmann23ac4ae2010-09-17 18:03:43 +020038#ifdef CONFIG_AMD_NB
Borislav Petkovade029e2010-04-24 09:56:53 +020039
Borislav Petkov84fd1d32011-03-03 12:59:32 +010040static inline u16 amd_nb_num(void)
Jaswinder Singh Rajputb2065252009-04-14 23:04:37 +053041{
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020042 return amd_northbridges.num;
43}
44
Borislav Petkov84fd1d32011-03-03 12:59:32 +010045static inline bool amd_nb_has_feature(unsigned feature)
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020046{
47 return ((amd_northbridges.flags & feature) == feature);
48}
49
50static inline struct amd_northbridge *node_to_amd_nb(int node)
51{
52 return (node < amd_northbridges.num) ? &amd_northbridges.nb[node] : NULL;
Jaswinder Singh Rajputb2065252009-04-14 23:04:37 +053053}
Borislav Petkovade029e2010-04-24 09:56:53 +020054
Andreas Herrmannafd9fce2009-04-09 15:16:17 +020055#else
Borislav Petkovade029e2010-04-24 09:56:53 +020056
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020057#define amd_nb_num(x) 0
58#define amd_nb_has_feature(x) false
59#define node_to_amd_nb(x) NULL
60
Andreas Herrmannafd9fce2009-04-09 15:16:17 +020061#endif
62
63
Andreas Herrmann23ac4ae2010-09-17 18:03:43 +020064#endif /* _ASM_X86_AMD_NB_H */