blob: 423f11ca6eebe4a5da6315c2bcf090bd3b45e961 [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);
Hans Rosenfeldcabb5bd2011-02-07 18:10:39 +010021extern int amd_get_subcaches(int);
22extern int amd_set_subcaches(int, int);
Andi Kleena32073b2006-06-26 13:56:40 +020023
David Rientjes4e76f4e2010-12-22 17:23:47 -080024#ifdef CONFIG_NUMA_EMU
David Rientjesf51bf302010-12-22 17:23:51 -080025extern void amd_fake_nodes(const struct bootnode *nodes, int nr_nodes);
David Rientjesa387e952010-12-22 17:23:56 -080026extern void amd_get_nodes(struct bootnode *nodes);
David Rientjes4e76f4e2010-12-22 17:23:47 -080027#endif
28
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020029struct amd_northbridge {
30 struct pci_dev *misc;
Hans Rosenfeld41b26102011-01-24 16:05:42 +010031 struct pci_dev *link;
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020032};
33
Hans Rosenfeldeec1d4f2010-10-29 17:14:30 +020034struct amd_northbridge_info {
Andreas Herrmann900f9ac2010-09-17 18:02:54 +020035 u16 num;
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020036 u64 flags;
37 struct amd_northbridge *nb;
Andreas Herrmann900f9ac2010-09-17 18:02:54 +020038};
Hans Rosenfeldeec1d4f2010-10-29 17:14:30 +020039extern struct amd_northbridge_info amd_northbridges;
Andreas Herrmann900f9ac2010-09-17 18:02:54 +020040
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020041#define AMD_NB_GART 0x1
Hans Rosenfeldf658bcf2010-10-29 17:14:32 +020042#define AMD_NB_L3_INDEX_DISABLE 0x2
Hans Rosenfeldcabb5bd2011-02-07 18:10:39 +010043#define AMD_NB_L3_PARTITIONING 0x4
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020044
Andreas Herrmann23ac4ae2010-09-17 18:03:43 +020045#ifdef CONFIG_AMD_NB
Borislav Petkovade029e2010-04-24 09:56:53 +020046
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020047static inline int amd_nb_num(void)
Jaswinder Singh Rajputb2065252009-04-14 23:04:37 +053048{
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020049 return amd_northbridges.num;
50}
51
52static inline int amd_nb_has_feature(int feature)
53{
54 return ((amd_northbridges.flags & feature) == feature);
55}
56
57static inline struct amd_northbridge *node_to_amd_nb(int node)
58{
59 return (node < amd_northbridges.num) ? &amd_northbridges.nb[node] : NULL;
Jaswinder Singh Rajputb2065252009-04-14 23:04:37 +053060}
Borislav Petkovade029e2010-04-24 09:56:53 +020061
Andreas Herrmannafd9fce2009-04-09 15:16:17 +020062#else
Borislav Petkovade029e2010-04-24 09:56:53 +020063
Hans Rosenfeld9653a5c2010-10-29 17:14:31 +020064#define amd_nb_num(x) 0
65#define amd_nb_has_feature(x) false
66#define node_to_amd_nb(x) NULL
67
Andreas Herrmannafd9fce2009-04-09 15:16:17 +020068#endif
69
70
Andreas Herrmann23ac4ae2010-09-17 18:03:43 +020071#endif /* _ASM_X86_AMD_NB_H */