summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2023-02-07 12:45:00 -0800
committerGitHub <noreply@github.com>2023-02-07 12:45:00 -0800
commit0c9616eed6ae88da6a968e8228254a4eb117a5c6 (patch)
treecfa9dc09dcc58ef4eb203959d2379fb2e1a4ca4c
parent801ccce4d95d6403826951928bbf6918671525ba (diff)
parentd4a2c93198cdd9c6f4a83798345851fee96d5ca5 (diff)
downloadacpica-0c9616eed6ae88da6a968e8228254a4eb117a5c6.tar.gz
Merge pull request #822 from heatd/acpisrc-linux-fix
acpisrc Linux generation fix
-rw-r--r--source/include/actbl2.h22
-rw-r--r--source/include/actypes.h2
-rw-r--r--source/tools/acpisrc/asconvrt.c63
-rw-r--r--source/tools/acpisrc/astable.c5
4 files changed, 79 insertions, 13 deletions
diff --git a/source/include/actbl2.h b/source/include/actbl2.h
index 43895b370..6dc2efd0c 100644
--- a/source/include/actbl2.h
+++ b/source/include/actbl2.h
@@ -236,7 +236,7 @@ typedef struct acpi_table_aest
/* Common Subtable header - one per Node Structure (Subtable) */
-typedef struct acpi_aest_hdr
+typedef struct acpi_aest_hdr
{
UINT8 Type;
UINT16 Length;
@@ -267,7 +267,7 @@ typedef struct acpi_aest_hdr
/* 0: Processor Error */
-typedef struct acpi_aest_processor
+typedef struct acpi_aest_processor
{
UINT32 ProcessorId;
UINT8 ResourceType;
@@ -287,7 +287,7 @@ typedef struct acpi_aest_processor
/* 0R: Processor Cache Resource Substructure */
-typedef struct acpi_aest_processor_cache
+typedef struct acpi_aest_processor_cache
{
UINT32 CacheReference;
UINT32 Reserved;
@@ -303,7 +303,7 @@ typedef struct acpi_aest_processor_cache
/* 1R: Processor TLB Resource Substructure */
-typedef struct acpi_aest_processor_tlb
+typedef struct acpi_aest_processor_tlb
{
UINT32 TlbLevel;
UINT32 Reserved;
@@ -312,7 +312,7 @@ typedef struct acpi_aest_processor_tlb
/* 2R: Processor Generic Resource Substructure */
-typedef struct acpi_aest_processor_generic
+typedef struct acpi_aest_processor_generic
{
UINT32 Resource;
@@ -320,7 +320,7 @@ typedef struct acpi_aest_processor_generic
/* 1: Memory Error */
-typedef struct acpi_aest_memory
+typedef struct acpi_aest_memory
{
UINT32 SratProximityDomain;
@@ -328,7 +328,7 @@ typedef struct acpi_aest_memory
/* 2: Smmu Error */
-typedef struct acpi_aest_smmu
+typedef struct acpi_aest_smmu
{
UINT32 IortNodeReference;
UINT32 SubcomponentReference;
@@ -337,7 +337,7 @@ typedef struct acpi_aest_smmu
/* 3: Vendor Defined */
-typedef struct acpi_aest_vendor
+typedef struct acpi_aest_vendor
{
UINT32 AcpiHid;
UINT32 AcpiUid;
@@ -347,7 +347,7 @@ typedef struct acpi_aest_vendor
/* 4: Gic Error */
-typedef struct acpi_aest_gic
+typedef struct acpi_aest_gic
{
UINT32 InterfaceType;
UINT32 InstanceId;
@@ -365,7 +365,7 @@ typedef struct acpi_aest_gic
/* Node Interface Structure */
-typedef struct acpi_aest_node_interface
+typedef struct acpi_aest_node_interface
{
UINT8 Type;
UINT8 Reserved[3];
@@ -387,7 +387,7 @@ typedef struct acpi_aest_node_interface
/* Node Interrupt Structure */
-typedef struct acpi_aest_node_interrupt
+typedef struct acpi_aest_node_interrupt
{
UINT8 Type;
UINT8 Reserved[2];
diff --git a/source/include/actypes.h b/source/include/actypes.h
index 77fa92123..52d2d6dcf 100644
--- a/source/include/actypes.h
+++ b/source/include/actypes.h
@@ -1481,7 +1481,7 @@ typedef struct acpi_mem_space_context
} ACPI_MEM_SPACE_CONTEXT;
-typedef struct acpi_data_table_space_context
+typedef struct acpi_data_table_mapping
{
void *Pointer;
diff --git a/source/tools/acpisrc/asconvrt.c b/source/tools/acpisrc/asconvrt.c
index ffa33aa22..ea97400a8 100644
--- a/source/tools/acpisrc/asconvrt.c
+++ b/source/tools/acpisrc/asconvrt.c
@@ -1618,6 +1618,8 @@ AsInsertPrefix (
int TrailingSpaces;
char LowerKeyword[128];
int KeywordLength;
+ char *LineStart;
+ BOOLEAN FoundPrefix;
switch (Type)
@@ -1664,7 +1666,66 @@ AsInsertPrefix (
{
/* Make sure the keyword isn't already prefixed with the insert */
- if (!strncmp (SubString - InsertLength, InsertString, InsertLength))
+ /* We find the beginning of the line and try to find the InsertString
+ * from LineStart up to SubBuffer (our keyword). If it's not there,
+ * we assume it doesn't have a prefix; this is a limitation, as having
+ * a keyword on another line is absolutely valid C.
+ */
+
+ LineStart = SubString;
+ FoundPrefix = FALSE;
+
+ /* Find the start of the line */
+
+ while (LineStart > Buffer)
+ {
+ if (*LineStart == '\n')
+ {
+ LineStart++;
+ break;
+ }
+
+ LineStart--;
+ }
+
+ /* Try to find InsertString from the start of the line up to SubBuffer */
+ /* Note that this algorithm is a bit naive. */
+
+ while (SubBuffer > LineStart)
+ {
+ if (*LineStart != *InsertString)
+ {
+ LineStart++;
+ continue;
+ }
+
+ if (strncmp (LineStart++, InsertString, InsertLength))
+ {
+ continue;
+ }
+
+ FoundPrefix = TRUE;
+ LineStart += InsertLength - 1;
+
+ /* Now check if there's non-whitespace between InsertString and SubBuffer, as that
+ * means it's not a valid prefix in this case. */
+
+ while (LineStart != SubBuffer)
+ {
+ if (!strchr (" \t\r\n", *LineStart))
+ {
+ /* We found non-whitespace while traversing up to SubBuffer,
+ * so this isn't a prefix.
+ */
+ FoundPrefix = FALSE;
+ break;
+ }
+
+ LineStart++;
+ }
+ }
+
+ if (FoundPrefix)
{
/* Add spaces if not already at the end-of-line */
diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c
index 92fa54bc6..f12ea3e2e 100644
--- a/source/tools/acpisrc/astable.c
+++ b/source/tools/acpisrc/astable.c
@@ -306,6 +306,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"ACPI_CONVERSION_TABLE", SRC_TYPE_STRUCT},
{"ACPI_CPU_FLAGS", SRC_TYPE_SIMPLE},
{"ACPI_CREATE_FIELD_INFO", SRC_TYPE_STRUCT},
+ {"ACPI_DATA_TABLE_MAPPING", SRC_TYPE_STRUCT},
{"ACPI_DB_ARGUMENT_INFO", SRC_TYPE_STRUCT},
{"ACPI_DB_COMMAND_HELP", SRC_TYPE_STRUCT},
{"ACPI_DB_COMMAND_INFO", SRC_TYPE_STRUCT},
@@ -339,6 +340,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"ACPI_FIND_CONTEXT", SRC_TYPE_STRUCT},
{"ACPI_FIXED_EVENT_HANDLER", SRC_TYPE_STRUCT},
{"ACPI_FIXED_EVENT_INFO", SRC_TYPE_STRUCT},
+ {"ACPI_FFH_INFO", SRC_TYPE_STRUCT},
{"ACPI_GBL_EVENT_HANDLER", SRC_TYPE_SIMPLE},
{"ACPI_GENERIC_ADDRESS", SRC_TYPE_STRUCT},
{"ACPI_GENERIC_STATE", SRC_TYPE_UNION},
@@ -373,6 +375,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"ACPI_LPIT_HEADER", SRC_TYPE_STRUCT},
{"ACPI_LPIT_IO", SRC_TYPE_STRUCT},
{"ACPI_LPIT_NATIVE", SRC_TYPE_STRUCT},
+ {"ACPI_MEM_MAPPING", SRC_TYPE_STRUCT},
{"ACPI_MEM_SPACE_CONTEXT", SRC_TYPE_STRUCT},
{"ACPI_MEMORY_ATTRIBUTE", SRC_TYPE_STRUCT},
{"ACPI_MEMORY_LIST", SRC_TYPE_STRUCT},
@@ -649,6 +652,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"ACPI_TABLE_BGRT", SRC_TYPE_STRUCT},
{"ACPI_TABLE_BOOT", SRC_TYPE_STRUCT},
{"ACPI_TABLE_CCEL", SRC_TYPE_STRUCT},
+ {"ACPI_TABLE_CDAT", SRC_TYPE_STRUCT},
{"ACPI_TABLE_CEDT", SRC_TYPE_STRUCT},
{"ACPI_TABLE_CPEP", SRC_TYPE_STRUCT},
{"ACPI_TABLE_CSRT", SRC_TYPE_STRUCT},
@@ -959,6 +963,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"AH_ASL_KEYWORD", SRC_TYPE_STRUCT},
{"AH_DEVICE_ID", SRC_TYPE_STRUCT},
{"AH_PREDEFINED_NAME", SRC_TYPE_STRUCT},
+ {"AH_TABLE", SRC_TYPE_STRUCT},
{"AH_UUID", SRC_TYPE_STRUCT},
/* AcpiXtract utility */