[acpi] Make acpi_find_rsdt() a per-platform method

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2017-05-22 19:27:30 +01:00
parent ee9897fe64
commit 933e6dadc0
11 changed files with 265 additions and 103 deletions

View File

@@ -16,6 +16,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/interface.h>
#include <ipxe/uaccess.h>
#include <ipxe/tables.h>
#include <ipxe/api.h>
#include <config/general.h>
/**
* An ACPI description header
@@ -89,18 +91,6 @@ struct acpi_rsdp {
uint32_t rsdt;
} __attribute__ (( packed ));
/** EBDA RSDP length */
#define RSDP_EBDA_LEN 0x400
/** Fixed BIOS area RSDP start address */
#define RSDP_BIOS_START 0xe0000
/** Fixed BIOS area RSDP length */
#define RSDP_BIOS_LEN 0x20000
/** Stride at which to search for RSDP */
#define RSDP_STRIDE 16
/** Root System Description Table (RSDT) signature */
#define RSDT_SIGNATURE ACPI_SIGNATURE ( 'R', 'S', 'D', 'T' )
@@ -194,16 +184,56 @@ struct acpi_model {
/** Declare an ACPI model */
#define __acpi_model __table_entry ( ACPI_MODELS, 01 )
/**
* Calculate static inline ACPI API function name
*
* @v _prefix Subsystem prefix
* @v _api_func API function
* @ret _subsys_func Subsystem API function
*/
#define ACPI_INLINE( _subsys, _api_func ) \
SINGLE_API_INLINE ( ACPI_PREFIX_ ## _subsys, _api_func )
/**
* Provide an ACPI API implementation
*
* @v _prefix Subsystem prefix
* @v _api_func API function
* @v _func Implementing function
*/
#define PROVIDE_ACPI( _subsys, _api_func, _func ) \
PROVIDE_SINGLE_API ( ACPI_PREFIX_ ## _subsys, _api_func, _func )
/**
* Provide a static inline ACPI API implementation
*
* @v _prefix Subsystem prefix
* @v _api_func API function
*/
#define PROVIDE_ACPI_INLINE( _subsys, _api_func ) \
PROVIDE_SINGLE_API_INLINE ( ACPI_PREFIX_ ## _subsys, _api_func )
/* Include all architecture-independent ACPI API headers */
#include <ipxe/null_acpi.h>
/* Include all architecture-dependent ACPI API headers */
#include <bits/acpi.h>
/**
* Locate ACPI root system description table
*
* @ret rsdt ACPI root system description table, or UNULL
*/
userptr_t acpi_find_rsdt ( void );
extern struct acpi_descriptor *
acpi_describe ( struct interface *interface );
#define acpi_describe_TYPE( object_type ) \
typeof ( struct acpi_descriptor * ( object_type ) )
extern void acpi_fix_checksum ( struct acpi_header *acpi );
extern userptr_t acpi_find_rsdt ( userptr_t ebda );
extern userptr_t acpi_find ( userptr_t rsdt, uint32_t signature,
unsigned int index );
extern int acpi_sx ( userptr_t rsdt, uint32_t signature );
extern userptr_t acpi_find ( uint32_t signature, unsigned int index );
extern int acpi_sx ( uint32_t signature );
extern void acpi_add ( struct acpi_descriptor *desc );
extern void acpi_del ( struct acpi_descriptor *desc );
extern int acpi_install ( int ( * install ) ( struct acpi_header *acpi ) );

View File

@@ -0,0 +1,23 @@
#ifndef _IPXE_NULL_ACPI_H
#define _IPXE_NULL_ACPI_H
/** @file
*
* Standard do-nothing ACPI interface
*
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#ifdef ACPI_NULL
#define ACPI_PREFIX_null
#else
#define ACPI_PREFIX_null __null_
#endif
static inline __always_inline userptr_t
ACPI_INLINE ( null, acpi_find_rsdt ) ( void ) {
return UNULL;
}
#endif /* _IPXE_NULL_ACPI_H */