summaryrefslogtreecommitdiffstats
path: root/src/core/acpi_settings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/acpi_settings.c')
-rw-r--r--src/core/acpi_settings.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/core/acpi_settings.c b/src/core/acpi_settings.c
index b9e2b7f61..8dc2a7fd8 100644
--- a/src/core/acpi_settings.c
+++ b/src/core/acpi_settings.c
@@ -22,6 +22,7 @@
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+FILE_SECBOOT ( PERMITTED );
/**
* @file
@@ -64,14 +65,15 @@ static int acpi_settings_applies ( struct settings *settings __unused,
static int acpi_settings_fetch ( struct settings *settings,
struct setting *setting,
void *data, size_t len ) {
- struct acpi_header acpi;
+ const struct acpi_header *acpi;
+ const uint8_t *src;
+ uint8_t *dst;
uint32_t tag_high;
uint32_t tag_low;
uint32_t tag_signature;
unsigned int tag_index;
size_t tag_offset;
size_t tag_len;
- userptr_t table;
size_t offset;
size_t max_len;
int delta;
@@ -88,15 +90,12 @@ static int acpi_settings_fetch ( struct settings *settings,
acpi_name ( tag_signature ), tag_index, tag_offset, tag_len );
/* Locate ACPI table */
- table = acpi_table ( tag_signature, tag_index );
- if ( ! table )
+ acpi = acpi_table ( tag_signature, tag_index );
+ if ( ! acpi )
return -ENOENT;
- /* Read table header */
- copy_from_user ( &acpi, table, 0, sizeof ( acpi ) );
-
/* Calculate starting offset and maximum available length */
- max_len = le32_to_cpu ( acpi.length );
+ max_len = le32_to_cpu ( acpi->length );
if ( tag_offset > max_len )
return -ENOENT;
offset = tag_offset;
@@ -115,10 +114,11 @@ static int acpi_settings_fetch ( struct settings *settings,
}
/* Read data */
+ src = ( ( ( const void * ) acpi ) + offset );
+ dst = data;
for ( i = 0 ; ( ( i < max_len ) && ( i < len ) ) ; i++ ) {
- copy_from_user ( data, table, offset, 1 );
- data++;
- offset += delta;
+ *(dst++) = *src;
+ src += delta;
}
/* Set type if not already specified */
@@ -157,5 +157,6 @@ static void acpi_settings_init ( void ) {
/** ACPI settings initialiser */
struct init_fn acpi_settings_init_fn __init_fn ( INIT_NORMAL ) = {
+ .name = "acpi",
.initialise = acpi_settings_init,
};