pcie_impl.h revision d0f40dc6a997c84bacf5f9ba83d57a95495c399b
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef _SYS_PCIE_IMPL_H
#define _SYS_PCIE_IMPL_H
#ifdef __cplusplus
extern "C" {
#endif
#define PCI_GET_BDF(dip) \
#define PCI_GET_SEC_BUS(dip) \
#define PCI_GET_PCIE2PCI_SECBUS(dip) \
#define DEVI_PORT_TYPE_PCI \
#define PCIE_DIP2BUS(dip) \
PCIE_DIP2UPBUS(dip) : \
#define PCIE_DIP2UPBUS(dip) \
#define PCIE_DIP2DOWNBUS(dip) \
/*
* These macros depend on initialization of type related data in bus_p.
*/
/* IS_ROOT = is RC or RP */
#define PCIE_IS_HOTPLUG_CAPABLE(dip) \
#define PCIE_IS_HOTPLUG_ENABLED(dip) \
/*
* This is a pseudo pcie "device type", but it's needed to explain describe
* nodes such as PX and NPE, which aren't really PCI devices but do control or
* interaction with PCI error handling.
*/
#define PCIE_IS_RC(bus_p) \
#define PCIE_IS_RP(bus_p) \
#define PCIE_IS_SWU(bus_p) \
#define PCIE_IS_SWD(bus_p) \
#define PCIE_IS_SW(bus_p) \
#define PCIE_IS_PCIE_BDG(bus_p) \
#define PCIE_IS_PCI2PCIE(bus_p) \
#define PCIE_IS_PCIE_SEC(bus_p) \
#define PCIX_ECC_VERSION_CHECK(bus_p) \
val)
val)
val)
/* Translate PF error return values to DDI_FM values */
#define PF_ERR2DDIFM_ERR(sts) \
/*
* The following flag is used for Broadcom 5714/5715 bridge prefetch issue.
* This flag will be used both by px and pcieb nexus drivers.
*/
#define PX_DMAI_FLAGS_MAP_BUFZONE 0x40000
/*
* PCI(e/-X) structures used to to gather and report errors detected by
* PCI(e/-X) compliant devices. These registers only contain "dynamic" data.
* Static data such as Capability Offsets and Version #s is saved in the parent
* private data.
*/
#define PCIE_ADV_BDG_REG(pfd_p) \
#define PCIE_ADV_RP_REG(pfd_p) \
/* bus_hp_mode field */
typedef enum {
PCIE_NONE_HP_MODE = 0x0,
PCIE_ACPI_HP_MODE = 0x1,
PCIE_PCI_HP_MODE = 0x2,
PCIE_NATIVE_HP_MODE = 0x4
typedef struct pf_pci_bdg_err_regs {
typedef struct pf_pci_err_regs {
typedef struct pf_pcix_ecc_regs {
typedef struct pf_pcix_err_regs {
typedef struct pf_pcix_bdg_err_regs {
typedef struct pf_pcie_adv_bdg_err_regs {
typedef struct pf_pcie_adv_rp_err_regs {
typedef struct pf_pcie_adv_err_regs {
union {
} pcie_ext;
typedef struct pf_pcie_rp_err_regs {
typedef struct pf_pcie_err_regs {
typedef enum {
PF_INTR_TYPE_NONE = 0,
PF_INTR_TYPE_DATA, /* Data Access Failure, failed loads */
PF_INTR_TYPE_AER, /* Root Port AER MSI */
PF_INTR_TYPE_INTERNAL /* Chip specific internal errors */
typedef struct pf_root_eh_src {
void *intr_data; /* Interrupt Data */
typedef struct pf_root_fault {
/*
* For hot plugged device, these data are init'ed during during probe
* For non-hotplugged device, these data are init'ed in pci_autoconfig (on x86),
* or in px_attach()(on sparc).
*
* For root complex the fields are initialized in pcie_rc_init_bus();
* for others part of the fields are initialized in pcie_init_bus(),
* and part of fields initialized in pcie_post_init_bus(). See comments
* on top of respective functions for details.
*/
typedef struct pcie_bus {
int bus_addr_entries; /* number of range prop */
int bus_assigned_entries; /* number of prop entries */
/* Cache of last fault data */
int bus_mps; /* Maximum Payload Size */
void *bus_plat_private; /* Platform specific */
/* Hotplug specific fields */
void *bus_hp_ctrl; /* HP bus ctrl data */
int bus_ari; /* ARI device */
} pcie_bus_t;
/*
* Data structure to log what devices are affected in relationship to the
* severity after all the errors bits have been analyzed.
*/
#define PF_MAX_AFFECTED_FLAG PF_AFFECTED_ADDR
typedef struct pf_affected_dev {
struct pf_data {
union {
} pe_ext;
};
/* Information used while handling errors in the fabric. */
typedef struct pf_impl {
} pf_impl_t;
/* bus_fm_flags field */
/*
* PCIe fabric handle lookup address flags. Used to define what type of
* transaction the address is for. These same value are defined again in
* fabric-xlate FM module. Do not modify these variables, without modifying
* those.
*/
#define PF_ADDR_DMA (1 << 0)
/* PCIe fabric error scanning status flags */
#define PF_SCAN_SUCCESS (1 << 0)
/* PCIe fabric error handling severity return flags */
#define PF_ERR_FATAL_FLAGS \
#define PF_HDL_FOUND 1
#define PF_HDL_NOTFOUND 2
/*
* PCIe Capability Device Type Pseudo Definitions.
*
* PCI_PSEUDO is used on real PCI devices. The Legacy PCI definition in the
* PCIe spec really refers to PCIe devices that *require* IO Space access. IO
* Space access is usually frowned upon now in PCIe, but there for legacy
* purposes.
*/
#define PCIE_PCIECAP_DEV_TYPE_RC_PSEUDO 0x100
#define PCIE_PCIECAP_DEV_TYPE_PCI_PSEUDO 0x101
#define PCIE_INVALID_BDF 0xFFFF
#define PCIE_CHECK_VALID_BDF(x) (x != PCIE_INVALID_BDF)
typedef struct {
int highest_common_mps;
/*
* Default interrupt priority for all PCI and PCIe nexus drivers including
* hotplug interrupts.
*/
/*
* XXX - PCIE_IS_PCIE check is required in order not to invoke these macros
* for non-standard PCI or PCI Express Hotplug Controllers.
*/
#define PCIE_ENABLE_ERRORS(dip) \
(void) pcie_enable_ce(dip); \
}
#define PCIE_DISABLE_ERRORS(dip) \
}
/*
* pcie_init_buspcie_fini_bus specific flags
*/
#define PCIE_BUS_INITIAL 0x0001
#define PCIE_BUS_FINAL 0x0002
#ifdef DEBUG
/* Common Debugging shortcuts */
#else /* DEBUG */
#define PCIE_DBG_CFG 0 &&
#define PCIE_DBG 0 &&
#define PCIE_ARI_DBG 0 &&
#define PCIE_DBG_CAP 0 &&
#define PCIE_DBG_AER 0 &&
#endif /* DEBUG */
/* PCIe Friendly Functions */
int *max_supported);
extern uint32_t pcie_get_aer_uce_mask();
extern uint32_t pcie_get_aer_ce_mask();
extern uint32_t pcie_get_aer_suce_mask();
extern uint32_t pcie_get_serr_mask();
#define PCIE_ARI_FORW_NOT_SUPPORTED 0
#define PCIE_ARI_FORW_SUPPORTED 1
#define PCIE_ARI_FORW_DISABLED 0
#define PCIE_ARI_FORW_ENABLED 1
#define PCIE_NOT_ARI_DEVICE 0
#define PCIE_ARI_DEVICE 1
/* PCIe error handling functions */
extern void pcie_force_fullscan();
#ifdef DEBUG
extern uint_t pcie_debug_flags;
#endif /* DEBUG */
/* PCIe IOV functions */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_PCIE_IMPL_H */