Print this page
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/i86pc/io/acpi/acpidev/acpidev_pci.c
+++ new/usr/src/uts/i86pc/io/acpi/acpidev/acpidev_pci.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
21 21
22 22 /*
23 23 * Copyright (c) 2010, Intel Corporation.
24 24 * All rights reserved.
25 25 */
26 26
27 27 #include <sys/types.h>
28 28 #include <sys/atomic.h>
29 29 #include <sys/sunddi.h>
30 30 #include <sys/sunndi.h>
31 -#include <sys/acpi/acpi.h>
31 +#include <acpica/include/acpi.h>
32 32 #include <sys/acpica.h>
33 33 #include <sys/acpidev.h>
34 34 #include <sys/acpidev_rsc.h>
35 35 #include <sys/acpidev_dr.h>
36 36 #include <sys/acpidev_impl.h>
37 37
38 38 static ACPI_STATUS acpidev_pci_probe(acpidev_walk_info_t *infop);
39 39
40 40 /*
41 41 * Default class driver for PCI/PCIEX Host Bridge devices.
42 42 */
43 43 acpidev_class_t acpidev_class_pci = {
44 44 0, /* adc_refcnt */
45 45 ACPIDEV_CLASS_REV1, /* adc_version */
46 46 ACPIDEV_CLASS_ID_PCI, /* adc_class_id */
47 47 "PCI/PCIex Host Bridge", /* adc_class_name */
48 48 ACPIDEV_TYPE_PCI, /* adc_dev_type */
49 49 NULL, /* adc_private */
50 50 NULL, /* adc_pre_probe */
51 51 NULL, /* adc_post_probe */
52 52 acpidev_pci_probe, /* adc_probe */
53 53 NULL, /* adc_filter */
54 54 NULL, /* adc_init */
55 55 NULL, /* adc_fini */
56 56 };
57 57
58 58 static char *acpidev_pci_device_ids[] = {
59 59 ACPIDEV_HID_PCIEX_HOSTBRIDGE,
60 60 ACPIDEV_HID_PCI_HOSTBRIDGE,
61 61 };
62 62
63 63 static char *acpidev_pciex_device_ids[] = {
64 64 ACPIDEV_HID_PCIEX_HOSTBRIDGE,
65 65 };
66 66
67 67 static void
68 68 acpidev_pci_update_status(acpidev_walk_info_t *infop)
69 69 {
70 70 int status;
71 71 dev_info_t *dip = NULL;
72 72 acpidev_data_handle_t dhdl;
73 73
74 74 dhdl = infop->awi_data;
75 75 ASSERT((dhdl->aod_iflag & ACPIDEV_ODF_DEVINFO_CREATED) == 0);
76 76 ASSERT((dhdl->aod_iflag & ACPIDEV_ODF_DEVINFO_TAGGED) == 0);
77 77 if ((dhdl->aod_iflag & ACPIDEV_ODF_STATUS_VALID) == 0) {
78 78 status = acpidev_query_device_status(infop->awi_hdl);
79 79 dhdl->aod_status = status;
80 80 dhdl->aod_iflag |= ACPIDEV_ODF_STATUS_VALID;
81 81 } else {
82 82 status = dhdl->aod_status;
83 83 }
84 84 dhdl->aod_level = infop->awi_level;
85 85 dhdl->aod_hdl = infop->awi_hdl;
86 86 dhdl->aod_class = NULL;
87 87 dhdl->aod_class_list = NULL;
88 88 if (acpidev_match_device_id(infop->awi_info,
89 89 ACPIDEV_ARRAY_PARAM(acpidev_pciex_device_ids))) {
90 90 dhdl->aod_class_id = ACPIDEV_CLASS_ID_PCIEX;
91 91 } else {
92 92 dhdl->aod_class_id = ACPIDEV_CLASS_ID_PCI;
93 93 }
94 94
95 95 if (ACPI_FAILURE(acpica_get_devinfo(infop->awi_hdl, &dip))) {
96 96 dip = NULL;
97 97 } else {
98 98 ASSERT(dip != NULL);
99 99 }
100 100 if (acpidev_check_device_enabled(status)) {
101 101 /*
102 102 * Mark the device as DISABLE if no device node created.
103 103 * BIOS may hide some special PCI/PCIex buses from OS.
104 104 */
105 105 if (dip == NULL) {
106 106 dhdl->aod_dip = NULL;
107 107 dhdl->aod_status &= ~ACPI_STA_DEVICE_ENABLED;
108 108 } else {
109 109 dhdl->aod_dip = dip;
110 110 dhdl->aod_iflag |= ACPIDEV_ODF_DEVINFO_CREATED;
111 111 }
112 112 } else {
113 113 ASSERT(dip == NULL);
114 114 dhdl->aod_dip = NULL;
115 115 dhdl->aod_status &= ~ACPI_STA_DEVICE_ENABLED;
116 116 }
117 117 }
118 118
119 119 static ACPI_STATUS
120 120 acpidev_pci_probe(acpidev_walk_info_t *infop)
121 121 {
122 122 ACPI_STATUS rc = AE_OK;
123 123
124 124 ASSERT(infop != NULL);
125 125 ASSERT(infop->awi_hdl != NULL);
126 126 ASSERT(infop->awi_info != NULL);
127 127 if (infop->awi_info->Type != ACPI_TYPE_DEVICE ||
128 128 acpidev_match_device_id(infop->awi_info,
129 129 ACPIDEV_ARRAY_PARAM(acpidev_pci_device_ids)) == B_FALSE) {
130 130 return (AE_OK);
131 131 }
132 132
133 133 if (acpica_get_devcfg_feature(ACPI_DEVCFG_PCI) == 0) {
134 134 return (AE_OK);
135 135 }
136 136
137 137 if (infop->awi_op_type == ACPIDEV_OP_BOOT_PROBE) {
138 138 /*
139 139 * Check hotplug capability on the first pass.
140 140 */
141 141 acpidev_dr_check(infop);
142 142 } else if (infop->awi_op_type == ACPIDEV_OP_BOOT_REPROBE) {
143 143 /*
144 144 * Check whether the PCI device enumerator has created device
145 145 * nodes for PCI/PCIEX host bridges.
146 146 */
147 147 acpidev_pci_update_status(infop);
148 148 } else if (infop->awi_op_type == ACPIDEV_OP_HOTPLUG_PROBE) {
149 149 /*
150 150 * No support of PCI/PCIEX host bridge hotplug yet.
151 151 * It will come in next phase.
152 152 */
153 153 cmn_err(CE_WARN,
154 154 "!acpidev: no support of PCI/PCIEX host bridge hotplug.");
155 155 /*
156 156 * Don't block the hot-adding process, just skip it.
157 157 */
158 158 rc = AE_OK;
159 159 } else {
160 160 ACPIDEV_DEBUG(CE_WARN, "!acpidev: unknown operation type %u "
161 161 "in acpidev_pci_probe().", infop->awi_op_type);
162 162 rc = AE_BAD_PARAMETER;
163 163 }
164 164 if (ACPI_FAILURE(rc) && rc != AE_NOT_EXIST && rc != AE_ALREADY_EXISTS) {
165 165 cmn_err(CE_CONT, "?acpidev: failed to process PCI/PCIEX host "
166 166 "bridge object %s.\n", infop->awi_name);
167 167 } else {
168 168 rc = AE_OK;
169 169 }
170 170
171 171 return (rc);
172 172 }
↓ open down ↓ |
131 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX