mirror of
https://github.com/ipxe/ipxe
synced 2026-01-28 20:12:28 +03:00
[acpi] Remove userptr_t from ACPI table parsing
Simplify the ACPI table parsing code by assuming that all table content is fully accessible via pointer dereferences. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -14,7 +14,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#include <ipxe/refcnt.h>
|
||||
#include <ipxe/list.h>
|
||||
#include <ipxe/interface.h>
|
||||
#include <ipxe/uaccess.h>
|
||||
#include <ipxe/tables.h>
|
||||
#include <ipxe/api.h>
|
||||
#include <config/general.h>
|
||||
@@ -355,7 +354,8 @@ struct acpi_model {
|
||||
#define PROVIDE_ACPI_INLINE( _subsys, _api_func ) \
|
||||
PROVIDE_SINGLE_API_INLINE ( ACPI_PREFIX_ ## _subsys, _api_func )
|
||||
|
||||
extern userptr_t acpi_find_via_rsdt ( uint32_t signature, unsigned int index );
|
||||
extern const struct acpi_header * acpi_find_via_rsdt ( uint32_t signature,
|
||||
unsigned int index );
|
||||
|
||||
/* Include all architecture-independent ACPI API headers */
|
||||
#include <ipxe/null_acpi.h>
|
||||
@@ -368,31 +368,35 @@ extern userptr_t acpi_find_via_rsdt ( uint32_t signature, unsigned int index );
|
||||
/**
|
||||
* Locate ACPI root system description table
|
||||
*
|
||||
* @ret rsdt ACPI root system description table, or UNULL
|
||||
* @ret rsdt ACPI root system description table, or NULL
|
||||
*/
|
||||
userptr_t acpi_find_rsdt ( void );
|
||||
const struct acpi_rsdt * acpi_find_rsdt ( void );
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @ret table Table, or NULL if not found
|
||||
*/
|
||||
userptr_t acpi_find ( uint32_t signature, unsigned int index );
|
||||
const struct acpi_header * acpi_find ( uint32_t signature,
|
||||
unsigned int index );
|
||||
|
||||
extern struct acpi_descriptor *
|
||||
acpi_describe ( struct interface *interface );
|
||||
#define acpi_describe_TYPE( object_type ) \
|
||||
typeof ( struct acpi_descriptor * ( object_type ) )
|
||||
|
||||
extern userptr_t ( * acpi_finder ) ( uint32_t signature, unsigned int index );
|
||||
extern const struct acpi_header * ( * 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 const struct acpi_header * 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 ) );
|
||||
int ( * extract ) ( const struct acpi_header *zsdt,
|
||||
size_t len, size_t offset,
|
||||
void *data ) );
|
||||
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 ) );
|
||||
|
||||
@@ -20,9 +20,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
*
|
||||
* @v signature Requested table signature
|
||||
* @v index Requested index of table with this signature
|
||||
* @ret table Table, or UNULL if not found
|
||||
* @ret table Table, or NULL if not found
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) userptr_t
|
||||
static inline __attribute__ (( always_inline )) const struct acpi_header *
|
||||
ACPI_INLINE ( efi, acpi_find ) ( uint32_t signature, unsigned int index ) {
|
||||
|
||||
return acpi_find_via_rsdt ( signature, index );
|
||||
|
||||
@@ -9,17 +9,19 @@
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef ACPI_NULL
|
||||
#define ACPI_PREFIX_null
|
||||
#else
|
||||
#define ACPI_PREFIX_null __null_
|
||||
#endif
|
||||
|
||||
static inline __attribute__ (( always_inline )) userptr_t
|
||||
static inline __attribute__ (( always_inline )) const struct acpi_header *
|
||||
ACPI_INLINE ( null, acpi_find ) ( uint32_t signature __unused,
|
||||
unsigned int index __unused ) {
|
||||
|
||||
return UNULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* _IPXE_NULL_ACPI_H */
|
||||
|
||||
Reference in New Issue
Block a user