1700 Add SCSI UNMAP support
[unleashed.git] / usr / src / uts / common / sys / pcifm.h
blob5df5c679c858eee0b0ca7642e43819cf44781df9
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_PCIFM_H
27 #define _SYS_PCIFM_H
29 #include <sys/dditypes.h> /* for ddi_acc_handle_t */
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
37 * PCI device type defines.
39 #define PCI_BRIDGE_DEV 0x02
40 #define PCIX_DEV 0x04
43 * PCI and PCI-X valid flags
45 #define PCI_ERR_STATUS_VALID 0x1
46 #define PCI_BDG_SEC_STAT_VALID 0x2
47 #define PCI_BDG_CTRL_VALID 0x4
48 #define PCIX_ERR_STATUS_VALID 0x8
49 #define PCIX_ERR_ECC_STS_VALID 0x10
50 #define PCIX_ERR_S_ECC_STS_VALID 0x20
51 #define PCIX_BDG_STATUS_VALID 0x40
52 #define PCIX_BDG_SEC_STATUS_VALID 0x80
56 * PCI(-X) structures used (by pci_ereport_setup, pci_ereport_post, and
57 * pci_ereport_teardown) to gather and report errors detected by PCI(-X)
58 * compliant devices.
60 typedef struct pci_bdg_error_regs {
61 uint16_t pci_bdg_vflags; /* status valid bits */
62 uint16_t pci_bdg_sec_stat; /* PCI secondary status reg */
63 uint16_t pci_bdg_ctrl; /* PCI bridge control reg */
64 } pci_bdg_error_regs_t;
66 typedef struct pci_error_regs {
67 uint16_t pci_vflags; /* status valid bits */
68 uint8_t pci_cap_ptr; /* PCI Capability pointer */
69 uint16_t pci_err_status; /* pci status register */
70 uint16_t pci_cfg_comm; /* pci command register */
71 pci_bdg_error_regs_t *pci_bdg_regs;
72 } pci_error_regs_t;
74 typedef struct pci_erpt {
75 ddi_acc_handle_t pe_hdl; /* Config space access handle */
76 uint64_t pe_dflags; /* Device type flags */
77 uint16_t pe_bdf; /* bus/device/function of device */
78 pci_error_regs_t *pe_pci_regs; /* PCI generic error registers */
79 void *pe_regs; /* Pointer to extended error regs */
80 } pci_erpt_t;
82 typedef struct pcix_ecc_regs {
83 uint16_t pcix_ecc_vflags; /* pcix ecc valid flags */
84 uint16_t pcix_ecc_bdf; /* pcix ecc bdf */
85 uint32_t pcix_ecc_ctlstat; /* pcix ecc control status reg */
86 uint32_t pcix_ecc_fstaddr; /* pcix ecc first address reg */
87 uint32_t pcix_ecc_secaddr; /* pcix ecc second address reg */
88 uint32_t pcix_ecc_attr; /* pcix ecc attributes reg */
89 } pcix_ecc_regs_t;
91 typedef struct pcix_error_regs {
92 uint16_t pcix_vflags; /* pcix valid flags */
93 uint8_t pcix_cap_ptr; /* pcix capability pointer */
94 uint16_t pcix_ver; /* pcix version */
95 uint16_t pcix_command; /* pcix command register */
96 uint32_t pcix_status; /* pcix status register */
97 pcix_ecc_regs_t *pcix_ecc_regs; /* pcix ecc registers */
98 } pcix_error_regs_t;
100 typedef struct pcix_bdg_error_regs {
101 uint16_t pcix_bdg_vflags; /* pcix valid flags */
102 uint8_t pcix_bdg_cap_ptr; /* pcix bridge capability pointer */
103 uint16_t pcix_bdg_ver; /* pcix version */
104 uint16_t pcix_bdg_sec_stat; /* pcix bridge secondary status reg */
105 uint32_t pcix_bdg_stat; /* pcix bridge status reg */
106 pcix_ecc_regs_t *pcix_bdg_ecc_regs[2]; /* pcix ecc registers */
107 } pcix_bdg_error_regs_t;
110 * pcie bus specific structure
113 typedef struct pci_fme_bus_specific {
114 int pci_bs_type;
115 uint64_t pci_bs_addr;
116 uint16_t pci_bs_bdf;
117 int pci_bs_flags;
118 } pci_fme_bus_specific_t;
120 #define PCI_BS_ADDR_VALID 1
121 #define PCI_BS_BDF_VALID 2
124 * target error queue defines
126 #define TARGET_MAX_ERRS 6
127 #define TGT_PCI_SPACE_UNKNOWN 4
129 typedef struct pci_target_err {
130 uint64_t tgt_err_addr;
131 uint64_t tgt_err_ena;
132 uint64_t tgt_pci_addr;
133 uint32_t tgt_pci_space;
134 dev_info_t *tgt_dip;
135 char *tgt_err_class;
136 char *tgt_bridge_type;
137 } pci_target_err_t;
139 #define PCI_FM_SEV_INC(x) ((x) == DDI_FM_FATAL) ? fatal++ :\
140 (((x) == DDI_FM_NONFATAL) ? nonfatal++ :\
141 (((x) == DDI_FM_UNKNOWN) ? unknown++ : ok++));
143 #ifdef __cplusplus
145 #endif
147 #endif /* _SYS_PCIFM_H */