xref: /onnv-gate/usr/src/uts/sun4u/io/px/px_lib4u.h (revision 12619:60877912fc2d)
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*12619Sandrew.rutz@sun.com  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate 
250Sstevel@tonic-gate #ifndef _SYS_PX_LIB4U_H
260Sstevel@tonic-gate #define	_SYS_PX_LIB4U_H
270Sstevel@tonic-gate 
280Sstevel@tonic-gate #ifdef	__cplusplus
290Sstevel@tonic-gate extern "C" {
300Sstevel@tonic-gate #endif
310Sstevel@tonic-gate 
320Sstevel@tonic-gate /*
330Sstevel@tonic-gate  * Errors returned.
340Sstevel@tonic-gate  */
350Sstevel@tonic-gate #define	H_EOK			0	/* Successful return */
360Sstevel@tonic-gate #define	H_ENOINTR		1	/* Invalid interrupt id */
370Sstevel@tonic-gate #define	H_EINVAL		2	/* Invalid argument */
380Sstevel@tonic-gate #define	H_ENOACCESS		3	/* No access to resource */
390Sstevel@tonic-gate #define	H_EIO			4	/* I/O error */
400Sstevel@tonic-gate #define	H_ENOTSUPPORTED		5	/* Function not supported */
410Sstevel@tonic-gate #define	H_ENOMAP		6	/* Mapping is not valid, */
420Sstevel@tonic-gate 					/* no translation exists */
430Sstevel@tonic-gate 
440Sstevel@tonic-gate /*
4527Sjchu  * Register base definitions.
4627Sjchu  *
4727Sjchu  * The specific numeric values for CSR, XBUS, Configuration,
4827Sjchu  * Interrupt blocks and other register bases.
4927Sjchu  */
5027Sjchu typedef enum {
5127Sjchu 	PX_REG_CSR = 0,
5227Sjchu 	PX_REG_XBC,
5327Sjchu 	PX_REG_CFG,
5427Sjchu 	PX_REG_IC,
5527Sjchu 	PX_REG_MAX
5627Sjchu } px_reg_bank_t;
5727Sjchu 
5827Sjchu /*
5927Sjchu  * Registers/state/variables that need to be saved and restored during
6027Sjchu  * suspend/resume.
6127Sjchu  *
620Sstevel@tonic-gate  * SUN4U px specific data structure.
630Sstevel@tonic-gate  */
641648Sjchu 
651648Sjchu /* Control block soft state structure */
661648Sjchu typedef struct px_cb_list {
671648Sjchu 	px_t			*pxp;
681648Sjchu 	struct px_cb_list	*next;
691648Sjchu } px_cb_list_t;
701648Sjchu 
712426Sschwartz /* IO chip type */
722426Sschwartz typedef enum {
732426Sschwartz 	PX_CHIP_UNIDENTIFIED = 0,
742426Sschwartz 	PX_CHIP_FIRE = 1,
752426Sschwartz 	PX_CHIP_OBERON = 2
762426Sschwartz } px_chip_type_t;
772426Sschwartz 
782426Sschwartz #define	PX_CHIP_TYPE(pxu_p)	((pxu_p)->chip_type)
792426Sschwartz 
801648Sjchu typedef struct px_cb {
811648Sjchu 	px_cb_list_t	*pxl;		/* linked list px */
821648Sjchu 	kmutex_t	cb_mutex;	/* lock for CB */
831648Sjchu 	sysino_t	sysino;		/* proxy sysino */
841648Sjchu 	cpuid_t		cpuid;		/* proxy cpuid */
851648Sjchu 	int		attachcnt;	/* number of attached px */
861648Sjchu 	uint_t		(*px_cb_func)(caddr_t); /* CB intr dispatcher */
871648Sjchu } px_cb_t;
881648Sjchu 
890Sstevel@tonic-gate typedef struct pxu {
902426Sschwartz 	px_chip_type_t	chip_type;
910Sstevel@tonic-gate 	uint8_t		portid;
920Sstevel@tonic-gate 	uint16_t	tsb_cookie;
930Sstevel@tonic-gate 	uint32_t	tsb_size;
940Sstevel@tonic-gate 	uint64_t	*tsb_vaddr;
951772Sjl139090 	uint64_t	tsb_paddr;	/* Only used for Oberon */
964701Sgovinda 	sysino_t	hp_sysino;	/* Oberon hotplug interrupt */
971772Sjl139090 
980Sstevel@tonic-gate 	void		*msiq_mapped_p;
991648Sjchu 	px_cb_t		*px_cb_p;
1000Sstevel@tonic-gate 
1010Sstevel@tonic-gate 	/* Soft state for suspend/resume */
1020Sstevel@tonic-gate 	uint64_t	*pec_config_state;
1030Sstevel@tonic-gate 	uint64_t	*mmu_config_state;
1040Sstevel@tonic-gate 	uint64_t	*ib_intr_map;
1050Sstevel@tonic-gate 	uint64_t	*ib_config_state;
1060Sstevel@tonic-gate 	uint64_t	*xcb_config_state;
1070Sstevel@tonic-gate 	uint64_t	*msiq_config_state;
1083274Set142600 	uint_t		cpr_flag;
10927Sjchu 
11027Sjchu 	/* sun4u specific vars */
11127Sjchu 	caddr_t			px_address[4];
11227Sjchu 	ddi_acc_handle_t	px_ac[4];
113*12619Sandrew.rutz@sun.com 	uint64_t		obp_tsb_paddr;
114*12619Sandrew.rutz@sun.com 	uint_t			obp_tsb_entries;
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 
15610923SEvan.Yan@Sun.COM /*
15710923SEvan.Yan@Sun.COM  * Default EQ Configurations
15810923SEvan.Yan@Sun.COM  */
15910923SEvan.Yan@Sun.COM #define	EQ_CNT		36
16010923SEvan.Yan@Sun.COM #define	EQ_REC_CNT	128
16110923SEvan.Yan@Sun.COM #define	EQ_1ST_ID	0
16210923SEvan.Yan@Sun.COM #define	EQ_1ST_DEVINO	24
16310923SEvan.Yan@Sun.COM 
1640Sstevel@tonic-gate #define	MMU_INVALID_TTE		0ull
1650Sstevel@tonic-gate #define	MMU_TTE_VALID(tte)	(((tte) & MMU_TTE_V) == MMU_TTE_V)
1661772Sjl139090 #define	MMU_OBERON_PADDR_MASK	0x7fffffffffff
1671772Sjl139090 #define	MMU_FIRE_PADDR_MASK	0x7ffffffffff
1680Sstevel@tonic-gate 
1690Sstevel@tonic-gate /*
1700Sstevel@tonic-gate  * control register decoding
1710Sstevel@tonic-gate  */
1720Sstevel@tonic-gate /* tsb size: 0=1k 1=2k 2=4k 3=8k 4=16k 5=32k 6=64k 7=128k */
1730Sstevel@tonic-gate #define	MMU_CTL_TO_TSBSIZE(ctl)		((ctl) >> 16)
1740Sstevel@tonic-gate #define	MMU_TSBSIZE_TO_TSBENTRIES(s)	((1 << (s)) << (13 - 3))
1750Sstevel@tonic-gate 
1760Sstevel@tonic-gate /*
1771772Sjl139090  * For Fire mmu bypass addresses, bit 43 specifies cacheability.
1780Sstevel@tonic-gate  */
1791772Sjl139090 #define	MMU_FIRE_BYPASS_NONCACHE	 (1ull << 43)
1801772Sjl139090 
1811772Sjl139090 /*
1821772Sjl139090  * For Oberon mmu bypass addresses, bit 47 specifies cacheability.
1831772Sjl139090  */
1841772Sjl139090 #define	MMU_OBERON_BYPASS_NONCACHE	 (1ull << 47)
1850Sstevel@tonic-gate 
1860Sstevel@tonic-gate /*
1870Sstevel@tonic-gate  * The following macros define the address ranges supported for DVMA
1881772Sjl139090  * and mmu bypass transfers. For Oberon, bit 63 is used for ordering.
1890Sstevel@tonic-gate  */
1901772Sjl139090 #define	MMU_FIRE_BYPASS_BASE		0xFFFC000000000000ull
1914886Sdwoods #define	MMU_FIRE_BYPASS_END		0xFFFC03FFFFFFFFFFull
1921772Sjl139090 
1931772Sjl139090 #define	MMU_OBERON_BYPASS_BASE		0x7FFC000000000000ull
1944886Sdwoods #define	MMU_OBERON_BYPASS_END		0x7FFC7FFFFFFFFFFFull
1951772Sjl139090 
1968691SLida.Horn@Sun.COM #define	MMU_OBERON_BYPASS_RO		0x8000000000000000ull
1978691SLida.Horn@Sun.COM 
1981772Sjl139090 #define	MMU_TSB_PA_MASK		0x7FFFFFFFE000
1990Sstevel@tonic-gate 
2000Sstevel@tonic-gate /*
2010Sstevel@tonic-gate  * The following macros are for loading and unloading io tte
2020Sstevel@tonic-gate  * entries.
2030Sstevel@tonic-gate  */
2040Sstevel@tonic-gate #define	MMU_TTE_SIZE		8
2050Sstevel@tonic-gate #define	MMU_TTE_V		(1ull << 63)
2060Sstevel@tonic-gate #define	MMU_TTE_W		(1ull << 1)
2071772Sjl139090 #define	MMU_TTE_RO		(1ull << 62)	/* Oberon Relaxed Ordering */
2080Sstevel@tonic-gate 
2090Sstevel@tonic-gate #define	INO_BITS		6	/* INO#s are 6 bits long */
2100Sstevel@tonic-gate #define	INO_MASK		0x3F	/* INO#s mask */
2112091Sam139583 
2122091Sam139583 #define	SYSINO_TO_DEVINO(sysino)	(sysino & INO_MASK)
2130Sstevel@tonic-gate 
2142091Sam139583 #define	FIRE_IGN_MASK		0x1F	/* IGN#s mask, 5 bits long for Fire */
2152091Sam139583 #define	OBERON_IGN_MASK		0xFF	/* IGN#s mask, 8 bits long for Oberon */
2162091Sam139583 
2172091Sam139583 #define	ID_TO_IGN(chip, portid) ((portid) & ((chip) == PX_CHIP_OBERON ? \
2182091Sam139583 	OBERON_IGN_MASK : FIRE_IGN_MASK))
2192091Sam139583 
2202091Sam139583 #define	DEVINO_TO_SYSINO(portid, devino) \
2212091Sam139583 	(((portid) << INO_BITS) | ((devino) & INO_MASK))
2220Sstevel@tonic-gate 
2230Sstevel@tonic-gate /* Interrupt states */
2240Sstevel@tonic-gate #define	INTERRUPT_IDLE_STATE		0
2250Sstevel@tonic-gate #define	INTERRUPT_RECEIVED_STATE	1
2260Sstevel@tonic-gate #define	INTERRUPT_PENDING_STATE		3
2270Sstevel@tonic-gate 
2280Sstevel@tonic-gate /*
2290Sstevel@tonic-gate  * Defines for link width and max packet size for ACKBAK Latency Threshold Timer
2300Sstevel@tonic-gate  * and TxLink Replay Timer Latency Table array sizes
2310Sstevel@tonic-gate  * Num		Link Width		Packet Size
2320Sstevel@tonic-gate  * 0		1			128
2330Sstevel@tonic-gate  * 1		4			256
2340Sstevel@tonic-gate  * 2		8			512
2350Sstevel@tonic-gate  * 3		16			1024
2360Sstevel@tonic-gate  * 4		-			2048
2370Sstevel@tonic-gate  * 5		-			4096
2380Sstevel@tonic-gate  */
2390Sstevel@tonic-gate #define	LINK_WIDTH_ARR_SIZE		4
2400Sstevel@tonic-gate #define	LINK_MAX_PKT_ARR_SIZE		6
2410Sstevel@tonic-gate 
2420Sstevel@tonic-gate /*
2430Sstevel@tonic-gate  * Defines for registers which have multi-bit fields.
2440Sstevel@tonic-gate  */
2450Sstevel@tonic-gate #define	TLU_LINK_CONTROL_ASPM_DISABLED			0x0
2460Sstevel@tonic-gate #define	TLU_LINK_CONTROL_ASPM_L0S_EN			0x1
2470Sstevel@tonic-gate #define	TLU_LINK_CONTROL_ASPM_L1_EN			0x2
2480Sstevel@tonic-gate #define	TLU_LINK_CONTROL_ASPM_L0S_L1_EN			0x3
2490Sstevel@tonic-gate 
2500Sstevel@tonic-gate #define	TLU_CONTROL_CONFIG_DEFAULT			0x1
2510Sstevel@tonic-gate #define	TLU_CONTROL_L0S_TIM_DEFAULT			0xdaull
2520Sstevel@tonic-gate #define	TLU_CONTROL_MPS_MASK				0x1C
2530Sstevel@tonic-gate #define	TLU_CONTROL_MPS_SHIFT				2
2540Sstevel@tonic-gate 
2550Sstevel@tonic-gate #define	LPU_TXLINK_REPLAY_NUMBER_STATUS_RPLAY_NUM_0	0x0
2560Sstevel@tonic-gate #define	LPU_TXLINK_REPLAY_NUMBER_STATUS_RPLAY_NUM_1	0x1
2570Sstevel@tonic-gate #define	LPU_TXLINK_REPLAY_NUMBER_STATUS_RPLAY_NUM_2	0x2
2580Sstevel@tonic-gate #define	LPU_TXLINK_REPLAY_NUMBER_STATUS_RPLAY_NUM_3	0x3
2590Sstevel@tonic-gate 
2600Sstevel@tonic-gate #define	LPU_TXLINK_RETRY_FIFO_POINTER_RTRY_FIFO_TLPTR_DEFAULT	0xFFFFull
2610Sstevel@tonic-gate #define	LPU_TXLINK_RETRY_FIFO_POINTER_RTRY_FIFO_HDPTR_DEFAULT	0x0ull
2620Sstevel@tonic-gate 
2630Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNTER_ACK_SEQ_CNTR_DEFAULT	0xFFF
2640Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNTER_NXT_TX_SEQ_CNTR_DEFAULT	0x0
2650Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNT_FIFO_MAX_ADDR_SEQ_CNT_MAX_ADDR_DEF	0x157
2660Sstevel@tonic-gate 
2670Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNT_FIFO_POINTERS_SEQ_CNT_TLPTR_DEFAULT	0xFFF
2680Sstevel@tonic-gate #define	LPU_TXLINK_SEQUENCE_COUNT_FIFO_POINTERS_SEQ_CNT_HDPTR_DEFAULT	0x0
2690Sstevel@tonic-gate 
2700Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG1_LTSSM_8_TO_DEFAULT		0x2
2710Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG1_LTSSM_20_TO_DEFAULT		0x5
2720Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG2_LTSSM_12_TO_DEFAULT		0x2DC6C0
2730Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG3_LTSSM_2_TO_DEFAULT		0x7A120
2740Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG4_DATA_RATE_DEFAULT		0x2
2750Sstevel@tonic-gate #define	LPU_LTSSM_CONFIG4_N_FTS_DEFAULT			0x8c
2760Sstevel@tonic-gate 
277118Sjchu /* LPU LTSSM states */
278118Sjchu #define	LPU_LTSSM_L0			0x0
279118Sjchu #define	LPU_LTSSM_L1_IDLE		0x15
280118Sjchu 
281118Sjchu /* TLU Control register bits */
282118Sjchu #define	TLU_REMAIN_DETECT_QUIET		8
283118Sjchu 
2840Sstevel@tonic-gate /*
2852426Sschwartz  * Fire hardware specific version definitions.
2862426Sschwartz  * All Fire versions > 2.0 will be numerically greater than FIRE_MOD_REV_20
2870Sstevel@tonic-gate  */
2882426Sschwartz #define	FIRE_MOD_REV_20	0x03
2890Sstevel@tonic-gate 
2900Sstevel@tonic-gate /*
2912426Sschwartz  * Oberon specific definitions.
2920Sstevel@tonic-gate  */
2931772Sjl139090 #define	OBERON_RANGE_PROP_MASK	0x7fff
2940Sstevel@tonic-gate 
2952276Sschwartz /*
2962276Sschwartz  * HW specific paddr mask.
2972276Sschwartz  */
2982276Sschwartz extern uint64_t px_paddr_mask;
2992276Sschwartz 
3000Sstevel@tonic-gate extern void hvio_cb_init(caddr_t xbc_csr_base, pxu_t *pxu_p);
3010Sstevel@tonic-gate extern void hvio_ib_init(caddr_t csr_base, pxu_t *pxu_p);
3020Sstevel@tonic-gate extern void hvio_mmu_init(caddr_t csr_base, pxu_t *pxu_p);
3030Sstevel@tonic-gate extern void hvio_pec_init(caddr_t csr_base, pxu_t *pxu_p);
3040Sstevel@tonic-gate 
3050Sstevel@tonic-gate extern uint64_t hvio_intr_devino_to_sysino(devhandle_t dev_hdl, pxu_t *pxu_p,
3060Sstevel@tonic-gate     devino_t devino, sysino_t *sysino);
3070Sstevel@tonic-gate extern uint64_t hvio_intr_getvalid(devhandle_t dev_hdl, sysino_t sysino,
3080Sstevel@tonic-gate     intr_valid_state_t *intr_valid_state);
3090Sstevel@tonic-gate extern uint64_t hvio_intr_setvalid(devhandle_t dev_hdl, sysino_t sysino,
3100Sstevel@tonic-gate     intr_valid_state_t intr_valid_state);
3110Sstevel@tonic-gate extern uint64_t hvio_intr_getstate(devhandle_t dev_hdl, sysino_t sysino,
3120Sstevel@tonic-gate     intr_state_t *intr_state);
3130Sstevel@tonic-gate extern uint64_t hvio_intr_setstate(devhandle_t dev_hdl, sysino_t sysino,
3140Sstevel@tonic-gate     intr_state_t intr_state);
3151772Sjl139090 extern uint64_t hvio_intr_gettarget(devhandle_t dev_hdl, pxu_t *pxu_p,
3161772Sjl139090     sysino_t sysino, cpuid_t *cpuid);
3171772Sjl139090 extern uint64_t hvio_intr_settarget(devhandle_t dev_hdl, pxu_t *pxu_p,
3181772Sjl139090     sysino_t sysino, cpuid_t cpuid);
3190Sstevel@tonic-gate 
3200Sstevel@tonic-gate extern uint64_t hvio_iommu_map(devhandle_t dev_hdl, pxu_t *pxu_p, tsbid_t tsbid,
3211617Sgovinda     pages_t pages, io_attributes_t attr, void *addr, size_t pfn_index,
3221617Sgovinda     int flags);
3230Sstevel@tonic-gate extern uint64_t hvio_iommu_demap(devhandle_t dev_hdl, pxu_t *pxu_p,
3240Sstevel@tonic-gate     tsbid_t tsbid, pages_t pages);
3250Sstevel@tonic-gate extern uint64_t hvio_iommu_getmap(devhandle_t dev_hdl, pxu_t *pxu_p,
3261617Sgovinda     tsbid_t tsbid, io_attributes_t *attr_p, r_addr_t *r_addr_p);
3271772Sjl139090 extern uint64_t hvio_iommu_getbypass(devhandle_t dev_hdl, pxu_t *pxu_p,
3281772Sjl139090     r_addr_t ra, io_attributes_t attr, io_addr_t *io_addr_p);
3291772Sjl139090 extern uint64_t hvio_get_bypass_base(pxu_t *pxu_p);
3301772Sjl139090 extern uint64_t hvio_get_bypass_end(pxu_t *pxu_p);
33110923SEvan.Yan@Sun.COM extern uint64_t px_get_range_prop(px_t *px_p, pci_ranges_t *rp, int bank);
332*12619Sandrew.rutz@sun.com extern void hvio_obptsb_attach(pxu_t *pxu_p);
333*12619Sandrew.rutz@sun.com extern void hvio_obptsb_detach(px_t *px_p);
3341772Sjl139090 
3350Sstevel@tonic-gate 
3360Sstevel@tonic-gate /*
3370Sstevel@tonic-gate  * MSIQ Functions:
3380Sstevel@tonic-gate  */
3390Sstevel@tonic-gate extern uint64_t hvio_msiq_init(devhandle_t dev_hdl, pxu_t *pxu_p);
3400Sstevel@tonic-gate extern uint64_t hvio_msiq_getvalid(devhandle_t dev_hdl, msiqid_t msiq_id,
3410Sstevel@tonic-gate     pci_msiq_valid_state_t *msiq_valid_state);
3420Sstevel@tonic-gate extern uint64_t hvio_msiq_setvalid(devhandle_t dev_hdl, msiqid_t msiq_id,
3430Sstevel@tonic-gate     pci_msiq_valid_state_t msiq_valid_state);
3440Sstevel@tonic-gate extern uint64_t hvio_msiq_getstate(devhandle_t dev_hdl, msiqid_t msiq_id,
3450Sstevel@tonic-gate     pci_msiq_state_t *msiq_state);
3460Sstevel@tonic-gate extern uint64_t hvio_msiq_setstate(devhandle_t dev_hdl, msiqid_t msiq_id,
3470Sstevel@tonic-gate     pci_msiq_state_t msiq_state);
3480Sstevel@tonic-gate extern uint64_t hvio_msiq_gethead(devhandle_t dev_hdl, msiqid_t msiq_id,
3490Sstevel@tonic-gate     msiqhead_t *msiq_head);
3500Sstevel@tonic-gate extern uint64_t hvio_msiq_sethead(devhandle_t dev_hdl, msiqid_t msiq_id,
3510Sstevel@tonic-gate     msiqhead_t msiq_head);
3520Sstevel@tonic-gate extern uint64_t hvio_msiq_gettail(devhandle_t dev_hdl, msiqid_t msiq_id,
3530Sstevel@tonic-gate     msiqtail_t *msiq_tail);
3540Sstevel@tonic-gate 
3550Sstevel@tonic-gate /*
3560Sstevel@tonic-gate  * MSI Functions:
3570Sstevel@tonic-gate  */
3580Sstevel@tonic-gate extern uint64_t hvio_msi_init(devhandle_t dev_hdl, uint64_t addr32,
3590Sstevel@tonic-gate     uint64_t addr64);
3600Sstevel@tonic-gate extern uint64_t hvio_msi_getmsiq(devhandle_t dev_hdl, msinum_t msi_num,
3610Sstevel@tonic-gate     msiqid_t *msiq_id);
3620Sstevel@tonic-gate extern uint64_t hvio_msi_setmsiq(devhandle_t dev_hdl, msinum_t msi_num,
3630Sstevel@tonic-gate     msiqid_t msiq_id);
3640Sstevel@tonic-gate extern uint64_t hvio_msi_getvalid(devhandle_t dev_hdl, msinum_t msi_num,
3650Sstevel@tonic-gate     pci_msi_valid_state_t *msi_valid_state);
3660Sstevel@tonic-gate extern uint64_t hvio_msi_setvalid(devhandle_t dev_hdl, msinum_t msi_num,
3670Sstevel@tonic-gate     pci_msi_valid_state_t msi_valid_state);
3680Sstevel@tonic-gate extern uint64_t hvio_msi_getstate(devhandle_t dev_hdl, msinum_t msi_num,
3690Sstevel@tonic-gate     pci_msi_state_t *msi_state);
3700Sstevel@tonic-gate extern uint64_t hvio_msi_setstate(devhandle_t dev_hdl, msinum_t msi_num,
3710Sstevel@tonic-gate     pci_msi_state_t msi_state);
3720Sstevel@tonic-gate 
3730Sstevel@tonic-gate /*
3740Sstevel@tonic-gate  * MSG Functions:
3750Sstevel@tonic-gate  */
3760Sstevel@tonic-gate extern uint64_t hvio_msg_getmsiq(devhandle_t dev_hdl, pcie_msg_type_t msg_type,
3770Sstevel@tonic-gate     msiqid_t *msiq_id);
3780Sstevel@tonic-gate extern uint64_t hvio_msg_setmsiq(devhandle_t dev_hdl, pcie_msg_type_t msg_type,
3790Sstevel@tonic-gate     msiqid_t msiq_id);
3800Sstevel@tonic-gate extern uint64_t hvio_msg_getvalid(devhandle_t dev_hdl, pcie_msg_type_t msg_type,
3810Sstevel@tonic-gate     pcie_msg_valid_state_t *msg_valid_state);
3820Sstevel@tonic-gate extern uint64_t hvio_msg_setvalid(devhandle_t dev_hdl, pcie_msg_type_t msg_type,
3830Sstevel@tonic-gate     pcie_msg_valid_state_t msg_valid_state);
3840Sstevel@tonic-gate 
3850Sstevel@tonic-gate /*
3860Sstevel@tonic-gate  * Suspend/Resume Functions:
3870Sstevel@tonic-gate  */
3880Sstevel@tonic-gate extern uint64_t hvio_suspend(devhandle_t dev_hdl, pxu_t *pxu_p);
3890Sstevel@tonic-gate extern void hvio_resume(devhandle_t dev_hdl,
3900Sstevel@tonic-gate     devino_t devino, pxu_t *pxu_p);
3910Sstevel@tonic-gate extern uint64_t hvio_cb_suspend(devhandle_t dev_hdl, pxu_t *pxu_p);
3920Sstevel@tonic-gate extern void hvio_cb_resume(devhandle_t pci_dev_hdl, devhandle_t xbus_dev_hdl,
3930Sstevel@tonic-gate     devino_t devino, pxu_t *pxu_p);
3940Sstevel@tonic-gate extern int px_send_pme_turnoff(caddr_t csr_base);
395118Sjchu extern int px_link_wait4l1idle(caddr_t csr_base);
396118Sjchu extern int px_link_retrain(caddr_t csr_base);
397118Sjchu extern void px_enable_detect_quiet(caddr_t csr_base);
3980Sstevel@tonic-gate 
3993274Set142600 extern void px_lib_clr_errs(px_t *px_p, dev_info_t *rdip, uint64_t addr);
400624Sschwartz 
4011772Sjl139090 /*
4021772Sjl139090  * Hotplug functions:
4031772Sjl139090  */
4041772Sjl139090 extern int hvio_hotplug_init(dev_info_t *dip, void *arg);
4051772Sjl139090 extern int hvio_hotplug_uninit(dev_info_t *dip);
4061772Sjl139090 
4070Sstevel@tonic-gate #ifdef	__cplusplus
4080Sstevel@tonic-gate }
4090Sstevel@tonic-gate #endif
4100Sstevel@tonic-gate 
4110Sstevel@tonic-gate #endif	/* _SYS_PX_LIB4U_H */
412