1*25cf1a30Sjl /* 2*25cf1a30Sjl * CDDL HEADER START 3*25cf1a30Sjl * 4*25cf1a30Sjl * The contents of this file are subject to the terms of the 5*25cf1a30Sjl * Common Development and Distribution License (the "License"). 6*25cf1a30Sjl * You may not use this file except in compliance with the License. 7*25cf1a30Sjl * 8*25cf1a30Sjl * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*25cf1a30Sjl * or http://www.opensolaris.org/os/licensing. 10*25cf1a30Sjl * See the License for the specific language governing permissions 11*25cf1a30Sjl * and limitations under the License. 12*25cf1a30Sjl * 13*25cf1a30Sjl * When distributing Covered Code, include this CDDL HEADER in each 14*25cf1a30Sjl * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*25cf1a30Sjl * If applicable, add the following below this CDDL HEADER, with the 16*25cf1a30Sjl * fields enclosed by brackets "[]" replaced with your own identifying 17*25cf1a30Sjl * information: Portions Copyright [yyyy] [name of copyright owner] 18*25cf1a30Sjl * 19*25cf1a30Sjl * CDDL HEADER END 20*25cf1a30Sjl */ 21*25cf1a30Sjl /* 22*25cf1a30Sjl * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23*25cf1a30Sjl * Use is subject to license terms. 24*25cf1a30Sjl */ 25*25cf1a30Sjl 26*25cf1a30Sjl #ifndef _SYS_PCICMU_H 27*25cf1a30Sjl #define _SYS_PCICMU_H 28*25cf1a30Sjl 29*25cf1a30Sjl #pragma ident "%Z%%M% %I% %E% SMI" 30*25cf1a30Sjl 31*25cf1a30Sjl 32*25cf1a30Sjl #ifdef __cplusplus 33*25cf1a30Sjl extern "C" { 34*25cf1a30Sjl #endif 35*25cf1a30Sjl 36*25cf1a30Sjl #include <sys/pci.h> 37*25cf1a30Sjl #include <sys/pci_intr_lib.h> 38*25cf1a30Sjl #include <sys/pcicmu/pcmu_types.h> 39*25cf1a30Sjl #include <sys/pcicmu/pcmu_ib.h> 40*25cf1a30Sjl #include <sys/pcicmu/pcmu_cb.h> 41*25cf1a30Sjl #include <sys/pcicmu/pcmu_ecc.h> 42*25cf1a30Sjl #include <sys/pcicmu/pcmu_pbm.h> 43*25cf1a30Sjl #include <sys/pcicmu/pcmu_counters.h> 44*25cf1a30Sjl #include <sys/pcicmu/pcmu_util.h> 45*25cf1a30Sjl #include <sys/pcicmu/pcmu_err.h> 46*25cf1a30Sjl 47*25cf1a30Sjl 48*25cf1a30Sjl /* 49*25cf1a30Sjl * The following typedef is used to represent a 50*25cf1a30Sjl * 1275 "bus-range" property of a PCI Bus node. 51*25cf1a30Sjl */ 52*25cf1a30Sjl struct pcmu_bus_range { 53*25cf1a30Sjl uint32_t lo; 54*25cf1a30Sjl uint32_t hi; 55*25cf1a30Sjl }; 56*25cf1a30Sjl 57*25cf1a30Sjl /* 58*25cf1a30Sjl * Structure to represent an entry in the 59*25cf1a30Sjl * "ranges" property of a device node. 60*25cf1a30Sjl */ 61*25cf1a30Sjl struct pcmu_ranges { 62*25cf1a30Sjl uint32_t child_high; 63*25cf1a30Sjl uint32_t child_mid; 64*25cf1a30Sjl uint32_t child_low; 65*25cf1a30Sjl uint32_t parent_high; 66*25cf1a30Sjl uint32_t parent_low; 67*25cf1a30Sjl uint32_t size_high; 68*25cf1a30Sjl uint32_t size_low; 69*25cf1a30Sjl }; 70*25cf1a30Sjl 71*25cf1a30Sjl typedef enum { 72*25cf1a30Sjl PCMU_NEW, 73*25cf1a30Sjl PCMU_ATTACHED, 74*25cf1a30Sjl PCMU_DETACHED, 75*25cf1a30Sjl PCMU_SUSPENDED 76*25cf1a30Sjl } pcmu_state_t; 77*25cf1a30Sjl 78*25cf1a30Sjl typedef enum { 79*25cf1a30Sjl PCMU_PBM_OBJ, 80*25cf1a30Sjl PCMU_ECC_OBJ, 81*25cf1a30Sjl PCMU_CB_OBJ 82*25cf1a30Sjl } pcmu_obj_t; 83*25cf1a30Sjl 84*25cf1a30Sjl typedef enum { 85*25cf1a30Sjl PCMU_OBJ_INTR_ADD, 86*25cf1a30Sjl PCMU_OBJ_INTR_REMOVE 87*25cf1a30Sjl } pcmu_obj_op_t; 88*25cf1a30Sjl 89*25cf1a30Sjl #define PCI_OPLCMU "pcicmu" 90*25cf1a30Sjl 91*25cf1a30Sjl /* 92*25cf1a30Sjl * pcicmu soft state structure. 93*25cf1a30Sjl */ 94*25cf1a30Sjl struct pcicmu { 95*25cf1a30Sjl /* 96*25cf1a30Sjl * State flags and mutex: 97*25cf1a30Sjl */ 98*25cf1a30Sjl pcmu_state_t pcmu_state; 99*25cf1a30Sjl uint_t pcmu_soft_state; 100*25cf1a30Sjl uint_t pcmu_open_count; 101*25cf1a30Sjl kmutex_t pcmu_mutex; 102*25cf1a30Sjl 103*25cf1a30Sjl /* 104*25cf1a30Sjl * Links to other state structures: 105*25cf1a30Sjl */ 106*25cf1a30Sjl dev_info_t *pcmu_dip; /* devinfo structure */ 107*25cf1a30Sjl pcmu_ib_t *pcmu_ib_p; /* interrupt block */ 108*25cf1a30Sjl pcmu_cb_t *pcmu_cb_p; /* control block */ 109*25cf1a30Sjl pcmu_pbm_t *pcmu_pcbm_p; /* PBM block */ 110*25cf1a30Sjl pcmu_ecc_t *pcmu_pecc_p; /* ECC error block */ 111*25cf1a30Sjl 112*25cf1a30Sjl /* 113*25cf1a30Sjl * other state info: 114*25cf1a30Sjl */ 115*25cf1a30Sjl uint_t pcmu_id; /* Jupiter device id */ 116*25cf1a30Sjl uint32_t pcmu_rev; /* Bus bridge chip identification */ 117*25cf1a30Sjl 118*25cf1a30Sjl /* 119*25cf1a30Sjl * pci device node properties: 120*25cf1a30Sjl */ 121*25cf1a30Sjl pcmu_bus_range_t pcmu_bus_range; /* "bus-range" */ 122*25cf1a30Sjl pcmu_ranges_t *pcmu_ranges; /* "ranges" data & length */ 123*25cf1a30Sjl int pcmu_ranges_length; 124*25cf1a30Sjl uint32_t *pcmu_inos; /* inos from "interrupts" prop */ 125*25cf1a30Sjl int pcmu_inos_len; /* "interrupts" length */ 126*25cf1a30Sjl int pcmu_numproxy; /* upa interrupt proxies */ 127*25cf1a30Sjl 128*25cf1a30Sjl /* 129*25cf1a30Sjl * register mapping: 130*25cf1a30Sjl */ 131*25cf1a30Sjl caddr_t pcmu_address[4]; 132*25cf1a30Sjl ddi_acc_handle_t pcmu_ac[4]; 133*25cf1a30Sjl 134*25cf1a30Sjl /* 135*25cf1a30Sjl * Performance counters kstat. 136*25cf1a30Sjl */ 137*25cf1a30Sjl pcmu_cntr_pa_t pcmu_uks_pa; 138*25cf1a30Sjl kstat_t *pcmu_uksp; /* ptr to upstream kstat */ 139*25cf1a30Sjl kmutex_t pcmu_err_mutex; /* per chip error handling mutex */ 140*25cf1a30Sjl 141*25cf1a30Sjl /* Fault Management support */ 142*25cf1a30Sjl int pcmu_fm_cap; 143*25cf1a30Sjl ddi_iblock_cookie_t pcmu_fm_ibc; 144*25cf1a30Sjl }; 145*25cf1a30Sjl 146*25cf1a30Sjl /* 147*25cf1a30Sjl * pcmu_soft_state values. 148*25cf1a30Sjl */ 149*25cf1a30Sjl #define PCMU_SOFT_STATE_OPEN 0x01 150*25cf1a30Sjl #define PCMU_SOFT_STATE_OPEN_EXCL 0x02 151*25cf1a30Sjl #define PCMU_SOFT_STATE_CLOSED 0x04 152*25cf1a30Sjl 153*25cf1a30Sjl /* 154*25cf1a30Sjl * CMU-CH and PBM soft state macros: 155*25cf1a30Sjl */ 156*25cf1a30Sjl #define PCMU_AP_MINOR_NUM_TO_INSTANCE(x) ((x) >> 8) 157*25cf1a30Sjl 158*25cf1a30Sjl #define get_pcmu_soft_state(i) \ 159*25cf1a30Sjl ((pcmu_t *)ddi_get_soft_state(per_pcmu_state, (i))) 160*25cf1a30Sjl 161*25cf1a30Sjl #define alloc_pcmu_soft_state(i) \ 162*25cf1a30Sjl ddi_soft_state_zalloc(per_pcmu_state, (i)) 163*25cf1a30Sjl 164*25cf1a30Sjl #define free_pcmu_soft_state(i) \ 165*25cf1a30Sjl ddi_soft_state_free(per_pcmu_state, (i)) 166*25cf1a30Sjl 167*25cf1a30Sjl #define DEV_TO_SOFTSTATE(dev) ((pcmu_t *)ddi_get_soft_state(per_pcmu_state, \ 168*25cf1a30Sjl PCMU_AP_MINOR_NUM_TO_INSTANCE(getminor(dev)))) 169*25cf1a30Sjl 170*25cf1a30Sjl #define PCMU_ATTACH_RETCODE(obj, op, err) \ 171*25cf1a30Sjl ((err) ? (obj) << 8 | (op) << 4 | (err) & 0xf : DDI_SUCCESS) 172*25cf1a30Sjl 173*25cf1a30Sjl 174*25cf1a30Sjl /* 175*25cf1a30Sjl * Performance counters information. 176*25cf1a30Sjl */ 177*25cf1a30Sjl #define PCMU_SHIFT_PIC0 8 178*25cf1a30Sjl #define PCMU_SHIFT_PIC1 0 179*25cf1a30Sjl 180*25cf1a30Sjl /* 181*25cf1a30Sjl * CMU-CH-specific register offsets & bit field positions. 182*25cf1a30Sjl */ 183*25cf1a30Sjl 184*25cf1a30Sjl /* 185*25cf1a30Sjl * Offsets of global registers: 186*25cf1a30Sjl */ 187*25cf1a30Sjl #define PCMU_CB_DEVICE_ID_REG_OFFSET 0x00000000 /* RAGS */ 188*25cf1a30Sjl #define PCMU_CB_CONTROL_STATUS_REG_OFFSET 0x00000010 189*25cf1a30Sjl 190*25cf1a30Sjl /* 191*25cf1a30Sjl * CMU-CH performance counters offsets. 192*25cf1a30Sjl */ 193*25cf1a30Sjl #define PCMU_PERF_PCR_OFFSET 0x00000100 194*25cf1a30Sjl #define PCMU_PERF_PIC_OFFSET 0x00000108 195*25cf1a30Sjl 196*25cf1a30Sjl /* 197*25cf1a30Sjl * Offsets of registers in the interrupt block: 198*25cf1a30Sjl */ 199*25cf1a30Sjl #define PCMU_IB_OBIO_INTR_MAP_REG_OFFSET 0x00001000 200*25cf1a30Sjl #define PCMU_IB_OBIO_CLEAR_INTR_REG_OFFSET 0x00001800 201*25cf1a30Sjl 202*25cf1a30Sjl /* 203*25cf1a30Sjl * Offsets of registers in the PBM block: 204*25cf1a30Sjl */ 205*25cf1a30Sjl #define PCMU_PCI_PBM_REG_BASE 0x00002000 /* RAGS */ 206*25cf1a30Sjl #define PCMU_PCI_CTRL_REG_OFFSET 0x00000000 207*25cf1a30Sjl #define PCMU_PCI_ASYNC_FLT_STATUS_REG_OFFSET 0x00000010 208*25cf1a30Sjl #define PCMU_PCI_ASYNC_FLT_ADDR_REG_OFFSET 0x00000018 209*25cf1a30Sjl #define PCMU_PCI_DIAG_REG_OFFSET 0x00000020 210*25cf1a30Sjl 211*25cf1a30Sjl /* 212*25cf1a30Sjl * CMU-CH control register bit definitions: 213*25cf1a30Sjl */ 214*25cf1a30Sjl #define PCMU_CB_CONTROL_STATUS_MODE 0x0000000000000001ull 215*25cf1a30Sjl #define PCMU_CB_CONTROL_STATUS_IMPL 0xf000000000000000ull 216*25cf1a30Sjl #define PCMU_CB_CONTROL_STATUS_IMPL_SHIFT 60 217*25cf1a30Sjl #define PCMU_CB_CONTROL_STATUS_VER 0x0f00000000000000ull 218*25cf1a30Sjl #define PCMU_CB_CONTROL_STATUS_VER_SHIFT 56 219*25cf1a30Sjl 220*25cf1a30Sjl /* 221*25cf1a30Sjl * CMU-CH ECC UE AFSR bit definitions: 222*25cf1a30Sjl */ 223*25cf1a30Sjl #define PCMU_ECC_UE_AFSR_BYTEMASK 0x0000ffff00000000ull 224*25cf1a30Sjl #define PCMU_ECC_UE_AFSR_BYTEMASK_SHIFT 32 225*25cf1a30Sjl #define PCMU_ECC_UE_AFSR_DW_OFFSET 0x00000000e0000000ull 226*25cf1a30Sjl #define PCMU_ECC_UE_AFSR_DW_OFFSET_SHIFT 29 227*25cf1a30Sjl #define PCMU_ECC_UE_AFSR_ID 0x000000001f000000ull 228*25cf1a30Sjl #define PCMU_ECC_UE_AFSR_ID_SHIFT 24 229*25cf1a30Sjl #define PCMU_ECC_UE_AFSR_BLK 0x0000000000800000ull 230*25cf1a30Sjl 231*25cf1a30Sjl /* 232*25cf1a30Sjl * CMU-CH pci control register bits: 233*25cf1a30Sjl */ 234*25cf1a30Sjl #define PCMU_PCI_CTRL_ARB_PARK 0x0000000000200000ull 235*25cf1a30Sjl #define PCMU_PCI_CTRL_WAKEUP_EN 0x0000000000000200ull 236*25cf1a30Sjl #define PCMU_PCI_CTRL_ERR_INT_EN 0x0000000000000100ull 237*25cf1a30Sjl #define PCMU_PCI_CTRL_ARB_EN_MASK 0x000000000000000full 238*25cf1a30Sjl 239*25cf1a30Sjl /* 240*25cf1a30Sjl * CMU-CH PCI asynchronous fault status register bit definitions: 241*25cf1a30Sjl */ 242*25cf1a30Sjl #define PCMU_PCI_AFSR_PE_SHIFT 60 243*25cf1a30Sjl #define PCMU_PCI_AFSR_SE_SHIFT 56 244*25cf1a30Sjl #define PCMU_PCI_AFSR_E_MA 0x0000000000000008ull 245*25cf1a30Sjl #define PCMU_PCI_AFSR_E_TA 0x0000000000000004ull 246*25cf1a30Sjl #define PCMU_PCI_AFSR_E_RTRY 0x0000000000000002ull 247*25cf1a30Sjl #define PCMU_PCI_AFSR_E_PERR 0x0000000000000001ull 248*25cf1a30Sjl #define PCMU_PCI_AFSR_E_MASK 0x000000000000000full 249*25cf1a30Sjl #define PCMU_PCI_AFSR_BYTEMASK 0x0000ffff00000000ull 250*25cf1a30Sjl #define PCMU_PCI_AFSR_BYTEMASK_SHIFT 32 251*25cf1a30Sjl #define PCMU_PCI_AFSR_BLK 0x0000000080000000ull 252*25cf1a30Sjl #define PCMU_PCI_AFSR_MID 0x000000003e000000ull 253*25cf1a30Sjl #define PCMU_PCI_AFSR_MID_SHIFT 25 254*25cf1a30Sjl 255*25cf1a30Sjl /* 256*25cf1a30Sjl * CMU-CH PCI diagnostic register bit definitions: 257*25cf1a30Sjl */ 258*25cf1a30Sjl #define PCMU_PCI_DIAG_DIS_DWSYNC 0x0000000000000010ull 259*25cf1a30Sjl 260*25cf1a30Sjl #define PBM_AFSR_TO_PRIERR(afsr) \ 261*25cf1a30Sjl (afsr >> PCMU_PCI_AFSR_PE_SHIFT & PCMU_PCI_AFSR_E_MASK) 262*25cf1a30Sjl #define PBM_AFSR_TO_SECERR(afsr) \ 263*25cf1a30Sjl (afsr >> PCMU_PCI_AFSR_SE_SHIFT & PCMU_PCI_AFSR_E_MASK) 264*25cf1a30Sjl 265*25cf1a30Sjl #define PCMU_ID_TO_IGN(pcmu_id) ((pcmu_ign_t)UPAID_TO_IGN(pcmu_id)) 266*25cf1a30Sjl 267*25cf1a30Sjl 268*25cf1a30Sjl /* 269*25cf1a30Sjl * Number of dispatch target entries. 270*25cf1a30Sjl */ 271*25cf1a30Sjl #define U2U_DATA_NUM 16 272*25cf1a30Sjl 273*25cf1a30Sjl /* 274*25cf1a30Sjl * Offsets of registers in the Interrupt Dispatch Table: 275*25cf1a30Sjl */ 276*25cf1a30Sjl #define U2U_MODE_STATUS_REGISTER_OFFSET 0x00000000 277*25cf1a30Sjl #define U2U_PID_REGISTER_OFFSET 0x00000008 278*25cf1a30Sjl #define U2U_DATA_REGISTER_OFFSET 0x00000010 279*25cf1a30Sjl 280*25cf1a30Sjl /* 281*25cf1a30Sjl * Mode Status register bit definitions: 282*25cf1a30Sjl */ 283*25cf1a30Sjl #define U2U_MS_IEV 0x00000040 /* bit-6: Interrupt Extension enable */ 284*25cf1a30Sjl 285*25cf1a30Sjl /* 286*25cf1a30Sjl * Index number of U2U registers in OBP's "regs-property" of CMU-CH 287*25cf1a30Sjl */ 288*25cf1a30Sjl #define REGS_INDEX_OF_U2U 3 289*25cf1a30Sjl 290*25cf1a30Sjl /* 291*25cf1a30Sjl * The following two difinitions are used to control target id 292*25cf1a30Sjl * for Interrupt dispatch data by software. 293*25cf1a30Sjl */ 294*25cf1a30Sjl typedef struct u2u_ittrans_id { 295*25cf1a30Sjl uint_t u2u_tgt_cpu_id; /* target CPU ID */ 296*25cf1a30Sjl uint_t u2u_rsv1; /* reserved */ 297*25cf1a30Sjl volatile uint64_t *u2u_ino_map_reg; /* u2u intr. map register */ 298*25cf1a30Sjl } u2u_ittrans_id_t; 299*25cf1a30Sjl 300*25cf1a30Sjl typedef struct u2u_ittrans_data { 301*25cf1a30Sjl kmutex_t u2u_ittrans_lock; 302*25cf1a30Sjl uintptr_t u2u_regs_base; /* "reg" property */ 303*25cf1a30Sjl ddi_acc_handle_t u2u_acc; /* pointer to acc */ 304*25cf1a30Sjl uint_t u2u_port_id; /* "PID" register n U2U */ 305*25cf1a30Sjl uint_t u2u_board; /* "board#" property */ 306*25cf1a30Sjl u2u_ittrans_id_t u2u_ittrans_id[U2U_DATA_NUM]; 307*25cf1a30Sjl } u2u_ittrans_data_t; 308*25cf1a30Sjl 309*25cf1a30Sjl 310*25cf1a30Sjl /* 311*25cf1a30Sjl * Offsets of registers in the interrupt block: 312*25cf1a30Sjl */ 313*25cf1a30Sjl 314*25cf1a30Sjl #define PCMU_IB_UPA0_INTR_MAP_REG_OFFSET 0x6000 315*25cf1a30Sjl #define PCMU_IB_UPA1_INTR_MAP_REG_OFFSET 0x8000 316*25cf1a30Sjl #define PCMU_IB_SLOT_CLEAR_INTR_REG_OFFSET 0x1400 317*25cf1a30Sjl #define PCMU_IB_OBIO_INTR_STATE_DIAG_REG 0xA808 318*25cf1a30Sjl #define PCMU_IB_INTR_RETRY_TIMER_OFFSET 0x1A00 319*25cf1a30Sjl 320*25cf1a30Sjl /* 321*25cf1a30Sjl * Offsets of registers in the ECC block: 322*25cf1a30Sjl */ 323*25cf1a30Sjl #define PCMU_ECC_CSR_OFFSET 0x20 324*25cf1a30Sjl #define PCMU_UE_AFSR_OFFSET 0x30 325*25cf1a30Sjl #define PCMU_UE_AFAR_OFFSET 0x38 326*25cf1a30Sjl 327*25cf1a30Sjl /* 328*25cf1a30Sjl * CMU-CH control register bit definitions: 329*25cf1a30Sjl */ 330*25cf1a30Sjl #define PCMU_CB_CONTROL_STATUS_IGN 0x0007c00000000000ull 331*25cf1a30Sjl #define PCMU_CB_CONTROL_STATUS_IGN_SHIFT 46 332*25cf1a30Sjl #define PCMU_CB_CONTROL_STATUS_APCKEN 0x0000000000000008ull 333*25cf1a30Sjl #define PCMU_CB_CONTROL_STATUS_APERR 0x0000000000000004ull 334*25cf1a30Sjl #define PCMU_CB_CONTROL_STATUS_IAP 0x0000000000000002ull 335*25cf1a30Sjl 336*25cf1a30Sjl /* 337*25cf1a30Sjl * CMU-CH interrupt mapping register bit definitions: 338*25cf1a30Sjl */ 339*25cf1a30Sjl #define PCMU_INTR_MAP_REG_VALID 0x0000000080000000ull 340*25cf1a30Sjl #define PCMU_INTR_MAP_REG_TID 0x000000007C000000ull 341*25cf1a30Sjl #define PCMU_INTR_MAP_REG_IGN 0x00000000000007C0ull 342*25cf1a30Sjl #define PCMU_INTR_MAP_REG_INO 0x000000000000003full 343*25cf1a30Sjl #define PCMU_INTR_MAP_REG_TID_SHIFT 26 344*25cf1a30Sjl #define PCMU_INTR_MAP_REG_IGN_SHIFT 6 345*25cf1a30Sjl 346*25cf1a30Sjl /* 347*25cf1a30Sjl * CMU-CH clear interrupt register bit definitions: 348*25cf1a30Sjl */ 349*25cf1a30Sjl #define PCMU_CLEAR_INTR_REG_MASK 0x0000000000000003ull 350*25cf1a30Sjl #define PCMU_CLEAR_INTR_REG_IDLE 0x0000000000000000ull 351*25cf1a30Sjl #define PCMU_CLEAR_INTR_REG_RECEIVED 0x0000000000000001ull 352*25cf1a30Sjl #define PCMU_CLEAR_INTR_REG_RSVD 0x0000000000000002ull 353*25cf1a30Sjl #define PCMU_CLEAR_INTR_REG_PENDING 0x0000000000000003ull 354*25cf1a30Sjl 355*25cf1a30Sjl /* 356*25cf1a30Sjl * CMU-CH ECC control register bit definitions: 357*25cf1a30Sjl */ 358*25cf1a30Sjl #define PCMU_ECC_CTRL_ECC_EN 0x8000000000000000ull 359*25cf1a30Sjl #define PCMU_ECC_CTRL_UE_INTEN 0x4000000000000000ull 360*25cf1a30Sjl 361*25cf1a30Sjl /* 362*25cf1a30Sjl * CMU-CH ECC UE AFSR bit definitions: 363*25cf1a30Sjl */ 364*25cf1a30Sjl #define PCMU_ECC_UE_AFSR_PE_SHIFT 61 365*25cf1a30Sjl #define PCMU_ECC_UE_AFSR_SE_SHIFT 58 366*25cf1a30Sjl #define PCMU_ECC_UE_AFSR_E_MASK 0x0000000000000007ull 367*25cf1a30Sjl #define PCMU_ECC_UE_AFSR_E_PIO 0x0000000000000004ull 368*25cf1a30Sjl 369*25cf1a30Sjl /* 370*25cf1a30Sjl * CMU-CH PCI diagnostic register bit definitions: 371*25cf1a30Sjl */ 372*25cf1a30Sjl #define PCMU_PCI_DIAG_DIS_RETRY 0x0000000000000040ull 373*25cf1a30Sjl #define PCMU_PCI_DIAG_DIS_INTSYNC 0x0000000000000020ull 374*25cf1a30Sjl 375*25cf1a30Sjl 376*25cf1a30Sjl #define NAMEINST(dip) ddi_driver_name(dip), ddi_get_instance(dip) 377*25cf1a30Sjl #define NAMEADDR(dip) ddi_node_name(dip), ddi_get_name_addr(dip) 378*25cf1a30Sjl 379*25cf1a30Sjl 380*25cf1a30Sjl /* 381*25cf1a30Sjl * CMU-CH Tunables 382*25cf1a30Sjl */ 383*25cf1a30Sjl extern uint32_t pcmu_spurintr_duration; /* spurious interupt duration */ 384*25cf1a30Sjl extern ushort_t pcmu_command_default; /* default command */ 385*25cf1a30Sjl extern uint_t ecc_error_intr_enable; /* ECC error intr */ 386*25cf1a30Sjl extern uint_t pcmu_ecc_afsr_retries; /* num ECC afsr retries */ 387*25cf1a30Sjl extern uint_t pcmu_intr_retry_intv; /* intr retry interval */ 388*25cf1a30Sjl extern uint_t pcmu_panic_on_fatal_errors; /* PANIC on fatal errors */ 389*25cf1a30Sjl extern uint_t pcmu_unclaimed_intr_max; /* Max unclaimed interrupts */ 390*25cf1a30Sjl extern hrtime_t pcmu_intrpend_timeout; /* intr pending timeout */ 391*25cf1a30Sjl 392*25cf1a30Sjl 393*25cf1a30Sjl extern void *per_pcmu_state; /* per-pbm soft state pointer */ 394*25cf1a30Sjl extern kmutex_t pcmu_global_mutex; /* attach/detach common struct lock */ 395*25cf1a30Sjl extern uint64_t pcmu_errtrig_pa; 396*25cf1a30Sjl 397*25cf1a30Sjl 398*25cf1a30Sjl /* 399*25cf1a30Sjl * Prototypes. 400*25cf1a30Sjl */ 401*25cf1a30Sjl extern void pcmu_post_uninit_child(pcmu_t *); 402*25cf1a30Sjl extern void pcmu_kstat_init(void); 403*25cf1a30Sjl extern void pcmu_kstat_fini(void); 404*25cf1a30Sjl extern void pcmu_add_upstream_kstat(pcmu_t *); 405*25cf1a30Sjl extern void pcmu_fix_ranges(pcmu_ranges_t *, int); 406*25cf1a30Sjl extern uint_t pcmu_pbm_disable_errors(pcmu_pbm_t *); 407*25cf1a30Sjl extern uint32_t ib_map_reg_get_cpu(volatile uint64_t); 408*25cf1a30Sjl extern uint64_t *ib_intr_map_reg_addr(pcmu_ib_t *, pcmu_ib_ino_t); 409*25cf1a30Sjl extern uint64_t *ib_clear_intr_reg_addr(pcmu_ib_t *, pcmu_ib_ino_t); 410*25cf1a30Sjl extern void pcmu_cb_setup(pcmu_t *); 411*25cf1a30Sjl extern void pcmu_cb_teardown(pcmu_t *); 412*25cf1a30Sjl extern int cb_register_intr(pcmu_t *); 413*25cf1a30Sjl extern void cb_enable_intr(pcmu_t *); 414*25cf1a30Sjl extern uint64_t cb_ino_to_map_pa(pcmu_cb_t *, pcmu_ib_ino_t); 415*25cf1a30Sjl extern uint64_t cb_ino_to_clr_pa(pcmu_cb_t *, pcmu_ib_ino_t); 416*25cf1a30Sjl extern int cb_remove_xintr(pcmu_t *, dev_info_t *, dev_info_t *, 417*25cf1a30Sjl pcmu_ib_ino_t, pcmu_ib_mondo_t); 418*25cf1a30Sjl extern uint32_t pcmu_intr_dist_cpuid(pcmu_ib_t *, pcmu_ib_ino_info_t *); 419*25cf1a30Sjl extern void pcmu_ecc_setup(pcmu_ecc_t *); 420*25cf1a30Sjl extern ushort_t pcmu_ecc_get_synd(uint64_t); 421*25cf1a30Sjl extern void pcmu_pbm_setup(pcmu_pbm_t *); 422*25cf1a30Sjl extern void pcmu_pbm_teardown(pcmu_pbm_t *); 423*25cf1a30Sjl extern uintptr_t pcmu_ib_setup(pcmu_ib_t *); 424*25cf1a30Sjl extern int pcmu_get_numproxy(dev_info_t *); 425*25cf1a30Sjl extern int pcmu_ecc_add_intr(pcmu_t *, int, pcmu_ecc_intr_info_t *); 426*25cf1a30Sjl extern void pcmu_ecc_rem_intr(pcmu_t *, int, pcmu_ecc_intr_info_t *); 427*25cf1a30Sjl extern int pcmu_pbm_err_handler(dev_info_t *, ddi_fm_error_t *, 428*25cf1a30Sjl const void *, int); 429*25cf1a30Sjl extern void pcmu_ecc_classify(uint64_t, pcmu_ecc_errstate_t *); 430*25cf1a30Sjl extern int pcmu_pbm_classify(pcmu_pbm_errstate_t *); 431*25cf1a30Sjl extern int pcmu_check_error(pcmu_t *); 432*25cf1a30Sjl extern void set_intr_mapping_reg(int, uint64_t *, int); 433*25cf1a30Sjl extern uint32_t pcmu_class_to_pil(dev_info_t *rdip); 434*25cf1a30Sjl extern int pcmu_add_intr(dev_info_t *dip, dev_info_t *rdip, 435*25cf1a30Sjl ddi_intr_handle_impl_t *hdlp); 436*25cf1a30Sjl extern int pcmu_remove_intr(dev_info_t *dip, dev_info_t *rdip, 437*25cf1a30Sjl ddi_intr_handle_impl_t *hdlp); 438*25cf1a30Sjl extern void pcmu_intr_teardown(pcmu_t *pcmu_p); 439*25cf1a30Sjl 440*25cf1a30Sjl extern int u2u_translate_tgtid(pcmu_t *, uint_t, volatile uint64_t *); 441*25cf1a30Sjl extern void u2u_ittrans_cleanup(u2u_ittrans_data_t *, volatile uint64_t *); 442*25cf1a30Sjl void pcmu_err_create(pcmu_t *pcmu_p); 443*25cf1a30Sjl void pcmu_err_destroy(pcmu_t *pcmu_p); 444*25cf1a30Sjl void pcmu_pbm_ereport_post(dev_info_t *dip, uint64_t ena, 445*25cf1a30Sjl pcmu_pbm_errstate_t *pbm_err); 446*25cf1a30Sjl #ifdef __cplusplus 447*25cf1a30Sjl } 448*25cf1a30Sjl #endif 449*25cf1a30Sjl 450*25cf1a30Sjl #endif /* _SYS_PCICMU_H */ 451