mirror of
https://github.com/acpica/acpica/
synced 2025-01-09 02:52:45 +03:00
iASL: Fix for WPBT table with no command-line arguments
Handle the case where the Command-line Arguments table field does not exist.
This commit is contained in:
parent
c4ddc96f99
commit
d648716449
@ -1143,6 +1143,12 @@ AcpiDmDumpTable (
|
||||
ByteLength = 128;
|
||||
break;
|
||||
|
||||
case ACPI_DMT_WPBT_UNICODE:
|
||||
|
||||
ByteLength = SubtableLength;
|
||||
CurrentOffset = sizeof (ACPI_TABLE_WPBT);
|
||||
break;
|
||||
|
||||
case ACPI_DMT_UNICODE:
|
||||
case ACPI_DMT_BUFFER:
|
||||
case ACPI_DMT_RAW_BUFFER:
|
||||
@ -1844,6 +1850,7 @@ AcpiDmDumpTable (
|
||||
break;
|
||||
|
||||
case ACPI_DMT_UNICODE:
|
||||
case ACPI_DMT_WPBT_UNICODE:
|
||||
|
||||
if (ByteLength == 0)
|
||||
{
|
||||
|
@ -833,13 +833,12 @@ AcpiDmDumpWpbt (
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_TABLE_WPBT *Subtable;
|
||||
UINT32 Length = Table->Length;
|
||||
UINT16 ArgumentsLength;
|
||||
|
||||
|
||||
/* Dump the main table */
|
||||
|
||||
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
|
||||
Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWpbt);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return;
|
||||
@ -850,8 +849,11 @@ AcpiDmDumpWpbt (
|
||||
Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
|
||||
ArgumentsLength = Subtable->ArgumentsLength;
|
||||
|
||||
/* Dump the arguments buffer */
|
||||
/* Dump the arguments buffer if present */
|
||||
|
||||
(void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
|
||||
AcpiDmTableInfoWpbt0);
|
||||
if (ArgumentsLength)
|
||||
{
|
||||
(void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
|
||||
AcpiDmTableInfoWpbt0);
|
||||
}
|
||||
}
|
||||
|
@ -759,7 +759,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt[] =
|
||||
|
||||
ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt0[] =
|
||||
{
|
||||
{ACPI_DMT_UNICODE, sizeof (ACPI_TABLE_WPBT), "Command-line Arguments", 0},
|
||||
{ACPI_DMT_WPBT_UNICODE, ACPI_WPBT2_OFFSET (UnicodeString), "Command-line Arguments", DT_DESCRIBES_OPTIONAL},
|
||||
ACPI_DMT_TERMINATOR
|
||||
};
|
||||
|
||||
|
@ -2678,13 +2678,11 @@ DtCompileWpbt (
|
||||
DT_SUBTABLE *ParentTable;
|
||||
ACPI_TABLE_WPBT *Table;
|
||||
ACPI_STATUS Status;
|
||||
UINT16 Length;
|
||||
|
||||
|
||||
/* Compile the main table */
|
||||
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt,
|
||||
&Subtable);
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt, &Subtable);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
@ -2692,11 +2690,23 @@ DtCompileWpbt (
|
||||
|
||||
ParentTable = DtPeekSubtable ();
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer);
|
||||
|
||||
/*
|
||||
* Exit now if there are no arguments specified. This is indicated by:
|
||||
* The "Command-line Arguments" field has not been specified (if specified,
|
||||
* it will be the last field in the field list -- after the main table).
|
||||
* Set the Argument Length in the main table to zero.
|
||||
*/
|
||||
if (!*PFieldList)
|
||||
{
|
||||
Table->ArgumentsLength = 0;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
/* Compile the argument list subtable */
|
||||
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt0,
|
||||
&Subtable);
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt0, &Subtable);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
@ -2704,11 +2714,7 @@ DtCompileWpbt (
|
||||
|
||||
/* Extract the length of the Arguments buffer, insert into main table */
|
||||
|
||||
Length = (UINT16) Subtable->TotalLength;
|
||||
Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer);
|
||||
Table->ArgumentsLength = Length;
|
||||
|
||||
ParentTable = DtPeekSubtable ();
|
||||
Table->ArgumentsLength = (UINT16) Subtable->TotalLength;
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
return (AE_OK);
|
||||
}
|
||||
|
@ -452,6 +452,7 @@ DtGetFieldType (
|
||||
break;
|
||||
|
||||
case ACPI_DMT_UNICODE:
|
||||
case ACPI_DMT_WPBT_UNICODE:
|
||||
|
||||
Type = DT_FIELD_TYPE_UNICODE;
|
||||
break;
|
||||
@ -740,12 +741,13 @@ DtGetFieldLength (
|
||||
break;
|
||||
|
||||
case ACPI_DMT_UNICODE:
|
||||
case ACPI_DMT_WPBT_UNICODE:
|
||||
|
||||
Value = DtGetFieldValue (Field);
|
||||
|
||||
/* TBD: error if Value is NULL? (as below?) */
|
||||
|
||||
ByteLength = (strlen (Value) + 1) * sizeof(UINT16);
|
||||
ByteLength = (strlen (Value) + 1) * sizeof (UINT16);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -289,6 +289,7 @@ typedef enum
|
||||
ACPI_DMT_SRAT,
|
||||
ACPI_DMT_TPM2,
|
||||
ACPI_DMT_VIOT,
|
||||
ACPI_DMT_WPBT_UNICODE,
|
||||
|
||||
/* Special opcodes */
|
||||
|
||||
|
@ -205,6 +205,7 @@
|
||||
#define ACPI_WDDT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDDT,f)
|
||||
#define ACPI_WDRT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDRT,f)
|
||||
#define ACPI_WPBT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WPBT,f)
|
||||
#define ACPI_WPBT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WPBT_UNICODE,f)
|
||||
#define ACPI_WSMT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WSMT,f)
|
||||
#define ACPI_XENV_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_XENV,f)
|
||||
|
||||
|
@ -955,6 +955,12 @@ typedef struct acpi_table_wpbt
|
||||
|
||||
} ACPI_TABLE_WPBT;
|
||||
|
||||
typedef struct acpi_wpbt_unicode
|
||||
{
|
||||
UINT16 *UnicodeString;
|
||||
|
||||
} ACPI_WPBT_UNICODE;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -895,6 +895,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
|
||||
{"ACPI_VIOT_VIRTIO_IOMMU_PCI", SRC_TYPE_STRUCT},
|
||||
{"ACPI_VIOT_VIRTIO_IOMMU_MMIO", SRC_TYPE_STRUCT},
|
||||
{"ACPI_WDAT_ENTRY", SRC_TYPE_STRUCT},
|
||||
{"ACPI_WPBT_UNICODE", SRC_TYPE_STRUCT},
|
||||
|
||||
/* Data Table compiler */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user