2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* File: portdrv.h
|
|
|
|
* Purpose: PCI Express Port Bus Driver's Internal Data Structures
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 Intel
|
|
|
|
* Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _PORTDRV_H_
|
|
|
|
#define _PORTDRV_H_
|
|
|
|
|
2006-09-26 07:52:20 +08:00
|
|
|
#include <linux/compiler.h>
|
|
|
|
|
2009-11-25 20:06:51 +08:00
|
|
|
#define PCIE_PORT_DEVICE_MAXSERVICES 4
|
2009-01-24 07:23:22 +08:00
|
|
|
/*
|
2009-11-25 20:06:51 +08:00
|
|
|
* According to the PCI Express Base Specification 2.0, the indices of
|
|
|
|
* the MSI-X table entires used by port services must not exceed 31
|
2009-01-24 07:23:22 +08:00
|
|
|
*/
|
|
|
|
#define PCIE_PORT_MAX_MSIX_ENTRIES 32
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define get_descriptor_id(type, service) (((type - 4) << 4) | service)
|
|
|
|
|
|
|
|
extern struct bus_type pcie_port_bus_type;
|
|
|
|
extern int pcie_port_device_register(struct pci_dev *dev);
|
|
|
|
#ifdef CONFIG_PM
|
2009-02-16 05:32:48 +08:00
|
|
|
extern int pcie_port_device_suspend(struct device *dev);
|
|
|
|
extern int pcie_port_device_resume(struct device *dev);
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|
|
|
|
extern void pcie_port_device_remove(struct pci_dev *dev);
|
2006-09-26 07:52:20 +08:00
|
|
|
extern int __must_check pcie_port_bus_register(void);
|
2005-04-17 06:20:36 +08:00
|
|
|
extern void pcie_port_bus_unregister(void);
|
|
|
|
|
PCI: PCIe: Ask BIOS for control of all native services at once
After commit 852972acff8f10f3a15679be2059bb94916cba5d (ACPI: Disable
ASPM if the platform won't provide _OSC control for PCIe) control of
the PCIe Capability Structure is unconditionally requested by
acpi_pci_root_add(), which in principle may cause problems to
happen in two ways. First, the BIOS may refuse to give control of
the PCIe Capability Structure if it is not asked for any of the
_OSC features depending on it at the same time. Second, the BIOS may
assume that control of the _OSC features depending on the PCIe
Capability Structure will be requested in the future and may behave
incorrectly if that doesn't happen. For this reason, control of
the PCIe Capability Structure should always be requested along with
control of any other _OSC features that may depend on it (ie. PCIe
native PME, PCIe native hot-plug, PCIe AER).
Rework the PCIe port driver so that (1) it checks which native PCIe
port services can be enabled, according to the BIOS, and (2) it
requests control of all these services simultaneously. In
particular, this causes pcie_portdrv_probe() to fail if the BIOS
refuses to grant control of the PCIe Capability Structure, which
means that no native PCIe port services can be enabled for the PCIe
Root Complex the given port belongs to. If that happens, ASPM is
disabled to avoid problems with mishandling it by the part of the
PCIe hierarchy for which control of the PCIe Capability Structure
has not been received.
Make it possible to override this behavior using 'pcie_ports=native'
(use the PCIe native services regardless of the BIOS response to the
control request), or 'pcie_ports=compat' (do not use the PCIe native
services at all).
Accordingly, rework the existing PCIe port service drivers so that
they don't request control of the services directly.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-08-22 04:02:38 +08:00
|
|
|
struct pci_dev;
|
|
|
|
|
2010-12-19 22:57:16 +08:00
|
|
|
extern void pcie_clear_root_pme_status(struct pci_dev *dev);
|
|
|
|
|
2012-02-03 00:09:22 +08:00
|
|
|
#ifdef CONFIG_HOTPLUG_PCI_PCIE
|
|
|
|
extern bool pciehp_msi_disabled;
|
|
|
|
|
|
|
|
static inline bool pciehp_no_msi(void)
|
|
|
|
{
|
|
|
|
return pciehp_msi_disabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else /* !CONFIG_HOTPLUG_PCI_PCIE */
|
|
|
|
static inline bool pciehp_no_msi(void) { return false; }
|
|
|
|
#endif /* !CONFIG_HOTPLUG_PCI_PCIE */
|
|
|
|
|
2010-02-18 06:40:07 +08:00
|
|
|
#ifdef CONFIG_PCIE_PME
|
|
|
|
extern bool pcie_pme_msi_disabled;
|
|
|
|
|
|
|
|
static inline void pcie_pme_disable_msi(void)
|
|
|
|
{
|
|
|
|
pcie_pme_msi_disabled = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool pcie_pme_no_msi(void)
|
|
|
|
{
|
|
|
|
return pcie_pme_msi_disabled;
|
|
|
|
}
|
PCI: PCIe: Ask BIOS for control of all native services at once
After commit 852972acff8f10f3a15679be2059bb94916cba5d (ACPI: Disable
ASPM if the platform won't provide _OSC control for PCIe) control of
the PCIe Capability Structure is unconditionally requested by
acpi_pci_root_add(), which in principle may cause problems to
happen in two ways. First, the BIOS may refuse to give control of
the PCIe Capability Structure if it is not asked for any of the
_OSC features depending on it at the same time. Second, the BIOS may
assume that control of the _OSC features depending on the PCIe
Capability Structure will be requested in the future and may behave
incorrectly if that doesn't happen. For this reason, control of
the PCIe Capability Structure should always be requested along with
control of any other _OSC features that may depend on it (ie. PCIe
native PME, PCIe native hot-plug, PCIe AER).
Rework the PCIe port driver so that (1) it checks which native PCIe
port services can be enabled, according to the BIOS, and (2) it
requests control of all these services simultaneously. In
particular, this causes pcie_portdrv_probe() to fail if the BIOS
refuses to grant control of the PCIe Capability Structure, which
means that no native PCIe port services can be enabled for the PCIe
Root Complex the given port belongs to. If that happens, ASPM is
disabled to avoid problems with mishandling it by the part of the
PCIe hierarchy for which control of the PCIe Capability Structure
has not been received.
Make it possible to override this behavior using 'pcie_ports=native'
(use the PCIe native services regardless of the BIOS response to the
control request), or 'pcie_ports=compat' (do not use the PCIe native
services at all).
Accordingly, rework the existing PCIe port service drivers so that
they don't request control of the services directly.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-08-22 04:02:38 +08:00
|
|
|
|
|
|
|
extern void pcie_pme_interrupt_enable(struct pci_dev *dev, bool enable);
|
2010-02-18 06:40:07 +08:00
|
|
|
#else /* !CONFIG_PCIE_PME */
|
|
|
|
static inline void pcie_pme_disable_msi(void) {}
|
|
|
|
static inline bool pcie_pme_no_msi(void) { return false; }
|
PCI: PCIe: Ask BIOS for control of all native services at once
After commit 852972acff8f10f3a15679be2059bb94916cba5d (ACPI: Disable
ASPM if the platform won't provide _OSC control for PCIe) control of
the PCIe Capability Structure is unconditionally requested by
acpi_pci_root_add(), which in principle may cause problems to
happen in two ways. First, the BIOS may refuse to give control of
the PCIe Capability Structure if it is not asked for any of the
_OSC features depending on it at the same time. Second, the BIOS may
assume that control of the _OSC features depending on the PCIe
Capability Structure will be requested in the future and may behave
incorrectly if that doesn't happen. For this reason, control of
the PCIe Capability Structure should always be requested along with
control of any other _OSC features that may depend on it (ie. PCIe
native PME, PCIe native hot-plug, PCIe AER).
Rework the PCIe port driver so that (1) it checks which native PCIe
port services can be enabled, according to the BIOS, and (2) it
requests control of all these services simultaneously. In
particular, this causes pcie_portdrv_probe() to fail if the BIOS
refuses to grant control of the PCIe Capability Structure, which
means that no native PCIe port services can be enabled for the PCIe
Root Complex the given port belongs to. If that happens, ASPM is
disabled to avoid problems with mishandling it by the part of the
PCIe hierarchy for which control of the PCIe Capability Structure
has not been received.
Make it possible to override this behavior using 'pcie_ports=native'
(use the PCIe native services regardless of the BIOS response to the
control request), or 'pcie_ports=compat' (do not use the PCIe native
services at all).
Accordingly, rework the existing PCIe port service drivers so that
they don't request control of the services directly.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-08-22 04:02:38 +08:00
|
|
|
static inline void pcie_pme_interrupt_enable(struct pci_dev *dev, bool en) {}
|
2010-02-18 06:40:07 +08:00
|
|
|
#endif /* !CONFIG_PCIE_PME */
|
|
|
|
|
PCI: PCIe: Ask BIOS for control of all native services at once
After commit 852972acff8f10f3a15679be2059bb94916cba5d (ACPI: Disable
ASPM if the platform won't provide _OSC control for PCIe) control of
the PCIe Capability Structure is unconditionally requested by
acpi_pci_root_add(), which in principle may cause problems to
happen in two ways. First, the BIOS may refuse to give control of
the PCIe Capability Structure if it is not asked for any of the
_OSC features depending on it at the same time. Second, the BIOS may
assume that control of the _OSC features depending on the PCIe
Capability Structure will be requested in the future and may behave
incorrectly if that doesn't happen. For this reason, control of
the PCIe Capability Structure should always be requested along with
control of any other _OSC features that may depend on it (ie. PCIe
native PME, PCIe native hot-plug, PCIe AER).
Rework the PCIe port driver so that (1) it checks which native PCIe
port services can be enabled, according to the BIOS, and (2) it
requests control of all these services simultaneously. In
particular, this causes pcie_portdrv_probe() to fail if the BIOS
refuses to grant control of the PCIe Capability Structure, which
means that no native PCIe port services can be enabled for the PCIe
Root Complex the given port belongs to. If that happens, ASPM is
disabled to avoid problems with mishandling it by the part of the
PCIe hierarchy for which control of the PCIe Capability Structure
has not been received.
Make it possible to override this behavior using 'pcie_ports=native'
(use the PCIe native services regardless of the BIOS response to the
control request), or 'pcie_ports=compat' (do not use the PCIe native
services at all).
Accordingly, rework the existing PCIe port service drivers so that
they don't request control of the services directly.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-08-22 04:02:38 +08:00
|
|
|
#ifdef CONFIG_ACPI
|
|
|
|
extern int pcie_port_acpi_setup(struct pci_dev *port, int *mask);
|
|
|
|
|
|
|
|
static inline int pcie_port_platform_notify(struct pci_dev *port, int *mask)
|
|
|
|
{
|
|
|
|
return pcie_port_acpi_setup(port, mask);
|
|
|
|
}
|
|
|
|
#else /* !CONFIG_ACPI */
|
|
|
|
static inline int pcie_port_platform_notify(struct pci_dev *port, int *mask)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* !CONFIG_ACPI */
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif /* _PORTDRV_H_ */
|