2005-04-16 22:20:36 +00: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-25 23:52:20 +00:00
|
|
|
#include <linux/compiler.h>
|
|
|
|
|
2009-11-25 12:06:51 +00:00
|
|
|
#define PCIE_PORT_DEVICE_MAXSERVICES 4
|
2009-01-23 23:23:22 +00:00
|
|
|
/*
|
2009-11-25 12:06:51 +00:00
|
|
|
* According to the PCI Express Base Specification 2.0, the indices of
|
2013-11-14 18:28:18 +00:00
|
|
|
* the MSI-X table entries used by port services must not exceed 31
|
2009-01-23 23:23:22 +00:00
|
|
|
*/
|
|
|
|
#define PCIE_PORT_MAX_MSIX_ENTRIES 32
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#define get_descriptor_id(type, service) (((type - 4) << 4) | service)
|
|
|
|
|
|
|
|
extern struct bus_type pcie_port_bus_type;
|
2013-04-12 18:02:59 +00:00
|
|
|
int pcie_port_device_register(struct pci_dev *dev);
|
2005-04-16 22:20:36 +00:00
|
|
|
#ifdef CONFIG_PM
|
2013-04-12 18:02:59 +00:00
|
|
|
int pcie_port_device_suspend(struct device *dev);
|
|
|
|
int pcie_port_device_resume(struct device *dev);
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|
2013-04-12 18:02:59 +00:00
|
|
|
void pcie_port_device_remove(struct pci_dev *dev);
|
|
|
|
int __must_check pcie_port_bus_register(void);
|
|
|
|
void pcie_port_bus_unregister(void);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
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-21 20:02:38 +00:00
|
|
|
struct pci_dev;
|
|
|
|
|
2013-04-12 18:02:59 +00:00
|
|
|
void pcie_clear_root_pme_status(struct pci_dev *dev);
|
2010-12-19 14:57:16 +00:00
|
|
|
|
2012-02-02 16:09:22 +00: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-17 22:40:07 +00: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-21 20:02:38 +00:00
|
|
|
|
2013-04-12 18:02:59 +00:00
|
|
|
void pcie_pme_interrupt_enable(struct pci_dev *dev, bool enable);
|
2010-02-17 22:40:07 +00: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-21 20:02:38 +00:00
|
|
|
static inline void pcie_pme_interrupt_enable(struct pci_dev *dev, bool en) {}
|
2010-02-17 22:40:07 +00: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-21 20:02:38 +00:00
|
|
|
#ifdef CONFIG_ACPI
|
2013-04-12 18:02:59 +00:00
|
|
|
int pcie_port_acpi_setup(struct pci_dev *port, int *mask);
|
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-21 20:02:38 +00:00
|
|
|
|
|
|
|
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-16 22:20:36 +00:00
|
|
|
#endif /* _PORTDRV_H_ */
|