Commit de9b2fcc authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6: (22 commits)
  acpiphp: Link-time error for PCI Hotplug
  shpchp: cleanup shpchp.h
  shpchp: remove shpchprm_get_physical_slot_number
  shpchp: cleanup struct controller
  shpchp: remove unnecessary struct php_ctlr
  PCI: ATI sb600 sata quirk
  PCI legacy resource fix
  PCI: don't export device IDs to userspace
  PCI: Be a bit defensive in quirk_nvidia_ck804() so we don't risk dereferencing a NULL pdev.
  PCI: Fix multiple problems with VIA hardware
  PCI: Only check the HT capability bits in mpic.c
  PCI: Use pci_find_ht_capability() in drivers/pci/quirks.c
  PCI: Add #defines for Hypertransport MSI fields
  PCI: Use pci_find_ht_capability() in drivers/pci/htirq.c
  PCI: Add pci_find_ht_capability() for finding Hypertransport capabilities
  PCI: Create __pci_bus_find_cap_start() from __pci_bus_find_cap()
  pci: Introduce pci_find_present
  PCI: pcieport-driver: remove invalid warning message
  rpaphp: compiler warning cleanup
  PCI quirks: remove redundant check
  ...
parents fb34d203 031f30d2
...@@ -115,7 +115,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, pci ...@@ -115,7 +115,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, pci
#define VIA_8363_KL133_REVISION_ID 0x81 #define VIA_8363_KL133_REVISION_ID 0x81
#define VIA_8363_KM133_REVISION_ID 0x84 #define VIA_8363_KM133_REVISION_ID 0x84
static void __devinit pci_fixup_via_northbridge_bug(struct pci_dev *d) static void pci_fixup_via_northbridge_bug(struct pci_dev *d)
{ {
u8 v; u8 v;
u8 revision; u8 revision;
...@@ -151,6 +151,10 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, pci_fixup_ ...@@ -151,6 +151,10 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, pci_fixup_
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8622, pci_fixup_via_northbridge_bug); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8622, pci_fixup_via_northbridge_bug);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, pci_fixup_via_northbridge_bug); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, pci_fixup_via_northbridge_bug);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8367_0, pci_fixup_via_northbridge_bug); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8367_0, pci_fixup_via_northbridge_bug);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, pci_fixup_via_northbridge_bug);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8622, pci_fixup_via_northbridge_bug);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, pci_fixup_via_northbridge_bug);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8367_0, pci_fixup_via_northbridge_bug);
/* /*
* For some reasons Intel decided that certain parts of their * For some reasons Intel decided that certain parts of their
...@@ -181,7 +185,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_fixup_transparent_ ...@@ -181,7 +185,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_fixup_transparent_
* issue another HALT within 80 ns of the initial HALT, the failure condition * issue another HALT within 80 ns of the initial HALT, the failure condition
* is avoided. * is avoided.
*/ */
static void __init pci_fixup_nforce2(struct pci_dev *dev) static void pci_fixup_nforce2(struct pci_dev *dev)
{ {
u32 val; u32 val;
...@@ -204,6 +208,7 @@ static void __init pci_fixup_nforce2(struct pci_dev *dev) ...@@ -204,6 +208,7 @@ static void __init pci_fixup_nforce2(struct pci_dev *dev)
} }
} }
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2, pci_fixup_nforce2); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2, pci_fixup_nforce2);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2, pci_fixup_nforce2);
/* Max PCI Express root ports */ /* Max PCI Express root ports */
#define MAX_PCIEROOT 6 #define MAX_PCIEROOT 6
...@@ -419,7 +424,7 @@ DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_TI, 0x8032, ...@@ -419,7 +424,7 @@ DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_TI, 0x8032,
* Prevent the BIOS trapping accesses to the Cyrix CS5530A video device * Prevent the BIOS trapping accesses to the Cyrix CS5530A video device
* configuration space. * configuration space.
*/ */
static void __devinit pci_early_fixup_cyrix_5530(struct pci_dev *dev) static void pci_early_fixup_cyrix_5530(struct pci_dev *dev)
{ {
u8 r; u8 r;
/* clear 'F4 Video Configuration Trap' bit */ /* clear 'F4 Video Configuration Trap' bit */
...@@ -429,3 +434,5 @@ static void __devinit pci_early_fixup_cyrix_5530(struct pci_dev *dev) ...@@ -429,3 +434,5 @@ static void __devinit pci_early_fixup_cyrix_5530(struct pci_dev *dev)
} }
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY,
pci_early_fixup_cyrix_5530); pci_early_fixup_cyrix_5530);
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY,
pci_early_fixup_cyrix_5530);
...@@ -390,7 +390,7 @@ static void __init mpic_scan_ht_pic(struct mpic *mpic, u8 __iomem *devbase, ...@@ -390,7 +390,7 @@ static void __init mpic_scan_ht_pic(struct mpic *mpic, u8 __iomem *devbase,
u8 id = readb(devbase + pos + PCI_CAP_LIST_ID); u8 id = readb(devbase + pos + PCI_CAP_LIST_ID);
if (id == PCI_CAP_ID_HT) { if (id == PCI_CAP_ID_HT) {
id = readb(devbase + pos + 3); id = readb(devbase + pos + 3);
if (id == HT_CAPTYPE_IRQ) if ((id & HT_5BIT_CAP_MASK) == HT_CAPTYPE_IRQ)
break; break;
} }
} }
......
...@@ -368,7 +368,6 @@ static struct pci_device_id atiixp_pci_tbl[] = { ...@@ -368,7 +368,6 @@ static struct pci_device_id atiixp_pci_tbl[] = {
{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, PCI_ANY_ID, PCI_ANY_ID, (PCI_CLASS_STORAGE_IDE<<8)|0x8a, 0xffff05, 1},
{ 0, }, { 0, },
}; };
MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl); MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl);
......
...@@ -1682,7 +1682,7 @@ int __init acpiphp_glue_init(void) ...@@ -1682,7 +1682,7 @@ int __init acpiphp_glue_init(void)
* *
* This function frees all data allocated in acpiphp_glue_init() * This function frees all data allocated in acpiphp_glue_init()
*/ */
void __exit acpiphp_glue_exit(void) void acpiphp_glue_exit(void)
{ {
acpi_pci_unregister_driver(&acpi_pci_hp_driver); acpi_pci_unregister_driver(&acpi_pci_hp_driver);
} }
......
...@@ -47,21 +47,11 @@ static ssize_t location_read_file (struct hotplug_slot *php_slot, char *buf) ...@@ -47,21 +47,11 @@ static ssize_t location_read_file (struct hotplug_slot *php_slot, char *buf)
return retval; return retval;
} }
static struct hotplug_slot_attribute hotplug_slot_attr_location = { static struct hotplug_slot_attribute php_attr_location = {
.attr = {.name = "phy_location", .mode = S_IFREG | S_IRUGO}, .attr = {.name = "phy_location", .mode = S_IFREG | S_IRUGO},
.show = location_read_file, .show = location_read_file,
}; };
static void rpaphp_sysfs_add_attr_location (struct hotplug_slot *slot)
{
sysfs_create_file(&slot->kobj, &hotplug_slot_attr_location.attr);
}
static void rpaphp_sysfs_remove_attr_location (struct hotplug_slot *slot)
{
sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_location.attr);
}
/* free up the memory used by a slot */ /* free up the memory used by a slot */
static void rpaphp_release_slot(struct hotplug_slot *hotplug_slot) static void rpaphp_release_slot(struct hotplug_slot *hotplug_slot)
{ {
...@@ -145,7 +135,7 @@ int rpaphp_deregister_slot(struct slot *slot) ...@@ -145,7 +135,7 @@ int rpaphp_deregister_slot(struct slot *slot)
list_del(&slot->rpaphp_slot_list); list_del(&slot->rpaphp_slot_list);
/* remove "phy_location" file */ /* remove "phy_location" file */
rpaphp_sysfs_remove_attr_location(php_slot); sysfs_remove_file(&php_slot->kobj, &php_attr_location.attr);
retval = pci_hp_deregister(php_slot); retval = pci_hp_deregister(php_slot);
if (retval) if (retval)
...@@ -160,36 +150,45 @@ EXPORT_SYMBOL_GPL(rpaphp_deregister_slot); ...@@ -160,36 +150,45 @@ EXPORT_SYMBOL_GPL(rpaphp_deregister_slot);
int rpaphp_register_slot(struct slot *slot) int rpaphp_register_slot(struct slot *slot)
{ {
struct hotplug_slot *php_slot = slot->hotplug_slot;
int retval; int retval;
dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n", dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n",
__FUNCTION__, slot->dn->full_name, slot->index, slot->name, __FUNCTION__, slot->dn->full_name, slot->index, slot->name,
slot->power_domain, slot->type); slot->power_domain, slot->type);
/* should not try to register the same slot twice */ /* should not try to register the same slot twice */
if (is_registered(slot)) { /* should't be here */ if (is_registered(slot)) {
err("rpaphp_register_slot: slot[%s] is already registered\n", slot->name); err("rpaphp_register_slot: slot[%s] is already registered\n", slot->name);
rpaphp_release_slot(slot->hotplug_slot); retval = -EAGAIN;
return -EAGAIN; goto register_fail;
} }
retval = pci_hp_register(slot->hotplug_slot);
retval = pci_hp_register(php_slot);
if (retval) { if (retval) {
err("pci_hp_register failed with error %d\n", retval); err("pci_hp_register failed with error %d\n", retval);
rpaphp_release_slot(slot->hotplug_slot); goto register_fail;
return retval;
} }
/* create "phy_locatoin" file */
rpaphp_sysfs_add_attr_location(slot->hotplug_slot);
/* add slot to our internal list */ /* create "phy_location" file */
dbg("%s adding slot[%s] to rpaphp_slot_list\n", retval = sysfs_create_file(&php_slot->kobj, &php_attr_location.attr);
__FUNCTION__, slot->name); if (retval) {
err("sysfs_create_file failed with error %d\n", retval);
goto sysfs_fail;
}
/* add slot to our internal list */
list_add(&slot->rpaphp_slot_list, &rpaphp_slot_head); list_add(&slot->rpaphp_slot_list, &rpaphp_slot_head);
info("Slot [%s](PCI location=%s) registered\n", slot->name, info("Slot [%s](PCI location=%s) registered\n", slot->name,
slot->location); slot->location);
num_slots++; num_slots++;
return 0; return 0;
sysfs_fail:
pci_hp_deregister(php_slot);
register_fail:
rpaphp_release_slot(php_slot);
return retval;
} }
int rpaphp_get_power_status(struct slot *slot, u8 * value) int rpaphp_get_power_status(struct slot *slot, u8 * value)
......
This diff is collapsed.
...@@ -104,23 +104,6 @@ static void make_slot_name(struct slot *slot) ...@@ -104,23 +104,6 @@ static void make_slot_name(struct slot *slot)
slot->bus, slot->number); slot->bus, slot->number);
} }
static int
shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun,
u8 busnum, u8 devnum)
{
int offset = devnum - ctrl->slot_device_offset;
dbg("%s: ctrl->slot_num_inc %d, offset %d\n", __FUNCTION__,
ctrl->slot_num_inc, offset);
*sun = (u8) (ctrl->first_slot + ctrl->slot_num_inc *offset);
return 0;
}
static int init_slots(struct controller *ctrl) static int init_slots(struct controller *ctrl)
{ {
struct slot *slot; struct slot *slot;
...@@ -128,7 +111,6 @@ static int init_slots(struct controller *ctrl) ...@@ -128,7 +111,6 @@ static int init_slots(struct controller *ctrl)
struct hotplug_slot_info *info; struct hotplug_slot_info *info;
int retval = -ENOMEM; int retval = -ENOMEM;
int i; int i;
u32 sun;
for (i = 0; i < ctrl->num_slots; i++) { for (i = 0; i < ctrl->num_slots; i++) {
slot = kzalloc(sizeof(*slot), GFP_KERNEL); slot = kzalloc(sizeof(*slot), GFP_KERNEL);
...@@ -149,16 +131,11 @@ static int init_slots(struct controller *ctrl) ...@@ -149,16 +131,11 @@ static int init_slots(struct controller *ctrl)
slot->hp_slot = i; slot->hp_slot = i;
slot->ctrl = ctrl; slot->ctrl = ctrl;
slot->bus = ctrl->slot_bus; slot->bus = ctrl->pci_dev->subordinate->number;
slot->device = ctrl->slot_device_offset + i; slot->device = ctrl->slot_device_offset + i;
slot->hpc_ops = ctrl->hpc_ops; slot->hpc_ops = ctrl->hpc_ops;
slot->number = ctrl->first_slot + (ctrl->slot_num_inc * i);
mutex_init(&slot->lock); mutex_init(&slot->lock);
if (shpchprm_get_physical_slot_number(ctrl, &sun,
slot->bus, slot->device))
goto error_info;
slot->number = sun;
INIT_DELAYED_WORK(&slot->work, queue_pushbutton_work); INIT_DELAYED_WORK(&slot->work, queue_pushbutton_work);
/* register this slot with the hotplug pci core */ /* register this slot with the hotplug pci core */
...@@ -211,42 +188,12 @@ void cleanup_slots(struct controller *ctrl) ...@@ -211,42 +188,12 @@ void cleanup_slots(struct controller *ctrl)
} }
} }
static int get_ctlr_slot_config(struct controller *ctrl)
{
int num_ctlr_slots;
int first_device_num;
int physical_slot_num;
int updown;
int rc;
int flags;
rc = shpc_get_ctlr_slot_config(ctrl, &num_ctlr_slots,
&first_device_num, &physical_slot_num,
&updown, &flags);
if (rc) {
err("%s: get_ctlr_slot_config fail for b:d (%x:%x)\n",
__FUNCTION__, ctrl->bus, ctrl->device);
return -1;
}
ctrl->num_slots = num_ctlr_slots;
ctrl->slot_device_offset = first_device_num;
ctrl->first_slot = physical_slot_num;
ctrl->slot_num_inc = updown; /* either -1 or 1 */
dbg("%s: num_slot(0x%x) 1st_dev(0x%x) psn(0x%x) updown(%d) for b:d "
"(%x:%x)\n", __FUNCTION__, num_ctlr_slots, first_device_num,
physical_slot_num, updown, ctrl->bus, ctrl->device);
return 0;
}
/* /*
* set_attention_status - Turns the Amber LED for a slot on, off or blink * set_attention_status - Turns the Amber LED for a slot on, off or blink
*/ */
static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
{ {
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot);
dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
...@@ -258,7 +205,7 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) ...@@ -258,7 +205,7 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
static int enable_slot (struct hotplug_slot *hotplug_slot) static int enable_slot (struct hotplug_slot *hotplug_slot)
{ {
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot);
dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
...@@ -267,7 +214,7 @@ static int enable_slot (struct hotplug_slot *hotplug_slot) ...@@ -267,7 +214,7 @@ static int enable_slot (struct hotplug_slot *hotplug_slot)
static int disable_slot (struct hotplug_slot *hotplug_slot) static int disable_slot (struct hotplug_slot *hotplug_slot)
{ {
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot);
dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
...@@ -276,7 +223,7 @@ static int disable_slot (struct hotplug_slot *hotplug_slot) ...@@ -276,7 +223,7 @@ static int disable_slot (struct hotplug_slot *hotplug_slot)
static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value) static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value)
{ {
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot);
int retval; int retval;
dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
...@@ -290,7 +237,7 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -290,7 +237,7 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value)
static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value) static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value)
{ {
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot);
int retval; int retval;
dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
...@@ -304,7 +251,7 @@ static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -304,7 +251,7 @@ static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value)
static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value) static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value)
{ {
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot);
int retval; int retval;
dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
...@@ -318,7 +265,7 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -318,7 +265,7 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value)
static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value) static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
{ {
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot);
int retval; int retval;
dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
...@@ -332,7 +279,7 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -332,7 +279,7 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
static int get_address (struct hotplug_slot *hotplug_slot, u32 *value) static int get_address (struct hotplug_slot *hotplug_slot, u32 *value)
{ {
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot);
struct pci_bus *bus = slot->ctrl->pci_dev->subordinate; struct pci_bus *bus = slot->ctrl->pci_dev->subordinate;
dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
...@@ -344,7 +291,7 @@ static int get_address (struct hotplug_slot *hotplug_slot, u32 *value) ...@@ -344,7 +291,7 @@ static int get_address (struct hotplug_slot *hotplug_slot, u32 *value)
static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value) static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
{ {
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot);
int retval; int retval;
dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
...@@ -358,7 +305,7 @@ static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp ...@@ -358,7 +305,7 @@ static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp
static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value) static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
{ {
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); struct slot *slot = get_slot(hotplug_slot);
int retval; int retval;
dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
...@@ -385,9 +332,6 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -385,9 +332,6 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
int rc; int rc;
struct controller *ctrl; struct controller *ctrl;
struct slot *t_slot;
int first_device_num; /* first PCI device number */
int num_ctlr_slots; /* number of slots implemented */
if (!is_shpc_capable(pdev)) if (!is_shpc_capable(pdev))
return -ENODEV; return -ENODEV;
...@@ -408,47 +352,13 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -408,47 +352,13 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_set_drvdata(pdev, ctrl); pci_set_drvdata(pdev, ctrl);
ctrl->bus = pdev->bus->number;
ctrl->slot_bus = pdev->subordinate->number;
ctrl->device = PCI_SLOT(pdev->devfn);
ctrl->function = PCI_FUNC(pdev->devfn);
dbg("ctrl bus=0x%x, device=%x, function=%x, irq=%x\n",
ctrl->bus, ctrl->device, ctrl->function, pdev->irq);
/*
* Save configuration headers for this and subordinate PCI buses
*/
rc = get_ctlr_slot_config(ctrl);
if (rc) {
err(msg_initialization_err, rc);
goto err_out_release_ctlr;
}
first_device_num = ctrl->slot_device_offset;
num_ctlr_slots = ctrl->num_slots;
ctrl->add_support = 1;
/* Setup the slot information structures */ /* Setup the slot information structures */
rc = init_slots(ctrl); rc = init_slots(ctrl);
if (rc) { if (rc) {
err(msg_initialization_err, 6); err("%s: slot initialization failed\n", SHPC_MODULE_NAME);
goto err_out_release_ctlr; goto err_out_release_ctlr;
} }
/* Now hpc_functions (slot->hpc_ops->functions) are ready */
t_slot = shpchp_find_slot(ctrl, first_device_num);
/* Check for operation bus speed */
rc = t_slot->hpc_ops->get_cur_bus_speed(t_slot, &ctrl->speed);
dbg("%s: t_slot->hp_slot %x\n", __FUNCTION__,t_slot->hp_slot);
if (rc || ctrl->speed == PCI_SPEED_UNKNOWN) {
err(SHPC_MODULE_NAME ": Can't get current bus speed. "
"Set to 33MHz PCI.\n");
ctrl->speed = PCI_SPEED_33MHz;
}
rc = shpchp_create_ctrl_files(ctrl); rc = shpchp_create_ctrl_files(ctrl);
if (rc) if (rc)
goto err_cleanup_slots; goto err_cleanup_slots;
......
...@@ -57,9 +57,8 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type) ...@@ -57,9 +57,8 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type)
return 0; return 0;
} }
u8 shpchp_handle_attention_button(u8 hp_slot, void *inst_id) u8 shpchp_handle_attention_button(u8 hp_slot, struct controller *ctrl)
{ {
struct controller *ctrl = (struct controller *) inst_id;
struct slot *p_slot; struct slot *p_slot;
u32 event_type; u32 event_type;
...@@ -81,9 +80,8 @@ u8 shpchp_handle_attention_button(u8 hp_slot, void *inst_id) ...@@ -81,9 +80,8 @@ u8 shpchp_handle_attention_button(u8 hp_slot, void *inst_id)
} }
u8 shpchp_handle_switch_change(u8 hp_slot, void *inst_id) u8 shpchp_handle_switch_change(u8 hp_slot, struct controller *ctrl)
{ {
struct controller *ctrl = (struct controller *) inst_id;
struct slot *p_slot; struct slot *p_slot;
u8 getstatus; u8 getstatus;
u32 event_type; u32 event_type;
...@@ -120,9 +118,8 @@ u8 shpchp_handle_switch_change(u8 hp_slot, void *inst_id) ...@@ -120,9 +118,8 @@ u8 shpchp_handle_switch_change(u8 hp_slot, void *inst_id)
return 1; return 1;
} }
u8 shpchp_handle_presence_change(u8 hp_slot, void *inst_id) u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl)
{ {
struct controller *ctrl = (struct controller *) inst_id;
struct slot *p_slot; struct slot *p_slot;
u32 event_type; u32 event_type;
...@@ -154,9 +151,8 @@ u8 shpchp_handle_presence_change(u8 hp_slot, void *inst_id) ...@@ -154,9 +151,8 @@ u8 shpchp_handle_presence_change(u8 hp_slot, void *inst_id)
return 1; return 1;
} }
u8 shpchp_handle_power_fault(u8 hp_slot, void *inst_id) u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl)
{ {
struct controller *ctrl = (struct controller *) inst_id;
struct slot *p_slot; struct slot *p_slot;
u32 event_type; u32 event_type;
...@@ -497,10 +493,12 @@ static void handle_button_press_event(struct slot *p_slot) ...@@ -497,10 +493,12 @@ static void handle_button_press_event(struct slot *p_slot)
p_slot->hpc_ops->get_power_status(p_slot, &getstatus); p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
if (getstatus) { if (getstatus) {
p_slot->state = BLINKINGOFF_STATE; p_slot->state = BLINKINGOFF_STATE;
info(msg_button_off, p_slot->name); info("PCI slot #%s - powering off due to button "
"press.\n", p_slot->name);
} else { } else {
p_slot->state = BLINKINGON_STATE; p_slot->state = BLINKINGON_STATE;
info(msg_button_on, p_slot->name); info("PCI slot #%s - powering on due to button "
"press.\n", p_slot->name);
} }
/* blink green LED and turn off amber */ /* blink green LED and turn off amber */
p_slot->hpc_ops->green_led_blink(p_slot); p_slot->hpc_ops->green_led_blink(p_slot);
...@@ -523,7 +521,8 @@ static void handle_button_press_event(struct slot *p_slot) ...@@ -523,7 +521,8 @@ static void handle_button_press_event(struct slot *p_slot)
else else
p_slot->hpc_ops->green_led_off(p_slot); p_slot->hpc_ops->green_led_off(p_slot);
p_slot->hpc_ops->set_attention_status(p_slot, 0); p_slot->hpc_ops->set_attention_status(p_slot, 0);
info(msg_button_cancel, p_slot->name); info("PCI slot #%s - action canceled due to button press\n",
p_slot->name);
p_slot->state = STATIC_STATE; p_slot->state = STATIC_STATE;
break; break;
case POWEROFF_STATE: case POWEROFF_STATE:
......
This diff is collapsed.
...@@ -99,14 +99,7 @@ int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update) ...@@ -99,14 +99,7 @@ int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update)
int pos; int pos;
int irq; int irq;
pos = pci_find_capability(dev, PCI_CAP_ID_HT); pos = pci_find_ht_capability(dev, HT_CAPTYPE_IRQ);
while (pos) {
u8 subtype;
pci_read_config_byte(dev, pos + 3, &subtype);
if (subtype == HT_CAPTYPE_IRQ)
break;
pos = pci_find_next_capability(dev, pos, PCI_CAP_ID_HT);
}
if (!pos) if (!pos)
return -EINVAL; return -EINVAL;
......
...@@ -162,14 +162,9 @@ const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, ...@@ -162,14 +162,9 @@ const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
const struct pci_device_id *pci_match_device(struct pci_driver *drv, const struct pci_device_id *pci_match_device(struct pci_driver *drv,
struct pci_dev *dev) struct pci_dev *dev)
{ {
const struct pci_device_id *id;
struct pci_dynid *dynid; struct pci_dynid *dynid;
id = pci_match_id(drv->id_table, dev); /* Look at the dynamic ids first, before the static ones */
if (id)
return id;
/* static ids didn't match, lets look at the dynamic ones */
spin_lock(&drv->dynids.lock); spin_lock(&drv->dynids.lock);
list_for_each_entry(dynid, &drv->dynids.list, node) { list_for_each_entry(dynid, &drv->dynids.list, node) {
if (pci_match_one_device(&dynid->id, dev)) { if (pci_match_one_device(&dynid->id, dev)) {
...@@ -178,7 +173,8 @@ const struct pci_device_id *pci_match_device(struct pci_driver *drv, ...@@ -178,7 +173,8 @@ const struct pci_device_id *pci_match_device(struct pci_driver *drv,
} }
} }
spin_unlock(&drv->dynids.lock); spin_unlock(&drv->dynids.lock);
return NULL;
return pci_match_id(drv->id_table, dev);
} }
static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev, static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
...@@ -357,6 +353,8 @@ static int pci_device_resume_early(struct device * dev) ...@@ -357,6 +353,8 @@ static int pci_device_resume_early(struct device * dev)
struct pci_dev * pci_dev = to_pci_dev(dev); struct pci_dev * pci_dev = to_pci_dev(dev);
struct pci_driver * drv = pci_dev->driver; struct pci_driver * drv = pci_dev->driver;
pci_fixup_device(pci_fixup_resume, pci_dev);
if (drv && drv->resume_early) if (drv && drv->resume_early)
error = drv->resume_early(pci_dev); error = drv->resume_early(pci_dev);
return error; return error;
......
...@@ -68,12 +68,14 @@ pci_max_busnr(void) ...@@ -68,12 +68,14 @@ pci_max_busnr(void)
#endif /* 0 */ #endif /* 0 */
static int __pci_find_next_cap(struct pci_bus *bus, unsigned int devfn, u8 pos, int cap) #define PCI_FIND_CAP_TTL 48
static int __pci_find_next_cap_ttl(struct pci_bus *bus, unsigned int devfn,
u8 pos, int cap, int *ttl)
{ {
u8 id; u8 id;
int ttl = 48;
while (ttl--) { while ((*ttl)--) {
pci_bus_read_config_byte(bus, devfn, pos, &pos); pci_bus_read_config_byte(bus, devfn, pos, &pos);
if (pos < 0x40) if (pos < 0x40)
break; break;
...@@ -89,6 +91,14 @@ static int __pci_find_next_cap(struct pci_bus *bus, unsigned int devfn, u8 pos, ...@@ -89,6 +91,14 @@ static int __pci_find_next_cap(struct pci_bus *bus, unsigned int devfn, u8 pos,
return 0; return 0;
} }
static int __pci_find_next_cap(struct pci_bus *bus, unsigned int devfn,
u8 pos, int cap)
{
int ttl = PCI_FIND_CAP_TTL;
return __pci_find_next_cap_ttl(bus, devfn, pos, cap, &ttl);
}
int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap) int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap)
{ {
return __pci_find_next_cap(dev->bus, dev->devfn, return __pci_find_next_cap(dev->bus, dev->devfn,
...@@ -96,10 +106,10 @@ int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap) ...@@ -96,10 +106,10 @@ int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap)
} }
EXPORT_SYMBOL_GPL(pci_find_next_capability); EXPORT_SYMBOL_GPL(pci_find_next_capability);
static int __pci_bus_find_cap(struct pci_bus *bus, unsigned int devfn, u8 hdr_type, int cap) static int __pci_bus_find_cap_start(struct pci_bus *bus,
unsigned int devfn, u8 hdr_type)
{ {
u16 status; u16 status;
u8 pos;
pci_bus_read_config_word(bus, devfn, PCI_STATUS, &status); pci_bus_read_config_word(bus, devfn, PCI_STATUS, &status);
if (!(status & PCI_STATUS_CAP_LIST)) if (!(status & PCI_STATUS_CAP_LIST))
...@@ -108,15 +118,14 @@ static int __pci_bus_find_cap(struct pci_bus *bus, unsigned int devfn, u8 hdr_ty ...@@ -108,15 +118,14 @@ static int __pci_bus_find_cap(struct pci_bus *bus, unsigned int devfn, u8 hdr_ty
switch (hdr_type) { switch (hdr_type) {
case PCI_HEADER_TYPE_NORMAL: case PCI_HEADER_TYPE_NORMAL:
case PCI_HEADER_TYPE_BRIDGE: case PCI_HEADER_TYPE_BRIDGE:
pos = PCI_CAPABILITY_LIST; return PCI_CAPABILITY_LIST;
break;
case PCI_HEADER_TYPE_CARDBUS: case PCI_HEADER_TYPE_CARDBUS:
pos = PCI_CB_CAPABILITY_LIST; return PCI_CB_CAPABILITY_LIST;
break;
default: default:
return 0; return 0;
} }
return __pci_find_next_cap(bus, devfn, pos, cap);
return 0;
} }
/** /**
...@@ -140,7 +149,13 @@ static int __pci_bus_find_cap(struct pci_bus *bus, unsigned int devfn, u8 hdr_ty ...@@ -140,7 +149,13 @@ static int __pci_bus_find_cap(struct pci_bus *bus, unsigned int devfn, u8 hdr_ty
*/ */
int pci_find_capability(struct pci_dev *dev, int cap) int pci_find_capability(struct pci_dev *dev, int cap)
{ {
return __pci_bus_find_cap(dev->bus, dev->devfn, dev->hdr_type, cap); int pos;
pos = __pci_bus_find_cap_start(dev->bus, dev->devfn, dev->hdr_type);
if (pos)
pos = __pci_find_next_cap(dev->bus, dev->devfn, pos, cap);
return pos;
} }
/** /**
...@@ -158,11 +173,16 @@ int pci_find_capability(struct pci_dev *dev, int cap) ...@@ -158,11 +173,16 @@ int pci_find_capability(struct pci_dev *dev, int cap)
*/ */
int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap) int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap)
{ {
int pos;
u8 hdr_type; u8 hdr_type;
pci_bus_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type); pci_bus_read_config_byte(bus, devfn, PCI_HEADER_TYPE, &hdr_type);
return __pci_bus_find_cap(bus, devfn, hdr_type & 0x7f, cap); pos = __pci_bus_find_cap_start(bus, devfn, hdr_type & 0x7f);
if (pos)
pos = __pci_find_next_cap(bus, devfn, pos, cap);
return pos;
} }
/** /**
...@@ -214,6 +234,74 @@ int pci_find_ext_capability(struct pci_dev *dev, int cap) ...@@ -214,6 +234,74 @@ int pci_find_ext_capability(struct pci_dev *dev, int cap)
} }
EXPORT_SYMBOL_GPL(pci_find_ext_capability); EXPORT_SYMBOL_GPL(pci_find_ext_capability);
static int __pci_find_next_ht_cap(struct pci_dev *dev, int pos, int ht_cap)
{
int rc, ttl = PCI_FIND_CAP_TTL;
u8 cap, mask;
if (ht_cap == HT_CAPTYPE_SLAVE || ht_cap == HT_CAPTYPE_HOST)
mask = HT_3BIT_CAP_MASK;
else
mask = HT_5BIT_CAP_MASK;
pos = __pci_find_next_cap_ttl(dev->bus, dev->devfn, pos,
PCI_CAP_ID_HT, &ttl);
while (pos) {
rc = pci_read_config_byte(dev, pos + 3, &cap);
if (rc != PCIBIOS_SUCCESSFUL)
return 0;
if ((cap & mask) == ht_cap)
return pos;
pos = __pci_find_next_cap_ttl(dev->bus, dev->devfn, pos,
PCI_CAP_ID_HT, &ttl);
}
return 0;
}
/**
* pci_find_next_ht_capability - query a device's Hypertransport capabilities
* @dev: PCI device to query
* @pos: Position from which to continue searching
* @ht_cap: Hypertransport capability code
*
* To be used in conjunction with pci_find_ht_capability() to search for
* all capabilities matching @ht_cap. @pos should always be a value returned
* from pci_find_ht_capability().
*
* NB. To be 100% safe against broken PCI devices, the caller should take
* steps to avoid an infinite loop.
*/
int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap)
{
return __pci_find_next_ht_cap(dev, pos + PCI_CAP_LIST_NEXT, ht_cap);
}
EXPORT_SYMBOL_GPL(pci_find_next_ht_capability);
/**
* pci_find_ht_capability - query a device's Hypertransport capabilities
* @dev: PCI device to query
* @ht_cap: Hypertransport capability code
*
* Tell if a device supports a given Hypertransport capability.
* Returns an address within the device's PCI configuration space
* or 0 in case the device does not support the request capability.
* The address points to the PCI capability, of type PCI_CAP_ID_HT,
* which has a Hypertransport capability matching @ht_cap.
*/
int pci_find_ht_capability(struct pci_dev *dev, int ht_cap)
{
int pos;
pos = __pci_bus_find_cap_start(dev->bus, dev->devfn, dev->hdr_type);
if (pos)
pos = __pci_find_next_ht_cap(dev, pos, ht_cap);
return pos;
}
EXPORT_SYMBOL_GPL(pci_find_ht_capability);
/** /**
* pci_find_parent_resource - return resource region of parent bus of given region * pci_find_parent_resource - return resource region of parent bus of given region
* @dev: PCI device structure contains resources to be searched * @dev: PCI device structure contains resources to be searched
......
...@@ -90,7 +90,7 @@ static int __devinit pcie_portdrv_probe (struct pci_dev *dev, ...@@ -90,7 +90,7 @@ static int __devinit pcie_portdrv_probe (struct pci_dev *dev,
return -ENODEV; return -ENODEV;
pci_set_master(dev); pci_set_master(dev);
if (!dev->irq) { if (!dev->irq && dev->pin) {
printk(KERN_WARNING printk(KERN_WARNING
"%s->Dev[%04x:%04x] has invalid IRQ. Check vendor BIOS\n", "%s->Dev[%04x:%04x] has invalid IRQ. Check vendor BIOS\n",
__FUNCTION__, dev->device, dev->vendor); __FUNCTION__, dev->device, dev->vendor);
......
...@@ -649,6 +649,9 @@ static void pci_read_irq(struct pci_dev *dev) ...@@ -649,6 +649,9 @@ static void pci_read_irq(struct pci_dev *dev)
* Returns 0 on success and -1 if unknown type of device (not normal, bridge * Returns 0 on success and -1 if unknown type of device (not normal, bridge
* or CardBus). * or CardBus).
*/ */
#define LEGACY_IO_RESOURCE (IORESOURCE_IO | IORESOURCE_PCI_FIXED)
static int pci_setup_device(struct pci_dev * dev) static int pci_setup_device(struct pci_dev * dev)
{ {
u32 class; u32 class;
...@@ -692,18 +695,18 @@ static int pci_setup_device(struct pci_dev * dev) ...@@ -692,18 +695,18 @@ static int pci_setup_device(struct pci_dev * dev)
if ((progif & 1) == 0) { if ((progif & 1) == 0) {
dev->resource[0].start = 0x1F0; dev->resource[0].start = 0x1F0;
dev->resource[0].end = 0x1F7; dev->resource[0].end = 0x1F7;
dev->resource[0].flags = IORESOURCE_IO; dev->resource[0].flags = LEGACY_IO_RESOURCE;
dev->resource[1].start = 0x3F6; dev->resource[1].start = 0x3F6;
dev->resource[1].end = 0x3F6; dev->resource[1].end = 0x3F6;
dev->resource[1].flags = IORESOURCE_IO; dev->resource[1].flags = LEGACY_IO_RESOURCE;
} }
if ((progif & 4) == 0) { if ((progif & 4) == 0) {
dev->resource[2].start = 0x170; dev->resource[2].start = 0x170;
dev->resource[2].end = 0x177; dev->resource[2].end = 0x177;
dev->resource[2].flags = IORESOURCE_IO; dev->resource[2].flags = LEGACY_IO_RESOURCE;
dev->resource[3].start = 0x376; dev->resource[3].start = 0x376;
dev->resource[3].end = 0x376; dev->resource[3].end = 0x376;
dev->resource[3].flags = IORESOURCE_IO; dev->resource[3].flags = LEGACY_IO_RESOURCE;
} }
} }
break; break;
......
This diff is collapsed.
...@@ -413,6 +413,24 @@ struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from) ...@@ -413,6 +413,24 @@ struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from)
return dev; return dev;
} }
const struct pci_device_id *pci_find_present(const struct pci_device_id *ids)
{
struct pci_dev *dev;
const struct pci_device_id *found = NULL;
WARN_ON(in_interrupt());
down_read(&pci_bus_sem);
while (ids->vendor || ids->subvendor || ids->class_mask) {
list_for_each_entry(dev, &pci_devices, global_list) {
if ((found = pci_match_one_device(ids, dev)) != NULL)
break;
}
ids++;
}
up_read(&pci_bus_sem);
return found;
}
/** /**
* pci_dev_present - Returns 1 if device matching the device list is present, 0 if not. * pci_dev_present - Returns 1 if device matching the device list is present, 0 if not.
* @ids: A pointer to a null terminated list of struct pci_device_id structures * @ids: A pointer to a null terminated list of struct pci_device_id structures
...@@ -426,25 +444,11 @@ struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from) ...@@ -426,25 +444,11 @@ struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from)
*/ */
int pci_dev_present(const struct pci_device_id *ids) int pci_dev_present(const struct pci_device_id *ids)
{ {
struct pci_dev *dev; return pci_find_present(ids) == NULL ? 0 : 1;
int found = 0;
WARN_ON(in_interrupt());
down_read(&pci_bus_sem);
while (ids->vendor || ids->subvendor || ids->class_mask) {
list_for_each_entry(dev, &pci_devices, global_list) {
if (pci_match_one_device(ids, dev)) {
found = 1;
goto exit;
}
}
ids++;
}
exit:
up_read(&pci_bus_sem);
return found;
} }
EXPORT_SYMBOL(pci_dev_present); EXPORT_SYMBOL(pci_dev_present);
EXPORT_SYMBOL(pci_find_present);
EXPORT_SYMBOL(pci_find_device); EXPORT_SYMBOL(pci_find_device);
EXPORT_SYMBOL(pci_find_device_reverse); EXPORT_SYMBOL(pci_find_device_reverse);
......
...@@ -33,11 +33,22 @@ pci_update_resource(struct pci_dev *dev, struct resource *res, int resno) ...@@ -33,11 +33,22 @@ pci_update_resource(struct pci_dev *dev, struct resource *res, int resno)
u32 new, check, mask; u32 new, check, mask;
int reg; int reg;
/* Ignore resources for unimplemented BARs and unused resource slots /*
for 64 bit BARs. */ * Ignore resources for unimplemented BARs and unused resource slots
* for 64 bit BARs.
*/
if (!res->flags) if (!res->flags)
return; return;
/*
* Ignore non-moveable resources. This might be legacy resources for
* which no functional BAR register exists or another important
* system resource we should better not move around in system address
* space.
*/
if (res->flags & IORESOURCE_PCI_FIXED)
return;
pcibios_resource_to_bus(dev, &region, res); pcibios_resource_to_bus(dev, &region, res);
pr_debug(" got res [%llx:%llx] bus [%lx:%lx] flags %lx for " pr_debug(" got res [%llx:%llx] bus [%lx:%lx] flags %lx for "
...@@ -212,6 +223,10 @@ pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) ...@@ -212,6 +223,10 @@ pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
resource_size_t r_align; resource_size_t r_align;
r = &dev->resource[i]; r = &dev->resource[i];
if (r->flags & IORESOURCE_PCI_FIXED)
continue;
r_align = r->end - r->start; r_align = r->end - r->start;
if (!(r->flags) || r->parent) if (!(r->flags) || r->parent)
......
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \ VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
*(.pci_fixup_enable) \ *(.pci_fixup_enable) \
VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \ VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \
*(.pci_fixup_resume) \
VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \
} \ } \
\ \
/* RapidIO route ops */ \ /* RapidIO route ops */ \
......
...@@ -119,7 +119,6 @@ header-y += nfs4_mount.h ...@@ -119,7 +119,6 @@ header-y += nfs4_mount.h
header-y += nfs_mount.h header-y += nfs_mount.h
header-y += oom.h header-y += oom.h
header-y += param.h header-y += param.h
header-y += pci_ids.h
header-y += pci_regs.h header-y += pci_regs.h
header-y += personality.h header-y += personality.h
header-y += pfkeyv2.h header-y += pfkeyv2.h
...@@ -162,7 +161,6 @@ header-y += vt.h ...@@ -162,7 +161,6 @@ header-y += vt.h
header-y += wireless.h header-y += wireless.h
header-y += xattr.h header-y += xattr.h
header-y += x25.h header-y += x25.h
header-y += zorro_ids.h
unifdef-y += acct.h unifdef-y += acct.h
unifdef-y += adb.h unifdef-y += adb.h
......
...@@ -91,6 +91,9 @@ struct resource_list { ...@@ -91,6 +91,9 @@ struct resource_list {
#define IORESOURCE_ROM_COPY (1<<2) /* ROM is alloc'd copy, resource field overlaid */ #define IORESOURCE_ROM_COPY (1<<2) /* ROM is alloc'd copy, resource field overlaid */
#define IORESOURCE_ROM_BIOS_COPY (1<<3) /* ROM is BIOS copy, resource field overlaid */ #define IORESOURCE_ROM_BIOS_COPY (1<<3) /* ROM is BIOS copy, resource field overlaid */
/* PCI control bits. Shares IORESOURCE_BITS with above PCI ROM. */
#define IORESOURCE_PCI_FIXED (1<<4) /* Do not move resource */
/* PC/ISA/whatever - the normal PC address spaces: IO and memory */ /* PC/ISA/whatever - the normal PC address spaces: IO and memory */
extern struct resource ioport_resource; extern struct resource ioport_resource;
extern struct resource iomem_resource; extern struct resource iomem_resource;
......
...@@ -20,9 +20,6 @@ ...@@ -20,9 +20,6 @@
/* Include the pci register defines */ /* Include the pci register defines */
#include <linux/pci_regs.h> #include <linux/pci_regs.h>
/* Include the ID list */
#include <linux/pci_ids.h>
/* /*
* The PCI interface treats multi-function devices as independent * The PCI interface treats multi-function devices as independent
* devices. The slot/function address of each device is encoded * devices. The slot/function address of each device is encoded
...@@ -54,6 +51,9 @@ ...@@ -54,6 +51,9 @@
#include <asm/atomic.h> #include <asm/atomic.h>
#include <linux/device.h> #include <linux/device.h>
/* Include the ID list */
#include <linux/pci_ids.h>
/* File state for mmap()s on /proc/bus/pci/X/Y */ /* File state for mmap()s on /proc/bus/pci/X/Y */
enum pci_mmap_state { enum pci_mmap_state {
pci_mmap_io, pci_mmap_io,
...@@ -396,6 +396,21 @@ struct pci_driver { ...@@ -396,6 +396,21 @@ struct pci_driver {
*/ */
#define pci_module_init pci_register_driver #define pci_module_init pci_register_driver
/**
* PCI_VDEVICE - macro used to describe a specific pci device in short form
* @vend: the vendor name
* @dev: the 16 bit PCI Device ID
*
* This macro is used to create a struct pci_device_id that matches a
* specific PCI device. The subvendor, and subdevice fields will be set
* to PCI_ANY_ID. The macro allows the next field to follow as the device
* private data.
*/
#define PCI_VDEVICE(vendor, device) \
PCI_VENDOR_ID_##vendor, (device), \
PCI_ANY_ID, PCI_ANY_ID, 0, 0
/* these external functions are only available when PCI support is enabled */ /* these external functions are only available when PCI support is enabled */
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
...@@ -454,6 +469,8 @@ struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn); ...@@ -454,6 +469,8 @@ struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn);
int pci_find_capability (struct pci_dev *dev, int cap); int pci_find_capability (struct pci_dev *dev, int cap);
int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap); int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap);
int pci_find_ext_capability (struct pci_dev *dev, int cap); int pci_find_ext_capability (struct pci_dev *dev, int cap);
int pci_find_ht_capability (struct pci_dev *dev, int ht_cap);
int pci_find_next_ht_capability (struct pci_dev *dev, int pos, int ht_cap);
struct pci_bus *pci_find_next_bus(const struct pci_bus *from); struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
...@@ -468,6 +485,7 @@ struct pci_dev *pci_get_slot (struct pci_bus *bus, unsigned int devfn); ...@@ -468,6 +485,7 @@ struct pci_dev *pci_get_slot (struct pci_bus *bus, unsigned int devfn);
struct pci_dev *pci_get_bus_and_slot (unsigned int bus, unsigned int devfn); struct pci_dev *pci_get_bus_and_slot (unsigned int bus, unsigned int devfn);
struct pci_dev *pci_get_class (unsigned int class, struct pci_dev *from); struct pci_dev *pci_get_class (unsigned int class, struct pci_dev *from);
int pci_dev_present(const struct pci_device_id *ids); int pci_dev_present(const struct pci_device_id *ids);
const struct pci_device_id *pci_find_present(const struct pci_device_id *ids);
int pci_bus_read_config_byte (struct pci_bus *bus, unsigned int devfn, int where, u8 *val); int pci_bus_read_config_byte (struct pci_bus *bus, unsigned int devfn, int where, u8 *val);
int pci_bus_read_config_word (struct pci_bus *bus, unsigned int devfn, int where, u16 *val); int pci_bus_read_config_word (struct pci_bus *bus, unsigned int devfn, int where, u16 *val);
...@@ -681,6 +699,7 @@ static inline struct pci_dev *pci_get_class(unsigned int class, struct pci_dev * ...@@ -681,6 +699,7 @@ static inline struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *
{ return NULL; } { return NULL; }
#define pci_dev_present(ids) (0) #define pci_dev_present(ids) (0)
#define pci_find_present(ids) (NULL)
#define pci_dev_put(dev) do { } while (0) #define pci_dev_put(dev) do { } while (0)
static inline void pci_set_master(struct pci_dev *dev) { } static inline void pci_set_master(struct pci_dev *dev) { }
...@@ -783,6 +802,7 @@ enum pci_fixup_pass { ...@@ -783,6 +802,7 @@ enum pci_fixup_pass {
pci_fixup_header, /* After reading configuration header */ pci_fixup_header, /* After reading configuration header */
pci_fixup_final, /* Final phase of device fixups */ pci_fixup_final, /* Final phase of device fixups */
pci_fixup_enable, /* pci_enable_device() time */ pci_fixup_enable, /* pci_enable_device() time */
pci_fixup_resume, /* pci_enable_device() time */
}; };
/* Anonymous variables would be nice... */ /* Anonymous variables would be nice... */
...@@ -801,6 +821,9 @@ enum pci_fixup_pass { ...@@ -801,6 +821,9 @@ enum pci_fixup_pass {
#define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \
DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \
vendor##device##hook, vendor, device, hook) vendor##device##hook, vendor, device, hook)
#define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \
DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \
resume##vendor##device##hook, vendor, device, hook)
void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
......
...@@ -104,6 +104,10 @@ ...@@ -104,6 +104,10 @@
#define PCI_CLASS_SERIAL_FIBER 0x0c04 #define PCI_CLASS_SERIAL_FIBER 0x0c04
#define PCI_CLASS_SERIAL_SMBUS 0x0c05 #define PCI_CLASS_SERIAL_SMBUS 0x0c05
#define PCI_BASE_CLASS_WIRELESS 0x0d
#define PCI_CLASS_WIRELESS_RF_CONTROLLER 0x0d10
#define PCI_CLASS_WIRELESS_WHCI 0x0d1010
#define PCI_BASE_CLASS_INTELLIGENT 0x0e #define PCI_BASE_CLASS_INTELLIGENT 0x0e
#define PCI_CLASS_INTELLIGENT_I2O 0x0e00 #define PCI_CLASS_INTELLIGENT_I2O 0x0e00
......
...@@ -475,15 +475,32 @@ ...@@ -475,15 +475,32 @@
#define PCI_PWR_CAP 12 /* Capability */ #define PCI_PWR_CAP 12 /* Capability */
#define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */
/* Hypertransport sub capability types */ /*
* Hypertransport sub capability types
*
* Unfortunately there are both 3 bit and 5 bit capability types defined
* in the HT spec, catering for that is a little messy. You probably don't
* want to use these directly, just use pci_find_ht_capability() and it
* will do the right thing for you.
*/
#define HT_3BIT_CAP_MASK 0xE0
#define HT_CAPTYPE_SLAVE 0x00 /* Slave/Primary link configuration */ #define HT_CAPTYPE_SLAVE 0x00 /* Slave/Primary link configuration */
#define HT_CAPTYPE_HOST 0x20 /* Host/Secondary link configuration */ #define HT_CAPTYPE_HOST 0x20 /* Host/Secondary link configuration */
#define HT_5BIT_CAP_MASK 0xF8
#define HT_CAPTYPE_IRQ 0x80 /* IRQ Configuration */ #define HT_CAPTYPE_IRQ 0x80 /* IRQ Configuration */
#define HT_CAPTYPE_REMAPPING_40 0xA0 /* 40 bit address remapping */ #define HT_CAPTYPE_REMAPPING_40 0xA0 /* 40 bit address remapping */
#define HT_CAPTYPE_REMAPPING_64 0xA2 /* 64 bit address remapping */ #define HT_CAPTYPE_REMAPPING_64 0xA2 /* 64 bit address remapping */
#define HT_CAPTYPE_UNITID_CLUMP 0x90 /* Unit ID clumping */ #define HT_CAPTYPE_UNITID_CLUMP 0x90 /* Unit ID clumping */
#define HT_CAPTYPE_EXTCONF 0x98 /* Extended Configuration Space Access */ #define HT_CAPTYPE_EXTCONF 0x98 /* Extended Configuration Space Access */
#define HT_CAPTYPE_MSI_MAPPING 0xA8 /* MSI Mapping Capability */ #define HT_CAPTYPE_MSI_MAPPING 0xA8 /* MSI Mapping Capability */
#define HT_MSI_FLAGS 0x02 /* Offset to flags */
#define HT_MSI_FLAGS_ENABLE 0x1 /* Mapping enable */
#define HT_MSI_FLAGS_FIXED 0x2 /* Fixed mapping only */
#define HT_MSI_FIXED_ADDR 0x00000000FEE00000ULL /* Fixed addr */
#define HT_MSI_ADDR_LO 0x04 /* Offset to low addr bits */
#define HT_MSI_ADDR_LO_MASK 0xFFF00000 /* Low address bit mask */
#define HT_MSI_ADDR_HI 0x08 /* Offset to high addr bits */
#define HT_CAPTYPE_DIRECT_ROUTE 0xB0 /* Direct routing configuration */ #define HT_CAPTYPE_DIRECT_ROUTE 0xB0 /* Direct routing configuration */
#define HT_CAPTYPE_VCSET 0xB8 /* Virtual Channel configuration */ #define HT_CAPTYPE_VCSET 0xB8 /* Virtual Channel configuration */
#define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */ #define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment