2018-03-15 07:13:07 +08:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
|
2005-04-17 06:20:36 +08:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: evrgnini- ACPI address_space (op_region) init
|
|
|
|
*
|
2021-01-16 02:48:25 +08:00
|
|
|
* Copyright (C) 2000 - 2021, Intel Corp.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
2018-03-15 07:13:07 +08:00
|
|
|
*****************************************************************************/
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <acpi/acpi.h>
|
2009-01-09 13:30:03 +08:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "acevents.h"
|
|
|
|
#include "acnamesp.h"
|
2016-10-26 15:42:01 +08:00
|
|
|
#include "acinterp.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_EVENTS
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_MODULE_NAME("evrgnini")
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_system_memory_region_setup
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: handle - Region we are interested in
|
|
|
|
* function - Start or stop
|
2005-04-17 06:20:36 +08:00
|
|
|
* handler_context - Address space handler context
|
|
|
|
* region_context - Region specific context
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* DESCRIPTION: Setup a system_memory operation region
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ev_system_memory_region_setup(acpi_handle handle,
|
|
|
|
u32 function,
|
|
|
|
void *handler_context, void **region_context)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
union acpi_operand_object *region_desc =
|
|
|
|
(union acpi_operand_object *)handle;
|
|
|
|
struct acpi_mem_space_context *local_region_context;
|
ACPICA: Preserve memory opregion mappings
The ACPICA's strategy with respect to the handling of memory mappings
associated with memory operation regions is to avoid mapping the
entire region at once which may be problematic at least in principle
(for example, it may lead to conflicts with overlapping mappings
having different attributes created by drivers). It may also be
wasteful, because memory opregions on some systems take up vast
chunks of address space while the fields in those regions actually
accessed by AML are sparsely distributed.
For this reason, a one-page "window" is mapped for a given opregion
on the first memory access through it and if that "window" does not
cover an address range accessed through that opregion subsequently,
it is unmapped and a new "window" is mapped to replace it. Next,
if the new "window" is not sufficient to acess memory through the
opregion in question in the future, it will be replaced with yet
another "window" and so on. That may lead to a suboptimal sequence
of memory mapping and unmapping operations, for example if two fields
in one opregion separated from each other by a sufficiently wide
chunk of unused address space are accessed in an alternating pattern.
The situation may still be suboptimal if the deferred unmapping
introduced previously is supported by the OS layer. For instance,
the alternating memory access pattern mentioned above may produce
a relatively long list of mappings to release with substantial
duplication among the entries in it, which could be avoided if
acpi_ex_system_memory_space_handler() did not release the mapping
used by it previously as soon as the current access was not covered
by it.
In order to improve that, modify acpi_ex_system_memory_space_handler()
to preserve all of the memory mappings created by it until the memory
regions associated with them go away.
Accordingly, update acpi_ev_system_memory_region_setup() to unmap all
memory associated with memory opregions that go away.
Reported-by: Dan Williams <dan.j.williams@intel.com>
Tested-by: Xiang Li <xiang.z.li@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-06-30 19:40:59 +08:00
|
|
|
struct acpi_mem_mapping *mm;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(ev_system_memory_region_setup);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (function == ACPI_REGION_DEACTIVATE) {
|
|
|
|
if (*region_context) {
|
ACPI: ACPICA 20060331
Implemented header file support for the following
additional ACPI tables: ASF!, BOOT, CPEP, DBGP, MCFG, SPCR,
SPMI, TCPA, and WDRT. With this support, all current and
known ACPI tables are now defined in the ACPICA headers and
are available for use by device drivers and other software.
Implemented support to allow tables that contain ACPI
names with invalid characters to be loaded. Previously,
this would cause the table load to fail, but since
there are several known cases of such tables on
existing machines, this change was made to enable
ACPI support for them. Also, this matches the
behavior of the Microsoft ACPI implementation.
https://bugzilla.novell.com/show_bug.cgi?id=147621
Fixed a couple regressions introduced during the memory
optimization in the 20060317 release. The namespace
node definition required additional reorganization and
an internal datatype that had been changed to 8-bit was
restored to 32-bit. (Valery Podrezov)
Fixed a problem where a null pointer passed to
acpi_ut_delete_generic_state() could be passed through
to acpi_os_release_object which is unexpected. Such
null pointers are now trapped and ignored, matching
the behavior of the previous implementation before the
deployment of acpi_os_release_object(). (Valery Podrezov,
Fiodor Suietov)
Fixed a memory mapping leak during the deletion of
a SystemMemory operation region where a cached memory
mapping was not deleted. This became a noticeable problem
for operation regions that are defined within frequently
used control methods. (Dana Meyers)
Reorganized the ACPI table header files into two main
files: one for the ACPI tables consumed by the ACPICA core,
and another for the miscellaneous ACPI tables that are
consumed by the drivers and other software. The various
FADT definitions were merged into one common section and
three different tables (ACPI 1.0, 1.0+, and 2.0)
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-03-31 13:00:00 +08:00
|
|
|
local_region_context =
|
|
|
|
(struct acpi_mem_space_context *)*region_context;
|
|
|
|
|
ACPICA: Preserve memory opregion mappings
The ACPICA's strategy with respect to the handling of memory mappings
associated with memory operation regions is to avoid mapping the
entire region at once which may be problematic at least in principle
(for example, it may lead to conflicts with overlapping mappings
having different attributes created by drivers). It may also be
wasteful, because memory opregions on some systems take up vast
chunks of address space while the fields in those regions actually
accessed by AML are sparsely distributed.
For this reason, a one-page "window" is mapped for a given opregion
on the first memory access through it and if that "window" does not
cover an address range accessed through that opregion subsequently,
it is unmapped and a new "window" is mapped to replace it. Next,
if the new "window" is not sufficient to acess memory through the
opregion in question in the future, it will be replaced with yet
another "window" and so on. That may lead to a suboptimal sequence
of memory mapping and unmapping operations, for example if two fields
in one opregion separated from each other by a sufficiently wide
chunk of unused address space are accessed in an alternating pattern.
The situation may still be suboptimal if the deferred unmapping
introduced previously is supported by the OS layer. For instance,
the alternating memory access pattern mentioned above may produce
a relatively long list of mappings to release with substantial
duplication among the entries in it, which could be avoided if
acpi_ex_system_memory_space_handler() did not release the mapping
used by it previously as soon as the current access was not covered
by it.
In order to improve that, modify acpi_ex_system_memory_space_handler()
to preserve all of the memory mappings created by it until the memory
regions associated with them go away.
Accordingly, update acpi_ev_system_memory_region_setup() to unmap all
memory associated with memory opregions that go away.
Reported-by: Dan Williams <dan.j.williams@intel.com>
Tested-by: Xiang Li <xiang.z.li@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-06-30 19:40:59 +08:00
|
|
|
/* Delete memory mappings if present */
|
ACPI: ACPICA 20060331
Implemented header file support for the following
additional ACPI tables: ASF!, BOOT, CPEP, DBGP, MCFG, SPCR,
SPMI, TCPA, and WDRT. With this support, all current and
known ACPI tables are now defined in the ACPICA headers and
are available for use by device drivers and other software.
Implemented support to allow tables that contain ACPI
names with invalid characters to be loaded. Previously,
this would cause the table load to fail, but since
there are several known cases of such tables on
existing machines, this change was made to enable
ACPI support for them. Also, this matches the
behavior of the Microsoft ACPI implementation.
https://bugzilla.novell.com/show_bug.cgi?id=147621
Fixed a couple regressions introduced during the memory
optimization in the 20060317 release. The namespace
node definition required additional reorganization and
an internal datatype that had been changed to 8-bit was
restored to 32-bit. (Valery Podrezov)
Fixed a problem where a null pointer passed to
acpi_ut_delete_generic_state() could be passed through
to acpi_os_release_object which is unexpected. Such
null pointers are now trapped and ignored, matching
the behavior of the previous implementation before the
deployment of acpi_os_release_object(). (Valery Podrezov,
Fiodor Suietov)
Fixed a memory mapping leak during the deletion of
a SystemMemory operation region where a cached memory
mapping was not deleted. This became a noticeable problem
for operation regions that are defined within frequently
used control methods. (Dana Meyers)
Reorganized the ACPI table header files into two main
files: one for the ACPI tables consumed by the ACPICA core,
and another for the miscellaneous ACPI tables that are
consumed by the drivers and other software. The various
FADT definitions were merged into one common section and
three different tables (ACPI 1.0, 1.0+, and 2.0)
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-03-31 13:00:00 +08:00
|
|
|
|
ACPICA: Preserve memory opregion mappings
The ACPICA's strategy with respect to the handling of memory mappings
associated with memory operation regions is to avoid mapping the
entire region at once which may be problematic at least in principle
(for example, it may lead to conflicts with overlapping mappings
having different attributes created by drivers). It may also be
wasteful, because memory opregions on some systems take up vast
chunks of address space while the fields in those regions actually
accessed by AML are sparsely distributed.
For this reason, a one-page "window" is mapped for a given opregion
on the first memory access through it and if that "window" does not
cover an address range accessed through that opregion subsequently,
it is unmapped and a new "window" is mapped to replace it. Next,
if the new "window" is not sufficient to acess memory through the
opregion in question in the future, it will be replaced with yet
another "window" and so on. That may lead to a suboptimal sequence
of memory mapping and unmapping operations, for example if two fields
in one opregion separated from each other by a sufficiently wide
chunk of unused address space are accessed in an alternating pattern.
The situation may still be suboptimal if the deferred unmapping
introduced previously is supported by the OS layer. For instance,
the alternating memory access pattern mentioned above may produce
a relatively long list of mappings to release with substantial
duplication among the entries in it, which could be avoided if
acpi_ex_system_memory_space_handler() did not release the mapping
used by it previously as soon as the current access was not covered
by it.
In order to improve that, modify acpi_ex_system_memory_space_handler()
to preserve all of the memory mappings created by it until the memory
regions associated with them go away.
Accordingly, update acpi_ev_system_memory_region_setup() to unmap all
memory associated with memory opregions that go away.
Reported-by: Dan Williams <dan.j.williams@intel.com>
Tested-by: Xiang Li <xiang.z.li@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-06-30 19:40:59 +08:00
|
|
|
while (local_region_context->first_mm) {
|
|
|
|
mm = local_region_context->first_mm;
|
|
|
|
local_region_context->first_mm = mm->next_mm;
|
|
|
|
acpi_os_unmap_memory(mm->logical_address,
|
|
|
|
mm->length);
|
|
|
|
ACPI_FREE(mm);
|
ACPI: ACPICA 20060331
Implemented header file support for the following
additional ACPI tables: ASF!, BOOT, CPEP, DBGP, MCFG, SPCR,
SPMI, TCPA, and WDRT. With this support, all current and
known ACPI tables are now defined in the ACPICA headers and
are available for use by device drivers and other software.
Implemented support to allow tables that contain ACPI
names with invalid characters to be loaded. Previously,
this would cause the table load to fail, but since
there are several known cases of such tables on
existing machines, this change was made to enable
ACPI support for them. Also, this matches the
behavior of the Microsoft ACPI implementation.
https://bugzilla.novell.com/show_bug.cgi?id=147621
Fixed a couple regressions introduced during the memory
optimization in the 20060317 release. The namespace
node definition required additional reorganization and
an internal datatype that had been changed to 8-bit was
restored to 32-bit. (Valery Podrezov)
Fixed a problem where a null pointer passed to
acpi_ut_delete_generic_state() could be passed through
to acpi_os_release_object which is unexpected. Such
null pointers are now trapped and ignored, matching
the behavior of the previous implementation before the
deployment of acpi_os_release_object(). (Valery Podrezov,
Fiodor Suietov)
Fixed a memory mapping leak during the deletion of
a SystemMemory operation region where a cached memory
mapping was not deleted. This became a noticeable problem
for operation regions that are defined within frequently
used control methods. (Dana Meyers)
Reorganized the ACPI table header files into two main
files: one for the ACPI tables consumed by the ACPICA core,
and another for the miscellaneous ACPI tables that are
consumed by the drivers and other software. The various
FADT definitions were merged into one common section and
three different tables (ACPI 1.0, 1.0+, and 2.0)
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-03-31 13:00:00 +08:00
|
|
|
}
|
|
|
|
ACPI_FREE(local_region_context);
|
2005-04-17 06:20:36 +08:00
|
|
|
*region_context = NULL;
|
|
|
|
}
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Create a new context */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
local_region_context =
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_mem_space_context));
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!(local_region_context)) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Save the region length and address for use in the handler */
|
|
|
|
|
|
|
|
local_region_context->length = region_desc->region.length;
|
|
|
|
local_region_context->address = region_desc->region.address;
|
|
|
|
|
|
|
|
*region_context = local_region_context;
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_io_space_region_setup
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: handle - Region we are interested in
|
|
|
|
* function - Start or stop
|
2005-04-17 06:20:36 +08:00
|
|
|
* handler_context - Address space handler context
|
|
|
|
* region_context - Region specific context
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* DESCRIPTION: Setup a IO operation region
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ev_io_space_region_setup(acpi_handle handle,
|
|
|
|
u32 function,
|
|
|
|
void *handler_context, void **region_context)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(ev_io_space_region_setup);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (function == ACPI_REGION_DEACTIVATE) {
|
|
|
|
*region_context = NULL;
|
2005-08-05 12:44:28 +08:00
|
|
|
} else {
|
2005-04-17 06:20:36 +08:00
|
|
|
*region_context = handler_context;
|
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_pci_config_region_setup
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: handle - Region we are interested in
|
|
|
|
* function - Start or stop
|
2005-04-17 06:20:36 +08:00
|
|
|
* handler_context - Address space handler context
|
|
|
|
* region_context - Region specific context
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* DESCRIPTION: Setup a PCI_Config operation region
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* MUTEX: Assumes namespace is not locked
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ev_pci_config_region_setup(acpi_handle handle,
|
|
|
|
u32 function,
|
|
|
|
void *handler_context, void **region_context)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
2010-01-21 10:06:32 +08:00
|
|
|
u64 pci_value;
|
2005-08-05 12:44:28 +08:00
|
|
|
struct acpi_pci_id *pci_id = *region_context;
|
|
|
|
union acpi_operand_object *handler_obj;
|
|
|
|
struct acpi_namespace_node *parent_node;
|
|
|
|
struct acpi_namespace_node *pci_root_node;
|
2007-02-03 00:48:21 +08:00
|
|
|
struct acpi_namespace_node *pci_device_node;
|
2005-08-05 12:44:28 +08:00
|
|
|
union acpi_operand_object *region_obj =
|
|
|
|
(union acpi_operand_object *)handle;
|
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(ev_pci_config_region_setup);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
handler_obj = region_obj->region.handler;
|
|
|
|
if (!handler_obj) {
|
|
|
|
/*
|
|
|
|
* No installed handler. This shouldn't happen because the dispatch
|
|
|
|
* routine checks before we get here, but we check again just in case.
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
|
|
|
|
"Attempting to init a region %p, with no handler\n",
|
|
|
|
region_obj));
|
|
|
|
return_ACPI_STATUS(AE_NOT_EXIST);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
*region_context = NULL;
|
|
|
|
if (function == ACPI_REGION_DEACTIVATE) {
|
|
|
|
if (pci_id) {
|
2006-10-03 12:00:00 +08:00
|
|
|
ACPI_FREE(pci_id);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2010-05-26 11:53:07 +08:00
|
|
|
parent_node = region_obj->region.node->parent;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the _SEG and _BBN values from the device upon which the handler
|
|
|
|
* is installed.
|
|
|
|
*
|
|
|
|
* We need to get the _SEG and _BBN objects relative to the PCI BUS device.
|
|
|
|
* This is the device the handler has been registered to handle.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If the address_space.Node is still pointing to the root, we need
|
|
|
|
* to scan upward for a PCI Root bridge and re-associate the op_region
|
|
|
|
* handlers with that device.
|
|
|
|
*/
|
|
|
|
if (handler_obj->address_space.node == acpi_gbl_root_node) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Start search from the parent object */
|
|
|
|
|
|
|
|
pci_root_node = parent_node;
|
|
|
|
while (pci_root_node != acpi_gbl_root_node) {
|
2007-02-03 00:48:21 +08:00
|
|
|
|
|
|
|
/* Get the _HID/_CID in order to detect a root_bridge */
|
|
|
|
|
|
|
|
if (acpi_ev_is_pci_root_bridge(pci_root_node)) {
|
|
|
|
|
|
|
|
/* Install a handler for this PCI root bridge */
|
|
|
|
|
2016-05-05 12:57:53 +08:00
|
|
|
status = acpi_install_address_space_handler((acpi_handle)pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
|
2007-02-03 00:48:21 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
if (status == AE_SAME_HANDLER) {
|
|
|
|
/*
|
2008-11-12 16:01:56 +08:00
|
|
|
* It is OK if the handler is already installed on the
|
|
|
|
* root bridge. Still need to return a context object
|
|
|
|
* for the new PCI_Config operation region, however.
|
2007-02-03 00:48:21 +08:00
|
|
|
*/
|
|
|
|
} else {
|
|
|
|
ACPI_EXCEPTION((AE_INFO, status,
|
2009-03-06 10:05:18 +08:00
|
|
|
"Could not install PciConfig handler "
|
|
|
|
"for Root Bridge %4.4s",
|
2007-02-03 00:48:21 +08:00
|
|
|
acpi_ut_get_node_name
|
|
|
|
(pci_root_node)));
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
2007-02-03 00:48:21 +08:00
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2010-05-26 11:53:07 +08:00
|
|
|
pci_root_node = pci_root_node->parent;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* PCI root bridge not found, use namespace root node */
|
2005-08-05 12:44:28 +08:00
|
|
|
} else {
|
2005-04-17 06:20:36 +08:00
|
|
|
pci_root_node = handler_obj->address_space.node;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If this region is now initialized, we are done.
|
|
|
|
* (install_address_space_handler could have initialized it)
|
|
|
|
*/
|
|
|
|
if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Region is still not initialized. Create a new context */
|
|
|
|
|
2006-10-03 12:00:00 +08:00
|
|
|
pci_id = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pci_id));
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!pci_id) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-11-12 16:01:56 +08:00
|
|
|
* For PCI_Config space access, we need the segment, bus, device and
|
|
|
|
* function numbers. Acquire them here.
|
2007-02-03 00:48:21 +08:00
|
|
|
*
|
|
|
|
* Find the parent device object. (This allows the operation region to be
|
|
|
|
* within a subscope under the device, such as a control method.)
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2007-02-03 00:48:21 +08:00
|
|
|
pci_device_node = region_obj->region.node;
|
|
|
|
while (pci_device_node && (pci_device_node->type != ACPI_TYPE_DEVICE)) {
|
2010-05-26 11:53:07 +08:00
|
|
|
pci_device_node = pci_device_node->parent;
|
2007-02-03 00:48:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!pci_device_node) {
|
2007-07-19 06:48:03 +08:00
|
|
|
ACPI_FREE(pci_id);
|
2007-02-03 00:48:21 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
2010-09-15 13:22:46 +08:00
|
|
|
* Get the PCI device and function numbers from the _ADR object
|
|
|
|
* contained in the parent's scope.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2009-03-06 10:05:18 +08:00
|
|
|
status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR,
|
|
|
|
pci_device_node, &pci_value);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
2008-11-12 16:01:56 +08:00
|
|
|
* The default is zero, and since the allocation above zeroed the data,
|
|
|
|
* just do nothing on failure.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_SUCCESS(status)) {
|
|
|
|
pci_id->device = ACPI_HIWORD(ACPI_LODWORD(pci_value));
|
|
|
|
pci_id->function = ACPI_LOWORD(ACPI_LODWORD(pci_value));
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* The PCI segment number comes from the _SEG method */
|
|
|
|
|
2009-03-06 10:05:18 +08:00
|
|
|
status = acpi_ut_evaluate_numeric_object(METHOD_NAME__SEG,
|
|
|
|
pci_root_node, &pci_value);
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_SUCCESS(status)) {
|
|
|
|
pci_id->segment = ACPI_LOWORD(pci_value);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* The PCI bus number comes from the _BBN method */
|
|
|
|
|
2009-03-06 10:05:18 +08:00
|
|
|
status = acpi_ut_evaluate_numeric_object(METHOD_NAME__BBN,
|
|
|
|
pci_root_node, &pci_value);
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_SUCCESS(status)) {
|
|
|
|
pci_id->bus = ACPI_LOWORD(pci_value);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2010-09-15 13:22:46 +08:00
|
|
|
/* Complete/update the PCI ID for this device */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-09-15 13:22:46 +08:00
|
|
|
status =
|
|
|
|
acpi_hw_derive_pci_id(pci_id, pci_root_node,
|
|
|
|
region_obj->region.node);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
ACPI_FREE(pci_id);
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
*region_context = pci_id;
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2007-02-03 00:48:21 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_is_pci_root_bridge
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: node - Device node being examined
|
2007-02-03 00:48:21 +08:00
|
|
|
*
|
|
|
|
* RETURN: TRUE if device is a PCI/PCI-Express Root Bridge
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Determine if the input device represents a PCI Root Bridge by
|
|
|
|
* examining the _HID and _CID for the device.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2018-10-04 02:45:38 +08:00
|
|
|
u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
|
2007-02-03 00:48:21 +08:00
|
|
|
{
|
|
|
|
acpi_status status;
|
2012-10-31 10:25:24 +08:00
|
|
|
struct acpi_pnp_device_id *hid;
|
|
|
|
struct acpi_pnp_device_id_list *cid;
|
2008-06-10 13:42:13 +08:00
|
|
|
u32 i;
|
2009-06-29 13:39:29 +08:00
|
|
|
u8 match;
|
2007-02-03 00:48:21 +08:00
|
|
|
|
2008-11-12 16:01:56 +08:00
|
|
|
/* Get the _HID and check for a PCI Root Bridge */
|
|
|
|
|
2007-02-03 00:48:21 +08:00
|
|
|
status = acpi_ut_execute_HID(node, &hid);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return (FALSE);
|
|
|
|
}
|
|
|
|
|
2009-06-29 13:39:29 +08:00
|
|
|
match = acpi_ut_is_pci_root_bridge(hid->string);
|
|
|
|
ACPI_FREE(hid);
|
|
|
|
|
|
|
|
if (match) {
|
2007-02-03 00:48:21 +08:00
|
|
|
return (TRUE);
|
|
|
|
}
|
|
|
|
|
2008-11-12 16:01:56 +08:00
|
|
|
/* The _HID did not match. Get the _CID and check for a PCI Root Bridge */
|
|
|
|
|
2007-02-03 00:48:21 +08:00
|
|
|
status = acpi_ut_execute_CID(node, &cid);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return (FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check all _CIDs in the returned list */
|
|
|
|
|
|
|
|
for (i = 0; i < cid->count; i++) {
|
2009-06-29 13:39:29 +08:00
|
|
|
if (acpi_ut_is_pci_root_bridge(cid->ids[i].string)) {
|
2007-02-03 00:48:21 +08:00
|
|
|
ACPI_FREE(cid);
|
|
|
|
return (TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ACPI_FREE(cid);
|
|
|
|
return (FALSE);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_pci_bar_region_setup
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: handle - Region we are interested in
|
|
|
|
* function - Start or stop
|
2005-04-17 06:20:36 +08:00
|
|
|
* handler_context - Address space handler context
|
|
|
|
* region_context - Region specific context
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* DESCRIPTION: Setup a pci_BAR operation region
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* MUTEX: Assumes namespace is not locked
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ev_pci_bar_region_setup(acpi_handle handle,
|
|
|
|
u32 function,
|
|
|
|
void *handler_context, void **region_context)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(ev_pci_bar_region_setup);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_cmos_region_setup
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: handle - Region we are interested in
|
|
|
|
* function - Start or stop
|
2005-04-17 06:20:36 +08:00
|
|
|
* handler_context - Address space handler context
|
|
|
|
* region_context - Region specific context
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* DESCRIPTION: Setup a CMOS operation region
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* MUTEX: Assumes namespace is not locked
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ev_cmos_region_setup(acpi_handle handle,
|
|
|
|
u32 function,
|
|
|
|
void *handler_context, void **region_context)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(ev_cmos_region_setup);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2021-12-23 00:21:25 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_data_table_region_setup
|
|
|
|
*
|
|
|
|
* PARAMETERS: handle - Region we are interested in
|
|
|
|
* function - Start or stop
|
|
|
|
* handler_context - Address space handler context
|
|
|
|
* region_context - Region specific context
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Setup a data_table_region
|
|
|
|
*
|
|
|
|
* MUTEX: Assumes namespace is not locked
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
|
|
|
acpi_ev_data_table_region_setup(acpi_handle handle,
|
|
|
|
u32 function,
|
|
|
|
void *handler_context, void **region_context)
|
|
|
|
{
|
|
|
|
union acpi_operand_object *region_desc =
|
|
|
|
(union acpi_operand_object *)handle;
|
|
|
|
struct acpi_data_table_space_context *local_region_context;
|
|
|
|
|
|
|
|
ACPI_FUNCTION_TRACE(ev_data_table_region_setup);
|
|
|
|
|
|
|
|
if (function == ACPI_REGION_DEACTIVATE) {
|
|
|
|
if (*region_context) {
|
|
|
|
ACPI_FREE(*region_context);
|
|
|
|
*region_context = NULL;
|
|
|
|
}
|
|
|
|
return_ACPI_STATUS(AE_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create a new context */
|
|
|
|
|
|
|
|
local_region_context =
|
|
|
|
ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_data_table_space_context));
|
|
|
|
if (!(local_region_context)) {
|
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Save the data table pointer for use in the handler */
|
|
|
|
|
|
|
|
local_region_context->pointer = region_desc->region.pointer;
|
|
|
|
|
|
|
|
*region_context = local_region_context;
|
|
|
|
return_ACPI_STATUS(AE_OK);
|
|
|
|
}
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_default_region_setup
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: handle - Region we are interested in
|
|
|
|
* function - Start or stop
|
2005-04-17 06:20:36 +08:00
|
|
|
* handler_context - Address space handler context
|
|
|
|
* region_context - Region specific context
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* DESCRIPTION: Default region initialization
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ev_default_region_setup(acpi_handle handle,
|
|
|
|
u32 function,
|
|
|
|
void *handler_context, void **region_context)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(ev_default_region_setup);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (function == ACPI_REGION_DEACTIVATE) {
|
|
|
|
*region_context = NULL;
|
2005-08-05 12:44:28 +08:00
|
|
|
} else {
|
2005-04-17 06:20:36 +08:00
|
|
|
*region_context = handler_context;
|
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ev_initialize_region
|
|
|
|
*
|
|
|
|
* PARAMETERS: region_obj - Region we are initializing
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Initializes the region, finds any _REG methods and saves them
|
|
|
|
* for execution at a later time
|
|
|
|
*
|
|
|
|
* Get the appropriate address space handler for a newly
|
|
|
|
* created region.
|
|
|
|
*
|
2008-11-12 16:01:56 +08:00
|
|
|
* This also performs address space specific initialization. For
|
2005-04-17 06:20:36 +08:00
|
|
|
* example, PCI regions must have an _ADR object that contains
|
2008-11-12 16:01:56 +08:00
|
|
|
* a PCI address in the scope of the definition. This address is
|
2005-04-17 06:20:36 +08:00
|
|
|
* required to perform an access to PCI config space.
|
|
|
|
*
|
2007-02-03 00:48:18 +08:00
|
|
|
* MUTEX: Interpreter should be unlocked, because we may run the _REG
|
|
|
|
* method for this region.
|
|
|
|
*
|
2016-11-30 15:21:12 +08:00
|
|
|
* NOTE: Possible incompliance:
|
|
|
|
* There is a behavior conflict in automatic _REG execution:
|
|
|
|
* 1. When the interpreter is evaluating a method, we can only
|
|
|
|
* automatically run _REG for the following case:
|
|
|
|
* operation_region (OPR1, 0x80, 0x1000010, 0x4)
|
|
|
|
* 2. When the interpreter is loading a table, we can also
|
|
|
|
* automatically run _REG for the following case:
|
|
|
|
* operation_region (OPR1, 0x80, 0x1000010, 0x4)
|
|
|
|
* Though this may not be compliant to the de-facto standard, the
|
|
|
|
* logic is kept in order not to trigger regressions. And keeping
|
|
|
|
* this logic should be taken care by the caller of this function.
|
|
|
|
*
|
2005-04-17 06:20:36 +08:00
|
|
|
******************************************************************************/
|
|
|
|
|
2016-11-30 15:21:12 +08:00
|
|
|
acpi_status acpi_ev_initialize_region(union acpi_operand_object *region_obj)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
union acpi_operand_object *handler_obj;
|
|
|
|
union acpi_operand_object *obj_desc;
|
|
|
|
acpi_adr_space_type space_id;
|
|
|
|
struct acpi_namespace_node *node;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2016-11-30 15:21:12 +08:00
|
|
|
ACPI_FUNCTION_TRACE(ev_initialize_region);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (!region_obj) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (region_obj->common.flags & AOPOBJ_OBJECT_INITIALIZED) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2015-12-29 14:02:58 +08:00
|
|
|
region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2010-05-26 11:53:07 +08:00
|
|
|
node = region_obj->region.node->parent;
|
2005-04-17 06:20:36 +08:00
|
|
|
space_id = region_obj->region.space_id;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The following loop depends upon the root Node having no parent
|
2015-12-29 14:01:53 +08:00
|
|
|
* ie: acpi_gbl_root_node->Parent being set to NULL
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
while (node) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Check to see if a handler exists */
|
|
|
|
|
|
|
|
handler_obj = NULL;
|
2005-08-05 12:44:28 +08:00
|
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (obj_desc) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Can only be a handler if the object exists */
|
|
|
|
|
|
|
|
switch (node->type) {
|
|
|
|
case ACPI_TYPE_DEVICE:
|
|
|
|
case ACPI_TYPE_PROCESSOR:
|
|
|
|
case ACPI_TYPE_THERMAL:
|
|
|
|
|
2015-12-29 14:02:08 +08:00
|
|
|
handler_obj = obj_desc->common_notify.handler;
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Ignore other objects */
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-12-29 14:02:00 +08:00
|
|
|
handler_obj =
|
|
|
|
acpi_ev_find_region_handler(space_id, handler_obj);
|
|
|
|
if (handler_obj) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2015-12-29 14:02:00 +08:00
|
|
|
/* Found correct handler */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2015-12-29 14:02:00 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
|
|
|
|
"Found handler %p for region %p in obj %p\n",
|
|
|
|
handler_obj, region_obj,
|
|
|
|
obj_desc));
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2016-11-30 15:21:12 +08:00
|
|
|
(void)acpi_ev_attach_region(handler_obj,
|
|
|
|
region_obj, FALSE);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2015-12-29 14:02:00 +08:00
|
|
|
/*
|
|
|
|
* Tell all users that this region is usable by
|
|
|
|
* running the _REG method
|
|
|
|
*/
|
2016-10-26 15:42:01 +08:00
|
|
|
acpi_ex_exit_interpreter();
|
2016-11-30 15:21:12 +08:00
|
|
|
(void)acpi_ev_execute_reg_method(region_obj,
|
|
|
|
ACPI_REG_CONNECT);
|
2016-10-26 15:42:01 +08:00
|
|
|
acpi_ex_enter_interpreter();
|
2015-12-29 14:02:00 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-12 16:01:56 +08:00
|
|
|
/* This node does not have the handler we need; Pop up one level */
|
|
|
|
|
2010-05-26 11:53:07 +08:00
|
|
|
node = node->parent;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2016-11-30 15:21:12 +08:00
|
|
|
/*
|
|
|
|
* If we get here, there is no handler for this region. This is not
|
|
|
|
* fatal because many regions get created before a handler is installed
|
|
|
|
* for said region.
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-22 05:15:00 +08:00
|
|
|
"No handler for RegionType %s(%X) (RegionObj %p)\n",
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_get_region_name(space_id), space_id,
|
|
|
|
region_obj));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2016-11-30 15:21:12 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|