xref: /titanic_50/usr/src/uts/sun4u/io/px/px_lib4u.h (revision 89b42a211fa7d3527b9615260f495d22e430c5c5)
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
544bb982bSgovinda  * Common Development and Distribution License (the "License").
644bb982bSgovinda  * 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  */
217c478bd9Sstevel@tonic-gate /*
22*89b42a21Sandrew.rutz@sun.com  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate #ifndef _SYS_PX_LIB4U_H
267c478bd9Sstevel@tonic-gate #define	_SYS_PX_LIB4U_H
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
297c478bd9Sstevel@tonic-gate extern "C" {
307c478bd9Sstevel@tonic-gate #endif
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate /*
337c478bd9Sstevel@tonic-gate  * Errors returned.
347c478bd9Sstevel@tonic-gate  */
357c478bd9Sstevel@tonic-gate #define	H_EOK			0	/* Successful return */
367c478bd9Sstevel@tonic-gate #define	H_ENOINTR		1	/* Invalid interrupt id */
377c478bd9Sstevel@tonic-gate #define	H_EINVAL		2	/* Invalid argument */
387c478bd9Sstevel@tonic-gate #define	H_ENOACCESS		3	/* No access to resource */
397c478bd9Sstevel@tonic-gate #define	H_EIO			4	/* I/O error */
407c478bd9Sstevel@tonic-gate #define	H_ENOTSUPPORTED		5	/* Function not supported */
417c478bd9Sstevel@tonic-gate #define	H_ENOMAP		6	/* Mapping is not valid, */
427c478bd9Sstevel@tonic-gate 					/* no translation exists */
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /*
45f8d2de6bSjchu  * Register base definitions.
46f8d2de6bSjchu  *
47f8d2de6bSjchu  * The specific numeric values for CSR, XBUS, Configuration,
48f8d2de6bSjchu  * Interrupt blocks and other register bases.
49f8d2de6bSjchu  */
50f8d2de6bSjchu typedef enum {
51f8d2de6bSjchu 	PX_REG_CSR = 0,
52f8d2de6bSjchu 	PX_REG_XBC,
53f8d2de6bSjchu 	PX_REG_CFG,
54f8d2de6bSjchu 	PX_REG_IC,
55f8d2de6bSjchu 	PX_REG_MAX
56f8d2de6bSjchu } px_reg_bank_t;
57f8d2de6bSjchu 
58f8d2de6bSjchu /*
59f8d2de6bSjchu  * Registers/state/variables that need to be saved and restored during
60f8d2de6bSjchu  * suspend/resume.
61f8d2de6bSjchu  *
627c478bd9Sstevel@tonic-gate  * SUN4U px specific data structure.
637c478bd9Sstevel@tonic-gate  */
6401689544Sjchu 
6501689544Sjchu /* Control block soft state structure */
6601689544Sjchu typedef struct px_cb_list {
6701689544Sjchu 	px_t			*pxp;
6801689544Sjchu 	struct px_cb_list	*next;
6901689544Sjchu } px_cb_list_t;
7001689544Sjchu 
717e1db6d2Sschwartz /* IO chip type */
727e1db6d2Sschwartz typedef enum {
737e1db6d2Sschwartz 	PX_CHIP_UNIDENTIFIED = 0,
747e1db6d2Sschwartz 	PX_CHIP_FIRE = 1,
757e1db6d2Sschwartz 	PX_CHIP_OBERON = 2
767e1db6d2Sschwartz } px_chip_type_t;
777e1db6d2Sschwartz 
787e1db6d2Sschwartz #define	PX_CHIP_TYPE(pxu_p)	((pxu_p)->chip_type)
797e1db6d2Sschwartz 
8001689544Sjchu typedef struct px_cb {
8101689544Sjchu 	px_cb_list_t	*pxl;		/* linked list px */
8201689544Sjchu 	kmutex_t	cb_mutex;	/* lock for CB */
8301689544Sjchu 	sysino_t	sysino;		/* proxy sysino */
8401689544Sjchu 	cpuid_t		cpuid;		/* proxy cpuid */
8501689544Sjchu 	int		attachcnt;	/* number of attached px */
8601689544Sjchu 	uint_t		(*px_cb_func)(caddr_t); /* CB intr dispatcher */
8701689544Sjchu } px_cb_t;
8801689544Sjchu 
897c478bd9Sstevel@tonic-gate typedef struct pxu {
907e1db6d2Sschwartz 	px_chip_type_t	chip_type;
917c478bd9Sstevel@tonic-gate 	uint8_t		portid;
927c478bd9Sstevel@tonic-gate 	uint16_t	tsb_cookie;
937c478bd9Sstevel@tonic-gate 	uint32_t	tsb_size;
947c478bd9Sstevel@tonic-gate 	uint64_t	*tsb_vaddr;
9525cf1a30Sjl139090 	uint64_t	tsb_paddr;	/* Only used for Oberon */
960d5b93d9Sgovinda 	sysino_t	hp_sysino;	/* Oberon hotplug interrupt */
9725cf1a30Sjl139090 
987c478bd9Sstevel@tonic-gate 	void		*msiq_mapped_p;
9901689544Sjchu 	px_cb_t		*px_cb_p;
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate 	/* Soft state for suspend/resume */
1027c478bd9Sstevel@tonic-gate 	uint64_t	*pec_config_state;
1037c478bd9Sstevel@tonic-gate 	uint64_t	*mmu_config_state;
1047c478bd9Sstevel@tonic-gate 	uint64_t	*ib_intr_map;
1057c478bd9Sstevel@tonic-gate 	uint64_t	*ib_config_state;
1067c478bd9Sstevel@tonic-gate 	uint64_t	*xcb_config_state;
1077c478bd9Sstevel@tonic-gate 	uint64_t	*msiq_config_state;
108bf8fc234Set142600 	uint_t		cpr_flag;
109f8d2de6bSjchu 
110f8d2de6bSjchu 	/* sun4u specific vars */
111f8d2de6bSjchu 	caddr_t			px_address[4];
112f8d2de6bSjchu 	ddi_acc_handle_t	px_ac[4];
113*89b42a21Sandrew.rutz@sun.com 	uint64_t		obp_tsb_paddr;
114*89b42a21Sandrew.rutz@sun.com 	uint_t			obp_tsb_entries;
115f0a73f04Sschwartz 
116f0a73f04Sschwartz 	/* PCItool */
117f0a73f04Sschwartz 	caddr_t		pcitool_addr;
1187c478bd9Sstevel@tonic-gate } pxu_t;
1197c478bd9Sstevel@tonic-gate 
12001689544Sjchu #define	PX2CB(px_p) (((pxu_t *)px_p->px_plat_p)->px_cb_p)
12101689544Sjchu 
122bf8fc234Set142600 /* cpr_flag */
123bf8fc234Set142600 #define	PX_NOT_CPR	0
124bf8fc234Set142600 #define	PX_ENTERED_CPR	1
125bf8fc234Set142600 
1267c478bd9Sstevel@tonic-gate /*
1277c478bd9Sstevel@tonic-gate  * Event Queue data structure.
1287c478bd9Sstevel@tonic-gate  */
1297c478bd9Sstevel@tonic-gate typedef	struct eq_rec {
1307c478bd9Sstevel@tonic-gate 	uint64_t	eq_rec_rsvd0 : 1,	/* DW 0 - 63 */
1317c478bd9Sstevel@tonic-gate 			eq_rec_fmt_type : 7,	/* DW 0 - 62:56 */
1327c478bd9Sstevel@tonic-gate 			eq_rec_len : 10,	/* DW 0 - 55:46 */
1337c478bd9Sstevel@tonic-gate 			eq_rec_addr0 : 14,	/* DW 0 - 45:32 */
1347c478bd9Sstevel@tonic-gate 			eq_rec_rid : 16,	/* DW 0 - 31:16 */
1357c478bd9Sstevel@tonic-gate 			eq_rec_data0 : 16;	/* DW 0 - 15:00 */
1367c478bd9Sstevel@tonic-gate 	uint64_t	eq_rec_addr1 : 48,	/* DW 1 - 63:16 */
1377c478bd9Sstevel@tonic-gate 			eq_rec_data1 : 16;	/* DW 1 - 15:0 */
1387c478bd9Sstevel@tonic-gate 	uint64_t	eq_rec_rsvd[6];		/* DW 2-7 */
1397c478bd9Sstevel@tonic-gate } eq_rec_t;
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate /*
1427c478bd9Sstevel@tonic-gate  * EQ record type
1437c478bd9Sstevel@tonic-gate  *
1447c478bd9Sstevel@tonic-gate  * Upper 4 bits of eq_rec_fmt_type is used
1457c478bd9Sstevel@tonic-gate  * to identify the EQ record type.
1467c478bd9Sstevel@tonic-gate  */
1477c478bd9Sstevel@tonic-gate #define	EQ_REC_MSG	0x6			/* MSG   - 0x3X */
1487c478bd9Sstevel@tonic-gate #define	EQ_REC_MSI32	0xB			/* MSI32 - 0x58 */
1497c478bd9Sstevel@tonic-gate #define	EQ_REC_MSI64	0xF			/* MSI64 - 0x78 */
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate /* EQ State */
1527c478bd9Sstevel@tonic-gate #define	EQ_IDLE_STATE	0x1			/* IDLE */
1537c478bd9Sstevel@tonic-gate #define	EQ_ACTIVE_STATE	0x2			/* ACTIVE */
1547c478bd9Sstevel@tonic-gate #define	EQ_ERROR_STATE	0x4			/* ERROR */
1557c478bd9Sstevel@tonic-gate 
15626947304SEvan Yan /*
15726947304SEvan Yan  * Default EQ Configurations
15826947304SEvan Yan  */
15926947304SEvan Yan #define	EQ_CNT		36
16026947304SEvan Yan #define	EQ_REC_CNT	128
16126947304SEvan Yan #define	EQ_1ST_ID	0
16226947304SEvan Yan #define	EQ_1ST_DEVINO	24
16326947304SEvan Yan 
1647c478bd9Sstevel@tonic-gate #define	MMU_INVALID_TTE		0ull
1657c478bd9Sstevel@tonic-gate #define	MMU_TTE_VALID(tte)	(((tte) & MMU_TTE_V) == MMU_TTE_V)
16625cf1a30Sjl139090 #define	MMU_OBERON_PADDR_MASK	0x7fffffffffff
16725cf1a30Sjl139090 #define	MMU_FIRE_PADDR_MASK	0x7ffffffffff
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate /*
1707c478bd9Sstevel@tonic-gate  * control register decoding
1717c478bd9Sstevel@tonic-gate  */
1727c478bd9Sstevel@tonic-gate /* tsb size: 0=1k 1=2k 2=4k 3=8k 4=16k 5=32k 6=64k 7=128k */
1737c478bd9Sstevel@tonic-gate #define	MMU_CTL_TO_TSBSIZE(ctl)		((ctl) >> 16)
1747c478bd9Sstevel@tonic-gate #define	MMU_TSBSIZE_TO_TSBENTRIES(s)	((1 << (s)) << (13 - 3))
1757c478bd9Sstevel@tonic-gate 
1767c478bd9Sstevel@tonic-gate /*
17725cf1a30Sjl139090  * For Fire mmu bypass addresses, bit 43 specifies cacheability.
1787c478bd9Sstevel@tonic-gate  */
17925cf1a30Sjl139090 #define	MMU_FIRE_BYPASS_NONCACHE	 (1ull << 43)
18025cf1a30Sjl139090 
18125cf1a30Sjl139090 /*
18225cf1a30Sjl139090  * For Oberon mmu bypass addresses, bit 47 specifies cacheability.
18325cf1a30Sjl139090  */
18425cf1a30Sjl139090 #define	MMU_OBERON_BYPASS_NONCACHE	 (1ull << 47)
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate /*
1877c478bd9Sstevel@tonic-gate  * The following macros define the address ranges supported for DVMA
18825cf1a30Sjl139090  * and mmu bypass transfers. For Oberon, bit 63 is used for ordering.
1897c478bd9Sstevel@tonic-gate  */
19025cf1a30Sjl139090 #define	MMU_FIRE_BYPASS_BASE		0xFFFC000000000000ull
191073dbf91Sdwoods #define	MMU_FIRE_BYPASS_END		0xFFFC03FFFFFFFFFFull
19225cf1a30Sjl139090 
19325cf1a30Sjl139090 #define	MMU_OBERON_BYPASS_BASE		0x7FFC000000000000ull
194073dbf91Sdwoods #define	MMU_OBERON_BYPASS_END		0x7FFC7FFFFFFFFFFFull
19525cf1a30Sjl139090 
196a616a11eSLida.Horn #define	MMU_OBERON_BYPASS_RO		0x8000000000000000ull
197a616a11eSLida.Horn 
19825cf1a30Sjl139090 #define	MMU_TSB_PA_MASK		0x7FFFFFFFE000
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate /*
2017c478bd9Sstevel@tonic-gate  * The following macros are for loading and unloading io tte
2027c478bd9Sstevel@tonic-gate  * entries.
2037c478bd9Sstevel@tonic-gate  */
2047c478bd9Sstevel@tonic-gate #define	MMU_TTE_SIZE		8
2057c478bd9Sstevel@tonic-gate #define	MMU_TTE_V		(1ull << 63)
2067c478bd9Sstevel@tonic-gate #define	MMU_TTE_W		(1ull << 1)
20725cf1a30Sjl139090 #define	MMU_TTE_RO		(1ull << 62)	/* Oberon Relaxed Ordering */
2087c478bd9Sstevel@tonic-gate 
2097c478bd9Sstevel@tonic-gate #define	INO_BITS		6	/* INO#s are 6 bits long */
2107c478bd9Sstevel@tonic-gate #define	INO_MASK		0x3F	/* INO#s mask */
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate #define	SYSINO_TO_DEVINO(sysino)	(sysino & INO_MASK)
2137c478bd9Sstevel@tonic-gate 
214bbe55e82Sam139583 #define	FIRE_IGN_MASK		0x1F	/* IGN#s mask, 5 bits long for Fire */
215bbe55e82Sam139583 #define	OBERON_IGN_MASK		0xFF	/* IGN#s mask, 8 bits long for Oberon */
216bbe55e82Sam139583 
217bbe55e82Sam139583 #define	ID_TO_IGN(chip, portid) ((portid) & ((chip) == PX_CHIP_OBERON ? \
218bbe55e82Sam139583 	OBERON_IGN_MASK : FIRE_IGN_MASK))
219bbe55e82Sam139583 
220bbe55e82Sam139583 #define	DEVINO_TO_SYSINO(portid, devino) \
221bbe55e82Sam139583 	(((portid) << INO_BITS) | ((devino) & INO_MASK))
222bbe55e82Sam139583 
2237c478bd9Sstevel@tonic-gate /* Interrupt states */
2247c478bd9Sstevel@tonic-gate #define	INTERRUPT_IDLE_STATE		0
2257c478bd9Sstevel@tonic-gate #define	INTERRUPT_RECEIVED_STATE	1
2267c478bd9Sstevel@tonic-gate #define	INTERRUPT_PENDING_STATE		3
2277c478bd9Sstevel@tonic-gate 
2287c478bd9Sstevel@tonic-gate /*
2297c478bd9Sstevel@tonic-gate  * Defines for link width and max packet size for ACKBAK Latency Threshold Timer
2307c478bd9Sstevel@tonic-gate  * and TxLink Replay Timer Latency Table array sizes
2317c478bd9Sstevel@tonic-gate  * Num		Link Width		Packet Size
2327c478bd9Sstevel@tonic-gate  * 0		1			128
2337c478bd9Sstevel@tonic-gate  * 1		4			256
2347c478bd9Sstevel@tonic-gate  * 2		8			512
2357c478bd9Sstevel@tonic-gate  * 3		16			1024
2367c478bd9Sstevel@tonic-gate  * 4		-			2048
2377c478bd9Sstevel@tonic-gate  * 5		-			4096
2387c478bd9Sstevel@tonic-gate  */
2397c478bd9Sstevel@tonic-gate #define	LINK_WIDTH_ARR_SIZE		4
2407c478bd9Sstevel@tonic-gate #define	LINK_MAX_PKT_ARR_SIZE		6
2417c478bd9Sstevel@tonic-gate 
2427c478bd9Sstevel@tonic-gate /*
2437c478bd9Sstevel@tonic-gate  * Defines for registers which have multi-bit fields.
2447c478bd9Sstevel@tonic-gate  */
2457c478bd9Sstevel@tonic-gate #define	TLU_LINK_CONTROL_ASPM_DISABLED			0x0
2467c478bd9Sstevel@tonic-gate #define	TLU_LINK_CONTROL_ASPM_L0S_EN			0x1
2477c478bd9Sstevel@tonic-gate #define	TLU_LINK_CONTROL_ASPM_L1_EN			0x2
2487c478bd9Sstevel@tonic-gate #define	TLU_LINK_CONTROL_ASPM_L0S_L1_EN			0x3
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate #define	TLU_CONTROL_CONFIG_DEFAULT			0x1
2517c478bd9Sstevel@tonic-gate #define	TLU_CONTROL_L0S_TIM_DEFAULT			0xdaull
2527c478bd9Sstevel@tonic-gate #define	TLU_CONTROL_MPS_MASK				0x1C
2537c478bd9Sstevel@tonic-gate #define	TLU_CONTROL_MPS_SHIFT				2
2547c478bd9Sstevel@tonic-gate 
2557c478bd9Sstevel@tonic-gate #define	LPU_TXLINK_REPLAY_NUMBER_STATUS_RPLAY_NUM_0	0x0
2567c478bd9Sstevel@tonic-gate #define	LPU_TXLINK_REPLAY_NUMBER_STATUS_RPLAY_NUM_1	0x1
2577c478bd9Sstevel@tonic-gate #define	LPU_TXLINK_REPLAY_NUMBER_STATUS_RPLAY_NUM_2	0x2
2587c478bd9Sstevel@tonic-gate #define	LPU_TXLINK_REPLAY_NUMBER_STATUS_RPLAY_NUM_3	0x3
2597c478bd9Sstevel@tonic-gate 
2607c478bd9Sstevel@tonic-gate #define	LPU_TXLINK_RETRY_FIFO_POINTER_RTRY_FIFO_TLPTR_DEFAULT	0xFFFFull
2617c478bd9Sstevel@tonic-gate #define	LPU_TXLINK_RETRY_FIFO_POINTER_RTRY_FIFO_HDPTR_DEFAULT	0x0ull
2627c478bd9Sstevel@tonic-gate 
2637c478bd9Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNTER_ACK_SEQ_CNTR_DEFAULT	0xFFF
2647c478bd9Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNTER_NXT_TX_SEQ_CNTR_DEFAULT	0x0
2657c478bd9Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNT_FIFO_MAX_ADDR_SEQ_CNT_MAX_ADDR_DEF	0x157
2667c478bd9Sstevel@tonic-gate 
2677c478bd9Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNT_FIFO_POINTERS_SEQ_CNT_TLPTR_DEFAULT	0xFFF
2687c478bd9Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNT_FIFO_POINTERS_SEQ_CNT_HDPTR_DEFAULT	0x0
2697c478bd9Sstevel@tonic-gate 
2707c478bd9Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG1_LTSSM_8_TO_DEFAULT		0x2
2717c478bd9Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG1_LTSSM_20_TO_DEFAULT		0x5
2727c478bd9Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG2_LTSSM_12_TO_DEFAULT		0x2DC6C0
2737c478bd9Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG3_LTSSM_2_TO_DEFAULT		0x7A120
2747c478bd9Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG4_DATA_RATE_DEFAULT		0x2
2757c478bd9Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG4_N_FTS_DEFAULT			0x8c
2767c478bd9Sstevel@tonic-gate 
2771a887b2eSjchu /* LPU LTSSM states */
2781a887b2eSjchu #define	LPU_LTSSM_L0			0x0
2791a887b2eSjchu #define	LPU_LTSSM_L1_IDLE		0x15
2801a887b2eSjchu 
2811a887b2eSjchu /* TLU Control register bits */
2821a887b2eSjchu #define	TLU_REMAIN_DETECT_QUIET		8
2831a887b2eSjchu 
2847c478bd9Sstevel@tonic-gate /*
2857c478bd9Sstevel@tonic-gate  * Fire hardware specific version definitions.
2867e1db6d2Sschwartz  * All Fire versions > 2.0 will be numerically greater than FIRE_MOD_REV_20
2877c478bd9Sstevel@tonic-gate  */
2887e1db6d2Sschwartz #define	FIRE_MOD_REV_20	0x03
2897e1db6d2Sschwartz 
2907e1db6d2Sschwartz /*
2917e1db6d2Sschwartz  * Oberon specific definitions.
2927e1db6d2Sschwartz  */
29325cf1a30Sjl139090 #define	OBERON_RANGE_PROP_MASK	0x7fff
2947c478bd9Sstevel@tonic-gate 
295f0a73f04Sschwartz /*
296f0a73f04Sschwartz  * HW specific paddr mask.
297f0a73f04Sschwartz  */
298f0a73f04Sschwartz extern uint64_t px_paddr_mask;
299f0a73f04Sschwartz 
3007c478bd9Sstevel@tonic-gate extern void hvio_cb_init(caddr_t xbc_csr_base, pxu_t *pxu_p);
3017c478bd9Sstevel@tonic-gate extern void hvio_ib_init(caddr_t csr_base, pxu_t *pxu_p);
3027c478bd9Sstevel@tonic-gate extern void hvio_mmu_init(caddr_t csr_base, pxu_t *pxu_p);
3037c478bd9Sstevel@tonic-gate extern void hvio_pec_init(caddr_t csr_base, pxu_t *pxu_p);
3047c478bd9Sstevel@tonic-gate 
3057c478bd9Sstevel@tonic-gate extern uint64_t hvio_intr_devino_to_sysino(devhandle_t dev_hdl, pxu_t *pxu_p,
3067c478bd9Sstevel@tonic-gate     devino_t devino, sysino_t *sysino);
3077c478bd9Sstevel@tonic-gate extern uint64_t hvio_intr_getvalid(devhandle_t dev_hdl, sysino_t sysino,
3087c478bd9Sstevel@tonic-gate     intr_valid_state_t *intr_valid_state);
3097c478bd9Sstevel@tonic-gate extern uint64_t hvio_intr_setvalid(devhandle_t dev_hdl, sysino_t sysino,
3107c478bd9Sstevel@tonic-gate     intr_valid_state_t intr_valid_state);
3117c478bd9Sstevel@tonic-gate extern uint64_t hvio_intr_getstate(devhandle_t dev_hdl, sysino_t sysino,
3127c478bd9Sstevel@tonic-gate     intr_state_t *intr_state);
3137c478bd9Sstevel@tonic-gate extern uint64_t hvio_intr_setstate(devhandle_t dev_hdl, sysino_t sysino,
3147c478bd9Sstevel@tonic-gate     intr_state_t intr_state);
31525cf1a30Sjl139090 extern uint64_t hvio_intr_gettarget(devhandle_t dev_hdl, pxu_t *pxu_p,
31625cf1a30Sjl139090     sysino_t sysino, cpuid_t *cpuid);
31725cf1a30Sjl139090 extern uint64_t hvio_intr_settarget(devhandle_t dev_hdl, pxu_t *pxu_p,
31825cf1a30Sjl139090     sysino_t sysino, cpuid_t cpuid);
3197c478bd9Sstevel@tonic-gate 
3207c478bd9Sstevel@tonic-gate extern uint64_t hvio_iommu_map(devhandle_t dev_hdl, pxu_t *pxu_p, tsbid_t tsbid,
32144bb982bSgovinda     pages_t pages, io_attributes_t attr, void *addr, size_t pfn_index,
32244bb982bSgovinda     int flags);
3237c478bd9Sstevel@tonic-gate extern uint64_t hvio_iommu_demap(devhandle_t dev_hdl, pxu_t *pxu_p,
3247c478bd9Sstevel@tonic-gate     tsbid_t tsbid, pages_t pages);
3257c478bd9Sstevel@tonic-gate extern uint64_t hvio_iommu_getmap(devhandle_t dev_hdl, pxu_t *pxu_p,
32644bb982bSgovinda     tsbid_t tsbid, io_attributes_t *attr_p, r_addr_t *r_addr_p);
32725cf1a30Sjl139090 extern uint64_t hvio_iommu_getbypass(devhandle_t dev_hdl, pxu_t *pxu_p,
32825cf1a30Sjl139090     r_addr_t ra, io_attributes_t attr, io_addr_t *io_addr_p);
32925cf1a30Sjl139090 extern uint64_t hvio_get_bypass_base(pxu_t *pxu_p);
33025cf1a30Sjl139090 extern uint64_t hvio_get_bypass_end(pxu_t *pxu_p);
33126947304SEvan Yan extern uint64_t px_get_range_prop(px_t *px_p, pci_ranges_t *rp, int bank);
332*89b42a21Sandrew.rutz@sun.com extern void hvio_obptsb_attach(pxu_t *pxu_p);
333*89b42a21Sandrew.rutz@sun.com extern void hvio_obptsb_detach(px_t *px_p);
33425cf1a30Sjl139090 
3357c478bd9Sstevel@tonic-gate 
3367c478bd9Sstevel@tonic-gate /*
3377c478bd9Sstevel@tonic-gate  * MSIQ Functions:
3387c478bd9Sstevel@tonic-gate  */
3397c478bd9Sstevel@tonic-gate extern uint64_t hvio_msiq_init(devhandle_t dev_hdl, pxu_t *pxu_p);
3407c478bd9Sstevel@tonic-gate extern uint64_t hvio_msiq_getvalid(devhandle_t dev_hdl, msiqid_t msiq_id,
3417c478bd9Sstevel@tonic-gate     pci_msiq_valid_state_t *msiq_valid_state);
3427c478bd9Sstevel@tonic-gate extern uint64_t hvio_msiq_setvalid(devhandle_t dev_hdl, msiqid_t msiq_id,
3437c478bd9Sstevel@tonic-gate     pci_msiq_valid_state_t msiq_valid_state);
3447c478bd9Sstevel@tonic-gate extern uint64_t hvio_msiq_getstate(devhandle_t dev_hdl, msiqid_t msiq_id,
3457c478bd9Sstevel@tonic-gate     pci_msiq_state_t *msiq_state);
3467c478bd9Sstevel@tonic-gate extern uint64_t hvio_msiq_setstate(devhandle_t dev_hdl, msiqid_t msiq_id,
3477c478bd9Sstevel@tonic-gate     pci_msiq_state_t msiq_state);
3487c478bd9Sstevel@tonic-gate extern uint64_t hvio_msiq_gethead(devhandle_t dev_hdl, msiqid_t msiq_id,
3497c478bd9Sstevel@tonic-gate     msiqhead_t *msiq_head);
3507c478bd9Sstevel@tonic-gate extern uint64_t hvio_msiq_sethead(devhandle_t dev_hdl, msiqid_t msiq_id,
3517c478bd9Sstevel@tonic-gate     msiqhead_t msiq_head);
3527c478bd9Sstevel@tonic-gate extern uint64_t hvio_msiq_gettail(devhandle_t dev_hdl, msiqid_t msiq_id,
3537c478bd9Sstevel@tonic-gate     msiqtail_t *msiq_tail);
3547c478bd9Sstevel@tonic-gate 
3557c478bd9Sstevel@tonic-gate /*
3567c478bd9Sstevel@tonic-gate  * MSI Functions:
3577c478bd9Sstevel@tonic-gate  */
3587c478bd9Sstevel@tonic-gate extern uint64_t hvio_msi_init(devhandle_t dev_hdl, uint64_t addr32,
3597c478bd9Sstevel@tonic-gate     uint64_t addr64);
3607c478bd9Sstevel@tonic-gate extern uint64_t hvio_msi_getmsiq(devhandle_t dev_hdl, msinum_t msi_num,
3617c478bd9Sstevel@tonic-gate     msiqid_t *msiq_id);
3627c478bd9Sstevel@tonic-gate extern uint64_t hvio_msi_setmsiq(devhandle_t dev_hdl, msinum_t msi_num,
3637c478bd9Sstevel@tonic-gate     msiqid_t msiq_id);
3647c478bd9Sstevel@tonic-gate extern uint64_t hvio_msi_getvalid(devhandle_t dev_hdl, msinum_t msi_num,
3657c478bd9Sstevel@tonic-gate     pci_msi_valid_state_t *msi_valid_state);
3667c478bd9Sstevel@tonic-gate extern uint64_t hvio_msi_setvalid(devhandle_t dev_hdl, msinum_t msi_num,
3677c478bd9Sstevel@tonic-gate     pci_msi_valid_state_t msi_valid_state);
3687c478bd9Sstevel@tonic-gate extern uint64_t hvio_msi_getstate(devhandle_t dev_hdl, msinum_t msi_num,
3697c478bd9Sstevel@tonic-gate     pci_msi_state_t *msi_state);
3707c478bd9Sstevel@tonic-gate extern uint64_t hvio_msi_setstate(devhandle_t dev_hdl, msinum_t msi_num,
3717c478bd9Sstevel@tonic-gate     pci_msi_state_t msi_state);
3727c478bd9Sstevel@tonic-gate 
3737c478bd9Sstevel@tonic-gate /*
3747c478bd9Sstevel@tonic-gate  * MSG Functions:
3757c478bd9Sstevel@tonic-gate  */
3767c478bd9Sstevel@tonic-gate extern uint64_t hvio_msg_getmsiq(devhandle_t dev_hdl, pcie_msg_type_t msg_type,
3777c478bd9Sstevel@tonic-gate     msiqid_t *msiq_id);
3787c478bd9Sstevel@tonic-gate extern uint64_t hvio_msg_setmsiq(devhandle_t dev_hdl, pcie_msg_type_t msg_type,
3797c478bd9Sstevel@tonic-gate     msiqid_t msiq_id);
3807c478bd9Sstevel@tonic-gate extern uint64_t hvio_msg_getvalid(devhandle_t dev_hdl, pcie_msg_type_t msg_type,
3817c478bd9Sstevel@tonic-gate     pcie_msg_valid_state_t *msg_valid_state);
3827c478bd9Sstevel@tonic-gate extern uint64_t hvio_msg_setvalid(devhandle_t dev_hdl, pcie_msg_type_t msg_type,
3837c478bd9Sstevel@tonic-gate     pcie_msg_valid_state_t msg_valid_state);
3847c478bd9Sstevel@tonic-gate 
3857c478bd9Sstevel@tonic-gate /*
3867c478bd9Sstevel@tonic-gate  * Suspend/Resume Functions:
3877c478bd9Sstevel@tonic-gate  */
3887c478bd9Sstevel@tonic-gate extern uint64_t hvio_suspend(devhandle_t dev_hdl, pxu_t *pxu_p);
3897c478bd9Sstevel@tonic-gate extern void hvio_resume(devhandle_t dev_hdl,
3907c478bd9Sstevel@tonic-gate     devino_t devino, pxu_t *pxu_p);
3917c478bd9Sstevel@tonic-gate extern uint64_t hvio_cb_suspend(devhandle_t dev_hdl, pxu_t *pxu_p);
3927c478bd9Sstevel@tonic-gate extern void hvio_cb_resume(devhandle_t pci_dev_hdl, devhandle_t xbus_dev_hdl,
3937c478bd9Sstevel@tonic-gate     devino_t devino, pxu_t *pxu_p);
3947c478bd9Sstevel@tonic-gate extern int px_send_pme_turnoff(caddr_t csr_base);
3951a887b2eSjchu extern int px_link_wait4l1idle(caddr_t csr_base);
3961a887b2eSjchu extern int px_link_retrain(caddr_t csr_base);
3971a887b2eSjchu extern void px_enable_detect_quiet(caddr_t csr_base);
3987c478bd9Sstevel@tonic-gate 
399bf8fc234Set142600 extern void px_lib_clr_errs(px_t *px_p, dev_info_t *rdip, uint64_t addr);
40069cd775fSschwartz 
40125cf1a30Sjl139090 /*
40225cf1a30Sjl139090  * Hotplug functions:
40325cf1a30Sjl139090  */
40425cf1a30Sjl139090 extern int hvio_hotplug_init(dev_info_t *dip, void *arg);
40525cf1a30Sjl139090 extern int hvio_hotplug_uninit(dev_info_t *dip);
40625cf1a30Sjl139090 
4077c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
4087c478bd9Sstevel@tonic-gate }
4097c478bd9Sstevel@tonic-gate #endif
4107c478bd9Sstevel@tonic-gate 
4117c478bd9Sstevel@tonic-gate #endif	/* _SYS_PX_LIB4U_H */
412