[PATCH] [2/2] Allow override acpi_gbl_pre_defined_names (aka change that _OS).

Ducrot Bruno
2003-02-05T18:47:25Z

This is the linux part. It permit to pass a apci_os_name= boot args
in order to override the \_OS.

--- linux/drivers/acpi/osl.c 2003/02/05 15:51:26 1.5
+++ linux/drivers/acpi/osl.c 2003/02/05 18:09:21
@@ -201,6 +201,8 @@
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)
@@ -209,6 +211,9 @@
return AE_BAD_PARAMETER;

*new_val = NULL;
+ if (!memcmp (init_val->name, "_OS_", 4))
+ *new_val = acpi_os_name;
+
return AE_OK;
}

@@ -848,3 +853,28 @@

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);

Cheers,