Print this page
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/dispatcher/dswscope.c
+++ new/usr/src/common/acpica/components/dispatcher/dswscope.c
1 1 /******************************************************************************
2 2 *
3 3 * Module Name: dswscope - Scope stack manipulation
4 4 *
5 5 *****************************************************************************/
6 6
7 7 /*
8 - * Copyright (C) 2000 - 2011, Intel Corp.
8 + * Copyright (C) 2000 - 2013, Intel Corp.
9 9 * All rights reserved.
10 10 *
11 11 * Redistribution and use in source and binary forms, with or without
12 12 * modification, are permitted provided that the following conditions
13 13 * are met:
14 14 * 1. Redistributions of source code must retain the above copyright
15 15 * notice, this list of conditions, and the following disclaimer,
16 16 * without modification.
17 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 18 * substantially similar to the "NO WARRANTY" disclaimer below
19 19 * ("Disclaimer") and any redistribution must be conditioned upon
20 20 * including a substantially similar Disclaimer requirement for further
21 21 * binary redistribution.
22 22 * 3. Neither the names of the above-listed copyright holders nor the names
23 23 * of any contributors may be used to endorse or promote products derived
24 24 * from this software without specific prior written permission.
25 25 *
26 26 * Alternatively, this software may be distributed under the terms of the
27 27 * GNU General Public License ("GPL") version 2 as published by the Free
28 28 * Software Foundation.
29 29 *
30 30 * NO WARRANTY
31 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 41 * POSSIBILITY OF SUCH DAMAGES.
42 42 */
43 43
44 44 #define __DSWSCOPE_C__
45 45
46 46 #include "acpi.h"
47 47 #include "accommon.h"
48 48 #include "acdispat.h"
49 49
50 50
51 51 #define _COMPONENT ACPI_DISPATCHER
52 52 ACPI_MODULE_NAME ("dswscope")
53 53
54 54
55 55 /****************************************************************************
56 56 *
57 57 * FUNCTION: AcpiDsScopeStackClear
58 58 *
59 59 * PARAMETERS: WalkState - Current state
60 60 *
61 61 * RETURN: None
62 62 *
63 63 * DESCRIPTION: Pop (and free) everything on the scope stack except the
64 64 * root scope object (which remains at the stack top.)
65 65 *
66 66 ***************************************************************************/
67 67
68 68 void
69 69 AcpiDsScopeStackClear (
70 70 ACPI_WALK_STATE *WalkState)
71 71 {
72 72 ACPI_GENERIC_STATE *ScopeInfo;
73 73
74 74 ACPI_FUNCTION_NAME (DsScopeStackClear);
75 75
76 76
77 77 while (WalkState->ScopeInfo)
78 78 {
79 79 /* Pop a scope off the stack */
80 80
81 81 ScopeInfo = WalkState->ScopeInfo;
82 82 WalkState->ScopeInfo = ScopeInfo->Scope.Next;
83 83
84 84 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
85 85 "Popped object type (%s)\n",
86 86 AcpiUtGetTypeName (ScopeInfo->Common.Value)));
87 87 AcpiUtDeleteGenericState (ScopeInfo);
88 88 }
89 89 }
90 90
91 91
92 92 /****************************************************************************
93 93 *
94 94 * FUNCTION: AcpiDsScopeStackPush
95 95 *
96 96 * PARAMETERS: Node - Name to be made current
97 97 * Type - Type of frame being pushed
98 98 * WalkState - Current state
99 99 *
100 100 * RETURN: Status
101 101 *
102 102 * DESCRIPTION: Push the current scope on the scope stack, and make the
103 103 * passed Node current.
104 104 *
105 105 ***************************************************************************/
106 106
107 107 ACPI_STATUS
108 108 AcpiDsScopeStackPush (
109 109 ACPI_NAMESPACE_NODE *Node,
110 110 ACPI_OBJECT_TYPE Type,
111 111 ACPI_WALK_STATE *WalkState)
112 112 {
113 113 ACPI_GENERIC_STATE *ScopeInfo;
114 114 ACPI_GENERIC_STATE *OldScopeInfo;
115 115
116 116
117 117 ACPI_FUNCTION_TRACE (DsScopeStackPush);
118 118
119 119
120 120 if (!Node)
121 121 {
122 122 /* Invalid scope */
123 123
124 124 ACPI_ERROR ((AE_INFO, "Null scope parameter"));
125 125 return_ACPI_STATUS (AE_BAD_PARAMETER);
126 126 }
127 127
128 128 /* Make sure object type is valid */
129 129
130 130 if (!AcpiUtValidObjectType (Type))
131 131 {
132 132 ACPI_WARNING ((AE_INFO,
133 133 "Invalid object type: 0x%X", Type));
134 134 }
135 135
136 136 /* Allocate a new scope object */
137 137
138 138 ScopeInfo = AcpiUtCreateGenericState ();
139 139 if (!ScopeInfo)
140 140 {
141 141 return_ACPI_STATUS (AE_NO_MEMORY);
142 142 }
143 143
144 144 /* Init new scope object */
145 145
146 146 ScopeInfo->Common.DescriptorType = ACPI_DESC_TYPE_STATE_WSCOPE;
147 147 ScopeInfo->Scope.Node = Node;
148 148 ScopeInfo->Common.Value = (UINT16) Type;
149 149
150 150 WalkState->ScopeDepth++;
151 151
152 152 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
153 153 "[%.2d] Pushed scope ", (UINT32) WalkState->ScopeDepth));
154 154
155 155 OldScopeInfo = WalkState->ScopeInfo;
156 156 if (OldScopeInfo)
157 157 {
158 158 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
159 159 "[%4.4s] (%s)",
160 160 AcpiUtGetNodeName (OldScopeInfo->Scope.Node),
161 161 AcpiUtGetTypeName (OldScopeInfo->Common.Value)));
162 162 }
163 163 else
164 164 {
165 165 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
166 166 "[\\___] (%s)", "ROOT"));
167 167 }
168 168
169 169 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
170 170 ", New scope -> [%4.4s] (%s)\n",
171 171 AcpiUtGetNodeName (ScopeInfo->Scope.Node),
172 172 AcpiUtGetTypeName (ScopeInfo->Common.Value)));
173 173
174 174 /* Push new scope object onto stack */
175 175
176 176 AcpiUtPushGenericState (&WalkState->ScopeInfo, ScopeInfo);
177 177 return_ACPI_STATUS (AE_OK);
178 178 }
179 179
180 180
181 181 /****************************************************************************
182 182 *
183 183 * FUNCTION: AcpiDsScopeStackPop
184 184 *
185 185 * PARAMETERS: WalkState - Current state
186 186 *
187 187 * RETURN: Status
188 188 *
189 189 * DESCRIPTION: Pop the scope stack once.
190 190 *
191 191 ***************************************************************************/
192 192
193 193 ACPI_STATUS
194 194 AcpiDsScopeStackPop (
195 195 ACPI_WALK_STATE *WalkState)
196 196 {
197 197 ACPI_GENERIC_STATE *ScopeInfo;
198 198 ACPI_GENERIC_STATE *NewScopeInfo;
199 199
200 200
201 201 ACPI_FUNCTION_TRACE (DsScopeStackPop);
202 202
203 203
204 204 /*
205 205 * Pop scope info object off the stack.
206 206 */
207 207 ScopeInfo = AcpiUtPopGenericState (&WalkState->ScopeInfo);
208 208 if (!ScopeInfo)
209 209 {
210 210 return_ACPI_STATUS (AE_STACK_UNDERFLOW);
211 211 }
212 212
213 213 WalkState->ScopeDepth--;
214 214
215 215 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
216 216 "[%.2d] Popped scope [%4.4s] (%s), New scope -> ",
217 217 (UINT32) WalkState->ScopeDepth,
218 218 AcpiUtGetNodeName (ScopeInfo->Scope.Node),
219 219 AcpiUtGetTypeName (ScopeInfo->Common.Value)));
220 220
221 221 NewScopeInfo = WalkState->ScopeInfo;
222 222 if (NewScopeInfo)
223 223 {
224 224 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
225 225 "[%4.4s] (%s)\n",
226 226 AcpiUtGetNodeName (NewScopeInfo->Scope.Node),
227 227 AcpiUtGetTypeName (NewScopeInfo->Common.Value)));
↓ open down ↓ |
209 lines elided |
↑ open up ↑ |
228 228 }
229 229 else
230 230 {
231 231 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
232 232 "[\\___] (ROOT)\n"));
233 233 }
234 234
235 235 AcpiUtDeleteGenericState (ScopeInfo);
236 236 return_ACPI_STATUS (AE_OK);
237 237 }
238 -
239 -
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX