Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/jbarnes/pci-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
  PCI/cardbus: Add a fixup hook and fix powerpc
  PCI: change PCI nomenclature in drivers/pci/ (non-comment changes)
  PCI: change PCI nomenclature in drivers/pci/ (comment changes)
  PCI: fix section mismatch on update_res()
  PCI: add Intel 82599 Virtual Function specific reset method
  PCI: add Intel USB specific reset method
  PCI: support device-specific reset methods
  PCI: Handle case when no pci device can provide cache line size hint
  PCI/PM: Propagate wake-up enable for PCIe devices too
  vgaarbiter: fix a typo in the vgaarbiter Documentation
  • Loading branch information
Linus Torvalds committed Dec 30, 2009
2 parents b07d41b + 2d1c861 commit d661d76
Show file tree
Hide file tree
Showing 21 changed files with 135 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Documentation/vgaarbiter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ I.2 libpciaccess
----------------

To use the vga arbiter char device it was implemented an API inside the
libpciaccess library. One fieldd was added to struct pci_device (each device
libpciaccess library. One field was added to struct pci_device (each device
on the system):

/* the type of resource decoded by the device */
Expand Down
13 changes: 13 additions & 0 deletions arch/powerpc/kernel/pci-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,12 @@ void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
list_for_each_entry(dev, &bus->devices, bus_list) {
struct dev_archdata *sd = &dev->dev.archdata;

/* Cardbus can call us to add new devices to a bus, so ignore
* those who are already fully discovered
*/
if (dev->is_added)
continue;

/* Setup OF node pointer in archdata */
sd->of_node = pci_device_to_OF_node(dev);

Expand Down Expand Up @@ -1147,6 +1153,13 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
}
EXPORT_SYMBOL(pcibios_fixup_bus);

void __devinit pci_fixup_cardbus(struct pci_bus *bus)
{
/* Now fixup devices on that bus */
pcibios_setup_bus_devices(bus);
}


static int skip_isa_ioresource_align(struct pci_dev *dev)
{
if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) &&
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/pci/bus_numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void x86_pci_root_bus_res_quirks(struct pci_bus *b)
}
}

void __init update_res(struct pci_root_info *info, size_t start,
void __devinit update_res(struct pci_root_info *info, size_t start,
size_t end, unsigned long flags, int merge)
{
int i;
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/hotplug/shpchp.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ struct controller {
#define PCI_DEVICE_ID_AMD_GOLAM_7450 0x7450
#define PCI_DEVICE_ID_AMD_POGO_7458 0x7458

/* AMD PCIX bridge registers */
/* AMD PCI-X bridge registers */
#define PCIX_MEM_BASE_LIMIT_OFFSET 0x1C
#define PCIX_MISCII_OFFSET 0x48
#define PCIX_MISC_BRIDGE_ERRORS_OFFSET 0x80
Expand Down
6 changes: 3 additions & 3 deletions drivers/pci/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ struct device_domain_info {
int segment; /* PCI domain */
u8 bus; /* PCI bus number */
u8 devfn; /* PCI devfn number */
struct pci_dev *dev; /* it's NULL for PCIE-to-PCI bridge */
struct pci_dev *dev; /* it's NULL for PCIe-to-PCI bridge */
struct intel_iommu *iommu; /* IOMMU used by this device */
struct dmar_domain *domain; /* pointer to domain */
};
Expand Down Expand Up @@ -1604,7 +1604,7 @@ domain_context_mapping(struct dmar_domain *domain, struct pci_dev *pdev,
return ret;
parent = parent->bus->self;
}
if (pci_is_pcie(tmp)) /* this is a PCIE-to-PCI bridge */
if (pci_is_pcie(tmp)) /* this is a PCIe-to-PCI bridge */
return domain_context_mapping_one(domain,
pci_domain_nr(tmp->subordinate),
tmp->subordinate->number, 0,
Expand Down Expand Up @@ -3325,7 +3325,7 @@ static void iommu_detach_dependent_devices(struct intel_iommu *iommu,
parent->devfn);
parent = parent->bus->self;
}
if (pci_is_pcie(tmp)) /* this is a PCIE-to-PCI bridge */
if (pci_is_pcie(tmp)) /* this is a PCIe-to-PCI bridge */
iommu_detach_dev(iommu,
tmp->subordinate->number, 0);
else /* this is a legacy PCI bridge */
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/intr_remapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ int set_msi_sid(struct irte *irte, struct pci_dev *dev)

bridge = pci_find_upstream_pcie_bridge(dev);
if (bridge) {
if (pci_is_pcie(bridge))/* this is a PCIE-to-PCI/PCIX bridge */
if (pci_is_pcie(bridge))/* this is a PCIe-to-PCI/PCIX bridge */
set_irte_sid(irte, SVT_VERIFY_BUS, SQ_ALL_16,
(bridge->bus->number << 8) | dev->bus->number);
else /* this is a legacy PCI bridge */
Expand Down
10 changes: 2 additions & 8 deletions drivers/pci/pci-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,7 @@ static bool acpi_pci_can_wakeup(struct pci_dev *dev)
static void acpi_pci_propagate_wakeup_enable(struct pci_bus *bus, bool enable)
{
while (bus->parent) {
struct pci_dev *bridge = bus->self;
int ret;

ret = acpi_pm_device_sleep_wake(&bridge->dev, enable);
if (!ret || pci_is_pcie(bridge))
if (!acpi_pm_device_sleep_wake(&bus->self->dev, enable))
return;
bus = bus->parent;
}
Expand All @@ -131,9 +127,7 @@ static int acpi_pci_sleep_wake(struct pci_dev *dev, bool enable)
if (acpi_pci_can_wakeup(dev))
return acpi_pm_device_sleep_wake(&dev->dev, enable);

if (!pci_is_pcie(dev))
acpi_pci_propagate_wakeup_enable(dev->bus, enable);

acpi_pci_propagate_wakeup_enable(dev->bus, enable);
return 0;
}

Expand Down
30 changes: 27 additions & 3 deletions drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1153,11 +1153,11 @@ pci_disable_device(struct pci_dev *dev)

/**
* pcibios_set_pcie_reset_state - set reset state for device dev
* @dev: the PCI-E device reset
* @dev: the PCIe device reset
* @state: Reset state to enter into
*
*
* Sets the PCI-E reset state for the device. This is the default
* Sets the PCIe reset state for the device. This is the default
* implementation. Architecture implementations can override this.
*/
int __attribute__ ((weak)) pcibios_set_pcie_reset_state(struct pci_dev *dev,
Expand All @@ -1168,7 +1168,7 @@ int __attribute__ ((weak)) pcibios_set_pcie_reset_state(struct pci_dev *dev,

/**
* pci_set_pcie_reset_state - set reset state for device dev
* @dev: the PCI-E device reset
* @dev: the PCIe device reset
* @state: Reset state to enter into
*
*
Expand Down Expand Up @@ -2284,6 +2284,21 @@ static int pci_parent_bus_reset(struct pci_dev *dev, int probe)
return 0;
}

static int pci_dev_specific_reset(struct pci_dev *dev, int probe)
{
struct pci_dev_reset_methods *i;

for (i = pci_dev_reset_methods; i->reset; i++) {
if ((i->vendor == dev->vendor ||
i->vendor == (u16)PCI_ANY_ID) &&
(i->device == dev->device ||
i->device == (u16)PCI_ANY_ID))
return i->reset(dev, probe);
}

return -ENOTTY;
}

static int pci_dev_reset(struct pci_dev *dev, int probe)
{
int rc;
Expand All @@ -2296,6 +2311,10 @@ static int pci_dev_reset(struct pci_dev *dev, int probe)
down(&dev->dev.sem);
}

rc = pci_dev_specific_reset(dev, probe);
if (rc != -ENOTTY)
goto done;

rc = pcie_flr(dev, probe);
if (rc != -ENOTTY)
goto done;
Expand Down Expand Up @@ -2779,6 +2798,11 @@ int __attribute__ ((weak)) pci_ext_cfg_avail(struct pci_dev *dev)
return 1;
}

void __weak pci_fixup_cardbus(struct pci_bus *bus)
{
}
EXPORT_SYMBOL(pci_fixup_cardbus);

static int __init pci_setup(char *str)
{
while (str) {
Expand Down
8 changes: 8 additions & 0 deletions drivers/pci/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,4 +313,12 @@ static inline int pci_resource_alignment(struct pci_dev *dev,

extern void pci_enable_acs(struct pci_dev *dev);

struct pci_dev_reset_methods {
u16 vendor;
u16 device;
int (*reset)(struct pci_dev *dev, int probe);
};

extern struct pci_dev_reset_methods pci_dev_reset_methods[];

#endif /* DRIVERS_PCI_H */
4 changes: 2 additions & 2 deletions drivers/pci/pcie/aer/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
#

config PCIEAER_INJECT
tristate "PCIE AER error injector support"
tristate "PCIe AER error injector support"
depends on PCIEAER
default n
help
This enables PCI Express Root Port Advanced Error Reporting
(AER) software error injector.

Debuging PCIE AER code is quite difficult because it is hard
Debugging PCIe AER code is quite difficult because it is hard
to trigger various real hardware errors. Software based
error injection can fake almost all kinds of errors with the
help of a user space helper tool aer-inject, which can be
Expand Down
6 changes: 3 additions & 3 deletions drivers/pci/pcie/aer/aer_inject.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* PCIE AER software error injection support.
* PCIe AER software error injection support.
*
* Debuging PCIE AER code is quite difficult because it is hard to
* Debuging PCIe AER code is quite difficult because it is hard to
* trigger various real hardware errors. Software based error
* injection can fake almost all kinds of errors with the help of a
* user space helper tool aer-inject, which can be gotten from:
Expand Down Expand Up @@ -484,5 +484,5 @@ static void __exit aer_inject_exit(void)
module_init(aer_inject_init);
module_exit(aer_inject_exit);

MODULE_DESCRIPTION("PCIE AER software error injector");
MODULE_DESCRIPTION("PCIe AER software error injector");
MODULE_LICENSE("GPL");
2 changes: 1 addition & 1 deletion drivers/pci/pcie/aer/aerdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ static struct aer_rpc *aer_alloc_rpc(struct pcie_device *dev)
mutex_init(&rpc->rpc_mutex);
init_waitqueue_head(&rpc->wait_release);

/* Use PCIE bus function to store rpc into PCIE device */
/* Use PCIe bus function to store rpc into PCIe device */
set_service_data(dev, rpc);

return rpc;
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/pcie/aer/aerdrv_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @return: Zero on success. Nonzero otherwise.
*
* Invoked when PCIE bus loads AER service driver. To avoid conflict with
* Invoked when PCIe bus loads AER service driver. To avoid conflict with
* BIOS AER support requires BIOS to yield AER control to OS native driver.
**/
int aer_osc_setup(struct pcie_device *pciedev)
Expand Down
6 changes: 3 additions & 3 deletions drivers/pci/pcie/aer/aerdrv_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ static void handle_error_source(struct pcie_device *aerdev,
* aer_enable_rootport - enable Root Port's interrupts when receiving messages
* @rpc: pointer to a Root Port data structure
*
* Invoked when PCIE bus loads AER service driver.
* Invoked when PCIe bus loads AER service driver.
*/
void aer_enable_rootport(struct aer_rpc *rpc)
{
Expand All @@ -597,7 +597,7 @@ void aer_enable_rootport(struct aer_rpc *rpc)
u32 reg32;

pos = pci_pcie_cap(pdev);
/* Clear PCIE Capability's Device Status */
/* Clear PCIe Capability's Device Status */
pci_read_config_word(pdev, pos+PCI_EXP_DEVSTA, &reg16);
pci_write_config_word(pdev, pos+PCI_EXP_DEVSTA, reg16);

Expand Down Expand Up @@ -631,7 +631,7 @@ void aer_enable_rootport(struct aer_rpc *rpc)
* disable_root_aer - disable Root Port's interrupts when receiving messages
* @rpc: pointer to a Root Port data structure
*
* Invoked when PCIE bus unloads AER service driver.
* Invoked when PCIe bus unloads AER service driver.
*/
static void disable_root_aer(struct aer_rpc *rpc)
{
Expand Down
4 changes: 2 additions & 2 deletions drivers/pci/pcie/aer/aerdrv_errprint.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)

if (info->status == 0) {
AER_PR(info, dev,
"PCIE Bus Error: severity=%s, type=Unaccessible, "
"PCIe Bus Error: severity=%s, type=Unaccessible, "
"id=%04x(Unregistered Agent ID)\n",
aer_error_severity_string[info->severity], id);
} else {
Expand All @@ -194,7 +194,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
agent = AER_GET_AGENT(info->severity, info->status);

AER_PR(info, dev,
"PCIE Bus Error: severity=%s, type=%s, id=%04x(%s)\n",
"PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n",
aer_error_severity_string[info->severity],
aer_error_layer[layer], id, aer_agent_string[agent]);

Expand Down
4 changes: 2 additions & 2 deletions drivers/pci/pcie/aspm.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* File: drivers/pci/pcie/aspm.c
* Enabling PCIE link L0s/L1 state and Clock Power Management
* Enabling PCIe link L0s/L1 state and Clock Power Management
*
* Copyright (C) 2007 Intel
* Copyright (C) Zhang Yanmin (yanmin.zhang@intel.com)
Expand Down Expand Up @@ -499,7 +499,7 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
int pos;
u32 reg32;
/*
* Some functions in a slot might not all be PCIE functions,
* Some functions in a slot might not all be PCIe functions,
* very strange. Disable ASPM for the whole slot
*/
list_for_each_entry(child, &pdev->subordinate->devices, bus_list) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/pcie/portdrv_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
#define DRIVER_VERSION "v1.0"
#define DRIVER_AUTHOR "tom.l.nguyen@intel.com"
#define DRIVER_DESC "PCIE Port Bus Driver"
#define DRIVER_DESC "PCIe Port Bus Driver"
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
Expand Down
57 changes: 56 additions & 1 deletion drivers/pci/quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -2629,13 +2629,68 @@ static int __init pci_apply_final_quirks(void)
if (!pci_cache_line_size) {
printk(KERN_DEBUG "PCI: CLS %u bytes, default %u\n",
cls << 2, pci_dfl_cache_line_size << 2);
pci_cache_line_size = cls;
pci_cache_line_size = cls ? cls : pci_dfl_cache_line_size;
}

return 0;
}

fs_initcall_sync(pci_apply_final_quirks);

/*
* Followings are device-specific reset methods which can be used to
* reset a single function if other methods (e.g. FLR, PM D0->D3) are
* not available.
*/
static int reset_intel_generic_dev(struct pci_dev *dev, int probe)
{
int pos;

/* only implement PCI_CLASS_SERIAL_USB at present */
if (dev->class == PCI_CLASS_SERIAL_USB) {
pos = pci_find_capability(dev, PCI_CAP_ID_VNDR);
if (!pos)
return -ENOTTY;

if (probe)
return 0;

pci_write_config_byte(dev, pos + 0x4, 1);
msleep(100);

return 0;
} else {
return -ENOTTY;
}
}

static int reset_intel_82599_sfp_virtfn(struct pci_dev *dev, int probe)
{
int pos;

pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
if (!pos)
return -ENOTTY;

if (probe)
return 0;

pci_write_config_word(dev, pos + PCI_EXP_DEVCTL,
PCI_EXP_DEVCTL_BCR_FLR);
msleep(100);

return 0;
}

#define PCI_DEVICE_ID_INTEL_82599_SFP_VF 0x10ed

struct pci_dev_reset_methods pci_dev_reset_methods[] = {
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82599_SFP_VF,
reset_intel_82599_sfp_virtfn },
{ PCI_VENDOR_ID_INTEL, PCI_ANY_ID,
reset_intel_generic_dev },
{ 0 }
};
#else
void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {}
#endif
Expand Down
Loading

0 comments on commit d661d76

Please sign in to comment.