Merge https://gitlab.denx.de/u-boot/custodians/u-boot-spi
[platform/kernel/u-boot.git] / include / dm / acpi.h
index 4925791..7563a4c 100644 (file)
 #if !defined(__ACPI__)
 
 /**
+ * struct acpi_ctx - Context used for writing ACPI tables
+ *
+ * This contains a few useful pieces of information used when writing
+ *
+ * @current: Current address for writing
+ * @rsdp: Pointer to the Root System Description Pointer, typically used when
+ *     adding a new table. The RSDP holds pointers to the RSDT and XSDT.
+ * @rsdt: Pointer to the Root System Description Table
+ * @xsdt: Pointer to the Extended System Description Table
+ */
+struct acpi_ctx {
+       void *current;
+       struct acpi_rsdp *rsdp;
+       struct acpi_rsdt *rsdt;
+       struct acpi_xsdt *xsdt;
+};
+
+/**
  * struct acpi_ops - ACPI operations supported by driver model
  */
 struct acpi_ops {
@@ -38,6 +56,15 @@ struct acpi_ops {
         *      other error
         */
        int (*get_name)(const struct udevice *dev, char *out_name);
+
+       /**
+        * write_tables() - Write out any tables required by this device
+        *
+        * @dev: Device to write
+        * @ctx: ACPI context to use
+        * @return 0 if OK, -ve on error
+        */
+       int (*write_tables)(const struct udevice *dev, struct acpi_ctx *ctx);
 };
 
 #define device_get_acpi_ops(dev)       ((dev)->driver->acpi_ops)
@@ -72,6 +99,16 @@ int acpi_get_name(const struct udevice *dev, char *out_name);
  */
 int acpi_copy_name(char *out_name, const char *name);
 
+/**
+ * acpi_write_dev_tables() - Write ACPI tables required by devices
+ *
+ * This scans through all devices and tells them to write any tables they want
+ * to write.
+ *
+ * @return 0 if OK, -ve if any device returned an error
+ */
+int acpi_write_dev_tables(struct acpi_ctx *ctx);
+
 #endif /* __ACPI__ */
 
 #endif