2010-09-17 23:03:43 +07:00
|
|
|
#ifndef _ASM_X86_AMD_NB_H
|
|
|
|
#define _ASM_X86_AMD_NB_H
|
2006-06-26 18:56:40 +07:00
|
|
|
|
2012-01-06 04:27:19 +07:00
|
|
|
#include <linux/ioport.h>
|
2006-06-26 18:56:40 +07:00
|
|
|
#include <linux/pci.h>
|
|
|
|
|
2011-01-10 23:20:23 +07:00
|
|
|
struct amd_nb_bus_dev_range {
|
|
|
|
u8 bus;
|
|
|
|
u8 dev_base;
|
|
|
|
u8 dev_limit;
|
|
|
|
};
|
|
|
|
|
2011-02-09 15:26:53 +07:00
|
|
|
extern const struct pci_device_id amd_nb_misc_ids[];
|
2011-01-10 23:20:23 +07:00
|
|
|
extern const struct amd_nb_bus_dev_range amd_nb_bus_dev_ranges[];
|
2006-06-26 18:56:40 +07:00
|
|
|
|
2011-03-03 18:59:32 +07:00
|
|
|
extern bool early_is_amd_nb(u32 value);
|
2012-01-06 04:27:19 +07:00
|
|
|
extern struct resource *amd_get_mmconfig_range(struct resource *res);
|
2010-10-29 22:14:31 +07:00
|
|
|
extern int amd_cache_northbridges(void);
|
2010-10-29 22:14:30 +07:00
|
|
|
extern void amd_flush_garts(void);
|
2011-02-16 18:13:06 +07:00
|
|
|
extern int amd_numa_init(void);
|
2011-02-08 00:10:39 +07:00
|
|
|
extern int amd_get_subcaches(int);
|
2014-01-21 14:22:09 +07:00
|
|
|
extern int amd_set_subcaches(int, unsigned long);
|
2006-06-26 18:56:40 +07:00
|
|
|
|
2011-07-24 16:46:09 +07:00
|
|
|
struct amd_l3_cache {
|
|
|
|
unsigned indices;
|
|
|
|
u8 subcaches[4];
|
|
|
|
};
|
|
|
|
|
2012-05-02 22:16:59 +07:00
|
|
|
struct threshold_block {
|
|
|
|
unsigned int block;
|
|
|
|
unsigned int bank;
|
|
|
|
unsigned int cpu;
|
|
|
|
u32 address;
|
|
|
|
u16 interrupt_enable;
|
|
|
|
bool interrupt_capable;
|
|
|
|
u16 threshold_limit;
|
|
|
|
struct kobject kobj;
|
|
|
|
struct list_head miscj;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct threshold_bank {
|
|
|
|
struct kobject *kobj;
|
|
|
|
struct threshold_block *blocks;
|
|
|
|
|
|
|
|
/* initialized to the number of CPUs on the node sharing this bank */
|
|
|
|
atomic_t cpus;
|
|
|
|
};
|
|
|
|
|
2010-10-29 22:14:31 +07:00
|
|
|
struct amd_northbridge {
|
|
|
|
struct pci_dev *misc;
|
2011-01-24 22:05:42 +07:00
|
|
|
struct pci_dev *link;
|
2011-07-24 16:46:09 +07:00
|
|
|
struct amd_l3_cache l3_cache;
|
2012-05-02 22:16:59 +07:00
|
|
|
struct threshold_bank *bank4;
|
2010-10-29 22:14:31 +07:00
|
|
|
};
|
|
|
|
|
2010-10-29 22:14:30 +07:00
|
|
|
struct amd_northbridge_info {
|
2010-09-17 23:02:54 +07:00
|
|
|
u16 num;
|
2010-10-29 22:14:31 +07:00
|
|
|
u64 flags;
|
|
|
|
struct amd_northbridge *nb;
|
2010-09-17 23:02:54 +07:00
|
|
|
};
|
2010-10-29 22:14:30 +07:00
|
|
|
extern struct amd_northbridge_info amd_northbridges;
|
2010-09-17 23:02:54 +07:00
|
|
|
|
2011-03-03 18:59:32 +07:00
|
|
|
#define AMD_NB_GART BIT(0)
|
|
|
|
#define AMD_NB_L3_INDEX_DISABLE BIT(1)
|
|
|
|
#define AMD_NB_L3_PARTITIONING BIT(2)
|
2010-10-29 22:14:31 +07:00
|
|
|
|
2010-09-17 23:03:43 +07:00
|
|
|
#ifdef CONFIG_AMD_NB
|
2010-04-24 14:56:53 +07:00
|
|
|
|
2011-03-03 18:59:32 +07:00
|
|
|
static inline u16 amd_nb_num(void)
|
2009-04-15 00:34:37 +07:00
|
|
|
{
|
2010-10-29 22:14:31 +07:00
|
|
|
return amd_northbridges.num;
|
2009-04-15 00:34:37 +07:00
|
|
|
}
|
2010-04-24 14:56:53 +07:00
|
|
|
|
2011-03-03 18:59:32 +07:00
|
|
|
static inline bool amd_nb_has_feature(unsigned feature)
|
2010-10-29 22:14:31 +07:00
|
|
|
{
|
|
|
|
return ((amd_northbridges.flags & feature) == feature);
|
|
|
|
}
|
2010-04-24 14:56:53 +07:00
|
|
|
|
2010-10-29 22:14:31 +07:00
|
|
|
static inline struct amd_northbridge *node_to_amd_nb(int node)
|
2009-04-15 00:34:37 +07:00
|
|
|
{
|
2010-10-29 22:14:31 +07:00
|
|
|
return (node < amd_northbridges.num) ? &amd_northbridges.nb[node] : NULL;
|
2009-04-15 00:34:37 +07:00
|
|
|
}
|
2010-10-29 22:14:31 +07:00
|
|
|
|
2012-11-27 13:32:09 +07:00
|
|
|
static inline u16 amd_get_node_id(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
struct pci_dev *misc;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i != amd_nb_num(); i++) {
|
|
|
|
misc = node_to_amd_nb(i)->misc;
|
|
|
|
|
|
|
|
if (pci_domain_nr(misc->bus) == pci_domain_nr(pdev->bus) &&
|
|
|
|
PCI_SLOT(misc->devfn) == PCI_SLOT(pdev->devfn))
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN(1, "Unable to find AMD Northbridge id for %s\n", pci_name(pdev));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-10-29 22:14:31 +07:00
|
|
|
#else
|
|
|
|
|
|
|
|
#define amd_nb_num(x) 0
|
|
|
|
#define amd_nb_has_feature(x) false
|
|
|
|
#define node_to_amd_nb(x) NULL
|
|
|
|
|
2009-04-09 20:16:17 +07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2010-09-17 23:03:43 +07:00
|
|
|
#endif /* _ASM_X86_AMD_NB_H */
|