2005-04-16 18:20:36 -04:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: tbconvrt - ACPI Table conversion utilities
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2006-01-13 16:22:00 -05:00
|
|
|
* Copyright (C) 2000 - 2006, R. Byron Moore
|
2005-04-16 18:20:36 -04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions, and the following disclaimer,
|
|
|
|
* without modification.
|
|
|
|
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
|
|
|
* substantially similar to the "NO WARRANTY" disclaimer below
|
|
|
|
* ("Disclaimer") and any redistribution must be conditioned upon
|
|
|
|
* including a substantially similar Disclaimer requirement for further
|
|
|
|
* binary redistribution.
|
|
|
|
* 3. Neither the names of the above-listed copyright holders nor the names
|
|
|
|
* of any contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* Alternatively, this software may be distributed under the terms of the
|
|
|
|
* GNU General Public License ("GPL") version 2 as published by the Free
|
|
|
|
* Software Foundation.
|
|
|
|
*
|
|
|
|
* NO WARRANTY
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGES.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
|
|
|
|
#include <acpi/acpi.h>
|
|
|
|
#include <acpi/actables.h>
|
|
|
|
|
|
|
|
#define _COMPONENT ACPI_TABLES
|
2005-08-05 00:44:28 -04:00
|
|
|
ACPI_MODULE_NAME("tbconvrt")
|
2005-04-16 18:20:36 -04:00
|
|
|
|
2005-04-18 22:49:35 -04:00
|
|
|
/* Local prototypes */
|
|
|
|
static void
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct,
|
|
|
|
u8 register_bit_width,
|
|
|
|
acpi_physical_address address);
|
2005-04-18 22:49:35 -04:00
|
|
|
|
|
|
|
static void
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt,
|
|
|
|
struct fadt_descriptor_rev1 *original_fadt);
|
2005-04-18 22:49:35 -04:00
|
|
|
|
|
|
|
static void
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt,
|
|
|
|
struct fadt_descriptor_rev2 *original_fadt);
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
u8 acpi_fadt_is_v1;
|
|
|
|
EXPORT_SYMBOL(acpi_fadt_is_v1);
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_tb_get_table_count
|
|
|
|
*
|
|
|
|
* PARAMETERS: RSDP - Pointer to the RSDP
|
|
|
|
* RSDT - Pointer to the RSDT/XSDT
|
|
|
|
*
|
|
|
|
* RETURN: The number of tables pointed to by the RSDT or XSDT.
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Calculate the number of tables. Automatically handles either
|
|
|
|
* an RSDT or XSDT.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
u32
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_get_table_count(struct rsdp_descriptor *RSDP,
|
|
|
|
struct acpi_table_header *RSDT)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
2005-08-05 00:44:28 -04:00
|
|
|
u32 pointer_size;
|
2005-04-16 18:20:36 -04:00
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
ACPI_FUNCTION_ENTRY();
|
2005-04-16 18:20:36 -04:00
|
|
|
|
ACPICA 20050617-0624 from Bob Moore <robert.moore@intel.com>
ACPICA 20050617:
Moved the object cache operations into the OS interface
layer (OSL) to allow the host OS to handle these operations
if desired (for example, the Linux OSL will invoke the
slab allocator). This support is optional; the compile
time define ACPI_USE_LOCAL_CACHE may be used to utilize
the original cache code in the ACPI CA core. The new OSL
interfaces are shown below. See utalloc.c for an example
implementation, and acpiosxf.h for the exact interface
definitions. Thanks to Alexey Starikovskiy.
acpi_os_create_cache
acpi_os_delete_cache
acpi_os_purge_cache
acpi_os_acquire_object
acpi_os_release_object
Modified the interfaces to acpi_os_acquire_lock and
acpi_os_release_lock to return and restore a flags
parameter. This fits better with many OS lock models.
Note: the current execution state (interrupt handler
or not) is no longer passed to these interfaces. If
necessary, the OSL must determine this state by itself, a
simple and fast operation. Thanks to Alexey Starikovskiy.
Fixed a problem in the ACPI table handling where a valid
XSDT was assumed present if the revision of the RSDP
was 2 or greater. According to the ACPI specification,
the XSDT is optional in all cases, and the table manager
therefore now checks for both an RSDP >=2 and a valid
XSDT pointer. Otherwise, the RSDT pointer is used.
Some ACPI 2.0 compliant BIOSs contain only the RSDT.
Fixed an interpreter problem with the Mid() operator in the
case of an input string where the resulting output string
is of zero length. It now correctly returns a valid,
null terminated string object instead of a string object
with a null pointer.
Fixed a problem with the control method argument handling
to allow a store to an Arg object that already contains an
object of type Device. The Device object is now correctly
overwritten. Previously, an error was returned.
ACPICA 20050624:
Modified the new OSL cache interfaces to use ACPI_CACHE_T
as the type for the host-defined cache object. This allows
the OSL implementation to define and type this object in
any manner desired, simplifying the OSL implementation.
For example, ACPI_CACHE_T is defined as kmem_cache_t for
Linux, and should be defined in the OS-specific header
file for other operating systems as required.
Changed the interface to AcpiOsAcquireObject to directly
return the requested object as the function return (instead
of ACPI_STATUS.) This change was made for performance
reasons, since this is the purpose of the interface in the
first place. acpi_os_acquire_object is now similar to the
acpi_os_allocate interface. Thanks to Alexey Starikovskiy.
Modified the initialization sequence in
acpi_initialize_subsystem to call the OSL interface
acpi_osl_initialize first, before any local initialization.
This change was required because the global initialization
now calls OSL interfaces.
Restructured the code base to split some files because
of size and/or because the code logically belonged in a
separate file. New files are listed below.
utilities/utcache.c /* Local cache interfaces */
utilities/utmutex.c /* Local mutex support */
utilities/utstate.c /* State object support */
parser/psloop.c /* Main AML parse loop */
Signed-off-by: Len Brown <len.brown@intel.com>
2005-06-24 00:00:00 -04:00
|
|
|
/* RSDT pointers are 32 bits, XSDT pointers are 64 bits */
|
|
|
|
|
|
|
|
if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
|
2005-08-05 00:44:28 -04:00
|
|
|
pointer_size = sizeof(u32);
|
|
|
|
} else {
|
|
|
|
pointer_size = sizeof(u64);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Determine the number of tables pointed to by the RSDT/XSDT.
|
|
|
|
* This is defined by the ACPI Specification to be the number of
|
|
|
|
* pointers contained within the RSDT/XSDT. The size of the pointers
|
|
|
|
* is architecture-dependent.
|
|
|
|
*/
|
2005-08-05 00:44:28 -04:00
|
|
|
return ((RSDT->length -
|
|
|
|
sizeof(struct acpi_table_header)) / pointer_size);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_tb_convert_to_xsdt
|
|
|
|
*
|
|
|
|
* PARAMETERS: table_info - Info about the RSDT
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Convert an RSDT to an XSDT (internal common format)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_size table_size;
|
|
|
|
u32 i;
|
|
|
|
XSDT_DESCRIPTOR *new_table;
|
2005-04-16 18:20:36 -04:00
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
ACPI_FUNCTION_ENTRY();
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
/* Compute size of the converted XSDT */
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
table_size = ((acpi_size) acpi_gbl_rsdt_table_count * sizeof(u64)) +
|
|
|
|
sizeof(struct acpi_table_header);
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
/* Allocate an XSDT */
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
new_table = ACPI_MEM_CALLOCATE(table_size);
|
2005-04-16 18:20:36 -04:00
|
|
|
if (!new_table) {
|
|
|
|
return (AE_NO_MEMORY);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy the header and set the length */
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
ACPI_MEMCPY(new_table, table_info->pointer,
|
|
|
|
sizeof(struct acpi_table_header));
|
2005-04-16 18:20:36 -04:00
|
|
|
new_table->length = (u32) table_size;
|
|
|
|
|
|
|
|
/* Copy the table pointers */
|
|
|
|
|
|
|
|
for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
|
ACPICA 20050617-0624 from Bob Moore <robert.moore@intel.com>
ACPICA 20050617:
Moved the object cache operations into the OS interface
layer (OSL) to allow the host OS to handle these operations
if desired (for example, the Linux OSL will invoke the
slab allocator). This support is optional; the compile
time define ACPI_USE_LOCAL_CACHE may be used to utilize
the original cache code in the ACPI CA core. The new OSL
interfaces are shown below. See utalloc.c for an example
implementation, and acpiosxf.h for the exact interface
definitions. Thanks to Alexey Starikovskiy.
acpi_os_create_cache
acpi_os_delete_cache
acpi_os_purge_cache
acpi_os_acquire_object
acpi_os_release_object
Modified the interfaces to acpi_os_acquire_lock and
acpi_os_release_lock to return and restore a flags
parameter. This fits better with many OS lock models.
Note: the current execution state (interrupt handler
or not) is no longer passed to these interfaces. If
necessary, the OSL must determine this state by itself, a
simple and fast operation. Thanks to Alexey Starikovskiy.
Fixed a problem in the ACPI table handling where a valid
XSDT was assumed present if the revision of the RSDP
was 2 or greater. According to the ACPI specification,
the XSDT is optional in all cases, and the table manager
therefore now checks for both an RSDP >=2 and a valid
XSDT pointer. Otherwise, the RSDT pointer is used.
Some ACPI 2.0 compliant BIOSs contain only the RSDT.
Fixed an interpreter problem with the Mid() operator in the
case of an input string where the resulting output string
is of zero length. It now correctly returns a valid,
null terminated string object instead of a string object
with a null pointer.
Fixed a problem with the control method argument handling
to allow a store to an Arg object that already contains an
object of type Device. The Device object is now correctly
overwritten. Previously, an error was returned.
ACPICA 20050624:
Modified the new OSL cache interfaces to use ACPI_CACHE_T
as the type for the host-defined cache object. This allows
the OSL implementation to define and type this object in
any manner desired, simplifying the OSL implementation.
For example, ACPI_CACHE_T is defined as kmem_cache_t for
Linux, and should be defined in the OS-specific header
file for other operating systems as required.
Changed the interface to AcpiOsAcquireObject to directly
return the requested object as the function return (instead
of ACPI_STATUS.) This change was made for performance
reasons, since this is the purpose of the interface in the
first place. acpi_os_acquire_object is now similar to the
acpi_os_allocate interface. Thanks to Alexey Starikovskiy.
Modified the initialization sequence in
acpi_initialize_subsystem to call the OSL interface
acpi_osl_initialize first, before any local initialization.
This change was required because the global initialization
now calls OSL interfaces.
Restructured the code base to split some files because
of size and/or because the code logically belonged in a
separate file. New files are listed below.
utilities/utcache.c /* Local cache interfaces */
utilities/utmutex.c /* Local mutex support */
utilities/utstate.c /* State object support */
parser/psloop.c /* Main AML parse loop */
Signed-off-by: Len Brown <len.brown@intel.com>
2005-06-24 00:00:00 -04:00
|
|
|
/* RSDT pointers are 32 bits, XSDT pointers are 64 bits */
|
|
|
|
|
|
|
|
if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
|
2005-08-05 00:44:28 -04:00
|
|
|
ACPI_STORE_ADDRESS(new_table->table_offset_entry[i],
|
|
|
|
(ACPI_CAST_PTR
|
|
|
|
(struct rsdt_descriptor_rev1,
|
|
|
|
table_info->pointer))->
|
|
|
|
table_offset_entry[i]);
|
|
|
|
} else {
|
2005-04-16 18:20:36 -04:00
|
|
|
new_table->table_offset_entry[i] =
|
2005-08-05 00:44:28 -04:00
|
|
|
(ACPI_CAST_PTR(XSDT_DESCRIPTOR,
|
|
|
|
table_info->pointer))->
|
|
|
|
table_offset_entry[i];
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Delete the original table (either mapped or in a buffer) */
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_delete_single_table(table_info);
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
/* Point the table descriptor to the new table */
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
table_info->pointer =
|
|
|
|
ACPI_CAST_PTR(struct acpi_table_header, new_table);
|
|
|
|
table_info->length = table_size;
|
|
|
|
table_info->allocation = ACPI_MEM_ALLOCATED;
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
return (AE_OK);
|
|
|
|
}
|
|
|
|
|
2005-04-18 22:49:35 -04:00
|
|
|
/*******************************************************************************
|
2005-04-16 18:20:36 -04:00
|
|
|
*
|
|
|
|
* FUNCTION: acpi_tb_init_generic_address
|
|
|
|
*
|
|
|
|
* PARAMETERS: new_gas_struct - GAS struct to be initialized
|
|
|
|
* register_bit_width - Width of this register
|
|
|
|
* Address - Address of the register
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Initialize a GAS structure.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
static void
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct,
|
|
|
|
u8 register_bit_width,
|
|
|
|
acpi_physical_address address)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
ACPI_STORE_ADDRESS(new_gas_struct->address, address);
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
new_gas_struct->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO;
|
|
|
|
new_gas_struct->register_bit_width = register_bit_width;
|
|
|
|
new_gas_struct->register_bit_offset = 0;
|
2005-08-05 00:44:28 -04:00
|
|
|
new_gas_struct->access_width = 0;
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_tb_convert_fadt1
|
|
|
|
*
|
|
|
|
* PARAMETERS: local_fadt - Pointer to new FADT
|
|
|
|
* original_fadt - Pointer to old FADT
|
|
|
|
*
|
2005-04-18 22:49:35 -04:00
|
|
|
* RETURN: None, populates local_fadt
|
2005-04-16 18:20:36 -04:00
|
|
|
*
|
|
|
|
* DESCRIPTION: Convert an ACPI 1.0 FADT to common internal format
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
static void
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt,
|
|
|
|
struct fadt_descriptor_rev1 *original_fadt)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
/* ACPI 1.0 FACS */
|
|
|
|
/* The BIOS stored FADT should agree with Revision 1.0 */
|
|
|
|
acpi_fadt_is_v1 = 1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copy the table header and the common part of the tables.
|
|
|
|
*
|
|
|
|
* The 2.0 table is an extension of the 1.0 table, so the entire 1.0
|
|
|
|
* table can be copied first, then expand some fields to 64 bits.
|
|
|
|
*/
|
2005-08-05 00:44:28 -04:00
|
|
|
ACPI_MEMCPY(local_fadt, original_fadt,
|
|
|
|
sizeof(struct fadt_descriptor_rev1));
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
/* Convert table pointers to 64-bit fields */
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
ACPI_STORE_ADDRESS(local_fadt->xfirmware_ctrl,
|
|
|
|
local_fadt->V1_firmware_ctrl);
|
|
|
|
ACPI_STORE_ADDRESS(local_fadt->Xdsdt, local_fadt->V1_dsdt);
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
/*
|
2005-04-18 22:49:35 -04:00
|
|
|
* System Interrupt Model isn't used in ACPI 2.0
|
|
|
|
* (local_fadt->Reserved1 = 0;)
|
2005-04-16 18:20:36 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This field is set by the OEM to convey the preferred power management
|
|
|
|
* profile to OSPM. It doesn't have any 1.0 equivalence. Since we don't
|
|
|
|
* know what kind of 32-bit system this is, we will use "unspecified".
|
|
|
|
*/
|
|
|
|
local_fadt->prefer_PM_profile = PM_UNSPECIFIED;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Processor Performance State Control. This is the value OSPM writes to
|
|
|
|
* the SMI_CMD register to assume processor performance state control
|
|
|
|
* responsibility. There isn't any equivalence in 1.0, but as many 1.x
|
|
|
|
* ACPI tables contain _PCT and _PSS we also keep this value, unless
|
|
|
|
* acpi_strict is set.
|
|
|
|
*/
|
|
|
|
if (acpi_strict)
|
|
|
|
local_fadt->pstate_cnt = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Support for the _CST object and C States change notification.
|
|
|
|
* This data item hasn't any 1.0 equivalence so leave it zero.
|
|
|
|
*/
|
|
|
|
local_fadt->cst_cnt = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FADT Rev 2 was an interim FADT released between ACPI 1.0 and ACPI 2.0.
|
|
|
|
* It primarily adds the FADT reset mechanism.
|
|
|
|
*/
|
|
|
|
if ((original_fadt->revision == 2) &&
|
2005-08-05 00:44:28 -04:00
|
|
|
(original_fadt->length ==
|
|
|
|
sizeof(struct fadt_descriptor_rev2_minus))) {
|
2005-04-16 18:20:36 -04:00
|
|
|
/*
|
|
|
|
* Grab the entire generic address struct, plus the 1-byte reset value
|
|
|
|
* that immediately follows.
|
|
|
|
*/
|
2005-08-05 00:44:28 -04:00
|
|
|
ACPI_MEMCPY(&local_fadt->reset_register,
|
|
|
|
&(ACPI_CAST_PTR(struct fadt_descriptor_rev2_minus,
|
|
|
|
original_fadt))->reset_register,
|
|
|
|
sizeof(struct acpi_generic_address) + 1);
|
|
|
|
} else {
|
2005-04-16 18:20:36 -04:00
|
|
|
/*
|
|
|
|
* Since there isn't any equivalence in 1.0 and since it is highly
|
|
|
|
* likely that a 1.0 system has legacy support.
|
|
|
|
*/
|
|
|
|
local_fadt->iapc_boot_arch = BAF_LEGACY_DEVICES;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Convert the V1.0 block addresses to V2.0 GAS structures
|
|
|
|
*/
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_init_generic_address(&local_fadt->xpm1a_evt_blk,
|
|
|
|
local_fadt->pm1_evt_len,
|
|
|
|
(acpi_physical_address) local_fadt->
|
|
|
|
V1_pm1a_evt_blk);
|
|
|
|
acpi_tb_init_generic_address(&local_fadt->xpm1b_evt_blk,
|
|
|
|
local_fadt->pm1_evt_len,
|
|
|
|
(acpi_physical_address) local_fadt->
|
|
|
|
V1_pm1b_evt_blk);
|
|
|
|
acpi_tb_init_generic_address(&local_fadt->xpm1a_cnt_blk,
|
|
|
|
local_fadt->pm1_cnt_len,
|
|
|
|
(acpi_physical_address) local_fadt->
|
|
|
|
V1_pm1a_cnt_blk);
|
|
|
|
acpi_tb_init_generic_address(&local_fadt->xpm1b_cnt_blk,
|
|
|
|
local_fadt->pm1_cnt_len,
|
|
|
|
(acpi_physical_address) local_fadt->
|
|
|
|
V1_pm1b_cnt_blk);
|
|
|
|
acpi_tb_init_generic_address(&local_fadt->xpm2_cnt_blk,
|
|
|
|
local_fadt->pm2_cnt_len,
|
|
|
|
(acpi_physical_address) local_fadt->
|
|
|
|
V1_pm2_cnt_blk);
|
|
|
|
acpi_tb_init_generic_address(&local_fadt->xpm_tmr_blk,
|
|
|
|
local_fadt->pm_tm_len,
|
|
|
|
(acpi_physical_address) local_fadt->
|
|
|
|
V1_pm_tmr_blk);
|
|
|
|
acpi_tb_init_generic_address(&local_fadt->xgpe0_blk, 0,
|
|
|
|
(acpi_physical_address) local_fadt->
|
|
|
|
V1_gpe0_blk);
|
|
|
|
acpi_tb_init_generic_address(&local_fadt->xgpe1_blk, 0,
|
|
|
|
(acpi_physical_address) local_fadt->
|
|
|
|
V1_gpe1_blk);
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
/* Create separate GAS structs for the PM1 Enable registers */
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable,
|
|
|
|
(u8) ACPI_DIV_2(acpi_gbl_FADT->
|
|
|
|
pm1_evt_len),
|
|
|
|
(acpi_physical_address)
|
|
|
|
(local_fadt->xpm1a_evt_blk.address +
|
|
|
|
ACPI_DIV_2(acpi_gbl_FADT->pm1_evt_len)));
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
/* PM1B is optional; leave null if not present */
|
|
|
|
|
|
|
|
if (local_fadt->xpm1b_evt_blk.address) {
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable,
|
|
|
|
(u8) ACPI_DIV_2(acpi_gbl_FADT->
|
|
|
|
pm1_evt_len),
|
|
|
|
(acpi_physical_address)
|
|
|
|
(local_fadt->xpm1b_evt_blk.
|
|
|
|
address +
|
|
|
|
ACPI_DIV_2(acpi_gbl_FADT->
|
|
|
|
pm1_evt_len)));
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_tb_convert_fadt2
|
|
|
|
*
|
|
|
|
* PARAMETERS: local_fadt - Pointer to new FADT
|
|
|
|
* original_fadt - Pointer to old FADT
|
|
|
|
*
|
2005-04-18 22:49:35 -04:00
|
|
|
* RETURN: None, populates local_fadt
|
2005-04-16 18:20:36 -04:00
|
|
|
*
|
|
|
|
* DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format.
|
|
|
|
* Handles optional "X" fields.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
static void
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt,
|
|
|
|
struct fadt_descriptor_rev2 *original_fadt)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
/* We have an ACPI 2.0 FADT but we must copy it to our local buffer */
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
ACPI_MEMCPY(local_fadt, original_fadt,
|
|
|
|
sizeof(struct fadt_descriptor_rev2));
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* "X" fields are optional extensions to the original V1.0 fields, so
|
|
|
|
* we must selectively expand V1.0 fields if the corresponding X field
|
|
|
|
* is zero.
|
|
|
|
*/
|
|
|
|
if (!(local_fadt->xfirmware_ctrl)) {
|
2005-08-05 00:44:28 -04:00
|
|
|
ACPI_STORE_ADDRESS(local_fadt->xfirmware_ctrl,
|
|
|
|
local_fadt->V1_firmware_ctrl);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(local_fadt->Xdsdt)) {
|
2005-08-05 00:44:28 -04:00
|
|
|
ACPI_STORE_ADDRESS(local_fadt->Xdsdt, local_fadt->V1_dsdt);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(local_fadt->xpm1a_evt_blk.address)) {
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_init_generic_address(&local_fadt->xpm1a_evt_blk,
|
|
|
|
local_fadt->pm1_evt_len,
|
|
|
|
(acpi_physical_address)
|
|
|
|
local_fadt->V1_pm1a_evt_blk);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(local_fadt->xpm1b_evt_blk.address)) {
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_init_generic_address(&local_fadt->xpm1b_evt_blk,
|
|
|
|
local_fadt->pm1_evt_len,
|
|
|
|
(acpi_physical_address)
|
|
|
|
local_fadt->V1_pm1b_evt_blk);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(local_fadt->xpm1a_cnt_blk.address)) {
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_init_generic_address(&local_fadt->xpm1a_cnt_blk,
|
|
|
|
local_fadt->pm1_cnt_len,
|
|
|
|
(acpi_physical_address)
|
|
|
|
local_fadt->V1_pm1a_cnt_blk);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(local_fadt->xpm1b_cnt_blk.address)) {
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_init_generic_address(&local_fadt->xpm1b_cnt_blk,
|
|
|
|
local_fadt->pm1_cnt_len,
|
|
|
|
(acpi_physical_address)
|
|
|
|
local_fadt->V1_pm1b_cnt_blk);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(local_fadt->xpm2_cnt_blk.address)) {
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_init_generic_address(&local_fadt->xpm2_cnt_blk,
|
|
|
|
local_fadt->pm2_cnt_len,
|
|
|
|
(acpi_physical_address)
|
|
|
|
local_fadt->V1_pm2_cnt_blk);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(local_fadt->xpm_tmr_blk.address)) {
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_init_generic_address(&local_fadt->xpm_tmr_blk,
|
|
|
|
local_fadt->pm_tm_len,
|
|
|
|
(acpi_physical_address)
|
|
|
|
local_fadt->V1_pm_tmr_blk);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(local_fadt->xgpe0_blk.address)) {
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_init_generic_address(&local_fadt->xgpe0_blk,
|
|
|
|
0,
|
|
|
|
(acpi_physical_address)
|
|
|
|
local_fadt->V1_gpe0_blk);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(local_fadt->xgpe1_blk.address)) {
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_init_generic_address(&local_fadt->xgpe1_blk,
|
|
|
|
0,
|
|
|
|
(acpi_physical_address)
|
|
|
|
local_fadt->V1_gpe1_blk);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Create separate GAS structs for the PM1 Enable registers */
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable,
|
|
|
|
(u8) ACPI_DIV_2(acpi_gbl_FADT->
|
|
|
|
pm1_evt_len),
|
|
|
|
(acpi_physical_address)
|
|
|
|
(local_fadt->xpm1a_evt_blk.address +
|
|
|
|
ACPI_DIV_2(acpi_gbl_FADT->pm1_evt_len)));
|
2005-04-18 22:49:35 -04:00
|
|
|
|
|
|
|
acpi_gbl_xpm1a_enable.address_space_id =
|
2005-08-05 00:44:28 -04:00
|
|
|
local_fadt->xpm1a_evt_blk.address_space_id;
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
/* PM1B is optional; leave null if not present */
|
|
|
|
|
|
|
|
if (local_fadt->xpm1b_evt_blk.address) {
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable,
|
|
|
|
(u8) ACPI_DIV_2(acpi_gbl_FADT->
|
|
|
|
pm1_evt_len),
|
|
|
|
(acpi_physical_address)
|
|
|
|
(local_fadt->xpm1b_evt_blk.
|
|
|
|
address +
|
|
|
|
ACPI_DIV_2(acpi_gbl_FADT->
|
|
|
|
pm1_evt_len)));
|
2005-04-18 22:49:35 -04:00
|
|
|
|
|
|
|
acpi_gbl_xpm1b_enable.address_space_id =
|
2005-08-05 00:44:28 -04:00
|
|
|
local_fadt->xpm1b_evt_blk.address_space_id;
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_tb_convert_table_fadt
|
|
|
|
*
|
|
|
|
* PARAMETERS: None
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Converts a BIOS supplied ACPI 1.0 FADT to a local
|
|
|
|
* ACPI 2.0 FADT. If the BIOS supplied a 2.0 FADT then it is simply
|
|
|
|
* copied to the local FADT. The ACPI CA software uses this
|
|
|
|
* local FADT. Thus a significant amount of special #ifdef
|
|
|
|
* type codeing is saved.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_status acpi_tb_convert_table_fadt(void)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
2005-08-05 00:44:28 -04:00
|
|
|
struct fadt_descriptor_rev2 *local_fadt;
|
|
|
|
struct acpi_table_desc *table_desc;
|
2005-04-16 18:20:36 -04:00
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
ACPI_FUNCTION_TRACE("tb_convert_table_fadt");
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* acpi_gbl_FADT is valid. Validate the FADT length. The table must be
|
|
|
|
* at least as long as the version 1.0 FADT
|
|
|
|
*/
|
2005-08-05 00:44:28 -04:00
|
|
|
if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev1)) {
|
2006-01-27 16:43:00 -05:00
|
|
|
ACPI_ERROR((AE_INFO, "FADT is invalid, too short: 0x%X",
|
|
|
|
acpi_gbl_FADT->length));
|
2005-08-05 00:44:28 -04:00
|
|
|
return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate buffer for the ACPI 2.0(+) FADT */
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
local_fadt = ACPI_MEM_CALLOCATE(sizeof(struct fadt_descriptor_rev2));
|
2005-04-16 18:20:36 -04:00
|
|
|
if (!local_fadt) {
|
2005-08-05 00:44:28 -04:00
|
|
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) {
|
2005-08-05 00:44:28 -04:00
|
|
|
if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) {
|
2005-04-16 18:20:36 -04:00
|
|
|
/* Length is too short to be a V2.0 table */
|
|
|
|
|
2006-01-27 16:43:00 -05:00
|
|
|
ACPI_WARNING((AE_INFO,
|
|
|
|
"Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table",
|
|
|
|
acpi_gbl_FADT->length,
|
|
|
|
acpi_gbl_FADT->revision));
|
2005-04-16 18:20:36 -04:00
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_convert_fadt1(local_fadt,
|
|
|
|
(void *)acpi_gbl_FADT);
|
|
|
|
} else {
|
2005-04-16 18:20:36 -04:00
|
|
|
/* Valid V2.0 table */
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_convert_fadt2(local_fadt, acpi_gbl_FADT);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
2005-08-05 00:44:28 -04:00
|
|
|
} else {
|
2005-04-16 18:20:36 -04:00
|
|
|
/* Valid V1.0 table */
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_convert_fadt1(local_fadt, (void *)acpi_gbl_FADT);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
2005-04-18 22:49:35 -04:00
|
|
|
/* Global FADT pointer will point to the new common V2.0 FADT */
|
|
|
|
|
2005-04-16 18:20:36 -04:00
|
|
|
acpi_gbl_FADT = local_fadt;
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_gbl_FADT->length = sizeof(FADT_DESCRIPTOR);
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
/* Free the original table */
|
|
|
|
|
|
|
|
table_desc = acpi_gbl_table_lists[ACPI_TABLE_FADT].next;
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_tb_delete_single_table(table_desc);
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
/* Install the new table */
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
table_desc->pointer =
|
|
|
|
ACPI_CAST_PTR(struct acpi_table_header, acpi_gbl_FADT);
|
|
|
|
table_desc->allocation = ACPI_MEM_ALLOCATED;
|
|
|
|
table_desc->length = sizeof(struct fadt_descriptor_rev2);
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
/* Dump the entire FADT */
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
|
|
|
|
"Hex dump of common internal FADT, size %d (%X)\n",
|
|
|
|
acpi_gbl_FADT->length, acpi_gbl_FADT->length));
|
2005-11-17 13:07:00 -05:00
|
|
|
|
|
|
|
ACPI_DUMP_BUFFER(ACPI_CAST_PTR(u8, acpi_gbl_FADT),
|
|
|
|
acpi_gbl_FADT->length);
|
2005-04-16 18:20:36 -04:00
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
2005-04-18 22:49:35 -04:00
|
|
|
* FUNCTION: acpi_tb_build_common_facs
|
2005-04-16 18:20:36 -04:00
|
|
|
*
|
|
|
|
* PARAMETERS: table_info - Info for currently installed FACS
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Convert ACPI 1.0 and ACPI 2.0 FACS to a common internal
|
|
|
|
* table format.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info)
|
2005-04-16 18:20:36 -04:00
|
|
|
{
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
ACPI_FUNCTION_TRACE("tb_build_common_facs");
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
/* Absolute minimum length is 24, but the ACPI spec says 64 */
|
|
|
|
|
|
|
|
if (acpi_gbl_FACS->length < 24) {
|
2006-01-27 16:43:00 -05:00
|
|
|
ACPI_ERROR((AE_INFO, "Invalid FACS table length: 0x%X",
|
|
|
|
acpi_gbl_FACS->length));
|
2005-08-05 00:44:28 -04:00
|
|
|
return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (acpi_gbl_FACS->length < 64) {
|
2006-01-27 16:43:00 -05:00
|
|
|
ACPI_WARNING((AE_INFO,
|
|
|
|
"FACS is shorter than the ACPI specification allows: 0x%X, using anyway",
|
|
|
|
acpi_gbl_FACS->length));
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy fields to the new FACS */
|
|
|
|
|
|
|
|
acpi_gbl_common_fACS.global_lock = &(acpi_gbl_FACS->global_lock);
|
|
|
|
|
|
|
|
if ((acpi_gbl_RSDP->revision < 2) ||
|
2005-08-05 00:44:28 -04:00
|
|
|
(acpi_gbl_FACS->length < 32) ||
|
|
|
|
(!(acpi_gbl_FACS->xfirmware_waking_vector))) {
|
2005-04-16 18:20:36 -04:00
|
|
|
/* ACPI 1.0 FACS or short table or optional X_ field is zero */
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64,
|
|
|
|
&
|
|
|
|
(acpi_gbl_FACS->
|
|
|
|
firmware_waking_vector));
|
2005-04-16 18:20:36 -04:00
|
|
|
acpi_gbl_common_fACS.vector_width = 32;
|
2005-08-05 00:44:28 -04:00
|
|
|
} else {
|
2005-04-16 18:20:36 -04:00
|
|
|
/* ACPI 2.0 FACS with valid X_ field */
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
acpi_gbl_common_fACS.firmware_waking_vector =
|
|
|
|
&acpi_gbl_FACS->xfirmware_waking_vector;
|
2005-04-16 18:20:36 -04:00
|
|
|
acpi_gbl_common_fACS.vector_width = 64;
|
|
|
|
}
|
|
|
|
|
2005-08-05 00:44:28 -04:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-16 18:20:36 -04:00
|
|
|
}
|