xref: /onnv-gate/usr/src/uts/sun4u/io/px/px_lib4u.h (revision 2276:11778235cccd)
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 /*
221617Sgovinda  * Copyright 2006 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef	__cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate /*
360Sstevel@tonic-gate  * Errors returned.
370Sstevel@tonic-gate  */
380Sstevel@tonic-gate #define	H_EOK			0	/* Successful return */
390Sstevel@tonic-gate #define	H_ENOINTR		1	/* Invalid interrupt id */
400Sstevel@tonic-gate #define	H_EINVAL		2	/* Invalid argument */
410Sstevel@tonic-gate #define	H_ENOACCESS		3	/* No access to resource */
420Sstevel@tonic-gate #define	H_EIO			4	/* I/O error */
430Sstevel@tonic-gate #define	H_ENOTSUPPORTED		5	/* Function not supported */
440Sstevel@tonic-gate #define	H_ENOMAP		6	/* Mapping is not valid, */
450Sstevel@tonic-gate 					/* no translation exists */
460Sstevel@tonic-gate 
470Sstevel@tonic-gate /*
4827Sjchu  * Register base definitions.
4927Sjchu  *
5027Sjchu  * The specific numeric values for CSR, XBUS, Configuration,
5127Sjchu  * Interrupt blocks and other register bases.
5227Sjchu  */
5327Sjchu typedef enum {
5427Sjchu 	PX_REG_CSR = 0,
5527Sjchu 	PX_REG_XBC,
5627Sjchu 	PX_REG_CFG,
5727Sjchu 	PX_REG_IC,
5827Sjchu 	PX_REG_MAX
5927Sjchu } px_reg_bank_t;
6027Sjchu 
6127Sjchu /*
6227Sjchu  * Registers/state/variables that need to be saved and restored during
6327Sjchu  * suspend/resume.
6427Sjchu  *
650Sstevel@tonic-gate  * SUN4U px specific data structure.
660Sstevel@tonic-gate  */
671648Sjchu 
681648Sjchu /* Control block soft state structure */
691648Sjchu typedef struct px_cb_list {
701648Sjchu 	px_t			*pxp;
711648Sjchu 	struct px_cb_list	*next;
721648Sjchu } px_cb_list_t;
731648Sjchu 
741648Sjchu typedef struct px_cb {
751648Sjchu 	px_cb_list_t	*pxl;		/* linked list px */
761648Sjchu 	kmutex_t	cb_mutex;	/* lock for CB */
771648Sjchu 	sysino_t	sysino;		/* proxy sysino */
781648Sjchu 	cpuid_t		cpuid;		/* proxy cpuid */
791648Sjchu 	int		attachcnt;	/* number of attached px */
801648Sjchu 	uint_t		(*px_cb_func)(caddr_t); /* CB intr dispatcher */
811648Sjchu } px_cb_t;
821648Sjchu 
830Sstevel@tonic-gate typedef struct pxu {
840Sstevel@tonic-gate 	uint32_t	chip_id;
850Sstevel@tonic-gate 	uint8_t		portid;
860Sstevel@tonic-gate 	uint16_t	tsb_cookie;
870Sstevel@tonic-gate 	uint32_t	tsb_size;
880Sstevel@tonic-gate 	uint64_t	*tsb_vaddr;
891772Sjl139090 	uint64_t	tsb_paddr;	/* Only used for Oberon */
901772Sjl139090 
910Sstevel@tonic-gate 	void		*msiq_mapped_p;
921648Sjchu 	px_cb_t		*px_cb_p;
930Sstevel@tonic-gate 
940Sstevel@tonic-gate 	/* Soft state for suspend/resume */
950Sstevel@tonic-gate 	uint64_t	*pec_config_state;
960Sstevel@tonic-gate 	uint64_t	*mmu_config_state;
970Sstevel@tonic-gate 	uint64_t	*ib_intr_map;
980Sstevel@tonic-gate 	uint64_t	*ib_config_state;
990Sstevel@tonic-gate 	uint64_t	*xcb_config_state;
1000Sstevel@tonic-gate 	uint64_t	*msiq_config_state;
10127Sjchu 
10227Sjchu 	/* sun4u specific vars */
10327Sjchu 	caddr_t			px_address[4];
10427Sjchu 	ddi_acc_handle_t	px_ac[4];
105*2276Sschwartz 
106*2276Sschwartz 	/* PCItool */
107*2276Sschwartz 	caddr_t		pcitool_addr;
1080Sstevel@tonic-gate } pxu_t;
1090Sstevel@tonic-gate 
1101648Sjchu #define	PX2CB(px_p) (((pxu_t *)px_p->px_plat_p)->px_cb_p)
1111648Sjchu 
1120Sstevel@tonic-gate /*
1130Sstevel@tonic-gate  * Event Queue data structure.
1140Sstevel@tonic-gate  */
1150Sstevel@tonic-gate typedef	struct eq_rec {
1160Sstevel@tonic-gate 	uint64_t	eq_rec_rsvd0 : 1,	/* DW 0 - 63 */
1170Sstevel@tonic-gate 			eq_rec_fmt_type : 7,	/* DW 0 - 62:56 */
1180Sstevel@tonic-gate 			eq_rec_len : 10,	/* DW 0 - 55:46 */
1190Sstevel@tonic-gate 			eq_rec_addr0 : 14,	/* DW 0 - 45:32 */
1200Sstevel@tonic-gate 			eq_rec_rid : 16,	/* DW 0 - 31:16 */
1210Sstevel@tonic-gate 			eq_rec_data0 : 16;	/* DW 0 - 15:00 */
1220Sstevel@tonic-gate 	uint64_t	eq_rec_addr1 : 48,	/* DW 1 - 63:16 */
1230Sstevel@tonic-gate 			eq_rec_data1 : 16;	/* DW 1 - 15:0 */
1240Sstevel@tonic-gate 	uint64_t	eq_rec_rsvd[6];		/* DW 2-7 */
1250Sstevel@tonic-gate } eq_rec_t;
1260Sstevel@tonic-gate 
1270Sstevel@tonic-gate /*
1280Sstevel@tonic-gate  * EQ record type
1290Sstevel@tonic-gate  *
1300Sstevel@tonic-gate  * Upper 4 bits of eq_rec_fmt_type is used
1310Sstevel@tonic-gate  * to identify the EQ record type.
1320Sstevel@tonic-gate  */
1330Sstevel@tonic-gate #define	EQ_REC_MSG	0x6			/* MSG   - 0x3X */
1340Sstevel@tonic-gate #define	EQ_REC_MSI32	0xB			/* MSI32 - 0x58 */
1350Sstevel@tonic-gate #define	EQ_REC_MSI64	0xF			/* MSI64 - 0x78 */
1360Sstevel@tonic-gate 
1370Sstevel@tonic-gate /* EQ State */
1380Sstevel@tonic-gate #define	EQ_IDLE_STATE	0x1			/* IDLE */
1390Sstevel@tonic-gate #define	EQ_ACTIVE_STATE	0x2			/* ACTIVE */
1400Sstevel@tonic-gate #define	EQ_ERROR_STATE	0x4			/* ERROR */
1410Sstevel@tonic-gate 
1420Sstevel@tonic-gate #define	MMU_INVALID_TTE		0ull
1430Sstevel@tonic-gate #define	MMU_TTE_VALID(tte)	(((tte) & MMU_TTE_V) == MMU_TTE_V)
1441772Sjl139090 #define	MMU_OBERON_PADDR_MASK	0x7fffffffffff
1451772Sjl139090 #define	MMU_FIRE_PADDR_MASK	0x7ffffffffff
1460Sstevel@tonic-gate 
1470Sstevel@tonic-gate /*
1480Sstevel@tonic-gate  * control register decoding
1490Sstevel@tonic-gate  */
1500Sstevel@tonic-gate /* tsb size: 0=1k 1=2k 2=4k 3=8k 4=16k 5=32k 6=64k 7=128k */
1510Sstevel@tonic-gate #define	MMU_CTL_TO_TSBSIZE(ctl)		((ctl) >> 16)
1520Sstevel@tonic-gate #define	MMU_TSBSIZE_TO_TSBENTRIES(s)	((1 << (s)) << (13 - 3))
1530Sstevel@tonic-gate 
1540Sstevel@tonic-gate /*
1551772Sjl139090  * For Fire mmu bypass addresses, bit 43 specifies cacheability.
1560Sstevel@tonic-gate  */
1571772Sjl139090 #define	MMU_FIRE_BYPASS_NONCACHE	 (1ull << 43)
1581772Sjl139090 
1591772Sjl139090 /*
1601772Sjl139090  * For Oberon mmu bypass addresses, bit 47 specifies cacheability.
1611772Sjl139090  */
1621772Sjl139090 #define	MMU_OBERON_BYPASS_NONCACHE	 (1ull << 47)
1630Sstevel@tonic-gate 
1640Sstevel@tonic-gate /*
1650Sstevel@tonic-gate  * The following macros define the address ranges supported for DVMA
1661772Sjl139090  * and mmu bypass transfers. For Oberon, bit 63 is used for ordering.
1670Sstevel@tonic-gate  */
1681772Sjl139090 #define	MMU_FIRE_BYPASS_BASE		0xFFFC000000000000ull
1691772Sjl139090 #define	MMU_FIRE_BYPASS_END		0xFFFC01FFFFFFFFFFull
1701772Sjl139090 
1711772Sjl139090 #define	MMU_OBERON_BYPASS_BASE		0x7FFC000000000000ull
1721772Sjl139090 #define	MMU_OBERON_BYPASS_END		0x7FFC01FFFFFFFFFFull
1731772Sjl139090 
1741772Sjl139090 #define	MMU_TSB_PA_MASK		0x7FFFFFFFE000
1750Sstevel@tonic-gate 
1760Sstevel@tonic-gate /*
1770Sstevel@tonic-gate  * The following macros are for loading and unloading io tte
1780Sstevel@tonic-gate  * entries.
1790Sstevel@tonic-gate  */
1800Sstevel@tonic-gate #define	MMU_TTE_SIZE		8
1810Sstevel@tonic-gate #define	MMU_TTE_V		(1ull << 63)
1820Sstevel@tonic-gate #define	MMU_TTE_W		(1ull << 1)
1831772Sjl139090 #define	MMU_TTE_RO		(1ull << 62)	/* Oberon Relaxed Ordering */
1840Sstevel@tonic-gate 
1850Sstevel@tonic-gate #define	INO_BITS		6	/* INO#s are 6 bits long */
1860Sstevel@tonic-gate #define	INO_MASK		0x3F	/* INO#s mask */
1872091Sam139583 
1882091Sam139583 #define	SYSINO_TO_DEVINO(sysino)	(sysino & INO_MASK)
1890Sstevel@tonic-gate 
1902091Sam139583 #define	FIRE_IGN_MASK		0x1F	/* IGN#s mask, 5 bits long for Fire */
1912091Sam139583 #define	OBERON_IGN_MASK		0xFF	/* IGN#s mask, 8 bits long for Oberon */
1922091Sam139583 
1932091Sam139583 #define	ID_TO_IGN(chip, portid) ((portid) & ((chip) == PX_CHIP_OBERON ? \
1942091Sam139583 	OBERON_IGN_MASK : FIRE_IGN_MASK))
1952091Sam139583 
1962091Sam139583 #define	DEVINO_TO_SYSINO(portid, devino) \
1972091Sam139583 	(((portid) << INO_BITS) | ((devino) & INO_MASK))
1980Sstevel@tonic-gate 
1990Sstevel@tonic-gate /* Interrupt states */
2000Sstevel@tonic-gate #define	INTERRUPT_IDLE_STATE		0
2010Sstevel@tonic-gate #define	INTERRUPT_RECEIVED_STATE	1
2020Sstevel@tonic-gate #define	INTERRUPT_PENDING_STATE		3
2030Sstevel@tonic-gate 
2040Sstevel@tonic-gate /*
2050Sstevel@tonic-gate  * Defines for link width and max packet size for ACKBAK Latency Threshold Timer
2060Sstevel@tonic-gate  * and TxLink Replay Timer Latency Table array sizes
2070Sstevel@tonic-gate  * Num		Link Width		Packet Size
2080Sstevel@tonic-gate  * 0		1			128
2090Sstevel@tonic-gate  * 1		4			256
2100Sstevel@tonic-gate  * 2		8			512
2110Sstevel@tonic-gate  * 3		16			1024
2120Sstevel@tonic-gate  * 4		-			2048
2130Sstevel@tonic-gate  * 5		-			4096
2140Sstevel@tonic-gate  */
2150Sstevel@tonic-gate #define	LINK_WIDTH_ARR_SIZE		4
2160Sstevel@tonic-gate #define	LINK_MAX_PKT_ARR_SIZE		6
2170Sstevel@tonic-gate 
2180Sstevel@tonic-gate /*
2190Sstevel@tonic-gate  * Defines for registers which have multi-bit fields.
2200Sstevel@tonic-gate  */
2210Sstevel@tonic-gate #define	TLU_LINK_CONTROL_ASPM_DISABLED			0x0
2220Sstevel@tonic-gate #define	TLU_LINK_CONTROL_ASPM_L0S_EN			0x1
2230Sstevel@tonic-gate #define	TLU_LINK_CONTROL_ASPM_L1_EN			0x2
2240Sstevel@tonic-gate #define	TLU_LINK_CONTROL_ASPM_L0S_L1_EN			0x3
2250Sstevel@tonic-gate 
2260Sstevel@tonic-gate #define	TLU_CONTROL_CONFIG_DEFAULT			0x1
2270Sstevel@tonic-gate #define	TLU_CONTROL_L0S_TIM_DEFAULT			0xdaull
2280Sstevel@tonic-gate #define	TLU_CONTROL_MPS_MASK				0x1C
2290Sstevel@tonic-gate #define	TLU_CONTROL_MPS_SHIFT				2
2300Sstevel@tonic-gate 
2310Sstevel@tonic-gate #define	LPU_TXLINK_REPLAY_NUMBER_STATUS_RPLAY_NUM_0	0x0
2320Sstevel@tonic-gate #define	LPU_TXLINK_REPLAY_NUMBER_STATUS_RPLAY_NUM_1	0x1
2330Sstevel@tonic-gate #define	LPU_TXLINK_REPLAY_NUMBER_STATUS_RPLAY_NUM_2	0x2
2340Sstevel@tonic-gate #define	LPU_TXLINK_REPLAY_NUMBER_STATUS_RPLAY_NUM_3	0x3
2350Sstevel@tonic-gate 
2360Sstevel@tonic-gate #define	LPU_TXLINK_RETRY_FIFO_POINTER_RTRY_FIFO_TLPTR_DEFAULT	0xFFFFull
2370Sstevel@tonic-gate #define	LPU_TXLINK_RETRY_FIFO_POINTER_RTRY_FIFO_HDPTR_DEFAULT	0x0ull
2380Sstevel@tonic-gate 
2390Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNTER_ACK_SEQ_CNTR_DEFAULT	0xFFF
2400Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNTER_NXT_TX_SEQ_CNTR_DEFAULT	0x0
2410Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNT_FIFO_MAX_ADDR_SEQ_CNT_MAX_ADDR_DEF	0x157
2420Sstevel@tonic-gate 
2430Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNT_FIFO_POINTERS_SEQ_CNT_TLPTR_DEFAULT	0xFFF
2440Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNT_FIFO_POINTERS_SEQ_CNT_HDPTR_DEFAULT	0x0
2450Sstevel@tonic-gate 
2460Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG1_LTSSM_8_TO_DEFAULT		0x2
2470Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG1_LTSSM_20_TO_DEFAULT		0x5
2480Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG2_LTSSM_12_TO_DEFAULT		0x2DC6C0
2490Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG3_LTSSM_2_TO_DEFAULT		0x7A120
2500Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG4_DATA_RATE_DEFAULT		0x2
2510Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG4_N_FTS_DEFAULT			0x8c
2520Sstevel@tonic-gate 
253118Sjchu /* LPU LTSSM states */
254118Sjchu #define	LPU_LTSSM_L0			0x0
255118Sjchu #define	LPU_LTSSM_L1_IDLE		0x15
256118Sjchu 
257118Sjchu /* TLU Control register bits */
258118Sjchu #define	TLU_REMAIN_DETECT_QUIET		8
259118Sjchu 
260383Set142600 /* PX BDF Shift in a Phyiscal Address - used FMA Fabric only */
261383Set142600 #define	PX_PA_BDF_SHIFT			12
262383Set142600 #define	PX_BDF_TO_CFGADDR(bdf, offset) (((bdf) << PX_PA_BDF_SHIFT) + (offset))
263383Set142600 
2640Sstevel@tonic-gate /*
2650Sstevel@tonic-gate  * The sequence of the chip_type appearance is significant.
2660Sstevel@tonic-gate  * There are code depending on it: PX_CHIP_TYPE(pxu_p) < PX_CHIP_FIRE.
2670Sstevel@tonic-gate  */
2680Sstevel@tonic-gate typedef enum {
2690Sstevel@tonic-gate 	PX_CHIP_UNIDENTIFIED = 0,
2701772Sjl139090 	PX_CHIP_FIRE = 1,
2711772Sjl139090 	PX_CHIP_OBERON = 2
2720Sstevel@tonic-gate } px_chip_id_t;
2730Sstevel@tonic-gate 
2740Sstevel@tonic-gate /*
2750Sstevel@tonic-gate  * [msb]                                [lsb]
2760Sstevel@tonic-gate  * 0x00 <chip_type> <version#> <module-revision#>
2770Sstevel@tonic-gate  */
2780Sstevel@tonic-gate #define	PX_CHIP_ID(t, v, m)	(((t) << 16) | ((v) << 8) | (m))
2791772Sjl139090 #define	PX_CHIP_TYPE(pxu_p)	(((pxu_p)->chip_id) >> 16)
2801772Sjl139090 #define	PX_CHIP_REV(pxu_p)	 (((pxu_p)->chip_id) & 0xFF)
2811772Sjl139090 #define	PX_CHIP_VER(pxu_p)	 ((((pxu_p)->chip_id) >> 8) & 0xFF)
2820Sstevel@tonic-gate 
2830Sstevel@tonic-gate /*
2840Sstevel@tonic-gate  * Fire hardware specific version definitions.
2850Sstevel@tonic-gate  */
2860Sstevel@tonic-gate #define	FIRE_VER_10	PX_CHIP_ID(PX_CHIP_FIRE, 0x01, 0x00)
2870Sstevel@tonic-gate #define	FIRE_VER_20	PX_CHIP_ID(PX_CHIP_FIRE, 0x03, 0x00)
2881772Sjl139090 #define	OBERON_VER_10	PX_CHIP_ID(PX_CHIP_OBERON, 0x00, 0x00)
2891772Sjl139090 #define	OBERON_RANGE_PROP_MASK	0x7fff
2900Sstevel@tonic-gate 
291*2276Sschwartz /*
292*2276Sschwartz  * HW specific paddr mask.
293*2276Sschwartz  */
294*2276Sschwartz extern uint64_t px_paddr_mask;
295*2276Sschwartz 
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 
393624Sschwartz extern void px_lib_clr_errs(px_t *px_p);
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