blob: 64dc82ee19f00da98e796c81e767e677c56cf796 [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
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020012extern 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[];
Randy Dunlap04201012009-10-28 16:09:55 -070014struct bootnode;
Andi Kleena32073b2006-06-26 13:56:40 +020015
Hans Rosenfeldeec1d4f2010-10-29 17:14:30 +020016extern int early_is_amd_nb(u32 value);
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020017extern int amd_cache_northbridges(void);
Hans Rosenfeldeec1d4f2010-10-29 17:14:30 +020018extern void amd_flush_garts(void);
Hans Rosenfeldeec1d4f2010-10-29 17:14:30 +020019extern int amd_numa_init(unsigned long start_pfn, unsigned long end_pfn);
20extern int amd_scan_nodes(void);
Andi Kleena32073b2006-06-26 13:56:40 +020021
David Rientjes4e76f4e2010-12-22 17:23:47 -080022#ifdef CONFIG_NUMA_EMU
David Rientjesf51bf302010-12-22 17:23:51 -080023extern void amd_fake_nodes(const struct bootnode *nodes, int nr_nodes);
David Rientjesa387e952010-12-22 17:23:56 -080024extern void amd_get_nodes(struct bootnode *nodes);
David Rientjes4e76f4e2010-12-22 17:23:47 -080025#endif
26
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020027struct amd_northbridge {
28 struct pci_dev *misc;
29};
30
Hans Rosenfeldeec1d4f2010-10-29 17:14:30 +020031struct amd_northbridge_info {
Andreas Herrmann900f9ac2010-09-17 18:02:54 +020032 u16 num;
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020033 u64 flags;
34 struct amd_northbridge *nb;
Andreas Herrmann900f9ac2010-09-17 18:02:54 +020035};
Hans Rosenfeldeec1d4f2010-10-29 17:14:30 +020036extern struct amd_northbridge_info amd_northbridges;
Andreas Herrmann900f9ac2010-09-17 18:02:54 +020037
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020038#define AMD_NB_GART 0x1
Hans Rosenfeldf658bcf2010-10-29 17:14:32 +020039#define AMD_NB_L3_INDEX_DISABLE 0x2
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020040
Andreas Herrmann23ac4ae2010-09-17 18:03:43 +020041#ifdef CONFIG_AMD_NB
Borislav Petkovade029e2010-04-24 09:56:53 +020042
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020043static inline int amd_nb_num(void)
Jaswinder Singh Rajputb2065252009-04-14 23:04:37 +053044{
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020045 return amd_northbridges.num;
46}
47
48static inline int amd_nb_has_feature(int feature)
49{
50 return ((amd_northbridges.flags & feature) == feature);
51}
52
53static inline struct amd_northbridge *node_to_amd_nb(int node)
54{
55 return (node < amd_northbridges.num) ? &amd_northbridges.nb[node] : NULL;
Jaswinder Singh Rajputb2065252009-04-14 23:04:37 +053056}
Borislav Petkovade029e2010-04-24 09:56:53 +020057
Andreas Herrmannafd9fce2009-04-09 15:16:17 +020058#else
Borislav Petkovade029e2010-04-24 09:56:53 +020059
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020060#define amd_nb_num(x) 0
61#define amd_nb_has_feature(x) false
62#define node_to_amd_nb(x) NULL
63
Andreas Herrmannafd9fce2009-04-09 15:16:17 +020064#endif
65
66
Andreas Herrmann23ac4ae2010-09-17 18:03:43 +020067#endif /* _ASM_X86_AMD_NB_H */