xref: /titanic_44/usr/src/uts/common/sys/hotplug/pci/pcihp.h (revision 1cb6af97c6f66f456d4f726ef056e1ebc0f73305)
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 (c) 1999-2001 by Sun Microsystems, Inc.
24  * All rights reserved.
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 /*
37  * Interfaces exported by PCI Nexus extension module, kernel/misc/pcihp.
38  */
39 int pcihp_init(dev_info_t *);
40 int pcihp_uninit(dev_info_t *);
41 int pcihp_info(dev_info_t *, ddi_info_cmd_t, void *, void **);
42 
43 struct cb_ops *pcihp_get_cb_ops(void);
44 
45 /* exported data definitions */
46 extern struct cb_ops pcihp_cb_ops;
47 
48 /* definitions for minor numbers */
49 #define	PCIHP_AP_MINOR_NUM(x, y)		(((uint_t)(x) << 8) | \
50 						((y) & 0xFF))
51 #define	PCIHP_AP_MINOR_NUM_TO_PCI_DEVNUM(x)	((x) & 0xFF)
52 #define	PCIHP_AP_MINOR_NUM_TO_INSTANCE(x)	((x) >> 8)
53 #define	PCIHP_DEVCTL_MINOR	0xFF
54 #define	PCIHP_DEBUG_MINOR	0xFE
55 
56 /* definitons for cPCI platforms */
57 #define	PCI_CONF_EXTCAP		0x34	/* Extended Capabilities Pointer */
58 #define	PCI_ECP_CAPID		0x00	/* Capability ID */
59 #define	PCI_ECP_NEXT		0x01	/* Pointer to Next Capability */
60 #define	PCI_ECP_HS_CSR		0x02	/* Hot Swap Control and Status Reg */
61 #define	CPCI_HOTSWAP_CAPID	0x06	/* Hot Swap Capability ID */
62 
63 #define	HS_CSR_INS		0x80	/* ENUM Status - Insertion */
64 #define	HS_CSR_EXT		0x40	/* ENUM Status - Extraction */
65 #define	HS_CSR_LOO		0x08	/* LED ON/OFF 1=ON 0=OFF */
66 #define	HS_CSR_EIM		0x02	/* ENUM# Signal Mask */
67 
68 #define	PCIHP_MAKE_REG_HIGH(busnum, devnum, funcnum, register)\
69 	(\
70 	((ulong_t)(busnum & 0xff) << 16)	|\
71 	((ulong_t)(devnum & 0x1f) << 11)	|\
72 	((ulong_t)(funcnum & 0x7) <<  8)	|\
73 	((ulong_t)(register & 0x3f)))
74 
75 #define	PCIHP_SUCCESS DDI_SUCCESS
76 #define	PCIHP_FAILURE DDI_FAILURE
77 
78 /* cPCI hotswap definitions */
79 #define	PCIHP_HANDLE_ENUM	1	/* clear interrupt and take action */
80 #define	PCIHP_CLEAR_ENUM	2	/* clear interrupt only. */
81 
82 #ifdef	__cplusplus
83 }
84 #endif
85 
86 #endif	/* _SYS_HOTPLUG_PCI_PCIHP_H */
87