Rev 1498 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1498 | Rev 2216 | ||
---|---|---|---|
Line 6... | Line 6... | ||
6 | 6 | ||
7 | /****************************************************************************** |
7 | /****************************************************************************** |
8 | * |
8 | * |
9 | * 1. Copyright Notice |
9 | * 1. Copyright Notice |
10 | * |
10 | * |
11 | * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. |
11 | * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. |
12 | * All rights reserved. |
12 | * All rights reserved. |
13 | * |
13 | * |
14 | * 2. License |
14 | * 2. License |
15 | * |
15 | * |
Line 131... | Line 131... | ||
131 | static BOOLEAN |
131 | static BOOLEAN |
132 | AcpiEvHasDefaultHandler ( |
132 | AcpiEvHasDefaultHandler ( |
133 | ACPI_NAMESPACE_NODE *Node, |
133 | ACPI_NAMESPACE_NODE *Node, |
134 | ACPI_ADR_SPACE_TYPE SpaceId); |
134 | ACPI_ADR_SPACE_TYPE SpaceId); |
Line -... | Line 135... | ||
- | 135 | ||
- | 136 | static void |
|
- | 137 | AcpiEvOrphanEcRegMethod ( |
|
- | 138 | void); |
|
135 | 139 | ||
136 | static ACPI_STATUS |
140 | static ACPI_STATUS |
137 | AcpiEvRegRun ( |
141 | AcpiEvRegRun ( |
138 | ACPI_HANDLE ObjHandle, |
142 | ACPI_HANDLE ObjHandle, |
139 | UINT32 Level, |
143 | UINT32 Level, |
Line 332... | Line 336... | ||
332 | Status = AcpiEvExecuteRegMethods (AcpiGbl_RootNode, |
336 | Status = AcpiEvExecuteRegMethods (AcpiGbl_RootNode, |
333 | AcpiGbl_DefaultAddressSpaces[i]); |
337 | AcpiGbl_DefaultAddressSpaces[i]); |
334 | } |
338 | } |
335 | } |
339 | } |
Line -... | Line 340... | ||
- | 340 | ||
- | 341 | AcpiGbl_RegMethodsExecuted = TRUE; |
|
336 | 342 | ||
337 | (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); |
343 | (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); |
338 | return_ACPI_STATUS (Status); |
344 | return_ACPI_STATUS (Status); |
Line 679... | Line 685... | ||
679 | } |
685 | } |
680 | } |
686 | } |
Line 681... | Line 687... | ||
681 | 687 | ||
Line 682... | Line 688... | ||
682 | /* Now stop region accesses by executing the _REG method */ |
688 | /* Now stop region accesses by executing the _REG method */ |
683 | 689 | ||
684 | Status = AcpiEvExecuteRegMethod (RegionObj, 0); |
690 | Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_DISCONNECT); |
685 | if (ACPI_FAILURE (Status)) |
691 | if (ACPI_FAILURE (Status)) |
686 | { |
692 | { |
687 | ACPI_EXCEPTION ((AE_INFO, Status, "from region _REG, [%s]", |
693 | ACPI_EXCEPTION ((AE_INFO, Status, "from region _REG, [%s]", |
Line 1210... | Line 1216... | ||
1210 | */ |
1216 | */ |
1211 | Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX, |
1217 | Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX, |
1212 | ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, |
1218 | ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, |
1213 | &SpaceId, NULL); |
1219 | &SpaceId, NULL); |
Line -... | Line 1220... | ||
- | 1220 | ||
- | 1221 | /* Special case for EC: handle "orphan" _REG methods with no region */ |
|
- | 1222 | ||
- | 1223 | if (SpaceId == ACPI_ADR_SPACE_EC) |
|
- | 1224 | { |
|
- | 1225 | AcpiEvOrphanEcRegMethod (); |
|
- | 1226 | } |
|
1214 | 1227 | ||
1215 | return_ACPI_STATUS (Status); |
1228 | return_ACPI_STATUS (Status); |
Line 1216... | Line 1229... | ||
1216 | } |
1229 | } |
Line 1276... | Line 1289... | ||
1276 | /* This region is for a different address space, just ignore it */ |
1289 | /* This region is for a different address space, just ignore it */ |
Line 1277... | Line 1290... | ||
1277 | 1290 | ||
1278 | return (AE_OK); |
1291 | return (AE_OK); |
Line 1279... | Line 1292... | ||
1279 | } |
1292 | } |
1280 | 1293 | ||
1281 | Status = AcpiEvExecuteRegMethod (ObjDesc, 1); |
1294 | Status = AcpiEvExecuteRegMethod (ObjDesc, ACPI_REG_CONNECT); |
Line -... | Line 1295... | ||
- | 1295 | return (Status); |
|
- | 1296 | } |
|
- | 1297 | ||
- | 1298 | ||
- | 1299 | /******************************************************************************* |
|
- | 1300 | * |
|
- | 1301 | * FUNCTION: AcpiEvOrphanEcRegMethod |
|
- | 1302 | * |
|
- | 1303 | * PARAMETERS: None |
|
- | 1304 | * |
|
- | 1305 | * RETURN: None |
|
- | 1306 | * |
|
- | 1307 | * DESCRIPTION: Execute an "orphan" _REG method that appears under the EC |
|
- | 1308 | * device. This is a _REG method that has no corresponding region |
|
- | 1309 | * within the EC device scope. The orphan _REG method appears to |
|
- | 1310 | * have been enabled by the description of the ECDT in the ACPI |
|
- | 1311 | * specification: "The availability of the region space can be |
|
- | 1312 | * detected by providing a _REG method object underneath the |
|
- | 1313 | * Embedded Controller device." |
|
- | 1314 | * |
|
- | 1315 | * To quickly access the EC device, we use the EC_ID that appears |
|
- | 1316 | * within the ECDT. Otherwise, we would need to perform a time- |
|
- | 1317 | * consuming namespace walk, executing _HID methods to find the |
|
- | 1318 | * EC device. |
|
- | 1319 | * |
|
- | 1320 | ******************************************************************************/ |
|
- | 1321 | ||
- | 1322 | static void |
|
- | 1323 | AcpiEvOrphanEcRegMethod ( |
|
- | 1324 | void) |
|
- | 1325 | { |
|
- | 1326 | ACPI_TABLE_ECDT *Table; |
|
- | 1327 | ACPI_STATUS Status; |
|
- | 1328 | ACPI_OBJECT_LIST Args; |
|
- | 1329 | ACPI_OBJECT Objects[2]; |
|
- | 1330 | ACPI_NAMESPACE_NODE *EcDeviceNode; |
|
- | 1331 | ACPI_NAMESPACE_NODE *RegMethod; |
|
- | 1332 | ACPI_NAMESPACE_NODE *NextNode; |
|
- | 1333 | ||
- | 1334 | ||
- | 1335 | ACPI_FUNCTION_TRACE (EvOrphanEcRegMethod); |
|
- | 1336 | ||
- | 1337 | ||
- | 1338 | /* Get the ECDT (if present in system) */ |
|
- | 1339 | ||
- | 1340 | Status = AcpiGetTable (ACPI_SIG_ECDT, 0, |
|
- | 1341 | ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Table)); |
|
- | 1342 | if (ACPI_FAILURE (Status)) |
|
- | 1343 | { |
|
- | 1344 | return_VOID; |
|
- | 1345 | } |
|
- | 1346 | ||
- | 1347 | /* We need a valid EC_ID string */ |
|
- | 1348 | ||
- | 1349 | if (!(*Table->Id)) |
|
- | 1350 | { |
|
- | 1351 | return_VOID; |
|
- | 1352 | } |
|
- | 1353 | ||
- | 1354 | /* Namespace is currently locked, must release */ |
|
- | 1355 | ||
- | 1356 | (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); |
|
- | 1357 | ||
- | 1358 | /* Get a handle to the EC device referenced in the ECDT */ |
|
- | 1359 | ||
- | 1360 | Status = AcpiGetHandle (NULL, |
|
- | 1361 | ACPI_CAST_PTR (char, Table->Id), |
|
- | 1362 | ACPI_CAST_PTR (ACPI_HANDLE, &EcDeviceNode)); |
|
- | 1363 | if (ACPI_FAILURE (Status)) |
|
- | 1364 | { |
|
- | 1365 | goto Exit; |
|
- | 1366 | } |
|
- | 1367 | ||
- | 1368 | /* Get a handle to a _REG method immediately under the EC device */ |
|
- | 1369 | ||
- | 1370 | Status = AcpiGetHandle (EcDeviceNode, |
|
- | 1371 | METHOD_NAME__REG, ACPI_CAST_PTR (ACPI_HANDLE, &RegMethod)); |
|
- | 1372 | if (ACPI_FAILURE (Status)) |
|
- | 1373 | { |
|
- | 1374 | goto Exit; |
|
- | 1375 | } |
|
- | 1376 | ||
- | 1377 | /* |
|
- | 1378 | * Execute the _REG method only if there is no Operation Region in |
|
- | 1379 | * this scope with the Embedded Controller space ID. Otherwise, it |
|
- | 1380 | * will already have been executed. Note, this allows for Regions |
|
- | 1381 | * with other space IDs to be present; but the code below will then |
|
- | 1382 | * execute the _REG method with the EC space ID argument. |
|
- | 1383 | */ |
|
- | 1384 | NextNode = AcpiNsGetNextNode (EcDeviceNode, NULL); |
|
- | 1385 | while (NextNode) |
|
- | 1386 | { |
|
- | 1387 | if ((NextNode->Type == ACPI_TYPE_REGION) && |
|
- | 1388 | (NextNode->Object) && |
|
- | 1389 | (NextNode->Object->Region.SpaceId == ACPI_ADR_SPACE_EC)) |
|
- | 1390 | { |
|
- | 1391 | goto Exit; /* Do not execute _REG */ |
|
- | 1392 | } |
|
- | 1393 | NextNode = AcpiNsGetNextNode (EcDeviceNode, NextNode); |
|
- | 1394 | } |
|
- | 1395 | ||
- | 1396 | /* Evaluate the _REG(EC,Connect) method */ |
|
- | 1397 | ||
- | 1398 | Args.Count = 2; |
|
- | 1399 | Args.Pointer = Objects; |
|
- | 1400 | Objects[0].Type = ACPI_TYPE_INTEGER; |
|
- | 1401 | Objects[0].Integer.Value = ACPI_ADR_SPACE_EC; |
|
- | 1402 | Objects[1].Type = ACPI_TYPE_INTEGER; |
|
- | 1403 | Objects[1].Integer.Value = ACPI_REG_CONNECT; |
|
- | 1404 | ||
- | 1405 | Status = AcpiEvaluateObject (RegMethod, NULL, &Args, NULL); |
|
- | 1406 | ||
- | 1407 | Exit: |
|
- | 1408 | /* We ignore all errors from above, don't care */ |
|
- | 1409 |