Print this page
5218 posix definition of NULL
correct unistd.h and iso/stddef_iso.h
update gate source affected


  33         (void) nvlist_lookup_uint ## sz(nvl, name, field)
  34 
  35 static boolean_t fab_xlate_fake_rp = B_TRUE;
  36 static fab_err_tbl_t *fab_master_err_tbl;
  37 
  38 /*
  39  * Translation tables for converting "fabric" error bits into "pci" ereports.
  40  * <Ereport Class Name>, <Error Bit Mask>, <Preparation Function>
  41  */
  42 
  43 /* MACRO for table entries with no TGT ereports */
  44 #define NT(class, bit, prep) class, bit, prep, NULL
  45 /* Translate Fabric ereports to ereport.io.pci.* */
  46 fab_erpt_tbl_t fab_pci_erpt_tbl[] = {
  47         PCI_DET_PERR,           PCI_STAT_PERROR,        NULL,
  48         PCI_MDPE,               PCI_STAT_S_PERROR,      NULL,
  49         PCI_SIG_SERR,           PCI_STAT_S_SYSERR,      NULL,
  50         PCI_MA,                 PCI_STAT_R_MAST_AB,     NULL,
  51         PCI_REC_TA,             PCI_STAT_R_TARG_AB,     NULL,
  52         PCI_SIG_TA,             PCI_STAT_S_TARG_AB,     NULL,
  53         NULL, NULL, NULL
  54 };
  55 
  56 /* Translate Fabric ereports to ereport.io.pci.sec-* */
  57 static fab_erpt_tbl_t fab_pci_bdg_erpt_tbl[] = {
  58         PCI_DET_PERR,           PCI_STAT_PERROR,        NULL,
  59         PCI_MDPE,               PCI_STAT_S_PERROR,      NULL,
  60         PCI_REC_SERR,           PCI_STAT_S_SYSERR,      NULL,
  61 #ifdef sparc
  62         PCI_MA,                 PCI_STAT_R_MAST_AB,     NULL,
  63 #endif
  64         PCI_REC_TA,             PCI_STAT_R_TARG_AB,     NULL,
  65         PCI_SIG_TA,             PCI_STAT_S_TARG_AB,     NULL,
  66         NULL, NULL, NULL, NULL,
  67 };
  68 
  69 
  70 /* Translate Fabric ereports to ereport.io.pci.dto */
  71 static fab_erpt_tbl_t fab_pci_bdg_ctl_erpt_tbl[] = {
  72         PCI_DTO,        PCI_BCNF_BCNTRL_DTO_STAT,       NULL,
  73         NULL, NULL, NULL
  74 };
  75 
  76 /* Translate Fabric ereports to ereport.io.pciex.* */
  77 static fab_erpt_tbl_t fab_pcie_ce_erpt_tbl[] = {
  78         PCIEX_RE,       PCIE_AER_CE_RECEIVER_ERR,       NULL,
  79         PCIEX_RNR,      PCIE_AER_CE_REPLAY_ROLLOVER,    NULL,
  80         PCIEX_RTO,      PCIE_AER_CE_REPLAY_TO,          NULL,
  81         PCIEX_BDP,      PCIE_AER_CE_BAD_DLLP,           NULL,
  82         PCIEX_BTP,      PCIE_AER_CE_BAD_TLP,            NULL,
  83         PCIEX_ANFE,     PCIE_AER_CE_AD_NFE,             NULL,
  84         NULL, NULL, NULL
  85 };
  86 
  87 /*
  88  * Translate Fabric ereports to ereport.io.pciex.*
  89  * The Target Ereports for this section is only used on leaf devices, with the
  90  * exception of TO
  91  */
  92 static fab_erpt_tbl_t fab_pcie_ue_erpt_tbl[] = {
  93         PCIEX_TE,       PCIE_AER_UCE_TRAINING,          NULL,
  94         PCIEX_DLP,      PCIE_AER_UCE_DLP,               NULL,
  95         PCIEX_SD,       PCIE_AER_UCE_SD,                NULL,
  96         PCIEX_ROF,      PCIE_AER_UCE_RO,                NULL,
  97         PCIEX_FCP,      PCIE_AER_UCE_FCP,               NULL,
  98         PCIEX_MFP,      PCIE_AER_UCE_MTLP,              NULL,
  99         PCIEX_CTO,      PCIE_AER_UCE_TO,                PCI_TARG_MA,
 100         PCIEX_UC,       PCIE_AER_UCE_UC,                NULL,
 101         PCIEX_ECRC,     PCIE_AER_UCE_ECRC,              NULL,
 102         PCIEX_CA,       PCIE_AER_UCE_CA,                PCI_TARG_REC_TA,
 103 #ifdef sparc
 104         PCIEX_UR,       PCIE_AER_UCE_UR,                PCI_TARG_MA,
 105 #endif
 106         PCIEX_POIS,     PCIE_AER_UCE_PTLP,              PCI_TARG_MDPE,
 107         NULL, NULL, NULL
 108 };
 109 
 110 /* Translate Fabric ereports to ereport.io.pciex.* */
 111 static fab_erpt_tbl_t fab_pcie_sue_erpt_tbl[] = {
 112         PCIEX_S_TA_SC,  PCIE_AER_SUCE_TA_ON_SC,         PCI_TARG_REC_TA,
 113         PCIEX_S_MA_SC,  PCIE_AER_SUCE_MA_ON_SC,         PCI_TARG_MA,
 114         PCIEX_S_RTA,    PCIE_AER_SUCE_RCVD_TA,          PCI_TARG_REC_TA,
 115 #ifdef sparc
 116         PCIEX_S_RMA,    PCIE_AER_SUCE_RCVD_MA,          PCI_TARG_MA,
 117 #endif
 118         PCIEX_S_USC,    PCIE_AER_SUCE_USC_ERR,          NULL,
 119         PCIEX_S_USCMD,  PCIE_AER_SUCE_USC_MSG_DATA_ERR, PCI_TARG_REC_TA,
 120         PCIEX_S_UDE,    PCIE_AER_SUCE_UC_DATA_ERR,      PCI_TARG_MDPE,
 121         PCIEX_S_UAT,    PCIE_AER_SUCE_UC_ATTR_ERR,      PCI_TARG_MDPE,
 122         PCIEX_S_UADR,   PCIE_AER_SUCE_UC_ADDR_ERR,      PCI_TARG_MDPE,
 123         PCIEX_S_TEX,    PCIE_AER_SUCE_TIMER_EXPIRED,    NULL,
 124         PCIEX_S_PERR,   PCIE_AER_SUCE_PERR_ASSERT,      PCI_TARG_MDPE,
 125         PCIEX_S_SERR,   PCIE_AER_SUCE_SERR_ASSERT,      NULL,
 126         PCIEX_INTERR,   PCIE_AER_SUCE_INTERNAL_ERR,     NULL,
 127         NULL, NULL, NULL
 128 };
 129 
 130 /* Translate Fabric ereports to ereport.io.pcix.* */
 131 static fab_erpt_tbl_t fab_pcix_erpt_tbl[] = {
 132         PCIX_SPL_DIS,           PCI_PCIX_SPL_DSCD,      NULL,
 133         PCIX_UNEX_SPL,          PCI_PCIX_UNEX_SPL,      NULL,
 134         PCIX_RX_SPL_MSG,        PCI_PCIX_RX_SPL_MSG,    NULL,
 135         NULL, NULL, NULL
 136 };
 137 static fab_erpt_tbl_t *fab_pcix_bdg_erpt_tbl = fab_pcix_erpt_tbl;
 138 
 139 /* Translate Fabric ereports to ereport.io.pcix.sec-* */
 140 static fab_erpt_tbl_t fab_pcix_bdg_sec_erpt_tbl[] = {
 141         PCIX_SPL_DIS,           PCI_PCIX_BSS_SPL_DSCD,  NULL,
 142         PCIX_UNEX_SPL,          PCI_PCIX_BSS_UNEX_SPL,  NULL,
 143         PCIX_BSS_SPL_OR,        PCI_PCIX_BSS_SPL_OR,    NULL,
 144         PCIX_BSS_SPL_DLY,       PCI_PCIX_BSS_SPL_DLY,   NULL,
 145         NULL, NULL, NULL
 146 };
 147 
 148 /* Translate Fabric ereports to ereport.io.pciex.* */
 149 static fab_erpt_tbl_t fab_pcie_nadv_erpt_tbl[] = {
 150 #ifdef sparc
 151         PCIEX_UR,               PCIE_DEVSTS_UR_DETECTED,        NULL,
 152 #endif
 153         PCIEX_FAT,              PCIE_DEVSTS_FE_DETECTED,        NULL,
 154         PCIEX_NONFAT,           PCIE_DEVSTS_NFE_DETECTED,       NULL,
 155         PCIEX_CORR,             PCIE_DEVSTS_CE_DETECTED,        NULL,
 156         NULL, NULL, NULL
 157 };
 158 
 159 /* Translate Fabric ereports to ereport.io.pciex.* */
 160 static fab_erpt_tbl_t fab_pcie_rc_erpt_tbl[] = {
 161         PCIEX_RC_FE_MSG,        PCIE_AER_RE_STS_FE_MSGS_RCVD,   NULL,
 162         PCIEX_RC_NFE_MSG,       PCIE_AER_RE_STS_NFE_MSGS_RCVD,  NULL,
 163         PCIEX_RC_CE_MSG,        PCIE_AER_RE_STS_CE_RCVD,        NULL,
 164         PCIEX_RC_MCE_MSG,       PCIE_AER_RE_STS_MUL_CE_RCVD,    NULL,
 165         PCIEX_RC_MUE_MSG,       PCIE_AER_RE_STS_MUL_FE_NFE_RCVD, NULL,
 166         NULL, NULL, NULL
 167 };
 168 
 169 /*
 170  * Translate Fabric ereports to pseudo ereport.io.pciex.* RC Fabric Messages.
 171  * If the RP is not a PCIe compliant RP or does not support AER, rely on the
 172  * leaf fabric ereport to help create a xxx_MSG ereport coming from the RC.
 173  */
 174 static fab_erpt_tbl_t fab_pcie_fake_rc_erpt_tbl[] = {
 175         PCIEX_RC_FE_MSG,        PCIE_DEVSTS_FE_DETECTED,        NULL,
 176         PCIEX_RC_NFE_MSG,       PCIE_DEVSTS_NFE_DETECTED,       NULL,
 177         PCIEX_RC_CE_MSG,        PCIE_DEVSTS_CE_DETECTED,        NULL,
 178         NULL, NULL, NULL,
 179 };
 180 
 181 /* ARGSUSED */
 182 void
 183 fab_pci_fabric_to_data(fmd_hdl_t *hdl, nvlist_t *nvl, fab_data_t *data)
 184 {
 185         data->nvl = nvl;
 186 
 187         /* Generic PCI device information */
 188         FAB_LOOKUP(16,  "bdf",                  &data->bdf);
 189         FAB_LOOKUP(16,  "device_id",            &data->device_id);
 190         FAB_LOOKUP(16,  "vendor_id",            &data->vendor_id);
 191         FAB_LOOKUP(8,   "rev_id",               &data->rev_id);
 192         FAB_LOOKUP(16,  "dev_type",             &data->dev_type);
 193         FAB_LOOKUP(16,  "pcie_off",             &data->pcie_off);
 194         FAB_LOOKUP(16,  "pcix_off",             &data->pcix_off);
 195         FAB_LOOKUP(16,  "aer_off",              &data->aer_off);
 196         FAB_LOOKUP(16,  "ecc_ver",              &data->ecc_ver);
 197 
 198         /* Misc ereport information */




  33         (void) nvlist_lookup_uint ## sz(nvl, name, field)
  34 
  35 static boolean_t fab_xlate_fake_rp = B_TRUE;
  36 static fab_err_tbl_t *fab_master_err_tbl;
  37 
  38 /*
  39  * Translation tables for converting "fabric" error bits into "pci" ereports.
  40  * <Ereport Class Name>, <Error Bit Mask>, <Preparation Function>
  41  */
  42 
  43 /* MACRO for table entries with no TGT ereports */
  44 #define NT(class, bit, prep) class, bit, prep, NULL
  45 /* Translate Fabric ereports to ereport.io.pci.* */
  46 fab_erpt_tbl_t fab_pci_erpt_tbl[] = {
  47         PCI_DET_PERR,           PCI_STAT_PERROR,        NULL,
  48         PCI_MDPE,               PCI_STAT_S_PERROR,      NULL,
  49         PCI_SIG_SERR,           PCI_STAT_S_SYSERR,      NULL,
  50         PCI_MA,                 PCI_STAT_R_MAST_AB,     NULL,
  51         PCI_REC_TA,             PCI_STAT_R_TARG_AB,     NULL,
  52         PCI_SIG_TA,             PCI_STAT_S_TARG_AB,     NULL,
  53         NULL, 0 , NULL
  54 };
  55 
  56 /* Translate Fabric ereports to ereport.io.pci.sec-* */
  57 static fab_erpt_tbl_t fab_pci_bdg_erpt_tbl[] = {
  58         PCI_DET_PERR,           PCI_STAT_PERROR,        NULL,
  59         PCI_MDPE,               PCI_STAT_S_PERROR,      NULL,
  60         PCI_REC_SERR,           PCI_STAT_S_SYSERR,      NULL,
  61 #ifdef sparc
  62         PCI_MA,                 PCI_STAT_R_MAST_AB,     NULL,
  63 #endif
  64         PCI_REC_TA,             PCI_STAT_R_TARG_AB,     NULL,
  65         PCI_SIG_TA,             PCI_STAT_S_TARG_AB,     NULL,
  66         NULL, 0 , NULL
  67 };
  68 
  69 
  70 /* Translate Fabric ereports to ereport.io.pci.dto */
  71 static fab_erpt_tbl_t fab_pci_bdg_ctl_erpt_tbl[] = {
  72         PCI_DTO,        PCI_BCNF_BCNTRL_DTO_STAT,       NULL,
  73         NULL, 0, NULL
  74 };
  75 
  76 /* Translate Fabric ereports to ereport.io.pciex.* */
  77 static fab_erpt_tbl_t fab_pcie_ce_erpt_tbl[] = {
  78         PCIEX_RE,       PCIE_AER_CE_RECEIVER_ERR,       NULL,
  79         PCIEX_RNR,      PCIE_AER_CE_REPLAY_ROLLOVER,    NULL,
  80         PCIEX_RTO,      PCIE_AER_CE_REPLAY_TO,          NULL,
  81         PCIEX_BDP,      PCIE_AER_CE_BAD_DLLP,           NULL,
  82         PCIEX_BTP,      PCIE_AER_CE_BAD_TLP,            NULL,
  83         PCIEX_ANFE,     PCIE_AER_CE_AD_NFE,             NULL,
  84         NULL, 0, NULL
  85 };
  86 
  87 /*
  88  * Translate Fabric ereports to ereport.io.pciex.*
  89  * The Target Ereports for this section is only used on leaf devices, with the
  90  * exception of TO
  91  */
  92 static fab_erpt_tbl_t fab_pcie_ue_erpt_tbl[] = {
  93         PCIEX_TE,       PCIE_AER_UCE_TRAINING,          NULL,
  94         PCIEX_DLP,      PCIE_AER_UCE_DLP,               NULL,
  95         PCIEX_SD,       PCIE_AER_UCE_SD,                NULL,
  96         PCIEX_ROF,      PCIE_AER_UCE_RO,                NULL,
  97         PCIEX_FCP,      PCIE_AER_UCE_FCP,               NULL,
  98         PCIEX_MFP,      PCIE_AER_UCE_MTLP,              NULL,
  99         PCIEX_CTO,      PCIE_AER_UCE_TO,                PCI_TARG_MA,
 100         PCIEX_UC,       PCIE_AER_UCE_UC,                NULL,
 101         PCIEX_ECRC,     PCIE_AER_UCE_ECRC,              NULL,
 102         PCIEX_CA,       PCIE_AER_UCE_CA,                PCI_TARG_REC_TA,
 103 #ifdef sparc
 104         PCIEX_UR,       PCIE_AER_UCE_UR,                PCI_TARG_MA,
 105 #endif
 106         PCIEX_POIS,     PCIE_AER_UCE_PTLP,              PCI_TARG_MDPE,
 107         NULL, 0, NULL
 108 };
 109 
 110 /* Translate Fabric ereports to ereport.io.pciex.* */
 111 static fab_erpt_tbl_t fab_pcie_sue_erpt_tbl[] = {
 112         PCIEX_S_TA_SC,  PCIE_AER_SUCE_TA_ON_SC,         PCI_TARG_REC_TA,
 113         PCIEX_S_MA_SC,  PCIE_AER_SUCE_MA_ON_SC,         PCI_TARG_MA,
 114         PCIEX_S_RTA,    PCIE_AER_SUCE_RCVD_TA,          PCI_TARG_REC_TA,
 115 #ifdef sparc
 116         PCIEX_S_RMA,    PCIE_AER_SUCE_RCVD_MA,          PCI_TARG_MA,
 117 #endif
 118         PCIEX_S_USC,    PCIE_AER_SUCE_USC_ERR,          NULL,
 119         PCIEX_S_USCMD,  PCIE_AER_SUCE_USC_MSG_DATA_ERR, PCI_TARG_REC_TA,
 120         PCIEX_S_UDE,    PCIE_AER_SUCE_UC_DATA_ERR,      PCI_TARG_MDPE,
 121         PCIEX_S_UAT,    PCIE_AER_SUCE_UC_ATTR_ERR,      PCI_TARG_MDPE,
 122         PCIEX_S_UADR,   PCIE_AER_SUCE_UC_ADDR_ERR,      PCI_TARG_MDPE,
 123         PCIEX_S_TEX,    PCIE_AER_SUCE_TIMER_EXPIRED,    NULL,
 124         PCIEX_S_PERR,   PCIE_AER_SUCE_PERR_ASSERT,      PCI_TARG_MDPE,
 125         PCIEX_S_SERR,   PCIE_AER_SUCE_SERR_ASSERT,      NULL,
 126         PCIEX_INTERR,   PCIE_AER_SUCE_INTERNAL_ERR,     NULL,
 127         NULL, 0, NULL
 128 };
 129 
 130 /* Translate Fabric ereports to ereport.io.pcix.* */
 131 static fab_erpt_tbl_t fab_pcix_erpt_tbl[] = {
 132         PCIX_SPL_DIS,           PCI_PCIX_SPL_DSCD,      NULL,
 133         PCIX_UNEX_SPL,          PCI_PCIX_UNEX_SPL,      NULL,
 134         PCIX_RX_SPL_MSG,        PCI_PCIX_RX_SPL_MSG,    NULL,
 135         NULL, 0, NULL
 136 };
 137 static fab_erpt_tbl_t *fab_pcix_bdg_erpt_tbl = fab_pcix_erpt_tbl;
 138 
 139 /* Translate Fabric ereports to ereport.io.pcix.sec-* */
 140 static fab_erpt_tbl_t fab_pcix_bdg_sec_erpt_tbl[] = {
 141         PCIX_SPL_DIS,           PCI_PCIX_BSS_SPL_DSCD,  NULL,
 142         PCIX_UNEX_SPL,          PCI_PCIX_BSS_UNEX_SPL,  NULL,
 143         PCIX_BSS_SPL_OR,        PCI_PCIX_BSS_SPL_OR,    NULL,
 144         PCIX_BSS_SPL_DLY,       PCI_PCIX_BSS_SPL_DLY,   NULL,
 145         NULL, 0, NULL
 146 };
 147 
 148 /* Translate Fabric ereports to ereport.io.pciex.* */
 149 static fab_erpt_tbl_t fab_pcie_nadv_erpt_tbl[] = {
 150 #ifdef sparc
 151         PCIEX_UR,               PCIE_DEVSTS_UR_DETECTED,        NULL,
 152 #endif
 153         PCIEX_FAT,              PCIE_DEVSTS_FE_DETECTED,        NULL,
 154         PCIEX_NONFAT,           PCIE_DEVSTS_NFE_DETECTED,       NULL,
 155         PCIEX_CORR,             PCIE_DEVSTS_CE_DETECTED,        NULL,
 156         NULL, 0, NULL
 157 };
 158 
 159 /* Translate Fabric ereports to ereport.io.pciex.* */
 160 static fab_erpt_tbl_t fab_pcie_rc_erpt_tbl[] = {
 161         PCIEX_RC_FE_MSG,        PCIE_AER_RE_STS_FE_MSGS_RCVD,   NULL,
 162         PCIEX_RC_NFE_MSG,       PCIE_AER_RE_STS_NFE_MSGS_RCVD,  NULL,
 163         PCIEX_RC_CE_MSG,        PCIE_AER_RE_STS_CE_RCVD,        NULL,
 164         PCIEX_RC_MCE_MSG,       PCIE_AER_RE_STS_MUL_CE_RCVD,    NULL,
 165         PCIEX_RC_MUE_MSG,       PCIE_AER_RE_STS_MUL_FE_NFE_RCVD, NULL,
 166         NULL, 0, NULL
 167 };
 168 
 169 /*
 170  * Translate Fabric ereports to pseudo ereport.io.pciex.* RC Fabric Messages.
 171  * If the RP is not a PCIe compliant RP or does not support AER, rely on the
 172  * leaf fabric ereport to help create a xxx_MSG ereport coming from the RC.
 173  */
 174 static fab_erpt_tbl_t fab_pcie_fake_rc_erpt_tbl[] = {
 175         PCIEX_RC_FE_MSG,        PCIE_DEVSTS_FE_DETECTED,        NULL,
 176         PCIEX_RC_NFE_MSG,       PCIE_DEVSTS_NFE_DETECTED,       NULL,
 177         PCIEX_RC_CE_MSG,        PCIE_DEVSTS_CE_DETECTED,        NULL,
 178         NULL, 0, NULL
 179 };
 180 
 181 /* ARGSUSED */
 182 void
 183 fab_pci_fabric_to_data(fmd_hdl_t *hdl, nvlist_t *nvl, fab_data_t *data)
 184 {
 185         data->nvl = nvl;
 186 
 187         /* Generic PCI device information */
 188         FAB_LOOKUP(16,  "bdf",                  &data->bdf);
 189         FAB_LOOKUP(16,  "device_id",            &data->device_id);
 190         FAB_LOOKUP(16,  "vendor_id",            &data->vendor_id);
 191         FAB_LOOKUP(8,   "rev_id",               &data->rev_id);
 192         FAB_LOOKUP(16,  "dev_type",             &data->dev_type);
 193         FAB_LOOKUP(16,  "pcie_off",             &data->pcie_off);
 194         FAB_LOOKUP(16,  "pcix_off",             &data->pcix_off);
 195         FAB_LOOKUP(16,  "aer_off",              &data->aer_off);
 196         FAB_LOOKUP(16,  "ecc_ver",              &data->ecc_ver);
 197 
 198         /* Misc ereport information */