/** Colour for debug messages */
#define colour FADT_SIGNATURE
+/** ACPI table finder
+ *
+ * May be overridden at link time to inject tables for testing.
+ */
+typeof ( acpi_find ) *acpi_finder __attribute__ (( weak )) = acpi_find;
+
/******************************************************************************
*
* Utility functions
acpi->checksum -= acpi_checksum ( virt_to_user ( acpi ) );
}
+/**
+ * Locate ACPI table
+ *
+ * @v signature Requested table signature
+ * @v index Requested index of table with this signature
+ * @ret table Table, or UNULL if not found
+ */
+userptr_t acpi_table ( uint32_t signature, unsigned int index ) {
+
+ return ( *acpi_finder ) ( signature, index );
+}
+
/**
* Locate ACPI table via RSDT
*
int rc;
/* Try DSDT first */
- fadt = acpi_find ( FADT_SIGNATURE, 0 );
+ fadt = acpi_table ( FADT_SIGNATURE, 0 );
if ( fadt ) {
copy_from_user ( &fadtab, fadt, 0, sizeof ( fadtab ) );
dsdt = phys_to_user ( fadtab.dsdt );
/* Try all SSDTs */
for ( i = 0 ; ; i++ ) {
- ssdt = acpi_find ( SSDT_SIGNATURE, i );
+ ssdt = acpi_table ( SSDT_SIGNATURE, i );
if ( ! ssdt )
break;
if ( ( rc = acpi_zsdt ( ssdt, signature, data,
acpi_name ( tag_signature ), tag_index, tag_offset, tag_len );
/* Locate ACPI table */
- table = acpi_find ( tag_signature, tag_index );
+ table = acpi_table ( tag_signature, tag_index );
if ( ! table )
return -ENOENT;
#define acpi_describe_TYPE( object_type ) \
typeof ( struct acpi_descriptor * ( object_type ) )
+extern userptr_t ( * acpi_finder ) ( uint32_t signature, unsigned int index );
+
extern void acpi_fix_checksum ( struct acpi_header *acpi );
+extern userptr_t acpi_table ( uint32_t signature, unsigned int index );
extern int acpi_extract ( uint32_t signature, void *data,
int ( * extract ) ( userptr_t zsdt, size_t len,
size_t offset, void *data ) );