X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Facpi%2Fparser%2Fpsutils.c;h=d405387b74146790fe3ba2f671fb0ef681cb1643;hb=16c70f8c1b54b61c3b951b6fb220df250fe09b32;hp=e4b8a280e151f5b2123be7b46a1b6e36ba8637bf;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index e4b8a280e..d405387b7 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2004, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,15 +41,12 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include #include #include -#include #define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psutils") - +ACPI_MODULE_NAME("psutils") /******************************************************************************* * @@ -57,30 +54,24 @@ * * PARAMETERS: None * - * RETURN: scope_op + * RETURN: A new Scope object, null on failure * * 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 *acpi_ps_create_scope_op(void) { - union acpi_parse_object *scope_op; + union acpi_parse_object *scope_op; - - scope_op = acpi_ps_alloc_op (AML_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 @@ -88,36 +79,32 @@ acpi_ps_create_scope_op ( * PARAMETERS: Op - A newly allocated Op object * Opcode - Opcode to store in the Op * - * RETURN: Status + * RETURN: None * - * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on - * opcode + * DESCRIPTION: Initialize a parse (Op) object * ******************************************************************************/ -void -acpi_ps_init_op ( - union acpi_parse_object *op, - u16 opcode) +void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode) { - ACPI_FUNCTION_ENTRY (); - + ACPI_FUNCTION_ENTRY(); - op->common.data_type = ACPI_DESC_TYPE_PARSER; + op->common.descriptor_type = ACPI_DESC_TYPE_PARSER; op->common.aml_opcode = opcode; - ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name, - (acpi_ps_get_opcode_info (opcode))->name, sizeof (op->common.aml_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 * * PARAMETERS: Opcode - Opcode that will be stored in the new Op * - * RETURN: Pointer to the new Op. + * RETURN: Pointer to the new Op, null on failure * * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on * opcode. A cache of opcodes is available for the pure @@ -125,61 +112,49 @@ acpi_ps_init_op ( * ******************************************************************************/ -union acpi_parse_object* -acpi_ps_alloc_op ( - u16 opcode) +union acpi_parse_object *acpi_ps_alloc_op(u16 opcode) { - union acpi_parse_object *op = NULL; - u32 size; - u8 flags; - const struct acpi_opcode_info *op_info; - - - ACPI_FUNCTION_ENTRY (); + union acpi_parse_object *op; + const struct acpi_opcode_info *op_info; + u8 flags = ACPI_PARSEOP_GENERIC; + ACPI_FUNCTION_ENTRY(); - op_info = acpi_ps_get_opcode_info (opcode); + op_info = acpi_ps_get_opcode_info(opcode); - /* Allocate the minimum required size object */ + /* Determine type of parse_op required */ if (op_info->flags & AML_DEFER) { - size = sizeof (struct acpi_parse_obj_named); flags = ACPI_PARSEOP_DEFERRED; - } - else if (op_info->flags & AML_NAMED) { - size = sizeof (struct acpi_parse_obj_named); + } else if (op_info->flags & AML_NAMED) { flags = ACPI_PARSEOP_NAMED; - } - else if (opcode == AML_INT_BYTELIST_OP) { - size = sizeof (struct acpi_parse_obj_named); + } else if (opcode == AML_INT_BYTELIST_OP) { flags = ACPI_PARSEOP_BYTELIST; } - else { - size = sizeof (struct acpi_parse_obj_common); - flags = ACPI_PARSEOP_GENERIC; - } - 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); + /* Allocate the minimum required size object */ + + if (flags == ACPI_PARSEOP_GENERIC) { + + /* The generic op (default) is by far the most common (16 to 1) */ + + op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); + } else { + /* Extended parseop */ + + op = acpi_os_acquire_object(acpi_gbl_ps_node_ext_cache); } /* Initialize the Op */ if (op) { - acpi_ps_init_op (op, opcode); + acpi_ps_init_op(op, opcode); op->common.flags = flags; } return (op); } - /******************************************************************************* * * FUNCTION: acpi_ps_free_op @@ -193,51 +168,22 @@ acpi_ps_alloc_op ( * ******************************************************************************/ -void -acpi_ps_free_op ( - union acpi_parse_object *op) +void acpi_ps_free_op(union acpi_parse_object *op) { - ACPI_FUNCTION_NAME ("ps_free_op"); - + ACPI_FUNCTION_NAME(ps_free_op); if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", op)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", + op)); } if (op->common.flags & ACPI_PARSEOP_GENERIC) { - acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE, op); + (void)acpi_os_release_object(acpi_gbl_ps_node_cache, op); + } else { + (void)acpi_os_release_object(acpi_gbl_ps_node_ext_cache, op); } - else { - acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE_EXT, op); - } -} - - -/******************************************************************************* - * - * FUNCTION: acpi_ps_delete_parse_cache - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Free all objects that are on the parse cache list. - * - ******************************************************************************/ - -void -acpi_ps_delete_parse_cache ( - void) -{ - ACPI_FUNCTION_TRACE ("ps_delete_parse_cache"); - - - acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE); - acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE_EXT); - return_VOID; } - /******************************************************************************* * * FUNCTION: Utility functions @@ -246,38 +192,29 @@ acpi_ps_delete_parse_cache ( * ******************************************************************************/ - /* * Is "c" a namestring lead character? */ -u8 -acpi_ps_is_leading_char ( - u32 c) +u8 acpi_ps_is_leading_char(u32 c) { return ((u8) (c == '_' || (c >= 'A' && c <= 'Z'))); } - /* * Is "c" a namestring prefix character? */ -u8 -acpi_ps_is_prefix_char ( - u32 c) +u8 acpi_ps_is_prefix_char(u32 c) { return ((u8) (c == '\\' || c == '^')); } - /* * Get op's name (4-byte name segment) or 0 if unnamed */ -u32 -acpi_ps_get_name ( - union acpi_parse_object *op) +#ifdef ACPI_FUTURE_USAGE +u32 acpi_ps_get_name(union acpi_parse_object * op) { - /* The "generic" object has no name associated with it */ if (op->common.flags & ACPI_PARSEOP_GENERIC) { @@ -288,15 +225,12 @@ acpi_ps_get_name ( return (op->named.name); } - +#endif /* ACPI_FUTURE_USAGE */ /* * Set op's name */ -void -acpi_ps_set_name ( - union acpi_parse_object *op, - u32 name) +void acpi_ps_set_name(union acpi_parse_object *op, u32 name) { /* The "generic" object has no name associated with it */ @@ -307,4 +241,3 @@ acpi_ps_set_name ( op->named.name = name; } -