From 4f0d66b4e9afab3e9830a658bedfbf79b34cfd89 Mon Sep 17 00:00:00 2001 From: Andy Grover Date: Mon, 17 Feb 2003 22:34:37 -0800 Subject: ACPI: Add ability to override predefined object values (Ducrot Bruno) --- drivers/acpi/namespace/nsaccess.c | 20 ++++++++++++++----- drivers/acpi/osl.c | 41 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index dd13719395a0..3d88fcbf47f5 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c @@ -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) { /* diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index ebade180041c..0bf367d340fc 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -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); -- cgit v1.2.3