patch-2.4.22 linux-2.4.22/drivers/acpi/parser/psutils.c

Next file: linux-2.4.22/drivers/acpi/parser/pswalk.c
Previous file: linux-2.4.22/drivers/acpi/parser/pstree.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.21/drivers/acpi/parser/psutils.c linux-2.4.22/drivers/acpi/parser/psutils.c
@@ -1,47 +1,89 @@
 /******************************************************************************
  *
  * Module Name: psutils - Parser miscellaneous utilities (Parser only)
- *              $Revision: 44 $
  *
  *****************************************************************************/
 
 /*
- *  Copyright (C) 2000, 2001 R. Byron Moore
+ * Copyright (C) 2000 - 2003, R. Byron Moore
+ * All rights reserved.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
  */
 
 
-#include "acpi.h"
-#include "acparser.h"
-#include "amlcode.h"
+#include <acpi/acpi.h>
+#include <acpi/acparser.h>
+#include <acpi/amlcode.h>
+#include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_PARSER
-	 MODULE_NAME         ("psutils")
+	 ACPI_MODULE_NAME    ("psutils")
 
 
-#define PARSEOP_GENERIC     0x01
-#define PARSEOP_NAMED       0x02
-#define PARSEOP_DEFERRED    0x04
-#define PARSEOP_BYTELIST    0x08
-#define PARSEOP_IN_CACHE    0x80
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ps_create_scope_op
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      scope_op
+ *
+ * DESCRIPTION: Create a Scope and associated namepath op with the root name
+ *
+ ******************************************************************************/
+
+union acpi_parse_object *
+acpi_ps_create_scope_op (
+	void)
+{
+	union acpi_parse_object         *scope_op;
+
+
+	scope_op = acpi_ps_alloc_op (AML_SCOPE_OP);
+	if (!scope_op) {
+		return (NULL);
+	}
+
+
+	scope_op->named.name = ACPI_ROOT_NAME;
+	return (scope_op);
+}
 
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_ps_init_op
+ * FUNCTION:    acpi_ps_init_op
  *
  * PARAMETERS:  Op              - A newly allocated Op object
  *              Opcode          - Opcode to store in the Op
@@ -55,28 +97,23 @@
 
 void
 acpi_ps_init_op (
-	acpi_parse_object       *op,
-	u16                     opcode)
+	union acpi_parse_object         *op,
+	u16                             opcode)
 {
-	const acpi_opcode_info  *aml_op;
-
-
-	FUNCTION_ENTRY ();
-
+	ACPI_FUNCTION_ENTRY ();
 
-	op->data_type = ACPI_DESC_TYPE_PARSER;
-	op->opcode = opcode;
 
-	aml_op = acpi_ps_get_opcode_info (opcode);
+	op->common.data_type = ACPI_DESC_TYPE_PARSER;
+	op->common.aml_opcode = opcode;
 
-	DEBUG_ONLY_MEMBERS (STRNCPY (op->op_name, aml_op->name,
-			   sizeof (op->op_name)));
+	ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name,
+			(acpi_ps_get_opcode_info (opcode))->name, sizeof (op->common.aml_op_name)));
 }
 
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_ps_alloc_op
+ * FUNCTION:    acpi_ps_alloc_op
  *
  * PARAMETERS:  Opcode          - Opcode that will be stored in the new Op
  *
@@ -88,17 +125,17 @@
  *
  ******************************************************************************/
 
-acpi_parse_object*
+union acpi_parse_object*
 acpi_ps_alloc_op (
-	u16                     opcode)
+	u16                             opcode)
 {
-	acpi_parse_object       *op = NULL;
-	u32                     size;
-	u8                      flags;
-	const acpi_opcode_info  *op_info;
+	union acpi_parse_object         *op = NULL;
+	u32                             size;
+	u8                              flags;
+	const struct acpi_opcode_info   *op_info;
 
 
-	FUNCTION_ENTRY ();
+	ACPI_FUNCTION_ENTRY ();
 
 
 	op_info = acpi_ps_get_opcode_info (opcode);
@@ -106,33 +143,28 @@
 	/* Allocate the minimum required size object */
 
 	if (op_info->flags & AML_DEFER) {
-		size = sizeof (acpi_parse2_object);
-		flags = PARSEOP_DEFERRED;
+		size = sizeof (struct acpi_parse_obj_named);
+		flags = ACPI_PARSEOP_DEFERRED;
 	}
-
 	else if (op_info->flags & AML_NAMED) {
-		size = sizeof (acpi_parse2_object);
-		flags = PARSEOP_NAMED;
+		size = sizeof (struct acpi_parse_obj_named);
+		flags = ACPI_PARSEOP_NAMED;
 	}
-
 	else if (opcode == AML_INT_BYTELIST_OP) {
-		size = sizeof (acpi_parse2_object);
-		flags = PARSEOP_BYTELIST;
+		size = sizeof (struct acpi_parse_obj_named);
+		flags = ACPI_PARSEOP_BYTELIST;
 	}
-
 	else {
-		size = sizeof (acpi_parse_object);
-		flags = PARSEOP_GENERIC;
+		size = sizeof (struct acpi_parse_obj_common);
+		flags = ACPI_PARSEOP_GENERIC;
 	}
 
-
-	if (size == sizeof (acpi_parse_object)) {
+	if (size == sizeof (struct acpi_parse_obj_common)) {
 		/*
 		 * The generic op is by far the most common (16 to 1)
 		 */
 		op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE);
 	}
-
 	else {
 		op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE_EXT);
 	}
@@ -141,7 +173,7 @@
 
 	if (op) {
 		acpi_ps_init_op (op, opcode);
-		op->flags = flags;
+		op->common.flags = flags;
 	}
 
 	return (op);
@@ -150,7 +182,7 @@
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_ps_free_op
+ * FUNCTION:    acpi_ps_free_op
  *
  * PARAMETERS:  Op              - Op to be freed
  *
@@ -163,19 +195,18 @@
 
 void
 acpi_ps_free_op (
-	acpi_parse_object       *op)
+	union acpi_parse_object         *op)
 {
-	PROC_NAME ("Ps_free_op");
+	ACPI_FUNCTION_NAME ("ps_free_op");
 
 
-	if (op->opcode == AML_INT_RETURN_VALUE_OP) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Free retval op: %p\n", op));
+	if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
+		ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", op));
 	}
 
-	if (op->flags == PARSEOP_GENERIC) {
+	if (op->common.flags & ACPI_PARSEOP_GENERIC) {
 		acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE, op);
 	}
-
 	else {
 		acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE_EXT, op);
 	}
@@ -184,7 +215,7 @@
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_ps_delete_parse_cache
+ * FUNCTION:    acpi_ps_delete_parse_cache
  *
  * PARAMETERS:  None
  *
@@ -198,7 +229,7 @@
 acpi_ps_delete_parse_cache (
 	void)
 {
-	FUNCTION_TRACE ("Ps_delete_parse_cache");
+	ACPI_FUNCTION_TRACE ("ps_delete_parse_cache");
 
 
 	acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE);
@@ -221,7 +252,7 @@
  */
 u8
 acpi_ps_is_leading_char (
-	u32                     c)
+	u32                             c)
 {
 	return ((u8) (c == '_' || (c >= 'A' && c <= 'Z')));
 }
@@ -232,7 +263,7 @@
  */
 u8
 acpi_ps_is_prefix_char (
-	u32                     c)
+	u32                             c)
 {
 	return ((u8) (c == '\\' || c == '^'));
 }
@@ -243,19 +274,19 @@
  */
 u32
 acpi_ps_get_name (
-	acpi_parse_object       *op)
+	union acpi_parse_object         *op)
 {
 
 
 	/* The "generic" object has no name associated with it */
 
-	if (op->flags & PARSEOP_GENERIC) {
+	if (op->common.flags & ACPI_PARSEOP_GENERIC) {
 		return (0);
 	}
 
 	/* Only the "Extended" parse objects have a name */
 
-	return (((acpi_parse2_object *) op)->name);
+	return (op->named.name);
 }
 
 
@@ -264,16 +295,16 @@
  */
 void
 acpi_ps_set_name (
-	acpi_parse_object       *op,
-	u32                     name)
+	union acpi_parse_object         *op,
+	u32                             name)
 {
 
 	/* The "generic" object has no name associated with it */
 
-	if (op->flags & PARSEOP_GENERIC) {
+	if (op->common.flags & ACPI_PARSEOP_GENERIC) {
 		return;
 	}
 
-	((acpi_parse2_object *) op)->name = name;
+	op->named.name = name;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)