xref: /onnv-gate/usr/src/uts/sun4u/io/px/px_lib4u.h (revision 8691:eb5a870f80e6)
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
51617Sgovinda  * Common Development and Distribution License (the "License").
61617Sgovinda  * 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  */
210Sstevel@tonic-gate /*
22*8691SLida.Horn@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _SYS_PX_LIB4U_H
270Sstevel@tonic-gate #define	_SYS_PX_LIB4U_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #ifdef	__cplusplus
310Sstevel@tonic-gate extern "C" {
320Sstevel@tonic-gate #endif
330Sstevel@tonic-gate 
340Sstevel@tonic-gate /*
350Sstevel@tonic-gate  * Errors returned.
360Sstevel@tonic-gate  */
370Sstevel@tonic-gate #define	H_EOK			0	/* Successful return */
380Sstevel@tonic-gate #define	H_ENOINTR		1	/* Invalid interrupt id */
390Sstevel@tonic-gate #define	H_EINVAL		2	/* Invalid argument */
400Sstevel@tonic-gate #define	H_ENOACCESS		3	/* No access to resource */
410Sstevel@tonic-gate #define	H_EIO			4	/* I/O error */
420Sstevel@tonic-gate #define	H_ENOTSUPPORTED		5	/* Function not supported */
430Sstevel@tonic-gate #define	H_ENOMAP		6	/* Mapping is not valid, */
440Sstevel@tonic-gate 					/* no translation exists */
450Sstevel@tonic-gate 
460Sstevel@tonic-gate /*
4727Sjchu  * Register base definitions.
4827Sjchu  *
4927Sjchu  * The specific numeric values for CSR, XBUS, Configuration,
5027Sjchu  * Interrupt blocks and other register bases.
5127Sjchu  */
5227Sjchu typedef enum {
5327Sjchu 	PX_REG_CSR = 0,
5427Sjchu 	PX_REG_XBC,
5527Sjchu 	PX_REG_CFG,
5627Sjchu 	PX_REG_IC,
5727Sjchu 	PX_REG_MAX
5827Sjchu } px_reg_bank_t;
5927Sjchu 
6027Sjchu /*
6127Sjchu  * Registers/state/variables that need to be saved and restored during
6227Sjchu  * suspend/resume.
6327Sjchu  *
640Sstevel@tonic-gate  * SUN4U px specific data structure.
650Sstevel@tonic-gate  */
661648Sjchu 
671648Sjchu /* Control block soft state structure */
681648Sjchu typedef struct px_cb_list {
691648Sjchu 	px_t			*pxp;
701648Sjchu 	struct px_cb_list	*next;
711648Sjchu } px_cb_list_t;
721648Sjchu 
732426Sschwartz /* IO chip type */
742426Sschwartz typedef enum {
752426Sschwartz 	PX_CHIP_UNIDENTIFIED = 0,
762426Sschwartz 	PX_CHIP_FIRE = 1,
772426Sschwartz 	PX_CHIP_OBERON = 2
782426Sschwartz } px_chip_type_t;
792426Sschwartz 
802426Sschwartz #define	PX_CHIP_TYPE(pxu_p)	((pxu_p)->chip_type)
812426Sschwartz 
821648Sjchu typedef struct px_cb {
831648Sjchu 	px_cb_list_t	*pxl;		/* linked list px */
841648Sjchu 	kmutex_t	cb_mutex;	/* lock for CB */
851648Sjchu 	sysino_t	sysino;		/* proxy sysino */
861648Sjchu 	cpuid_t		cpuid;		/* proxy cpuid */
871648Sjchu 	int		attachcnt;	/* number of attached px */
881648Sjchu 	uint_t		(*px_cb_func)(caddr_t); /* CB intr dispatcher */
891648Sjchu } px_cb_t;
901648Sjchu 
910Sstevel@tonic-gate typedef struct pxu {
922426Sschwartz 	px_chip_type_t	chip_type;
930Sstevel@tonic-gate 	uint8_t		portid;
940Sstevel@tonic-gate 	uint16_t	tsb_cookie;
950Sstevel@tonic-gate 	uint32_t	tsb_size;
960Sstevel@tonic-gate 	uint64_t	*tsb_vaddr;
971772Sjl139090 	uint64_t	tsb_paddr;	/* Only used for Oberon */
984701Sgovinda 	sysino_t	hp_sysino;	/* Oberon hotplug interrupt */
991772Sjl139090 
1000Sstevel@tonic-gate 	void		*msiq_mapped_p;
1011648Sjchu 	px_cb_t		*px_cb_p;
1020Sstevel@tonic-gate 
1030Sstevel@tonic-gate 	/* Soft state for suspend/resume */
1040Sstevel@tonic-gate 	uint64_t	*pec_config_state;
1050Sstevel@tonic-gate 	uint64_t	*mmu_config_state;
1060Sstevel@tonic-gate 	uint64_t	*ib_intr_map;
1070Sstevel@tonic-gate 	uint64_t	*ib_config_state;
1080Sstevel@tonic-gate 	uint64_t	*xcb_config_state;
1090Sstevel@tonic-gate 	uint64_t	*msiq_config_state;
1103274Set142600 	uint_t		cpr_flag;
11127Sjchu 
11227Sjchu 	/* sun4u specific vars */
11327Sjchu 	caddr_t			px_address[4];
11427Sjchu 	ddi_acc_handle_t	px_ac[4];
1152276Sschwartz 
1162276Sschwartz 	/* PCItool */
1172276Sschwartz 	caddr_t		pcitool_addr;
1180Sstevel@tonic-gate } pxu_t;
1190Sstevel@tonic-gate 
1201648Sjchu #define	PX2CB(px_p) (((pxu_t *)px_p->px_plat_p)->px_cb_p)
1211648Sjchu 
1223274Set142600 /* cpr_flag */
1233274Set142600 #define	PX_NOT_CPR	0
1243274Set142600 #define	PX_ENTERED_CPR	1
1253274Set142600 
1260Sstevel@tonic-gate /*
1270Sstevel@tonic-gate  * Event Queue data structure.
1280Sstevel@tonic-gate  */
1290Sstevel@tonic-gate typedef	struct eq_rec {
1300Sstevel@tonic-gate 	uint64_t	eq_rec_rsvd0 : 1,	/* DW 0 - 63 */
1310Sstevel@tonic-gate 			eq_rec_fmt_type : 7,	/* DW 0 - 62:56 */
1320Sstevel@tonic-gate 			eq_rec_len : 10,	/* DW 0 - 55:46 */
1330Sstevel@tonic-gate 			eq_rec_addr0 : 14,	/* DW 0 - 45:32 */
1340Sstevel@tonic-gate 			eq_rec_rid : 16,	/* DW 0 - 31:16 */
1350Sstevel@tonic-gate 			eq_rec_data0 : 16;	/* DW 0 - 15:00 */
1360Sstevel@tonic-gate 	uint64_t	eq_rec_addr1 : 48,	/* DW 1 - 63:16 */
1370Sstevel@tonic-gate 			eq_rec_data1 : 16;	/* DW 1 - 15:0 */
1380Sstevel@tonic-gate 	uint64_t	eq_rec_rsvd[6];		/* DW 2-7 */
1390Sstevel@tonic-gate } eq_rec_t;
1400Sstevel@tonic-gate 
1410Sstevel@tonic-gate /*
1420Sstevel@tonic-gate  * EQ record type
1430Sstevel@tonic-gate  *
1440Sstevel@tonic-gate  * Upper 4 bits of eq_rec_fmt_type is used
1450Sstevel@tonic-gate  * to identify the EQ record type.
1460Sstevel@tonic-gate  */
1470Sstevel@tonic-gate #define	EQ_REC_MSG	0x6			/* MSG   - 0x3X */
1480Sstevel@tonic-gate #define	EQ_REC_MSI32	0xB			/* MSI32 - 0x58 */
1490Sstevel@tonic-gate #define	EQ_REC_MSI64	0xF			/* MSI64 - 0x78 */
1500Sstevel@tonic-gate 
1510Sstevel@tonic-gate /* EQ State */
1520Sstevel@tonic-gate #define	EQ_IDLE_STATE	0x1			/* IDLE */
1530Sstevel@tonic-gate #define	EQ_ACTIVE_STATE	0x2			/* ACTIVE */
1540Sstevel@tonic-gate #define	EQ_ERROR_STATE	0x4			/* ERROR */
1550Sstevel@tonic-gate 
1560Sstevel@tonic-gate #define	MMU_INVALID_TTE		0ull
1570Sstevel@tonic-gate #define	MMU_TTE_VALID(tte)	(((tte) & MMU_TTE_V) == MMU_TTE_V)
1581772Sjl139090 #define	MMU_OBERON_PADDR_MASK	0x7fffffffffff
1591772Sjl139090 #define	MMU_FIRE_PADDR_MASK	0x7ffffffffff
1600Sstevel@tonic-gate 
1610Sstevel@tonic-gate /*
1620Sstevel@tonic-gate  * control register decoding
1630Sstevel@tonic-gate  */
1640Sstevel@tonic-gate /* tsb size: 0=1k 1=2k 2=4k 3=8k 4=16k 5=32k 6=64k 7=128k */
1650Sstevel@tonic-gate #define	MMU_CTL_TO_TSBSIZE(ctl)		((ctl) >> 16)
1660Sstevel@tonic-gate #define	MMU_TSBSIZE_TO_TSBENTRIES(s)	((1 << (s)) << (13 - 3))
1670Sstevel@tonic-gate 
1680Sstevel@tonic-gate /*
1691772Sjl139090  * For Fire mmu bypass addresses, bit 43 specifies cacheability.
1700Sstevel@tonic-gate  */
1711772Sjl139090 #define	MMU_FIRE_BYPASS_NONCACHE	 (1ull << 43)
1721772Sjl139090 
1731772Sjl139090 /*
1741772Sjl139090  * For Oberon mmu bypass addresses, bit 47 specifies cacheability.
1751772Sjl139090  */
1761772Sjl139090 #define	MMU_OBERON_BYPASS_NONCACHE	 (1ull << 47)
1770Sstevel@tonic-gate 
1780Sstevel@tonic-gate /*
1790Sstevel@tonic-gate  * The following macros define the address ranges supported for DVMA
1801772Sjl139090  * and mmu bypass transfers. For Oberon, bit 63 is used for ordering.
1810Sstevel@tonic-gate  */
1821772Sjl139090 #define	MMU_FIRE_BYPASS_BASE		0xFFFC000000000000ull
1834886Sdwoods #define	MMU_FIRE_BYPASS_END		0xFFFC03FFFFFFFFFFull
1841772Sjl139090 
1851772Sjl139090 #define	MMU_OBERON_BYPASS_BASE		0x7FFC000000000000ull
1864886Sdwoods #define	MMU_OBERON_BYPASS_END		0x7FFC7FFFFFFFFFFFull
1871772Sjl139090 
188*8691SLida.Horn@Sun.COM #define	MMU_OBERON_BYPASS_RO		0x8000000000000000ull
189*8691SLida.Horn@Sun.COM 
1901772Sjl139090 #define	MMU_TSB_PA_MASK		0x7FFFFFFFE000
1910Sstevel@tonic-gate 
1920Sstevel@tonic-gate /*
1930Sstevel@tonic-gate  * The following macros are for loading and unloading io tte
1940Sstevel@tonic-gate  * entries.
1950Sstevel@tonic-gate  */
1960Sstevel@tonic-gate #define	MMU_TTE_SIZE		8
1970Sstevel@tonic-gate #define	MMU_TTE_V		(1ull << 63)
1980Sstevel@tonic-gate #define	MMU_TTE_W		(1ull << 1)
1991772Sjl139090 #define	MMU_TTE_RO		(1ull << 62)	/* Oberon Relaxed Ordering */
2000Sstevel@tonic-gate 
2010Sstevel@tonic-gate #define	INO_BITS		6	/* INO#s are 6 bits long */
2020Sstevel@tonic-gate #define	INO_MASK		0x3F	/* INO#s mask */
2032091Sam139583 
2042091Sam139583 #define	SYSINO_TO_DEVINO(sysino)	(sysino & INO_MASK)
2050Sstevel@tonic-gate 
2062091Sam139583 #define	FIRE_IGN_MASK		0x1F	/* IGN#s mask, 5 bits long for Fire */
2072091Sam139583 #define	OBERON_IGN_MASK		0xFF	/* IGN#s mask, 8 bits long for Oberon */
2082091Sam139583 
2092091Sam139583 #define	ID_TO_IGN(chip, portid) ((portid) & ((chip) == PX_CHIP_OBERON ? \
2102091Sam139583 	OBERON_IGN_MASK : FIRE_IGN_MASK))
2112091Sam139583 
2122091Sam139583 #define	DEVINO_TO_SYSINO(portid, devino) \
2132091Sam139583 	(((portid) << INO_BITS) | ((devino) & INO_MASK))
2140Sstevel@tonic-gate 
2150Sstevel@tonic-gate /* Interrupt states */
2160Sstevel@tonic-gate #define	INTERRUPT_IDLE_STATE		0
2170Sstevel@tonic-gate #define	INTERRUPT_RECEIVED_STATE	1
2180Sstevel@tonic-gate #define	INTERRUPT_PENDING_STATE		3
2190Sstevel@tonic-gate 
2200Sstevel@tonic-gate /*
2210Sstevel@tonic-gate  * Defines for link width and max packet size for ACKBAK Latency Threshold Timer
2220Sstevel@tonic-gate  * and TxLink Replay Timer Latency Table array sizes
2230Sstevel@tonic-gate  * Num		Link Width		Packet Size
2240Sstevel@tonic-gate  * 0		1			128
2250Sstevel@tonic-gate  * 1		4			256
2260Sstevel@tonic-gate  * 2		8			512
2270Sstevel@tonic-gate  * 3		16			1024
2280Sstevel@tonic-gate  * 4		-			2048
2290Sstevel@tonic-gate  * 5		-			4096
2300Sstevel@tonic-gate  */
2310Sstevel@tonic-gate #define	LINK_WIDTH_ARR_SIZE		4
2320Sstevel@tonic-gate #define	LINK_MAX_PKT_ARR_SIZE		6
2330Sstevel@tonic-gate 
2340Sstevel@tonic-gate /*
2350Sstevel@tonic-gate  * Defines for registers which have multi-bit fields.
2360Sstevel@tonic-gate  */
2370Sstevel@tonic-gate #define	TLU_LINK_CONTROL_ASPM_DISABLED			0x0
2380Sstevel@tonic-gate #define	TLU_LINK_CONTROL_ASPM_L0S_EN			0x1
2390Sstevel@tonic-gate #define	TLU_LINK_CONTROL_ASPM_L1_EN			0x2
2400Sstevel@tonic-gate #define	TLU_LINK_CONTROL_ASPM_L0S_L1_EN			0x3
2410Sstevel@tonic-gate 
2420Sstevel@tonic-gate #define	TLU_CONTROL_CONFIG_DEFAULT			0x1
2430Sstevel@tonic-gate #define	TLU_CONTROL_L0S_TIM_DEFAULT			0xdaull
2440Sstevel@tonic-gate #define	TLU_CONTROL_MPS_MASK				0x1C
2450Sstevel@tonic-gate #define	TLU_CONTROL_MPS_SHIFT				2
2460Sstevel@tonic-gate 
2470Sstevel@tonic-gate #define	LPU_TXLINK_REPLAY_NUMBER_STATUS_RPLAY_NUM_0	0x0
2480Sstevel@tonic-gate #define	LPU_TXLINK_REPLAY_NUMBER_STATUS_RPLAY_NUM_1	0x1
2490Sstevel@tonic-gate #define	LPU_TXLINK_REPLAY_NUMBER_STATUS_RPLAY_NUM_2	0x2
2500Sstevel@tonic-gate #define	LPU_TXLINK_REPLAY_NUMBER_STATUS_RPLAY_NUM_3	0x3
2510Sstevel@tonic-gate 
2520Sstevel@tonic-gate #define	LPU_TXLINK_RETRY_FIFO_POINTER_RTRY_FIFO_TLPTR_DEFAULT	0xFFFFull
2530Sstevel@tonic-gate #define	LPU_TXLINK_RETRY_FIFO_POINTER_RTRY_FIFO_HDPTR_DEFAULT	0x0ull
2540Sstevel@tonic-gate 
2550Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNTER_ACK_SEQ_CNTR_DEFAULT	0xFFF
2560Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNTER_NXT_TX_SEQ_CNTR_DEFAULT	0x0
2570Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNT_FIFO_MAX_ADDR_SEQ_CNT_MAX_ADDR_DEF	0x157
2580Sstevel@tonic-gate 
2590Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNT_FIFO_POINTERS_SEQ_CNT_TLPTR_DEFAULT	0xFFF
2600Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNT_FIFO_POINTERS_SEQ_CNT_HDPTR_DEFAULT	0x0
2610Sstevel@tonic-gate 
2620Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG1_LTSSM_8_TO_DEFAULT		0x2
2630Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG1_LTSSM_20_TO_DEFAULT		0x5
2640Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG2_LTSSM_12_TO_DEFAULT		0x2DC6C0
2650Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG3_LTSSM_2_TO_DEFAULT		0x7A120
2660Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG4_DATA_RATE_DEFAULT		0x2
2670Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG4_N_FTS_DEFAULT			0x8c
2680Sstevel@tonic-gate 
269118Sjchu /* LPU LTSSM states */
270118Sjchu #define	LPU_LTSSM_L0			0x0
271118Sjchu #define	LPU_LTSSM_L1_IDLE		0x15
272118Sjchu 
273118Sjchu /* TLU Control register bits */
274118Sjchu #define	TLU_REMAIN_DETECT_QUIET		8
275118Sjchu 
276383Set142600 /* PX BDF Shift in a Phyiscal Address - used FMA Fabric only */
277383Set142600 #define	PX_PA_BDF_SHIFT			12
278383Set142600 #define	PX_BDF_TO_CFGADDR(bdf, offset) (((bdf) << PX_PA_BDF_SHIFT) + (offset))
279383Set142600 
2800Sstevel@tonic-gate /*
2812426Sschwartz  * Fire hardware specific version definitions.
2822426Sschwartz  * All Fire versions > 2.0 will be numerically greater than FIRE_MOD_REV_20
2830Sstevel@tonic-gate  */
2842426Sschwartz #define	FIRE_MOD_REV_20	0x03
2850Sstevel@tonic-gate 
2860Sstevel@tonic-gate /*
2872426Sschwartz  * Oberon specific definitions.
2880Sstevel@tonic-gate  */
2891772Sjl139090 #define	OBERON_RANGE_PROP_MASK	0x7fff
2900Sstevel@tonic-gate 
2912276Sschwartz /*
2922276Sschwartz  * HW specific paddr mask.
2932276Sschwartz  */
2942276Sschwartz extern uint64_t px_paddr_mask;
2952276Sschwartz 
2960Sstevel@tonic-gate extern void hvio_cb_init(caddr_t xbc_csr_base, pxu_t *pxu_p);
2970Sstevel@tonic-gate extern void hvio_ib_init(caddr_t csr_base, pxu_t *pxu_p);
2980Sstevel@tonic-gate extern void hvio_mmu_init(caddr_t csr_base, pxu_t *pxu_p);
2990Sstevel@tonic-gate extern void hvio_pec_init(caddr_t csr_base, pxu_t *pxu_p);
3000Sstevel@tonic-gate 
3010Sstevel@tonic-gate extern uint64_t hvio_intr_devino_to_sysino(devhandle_t dev_hdl, pxu_t *pxu_p,
3020Sstevel@tonic-gate     devino_t devino, sysino_t *sysino);
3030Sstevel@tonic-gate extern uint64_t hvio_intr_getvalid(devhandle_t dev_hdl, sysino_t sysino,
3040Sstevel@tonic-gate     intr_valid_state_t *intr_valid_state);
3050Sstevel@tonic-gate extern uint64_t hvio_intr_setvalid(devhandle_t dev_hdl, sysino_t sysino,
3060Sstevel@tonic-gate     intr_valid_state_t intr_valid_state);
3070Sstevel@tonic-gate extern uint64_t hvio_intr_getstate(devhandle_t dev_hdl, sysino_t sysino,
3080Sstevel@tonic-gate     intr_state_t *intr_state);
3090Sstevel@tonic-gate extern uint64_t hvio_intr_setstate(devhandle_t dev_hdl, sysino_t sysino,
3100Sstevel@tonic-gate     intr_state_t intr_state);
3111772Sjl139090 extern uint64_t hvio_intr_gettarget(devhandle_t dev_hdl, pxu_t *pxu_p,
3121772Sjl139090     sysino_t sysino, cpuid_t *cpuid);
3131772Sjl139090 extern uint64_t hvio_intr_settarget(devhandle_t dev_hdl, pxu_t *pxu_p,
3141772Sjl139090     sysino_t sysino, cpuid_t cpuid);
3150Sstevel@tonic-gate 
3160Sstevel@tonic-gate extern uint64_t hvio_iommu_map(devhandle_t dev_hdl, pxu_t *pxu_p, tsbid_t tsbid,
3171617Sgovinda     pages_t pages, io_attributes_t attr, void *addr, size_t pfn_index,
3181617Sgovinda     int flags);
3190Sstevel@tonic-gate extern uint64_t hvio_iommu_demap(devhandle_t dev_hdl, pxu_t *pxu_p,
3200Sstevel@tonic-gate     tsbid_t tsbid, pages_t pages);
3210Sstevel@tonic-gate extern uint64_t hvio_iommu_getmap(devhandle_t dev_hdl, pxu_t *pxu_p,
3221617Sgovinda     tsbid_t tsbid, io_attributes_t *attr_p, r_addr_t *r_addr_p);
3231772Sjl139090 extern uint64_t hvio_iommu_getbypass(devhandle_t dev_hdl, pxu_t *pxu_p,
3241772Sjl139090     r_addr_t ra, io_attributes_t attr, io_addr_t *io_addr_p);
3251772Sjl139090 extern uint64_t hvio_get_bypass_base(pxu_t *pxu_p);
3261772Sjl139090 extern uint64_t hvio_get_bypass_end(pxu_t *pxu_p);
3271772Sjl139090 extern uint64_t px_get_range_prop(px_t *px_p, px_ranges_t *rp, int bank);
3281772Sjl139090 
3290Sstevel@tonic-gate 
3300Sstevel@tonic-gate /*
3310Sstevel@tonic-gate  * MSIQ Functions:
3320Sstevel@tonic-gate  */
3330Sstevel@tonic-gate extern uint64_t hvio_msiq_init(devhandle_t dev_hdl, pxu_t *pxu_p);
3340Sstevel@tonic-gate extern uint64_t hvio_msiq_getvalid(devhandle_t dev_hdl, msiqid_t msiq_id,
3350Sstevel@tonic-gate     pci_msiq_valid_state_t *msiq_valid_state);
3360Sstevel@tonic-gate extern uint64_t hvio_msiq_setvalid(devhandle_t dev_hdl, msiqid_t msiq_id,
3370Sstevel@tonic-gate     pci_msiq_valid_state_t msiq_valid_state);
3380Sstevel@tonic-gate extern uint64_t hvio_msiq_getstate(devhandle_t dev_hdl, msiqid_t msiq_id,
3390Sstevel@tonic-gate     pci_msiq_state_t *msiq_state);
3400Sstevel@tonic-gate extern uint64_t hvio_msiq_setstate(devhandle_t dev_hdl, msiqid_t msiq_id,
3410Sstevel@tonic-gate     pci_msiq_state_t msiq_state);
3420Sstevel@tonic-gate extern uint64_t hvio_msiq_gethead(devhandle_t dev_hdl, msiqid_t msiq_id,
3430Sstevel@tonic-gate     msiqhead_t *msiq_head);
3440Sstevel@tonic-gate extern uint64_t hvio_msiq_sethead(devhandle_t dev_hdl, msiqid_t msiq_id,
3450Sstevel@tonic-gate     msiqhead_t msiq_head);
3460Sstevel@tonic-gate extern uint64_t hvio_msiq_gettail(devhandle_t dev_hdl, msiqid_t msiq_id,
3470Sstevel@tonic-gate     msiqtail_t *msiq_tail);
3480Sstevel@tonic-gate 
3490Sstevel@tonic-gate /*
3500Sstevel@tonic-gate  * MSI Functions:
3510Sstevel@tonic-gate  */
3520Sstevel@tonic-gate extern uint64_t hvio_msi_init(devhandle_t dev_hdl, uint64_t addr32,
3530Sstevel@tonic-gate     uint64_t addr64);
3540Sstevel@tonic-gate extern uint64_t hvio_msi_getmsiq(devhandle_t dev_hdl, msinum_t msi_num,
3550Sstevel@tonic-gate     msiqid_t *msiq_id);
3560Sstevel@tonic-gate extern uint64_t hvio_msi_setmsiq(devhandle_t dev_hdl, msinum_t msi_num,
3570Sstevel@tonic-gate     msiqid_t msiq_id);
3580Sstevel@tonic-gate extern uint64_t hvio_msi_getvalid(devhandle_t dev_hdl, msinum_t msi_num,
3590Sstevel@tonic-gate     pci_msi_valid_state_t *msi_valid_state);
3600Sstevel@tonic-gate extern uint64_t hvio_msi_setvalid(devhandle_t dev_hdl, msinum_t msi_num,
3610Sstevel@tonic-gate     pci_msi_valid_state_t msi_valid_state);
3620Sstevel@tonic-gate extern uint64_t hvio_msi_getstate(devhandle_t dev_hdl, msinum_t msi_num,
3630Sstevel@tonic-gate     pci_msi_state_t *msi_state);
3640Sstevel@tonic-gate extern uint64_t hvio_msi_setstate(devhandle_t dev_hdl, msinum_t msi_num,
3650Sstevel@tonic-gate     pci_msi_state_t msi_state);
3660Sstevel@tonic-gate 
3670Sstevel@tonic-gate /*
3680Sstevel@tonic-gate  * MSG Functions:
3690Sstevel@tonic-gate  */
3700Sstevel@tonic-gate extern uint64_t hvio_msg_getmsiq(devhandle_t dev_hdl, pcie_msg_type_t msg_type,
3710Sstevel@tonic-gate     msiqid_t *msiq_id);
3720Sstevel@tonic-gate extern uint64_t hvio_msg_setmsiq(devhandle_t dev_hdl, pcie_msg_type_t msg_type,
3730Sstevel@tonic-gate     msiqid_t msiq_id);
3740Sstevel@tonic-gate extern uint64_t hvio_msg_getvalid(devhandle_t dev_hdl, pcie_msg_type_t msg_type,
3750Sstevel@tonic-gate     pcie_msg_valid_state_t *msg_valid_state);
3760Sstevel@tonic-gate extern uint64_t hvio_msg_setvalid(devhandle_t dev_hdl, pcie_msg_type_t msg_type,
3770Sstevel@tonic-gate     pcie_msg_valid_state_t msg_valid_state);
3780Sstevel@tonic-gate 
3790Sstevel@tonic-gate /*
3800Sstevel@tonic-gate  * Suspend/Resume Functions:
3810Sstevel@tonic-gate  */
3820Sstevel@tonic-gate extern uint64_t hvio_suspend(devhandle_t dev_hdl, pxu_t *pxu_p);
3830Sstevel@tonic-gate extern void hvio_resume(devhandle_t dev_hdl,
3840Sstevel@tonic-gate     devino_t devino, pxu_t *pxu_p);
3850Sstevel@tonic-gate extern uint64_t hvio_cb_suspend(devhandle_t dev_hdl, pxu_t *pxu_p);
3860Sstevel@tonic-gate extern void hvio_cb_resume(devhandle_t pci_dev_hdl, devhandle_t xbus_dev_hdl,
3870Sstevel@tonic-gate     devino_t devino, pxu_t *pxu_p);
3880Sstevel@tonic-gate extern int px_send_pme_turnoff(caddr_t csr_base);
389118Sjchu extern int px_link_wait4l1idle(caddr_t csr_base);
390118Sjchu extern int px_link_retrain(caddr_t csr_base);
391118Sjchu extern void px_enable_detect_quiet(caddr_t csr_base);
3920Sstevel@tonic-gate 
3933274Set142600 extern void px_lib_clr_errs(px_t *px_p, dev_info_t *rdip, uint64_t addr);
394624Sschwartz 
3951772Sjl139090 /*
3961772Sjl139090  * Hotplug functions:
3971772Sjl139090  */
3981772Sjl139090 extern int hvio_hotplug_init(dev_info_t *dip, void *arg);
3991772Sjl139090 extern int hvio_hotplug_uninit(dev_info_t *dip);
4001772Sjl139090 
4010Sstevel@tonic-gate #ifdef	__cplusplus
4020Sstevel@tonic-gate }
4030Sstevel@tonic-gate #endif
4040Sstevel@tonic-gate 
4050Sstevel@tonic-gate #endif	/* _SYS_PX_LIB4U_H */
406