psxface.c (126372) | psxface.c (129684) |
---|---|
1/****************************************************************************** 2 * 3 * Module Name: psxface - Parser external interfaces | 1/****************************************************************************** 2 * 3 * Module Name: psxface - Parser external interfaces |
4 * $Revision: 71 $ | 4 * $Revision: 75 $ |
5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. --- 113 unchanged lines hidden (view full) --- 126#define _COMPONENT ACPI_PARSER 127 ACPI_MODULE_NAME ("psxface") 128 129 130/******************************************************************************* 131 * 132 * FUNCTION: AcpiPsxExecute 133 * | 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. --- 113 unchanged lines hidden (view full) --- 126#define _COMPONENT ACPI_PARSER 127 ACPI_MODULE_NAME ("psxface") 128 129 130/******************************************************************************* 131 * 132 * FUNCTION: AcpiPsxExecute 133 * |
134 * PARAMETERS: MethodNode - A method object containing both the AML | 134 * PARAMETERS: Info->Node - A method object containing both the AML |
135 * address and length. 136 * **Params - List of parameters to pass to method, 137 * terminated by NULL. Params itself may be 138 * NULL if no parameters are being passed. 139 * **ReturnObjDesc - Return object from execution of the 140 * method. 141 * 142 * RETURN: Status 143 * 144 * DESCRIPTION: Execute a control method 145 * 146 ******************************************************************************/ 147 148ACPI_STATUS 149AcpiPsxExecute ( | 135 * address and length. 136 * **Params - List of parameters to pass to method, 137 * terminated by NULL. Params itself may be 138 * NULL if no parameters are being passed. 139 * **ReturnObjDesc - Return object from execution of the 140 * method. 141 * 142 * RETURN: Status 143 * 144 * DESCRIPTION: Execute a control method 145 * 146 ******************************************************************************/ 147 148ACPI_STATUS 149AcpiPsxExecute ( |
150 ACPI_NAMESPACE_NODE *MethodNode, 151 ACPI_OPERAND_OBJECT **Params, 152 ACPI_OPERAND_OBJECT **ReturnObjDesc) | 150 ACPI_PARAMETER_INFO *Info) |
153{ 154 ACPI_STATUS Status; 155 ACPI_OPERAND_OBJECT *ObjDesc; 156 UINT32 i; 157 ACPI_PARSE_OBJECT *Op; 158 ACPI_WALK_STATE *WalkState; 159 160 161 ACPI_FUNCTION_TRACE ("PsxExecute"); 162 163 164 /* Validate the Node and get the attached object */ 165 | 151{ 152 ACPI_STATUS Status; 153 ACPI_OPERAND_OBJECT *ObjDesc; 154 UINT32 i; 155 ACPI_PARSE_OBJECT *Op; 156 ACPI_WALK_STATE *WalkState; 157 158 159 ACPI_FUNCTION_TRACE ("PsxExecute"); 160 161 162 /* Validate the Node and get the attached object */ 163 |
166 if (!MethodNode) | 164 if (!Info || !Info->Node) |
167 { 168 return_ACPI_STATUS (AE_NULL_ENTRY); 169 } 170 | 165 { 166 return_ACPI_STATUS (AE_NULL_ENTRY); 167 } 168 |
171 ObjDesc = AcpiNsGetAttachedObject (MethodNode); | 169 ObjDesc = AcpiNsGetAttachedObject (Info->Node); |
172 if (!ObjDesc) 173 { 174 return_ACPI_STATUS (AE_NULL_OBJECT); 175 } 176 177 /* Init for new method, wait on concurrency semaphore */ 178 | 170 if (!ObjDesc) 171 { 172 return_ACPI_STATUS (AE_NULL_OBJECT); 173 } 174 175 /* Init for new method, wait on concurrency semaphore */ 176 |
179 Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc, NULL); | 177 Status = AcpiDsBeginMethodExecution (Info->Node, ObjDesc, NULL); |
180 if (ACPI_FAILURE (Status)) 181 { 182 return_ACPI_STATUS (Status); 183 } 184 | 178 if (ACPI_FAILURE (Status)) 179 { 180 return_ACPI_STATUS (Status); 181 } 182 |
185 if (Params) | 183 if ((Info->ParameterType == ACPI_PARAM_ARGS) && 184 (Info->Parameters)) |
186 { 187 /* 188 * The caller "owns" the parameters, so give each one an extra 189 * reference 190 */ | 185 { 186 /* 187 * The caller "owns" the parameters, so give each one an extra 188 * reference 189 */ |
191 for (i = 0; Params[i]; i++) | 190 for (i = 0; Info->Parameters[i]; i++) |
192 { | 191 { |
193 AcpiUtAddReference (Params[i]); | 192 AcpiUtAddReference (Info->Parameters[i]); |
194 } 195 } 196 197 /* 198 * 1) Perform the first pass parse of the method to enter any 199 * named objects that it creates into the namespace 200 */ 201 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, 202 "**** Begin Method Parse **** Entry=%p obj=%p\n", | 193 } 194 } 195 196 /* 197 * 1) Perform the first pass parse of the method to enter any 198 * named objects that it creates into the namespace 199 */ 200 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, 201 "**** Begin Method Parse **** Entry=%p obj=%p\n", |
203 MethodNode, ObjDesc)); | 202 Info->Node, ObjDesc)); |
204 205 /* Create and init a Root Node */ 206 207 Op = AcpiPsCreateScopeOp (); 208 if (!Op) 209 { 210 Status = AE_NO_MEMORY; 211 goto Cleanup1; --- 11 unchanged lines hidden (view full) --- 223 WalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId, 224 NULL, NULL, NULL); 225 if (!WalkState) 226 { 227 Status = AE_NO_MEMORY; 228 goto Cleanup2; 229 } 230 | 203 204 /* Create and init a Root Node */ 205 206 Op = AcpiPsCreateScopeOp (); 207 if (!Op) 208 { 209 Status = AE_NO_MEMORY; 210 goto Cleanup1; --- 11 unchanged lines hidden (view full) --- 222 WalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId, 223 NULL, NULL, NULL); 224 if (!WalkState) 225 { 226 Status = AE_NO_MEMORY; 227 goto Cleanup2; 228 } 229 |
231 Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart, 232 ObjDesc->Method.AmlLength, NULL, NULL, 1); | 230 Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node, 231 ObjDesc->Method.AmlStart, 232 ObjDesc->Method.AmlLength, NULL, 1); |
233 if (ACPI_FAILURE (Status)) 234 { 235 goto Cleanup3; 236 } 237 238 /* Parse the AML */ 239 240 Status = AcpiPsParseAml (WalkState); 241 AcpiPsDeleteParseTree (Op); 242 if (ACPI_FAILURE (Status)) 243 { 244 goto Cleanup1; /* Walk state is already deleted */ | 233 if (ACPI_FAILURE (Status)) 234 { 235 goto Cleanup3; 236 } 237 238 /* Parse the AML */ 239 240 Status = AcpiPsParseAml (WalkState); 241 AcpiPsDeleteParseTree (Op); 242 if (ACPI_FAILURE (Status)) 243 { 244 goto Cleanup1; /* Walk state is already deleted */ |
245 | |
246 } 247 248 /* 249 * 2) Execute the method. Performs second pass parse simultaneously 250 */ 251 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, 252 "**** Begin Method Execution **** Entry=%p obj=%p\n", | 245 } 246 247 /* 248 * 2) Execute the method. Performs second pass parse simultaneously 249 */ 250 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, 251 "**** Begin Method Execution **** Entry=%p obj=%p\n", |
253 MethodNode, ObjDesc)); | 252 Info->Node, ObjDesc)); |
254 255 /* Create and init a Root Node */ 256 257 Op = AcpiPsCreateScopeOp (); 258 if (!Op) 259 { 260 Status = AE_NO_MEMORY; 261 goto Cleanup1; 262 } 263 264 /* Init new op with the method name and pointer back to the NS node */ 265 | 253 254 /* Create and init a Root Node */ 255 256 Op = AcpiPsCreateScopeOp (); 257 if (!Op) 258 { 259 Status = AE_NO_MEMORY; 260 goto Cleanup1; 261 } 262 263 /* Init new op with the method name and pointer back to the NS node */ 264 |
266 AcpiPsSetName (Op, MethodNode->Name.Integer); 267 Op->Common.Node = MethodNode; | 265 AcpiPsSetName (Op, Info->Node->Name.Integer); 266 Op->Common.Node = Info->Node; |
268 269 /* Create and initialize a new walk state */ 270 271 WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); 272 if (!WalkState) 273 { 274 Status = AE_NO_MEMORY; 275 goto Cleanup2; 276 } 277 | 267 268 /* Create and initialize a new walk state */ 269 270 WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); 271 if (!WalkState) 272 { 273 Status = AE_NO_MEMORY; 274 goto Cleanup2; 275 } 276 |
278 Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart, 279 ObjDesc->Method.AmlLength, Params, ReturnObjDesc, 3); | 277 Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node, 278 ObjDesc->Method.AmlStart, 279 ObjDesc->Method.AmlLength, Info, 3); |
280 if (ACPI_FAILURE (Status)) 281 { 282 goto Cleanup3; 283 } 284 285 /* 286 * The walk of the parse tree is where we actually execute the method 287 */ 288 Status = AcpiPsParseAml (WalkState); 289 goto Cleanup2; /* Walk state already deleted */ 290 291 292Cleanup3: 293 AcpiDsDeleteWalkState (WalkState); 294 295Cleanup2: 296 AcpiPsDeleteParseTree (Op); 297 298Cleanup1: | 280 if (ACPI_FAILURE (Status)) 281 { 282 goto Cleanup3; 283 } 284 285 /* 286 * The walk of the parse tree is where we actually execute the method 287 */ 288 Status = AcpiPsParseAml (WalkState); 289 goto Cleanup2; /* Walk state already deleted */ 290 291 292Cleanup3: 293 AcpiDsDeleteWalkState (WalkState); 294 295Cleanup2: 296 AcpiPsDeleteParseTree (Op); 297 298Cleanup1: |
299 if (Params) | 299 if ((Info->ParameterType == ACPI_PARAM_ARGS) && 300 (Info->Parameters)) |
300 { 301 /* Take away the extra reference that we gave the parameters above */ 302 | 301 { 302 /* Take away the extra reference that we gave the parameters above */ 303 |
303 for (i = 0; Params[i]; i++) | 304 for (i = 0; Info->Parameters[i]; i++) |
304 { 305 /* Ignore errors, just do them all */ 306 | 305 { 306 /* Ignore errors, just do them all */ 307 |
307 (void) AcpiUtUpdateObjectReference (Params[i], REF_DECREMENT); | 308 (void) AcpiUtUpdateObjectReference (Info->Parameters[i], REF_DECREMENT); |
308 } 309 } 310 311 if (ACPI_FAILURE (Status)) 312 { 313 return_ACPI_STATUS (Status); 314 } 315 316 /* 317 * If the method has returned an object, signal this to the caller with 318 * a control exception code 319 */ | 309 } 310 } 311 312 if (ACPI_FAILURE (Status)) 313 { 314 return_ACPI_STATUS (Status); 315 } 316 317 /* 318 * If the method has returned an object, signal this to the caller with 319 * a control exception code 320 */ |
320 if (*ReturnObjDesc) | 321 if (Info->ReturnObject) |
321 { 322 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned ObjDesc=%p\n", | 322 { 323 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned ObjDesc=%p\n", |
323 *ReturnObjDesc)); 324 ACPI_DUMP_STACK_ENTRY (*ReturnObjDesc); | 324 Info->ReturnObject)); 325 ACPI_DUMP_STACK_ENTRY (Info->ReturnObject); |
325 326 Status = AE_CTRL_RETURN_VALUE; 327 } 328 329 return_ACPI_STATUS (Status); 330} 331 332 | 326 327 Status = AE_CTRL_RETURN_VALUE; 328 } 329 330 return_ACPI_STATUS (Status); 331} 332 333 |