Thread (1 message) 1 message, 1 author, 2003-02-05

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

DORMANTno replies

From: Ducrot Bruno <hidden>
Date: 2003-02-05 18:43:10

Hi!

This patch allow an OS vendor to be able to change some values of the
acpi_gbl_pre_defined_names global variable.

The main purpose actually is to override the \_OS part, in order
to test/try etc. when a DSDT was more specifically written for
some Redmond OSes.

In order to get it to work, OS must provide an acpi_os_predefined_override()
(or AcpiOsPredefinedOverride) function.
One example is at the end of this patch.

A patch using a bootarg in order to change the \_OS string for Linux follow.


--- linux/drivers/acpi/namespace/nsaccess.c	2003/02/05 14:25:40	1.1
+++ linux/drivers/acpi/namespace/nsaccess.c	2003/02/05 15:23:59
@@ -100,6 +100,16 @@
 		 * 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 @@
 			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 @@
 			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 @@
 				/*
 				 * 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 @@
 
 				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) {
 					/*
--- linux/include/acpi/acpiosxf.h	2003/02/05 15:15:11	1.1
+++ linux/include/acpi/acpiosxf.h	2003/02/05 15:25:08
@@ -93,6 +93,11 @@
 	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,
 	struct acpi_table_header        **new_table);





--- linux/drivers/acpi/osl.c	2003/01/31 18:12:52	1.1
+++ linux/drivers/acpi/osl.c	2003/02/05 15:42:43
@@ -198,6 +198,17 @@
 
 	*phys = virt_to_phys(virt);
 
+	return AE_OK;
+}
+
+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;
 	return AE_OK;
 }





-- 
Ducrot Bruno

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help