diff options
author | lvjianmin-loongson <72972102+lvjianmin-loongson@users.noreply.github.com> | 2023-04-07 19:09:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-07 19:09:34 +0800 |
commit | 017e83209b814f7089488e851446b6ca767e8a6b (patch) | |
tree | eabd0b20030de73bfb14b848c90cf933329f7b48 | |
parent | a1cb7b6af77ec30668634cdcaa0eb73b8f1dc3e2 (diff) | |
parent | 1631c7f3e9d89e55854710b09145bff99c8246b8 (diff) | |
download | acpica-017e83209b814f7089488e851446b6ca767e8a6b.tar.gz |
Merge branch 'acpica:master' into master
27 files changed, 1431 insertions, 74 deletions
diff --git a/documents/changes.txt b/documents/changes.txt index 1987f9ba2..af896ec7e 100644 --- a/documents/changes.txt +++ b/documents/changes.txt @@ -1,4 +1,47 @@ ---------------------------------------- +31 March 2023. Summary of changes for version 20230331: + +This release is available at https://acpica.org/downloads + +0) Global changes: + + +Update all copyright notices to the year 2023. This effects all source +modules, as well as utility signons. +Add OS-specific support for Zephyr RTOS. +Fix miscellaneous code that accesses various objects. +Remove some dead code. +Add C ?Flexible Array? support. +Add support for 64 bit LoongArch compilation. +Add first batch of RISC-V related definitions. +Performed a global automated update to remove tabs, fix indentation +issues, etc. + +1) ACPICA kernel-resident subsystem: + +hwvalid: Drop port I/O validation. + +2) ACPICA tools and utilities: + +iASL: Added full macro support in the preprocessor. Example: +#define ABCD(a,b,c,d) a+b+c-d + +Known macro support limitations (at this time): + No support for multi-line #define macros (backslash continuation +lines) + No support for the C-style ternary operator + No support for the stringizing operator (#) + No support for the concatenation (token pasting) operator (##) + No support for variable number of macro arguments + +Add support for AMD Secure Processor Table (ASPT) version 1. +Add support for Arm's MPAM ACPI table version 2. +ACPI 6.5: MADT: add support for trace buffer extension in GICC. +Headers: Delete bogus NodeArray array of pointers from AEST table. +PHAT table support is still ongoing. + + +---------------------------------------- 20 October 2022. Summary of changes for version 20221020: This release is available at https://acpica.org/downloads diff --git a/source/common/dmextern.c b/source/common/dmextern.c index 3a413f43d..6827d5e5f 100644 --- a/source/common/dmextern.c +++ b/source/common/dmextern.c @@ -1493,7 +1493,6 @@ AcpiDmMarkExternalConflict ( ACPI_EXTERNAL_LIST *ExternalList = AcpiGbl_ExternalList; char *ExternalPath; char *InternalPath; - char *Temp; ACPI_STATUS Status; @@ -1526,13 +1525,6 @@ AcpiDmMarkExternalConflict ( while (ExternalList) { - Temp = ExternalList->InternalPath; - if ((*ExternalList->InternalPath == AML_ROOT_PREFIX) && - (ExternalList->InternalPath[1])) - { - Temp++; - } - if (!strcmp (ExternalList->InternalPath, InternalPath)) { ExternalList->Flags |= ACPI_EXT_CONFLICTING_DECLARATION; diff --git a/source/common/dmtable.c b/source/common/dmtable.c index 5b9fe6ef9..31ca73904 100644 --- a/source/common/dmtable.c +++ b/source/common/dmtable.c @@ -1400,7 +1400,7 @@ AcpiDmDumpTable ( AcpiOsPrintf ("%2.2X\n", (*Target >> 2) & 0xFF); break; - case ACPI_DMT_FLAGS4: + case ACPI_DMT_FLAGS4: AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03); break; diff --git a/source/common/dmtbdump2.c b/source/common/dmtbdump2.c index 7a0db3ef9..23f3238c8 100644 --- a/source/common/dmtbdump2.c +++ b/source/common/dmtbdump2.c @@ -2841,7 +2841,7 @@ AcpiDmDumpRhct ( AcpiOsPrintf ("Invalid subtable length\n"); return; } - SubtableOffset = Length; + SubtableOffset = (UINT8) Length; switch (Subtable->Type) { @@ -2875,7 +2875,7 @@ AcpiDmDumpRhct ( case ACPI_RHCT_NODE_TYPE_ISA_STRING: RhctIsaString = ACPI_ADD_PTR (ACPI_RHCT_ISA_STRING, Subtable, SubtableOffset); - IsaPadOffset = SubtableOffset + 2 + RhctIsaString->IsaLength; + IsaPadOffset = (UINT8) (SubtableOffset + 2 + RhctIsaString->IsaLength); Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, RhctIsaString, RhctIsaString->IsaLength, AcpiDmTableInfoRhctIsa1); if (Subtable->Length > IsaPadOffset) diff --git a/source/common/dmtbinfo1.c b/source/common/dmtbinfo1.c index 11cf67151..e4632085d 100644 --- a/source/common/dmtbinfo1.c +++ b/source/common/dmtbinfo1.c @@ -947,7 +947,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar4[] = { {ACPI_DMT_UINT24, ACPI_DMAR4_OFFSET (Reserved[0]), "Reserved", 0}, {ACPI_DMT_UINT8, ACPI_DMAR4_OFFSET (DeviceNumber), "Device Number", 0}, - {ACPI_DMT_STRING, ACPI_DMAR4_OFFSET (DeviceName[0]), "Device Name", 0}, + {ACPI_DMT_STRING, ACPI_DMAR4_OFFSET (u.DeviceName[0]), "Device Name", 0}, ACPI_DMT_TERMINATOR }; diff --git a/source/compiler/aslrestype2.c b/source/compiler/aslrestype2.c index 6a1c1cbed..bf6f77ed7 100644 --- a/source/compiler/aslrestype2.c +++ b/source/compiler/aslrestype2.c @@ -337,7 +337,7 @@ RsDoInterruptDescriptor ( Descriptor->ExtendedIrq.InterruptCount = 0; Rover = ACPI_CAST_PTR (AML_RESOURCE, - (&(Descriptor->ExtendedIrq.Interrupts[0]))); + (&(Descriptor->ExtendedIrq.u.Interrupts[0]))); /* Process all child initialization nodes */ @@ -466,7 +466,7 @@ RsDoInterruptDescriptor ( RsCreateDwordField (InitializerOp, ACPI_RESTAG_INTERRUPT, CurrentByteOffset + - ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0])); + ASL_RESDESC_OFFSET (ExtendedIrq.u.Interrupts[0])); } } @@ -494,7 +494,7 @@ RsDoInterruptDescriptor ( } Rnode->BufferLength = - (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) - + (ASL_RESDESC_OFFSET (ExtendedIrq.u.Interrupts[0]) - ASL_RESDESC_OFFSET (ExtendedIrq.DescriptorType)) + OptionIndex + StringLength; return (Rnode); diff --git a/source/compiler/aslrestype2s.c b/source/compiler/aslrestype2s.c index cdb467ff1..054807964 100644 --- a/source/compiler/aslrestype2s.c +++ b/source/compiler/aslrestype2s.c @@ -1550,7 +1550,6 @@ RsDoPinFunctionDescriptor ( UINT16 PinListLength; UINT16 DescriptorSize; UINT32 CurrentByteOffset; - UINT32 PinCount = 0; UINT32 i; InitializerOp = Info->DescriptorTypeOp->Asl.Child; @@ -1668,15 +1667,10 @@ RsDoPinFunctionDescriptor ( default: /* * PINs come through here, repeatedly. Each PIN must be a WORD. - * NOTE: there is no "length" field for this, so from ACPI spec: - * The number of pins in the table can be calculated from: - * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2 - * (implies resource source must immediately follow the pin list.) * Name: _PIN */ *PinList = (UINT16) InitializerOp->Asl.Value.Integer; PinList++; - PinCount++; /* Case 8: First pin number in list */ @@ -1845,7 +1839,6 @@ RsDoPinConfigDescriptor ( UINT16 PinListLength; UINT16 DescriptorSize; UINT32 CurrentByteOffset; - UINT32 PinCount = 0; UINT32 i; InitializerOp = Info->DescriptorTypeOp->Asl.Child; @@ -1977,15 +1970,10 @@ RsDoPinConfigDescriptor ( default: /* * PINs come through here, repeatedly. Each PIN must be a WORD. - * NOTE: there is no "length" field for this, so from ACPI spec: - * The number of pins in the table can be calculated from: - * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2 - * (implies resource source must immediately follow the pin list.) * Name: _PIN */ *PinList = (UINT16) InitializerOp->Asl.Value.Integer; PinList++; - PinCount++; /* Case 8: First pin number in list */ @@ -2045,7 +2033,6 @@ RsDoPinGroupDescriptor ( UINT16 PinListLength; UINT16 DescriptorSize; UINT32 CurrentByteOffset; - UINT32 PinCount = 0; UINT32 i; InitializerOp = Info->DescriptorTypeOp->Asl.Child; @@ -2131,15 +2118,10 @@ RsDoPinGroupDescriptor ( default: /* * PINs come through here, repeatedly. Each PIN must be a WORD. - * NOTE: there is no "length" field for this, so from ACPI spec: - * The number of pins in the table can be calculated from: - * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2 - * (implies resource source must immediately follow the pin list.) * Name: _PIN */ *PinList = (UINT16) InitializerOp->Asl.Value.Integer; PinList++; - PinCount++; /* Case 3: First pin number in list */ diff --git a/source/compiler/dtfield.c b/source/compiler/dtfield.c index 32b5dba09..b2ba6693d 100644 --- a/source/compiler/dtfield.c +++ b/source/compiler/dtfield.c @@ -678,7 +678,7 @@ DtCompileFlag ( case ACPI_DMT_FLAGS8_2: - BitPosition = 2; + BitPosition = 2; BitLength = 8; break; diff --git a/source/compiler/dttable1.c b/source/compiler/dttable1.c index d03a8fd7c..8ffcb40dc 100644 --- a/source/compiler/dttable1.c +++ b/source/compiler/dttable1.c @@ -939,7 +939,7 @@ DtCompileCedt ( /* Look in buffer for the number of targets */ offset = (unsigned int) ACPI_OFFSET (ACPI_CEDT_CFMWS, InterleaveWays); dump = (unsigned char *) Subtable->Buffer - 4; /* place at beginning of cedt1 */ - max = 0x01 << dump[offset]; /* 2^max, so 0=1, 1=2, 2=4, 3=8. 8 is MAX */ + max = 0x01 << dump[offset]; /* 2^max, so 0=1, 1=2, 2=4, 3=8. 8 is MAX */ if (max > 8) max=1; /* Error in encoding Interleaving Ways. */ if (max == 1) /* if only one target, then break here. */ break; /* break if only one target. */ diff --git a/source/components/debugger/dbnames.c b/source/components/debugger/dbnames.c index 084a25287..040fed248 100644 --- a/source/components/debugger/dbnames.c +++ b/source/components/debugger/dbnames.c @@ -883,7 +883,7 @@ AcpiDbDisplayObjects ( if (!ObjTypeArg) { ObjectInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_OBJECT_INFO)); - + if (!ObjectInfo) return (AE_NO_MEMORY); diff --git a/source/components/disassembler/dmresrcl.c b/source/components/disassembler/dmresrcl.c index 75cafe5da..88d19036a 100644 --- a/source/components/disassembler/dmresrcl.c +++ b/source/components/disassembler/dmresrcl.c @@ -1112,7 +1112,7 @@ AcpiDmInterruptDescriptor ( { AcpiDmIndent (Level + 1); AcpiOsPrintf ("0x%8.8X,\n", - (UINT32) Resource->ExtendedIrq.Interrupts[i]); + (UINT32) Resource->ExtendedIrq.u.Interrupts[i]); } AcpiDmIndent (Level); diff --git a/source/components/events/evevent.c b/source/components/events/evevent.c index 7d10c16c1..913cbd143 100644 --- a/source/components/events/evevent.c +++ b/source/components/events/evevent.c @@ -438,7 +438,7 @@ AcpiEvFixedEventDispatch ( (void) AcpiWriteBitRegister ( AcpiGbl_FixedEventInfo[Event].EnableRegisterId, (Event == ACPI_EVENT_PCIE_WAKE) ? - ACPI_ENABLE_EVENT : ACPI_DISABLE_EVENT); + ACPI_ENABLE_EVENT : ACPI_DISABLE_EVENT); ACPI_ERROR ((AE_INFO, "No installed handler for fixed event - %s (%u), disabling", diff --git a/source/components/executer/exsystem.c b/source/components/executer/exsystem.c index 3f1deb14c..68a074be3 100644 --- a/source/components/executer/exsystem.c +++ b/source/components/executer/exsystem.c @@ -303,10 +303,10 @@ AcpiExSystemDoStall ( else { if (HowLongUs > 100) - { + { ACPI_WARNING ((AE_INFO, "Time parameter %u us > 100 us violating ACPI spec, please fix the firmware.", HowLongUs)); - } + } AcpiOsStall (HowLongUs); } diff --git a/source/components/hardware/hwsleep.c b/source/components/hardware/hwsleep.c index 80af628c9..d9bb8ae03 100644 --- a/source/components/hardware/hwsleep.c +++ b/source/components/hardware/hwsleep.c @@ -476,13 +476,14 @@ AcpiHwLegacyWake ( ACPI_CLEAR_STATUS); /* Enable pcie wake event if support */ - if ((AcpiGbl_FADT.Flags & ACPI_FADT_PCI_EXPRESS_WAKE)) { + if ((AcpiGbl_FADT.Flags & ACPI_FADT_PCI_EXPRESS_WAKE)) + { (void) AcpiWriteBitRegister ( - AcpiGbl_FixedEventInfo[ACPI_EVENT_PCIE_WAKE].EnableRegisterId, - ACPI_DISABLE_EVENT); + AcpiGbl_FixedEventInfo[ACPI_EVENT_PCIE_WAKE].EnableRegisterId, + ACPI_DISABLE_EVENT); (void) AcpiWriteBitRegister ( - AcpiGbl_FixedEventInfo[ACPI_EVENT_PCIE_WAKE].StatusRegisterId, - ACPI_CLEAR_STATUS); + AcpiGbl_FixedEventInfo[ACPI_EVENT_PCIE_WAKE].StatusRegisterId, + ACPI_CLEAR_STATUS); } AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WORKING); diff --git a/source/components/resources/rsaddr.c b/source/components/resources/rsaddr.c index 46f38bc7b..beee83803 100644 --- a/source/components/resources/rsaddr.c +++ b/source/components/resources/rsaddr.c @@ -431,13 +431,13 @@ AcpiRsGetAddressCommon ( ACPI_RESOURCE *Resource, AML_RESOURCE *Aml) { - ACPI_FUNCTION_ENTRY (); - /* Avoid undefined behavior: member access within misaligned address */ AML_RESOURCE_ADDRESS Address; memcpy(&Address, Aml, sizeof(Address)); + ACPI_FUNCTION_ENTRY(); + /* Validate the Resource Type */ if ((Address.ResourceType > 2) && diff --git a/source/components/resources/rscreate.c b/source/components/resources/rscreate.c index da0967ee8..583abe1a7 100644 --- a/source/components/resources/rscreate.c +++ b/source/components/resources/rscreate.c @@ -475,9 +475,9 @@ AcpiRsCreatePciRoutingTable ( /* Use *remaining* length of the buffer as max for pathname */ PathBuffer.Length = OutputBuffer->Length - - (UINT32) ((UINT8 *) UserPrt->Source - + (UINT32) ((UINT8 *) UserPrt->u.Source - (UINT8 *) OutputBuffer->Pointer); - PathBuffer.Pointer = UserPrt->Source; + PathBuffer.Pointer = UserPrt->u.Source; Status = AcpiNsHandleToPathname ( (ACPI_HANDLE) Node, &PathBuffer, FALSE); @@ -488,12 +488,12 @@ AcpiRsCreatePciRoutingTable ( /* +1 to include null terminator */ - UserPrt->Length += (UINT32) strlen (UserPrt->Source) + 1; + UserPrt->Length += (UINT32) strlen (UserPrt->u.Source) + 1; break; case ACPI_TYPE_STRING: - strcpy (UserPrt->Source, ObjDesc->String.Pointer); + strcpy (UserPrt->u.Source, ObjDesc->String.Pointer); /* * Add to the Length field the length of the string diff --git a/source/components/resources/rsdumpinfo.c b/source/components/resources/rsdumpinfo.c index f15b7b981..2801e0d77 100644 --- a/source/components/resources/rsdumpinfo.c +++ b/source/components/resources/rsdumpinfo.c @@ -182,7 +182,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpIrq[7] = {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity), "Polarity", AcpiGbl_LlDecode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Irq.Shareable), "Sharing", AcpiGbl_ShrDecode}, {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.InterruptCount), "Interrupt Count", NULL}, - {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.Interrupts[0]), "Interrupt List", NULL} + {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.u.Interrupts[0]), "Interrupt List", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpDma[6] = @@ -192,7 +192,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpDma[6] = {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Dma.BusMaster), "Mastering", AcpiGbl_BmDecode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Transfer), "Transfer Type", AcpiGbl_SizDecode}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Dma.ChannelCount), "Channel Count", NULL}, - {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.Channels[0]), "Channel List", NULL} + {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.u.Channels[0]), "Channel List", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpStartDpf[4] = @@ -327,7 +327,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[8] = {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Shareable), "Sharing", AcpiGbl_ShrDecode}, {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (ExtendedIrq.ResourceSource), NULL, NULL}, {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (ExtendedIrq.InterruptCount), "Interrupt Count", NULL}, - {ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.Interrupts[0]), "Interrupt List", NULL} + {ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.u.Interrupts[0]), "Interrupt List", NULL} }; ACPI_RSDUMP_INFO AcpiRsDumpGenericReg[6] = @@ -555,7 +555,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpPrt[5] = {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPrt), NULL, NULL}, {ACPI_RSD_UINT64, ACPI_PRT_OFFSET (Address), "Address", NULL}, {ACPI_RSD_UINT32, ACPI_PRT_OFFSET (Pin), "Pin", NULL}, - {ACPI_RSD_STRING, ACPI_PRT_OFFSET (Source[0]), "Source", NULL}, + {ACPI_RSD_STRING, ACPI_PRT_OFFSET (u.Source[0]), "Source", NULL}, {ACPI_RSD_UINT32, ACPI_PRT_OFFSET (SourceIndex), "Source Index", NULL} }; diff --git a/source/components/resources/rsirq.c b/source/components/resources/rsirq.c index c2d306aa2..10256c50b 100644 --- a/source/components/resources/rsirq.c +++ b/source/components/resources/rsirq.c @@ -171,7 +171,7 @@ ACPI_RSCONVERT_INFO AcpiRsGetIrq[9] = /* Get the IRQ mask (bytes 1:2) */ - {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.Interrupts[0]), + {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.u.Interrupts[0]), AML_OFFSET (Irq.IrqMask), ACPI_RS_OFFSET (Data.Irq.InterruptCount)}, @@ -227,7 +227,7 @@ ACPI_RSCONVERT_INFO AcpiRsSetIrq[14] = /* Convert interrupt list to 16-bit IRQ bitmask */ - {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.Interrupts[0]), + {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.u.Interrupts[0]), AML_OFFSET (Irq.IrqMask), ACPI_RS_OFFSET (Data.Irq.InterruptCount)}, @@ -345,14 +345,14 @@ ACPI_RSCONVERT_INFO AcpiRsConvertExtIrq[10] = /* Copy every IRQ in the table, each is 32 bits */ - {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.ExtendedIrq.Interrupts[0]), - AML_OFFSET (ExtendedIrq.Interrupts[0]), + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.ExtendedIrq.u.Interrupts[0]), + AML_OFFSET (ExtendedIrq.u.Interrupts[0]), 0}, /* Optional ResourceSource (Index and String) */ {ACPI_RSC_SOURCEX, ACPI_RS_OFFSET (Data.ExtendedIrq.ResourceSource), - ACPI_RS_OFFSET (Data.ExtendedIrq.Interrupts[0]), + ACPI_RS_OFFSET (Data.ExtendedIrq.u.Interrupts[0]), sizeof (AML_RESOURCE_EXTENDED_IRQ)} }; @@ -389,7 +389,7 @@ ACPI_RSCONVERT_INFO AcpiRsConvertDma[6] = /* DMA channel mask bits */ - {ACPI_RSC_BITMASK, ACPI_RS_OFFSET (Data.Dma.Channels[0]), + {ACPI_RSC_BITMASK, ACPI_RS_OFFSET (Data.Dma.u.Channels[0]), AML_OFFSET (Dma.DmaChannelMask), ACPI_RS_OFFSET (Data.Dma.ChannelCount)} }; diff --git a/source/components/tables/tbprint.c b/source/components/tables/tbprint.c index 13502ee1b..9fd5c7aac 100644 --- a/source/components/tables/tbprint.c +++ b/source/components/tables/tbprint.c @@ -294,4 +294,3 @@ AcpiTbPrintTableHeader ( LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision)); } } - diff --git a/source/include/acpixf.h b/source/include/acpixf.h index a23978c1f..a7d61033a 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -154,7 +154,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20221020 +#define ACPI_CA_VERSION 0x20230331 #include "acconfig.h" #include "actypes.h" diff --git a/source/include/acrestyp.h b/source/include/acrestyp.h index 0dab6ec7b..3065bdcee 100644 --- a/source/include/acrestyp.h +++ b/source/include/acrestyp.h @@ -293,7 +293,7 @@ typedef struct acpi_resource_irq union { UINT8 Interrupt; ACPI_FLEX_ARRAY(UINT8, Interrupts); - }; + } u; } ACPI_RESOURCE_IRQ; @@ -306,7 +306,7 @@ typedef struct acpi_resource_dma union { UINT8 Channel; ACPI_FLEX_ARRAY(UINT8, Channels); - }; + } u; } ACPI_RESOURCE_DMA; @@ -547,7 +547,7 @@ typedef struct acpi_resource_extended_irq union { UINT32 Interrupt; ACPI_FLEX_ARRAY(UINT32, Interrupts); - }; + } u; } ACPI_RESOURCE_EXTENDED_IRQ; @@ -951,7 +951,7 @@ typedef struct acpi_pci_routing_table union { char Pad[4]; /* pad to 64 bits so sizeof() works in all cases */ ACPI_FLEX_ARRAY(char, Source); - }; + } u; } ACPI_PCI_ROUTING_TABLE; #endif /* __ACRESTYP_H__ */ diff --git a/source/include/actbl1.h b/source/include/actbl1.h index cecd7edbe..1b115ae35 100644 --- a/source/include/actbl1.h +++ b/source/include/actbl1.h @@ -1222,7 +1222,7 @@ typedef struct acpi_dmar_andd union { char __pad; ACPI_FLEX_ARRAY(char, DeviceName); - }; + } u; } ACPI_DMAR_ANDD; diff --git a/source/include/amlresrc.h b/source/include/amlresrc.h index 05fa1505d..a8e288add 100644 --- a/source/include/amlresrc.h +++ b/source/include/amlresrc.h @@ -506,7 +506,7 @@ typedef struct aml_resource_extended_irq union { UINT32 Interrupt; ACPI_FLEX_ARRAY(UINT32, Interrupts); - }; + } u; /* ResSourceIndex, ResSource optional fields follow */ } AML_RESOURCE_EXTENDED_IRQ; diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h index a08311ddc..1fc692db8 100644 --- a/source/include/platform/acenv.h +++ b/source/include/platform/acenv.h @@ -358,6 +358,8 @@ #elif defined(_AED_EFI) || defined(_GNU_EFI) || defined(_EDK2_EFI) #include "acefi.h" +#elif defined(__ZEPHYR__) +#include "aczephyr.h" #else /* Unknown environment */ diff --git a/source/include/platform/aczephyr.h b/source/include/platform/aczephyr.h new file mode 100644 index 000000000..c1d411c35 --- /dev/null +++ b/source/include/platform/aczephyr.h @@ -0,0 +1,192 @@ +/******************************************************************************
+ *
+ * Module Name: aczephyr.h - OS specific defines, etc.
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2023, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************
+ *
+ * Alternatively, you may choose to be licensed under the terms of the
+ * following license:
+ *
+ * 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.
+ *
+ * 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 MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * 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 DAMAGE.
+ *
+ * Alternatively, you may choose to be licensed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ *****************************************************************************/
+
+#ifndef __ACZEPHYR_H__
+#define __ACZEPHYR_H__
+
+#define SEEK_SET FS_SEEK_SET
+#define SEEK_END FS_SEEK_END
+
+#define ACPI_MACHINE_WIDTH 64
+
+#define ACPI_NO_ERROR_MESSAGES
+#undef ACPI_DEBUG_OUTPUT
+#define ACPI_USE_SYSTEM_CLIBRARY
+#undef ACPI_DBG_TRACK_ALLOCATIONS
+#define ACPI_SINGLE_THREADED
+#define ACPI_USE_NATIVE_RSDP_POINTER
+
+#include <zephyr/kernel.h>
+#include <zephyr/device.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <zephyr/fs/fs.h>
+#include <zephyr/sys/printk.h>
+#include <zephyr/sys/__assert.h>
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiEnableDbgPrint
+ *
+ * PARAMETERS: Enable, - Enable/Disable debug print
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Enable/disable debug print
+ *
+ *****************************************************************************/
+
+void AcpiEnableDbgPrint (
+ bool Enable);
+#endif
diff --git a/source/os_specific/service_layers/oszephyr.c b/source/os_specific/service_layers/oszephyr.c new file mode 100644 index 000000000..cc5136f0d --- /dev/null +++ b/source/os_specific/service_layers/oszephyr.c @@ -0,0 +1,1151 @@ +/****************************************************************************** + * + * Module Name: oszephyr - Zephyr OSL + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2023, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + ***************************************************************************** + * + * Alternatively, you may choose to be licensed under the terms of the + * following license: + * + * 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. + * + * 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 MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * 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 DAMAGE. + * + * Alternatively, you may choose to be licensed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" +#include "acapps.h" +#include "aslcompiler.h" +#include <zephyr/arch/x86/efi.h> +#include <zephyr/drivers/pcie/pcie.h> +#include <zephyr/dt-bindings/interrupt-controller/intel-ioapic.h> +#include <zephyr/sys/__assert.h> + +#include <zephyr/logging/log.h> +LOG_MODULE_DECLARE(acpica, LOG_LEVEL_ERR); + +typedef void (*zephyr_irq_t)(const void *); + +#define ASL_MSG_BUFFER_SIZE (1024 * 128) + +/* Global varibles use from acpica lib. */ +BOOLEAN AslGbl_DoTemplates = FALSE; +BOOLEAN AslGbl_VerboseTemplates = FALSE; + +char AslGbl_MsgBuffer[ASL_MSG_BUFFER_SIZE]; +static BOOLEAN EnDbgPrint; + + +/****************************************************************************** + * + * FUNCTION: AcpiOsReadable + * + * PARAMETERS: Pointer - Area to be verified + * Length - Size of area + * + * RETURN: TRUE if readable for entire Length + * + * DESCRIPTION: Verify that a pointer is valid for reading + * + *****************************************************************************/ + +BOOLEAN +AcpiOsReadable ( + void *Pointer, + ACPI_SIZE Length) +{ + return (TRUE); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiEnableDbgPrint + * + * PARAMETERS: en, - Enable/Disable debug print + * + * RETURN: None + * + * DESCRIPTION: Formatted output + * + *****************************************************************************/ + +void +AcpiEnableDbgPrint ( + bool Enable) +{ + if (Enable) + { + EnDbgPrint = TRUE; + } + else + { + EnDbgPrint = FALSE; + } +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsPrintf + * + * PARAMETERS: Fmt, ... - Standard printf format + * + * RETURN: None + * + * DESCRIPTION: Formatted output + * + *****************************************************************************/ + +void ACPI_INTERNAL_VAR_XFACE +AcpiOsPrintf ( + const char *Fmt, + ...) +{ + va_list args; + + va_start (args, Fmt); + + if (EnDbgPrint) + { + printk (Fmt, args); + } + + va_end (args); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsGetLine + * + * PARAMETERS: Buffer - Where to return the command line + * BufferLength - Maximum Length of Buffer + * BytesRead - Where the actual byte count is returned + * + * RETURN: Status and actual bytes read + * + * DESCRIPTION: Formatted input with argument list pointer + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsGetLine ( + char *Buffer, + UINT32 BufferLength, + UINT32 *BytesRead) +{ + return (-1); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsAllocate + * + * PARAMETERS: Size - Amount to allocate, in bytes + * + * RETURN: Pointer to the new allocation. Null on error. + * + * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS. + * + *****************************************************************************/ + +void * +AcpiOsAllocate ( + ACPI_SIZE Size) +{ + return (k_malloc (Size)); +} + + +#ifdef USE_NATIVE_ALLOCATE_ZEROED +/****************************************************************************** + * + * FUNCTION: AcpiOsAllocateZeroed + * + * PARAMETERS: Size - Amount to allocate, in bytes + * + * RETURN: Pointer to the new allocation. Null on error. + * + * DESCRIPTION: Allocate and zero memory. Algorithm is dependent on the OS. + * + *****************************************************************************/ + +void * +AcpiOsAllocateZeroed ( + ACPI_SIZE Size) +{ + void *mem; + + mem = AcpiOsAllocate (Size); + + if (mem) + { + memset (mem, 0, Size); + } + + return (mem); +} +#endif + + +/****************************************************************************** + * + * FUNCTION: AcpiOsFree + * + * PARAMETERS: Mem - Pointer to previously allocated memory + * + * RETURN: None. + * + * DESCRIPTION: Free memory allocated via AcpiOsAllocate + * + *****************************************************************************/ + +void +AcpiOsFree ( + void *Mem) +{ + k_free (Mem); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsReadMemory + * + * PARAMETERS: Address - Physical Memory Address to read + * Value - Where Value is placed + * Width - Number of bits (8,16,32, or 64) + * + * RETURN: Value read from physical memory Address. Always returned + * as a 64-bit integer, regardless of the read Width. + * + * DESCRIPTION: Read data from a physical memory Address + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsReadMemory ( + ACPI_PHYSICAL_ADDRESS Address, + UINT64 *Value, + UINT32 Width) +{ + switch (Width) + { + case 8: + + *((UINT8 *) Value) = sys_read8 (Address); + break; + + case 16: + + *((UINT16 *) Value) = sys_read16 (Address); + break; + + case 32: + + *((UINT32 *) Value) = sys_read32 (Address); + break; + + case 64: + + *((UINT64 *) Value) = sys_read64 (Address); + break; + + default: + + return (AE_BAD_PARAMETER); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsWriteMemory + * + * PARAMETERS: Address - Physical Memory Address to write + * Value - Value to write + * Width - Number of bits (8,16,32, or 64) + * + * RETURN: None + * + * DESCRIPTION: Write data to a physical memory Address + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsWriteMemory ( + ACPI_PHYSICAL_ADDRESS Address, + UINT64 Value, + UINT32 Width) +{ + switch (Width) + { + case 8: + + sys_write8 ((UINT8) Value, Address); + break; + + case 16: + + sys_write16 ((UINT16) Value, Address); + break; + + case 32: + + sys_write32 ((UINT32) Value, Address); + break; + + case 64: + + sys_write64 ((UINT64) Value, Address); + break; + + default: + + return (AE_BAD_PARAMETER); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsReadPort + * + * PARAMETERS: Address - Address of I/O port/register to read + * Value - Where Value is placed + * Width - Number of bits + * + * RETURN: Value read from port + * + * DESCRIPTION: Read data from an I/O port or register + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsReadPort ( + ACPI_IO_ADDRESS Address, + UINT32 *Value, + UINT32 Width) +{ + + switch (Width) + { + case 8: + + *((UINT8 *) Value) = sys_in8 (Address); + break; + + case 16: + + *((UINT16 *) Value) = sys_in16 (Address); + break; + + case 32: + + *((UINT32 *) Value) = sys_in32 (Address); + break; + + case 64: + + *((UINT32 *) Value) = sys_in32 (Address); + *((UINT32 *) Value + 4) = sys_in32 (Address + 4); + break; + + default: + + return (AE_BAD_PARAMETER); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsWritePort + * + * PARAMETERS: Address - Address of I/O port/register to write + * Value - Value to write + * Width - Number of bits + * + * RETURN: None + * + * DESCRIPTION: Write data to an I/O port or register + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsWritePort ( + ACPI_IO_ADDRESS Address, + UINT32 Value, + UINT32 Width) +{ + + switch (Width) + { + case 8: + + sys_out8 ((UINT8) Value, Address); + break; + + case 16: + + sys_out16 ((UINT16) Value, Address); + break; + + case 32: + + sys_out32 ((UINT32) Value, Address); + break; + + case 64: + + sys_out32 ((UINT32) Value, Address); + sys_out32 ((UINT32) (Value + 4), (Address + 4)); + break; + + default: + + return (AE_BAD_PARAMETER); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsWritePciConfiguration + * + * PARAMETERS: PciId - Seg/Bus/Dev + * Register - Device Register + * Value - Value to be written + * Width - Number of bits + * + * RETURN: Status + * + * DESCRIPTION: Write data to PCI configuration space + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsWritePciConfiguration ( + ACPI_PCI_ID *PciId, + UINT32 Register, + UINT64 Value, + UINT32 Width) +{ + UINT32 value32; + pcie_bdf_t bdf = PCIE_BDF (PciId->Bus, PciId->Device, PciId->Function); + + + switch (Width) + { + case 8: + + value32 = pcie_conf_read (bdf, Register); + value32 = (value32 & 0xffffff00) | (UINT8) Value; + pcie_conf_write (bdf, Register, value32); + break; + + case 16: + + value32 = pcie_conf_read (bdf, Register); + value32 = (value32 & 0xffff0000) | (UINT16) Value; + pcie_conf_write (bdf, Register, value32); + break; + + case 32: + + pcie_conf_write (bdf, Register, (UINT32) Value); + break; + + case 64: + + pcie_conf_write (bdf, Register, (UINT32) Value); + pcie_conf_write (bdf, (Register + 4), (UINT32) (Value >> 32)); + break; + + default: + + return (AE_BAD_PARAMETER); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsReadPciConfiguration + * + * PARAMETERS: PciId - Seg/Bus/Dev + * Register - Device Register + * Value - Buffer Where Value is placed + * Width - Number of bits + * + * RETURN: Status + * + * DESCRIPTION: Read data from PCI configuration space + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsReadPciConfiguration ( + ACPI_PCI_ID *PciId, + UINT32 Register, + UINT64 *Value, + UINT32 Width) +{ + + pcie_bdf_t bdf = PCIE_BDF (PciId->Bus, PciId->Device, PciId->Function); + + switch (Width) + { + case 8: + + *((UINT8 *) Value) = (UINT8) pcie_conf_read (bdf, Register); + break; + + case 16: + + *((UINT16 *) Value) = (UINT16) pcie_conf_read (bdf, Register); + break; + + case 32: + + *((UINT32 *) Value) = (UINT32) pcie_conf_read (bdf, Register); + break; + + case 64: + + *((UINT32 *) Value) = (UINT32) pcie_conf_read (bdf, Register); + *((UINT32 *) Value + 1) = (UINT32) pcie_conf_read (bdf, (Register + 4)); + break; + + default: + + return (AE_BAD_PARAMETER); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsRedirectOutput + * + * PARAMETERS: Destination - An open file handle/pointer + * + * RETURN: None + * + * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf + * + *****************************************************************************/ + +void +AcpiOsRedirectOutput ( + void *Destination) +{ + +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsPredefinedOverride + * + * PARAMETERS: InitVal - Initial Value of the predefined object + * NewVal - The new Value for the object + * + * RETURN: Status, pointer to Value. Null pointer returned if not + * overriding. + * + * DESCRIPTION: Allow the OS to override predefined names + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsPredefinedOverride ( + const ACPI_PREDEFINED_NAMES *InitVal, + ACPI_STRING *NewVal) +{ + + if (!InitVal || !NewVal) + { + return (AE_BAD_PARAMETER); + } + + *NewVal = NULL; + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsTableOverride + * + * PARAMETERS: ExistingTable - Header of current table (probably firmware) + * NewTable - Where an entire new table is returned. + * + * RETURN: Status, pointer to new table. Null pointer returned if no + * table is available to override + * + * DESCRIPTION: Return a different version of a table if one is available + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsTableOverride ( + ACPI_TABLE_HEADER *ExistingTable, + ACPI_TABLE_HEADER **NewTable) +{ + + if (!ExistingTable || !NewTable) + { + return (AE_BAD_PARAMETER); + } + + *NewTable = NULL; + + return (AE_NO_ACPI_TABLES); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsGetRootPointer + * + * PARAMETERS: None + * + * RETURN: RSDP physical Address + * + * DESCRIPTION: Gets the root pointer (RSDP) + * + *****************************************************************************/ + +ACPI_PHYSICAL_ADDRESS +AcpiOsGetRootPointer ( + void) +{ + + LOG_DBG (""); + return ((ACPI_PHYSICAL_ADDRESS) efi_get_acpi_rsdp ()); +} + + +#ifndef ACPI_USE_NATIVE_MEMORY_MAPPING +/****************************************************************************** + * + * FUNCTION: AcpiOsMapMemory + * + * PARAMETERS: Where - Physical Address of memory to be mapped + * Length - How much memory to map + * + * RETURN: Pointer to mapped memory. Null on error. + * + * DESCRIPTION: Map physical memory into caller's Address space + * + *****************************************************************************/ + +void * +AcpiOsMapMemory ( + ACPI_PHYSICAL_ADDRESS Where, + ACPI_SIZE Length) +{ + uint8_t *VirtlAdd; + + LOG_DBG (""); + z_phys_map (&VirtlAdd, Where, Length, 0); + return ((void *) VirtlAdd); +} +#endif + + +/****************************************************************************** + * + * FUNCTION: AcpiOsUnmapMemory + * + * PARAMETERS: Where - Logical Address of memory to be unmapped + * Length - How much memory to unmap + * + * RETURN: None. + * + * DESCRIPTION: Delete a previously created mapping. Where and Length must + * correspond to a previous mapping exactly. + * + *****************************************************************************/ + +void +AcpiOsUnmapMemory ( + void *Where, + ACPI_SIZE Length) +{ + LOG_DBG (""); + z_phys_unmap (Where, Length); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsPhysicalTableOverride + * + * PARAMETERS: ExistingTable - Header of current table (probably firmware) + * NewAddress - Where new table Address is returned + * (Physical Address) + * NewTableLength - Where new table Length is returned + * + * RETURN: Status, Address/Length of new table. Null pointer returned + * if no table is available to override. + * + * DESCRIPTION: Returns AE_SUPPORT, function not used in user space. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsPhysicalTableOverride ( + ACPI_TABLE_HEADER *ExistingTable, + ACPI_PHYSICAL_ADDRESS *NewAddress, + UINT32 *NewTableLength) +{ + + LOG_DBG (""); + return (AE_SUPPORT); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsInitialize + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Init this OSL + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsInitialize ( + void) +{ + LOG_DBG (""); + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsStall + * + * PARAMETERS: Microseconds - Time to stall + * + * RETURN: None. Blocks until stall is completed. + * + * DESCRIPTION: Sleep at microsecond granularity + * + *****************************************************************************/ + +void +AcpiOsStall ( + UINT32 Microseconds) +{ + k_busy_wait (Microseconds); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsSleep + * + * PARAMETERS: Milliseconds - Time to sleep + * + * RETURN: None. Blocks until sleep is completed. + * + * DESCRIPTION: Sleep at millisecond granularity + * + *****************************************************************************/ + +void +AcpiOsSleep ( + UINT64 Milliseconds) +{ + k_msleep ((UINT32) Milliseconds); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsEnterSleep + * + * PARAMETERS: SleepState - Which sleep state to enter + * RegaValue - Register A Value + * RegbValue - Register B Value + * + * RETURN: Status + * + * DESCRIPTION: A hook before writing sleep registers to enter the sleep + * state. Return AE_CTRL_SKIP to skip further sleep register + * writes. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsEnterSleep ( + UINT8 SleepState, + UINT32 RegaValue, + UINT32 RegbValue) +{ + __ASSERT (FALSE, "function Not implemented"); + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsGetTimer + * + * PARAMETERS: None + * + * RETURN: Current ticks in 100-nanosecond units + * + * DESCRIPTION: Get the Value of a system timer + * + ******************************************************************************/ + +UINT64 +AcpiOsGetTimer ( + void) +{ + return (k_cycle_get_64 ()); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsInstallInterruptHandler + * + * PARAMETERS: InterruptNumber - Level handler should respond to. + * ServiceRoutine - Address of the ACPI interrupt handler + * Context - User context + * + * RETURN: Handle to the newly installed handler. + * + * DESCRIPTION: Install an interrupt handler. Used to install the ACPI + * OS-independent handler. + * + *****************************************************************************/ + +UINT32 +AcpiOsInstallInterruptHandler ( + UINT32 InterruptNumber, + ACPI_OSD_HANDLER ServiceRoutine, + void *Context) +{ + LOG_DBG (""); + irq_connect_dynamic (InterruptNumber, 3, (zephyr_irq_t) ServiceRoutine, Context, + IRQ_TYPE_LOWEST_LEVEL_LOW); + irq_enable (InterruptNumber); + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsRemoveInterruptHandler + * + * PARAMETERS: Handle - Returned when handler was installed + * + * RETURN: Status + * + * DESCRIPTION: Uninstalls an interrupt handler. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsRemoveInterruptHandler ( + UINT32 InterruptNumber, + ACPI_OSD_HANDLER ServiceRoutine) +{ + + LOG_DBG (""); + irq_disable (InterruptNumber); + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsSignal + * + * PARAMETERS: Function - ACPICA signal function code + * Info - Pointer to function-dependent structure + * + * RETURN: Status + * + * DESCRIPTION: Miscellaneous functions. Example implementation only. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsSignal ( + UINT32 Function, + void *Info) +{ + switch (Function) + { + case ACPI_SIGNAL_FATAL: + LOG_DBG ("ACPI_SIGNAL_FATAL error"); + break; + + case ACPI_SIGNAL_BREAKPOINT: + LOG_DBG ("ACPI_SIGNAL_BREAKPOINT"); + break; + + default: + break; + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: Spinlock/Semaphore interfaces + * + * DESCRIPTION: Map these interfaces to semaphore interfaces + * + *****************************************************************************/ + +#ifdef ACPI_SINGLE_THREADED +ACPI_STATUS +AcpiOsCreateLock ( + ACPI_SPINLOCK *OutHandle) +{ + LOG_DBG (""); + + return (AE_OK); +} + +void +AcpiOsDeleteLock ( + ACPI_SPINLOCK Handle) +{ + LOG_DBG (""); +} + +ACPI_CPU_FLAGS +AcpiOsAcquireLock ( + ACPI_SPINLOCK Handle) +{ + LOG_DBG (""); + return (0); +} + +void +AcpiOsReleaseLock ( + ACPI_SPINLOCK Handle, + ACPI_CPU_FLAGS Flags) +{ + LOG_DBG (""); +} + +ACPI_STATUS +AcpiOsCreateSemaphore ( + UINT32 MaxUnits, + UINT32 InitialUnits, + ACPI_HANDLE *OutHandle) +{ + *OutHandle = (ACPI_HANDLE) 1; + return (AE_OK); +} + +ACPI_STATUS +AcpiOsDeleteSemaphore ( + ACPI_HANDLE Handle) +{ + return (AE_OK); +} + +ACPI_STATUS +AcpiOsWaitSemaphore ( + ACPI_HANDLE Handle, + UINT32 Units, + UINT16 Timeout) +{ + return (AE_OK); +} + +ACPI_STATUS +AcpiOsSignalSemaphore ( + ACPI_HANDLE Handle, + UINT32 Units) +{ + return (AE_OK); +} + +ACPI_THREAD_ID +AcpiOsGetThreadId ( + void) +{ + LOG_DBG (""); + return (1); +} + +ACPI_STATUS +AcpiOsExecute ( + ACPI_EXECUTE_TYPE Type, + ACPI_OSD_EXEC_CALLBACK Function, + void *Context) +{ + Function (Context); + return (AE_OK); +} +#endif diff --git a/source/tools/acpisrc/asconvrt.c b/source/tools/acpisrc/asconvrt.c index ea97400a8..0027e45a9 100644 --- a/source/tools/acpisrc/asconvrt.c +++ b/source/tools/acpisrc/asconvrt.c @@ -1230,7 +1230,6 @@ AsTabify8 ( char *NewSubBuffer; char *CommentEnd = NULL; UINT32 SpaceCount = 0; - UINT32 Column = 0; UINT32 TabCount = 0; UINT32 LastLineTabCount = 0; UINT32 LastLineColumnStart = 0; @@ -1246,7 +1245,6 @@ AsTabify8 ( /* This is a standalone blank line */ FirstNonBlank = NULL; - Column = 0; SpaceCount = 0; TabCount = 0; SubBuffer++; @@ -1285,8 +1283,6 @@ AsTabify8 ( } } - Column++; - /* Check if we are in a comment */ if ((SubBuffer[0] == '*') && @@ -1379,7 +1375,6 @@ AsTabify8 ( FirstNonBlank = NULL; LastLineColumnStart = ThisColumnStart; - Column = 0; SpaceCount = 0; } else |