Commit 4f0d66b4 authored by Andy Grover's avatar Andy Grover

ACPI: Add ability to override predefined object values (Ducrot Bruno)

parent 53a56431
......@@ -100,6 +100,16 @@ acpi_ns_root_initialize (void)
* initial value, create the initial value.
*/
if (init_val->val) {
acpi_string val;
status = acpi_os_predefined_override(init_val, &val);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not override predefined %s\n", init_val->name));
}
if (val == NULL)
val = init_val->val;
/*
* Entry requests an initial value, allocate a
* descriptor for it.
......@@ -118,7 +128,7 @@ acpi_ns_root_initialize (void)
switch (init_val->type) {
case ACPI_TYPE_METHOD:
obj_desc->method.param_count =
(u8) ACPI_STRTOUL (init_val->val, NULL, 10);
(u8) ACPI_STRTOUL (val, NULL, 10);
obj_desc->common.flags |= AOPOBJ_DATA_VALID;
#if defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
......@@ -132,7 +142,7 @@ acpi_ns_root_initialize (void)
case ACPI_TYPE_INTEGER:
obj_desc->integer.value =
(acpi_integer) ACPI_STRTOUL (init_val->val, NULL, 10);
(acpi_integer) ACPI_STRTOUL (val, NULL, 10);
break;
......@@ -141,8 +151,8 @@ acpi_ns_root_initialize (void)
/*
* Build an object around the static string
*/
obj_desc->string.length = (u32) ACPI_STRLEN (init_val->val);
obj_desc->string.pointer = init_val->val;
obj_desc->string.length = (u32) ACPI_STRLEN (val);
obj_desc->string.pointer = val;
obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
break;
......@@ -151,7 +161,7 @@ acpi_ns_root_initialize (void)
obj_desc->mutex.node = new_node;
obj_desc->mutex.sync_level =
(u16) ACPI_STRTOUL (init_val->val, NULL, 10);
(u16) ACPI_STRTOUL (val, NULL, 10);
if (ACPI_STRCMP (init_val->name, "_GL_") == 0) {
/*
......
......@@ -203,6 +203,22 @@ acpi_os_get_physical_address(void *virt, acpi_physical_address *phys)
return AE_OK;
}
static char acpi_os_name[200] = ACPI_OS_NAME;
acpi_status
acpi_os_predefined_override (const struct acpi_predefined_names *init_val,
acpi_string *new_val)
{
if (!init_val || !new_val)
return AE_BAD_PARAMETER;
*new_val = NULL;
if (!memcmp (init_val->name, "_OS_", 4))
*new_val = acpi_os_name;
return AE_OK;
}
acpi_status
acpi_os_table_override (struct acpi_table_header *existing_table,
struct acpi_table_header **new_table)
......@@ -854,3 +870,28 @@ acpi_os_signal (
return AE_OK;
}
int __init
acpi_os_name_setup(char *str)
{
char *p = acpi_os_name;
int count = 199;
if (!str || !*str)
return 0;
for (; count-- && str && *str; str++) {
if (isalnum(*str) || *str == ' ')
*p++ = *str;
else if (*str == '\'' || *str == '"')
continue;
else
break;
}
*p = 0;
return 1;
}
__setup("acpi_os_name=", acpi_os_name_setup);
......@@ -29,8 +29,8 @@
#ifndef __ACPIOSXF_H__
#define __ACPIOSXF_H__
#include <acpi/platform/acenv.h>
#include <acpi/actypes.h>
#include "platform/acenv.h"
#include "actypes.h"
/* Priorities for acpi_os_queue_for_execution */
......@@ -92,6 +92,11 @@ acpi_os_get_root_pointer (
u32 flags,
struct acpi_pointer *address);
acpi_status
acpi_os_predefined_override (
const struct acpi_predefined_names *init_val,
acpi_string *new_val);
acpi_status
acpi_os_table_override (
struct acpi_table_header *existing_table,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment