xref: /illumos-gate/usr/src/uts/common/sys/hotplug/pci/pcihp.h (revision 88f8b78a88cbdc6d8c1af5c3e54bc49d25095c98)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_HOTPLUG_PCI_PCIHP_H
28 #define	_SYS_HOTPLUG_PCI_PCIHP_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/hotplug/pci/pcihp_impl.h>
37 
38 /*
39  * Interfaces exported by PCI Nexus extension module, kernel/misc/pcihp.
40  */
41 int pcihp_init(dev_info_t *);
42 int pcihp_uninit(dev_info_t *);
43 int pcihp_info(dev_info_t *, ddi_info_cmd_t, void *, void **);
44 struct cb_ops *pcihp_get_cb_ops(void);
45 
46 /* definitions for minor numbers */
47 #define	PCIHP_AP_MINOR_NUM(x, y)		(((uint_t)(x) << 8) | \
48 						((y) & 0xFF))
49 #define	PCIHP_AP_MINOR_NUM_TO_PCI_DEVNUM(x)	((x) & 0xFF)
50 #define	PCIHP_AP_MINOR_NUM_TO_INSTANCE(x)	((x) >> 8)
51 #define	PCIHP_DEVCTL_MINOR	0xFF
52 #define	PCIHP_DEBUG_MINOR	0xFE
53 
54 /* definitons for cPCI platforms */
55 #define	PCI_CONF_EXTCAP		0x34	/* Extended Capabilities Pointer */
56 #define	PCI_ECP_CAPID		0x00	/* Capability ID */
57 #define	PCI_ECP_NEXT		0x01	/* Pointer to Next Capability */
58 #define	PCI_ECP_HS_CSR		0x02	/* Hot Swap Control and Status Reg */
59 #define	CPCI_HOTSWAP_CAPID	0x06	/* Hot Swap Capability ID */
60 
61 #define	HS_CSR_INS		0x80	/* ENUM Status - Insertion */
62 #define	HS_CSR_EXT		0x40	/* ENUM Status - Extraction */
63 #define	HS_CSR_LOO		0x08	/* LED ON/OFF 1=ON 0=OFF */
64 #define	HS_CSR_EIM		0x02	/* ENUM# Signal Mask */
65 
66 #define	PCIHP_MAKE_REG_HIGH(busnum, devnum, funcnum, register)\
67 	(\
68 	((ulong_t)(busnum & 0xff) << 16)	|\
69 	((ulong_t)(devnum & 0x1f) << 11)	|\
70 	((ulong_t)(funcnum & 0x7) <<  8)	|\
71 	((ulong_t)(register & 0x3f)))
72 
73 #define	PCIHP_SUCCESS DDI_SUCCESS
74 #define	PCIHP_FAILURE DDI_FAILURE
75 
76 /* cPCI hotswap definitions */
77 #define	PCIHP_HANDLE_ENUM	1	/* clear interrupt and take action */
78 #define	PCIHP_CLEAR_ENUM	2	/* clear interrupt only. */
79 
80 #ifdef	__cplusplus
81 }
82 #endif
83 
84 #endif	/* _SYS_HOTPLUG_PCI_PCIHP_H */
85