mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-27 20:07:09 +00:00
76baeebf7d
We use -1 to indicate no node affinity, so we need a signed type here or all sorts of bad things happen, like crashes in dev_attr_show as reported by Ingo: [ 158.058140] warning: `dbus-daemon' uses 32-bit capabilities (legacy support in use) [ 159.370562] BUG: unable to handle kernel NULL pointer dereference at (null) [ 159.372694] IP: [<ffffffff8143b722>] bitmap_scnprintf+0x72/0xd0 [ 159.372694] PGD 71d3e067 PUD 7052e067 PMD 0 [ 159.372694] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC [ 159.372694] last sysfs file: /sys/devices/pci0000:00/0000:00:01.0/local_cpus [ 159.372694] CPU 0 [ 159.372694] Pid: 7364, comm: irqbalance Not tainted 2.6.31-tip #8043 System Product Name [ 159.372694] RIP: 0010:[<ffffffff8143b722>] [<ffffffff8143b722>] bitmap_scnprintf+0x72/0xd0 [ 159.372694] RSP: 0018:ffff8800712a1e38 EFLAGS: 00010246 [ 159.372694] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 [ 159.372694] RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffff880077dc5000 [ 159.372694] RBP: ffff8800712a1e68 R08: 0000000000000001 R09: 0000000000000001 [ 159.372694] R10: ffffffff8215c47c R11: 0000000000000000 R12: 0000000000000000 [ 159.372694] R13: 0000000000000000 R14: 0000000000000ffe R15: ffff880077dc5000 [ 159.372694] FS: 00007f5f578f76f0(0000) GS:ffff880007000000(0000) knlGS:0000000000000000 [ 159.372694] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 159.372694] CR2: 0000000000000000 CR3: 0000000071a77000 CR4: 00000000000006f0 [ 159.372694] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 159.372694] DR3: ffffffff835109dc DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 159.372694] Process irqbalance (pid: 7364, threadinfo ffff8800712a0000, task ffff880070773000) [ 159.372694] Stack: [ 159.372694] 2222222222222222 ffff880077dc5000 fffffffffffffffb ffff88007d366b40 [ 159.372694] <0> ffff8800712a1f48 ffff88007d3840a0 ffff8800712a1e88 ffffffff8146332b [ 159.372694] <0> fffffffffffffff4 ffffffff82450718 ffff8800712a1ea8 ffffffff815a9a1f [ 159.372694] Call Trace: [ 159.372694] [<ffffffff8146332b>] local_cpus_show+0x3b/0x60 [ 159.372694] [<ffffffff815a9a1f>] dev_attr_show+0x2f/0x60 [ 159.372694] [<ffffffff8118ee6f>] sysfs_read_file+0xbf/0x1d0 [ 159.372694] [<ffffffff8112afe9>] vfs_read+0xc9/0x180 [ 159.372694] [<ffffffff8112c365>] sys_read+0x55/0x90 [ 159.372694] [<ffffffff810114f2>] system_call_fastpath+0x16/0x1b [ 159.372694] Code: 41 b9 01 00 00 00 44 8d 46 03 49 63 fc 0f 49 d3 c1 f8 1f 4c 01 ff c1 e8 1a c1 fa 06 41 c1 e8 02 8d 0c 03 48 63 d2 83 e1 3f 29 c1 <49> 8b 44 d5 00 48 c7 c2 8c 37 16 82 48 d3 e8 89 f1 44 89 f6 49 [ 159.372694] RIP [<ffffffff8143b722>] bitmap_scnprintf+0x72/0xd0 [ 159.372694] RSP <ffff8800712a1e38> [ 159.372694] CR2: 0000000000000000 [ 159.600828] ---[ end trace 35550c356e84e60c ]--- Reported-by: Ingo Molnar <mingo@elte.hu> Tested-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
672 lines
15 KiB
C
672 lines
15 KiB
C
/*
|
|
* Low-Level PCI Support for PC
|
|
*
|
|
* (c) 1999--2000 Martin Mares <mj@ucw.cz>
|
|
*/
|
|
|
|
#include <linux/sched.h>
|
|
#include <linux/pci.h>
|
|
#include <linux/ioport.h>
|
|
#include <linux/init.h>
|
|
#include <linux/dmi.h>
|
|
|
|
#include <asm/acpi.h>
|
|
#include <asm/segment.h>
|
|
#include <asm/io.h>
|
|
#include <asm/smp.h>
|
|
#include <asm/pci_x86.h>
|
|
|
|
unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 |
|
|
PCI_PROBE_MMCONF;
|
|
|
|
unsigned int pci_early_dump_regs;
|
|
static int pci_bf_sort;
|
|
int pci_routeirq;
|
|
int noioapicquirk;
|
|
#ifdef CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS
|
|
int noioapicreroute = 0;
|
|
#else
|
|
int noioapicreroute = 1;
|
|
#endif
|
|
int pcibios_last_bus = -1;
|
|
unsigned long pirq_table_addr;
|
|
struct pci_bus *pci_root_bus;
|
|
struct pci_raw_ops *raw_pci_ops;
|
|
struct pci_raw_ops *raw_pci_ext_ops;
|
|
|
|
int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn,
|
|
int reg, int len, u32 *val)
|
|
{
|
|
if (domain == 0 && reg < 256 && raw_pci_ops)
|
|
return raw_pci_ops->read(domain, bus, devfn, reg, len, val);
|
|
if (raw_pci_ext_ops)
|
|
return raw_pci_ext_ops->read(domain, bus, devfn, reg, len, val);
|
|
return -EINVAL;
|
|
}
|
|
|
|
int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn,
|
|
int reg, int len, u32 val)
|
|
{
|
|
if (domain == 0 && reg < 256 && raw_pci_ops)
|
|
return raw_pci_ops->write(domain, bus, devfn, reg, len, val);
|
|
if (raw_pci_ext_ops)
|
|
return raw_pci_ext_ops->write(domain, bus, devfn, reg, len, val);
|
|
return -EINVAL;
|
|
}
|
|
|
|
static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value)
|
|
{
|
|
return raw_pci_read(pci_domain_nr(bus), bus->number,
|
|
devfn, where, size, value);
|
|
}
|
|
|
|
static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value)
|
|
{
|
|
return raw_pci_write(pci_domain_nr(bus), bus->number,
|
|
devfn, where, size, value);
|
|
}
|
|
|
|
struct pci_ops pci_root_ops = {
|
|
.read = pci_read,
|
|
.write = pci_write,
|
|
};
|
|
|
|
/*
|
|
* legacy, numa, and acpi all want to call pcibios_scan_root
|
|
* from their initcalls. This flag prevents that.
|
|
*/
|
|
int pcibios_scanned;
|
|
|
|
/*
|
|
* This interrupt-safe spinlock protects all accesses to PCI
|
|
* configuration space.
|
|
*/
|
|
DEFINE_SPINLOCK(pci_config_lock);
|
|
|
|
static int __devinit can_skip_ioresource_align(const struct dmi_system_id *d)
|
|
{
|
|
pci_probe |= PCI_CAN_SKIP_ISA_ALIGN;
|
|
printk(KERN_INFO "PCI: %s detected, can skip ISA alignment\n", d->ident);
|
|
return 0;
|
|
}
|
|
|
|
static const struct dmi_system_id can_skip_pciprobe_dmi_table[] __devinitconst = {
|
|
/*
|
|
* Systems where PCI IO resource ISA alignment can be skipped
|
|
* when the ISA enable bit in the bridge control is not set
|
|
*/
|
|
{
|
|
.callback = can_skip_ioresource_align,
|
|
.ident = "IBM System x3800",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "x3800"),
|
|
},
|
|
},
|
|
{
|
|
.callback = can_skip_ioresource_align,
|
|
.ident = "IBM System x3850",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "x3850"),
|
|
},
|
|
},
|
|
{
|
|
.callback = can_skip_ioresource_align,
|
|
.ident = "IBM System x3950",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "x3950"),
|
|
},
|
|
},
|
|
{}
|
|
};
|
|
|
|
void __init dmi_check_skip_isa_align(void)
|
|
{
|
|
dmi_check_system(can_skip_pciprobe_dmi_table);
|
|
}
|
|
|
|
static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
|
|
{
|
|
struct resource *rom_r = &dev->resource[PCI_ROM_RESOURCE];
|
|
|
|
if (pci_probe & PCI_NOASSIGN_ROMS) {
|
|
if (rom_r->parent)
|
|
return;
|
|
if (rom_r->start) {
|
|
/* we deal with BIOS assigned ROM later */
|
|
return;
|
|
}
|
|
rom_r->start = rom_r->end = rom_r->flags = 0;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Called after each bus is probed, but before its children
|
|
* are examined.
|
|
*/
|
|
|
|
void __devinit pcibios_fixup_bus(struct pci_bus *b)
|
|
{
|
|
struct pci_dev *dev;
|
|
|
|
/* root bus? */
|
|
if (!b->parent)
|
|
x86_pci_root_bus_res_quirks(b);
|
|
pci_read_bridge_bases(b);
|
|
list_for_each_entry(dev, &b->devices, bus_list)
|
|
pcibios_fixup_device_resources(dev);
|
|
}
|
|
|
|
/*
|
|
* Only use DMI information to set this if nothing was passed
|
|
* on the kernel command line (which was parsed earlier).
|
|
*/
|
|
|
|
static int __devinit set_bf_sort(const struct dmi_system_id *d)
|
|
{
|
|
if (pci_bf_sort == pci_bf_sort_default) {
|
|
pci_bf_sort = pci_dmi_bf;
|
|
printk(KERN_INFO "PCI: %s detected, enabling pci=bfsort.\n", d->ident);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Enable renumbering of PCI bus# ranges to reach all PCI busses (Cardbus)
|
|
*/
|
|
#ifdef __i386__
|
|
static int __devinit assign_all_busses(const struct dmi_system_id *d)
|
|
{
|
|
pci_probe |= PCI_ASSIGN_ALL_BUSSES;
|
|
printk(KERN_INFO "%s detected: enabling PCI bus# renumbering"
|
|
" (pci=assign-busses)\n", d->ident);
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = {
|
|
#ifdef __i386__
|
|
/*
|
|
* Laptops which need pci=assign-busses to see Cardbus cards
|
|
*/
|
|
{
|
|
.callback = assign_all_busses,
|
|
.ident = "Samsung X20 Laptop",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "Samsung Electronics"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "SX20S"),
|
|
},
|
|
},
|
|
#endif /* __i386__ */
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "Dell PowerEdge 1950",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 1950"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "Dell PowerEdge 1955",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 1955"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "Dell PowerEdge 2900",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2900"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "Dell PowerEdge 2950",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2950"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "Dell PowerEdge R900",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R900"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "HP ProLiant BL20p G3",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL20p G3"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "HP ProLiant BL20p G4",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL20p G4"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "HP ProLiant BL30p G1",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL30p G1"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "HP ProLiant BL25p G1",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL25p G1"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "HP ProLiant BL35p G1",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL35p G1"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "HP ProLiant BL45p G1",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL45p G1"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "HP ProLiant BL45p G2",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL45p G2"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "HP ProLiant BL460c G1",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL460c G1"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "HP ProLiant BL465c G1",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL465c G1"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "HP ProLiant BL480c G1",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL480c G1"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "HP ProLiant BL685c G1",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL685c G1"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "HP ProLiant DL360",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL360"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "HP ProLiant DL380",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL380"),
|
|
},
|
|
},
|
|
#ifdef __i386__
|
|
{
|
|
.callback = assign_all_busses,
|
|
.ident = "Compaq EVO N800c",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "EVO N800c"),
|
|
},
|
|
},
|
|
#endif
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "HP ProLiant DL385 G2",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL385 G2"),
|
|
},
|
|
},
|
|
{
|
|
.callback = set_bf_sort,
|
|
.ident = "HP ProLiant DL585 G2",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
|
|
DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL585 G2"),
|
|
},
|
|
},
|
|
{}
|
|
};
|
|
|
|
void __init dmi_check_pciprobe(void)
|
|
{
|
|
dmi_check_system(pciprobe_dmi_table);
|
|
}
|
|
|
|
struct pci_bus * __devinit pcibios_scan_root(int busnum)
|
|
{
|
|
struct pci_bus *bus = NULL;
|
|
struct pci_sysdata *sd;
|
|
|
|
while ((bus = pci_find_next_bus(bus)) != NULL) {
|
|
if (bus->number == busnum) {
|
|
/* Already scanned */
|
|
return bus;
|
|
}
|
|
}
|
|
|
|
/* Allocate per-root-bus (not per bus) arch-specific data.
|
|
* TODO: leak; this memory is never freed.
|
|
* It's arguable whether it's worth the trouble to care.
|
|
*/
|
|
sd = kzalloc(sizeof(*sd), GFP_KERNEL);
|
|
if (!sd) {
|
|
printk(KERN_ERR "PCI: OOM, not probing PCI bus %02x\n", busnum);
|
|
return NULL;
|
|
}
|
|
|
|
sd->node = get_mp_bus_to_node(busnum);
|
|
|
|
printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
|
|
bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd);
|
|
if (!bus)
|
|
kfree(sd);
|
|
|
|
return bus;
|
|
}
|
|
|
|
extern u8 pci_cache_line_size;
|
|
|
|
int __init pcibios_init(void)
|
|
{
|
|
struct cpuinfo_x86 *c = &boot_cpu_data;
|
|
|
|
if (!raw_pci_ops) {
|
|
printk(KERN_WARNING "PCI: System does not support PCI\n");
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Assume PCI cacheline size of 32 bytes for all x86s except K7/K8
|
|
* and P4. It's also good for 386/486s (which actually have 16)
|
|
* as quite a few PCI devices do not support smaller values.
|
|
*/
|
|
pci_cache_line_size = 32 >> 2;
|
|
if (c->x86 >= 6 && c->x86_vendor == X86_VENDOR_AMD)
|
|
pci_cache_line_size = 64 >> 2; /* K7 & K8 */
|
|
else if (c->x86 > 6 && c->x86_vendor == X86_VENDOR_INTEL)
|
|
pci_cache_line_size = 128 >> 2; /* P4 */
|
|
|
|
pcibios_resource_survey();
|
|
|
|
if (pci_bf_sort >= pci_force_bf)
|
|
pci_sort_breadthfirst();
|
|
return 0;
|
|
}
|
|
|
|
char * __devinit pcibios_setup(char *str)
|
|
{
|
|
if (!strcmp(str, "off")) {
|
|
pci_probe = 0;
|
|
return NULL;
|
|
} else if (!strcmp(str, "bfsort")) {
|
|
pci_bf_sort = pci_force_bf;
|
|
return NULL;
|
|
} else if (!strcmp(str, "nobfsort")) {
|
|
pci_bf_sort = pci_force_nobf;
|
|
return NULL;
|
|
}
|
|
#ifdef CONFIG_PCI_BIOS
|
|
else if (!strcmp(str, "bios")) {
|
|
pci_probe = PCI_PROBE_BIOS;
|
|
return NULL;
|
|
} else if (!strcmp(str, "nobios")) {
|
|
pci_probe &= ~PCI_PROBE_BIOS;
|
|
return NULL;
|
|
} else if (!strcmp(str, "biosirq")) {
|
|
pci_probe |= PCI_BIOS_IRQ_SCAN;
|
|
return NULL;
|
|
} else if (!strncmp(str, "pirqaddr=", 9)) {
|
|
pirq_table_addr = simple_strtoul(str+9, NULL, 0);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
#ifdef CONFIG_PCI_DIRECT
|
|
else if (!strcmp(str, "conf1")) {
|
|
pci_probe = PCI_PROBE_CONF1 | PCI_NO_CHECKS;
|
|
return NULL;
|
|
}
|
|
else if (!strcmp(str, "conf2")) {
|
|
pci_probe = PCI_PROBE_CONF2 | PCI_NO_CHECKS;
|
|
return NULL;
|
|
}
|
|
#endif
|
|
#ifdef CONFIG_PCI_MMCONFIG
|
|
else if (!strcmp(str, "nommconf")) {
|
|
pci_probe &= ~PCI_PROBE_MMCONF;
|
|
return NULL;
|
|
}
|
|
else if (!strcmp(str, "check_enable_amd_mmconf")) {
|
|
pci_probe |= PCI_CHECK_ENABLE_AMD_MMCONF;
|
|
return NULL;
|
|
}
|
|
#endif
|
|
else if (!strcmp(str, "noacpi")) {
|
|
acpi_noirq_set();
|
|
return NULL;
|
|
}
|
|
else if (!strcmp(str, "noearly")) {
|
|
pci_probe |= PCI_PROBE_NOEARLY;
|
|
return NULL;
|
|
}
|
|
#ifndef CONFIG_X86_VISWS
|
|
else if (!strcmp(str, "usepirqmask")) {
|
|
pci_probe |= PCI_USE_PIRQ_MASK;
|
|
return NULL;
|
|
} else if (!strncmp(str, "irqmask=", 8)) {
|
|
pcibios_irq_mask = simple_strtol(str+8, NULL, 0);
|
|
return NULL;
|
|
} else if (!strncmp(str, "lastbus=", 8)) {
|
|
pcibios_last_bus = simple_strtol(str+8, NULL, 0);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
else if (!strcmp(str, "rom")) {
|
|
pci_probe |= PCI_ASSIGN_ROMS;
|
|
return NULL;
|
|
} else if (!strcmp(str, "norom")) {
|
|
pci_probe |= PCI_NOASSIGN_ROMS;
|
|
return NULL;
|
|
} else if (!strcmp(str, "assign-busses")) {
|
|
pci_probe |= PCI_ASSIGN_ALL_BUSSES;
|
|
return NULL;
|
|
} else if (!strcmp(str, "use_crs")) {
|
|
pci_probe |= PCI_USE__CRS;
|
|
return NULL;
|
|
} else if (!strcmp(str, "earlydump")) {
|
|
pci_early_dump_regs = 1;
|
|
return NULL;
|
|
} else if (!strcmp(str, "routeirq")) {
|
|
pci_routeirq = 1;
|
|
return NULL;
|
|
} else if (!strcmp(str, "skip_isa_align")) {
|
|
pci_probe |= PCI_CAN_SKIP_ISA_ALIGN;
|
|
return NULL;
|
|
} else if (!strcmp(str, "noioapicquirk")) {
|
|
noioapicquirk = 1;
|
|
return NULL;
|
|
} else if (!strcmp(str, "ioapicreroute")) {
|
|
if (noioapicreroute != -1)
|
|
noioapicreroute = 0;
|
|
return NULL;
|
|
} else if (!strcmp(str, "noioapicreroute")) {
|
|
if (noioapicreroute != -1)
|
|
noioapicreroute = 1;
|
|
return NULL;
|
|
}
|
|
return str;
|
|
}
|
|
|
|
unsigned int pcibios_assign_all_busses(void)
|
|
{
|
|
return (pci_probe & PCI_ASSIGN_ALL_BUSSES) ? 1 : 0;
|
|
}
|
|
|
|
int pcibios_enable_device(struct pci_dev *dev, int mask)
|
|
{
|
|
int err;
|
|
|
|
if ((err = pci_enable_resources(dev, mask)) < 0)
|
|
return err;
|
|
|
|
if (!pci_dev_msi_enabled(dev))
|
|
return pcibios_enable_irq(dev);
|
|
return 0;
|
|
}
|
|
|
|
void pcibios_disable_device (struct pci_dev *dev)
|
|
{
|
|
if (!pci_dev_msi_enabled(dev) && pcibios_disable_irq)
|
|
pcibios_disable_irq(dev);
|
|
}
|
|
|
|
int pci_ext_cfg_avail(struct pci_dev *dev)
|
|
{
|
|
if (raw_pci_ext_ops)
|
|
return 1;
|
|
else
|
|
return 0;
|
|
}
|
|
|
|
struct pci_bus * __devinit pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node)
|
|
{
|
|
struct pci_bus *bus = NULL;
|
|
struct pci_sysdata *sd;
|
|
|
|
/*
|
|
* Allocate per-root-bus (not per bus) arch-specific data.
|
|
* TODO: leak; this memory is never freed.
|
|
* It's arguable whether it's worth the trouble to care.
|
|
*/
|
|
sd = kzalloc(sizeof(*sd), GFP_KERNEL);
|
|
if (!sd) {
|
|
printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busno);
|
|
return NULL;
|
|
}
|
|
sd->node = node;
|
|
bus = pci_scan_bus(busno, ops, sd);
|
|
if (!bus)
|
|
kfree(sd);
|
|
|
|
return bus;
|
|
}
|
|
|
|
struct pci_bus * __devinit pci_scan_bus_with_sysdata(int busno)
|
|
{
|
|
return pci_scan_bus_on_node(busno, &pci_root_ops, -1);
|
|
}
|
|
|
|
/*
|
|
* NUMA info for PCI busses
|
|
*
|
|
* Early arch code is responsible for filling in reasonable values here.
|
|
* A node id of "-1" means "use current node". In other words, if a bus
|
|
* has a -1 node id, it's not tightly coupled to any particular chunk
|
|
* of memory (as is the case on some Nehalem systems).
|
|
*/
|
|
#ifdef CONFIG_NUMA
|
|
|
|
#define BUS_NR 256
|
|
|
|
#ifdef CONFIG_X86_64
|
|
|
|
static int mp_bus_to_node[BUS_NR] = {
|
|
[0 ... BUS_NR - 1] = -1
|
|
};
|
|
|
|
void set_mp_bus_to_node(int busnum, int node)
|
|
{
|
|
if (busnum >= 0 && busnum < BUS_NR)
|
|
mp_bus_to_node[busnum] = node;
|
|
}
|
|
|
|
int get_mp_bus_to_node(int busnum)
|
|
{
|
|
int node = -1;
|
|
|
|
if (busnum < 0 || busnum > (BUS_NR - 1))
|
|
return node;
|
|
|
|
node = mp_bus_to_node[busnum];
|
|
|
|
/*
|
|
* let numa_node_id to decide it later in dma_alloc_pages
|
|
* if there is no ram on that node
|
|
*/
|
|
if (node != -1 && !node_online(node))
|
|
node = -1;
|
|
|
|
return node;
|
|
}
|
|
|
|
#else /* CONFIG_X86_32 */
|
|
|
|
static int mp_bus_to_node[BUS_NR] = {
|
|
[0 ... BUS_NR - 1] = -1
|
|
};
|
|
|
|
void set_mp_bus_to_node(int busnum, int node)
|
|
{
|
|
if (busnum >= 0 && busnum < BUS_NR)
|
|
mp_bus_to_node[busnum] = (unsigned char) node;
|
|
}
|
|
|
|
int get_mp_bus_to_node(int busnum)
|
|
{
|
|
int node;
|
|
|
|
if (busnum < 0 || busnum > (BUS_NR - 1))
|
|
return 0;
|
|
node = mp_bus_to_node[busnum];
|
|
return node;
|
|
}
|
|
|
|
#endif /* CONFIG_X86_32 */
|
|
|
|
#endif /* CONFIG_NUMA */
|