xref: /onnv-gate/usr/src/uts/sun4u/opl/sys/pcicmu/pcmu_pbm.h (revision 1772:78cca3d2cc4b)
1*1772Sjl139090 /*
2*1772Sjl139090  * CDDL HEADER START
3*1772Sjl139090  *
4*1772Sjl139090  * The contents of this file are subject to the terms of the
5*1772Sjl139090  * Common Development and Distribution License (the "License").
6*1772Sjl139090  * You may not use this file except in compliance with the License.
7*1772Sjl139090  *
8*1772Sjl139090  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*1772Sjl139090  * or http://www.opensolaris.org/os/licensing.
10*1772Sjl139090  * See the License for the specific language governing permissions
11*1772Sjl139090  * and limitations under the License.
12*1772Sjl139090  *
13*1772Sjl139090  * When distributing Covered Code, include this CDDL HEADER in each
14*1772Sjl139090  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*1772Sjl139090  * If applicable, add the following below this CDDL HEADER, with the
16*1772Sjl139090  * fields enclosed by brackets "[]" replaced with your own identifying
17*1772Sjl139090  * information: Portions Copyright [yyyy] [name of copyright owner]
18*1772Sjl139090  *
19*1772Sjl139090  * CDDL HEADER END
20*1772Sjl139090  */
21*1772Sjl139090 /*
22*1772Sjl139090  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*1772Sjl139090  * Use is subject to license terms.
24*1772Sjl139090  */
25*1772Sjl139090 
26*1772Sjl139090 #ifndef	_SYS_PCMU_PBM_H
27*1772Sjl139090 #define	_SYS_PCMU_PBM_H
28*1772Sjl139090 
29*1772Sjl139090 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*1772Sjl139090 
31*1772Sjl139090 #include <sys/types.h>
32*1772Sjl139090 #include <sys/dditypes.h>
33*1772Sjl139090 #include <sys/ontrap.h>
34*1772Sjl139090 #include <sys/callb.h>
35*1772Sjl139090 
36*1772Sjl139090 #ifdef	__cplusplus
37*1772Sjl139090 extern "C" {
38*1772Sjl139090 #endif
39*1772Sjl139090 
40*1772Sjl139090 /*
41*1772Sjl139090  * The following structure represents the pci configuration header
42*1772Sjl139090  * for CMU-CH PBM.
43*1772Sjl139090  */
44*1772Sjl139090 typedef struct config_header {
45*1772Sjl139090 	volatile uint16_t ch_vendor_id;
46*1772Sjl139090 	volatile uint16_t ch_device_id;
47*1772Sjl139090 	volatile uint16_t ch_command_reg;
48*1772Sjl139090 	volatile uint16_t ch_status_reg;
49*1772Sjl139090 	volatile uint8_t ch_revision_id_reg;
50*1772Sjl139090 	volatile uint8_t ch_programming_if_code_reg;
51*1772Sjl139090 	volatile uint8_t ch_sub_class_reg;
52*1772Sjl139090 	volatile uint8_t ch_base_class_reg;
53*1772Sjl139090 	volatile uint8_t ch_cache_line_size_reg;
54*1772Sjl139090 	volatile uint8_t ch_latency_timer_reg;
55*1772Sjl139090 	volatile uint8_t ch_header_type_reg;
56*1772Sjl139090 } config_header_t;
57*1772Sjl139090 
58*1772Sjl139090 #define	PBM_NAMESTR_BUFLEN	64
59*1772Sjl139090 
60*1772Sjl139090 /*
61*1772Sjl139090  * CMU-CH pbm block soft state structure:
62*1772Sjl139090  */
63*1772Sjl139090 struct pcmu_pbm {
64*1772Sjl139090 	pcmu_t *pcbm_pcmu_p;		/* link back to the soft state */
65*1772Sjl139090 
66*1772Sjl139090 	volatile uint64_t *pcbm_ctrl_reg;		/* PBM control reg */
67*1772Sjl139090 	volatile uint64_t *pcbm_async_flt_status_reg;	/* PBM AFSR reg */
68*1772Sjl139090 	volatile uint64_t *pcbm_async_flt_addr_reg;	/* PBM AFAR reg */
69*1772Sjl139090 	volatile uint64_t *pcbm_diag_reg;		/* PBM diag reg */
70*1772Sjl139090 
71*1772Sjl139090 	config_header_t *pcbm_config_header;		/* PBM config header */
72*1772Sjl139090 	uint64_t pcbm_imr_save;				/* intr map save area */
73*1772Sjl139090 	ddi_iblock_cookie_t pcbm_iblock_cookie;	/* PBM error intr priority */
74*1772Sjl139090 
75*1772Sjl139090 	on_trap_data_t *pcbm_ontrap_data;	/* ddi_poke support */
76*1772Sjl139090 	kmutex_t pcbm_pokeflt_mutex;		/* poke mutex */
77*1772Sjl139090 	ddi_acc_handle_t pcbm_excl_handle;	/* cautious IO access handle */
78*1772Sjl139090 	char pcbm_nameinst_str[PBM_NAMESTR_BUFLEN]; /* driver name & inst */
79*1772Sjl139090 	char *pcbm_nameaddr_str;		/* node name & address */
80*1772Sjl139090 };
81*1772Sjl139090 
82*1772Sjl139090 /*
83*1772Sjl139090  * Prototypes
84*1772Sjl139090  */
85*1772Sjl139090 extern void pcmu_pbm_create(pcmu_t *pcmu_p);
86*1772Sjl139090 extern void pcmu_pbm_destroy(pcmu_t *pcmu_p);
87*1772Sjl139090 extern void pcmu_pbm_configure(pcmu_pbm_t *pcbm_p);
88*1772Sjl139090 extern void pcmu_pbm_suspend(pcmu_pbm_t *pcbm_p);
89*1772Sjl139090 extern void pcmu_pbm_resume(pcmu_pbm_t *pcbm_p);
90*1772Sjl139090 extern void pcmu_pbm_intr_dist(void *arg);
91*1772Sjl139090 extern int pcmu_pbm_register_intr(pcmu_pbm_t *pcbm_p);
92*1772Sjl139090 extern int pcmu_pbm_afsr_report(dev_info_t *dip, uint64_t fme_ena,
93*1772Sjl139090     pcmu_pbm_errstate_t *pbm_err_p);
94*1772Sjl139090 
95*1772Sjl139090 #ifdef	__cplusplus
96*1772Sjl139090 }
97*1772Sjl139090 #endif
98*1772Sjl139090 
99*1772Sjl139090 #endif	/* _SYS_PCMU_PBM_H */
100