xref: /onnv-gate/usr/src/uts/common/sys/hotplug/pci/pcihp.h (revision 10923:df470fd79c3c)
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
52587Spjha  * Common Development and Distribution License (the "License").
62587Spjha  * 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*10923SEvan.Yan@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23881Sjohnny  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_HOTPLUG_PCI_PCIHP_H
270Sstevel@tonic-gate #define	_SYS_HOTPLUG_PCI_PCIHP_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #ifdef	__cplusplus
300Sstevel@tonic-gate extern "C" {
310Sstevel@tonic-gate #endif
320Sstevel@tonic-gate 
332587Spjha #ifdef	_KERNEL
340Sstevel@tonic-gate /*
350Sstevel@tonic-gate  * Interfaces exported by PCI Nexus extension module, kernel/misc/pcihp.
360Sstevel@tonic-gate  */
370Sstevel@tonic-gate int pcihp_init(dev_info_t *);
380Sstevel@tonic-gate int pcihp_uninit(dev_info_t *);
390Sstevel@tonic-gate int pcihp_info(dev_info_t *, ddi_info_cmd_t, void *, void **);
400Sstevel@tonic-gate struct cb_ops *pcihp_get_cb_ops(void);
412587Spjha #endif
420Sstevel@tonic-gate 
430Sstevel@tonic-gate /* definitions for minor numbers */
440Sstevel@tonic-gate #define	PCIHP_AP_MINOR_NUM(x, y)		(((uint_t)(x) << 8) | \
450Sstevel@tonic-gate 						((y) & 0xFF))
460Sstevel@tonic-gate #define	PCIHP_AP_MINOR_NUM_TO_PCI_DEVNUM(x)	((x) & 0xFF)
470Sstevel@tonic-gate #define	PCIHP_AP_MINOR_NUM_TO_INSTANCE(x)	((x) >> 8)
480Sstevel@tonic-gate #define	PCIHP_DEVCTL_MINOR	0xFF
490Sstevel@tonic-gate #define	PCIHP_DEBUG_MINOR	0xFE
500Sstevel@tonic-gate 
510Sstevel@tonic-gate /* definitons for cPCI platforms */
520Sstevel@tonic-gate #define	PCI_CONF_EXTCAP		0x34	/* Extended Capabilities Pointer */
530Sstevel@tonic-gate #define	PCI_ECP_CAPID		0x00	/* Capability ID */
540Sstevel@tonic-gate #define	PCI_ECP_NEXT		0x01	/* Pointer to Next Capability */
550Sstevel@tonic-gate #define	PCI_ECP_HS_CSR		0x02	/* Hot Swap Control and Status Reg */
560Sstevel@tonic-gate #define	CPCI_HOTSWAP_CAPID	0x06	/* Hot Swap Capability ID */
570Sstevel@tonic-gate 
580Sstevel@tonic-gate #define	HS_CSR_INS		0x80	/* ENUM Status - Insertion */
590Sstevel@tonic-gate #define	HS_CSR_EXT		0x40	/* ENUM Status - Extraction */
600Sstevel@tonic-gate #define	HS_CSR_LOO		0x08	/* LED ON/OFF 1=ON 0=OFF */
610Sstevel@tonic-gate #define	HS_CSR_EIM		0x02	/* ENUM# Signal Mask */
620Sstevel@tonic-gate 
630Sstevel@tonic-gate #define	PCIHP_MAKE_REG_HIGH(busnum, devnum, funcnum, register)\
640Sstevel@tonic-gate 	(\
650Sstevel@tonic-gate 	((ulong_t)(busnum & 0xff) << 16)	|\
660Sstevel@tonic-gate 	((ulong_t)(devnum & 0x1f) << 11)	|\
670Sstevel@tonic-gate 	((ulong_t)(funcnum & 0x7) <<  8)	|\
680Sstevel@tonic-gate 	((ulong_t)(register & 0x3f)))
690Sstevel@tonic-gate 
700Sstevel@tonic-gate #define	PCIHP_SUCCESS DDI_SUCCESS
710Sstevel@tonic-gate #define	PCIHP_FAILURE DDI_FAILURE
720Sstevel@tonic-gate 
730Sstevel@tonic-gate /* cPCI hotswap definitions */
740Sstevel@tonic-gate #define	PCIHP_HANDLE_ENUM	1	/* clear interrupt and take action */
750Sstevel@tonic-gate #define	PCIHP_CLEAR_ENUM	2	/* clear interrupt only. */
760Sstevel@tonic-gate 
770Sstevel@tonic-gate #ifdef	__cplusplus
780Sstevel@tonic-gate }
790Sstevel@tonic-gate #endif
800Sstevel@tonic-gate 
810Sstevel@tonic-gate #endif	/* _SYS_HOTPLUG_PCI_PCIHP_H */
82