acpi_status status;
struct acpi_table_header header;
- ACPI_FUNCTION_TRACE(tb_get_table);
+ ACPI_FUNCTION_TRACE("tb_get_table");
/* Get the header in order to get signature and table size */
acpi_status status = AE_OK;
struct acpi_table_header *header = NULL;
- ACPI_FUNCTION_TRACE(tb_get_table_header);
+ ACPI_FUNCTION_TRACE("tb_get_table_header");
/*
* Flags contains the current processor mode (Virtual or Physical
sizeof(struct acpi_table_header),
(void *)&header);
if (ACPI_FAILURE(status)) {
- ACPI_ERROR((AE_INFO,
- "Could not map memory at %8.8X%8.8X for table header",
- ACPI_FORMAT_UINT64(address->pointer.
- physical)));
return_ACPI_STATUS(status);
}
{
acpi_status status;
- ACPI_FUNCTION_TRACE(tb_get_table_body);
+ ACPI_FUNCTION_TRACE("tb_get_table_body");
if (!table_info || !address) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
status = acpi_tb_table_override(header, table_info);
if (ACPI_SUCCESS(status)) {
-
/* Table was overridden by the host OS */
return_ACPI_STATUS(status);
acpi_status status;
struct acpi_pointer address;
- ACPI_FUNCTION_TRACE(tb_table_override);
+ ACPI_FUNCTION_TRACE("tb_table_override");
/*
* The OSL will examine the header and decide whether to override this
*/
status = acpi_os_table_override(header, &new_table);
if (ACPI_FAILURE(status)) {
-
/* Some severe error from the OSL, but we basically ignore it */
ACPI_EXCEPTION((AE_INFO, status,
}
if (!new_table) {
-
/* No table override */
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
u8 allocation;
acpi_status status = AE_OK;
- ACPI_FUNCTION_TRACE(tb_get_this_table);
-
- /* Validate minimum length */
-
- if (header->length < sizeof(struct acpi_table_header)) {
- ACPI_ERROR((AE_INFO,
- "Table length (%X) is smaller than minimum (%X)",
- header->length, sizeof(struct acpi_table_header)));
-
- return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH);
- }
+ ACPI_FUNCTION_TRACE("tb_get_this_table");
/*
* Flags contains the current processor mode (Virtual or Physical
/* Pointer matches processor mode, copy the table to a new buffer */
- full_table = ACPI_ALLOCATE(header->length);
+ full_table = ACPI_MEM_ALLOCATE(header->length);
if (!full_table) {
ACPI_ERROR((AE_INFO,
"Could not allocate table memory for [%4.4s] length %X",
*/
status = acpi_os_map_memory(address->pointer.physical,
(acpi_size) header->length,
- ACPI_CAST_PTR(void, &full_table));
+ (void *)&full_table);
if (ACPI_FAILURE(status)) {
ACPI_ERROR((AE_INFO,
"Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X",
* Validate checksum for _most_ tables,
* even the ones whose signature we don't recognize
*/
- if (table_info->type != ACPI_TABLE_ID_FACS) {
+ if (table_info->type != ACPI_TABLE_FACS) {
status = acpi_tb_verify_table_checksum(full_table);
#if (!ACPI_CHECKSUM_ABORT)
if (ACPI_FAILURE(status)) {
-
/* Ignore the error if configuration says so */
status = AE_OK;
*
* PARAMETERS: table_type - one of the defined table types
* Instance - Which table of this type
- * return_table - pointer to location to place the pointer for
+ * table_ptr_loc - pointer to location to place the pointer for
* return
*
* RETURN: Status
acpi_status
acpi_tb_get_table_ptr(acpi_table_type table_type,
- u32 instance, struct acpi_table_header **return_table)
+ u32 instance, struct acpi_table_header **table_ptr_loc)
{
struct acpi_table_desc *table_desc;
u32 i;
- ACPI_FUNCTION_TRACE(tb_get_table_ptr);
+ ACPI_FUNCTION_TRACE("tb_get_table_ptr");
- if (table_type > ACPI_TABLE_ID_MAX) {
+ if (!acpi_gbl_DSDT) {
+ return_ACPI_STATUS(AE_NO_ACPI_TABLES);
+ }
+
+ if (table_type > ACPI_TABLE_MAX) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
- /* Check for instance out of range of the current table count */
+ /*
+ * For all table types (Single/Multiple), the first
+ * instance is always in the list head.
+ */
+ if (instance == 1) {
+ /* Get the first */
+
+ *table_ptr_loc = NULL;
+ if (acpi_gbl_table_lists[table_type].next) {
+ *table_ptr_loc =
+ acpi_gbl_table_lists[table_type].next->pointer;
+ }
+ return_ACPI_STATUS(AE_OK);
+ }
+
+ /* Check for instance out of range */
if (instance > acpi_gbl_table_lists[table_type].count) {
return_ACPI_STATUS(AE_NOT_EXIST);
}
- /*
- * Walk the list to get the desired table
- * Note: Instance is one-based
+ /* Walk the list to get the desired table
+ * Since the if (Instance == 1) check above checked for the
+ * first table, setting table_desc equal to the .Next member
+ * is actually pointing to the second table. Therefore, we
+ * need to walk from the 2nd table until we reach the Instance
+ * that the user is looking for and return its table pointer.
*/
table_desc = acpi_gbl_table_lists[table_type].next;
- for (i = 1; i < instance; i++) {
+ for (i = 2; i < instance; i++) {
table_desc = table_desc->next;
}
/* We are now pointing to the requested table's descriptor */
- *return_table = table_desc->pointer;
+ *table_ptr_loc = table_desc->pointer;
+
return_ACPI_STATUS(AE_OK);
}