xref: /onnv-gate/usr/src/uts/common/sys/hotplug/pci/pcihp.h (revision 881:e6bc7f4b8a33)
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
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
220Sstevel@tonic-gate /*
23*881Sjohnny  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*881Sjohnny  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #ifndef	_SYS_HOTPLUG_PCI_PCIHP_H
280Sstevel@tonic-gate #define	_SYS_HOTPLUG_PCI_PCIHP_H
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #ifdef	__cplusplus
330Sstevel@tonic-gate extern "C" {
340Sstevel@tonic-gate #endif
350Sstevel@tonic-gate 
36*881Sjohnny #include <sys/hotplug/pci/pcihp_impl.h>
37*881Sjohnny 
380Sstevel@tonic-gate /*
390Sstevel@tonic-gate  * Interfaces exported by PCI Nexus extension module, kernel/misc/pcihp.
400Sstevel@tonic-gate  */
410Sstevel@tonic-gate int pcihp_init(dev_info_t *);
420Sstevel@tonic-gate int pcihp_uninit(dev_info_t *);
430Sstevel@tonic-gate int pcihp_info(dev_info_t *, ddi_info_cmd_t, void *, void **);
440Sstevel@tonic-gate struct cb_ops *pcihp_get_cb_ops(void);
450Sstevel@tonic-gate 
460Sstevel@tonic-gate /* definitions for minor numbers */
470Sstevel@tonic-gate #define	PCIHP_AP_MINOR_NUM(x, y)		(((uint_t)(x) << 8) | \
480Sstevel@tonic-gate 						((y) & 0xFF))
490Sstevel@tonic-gate #define	PCIHP_AP_MINOR_NUM_TO_PCI_DEVNUM(x)	((x) & 0xFF)
500Sstevel@tonic-gate #define	PCIHP_AP_MINOR_NUM_TO_INSTANCE(x)	((x) >> 8)
510Sstevel@tonic-gate #define	PCIHP_DEVCTL_MINOR	0xFF
520Sstevel@tonic-gate #define	PCIHP_DEBUG_MINOR	0xFE
530Sstevel@tonic-gate 
540Sstevel@tonic-gate /* definitons for cPCI platforms */
550Sstevel@tonic-gate #define	PCI_CONF_EXTCAP		0x34	/* Extended Capabilities Pointer */
560Sstevel@tonic-gate #define	PCI_ECP_CAPID		0x00	/* Capability ID */
570Sstevel@tonic-gate #define	PCI_ECP_NEXT		0x01	/* Pointer to Next Capability */
580Sstevel@tonic-gate #define	PCI_ECP_HS_CSR		0x02	/* Hot Swap Control and Status Reg */
590Sstevel@tonic-gate #define	CPCI_HOTSWAP_CAPID	0x06	/* Hot Swap Capability ID */
600Sstevel@tonic-gate 
610Sstevel@tonic-gate #define	HS_CSR_INS		0x80	/* ENUM Status - Insertion */
620Sstevel@tonic-gate #define	HS_CSR_EXT		0x40	/* ENUM Status - Extraction */
630Sstevel@tonic-gate #define	HS_CSR_LOO		0x08	/* LED ON/OFF 1=ON 0=OFF */
640Sstevel@tonic-gate #define	HS_CSR_EIM		0x02	/* ENUM# Signal Mask */
650Sstevel@tonic-gate 
660Sstevel@tonic-gate #define	PCIHP_MAKE_REG_HIGH(busnum, devnum, funcnum, register)\
670Sstevel@tonic-gate 	(\
680Sstevel@tonic-gate 	((ulong_t)(busnum & 0xff) << 16)	|\
690Sstevel@tonic-gate 	((ulong_t)(devnum & 0x1f) << 11)	|\
700Sstevel@tonic-gate 	((ulong_t)(funcnum & 0x7) <<  8)	|\
710Sstevel@tonic-gate 	((ulong_t)(register & 0x3f)))
720Sstevel@tonic-gate 
730Sstevel@tonic-gate #define	PCIHP_SUCCESS DDI_SUCCESS
740Sstevel@tonic-gate #define	PCIHP_FAILURE DDI_FAILURE
750Sstevel@tonic-gate 
760Sstevel@tonic-gate /* cPCI hotswap definitions */
770Sstevel@tonic-gate #define	PCIHP_HANDLE_ENUM	1	/* clear interrupt and take action */
780Sstevel@tonic-gate #define	PCIHP_CLEAR_ENUM	2	/* clear interrupt only. */
790Sstevel@tonic-gate 
800Sstevel@tonic-gate #ifdef	__cplusplus
810Sstevel@tonic-gate }
820Sstevel@tonic-gate #endif
830Sstevel@tonic-gate 
840Sstevel@tonic-gate #endif	/* _SYS_HOTPLUG_PCI_PCIHP_H */
85