xref: /onnv-gate/usr/src/uts/sun4/io/px/px_pec.h (revision 12458:8a6b6f4699c0)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*12458SErwin.Tsaur@Sun.COM  * Common Development and Distribution License (the "License").
6*12458SErwin.Tsaur@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
21*12458SErwin.Tsaur@Sun.COM 
220Sstevel@tonic-gate /*
23*12458SErwin.Tsaur@Sun.COM  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_PX_PEC_H
270Sstevel@tonic-gate #define	_SYS_PX_PEC_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #include <sys/types.h>
300Sstevel@tonic-gate #include <sys/ontrap.h>
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #ifdef	__cplusplus
330Sstevel@tonic-gate extern "C" {
340Sstevel@tonic-gate #endif
350Sstevel@tonic-gate 
360Sstevel@tonic-gate /*
370Sstevel@tonic-gate  * The following structure represents the pci-express configuration
380Sstevel@tonic-gate  * header for a fire PEC.
390Sstevel@tonic-gate  */
400Sstevel@tonic-gate typedef struct px_config_header {
410Sstevel@tonic-gate 	volatile uint16_t ch_vendor_id;
420Sstevel@tonic-gate 	volatile uint16_t ch_device_id;
430Sstevel@tonic-gate 	volatile uint16_t ch_command_reg;
440Sstevel@tonic-gate 	volatile uint16_t ch_status_reg;
450Sstevel@tonic-gate 	volatile uint8_t ch_revision_id_reg;
460Sstevel@tonic-gate 	volatile uint8_t ch_programming_if_code_reg;
470Sstevel@tonic-gate 	volatile uint8_t ch_sub_class_reg;
480Sstevel@tonic-gate 	volatile uint8_t ch_base_class_reg;
490Sstevel@tonic-gate 	volatile uint8_t ch_cache_line_size_reg;
500Sstevel@tonic-gate 	volatile uint8_t ch_latency_timer_reg;
510Sstevel@tonic-gate 	volatile uint8_t ch_header_type_reg;
520Sstevel@tonic-gate } px_config_header_t;
530Sstevel@tonic-gate 
540Sstevel@tonic-gate /*
550Sstevel@tonic-gate  * Bit fields of ch_status_reg for cmn_err's %b
560Sstevel@tonic-gate  */
570Sstevel@tonic-gate #define	PX_STATUS_BITS "\020\
580Sstevel@tonic-gate \11signaled-parity-error\
590Sstevel@tonic-gate \14signaled-target-abort\
600Sstevel@tonic-gate \15received-target-abort\
610Sstevel@tonic-gate \16received-master-abort\
620Sstevel@tonic-gate \17signaled-system-error\
630Sstevel@tonic-gate \20detected-parity-error"
640Sstevel@tonic-gate 
650Sstevel@tonic-gate /*
660Sstevel@tonic-gate  * pec block soft state structure:
670Sstevel@tonic-gate  *
680Sstevel@tonic-gate  * Each px node has its own private pec block structure.
690Sstevel@tonic-gate  */
700Sstevel@tonic-gate typedef struct px_pec {
710Sstevel@tonic-gate 	px_t		*pec_px_p;	/* link back to px soft state */
720Sstevel@tonic-gate 
730Sstevel@tonic-gate 	/*
740Sstevel@tonic-gate 	 * Memory address range on this PBM used to determine DMA on this pec
750Sstevel@tonic-gate 	 */
760Sstevel@tonic-gate 	px_iopfn_t		pec_base32_pfn;
770Sstevel@tonic-gate 	px_iopfn_t		pec_last32_pfn;
780Sstevel@tonic-gate 	px_iopfn_t		pec_base64_pfn;
790Sstevel@tonic-gate 	px_iopfn_t		pec_last64_pfn;
800Sstevel@tonic-gate 
810Sstevel@tonic-gate 	/*
820Sstevel@tonic-gate 	 * support for ddi_poke:
830Sstevel@tonic-gate 	 */
840Sstevel@tonic-gate 	on_trap_data_t	*pec_ontrap_data;
8527Sjchu 	int		pec_safeacc_type;
860Sstevel@tonic-gate 	kmutex_t	pec_pokefault_mutex;
870Sstevel@tonic-gate 
8827Sjchu 	/*
8927Sjchu 	 * support for cautious
9027Sjchu 	 */
9127Sjchu 	ddi_acc_handle_t pec_acc_hdl;
9227Sjchu 
930Sstevel@tonic-gate #define	PBM_NAMESTR_BUFLEN 	64
940Sstevel@tonic-gate 	/* driver name & instance */
950Sstevel@tonic-gate 	char		pec_nameinst_str[PBM_NAMESTR_BUFLEN];
960Sstevel@tonic-gate 
970Sstevel@tonic-gate 	/* nodename & node_addr */
980Sstevel@tonic-gate 	char		*pec_nameaddr_str;
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate 	/* MSIQ used for correctable/fatal/non fatala PCIe messages */
1010Sstevel@tonic-gate 	msiqid_t	pec_corr_msg_msiq_id;
1020Sstevel@tonic-gate 	msiqid_t	pec_non_fatal_msg_msiq_id;
1030Sstevel@tonic-gate 	msiqid_t	pec_fatal_msg_msiq_id;
1040Sstevel@tonic-gate } px_pec_t;
1050Sstevel@tonic-gate 
1060Sstevel@tonic-gate /*
1070Sstevel@tonic-gate  * forward declarations (object creation and destruction):
1080Sstevel@tonic-gate  */
1090Sstevel@tonic-gate 
1100Sstevel@tonic-gate extern int px_pec_attach(px_t *px_p);
1110Sstevel@tonic-gate extern void px_pec_detach(px_t *px_p);
112*12458SErwin.Tsaur@Sun.COM extern int  px_pec_msg_add_intr(px_t *px_p);
113*12458SErwin.Tsaur@Sun.COM extern void px_pec_msg_rem_intr(px_t *px_p);
1140Sstevel@tonic-gate 
1150Sstevel@tonic-gate #ifdef	__cplusplus
1160Sstevel@tonic-gate }
1170Sstevel@tonic-gate #endif
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate #endif	/* _SYS_PX_PEC_H */
120