pcicmu.h revision 25cf1a301a396c38e8adf52c15f537b80d2483f7
/*
* 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
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_PCICMU_H
#define _SYS_PCICMU_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/pci_intr_lib.h>
/*
* The following typedef is used to represent a
* 1275 "bus-range" property of a PCI Bus node.
*/
struct pcmu_bus_range {
};
/*
* Structure to represent an entry in the
* "ranges" property of a device node.
*/
struct pcmu_ranges {
};
typedef enum {
} pcmu_state_t;
typedef enum {
} pcmu_obj_t;
typedef enum {
#define PCI_OPLCMU "pcicmu"
/*
* pcicmu soft state structure.
*/
struct pcicmu {
/*
* State flags and mutex:
*/
/*
* Links to other state structures:
*/
/*
* other state info:
*/
/*
* pci device node properties:
*/
int pcmu_ranges_length;
int pcmu_inos_len; /* "interrupts" length */
int pcmu_numproxy; /* upa interrupt proxies */
/*
* register mapping:
*/
/*
* Performance counters kstat.
*/
/* Fault Management support */
int pcmu_fm_cap;
};
/*
* pcmu_soft_state values.
*/
#define PCMU_SOFT_STATE_OPEN 0x01
#define PCMU_SOFT_STATE_OPEN_EXCL 0x02
#define PCMU_SOFT_STATE_CLOSED 0x04
/*
* CMU-CH and PBM soft state macros:
*/
#define PCMU_AP_MINOR_NUM_TO_INSTANCE(x) ((x) >> 8)
#define get_pcmu_soft_state(i) \
#define alloc_pcmu_soft_state(i) \
#define free_pcmu_soft_state(i) \
/*
* Performance counters information.
*/
#define PCMU_SHIFT_PIC0 8
#define PCMU_SHIFT_PIC1 0
/*
* CMU-CH-specific register offsets & bit field positions.
*/
/*
* Offsets of global registers:
*/
#define PCMU_CB_CONTROL_STATUS_REG_OFFSET 0x00000010
/*
* CMU-CH performance counters offsets.
*/
#define PCMU_PERF_PCR_OFFSET 0x00000100
#define PCMU_PERF_PIC_OFFSET 0x00000108
/*
* Offsets of registers in the interrupt block:
*/
#define PCMU_IB_OBIO_INTR_MAP_REG_OFFSET 0x00001000
#define PCMU_IB_OBIO_CLEAR_INTR_REG_OFFSET 0x00001800
/*
* Offsets of registers in the PBM block:
*/
#define PCMU_PCI_CTRL_REG_OFFSET 0x00000000
#define PCMU_PCI_ASYNC_FLT_STATUS_REG_OFFSET 0x00000010
#define PCMU_PCI_ASYNC_FLT_ADDR_REG_OFFSET 0x00000018
#define PCMU_PCI_DIAG_REG_OFFSET 0x00000020
/*
* CMU-CH control register bit definitions:
*/
#define PCMU_CB_CONTROL_STATUS_MODE 0x0000000000000001ull
#define PCMU_CB_CONTROL_STATUS_IMPL 0xf000000000000000ull
#define PCMU_CB_CONTROL_STATUS_IMPL_SHIFT 60
#define PCMU_CB_CONTROL_STATUS_VER 0x0f00000000000000ull
#define PCMU_CB_CONTROL_STATUS_VER_SHIFT 56
/*
* CMU-CH ECC UE AFSR bit definitions:
*/
#define PCMU_ECC_UE_AFSR_BYTEMASK 0x0000ffff00000000ull
#define PCMU_ECC_UE_AFSR_BYTEMASK_SHIFT 32
#define PCMU_ECC_UE_AFSR_DW_OFFSET 0x00000000e0000000ull
#define PCMU_ECC_UE_AFSR_DW_OFFSET_SHIFT 29
#define PCMU_ECC_UE_AFSR_ID 0x000000001f000000ull
#define PCMU_ECC_UE_AFSR_ID_SHIFT 24
#define PCMU_ECC_UE_AFSR_BLK 0x0000000000800000ull
/*
* CMU-CH pci control register bits:
*/
#define PCMU_PCI_CTRL_ARB_PARK 0x0000000000200000ull
#define PCMU_PCI_CTRL_WAKEUP_EN 0x0000000000000200ull
#define PCMU_PCI_CTRL_ERR_INT_EN 0x0000000000000100ull
#define PCMU_PCI_CTRL_ARB_EN_MASK 0x000000000000000full
/*
* CMU-CH PCI asynchronous fault status register bit definitions:
*/
#define PCMU_PCI_AFSR_PE_SHIFT 60
#define PCMU_PCI_AFSR_SE_SHIFT 56
#define PCMU_PCI_AFSR_E_MA 0x0000000000000008ull
#define PCMU_PCI_AFSR_E_TA 0x0000000000000004ull
#define PCMU_PCI_AFSR_E_RTRY 0x0000000000000002ull
#define PCMU_PCI_AFSR_E_PERR 0x0000000000000001ull
#define PCMU_PCI_AFSR_E_MASK 0x000000000000000full
#define PCMU_PCI_AFSR_BYTEMASK 0x0000ffff00000000ull
#define PCMU_PCI_AFSR_BYTEMASK_SHIFT 32
#define PCMU_PCI_AFSR_BLK 0x0000000080000000ull
#define PCMU_PCI_AFSR_MID 0x000000003e000000ull
#define PCMU_PCI_AFSR_MID_SHIFT 25
/*
* CMU-CH PCI diagnostic register bit definitions:
*/
#define PCMU_PCI_DIAG_DIS_DWSYNC 0x0000000000000010ull
#define PBM_AFSR_TO_PRIERR(afsr) \
#define PBM_AFSR_TO_SECERR(afsr) \
/*
* Number of dispatch target entries.
*/
#define U2U_DATA_NUM 16
/*
* Offsets of registers in the Interrupt Dispatch Table:
*/
#define U2U_MODE_STATUS_REGISTER_OFFSET 0x00000000
#define U2U_PID_REGISTER_OFFSET 0x00000008
#define U2U_DATA_REGISTER_OFFSET 0x00000010
/*
* Mode Status register bit definitions:
*/
/*
* Index number of U2U registers in OBP's "regs-property" of CMU-CH
*/
#define REGS_INDEX_OF_U2U 3
/*
* The following two difinitions are used to control target id
* for Interrupt dispatch data by software.
*/
typedef struct u2u_ittrans_id {
typedef struct u2u_ittrans_data {
/*
* Offsets of registers in the interrupt block:
*/
#define PCMU_IB_UPA0_INTR_MAP_REG_OFFSET 0x6000
#define PCMU_IB_UPA1_INTR_MAP_REG_OFFSET 0x8000
#define PCMU_IB_SLOT_CLEAR_INTR_REG_OFFSET 0x1400
#define PCMU_IB_OBIO_INTR_STATE_DIAG_REG 0xA808
#define PCMU_IB_INTR_RETRY_TIMER_OFFSET 0x1A00
/*
* Offsets of registers in the ECC block:
*/
#define PCMU_ECC_CSR_OFFSET 0x20
#define PCMU_UE_AFSR_OFFSET 0x30
#define PCMU_UE_AFAR_OFFSET 0x38
/*
* CMU-CH control register bit definitions:
*/
#define PCMU_CB_CONTROL_STATUS_IGN 0x0007c00000000000ull
#define PCMU_CB_CONTROL_STATUS_IGN_SHIFT 46
#define PCMU_CB_CONTROL_STATUS_APCKEN 0x0000000000000008ull
#define PCMU_CB_CONTROL_STATUS_APERR 0x0000000000000004ull
#define PCMU_CB_CONTROL_STATUS_IAP 0x0000000000000002ull
/*
* CMU-CH interrupt mapping register bit definitions:
*/
#define PCMU_INTR_MAP_REG_VALID 0x0000000080000000ull
#define PCMU_INTR_MAP_REG_TID 0x000000007C000000ull
#define PCMU_INTR_MAP_REG_IGN 0x00000000000007C0ull
#define PCMU_INTR_MAP_REG_INO 0x000000000000003full
#define PCMU_INTR_MAP_REG_TID_SHIFT 26
#define PCMU_INTR_MAP_REG_IGN_SHIFT 6
/*
* CMU-CH clear interrupt register bit definitions:
*/
#define PCMU_CLEAR_INTR_REG_MASK 0x0000000000000003ull
#define PCMU_CLEAR_INTR_REG_IDLE 0x0000000000000000ull
#define PCMU_CLEAR_INTR_REG_RECEIVED 0x0000000000000001ull
#define PCMU_CLEAR_INTR_REG_RSVD 0x0000000000000002ull
#define PCMU_CLEAR_INTR_REG_PENDING 0x0000000000000003ull
/*
* CMU-CH ECC control register bit definitions:
*/
#define PCMU_ECC_CTRL_ECC_EN 0x8000000000000000ull
#define PCMU_ECC_CTRL_UE_INTEN 0x4000000000000000ull
/*
* CMU-CH ECC UE AFSR bit definitions:
*/
#define PCMU_ECC_UE_AFSR_PE_SHIFT 61
#define PCMU_ECC_UE_AFSR_SE_SHIFT 58
#define PCMU_ECC_UE_AFSR_E_MASK 0x0000000000000007ull
#define PCMU_ECC_UE_AFSR_E_PIO 0x0000000000000004ull
/*
* CMU-CH PCI diagnostic register bit definitions:
*/
#define PCMU_PCI_DIAG_DIS_RETRY 0x0000000000000040ull
#define PCMU_PCI_DIAG_DIS_INTSYNC 0x0000000000000020ull
/*
* CMU-CH Tunables
*/
extern void *per_pcmu_state; /* per-pbm soft state pointer */
extern uint64_t pcmu_errtrig_pa;
/*
* Prototypes.
*/
extern void pcmu_post_uninit_child(pcmu_t *);
extern void pcmu_kstat_init(void);
extern void pcmu_kstat_fini(void);
extern void pcmu_add_upstream_kstat(pcmu_t *);
extern void pcmu_fix_ranges(pcmu_ranges_t *, int);
extern void pcmu_cb_setup(pcmu_t *);
extern void pcmu_cb_teardown(pcmu_t *);
extern int cb_register_intr(pcmu_t *);
extern void cb_enable_intr(pcmu_t *);
extern void pcmu_ecc_setup(pcmu_ecc_t *);
extern void pcmu_pbm_setup(pcmu_pbm_t *);
extern void pcmu_pbm_teardown(pcmu_pbm_t *);
extern int pcmu_get_numproxy(dev_info_t *);
const void *, int);
extern int pcmu_pbm_classify(pcmu_pbm_errstate_t *);
extern int pcmu_check_error(pcmu_t *);
extern void set_intr_mapping_reg(int, uint64_t *, int);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_PCICMU_H */