xref: /titanic_52/usr/src/uts/intel/sys/pcie_acpi.h (revision fc51f9bbbff02dbd8c3adf640b1a184ceeb58fa5)
1*fc51f9bbSKrishna Elango /*
2*fc51f9bbSKrishna Elango  * CDDL HEADER START
3*fc51f9bbSKrishna Elango  *
4*fc51f9bbSKrishna Elango  * The contents of this file are subject to the terms of the
5*fc51f9bbSKrishna Elango  * Common Development and Distribution License (the "License").
6*fc51f9bbSKrishna Elango  * You may not use this file except in compliance with the License.
7*fc51f9bbSKrishna Elango  *
8*fc51f9bbSKrishna Elango  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*fc51f9bbSKrishna Elango  * or http://www.opensolaris.org/os/licensing.
10*fc51f9bbSKrishna Elango  * See the License for the specific language governing permissions
11*fc51f9bbSKrishna Elango  * and limitations under the License.
12*fc51f9bbSKrishna Elango  *
13*fc51f9bbSKrishna Elango  * When distributing Covered Code, include this CDDL HEADER in each
14*fc51f9bbSKrishna Elango  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*fc51f9bbSKrishna Elango  * If applicable, add the following below this CDDL HEADER, with the
16*fc51f9bbSKrishna Elango  * fields enclosed by brackets "[]" replaced with your own identifying
17*fc51f9bbSKrishna Elango  * information: Portions Copyright [yyyy] [name of copyright owner]
18*fc51f9bbSKrishna Elango  *
19*fc51f9bbSKrishna Elango  * CDDL HEADER END
20*fc51f9bbSKrishna Elango  */
21*fc51f9bbSKrishna Elango /*
22*fc51f9bbSKrishna Elango  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23*fc51f9bbSKrishna Elango  * Use is subject to license terms.
24*fc51f9bbSKrishna Elango  */
25*fc51f9bbSKrishna Elango 
26*fc51f9bbSKrishna Elango #ifndef	_SYS_PCIE_ACPI_H
27*fc51f9bbSKrishna Elango #define	_SYS_PCIE_ACPI_H
28*fc51f9bbSKrishna Elango 
29*fc51f9bbSKrishna Elango #ifdef	__cplusplus
30*fc51f9bbSKrishna Elango extern "C" {
31*fc51f9bbSKrishna Elango #endif
32*fc51f9bbSKrishna Elango 
33*fc51f9bbSKrishna Elango /* revision id of _OSC for PCI/PCI-X/PCI-Exp hierarchy */
34*fc51f9bbSKrishna Elango #define	PCIE_OSC_REVISION_ID	1	/* defined in PCI fw ver 3.0 */
35*fc51f9bbSKrishna Elango 
36*fc51f9bbSKrishna Elango /*
37*fc51f9bbSKrishna Elango  * _OSC method Capabilities buffer bit definitions (from PCI FW 3.0)
38*fc51f9bbSKrishna Elango  */
39*fc51f9bbSKrishna Elango /* first DWORD: status from _OSC invocation (except bit 0) */
40*fc51f9bbSKrishna Elango #define	OSC_STATUS_QUERY_ENABLE	0x1	/* Query Support Flag */
41*fc51f9bbSKrishna Elango #define	OSC_STATUS_FAILED	0x2	/* _OSC failure */
42*fc51f9bbSKrishna Elango #define	OSC_STATUS_INV_UUID	0x4	/* invalid UUID */
43*fc51f9bbSKrishna Elango #define	OSC_STATUS_INV_REVID	0x8	/* invalid revision ID */
44*fc51f9bbSKrishna Elango #define	OSC_STATUS_CAPS_MASKED	0x10	/* capabilities masked */
45*fc51f9bbSKrishna Elango 
46*fc51f9bbSKrishna Elango #define	OSC_STATUS_ERRORS \
47*fc51f9bbSKrishna Elango 	(OSC_STATUS_FAILED | OSC_STATUS_INV_UUID | OSC_STATUS_INV_REVID)
48*fc51f9bbSKrishna Elango 
49*fc51f9bbSKrishna Elango /* second DWORD: Support Field (set by OS) */
50*fc51f9bbSKrishna Elango #define	OSC_SUPPORT_EXT_PCI_CFG	0x1	/* Extended PCI Config Ops supported */
51*fc51f9bbSKrishna Elango #define	OSC_SUPPORT_ACT_PM	0x2	/* Active State PM supported */
52*fc51f9bbSKrishna Elango #define	OSC_SUPPORT_CLK_PM_CAP	0x4	/* Clock PM Capability supported */
53*fc51f9bbSKrishna Elango #define	OSC_SUPPORT_PCI_SEGS	0x8	/* PCI Segment Groups supported */
54*fc51f9bbSKrishna Elango #define	OSC_SUPPORT_MSI		0x10	/* MSI supported */
55*fc51f9bbSKrishna Elango 
56*fc51f9bbSKrishna Elango /* third DWORD: Control Field (set by OS/BIOS) */
57*fc51f9bbSKrishna Elango #define	OSC_CONTROL_PCIE_NAT_HP	0x1	/* PCI Exp Native Hot Plug control */
58*fc51f9bbSKrishna Elango #define	OSC_CONTROL_SHPC_NAT_HP	0x2	/* SHPC Native Hot Plug control */
59*fc51f9bbSKrishna Elango #define	OSC_CONTROL_PCIE_NAT_PM	0x4	/* PCI Exp Native Power Mgmt. control */
60*fc51f9bbSKrishna Elango #define	OSC_CONTROL_PCIE_ADV_ERR 0x8	/* PCIE Advanced Err. rep. control */
61*fc51f9bbSKrishna Elango #define	OSC_CONTROL_PCIE_CAPS	0x10	/* PCIE Caps Structure control */
62*fc51f9bbSKrishna Elango 
63*fc51f9bbSKrishna Elango #define	OSC_CONTROL_FIELD_INIT \
64*fc51f9bbSKrishna Elango 	(OSC_CONTROL_PCIE_CAPS | OSC_CONTROL_PCIE_ADV_ERR)
65*fc51f9bbSKrishna Elango 
66*fc51f9bbSKrishna Elango #define	OSC_SUPPORT_FIELD_INIT \
67*fc51f9bbSKrishna Elango 	(OSC_SUPPORT_EXT_PCI_CFG | \
68*fc51f9bbSKrishna Elango 	OSC_SUPPORT_ACT_PM | OSC_SUPPORT_CLK_PM_CAP | \
69*fc51f9bbSKrishna Elango 	OSC_SUPPORT_MSI | OSC_SUPPORT_PCI_SEGS)
70*fc51f9bbSKrishna Elango 
71*fc51f9bbSKrishna Elango typedef struct pcie_x86_priv {
72*fc51f9bbSKrishna Elango 	/* _OSC related */
73*fc51f9bbSKrishna Elango 	boolean_t	bus_osc;  	/* Has _OSC method been called */
74*fc51f9bbSKrishna Elango 	boolean_t	bus_osc_hp;	/* Was native HP control granted */
75*fc51f9bbSKrishna Elango 	boolean_t	bus_osc_aer;	/* Was AER control granted */
76*fc51f9bbSKrishna Elango } pcie_x86_priv_t;
77*fc51f9bbSKrishna Elango 
78*fc51f9bbSKrishna Elango extern int pcie_acpi_osc(dev_info_t *dip, uint32_t *osc_flags);
79*fc51f9bbSKrishna Elango extern boolean_t pcie_is_osc(dev_info_t *dip);
80*fc51f9bbSKrishna Elango 
81*fc51f9bbSKrishna Elango #ifdef	__cplusplus
82*fc51f9bbSKrishna Elango }
83*fc51f9bbSKrishna Elango #endif
84*fc51f9bbSKrishna Elango 
85*fc51f9bbSKrishna Elango #endif	/* _SYS_PCIE_ACPI_H */
86