Additional fixup for the compiler/disassembler to support big-endian.
Signed-off-by: Al Stone <ahs3@redhat.com>
diff -Naur acpica-unix2-20160930/source/compiler/aslrestype2.c acpica-unix2-20160930-s390/source/compiler/aslrestype2.c
--- acpica-unix2-20160930/source/compiler/aslrestype2.c 2016-12-06 19:25:49.283453253 -0700
+++ acpica-unix2-20160930-s390/source/compiler/aslrestype2.c 2016-12-08 15:50:38.783785207 -0700
@@ -98,21 +98,33 @@
{
case 0: /* Address space */
+ /*
Descriptor->GenericReg.AddressSpaceId = (UINT8) InitializerOp->Asl.Value.Integer;
+ */
+ ACPI_MOVE_64_TO_8(&Descriptor->GenericReg.AddressSpaceId,
+ &InitializerOp->Asl.Value.Integer);
RsCreateByteField (InitializerOp, ACPI_RESTAG_ADDRESSSPACE,
CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.AddressSpaceId));
break;
case 1: /* Register Bit Width */
+ /*
Descriptor->GenericReg.BitWidth = (UINT8) InitializerOp->Asl.Value.Integer;
+ */
+ ACPI_MOVE_64_TO_8(&Descriptor->GenericReg.BitWidth,
+ &InitializerOp->Asl.Value.Integer);
RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITWIDTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitWidth));
break;
case 2: /* Register Bit Offset */
+ /*
Descriptor->GenericReg.BitOffset = (UINT8) InitializerOp->Asl.Value.Integer;
+ */
+ ACPI_MOVE_64_TO_8(&Descriptor->GenericReg.BitOffset,
+ &InitializerOp->Asl.Value.Integer);
RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITOFFSET,
CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitOffset));
break;
@@ -127,7 +139,11 @@
case 4: /* Access Size (ACPI 3.0) */
+ /*
Descriptor->GenericReg.AccessSize = (UINT8) InitializerOp->Asl.Value.Integer;
+ */
+ ACPI_MOVE_64_TO_8(&Descriptor->GenericReg.AccessSize,
+ &InitializerOp->Asl.Value.Integer);
RsCreateByteField (InitializerOp, ACPI_RESTAG_ACCESSSIZE,
CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.AccessSize));
diff -Naur acpica-unix2-20160930/source/compiler/dtfield.c acpica-unix2-20160930-s390/source/compiler/dtfield.c
--- acpica-unix2-20160930/source/compiler/dtfield.c 2016-09-30 10:43:57.000000000 -0600
+++ acpica-unix2-20160930-s390/source/compiler/dtfield.c 2016-12-06 11:26:37.483785207 -0700
@@ -360,7 +360,27 @@
DtError (ASL_ERROR, ASL_MSG_INTEGER_SIZE, Field, MsgBuffer);
}
- memcpy (Buffer, &Value, ByteLength);
+ switch (ByteLength) {
+ case 1:
+ ACPI_MOVE_64_TO_8(Buffer, &Value);
+ break;
+
+ case 2:
+ ACPI_MOVE_64_TO_16(Buffer, &Value);
+ break;
+
+ case 4:
+ ACPI_MOVE_64_TO_32(Buffer, &Value);
+ break;
+
+ case 8:
+ ACPI_MOVE_64_TO_64(Buffer, &Value);
+ break;
+
+ default:
+ memcpy (Buffer, &Value, ByteLength);
+ break;
+ }
return;
}
diff -Naur acpica-unix2-20160930/source/compiler/dtsubtable.c acpica-unix2-20160930-s390/source/compiler/dtsubtable.c
--- acpica-unix2-20160930/source/compiler/dtsubtable.c 2016-09-30 10:43:57.000000000 -0600
+++ acpica-unix2-20160930-s390/source/compiler/dtsubtable.c 2016-12-06 15:30:17.993785207 -0700
@@ -379,6 +379,21 @@
return;
}
- memcpy (Subtable->LengthField, &Subtable->TotalLength,
- Subtable->SizeOfLengthField);
+ switch(Subtable->SizeOfLengthField) {
+ case 1:
+ ACPI_MOVE_32_TO_8(Subtable->LengthField, &Subtable->TotalLength);
+ break;
+
+ case 2:
+ ACPI_MOVE_32_TO_16(Subtable->LengthField, &Subtable->TotalLength);
+ break;
+
+ case 4:
+ ACPI_MOVE_32_TO_32(Subtable->LengthField, &Subtable->TotalLength);
+ break;
+
+ default:
+ memcpy (Subtable->LengthField, &Subtable->TotalLength,
+ Subtable->SizeOfLengthField);
+ }
}
diff -Naur acpica-unix2-20160930/source/compiler/dttable1.c acpica-unix2-20160930-s390/source/compiler/dttable1.c
--- acpica-unix2-20160930/source/compiler/dttable1.c 2016-09-30 10:43:57.000000000 -0600
+++ acpica-unix2-20160930-s390/source/compiler/dttable1.c 2016-12-08 11:58:07.353785207 -0700
@@ -282,6 +282,8 @@
DT_FIELD **PFieldList = (DT_FIELD **) List;
UINT32 DescriptorCount;
UINT32 GroupLength;
+ ACPI_CSRT_GROUP *Pgrp;
+ UINT32 Tmp32;
/* Subtables (Resource Groups) */
@@ -300,12 +302,20 @@
/* Compute the number of resource descriptors */
+ /*
GroupLength =
(ACPI_CAST_PTR (ACPI_CSRT_GROUP,
Subtable->Buffer))->Length -
(ACPI_CAST_PTR (ACPI_CSRT_GROUP,
Subtable->Buffer))->SharedInfoLength -
sizeof (ACPI_CSRT_GROUP);
+ */
+ Pgrp = ACPI_CAST_PTR(ACPI_CSRT_GROUP, Subtable->Buffer);
+ ACPI_MOVE_32_TO_32(&Tmp32, &Pgrp->Length);
+ GroupLength = Tmp32;
+ ACPI_MOVE_32_TO_32(&Tmp32, &Pgrp->SharedInfoLength);
+ GroupLength -= Tmp32;
+ GroupLength -= sizeof (ACPI_CSRT_GROUP);
DescriptorCount = (GroupLength /
sizeof (ACPI_CSRT_DESCRIPTOR));
@@ -393,6 +403,8 @@
ACPI_DBG2_DEVICE *DeviceInfo;
UINT16 CurrentOffset;
UINT32 i;
+ UINT16 Tmp16;
+ UINT32 Tmp32;
/* Main table */
@@ -409,10 +421,11 @@
/* Main table fields */
Dbg2Header = ACPI_CAST_PTR (ACPI_DBG2_HEADER, Subtable->Buffer);
- Dbg2Header->InfoOffset = sizeof (ACPI_TABLE_HEADER) + ACPI_PTR_DIFF (
+ Tmp32 = sizeof (ACPI_TABLE_HEADER) + ACPI_PTR_DIFF (
ACPI_ADD_PTR (UINT8, Dbg2Header, sizeof (ACPI_DBG2_HEADER)), Dbg2Header);
+ ACPI_MOVE_32_TO_32(&Dbg2Header->InfoOffset, &Tmp32);
- SubtableCount = Dbg2Header->InfoCount;
+ ACPI_MOVE_32_TO_32(&SubtableCount, &Dbg2Header->InfoCount);
DtPushSubtable (Subtable);
/* Process all Device Information subtables (Count = InfoCount) */
@@ -439,7 +452,7 @@
/* BaseAddressRegister GAS array (Required, size is RegisterCount) */
- DeviceInfo->BaseAddressOffset = CurrentOffset;
+ ACPI_MOVE_16_TO_16(&DeviceInfo->BaseAddressOffset, &CurrentOffset);
for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
{
Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Addr,
@@ -455,7 +468,7 @@
/* AddressSize array (Required, size = RegisterCount) */
- DeviceInfo->AddressSizeOffset = CurrentOffset;
+ ACPI_MOVE_16_TO_16(&DeviceInfo->AddressSizeOffset, &CurrentOffset);
for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
{
Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Size,
@@ -471,7 +484,7 @@
/* NamespaceString device identifier (Required, size = NamePathLength) */
- DeviceInfo->NamepathOffset = CurrentOffset;
+ ACPI_MOVE_16_TO_16(&DeviceInfo->NamepathOffset, &CurrentOffset);
Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Name,
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
@@ -481,8 +494,9 @@
/* Update the device info header */
- DeviceInfo->NamepathLength = (UINT16) Subtable->Length;
- CurrentOffset += (UINT16) DeviceInfo->NamepathLength;
+ ACPI_MOVE_32_TO_16(&DeviceInfo->NamepathLength, &Subtable->Length);
+ ACPI_MOVE_16_TO_16(&Tmp16, &DeviceInfo->NamepathLength);
+ CurrentOffset += Tmp16;
DtInsertSubtable (ParentTable, Subtable);
/* OemData - Variable-length data (Optional, size = OemDataLength) */
@@ -503,8 +517,8 @@
if (Subtable && Subtable->Length)
{
- DeviceInfo->OemDataOffset = CurrentOffset;
- DeviceInfo->OemDataLength = (UINT16) Subtable->Length;
+ ACPI_MOVE_16_TO_16(&DeviceInfo->OemDataOffset, &CurrentOffset);
+ ACPI_MOVE_32_TO_16(&DeviceInfo->OemDataLength, &Subtable->Length);
DtInsertSubtable (ParentTable, Subtable);
}
@@ -544,6 +558,8 @@
ACPI_DMAR_DEVICE_SCOPE *DmarDeviceScope;
UINT32 DeviceScopeLength;
UINT32 PciPathLength;
+ UINT16 Tmp16;
+ UINT16 HdrType;
Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable, TRUE);
@@ -573,8 +589,11 @@
DtPushSubtable (Subtable);
DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer);
+ ACPI_MOVE_16_TO_16(&Tmp16, &DmarHeader->Length);
+ DmarHeader->Length = Tmp16;
- switch (DmarHeader->Type)
+ ACPI_MOVE_16_TO_16(&HdrType, &DmarHeader->Type);
+ switch (HdrType)
{
case ACPI_DMAR_TYPE_HARDWARE_UNIT:
@@ -621,8 +640,8 @@
/*
* Optional Device Scope subtables
*/
- if ((DmarHeader->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
- (DmarHeader->Type == ACPI_DMAR_TYPE_NAMESPACE))
+ if ((HdrType == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
+ (HdrType == ACPI_DMAR_TYPE_NAMESPACE))
{
/* These types do not support device scopes */
@@ -631,8 +650,8 @@
}
DtPushSubtable (Subtable);
- DeviceScopeLength = DmarHeader->Length - Subtable->Length -
- ParentTable->Length;
+ DeviceScopeLength = DmarHeader->Length - Subtable->Length -
+ ParentTable->Length;
while (DeviceScopeLength)
{
Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope,
@@ -757,7 +776,7 @@
Count++;
}
- DrtmVtl->ValidatedTableCount = Count;
+ ACPI_MOVE_32_TO_32(&DrtmVtl->ValidatedTableCount, &Count);
DtPopSubtable ();
ParentTable = DtPeekSubtable ();
@@ -795,7 +814,7 @@
Count++;
}
- DrtmRl->ResourceCount = Count;
+ ACPI_MOVE_32_TO_32(&DrtmRl->ResourceCount, &Count);
DtPopSubtable ();
ParentTable = DtPeekSubtable ();
@@ -889,6 +908,7 @@
ACPI_SUBTABLE_HEADER *GtdtHeader;
ACPI_DMTABLE_INFO *InfoTable;
UINT32 GtCount;
+ ACPI_GTDT_TIMER_BLOCK *TimerBlock;
Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdt,
@@ -955,8 +975,9 @@
DtPushSubtable (Subtable);
ParentTable = DtPeekSubtable ();
- GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
- Subtable->Buffer - sizeof(ACPI_GTDT_HEADER)))->TimerCount;
+ TimerBlock = ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
+ Subtable->Buffer - sizeof(ACPI_GTDT_HEADER));
+ ACPI_MOVE_32_TO_32(&GtCount, &TimerBlock->TimerCount);
while (GtCount)
{
@@ -1009,6 +1030,7 @@
ACPI_DMTABLE_INFO *InfoTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
DT_FIELD *SubtableStart;
+ UINT16 HdrType;
while (*PFieldList)
@@ -1027,7 +1049,8 @@
FpdtHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
- switch (FpdtHeader->Type)
+ ACPI_MOVE_16_TO_16(&HdrType, &FpdtHeader->Type);
+ switch (HdrType)
{
case ACPI_FPDT_TYPE_BOOT:
@@ -1085,6 +1108,7 @@
ACPI_DMTABLE_INFO *InfoTable;
UINT16 Type;
UINT32 BankCount;
+ UINT16 Tmp16;
Status = DtCompileTable (PFieldList, AcpiDmTableInfoHest,
@@ -1102,8 +1126,9 @@
/* Get subtable type */
SubtableStart = *PFieldList;
- DtCompileInteger ((UINT8 *) &Type, *PFieldList, 2, 0);
+ DtCompileInteger ((UINT8 *) &Tmp16, *PFieldList, 2, 0);
+ ACPI_MOVE_16_TO_16(&Type, &Tmp16);
switch (Type)
{
case ACPI_HEST_TYPE_IA32_CHECK:
@@ -1225,11 +1250,13 @@
ACPI_IORT_SMMU *IortSmmu;
UINT32 NodeNumber;
UINT32 NodeLength;
+ UINT32 NodeOffset;
UINT32 IdMappingNumber;
UINT32 ItsNumber;
UINT32 ContextIrptNumber;
UINT32 PmuIrptNumber;
UINT32 PaddingLength;
+ UINT32 MappingOffset;
ParentTable = DtPeekSubtable ();
@@ -1255,7 +1282,7 @@
* Optionally allows the generic data types to be used for filling
* this field.
*/
- Iort->NodeOffset = sizeof (ACPI_TABLE_IORT);
+ NodeOffset = sizeof (ACPI_TABLE_IORT);
Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortPad,
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
@@ -1265,7 +1292,7 @@
if (Subtable)
{
DtInsertSubtable (ParentTable, Subtable);
- Iort->NodeOffset += Subtable->Length;
+ NodeOffset += Subtable->Length;
}
else
{
@@ -1275,8 +1302,9 @@
{
return (Status);
}
- Iort->NodeOffset += PaddingLength;
+ NodeOffset += PaddingLength;
}
+ ACPI_MOVE_32_TO_32(&Iort->NodeOffset, &NodeOffset);
NodeNumber = 0;
while (*PFieldList)
@@ -1330,7 +1358,7 @@
ItsNumber++;
}
- IortItsGroup->ItsCount = ItsNumber;
+ ACPI_MOVE_32_TO_32(&IortItsGroup->ItsCount, &ItsNumber);
break;
case ACPI_IORT_NODE_NAMED_COMPONENT:
@@ -1364,15 +1392,16 @@
}
else
{
- if (NodeLength > IortNode->MappingOffset)
+ ACPI_MOVE_32_TO_32(&MappingOffset, &IortNode->MappingOffset);
+ if (NodeLength > MappingOffset)
{
return (AE_BAD_DATA);
}
- if (NodeLength < IortNode->MappingOffset)
+ if (NodeLength < MappingOffset)
{
Status = DtCompilePadding (
- IortNode->MappingOffset - NodeLength,
+ MappingOffset - NodeLength,
&Subtable);
if (ACPI_FAILURE (Status))
{
@@ -1380,7 +1409,8 @@
}
DtInsertSubtable (ParentTable, Subtable);
- NodeLength = IortNode->MappingOffset;
+ ACPI_MOVE_32_TO_32(&MappingOffset, &IortNode->MappingOffset);
+ NodeLength = MappingOffset;
}
}
break;
@@ -1413,7 +1443,7 @@
/* Compile global interrupt array */
- IortSmmu->GlobalInterruptOffset = NodeLength;
+ ACPI_MOVE_32_TO_32(&IortSmmu->GlobalInterruptOffset, &NodeLength);
Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3a,
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
@@ -1427,7 +1457,7 @@
/* Compile context interrupt array */
ContextIrptNumber = 0;
- IortSmmu->ContextInterruptOffset = NodeLength;
+ ACPI_MOVE_32_TO_32(&IortSmmu->ContextInterruptOffset, &NodeLength);
while (*PFieldList)
{
Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3b,
@@ -1447,12 +1477,12 @@
ContextIrptNumber++;
}
- IortSmmu->ContextInterruptCount = ContextIrptNumber;
+ ACPI_MOVE_32_TO_32(&IortSmmu->ContextInterruptCount, &ContextIrptNumber);
/* Compile PMU interrupt array */
PmuIrptNumber = 0;
- IortSmmu->PmuInterruptOffset = NodeLength;
+ ACPI_MOVE_32_TO_32(&IortSmmu->PmuInterruptOffset, &NodeLength);
while (*PFieldList)
{
Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3c,
@@ -1472,7 +1502,7 @@
PmuIrptNumber++;
}
- IortSmmu->PmuInterruptCount = PmuIrptNumber;
+ ACPI_MOVE_32_TO_32(&IortSmmu->PmuInterruptCount, &PmuIrptNumber);
break;
case ACPI_IORT_NODE_SMMU_V3:
@@ -1496,7 +1526,7 @@
/* Compile Array of ID mappings */
- IortNode->MappingOffset = NodeLength;
+ ACPI_MOVE_32_TO_32(&IortNode->MappingOffset, &NodeLength);
IdMappingNumber = 0;
while (*PFieldList)
{
@@ -1517,7 +1547,7 @@
IdMappingNumber++;
}
- IortNode->MappingCount = IdMappingNumber;
+ ACPI_MOVE_32_TO_32(&IortNode->MappingCount, &IdMappingNumber);
/*
* Node length can be determined by DT_LENGTH option
@@ -1528,7 +1558,7 @@
NodeNumber++;
}
- Iort->NodeCount = NodeNumber;
+ ACPI_MOVE_32_TO_32(&Iort->NodeCount, &NodeNumber);
return (AE_OK);
}
diff -Naur acpica-unix2-20160930/source/compiler/dttable2.c acpica-unix2-20160930-s390/source/compiler/dttable2.c
--- acpica-unix2-20160930/source/compiler/dttable2.c 2016-09-30 10:43:57.000000000 -0600
+++ acpica-unix2-20160930-s390/source/compiler/dttable2.c 2016-12-09 17:35:52.483785207 -0700
@@ -346,7 +346,7 @@
DtPushSubtable (Subtable);
MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer);
- SubtableCount = MpstChannelInfo->PowerNodeCount;
+ ACPI_MOVE_16_TO_16(&SubtableCount, &MpstChannelInfo->PowerNodeCount);
while (*PFieldList && SubtableCount)
{
@@ -364,8 +364,8 @@
DtPushSubtable (Subtable);
MpstPowerNode = ACPI_CAST_PTR (ACPI_MPST_POWER_NODE, Subtable->Buffer);
- PowerStateCount = MpstPowerNode->NumPowerStates;
- ComponentCount = MpstPowerNode->NumPhysicalComponents;
+ ACPI_MOVE_32_TO_32(&PowerStateCount, &MpstPowerNode->NumPowerStates);
+ ACPI_MOVE_32_TO_32(&ComponentCount, &MpstPowerNode->NumPhysicalComponents);
ParentTable = DtPeekSubtable ();
@@ -518,6 +518,7 @@
UINT32 Count;
ACPI_NFIT_INTERLEAVE *Interleave = NULL;
ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
+ UINT16 SubType;
/* Main table */
@@ -551,7 +552,8 @@
NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer);
- switch (NfitHeader->Type)
+ ACPI_MOVE_16_TO_16(&SubType, &NfitHeader->Type);
+ switch (SubType)
{
case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
@@ -606,7 +608,7 @@
DtInsertSubtable (ParentTable, Subtable);
DtPopSubtable ();
- switch (NfitHeader->Type)
+ switch (SubType)
{
case ACPI_NFIT_TYPE_INTERLEAVE:
@@ -632,7 +634,7 @@
Count++;
}
- Interleave->LineCount = Count;
+ ACPI_MOVE_32_TO_32(&Interleave->LineCount, &Count);
DtPopSubtable ();
break;
@@ -678,7 +680,7 @@
Count++;
}
- Hint->HintCount = (UINT16) Count;
+ ACPI_MOVE_32_TO_16(&Hint->HintCount, &Count);
DtPopSubtable ();
break;
@@ -885,7 +887,7 @@
PmttController = ACPI_CAST_PTR (ACPI_PMTT_CONTROLLER,
(Subtable->Buffer - sizeof (ACPI_PMTT_HEADER)));
- DomainCount = PmttController->DomainCount;
+ ACPI_MOVE_16_TO_16(&DomainCount, &PmttController->DomainCount);
while (DomainCount)
{
@@ -986,6 +988,7 @@
DT_SUBTABLE *ParentTable;
ACPI_DMTABLE_INFO *InfoTable;
DT_FIELD *SubtableStart;
+ UINT16 HdrType;
Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt,
@@ -1013,7 +1016,8 @@
S3ptHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
- switch (S3ptHeader->Type)
+ ACPI_MOVE_16_TO_16(&HdrType, &S3ptHeader->Type);
+ switch (HdrType)
{
case ACPI_S3PT_TYPE_RESUME:
@@ -1110,6 +1114,7 @@
DT_FIELD *FieldList;
UINT32 Localities;
UINT8 *LocalityBuffer;
+ UINT32 Tmp;
Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
@@ -1122,7 +1127,8 @@
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
- Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
+ Tmp = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
+ ACPI_MOVE_32_TO_32(&Localities, &Tmp);
LocalityBuffer = UtLocalCalloc (Localities);
/* Compile each locality buffer */
@@ -1311,6 +1317,7 @@
ACPI_TABLE_TCPA_HDR *TcpaHeader;
DT_SUBTABLE *ParentTable;
ACPI_STATUS Status;
+ UINT16 PlatClass;
/* Compile the main table */
@@ -1331,7 +1338,8 @@
*/
TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer);
- switch (TcpaHeader->PlatformClass)
+ ACPI_MOVE_16_TO_16(&PlatClass, &TcpaHeader->PlatformClass);
+ switch (PlatClass)
{
case ACPI_TCPA_CLIENT_TABLE:
@@ -1527,6 +1535,9 @@
ACPI_TABLE_WPBT *Table;
ACPI_STATUS Status;
UINT16 Length;
+ UINT16 Tmp16;
+ UINT16 *Ptr16;
+ UINT32 ii;
/* Compile the main table */
@@ -1554,7 +1565,16 @@
Length = (UINT16) Subtable->TotalLength;
Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer);
- Table->ArgumentsLength = Length;
+ ACPI_MOVE_16_TO_16(&Table->ArgumentsLength, &Length);
+
+ /* The arguments are in Unicode, so make sure the byte order is correct */
+ Ptr16 = (UINT16 *)Subtable->Buffer;
+ for (ii = 0; ii < Length; ii++)
+ {
+ ACPI_MOVE_16_TO_16(&Tmp16, Ptr16);
+ *Ptr16 = Tmp16;
+ Ptr16++;
+ }
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
diff -Naur acpica-unix2-20160930/source/components/disassembler/dmbuffer.c acpica-unix2-20160930-s390/source/components/disassembler/dmbuffer.c
--- acpica-unix2-20160930/source/components/disassembler/dmbuffer.c 2016-12-06 19:25:49.303453108 -0700
+++ acpica-unix2-20160930-s390/source/components/disassembler/dmbuffer.c 2016-12-09 14:27:06.193785207 -0700
@@ -425,7 +425,8 @@
/* Extract the byte list info */
ByteData = NextOp->Named.Data;
- ByteCount = (UINT32) NextOp->Common.Value.Integer;
+ /* ByteCount = (UINT32) NextOp->Common.Value.Integer; */
+ ByteCount = (UINT32) NextOp->Common.Value.Size;
WordCount = ACPI_DIV_2 (ByteCount);
/*
@@ -834,19 +835,22 @@
UINT32 WordCount;
UINT32 i;
int OutputValue;
+ UINT16 Tmp16;
/* Extract the buffer info as a WORD buffer */
WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data);
- WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Integer));
+ WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Size));
/* Write every other byte as an ASCII character */
AcpiOsPrintf ("\"");
for (i = 0; i < (WordCount - 1); i++)
{
- OutputValue = (int) WordData[i];
+ /* OutputValue = (int) WordData[i]; */
+ ACPI_MOVE_16_TO_16(&Tmp16, &WordData[i]);
+ OutputValue = (int) Tmp16;
/* Handle values that must be escaped */
diff -Naur acpica-unix2-20160930/source/components/disassembler/dmresrcl2.c acpica-unix2-20160930-s390/source/components/disassembler/dmresrcl2.c
--- acpica-unix2-20160930/source/components/disassembler/dmresrcl2.c 2016-09-30 10:43:58.000000000 -0600
+++ acpica-unix2-20160930-s390/source/components/disassembler/dmresrcl2.c 2016-12-09 16:23:07.283785207 -0700
@@ -191,22 +191,24 @@
char *DeviceName = NULL;
UINT32 PinCount;
UINT32 i;
+ UINT16 Tmp16;
/* ResourceSource, ResourceSourceIndex, ResourceType */
AcpiDmIndent (Level + 1);
- if (Resource->Gpio.ResSourceOffset)
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.ResSourceOffset);
+ if (Tmp16)
{
- DeviceName = ACPI_ADD_PTR (char,
- Resource, Resource->Gpio.ResSourceOffset),
+ DeviceName = ACPI_ADD_PTR (char, Resource, Tmp16),
AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
}
AcpiOsPrintf (", ");
AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex);
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.Flags);
AcpiOsPrintf ("%s, ",
- AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]);
+ AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Tmp16)]);
/* Insert a descriptor name */
@@ -215,15 +217,16 @@
/* Dump the vendor data */
- if (Resource->Gpio.VendorOffset)
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.VendorOffset);
+ if (Tmp16)
{
AcpiOsPrintf ("\n");
AcpiDmIndent (Level + 1);
- VendorData = ACPI_ADD_PTR (UINT8, Resource,
- Resource->Gpio.VendorOffset);
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.VendorOffset);
+ VendorData = ACPI_ADD_PTR (UINT8, Resource, Tmp16);
- AcpiDmDumpRawDataBuffer (VendorData,
- Resource->Gpio.VendorLength, Level);
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.VendorLength);
+ AcpiDmDumpRawDataBuffer (VendorData, Tmp16, Level);
}
AcpiOsPrintf (")\n");
@@ -233,17 +236,25 @@
AcpiDmIndent (Level + 1);
AcpiOsPrintf ("{ // Pin list\n");
+ /*
PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset -
Resource->Gpio.PinTableOffset)) /
sizeof (UINT16);
+ */
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.ResSourceOffset);
+ PinCount = (UINT32) Tmp16;
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.PinTableOffset);
+ PinCount -= (UINT32) Tmp16;
+ PinCount /= sizeof (UINT16);
- PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
- Resource->Gpio.PinTableOffset);
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.PinTableOffset);
+ PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource, Tmp16);
for (i = 0; i < PinCount; i++)
{
AcpiDmIndent (Level + 2);
- AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
+ ACPI_MOVE_16_TO_16(&Tmp16, &PinList[i]);
+ AcpiOsPrintf ("0x%4.4X%s\n", Tmp16,
((i + 1) < PinCount) ? "," : "");
}
@@ -277,16 +288,18 @@
UINT32 Length,
UINT32 Level)
{
+ UINT16 Tmp16;
/* Dump the GpioInt-specific portion of the descriptor */
/* EdgeLevel, ActiveLevel, Shared */
AcpiDmIndent (Level);
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.IntFlags);
AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
- AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)],
- AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)],
- AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
+ AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Tmp16)],
+ AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 1)],
+ AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 3)]);
/* PinConfig, DebounceTimeout */
@@ -299,7 +312,8 @@
{
AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
}
- AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout);
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.DebounceTimeout);
+ AcpiOsPrintf ("0x%4.4X,\n", Tmp16);
/* Dump the GpioInt/GpioIo common portion of the descriptor */
@@ -329,14 +343,16 @@
UINT32 Length,
UINT32 Level)
{
+ UINT16 Tmp16;
/* Dump the GpioIo-specific portion of the descriptor */
/* Shared, PinConfig */
AcpiDmIndent (Level);
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.IntFlags);
AcpiOsPrintf ("GpioIo (%s, ",
- AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
+ AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 3)]);
if (Resource->Gpio.PinConfig <= 3)
{
@@ -350,10 +366,13 @@
/* DebounceTimeout, DriveStrength, IoRestriction */
- AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout);
- AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength);
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.DebounceTimeout);
+ AcpiOsPrintf ("0x%4.4X, ", Tmp16);
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.DriveStrength);
+ AcpiOsPrintf ("0x%4.4X, ", Tmp16);
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.IntFlags);
AcpiOsPrintf ("%s,\n",
- AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]);
+ AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Tmp16)]);
/* Dump the GpioInt/GpioIo common portion of the descriptor */
@@ -427,6 +446,7 @@
{
UINT8 *VendorData;
UINT32 VendorLength;
+ UINT16 Tmp16;
/* Get the (optional) vendor data and length */
@@ -435,8 +455,8 @@
{
case AML_RESOURCE_I2C_SERIALBUSTYPE:
- VendorLength = Resource->CommonSerialBus.TypeDataLength -
- AML_RESOURCE_I2C_MIN_DATA_LEN;
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->CommonSerialBus.TypeDataLength);
+ VendorLength = Tmp16 - AML_RESOURCE_I2C_MIN_DATA_LEN;
VendorData = ACPI_ADD_PTR (UINT8, Resource,
sizeof (AML_RESOURCE_I2C_SERIALBUS));
@@ -444,8 +464,8 @@
case AML_RESOURCE_SPI_SERIALBUSTYPE:
- VendorLength = Resource->CommonSerialBus.TypeDataLength -
- AML_RESOURCE_SPI_MIN_DATA_LEN;
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->CommonSerialBus.TypeDataLength);
+ VendorLength = Tmp16 - AML_RESOURCE_SPI_MIN_DATA_LEN;
VendorData = ACPI_ADD_PTR (UINT8, Resource,
sizeof (AML_RESOURCE_SPI_SERIALBUS));
@@ -453,8 +473,8 @@
case AML_RESOURCE_UART_SERIALBUSTYPE:
- VendorLength = Resource->CommonSerialBus.TypeDataLength -
- AML_RESOURCE_UART_MIN_DATA_LEN;
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->CommonSerialBus.TypeDataLength);
+ VendorLength = Tmp16 - AML_RESOURCE_UART_MIN_DATA_LEN;
VendorData = ACPI_ADD_PTR (UINT8, Resource,
sizeof (AML_RESOURCE_UART_SERIALBUS));
@@ -495,15 +515,19 @@
{
UINT32 ResourceSourceOffset;
char *DeviceName;
+ UINT16 Tmp16;
+ UINT32 Tmp32;
/* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->I2cSerialBus.SlaveAddress);
+ ACPI_MOVE_32_TO_32(&Tmp32, &Resource->I2cSerialBus.ConnectionSpeed);
AcpiDmIndent (Level);
AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n",
- Resource->I2cSerialBus.SlaveAddress,
+ Tmp16,
AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
- Resource->I2cSerialBus.ConnectionSpeed);
+ Tmp32);
AcpiDmIndent (Level + 1);
AcpiOsPrintf ("%s, ",
@@ -511,8 +535,8 @@
/* ResourceSource is a required field */
- ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
- Resource->CommonSerialBus.TypeDataLength;
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->CommonSerialBus.TypeDataLength);
+ ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + Tmp16;
DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
diff -Naur acpica-unix2-20160930/source/components/disassembler/dmresrcl.c acpica-unix2-20160930-s390/source/components/disassembler/dmresrcl.c
--- acpica-unix2-20160930/source/components/disassembler/dmresrcl.c 2016-12-06 19:25:49.303453108 -0700
+++ acpica-unix2-20160930-s390/source/components/disassembler/dmresrcl.c 2016-12-08 16:33:58.673785207 -0700
@@ -917,6 +917,7 @@
UINT32 Length,
UINT32 Level)
{
+ UINT64 Tmp64;
AcpiDmIndent (Level);
AcpiOsPrintf ("Register (");
@@ -930,7 +931,9 @@
AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset");
AcpiDmIndent (Level + 1);
- AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address");
+ /* AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address"); */
+ ACPI_MOVE_64_TO_64(&Tmp64, &Resource->GenericReg.Address);
+ AcpiDmDumpInteger64 (Tmp64, "Address");
/* Optional field for ACPI 3.0 */
diff -Naur acpica-unix2-20160930/source/components/disassembler/dmresrcs.c acpica-unix2-20160930-s390/source/components/disassembler/dmresrcs.c
--- acpica-unix2-20160930/source/components/disassembler/dmresrcs.c 2016-12-06 19:25:49.304453101 -0700
+++ acpica-unix2-20160930-s390/source/components/disassembler/dmresrcs.c 2016-12-09 16:56:26.153785207 -0700
@@ -256,12 +256,14 @@
UINT32 Length,
UINT32 Level)
{
+ UINT16 Tmp16;
AcpiDmIndent (Level);
AcpiOsPrintf ("FixedIO (\n");
AcpiDmIndent (Level + 1);
- AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address");
+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->FixedIo.Address);
+ AcpiDmDumpInteger16 (Tmp16, "Address");
AcpiDmIndent (Level + 1);
AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length");
diff -Naur acpica-unix2-20160930/source/components/namespace/nsaccess.c acpica-unix2-20160930-s390/source/components/namespace/nsaccess.c
--- acpica-unix2-20160930/source/components/namespace/nsaccess.c 2016-09-30 10:43:59.000000000 -0600
+++ acpica-unix2-20160930-s390/source/components/namespace/nsaccess.c 2016-12-08 17:11:07.563785207 -0700
@@ -309,6 +309,7 @@
ACPI_OBJECT_TYPE ThisSearchType;
UINT32 SearchParentFlag = ACPI_NS_SEARCH_PARENT;
UINT32 LocalFlags;
+ UINT32 Tmp32;
ACPI_FUNCTION_TRACE (NsLookup);
@@ -657,9 +658,10 @@
{
/* Complain about a type mismatch */
+ ACPI_MOVE_32_TO_32(&Tmp32, &SimpleName);
ACPI_WARNING ((AE_INFO,
"NsLookup: Type mismatch on %4.4s (%s), searching for (%s)",
- ACPI_CAST_PTR (char, &SimpleName),
+ ACPI_CAST_PTR (char, &Tmp32),
AcpiUtGetTypeName (ThisNode->Type),
AcpiUtGetTypeName (TypeToCheckFor)));
}
diff -Naur acpica-unix2-20160930/source/include/acmacros.h acpica-unix2-20160930-s390/source/include/acmacros.h
--- acpica-unix2-20160930/source/include/acmacros.h 2016-12-06 19:25:49.285453239 -0700
+++ acpica-unix2-20160930-s390/source/include/acmacros.h 2016-12-06 11:58:04.563785207 -0700
@@ -98,7 +98,9 @@
((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
-/* 32-bit source, 16/32/64 destination */
+/* 32-bit source, 8/16/32/64 destination */
+
+#define ACPI_MOVE_32_TO_8(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];}
#define ACPI_MOVE_32_TO_16(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\
(( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];}
@@ -114,7 +116,9 @@
((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
-/* 64-bit source, 16/32/64 destination */
+/* 64-bit source, 8/16/32/64 destination */
+
+#define ACPI_MOVE_64_TO_8(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];}
#define ACPI_MOVE_64_TO_16(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\
(( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];}
@@ -141,13 +145,16 @@
/* The hardware supports unaligned transfers, just do the little-endian move */
-/* 16-bit source, 16/32/64 destination */
+/* 16-bit source, 8/16/32/64 destination */
+#define ACPI_MOVE_16_TO_8(d, s) *(UINT8 *)(void *)(d) = *(UINT16 *)(void *)(s)
#define ACPI_MOVE_16_TO_16(d, s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s)
#define ACPI_MOVE_16_TO_32(d, s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s)
#define ACPI_MOVE_16_TO_64(d, s) *(UINT64 *)(void *)(d) = *(UINT16 *)(void *)(s)
-/* 32-bit source, 16/32/64 destination */
+/* 32-bit source, 8/16/32/64 destination */
+
+#define ACPI_MOVE_32_TO_8(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];}
#define ACPI_MOVE_32_TO_16(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
(( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];}
@@ -155,8 +162,9 @@
#define ACPI_MOVE_32_TO_32(d, s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s)
#define ACPI_MOVE_32_TO_64(d, s) *(UINT64 *)(void *)(d) = *(UINT32 *)(void *)(s)
-/* 64-bit source, 16/32/64 destination */
+/* 64-bit source, 8/16/32/64 destination */
+#define ACPI_MOVE_64_TO_8(d, s) ACPI_MOVE_16_TO_8(d, s) /* Truncate to 8 */
#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */
#define ACPI_MOVE_64_TO_64(d, s) *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s)
@@ -176,7 +184,9 @@
#define ACPI_MOVE_16_TO_32(d, s) {(*(UINT32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
#define ACPI_MOVE_16_TO_64(d, s) {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
-/* 32-bit source, 16/32/64 destination */
+/* 32-bit source, 8/16/32/64 destination */
+
+#define ACPI_MOVE_32_TO_8(d, s) ACPI_MOVE_16_TO_8(d, s) /* Truncate to 8 */
#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */