acpi: Add an __ACPI__ preprocessor symbol
authorSimon Glass <sjg@chromium.org>
Wed, 8 Apr 2020 22:57:37 +0000 (16:57 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Thu, 16 Apr 2020 06:36:28 +0000 (14:36 +0800)
The ASL compiler cannot handle C structures and the like so needs some
sort of header guard around these.

We already have an __ASSEMBLY__ #define but it seems best to create a new
one for ACPI since the rules may be different.

Add the check to a few files that ACPI always includes.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
include/acpi/acpi_table.h
include/dm/acpi.h
scripts/Makefile.lib

index b4404a632c0c0db54f14074d8f8bcbd2a169a2ca..dd7489581366c340d1bd5235acc4299cbc9722b1 100644 (file)
@@ -21,6 +21,8 @@
 #define ACPI_RSDP_REV_ACPI_1_0 0
 #define ACPI_RSDP_REV_ACPI_2_0 2
 
+#if !defined(__ACPI__)
+
 /*
  * RSDP (Root System Description Pointer)
  * Note: ACPI 1.0 didn't have length, xsdt_address, and ext_checksum
@@ -389,6 +391,8 @@ struct __packed acpi_spcr {
        u32 reserved2;
 };
 
+#endif /* !__ACPI__*/
+
 #include <asm/acpi_table.h>
 
 #endif /* __ACPI_TABLE_H__ */
index ba0813fa21c20e0538fd718ed087dc5ab0b5d58f..49257914ffdfd6504d75c7271f7fc2ea37de8556 100644 (file)
@@ -22,6 +22,8 @@
 /* Length of an ACPI name string including nul terminator */
 #define ACPI_NAME_MAX  (ACPI_NAME_LEN + 1)
 
+#if !defined(__ACPI__)
+
 /**
  * struct acpi_ops - ACPI operations supported by driver model
  */
@@ -70,4 +72,6 @@ int acpi_get_name(const struct udevice *dev, char *out_name);
  */
 int acpi_copy_name(char *out_name, const char *name);
 
+#endif /* __ACPI__ */
+
 #endif
index 8decb0e451d4c29c6f1ec8ca7ae4d08e0f675e08..1c8cb7488f9680a19a227791e36e6885c8a48807 100644 (file)
@@ -437,8 +437,8 @@ ASL_TMP = $(patsubst %.c,%.asl.tmp,$@)
 
 quiet_cmd_acpi_c_asl= ASL     $<
 cmd_acpi_c_asl=         \
-       $(CPP) -x assembler-with-cpp -D__ASSEMBLY__ -P $(UBOOTINCLUDE) \
-               -o $(ASL_TMP) $< && \
+       $(CPP) -x assembler-with-cpp -D__ASSEMBLY__ -D__ACPI__ \
+               -P $(UBOOTINCLUDE) -o $(ASL_TMP) $< && \
        iasl -p $@ -tc $(ASL_TMP) $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \
        mv $(patsubst %.c,%.hex,$@) $@