summaryrefslogtreecommitdiffstats
path: root/src/core/acpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/acpi.c')
-rw-r--r--src/core/acpi.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/core/acpi.c b/src/core/acpi.c
index d573d2e98..223765f76 100644
--- a/src/core/acpi.c
+++ b/src/core/acpi.c
@@ -18,7 +18,9 @@
FILE_LICENCE ( GPL2_OR_LATER );
+#include <errno.h>
#include <ipxe/acpi.h>
+#include <ipxe/interface.h>
/** @file
*
@@ -26,6 +28,13 @@ FILE_LICENCE ( GPL2_OR_LATER );
*
*/
+/******************************************************************************
+ *
+ * Utility functions
+ *
+ ******************************************************************************
+ */
+
/**
* Fix up ACPI table checksum
*
@@ -40,3 +49,37 @@ void acpi_fix_checksum ( struct acpi_description_header *acpi ) {
}
acpi->checksum -= sum;
}
+
+/******************************************************************************
+ *
+ * Interface methods
+ *
+ ******************************************************************************
+ */
+
+/**
+ * Describe object in an ACPI table
+ *
+ * @v intf Interface
+ * @v acpi ACPI table
+ * @v len Length of ACPI table
+ * @ret rc Return status code
+ */
+int acpi_describe ( struct interface *intf,
+ struct acpi_description_header *acpi, size_t len ) {
+ struct interface *dest;
+ acpi_describe_TYPE ( void * ) *op =
+ intf_get_dest_op ( intf, acpi_describe, &dest );
+ void *object = intf_object ( dest );
+ int rc;
+
+ if ( op ) {
+ rc = op ( object, acpi, len );
+ } else {
+ /* Default is to fail to describe */
+ rc = -EOPNOTSUPP;
+ }
+
+ intf_put ( dest );
+ return rc;
+}