acpica-tools/big-endian-dmtbdump3.patch

251 lines
8.3 KiB
Diff
Raw Normal View History

Index: acpica-unix-20191018/source/common/dmtbdump3.c
===================================================================
--- acpica-unix-20191018.orig/source/common/dmtbdump3.c
+++ acpica-unix-20191018/source/common/dmtbdump3.c
@@ -68,9 +68,11 @@ void
AcpiDmDumpSlic (
ACPI_TABLE_HEADER *Table)
{
+ UINT32 Length;
- (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
- Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ (void) AcpiDmDumpTable (Length, sizeof (ACPI_TABLE_HEADER), Table,
+ Length - sizeof (*Table), AcpiDmTableInfoSlic);
}
@@ -93,14 +95,17 @@ AcpiDmDumpSlit (
ACPI_STATUS Status;
UINT32 Offset;
UINT8 *Row;
- UINT32 Localities;
+ UINT64 Localities;
UINT32 i;
UINT32 j;
+ UINT32 Length;
+ UINT64 Tmp64;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSlit);
if (ACPI_FAILURE (Status))
{
return;
@@ -108,7 +113,8 @@ AcpiDmDumpSlit (
/* Display the Locality NxN Matrix */
- Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
+ Tmp64 = (UINT64) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
+ ACPI_MOVE_64_TO_64(&Localities, &Tmp64);
Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
@@ -121,7 +127,7 @@ AcpiDmDumpSlit (
{
/* Check for beyond EOT */
- if (Offset >= Table->Length)
+ if (Offset >= Length)
{
AcpiOsPrintf (
"\n**** Not enough room in table for all localities\n");
@@ -173,11 +179,13 @@ AcpiDmDumpSrat (
UINT32 Offset = sizeof (ACPI_TABLE_SRAT);
ACPI_SUBTABLE_HEADER *Subtable;
ACPI_DMTABLE_INFO *InfoTable;
+ UINT32 Length;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSrat);
if (ACPI_FAILURE (Status))
{
return;
@@ -186,12 +194,12 @@ AcpiDmDumpSrat (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
Subtable->Length, AcpiDmTableInfoSratHdr);
if (ACPI_FAILURE (Status))
{
@@ -245,7 +253,7 @@ AcpiDmDumpSrat (
}
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
Subtable->Length, InfoTable);
if (ACPI_FAILURE (Status))
{
@@ -282,13 +290,14 @@ AcpiDmDumpStao (
{
ACPI_STATUS Status;
char *Namepath;
- UINT32 Length = Table->Length;
+ UINT32 Length;
UINT32 StringLength;
UINT32 Offset = sizeof (ACPI_TABLE_STAO);
/* Main table */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
if (ACPI_FAILURE (Status))
{
@@ -297,7 +306,7 @@ AcpiDmDumpStao (
/* The rest of the table consists of Namepath strings */
- while (Offset < Table->Length)
+ while (Offset < Length)
{
Namepath = ACPI_ADD_PTR (char, Table, Offset);
StringLength = strlen (Namepath) + 1;
@@ -339,11 +348,14 @@ AcpiDmDumpTcpa (
ACPI_TABLE_TCPA_HDR *Subtable = ACPI_ADD_PTR (
ACPI_TABLE_TCPA_HDR, Table, Offset);
ACPI_STATUS Status;
+ UINT32 Length;
+ UINT16 PlatformClass;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table,
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Status = AcpiDmDumpTable (Length, 0, Table,
0, AcpiDmTableInfoTcpaHdr);
if (ACPI_FAILURE (Status))
{
@@ -354,18 +366,19 @@ AcpiDmDumpTcpa (
* Examine the PlatformClass field to determine the table type.
* Either a client or server table. Only one.
*/
- switch (CommonHeader->PlatformClass)
+ ACPI_MOVE_16_TO_16(&PlatformClass, &CommonHeader->PlatformClass);
+ switch (PlatformClass)
{
case ACPI_TCPA_CLIENT_TABLE:
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Table->Length - Offset, AcpiDmTableInfoTcpaClient);
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
+ Length - Offset, AcpiDmTableInfoTcpaClient);
break;
case ACPI_TCPA_SERVER_TABLE:
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Table->Length - Offset, AcpiDmTableInfoTcpaServer);
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
+ Length - Offset, AcpiDmTableInfoTcpaServer);
break;
default:
@@ -512,11 +525,13 @@ AcpiDmDumpVrtc (
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_VRTC);
ACPI_VRTC_ENTRY *Subtable;
+ UINT32 Length;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoVrtc);
if (ACPI_FAILURE (Status))
{
return;
@@ -525,12 +540,12 @@ AcpiDmDumpVrtc (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
if (ACPI_FAILURE (Status))
{
@@ -565,11 +580,13 @@ AcpiDmDumpWdat (
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_WDAT);
ACPI_WDAT_ENTRY *Subtable;
+ UINT32 Length;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWdat);
if (ACPI_FAILURE (Status))
{
return;
@@ -578,12 +595,12 @@ AcpiDmDumpWdat (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
if (ACPI_FAILURE (Status))
{
@@ -618,12 +635,13 @@ AcpiDmDumpWpbt (
{
ACPI_STATUS Status;
ACPI_TABLE_WPBT *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length;
UINT16 ArgumentsLength;
/* Dump the main table */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
if (ACPI_FAILURE (Status))
{
@@ -633,10 +651,10 @@ AcpiDmDumpWpbt (
/* Extract the arguments buffer length from the main table */
Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
- ArgumentsLength = Subtable->ArgumentsLength;
+ ACPI_MOVE_16_TO_16(&ArgumentsLength, &Subtable->ArgumentsLength);
/* Dump the arguments buffer */
- (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
+ (void) AcpiDmDumpTable (Length, 0, Table, ArgumentsLength,
AcpiDmTableInfoWpbt0);
}