xref: /illumos-gate/usr/src/uts/sun4/io/px/px_pec.h (revision e6b21d58)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*e6b21d58SErwin T Tsaur  * Common Development and Distribution License (the "License").
6*e6b21d58SErwin T Tsaur  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21*e6b21d58SErwin T Tsaur 
227c478bd9Sstevel@tonic-gate /*
23*e6b21d58SErwin T Tsaur  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_PX_PEC_H
277c478bd9Sstevel@tonic-gate #define	_SYS_PX_PEC_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #include <sys/types.h>
307c478bd9Sstevel@tonic-gate #include <sys/ontrap.h>
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
337c478bd9Sstevel@tonic-gate extern "C" {
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate /*
377c478bd9Sstevel@tonic-gate  * The following structure represents the pci-express configuration
387c478bd9Sstevel@tonic-gate  * header for a fire PEC.
397c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate typedef struct px_config_header {
417c478bd9Sstevel@tonic-gate 	volatile uint16_t ch_vendor_id;
427c478bd9Sstevel@tonic-gate 	volatile uint16_t ch_device_id;
437c478bd9Sstevel@tonic-gate 	volatile uint16_t ch_command_reg;
447c478bd9Sstevel@tonic-gate 	volatile uint16_t ch_status_reg;
457c478bd9Sstevel@tonic-gate 	volatile uint8_t ch_revision_id_reg;
467c478bd9Sstevel@tonic-gate 	volatile uint8_t ch_programming_if_code_reg;
477c478bd9Sstevel@tonic-gate 	volatile uint8_t ch_sub_class_reg;
487c478bd9Sstevel@tonic-gate 	volatile uint8_t ch_base_class_reg;
497c478bd9Sstevel@tonic-gate 	volatile uint8_t ch_cache_line_size_reg;
507c478bd9Sstevel@tonic-gate 	volatile uint8_t ch_latency_timer_reg;
517c478bd9Sstevel@tonic-gate 	volatile uint8_t ch_header_type_reg;
527c478bd9Sstevel@tonic-gate } px_config_header_t;
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate /*
557c478bd9Sstevel@tonic-gate  * Bit fields of ch_status_reg for cmn_err's %b
567c478bd9Sstevel@tonic-gate  */
577c478bd9Sstevel@tonic-gate #define	PX_STATUS_BITS "\020\
587c478bd9Sstevel@tonic-gate \11signaled-parity-error\
597c478bd9Sstevel@tonic-gate \14signaled-target-abort\
607c478bd9Sstevel@tonic-gate \15received-target-abort\
617c478bd9Sstevel@tonic-gate \16received-master-abort\
627c478bd9Sstevel@tonic-gate \17signaled-system-error\
637c478bd9Sstevel@tonic-gate \20detected-parity-error"
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate /*
667c478bd9Sstevel@tonic-gate  * pec block soft state structure:
677c478bd9Sstevel@tonic-gate  *
687c478bd9Sstevel@tonic-gate  * Each px node has its own private pec block structure.
697c478bd9Sstevel@tonic-gate  */
707c478bd9Sstevel@tonic-gate typedef struct px_pec {
717c478bd9Sstevel@tonic-gate 	px_t		*pec_px_p;	/* link back to px soft state */
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate 	/*
747c478bd9Sstevel@tonic-gate 	 * Memory address range on this PBM used to determine DMA on this pec
757c478bd9Sstevel@tonic-gate 	 */
767c478bd9Sstevel@tonic-gate 	px_iopfn_t		pec_base32_pfn;
777c478bd9Sstevel@tonic-gate 	px_iopfn_t		pec_last32_pfn;
787c478bd9Sstevel@tonic-gate 	px_iopfn_t		pec_base64_pfn;
797c478bd9Sstevel@tonic-gate 	px_iopfn_t		pec_last64_pfn;
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate 	/*
827c478bd9Sstevel@tonic-gate 	 * support for ddi_poke:
837c478bd9Sstevel@tonic-gate 	 */
847c478bd9Sstevel@tonic-gate 	on_trap_data_t	*pec_ontrap_data;
85f8d2de6bSjchu 	int		pec_safeacc_type;
867c478bd9Sstevel@tonic-gate 	kmutex_t	pec_pokefault_mutex;
877c478bd9Sstevel@tonic-gate 
88f8d2de6bSjchu 	/*
89f8d2de6bSjchu 	 * support for cautious
90f8d2de6bSjchu 	 */
91f8d2de6bSjchu 	ddi_acc_handle_t pec_acc_hdl;
92f8d2de6bSjchu 
937c478bd9Sstevel@tonic-gate #define	PBM_NAMESTR_BUFLEN 	64
947c478bd9Sstevel@tonic-gate 	/* driver name & instance */
957c478bd9Sstevel@tonic-gate 	char		pec_nameinst_str[PBM_NAMESTR_BUFLEN];
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate 	/* nodename & node_addr */
987c478bd9Sstevel@tonic-gate 	char		*pec_nameaddr_str;
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate 	/* MSIQ used for correctable/fatal/non fatala PCIe messages */
1017c478bd9Sstevel@tonic-gate 	msiqid_t	pec_corr_msg_msiq_id;
1027c478bd9Sstevel@tonic-gate 	msiqid_t	pec_non_fatal_msg_msiq_id;
1037c478bd9Sstevel@tonic-gate 	msiqid_t	pec_fatal_msg_msiq_id;
1047c478bd9Sstevel@tonic-gate } px_pec_t;
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate /*
1077c478bd9Sstevel@tonic-gate  * forward declarations (object creation and destruction):
1087c478bd9Sstevel@tonic-gate  */
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate extern int px_pec_attach(px_t *px_p);
1117c478bd9Sstevel@tonic-gate extern void px_pec_detach(px_t *px_p);
112*e6b21d58SErwin T Tsaur extern int  px_pec_msg_add_intr(px_t *px_p);
113*e6b21d58SErwin T Tsaur extern void px_pec_msg_rem_intr(px_t *px_p);
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1167c478bd9Sstevel@tonic-gate }
1177c478bd9Sstevel@tonic-gate #endif
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate #endif	/* _SYS_PX_PEC_H */
120