ACPICA: Consolidate method arg count validation code
[safe/jmp/linux-2.6] / include / acpi / aclocal.h
index 0f12fec..0323fa9 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2006, R. Byron Moore
+ * Copyright (C) 2000 - 2008, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -98,8 +98,8 @@ union acpi_parse_object;
 
 static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = {
        "ACPI_MTX_Interpreter",
-       "ACPI_MTX_Tables",
        "ACPI_MTX_Namespace",
+       "ACPI_MTX_Tables",
        "ACPI_MTX_Events",
        "ACPI_MTX_Caches",
        "ACPI_MTX_Memory",
@@ -162,7 +162,7 @@ struct acpi_mutex_info {
 typedef enum {
        ACPI_IMODE_LOAD_PASS1 = 0x01,
        ACPI_IMODE_LOAD_PASS2 = 0x02,
-       ACPI_IMODE_EXECUTE = 0x0E
+       ACPI_IMODE_EXECUTE = 0x03
 } acpi_interpreter_mode;
 
 union acpi_name_union {
@@ -204,10 +204,11 @@ struct acpi_namespace_node {
 /* Namespace Node flags */
 
 #define ANOBJ_END_OF_PEER_LIST          0x01   /* End-of-list, Peer field points to parent */
-#define ANOBJ_RESERVED                  0x02   /* Available for future use */
+#define ANOBJ_TEMPORARY                 0x02   /* Node is create by a method and is temporary */
 #define ANOBJ_METHOD_ARG                0x04   /* Node is a method argument */
 #define ANOBJ_METHOD_LOCAL              0x08   /* Node is a method local */
 #define ANOBJ_SUBTREE_HAS_INI           0x10   /* Used to optimize device initialization */
+#define ANOBJ_EVALUATED                 0x20   /* Set on first evaluation of node */
 
 #define ANOBJ_IS_EXTERNAL               0x08   /* i_aSL only: This object created via External() */
 #define ANOBJ_METHOD_NO_RETVAL          0x10   /* i_aSL only: Method has no return value */
@@ -227,6 +228,16 @@ struct acpi_table_desc {
        u8 flags;
 };
 
+/* Flags for above */
+
+#define ACPI_TABLE_ORIGIN_UNKNOWN       (0)
+#define ACPI_TABLE_ORIGIN_MAPPED        (1)
+#define ACPI_TABLE_ORIGIN_ALLOCATED     (2)
+#define ACPI_TABLE_ORIGIN_MASK          (3)
+#define ACPI_TABLE_IS_LOADED            (4)
+
+/* One internal RSDT for table management */
+
 struct acpi_internal_rsdt {
        struct acpi_table_desc *tables;
        u32 count;
@@ -234,14 +245,11 @@ struct acpi_internal_rsdt {
        u8 flags;
 };
 
-/* Flags for both structs above */
+/* Flags for above */
 
-#define ACPI_TABLE_ORIGIN_UNKNOWN       (0)
-#define ACPI_TABLE_ORIGIN_MAPPED        (1)
-#define ACPI_TABLE_ORIGIN_ALLOCATED     (2)
-#define ACPI_TABLE_ORIGIN_MASK          (3)
-#define ACPI_TABLE_FLAGS_LOADED         (4)
-#define ACPI_TABLE_FLAGS_ALLOW_RESIZE   (8)
+#define ACPI_ROOT_ORIGIN_UNKNOWN        (0)    /* ~ORIGIN_ALLOCATED */
+#define ACPI_ROOT_ORIGIN_ALLOCATED      (1)
+#define ACPI_ROOT_ALLOW_RESIZE          (2)
 
 /* Predefined (fixed) table indexes */
 
@@ -275,8 +283,8 @@ struct acpi_predefined_names {
 /* Info structure used to convert external<->internal namestrings */
 
 struct acpi_namestring_info {
-       char *external_name;
-       char *next_external_char;
+       const char *external_name;
+       const char *next_external_char;
        char *internal_name;
        u32 length;
        u32 num_segments;
@@ -333,6 +341,82 @@ acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
 #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF     /* ARG or LOCAL */
 #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
 
+/*
+ * Information structure for ACPI predefined names.
+ * Each entry in the table contains the following items:
+ *
+ * Name                 - The ACPI reserved name
+ * param_count          - Number of arguments to the method
+ * expected_return_btypes - Allowed type(s) for the return value
+ */
+struct acpi_name_info {
+       char name[ACPI_NAME_SIZE];
+       u8 param_count;
+       u8 expected_btypes;
+};
+
+/*
+ * Secondary information structures for ACPI predefined objects that return
+ * package objects. This structure appears as the next entry in the table
+ * after the NAME_INFO structure above.
+ *
+ * The reason for this is to minimize the size of the predefined name table.
+ */
+
+/*
+ * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
+ * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT
+ */
+struct acpi_package_info {
+       u8 type;
+       u8 object_type1;
+       u8 count1;
+       u8 object_type2;
+       u8 count2;
+       u8 reserved;
+};
+
+/* Used for ACPI_PTYPE2_FIXED */
+
+struct acpi_package_info2 {
+       u8 type;
+       u8 count;
+       u8 object_type[4];
+};
+
+/* Used for ACPI_PTYPE1_OPTION */
+
+struct acpi_package_info3 {
+       u8 type;
+       u8 count;
+       u8 object_type[2];
+       u8 tail_object_type;
+       u8 reserved;
+};
+
+union acpi_predefined_info {
+       struct acpi_name_info info;
+       struct acpi_package_info ret_info;
+       struct acpi_package_info2 ret_info2;
+       struct acpi_package_info3 ret_info3;
+};
+
+/*
+ * Bitmapped return value types
+ * Note: the actual data types must be contiguous, a loop in nspredef.c
+ * depends on this.
+ */
+#define ACPI_RTYPE_ANY                  0x00
+#define ACPI_RTYPE_NONE                 0x01
+#define ACPI_RTYPE_INTEGER              0x02
+#define ACPI_RTYPE_STRING               0x04
+#define ACPI_RTYPE_BUFFER               0x08
+#define ACPI_RTYPE_PACKAGE              0x10
+#define ACPI_RTYPE_REFERENCE            0x20
+#define ACPI_RTYPE_ALL                  0x3F
+
+#define ACPI_NUM_RTYPES                 5      /* Number of actual object types */
+
 /*****************************************************************************
  *
  * Event typedefs and structs
@@ -360,7 +444,7 @@ struct acpi_gpe_event_info {
        union acpi_gpe_dispatch_info dispatch;  /* Either Method or Handler */
        struct acpi_gpe_register_info *register_info;   /* Backpointer to register info */
        u8 flags;               /* Misc info about this GPE */
-       u8 register_bit;        /* This GPE bit within the register */
+       u8 gpe_number;          /* This GPE */
 };
 
 /* Information about a GPE register pair, one per each status/enable pair in an array */
@@ -482,6 +566,7 @@ struct acpi_control_state {
        union acpi_parse_object *predicate_op;
        u8 *aml_predicate_start;        /* Start of if/while predicate */
        u8 *package_end;        /* End of if/while block */
+       u32 loop_count;         /* While() loop counter */
 };
 
 /*
@@ -515,9 +600,8 @@ struct acpi_thread_state {
  * AML arguments
  */
 struct acpi_result_values {
-       ACPI_STATE_COMMON u8 num_results;
-       u8 last_insert;
-       union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS];
+       ACPI_STATE_COMMON
+           union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM];
 };
 
 typedef
@@ -597,6 +681,7 @@ union acpi_parse_value {
        union acpi_parse_object         *next;          /* Next op */\
        struct acpi_namespace_node      *node;          /* For use by interpreter */\
        union acpi_parse_value          value;          /* Value or args associated with the opcode */\
+       u8                              arg_list_length; /* Number of elements in the arg list */\
        ACPI_DISASM_ONLY_MEMBERS (\
        u8                              disasm_flags;   /* Used during AML disassembly */\
        u8                              disasm_opcode;  /* Subtype used for disassembly */\
@@ -623,7 +708,7 @@ ACPI_PARSE_COMMON};
  * and bytelists.
  */
 struct acpi_parse_obj_named {
-       ACPI_PARSE_COMMON u8 * path;
+       ACPI_PARSE_COMMON u8 *path;
        u8 *data;               /* AML body or bytelist data */
        u32 length;             /* AML length */
        u32 name;               /* 4-byte name or zero if no name */
@@ -689,6 +774,8 @@ struct acpi_parse_state {
 #define ACPI_PARSEOP_NAMED              0x02
 #define ACPI_PARSEOP_DEFERRED           0x04
 #define ACPI_PARSEOP_BYTELIST           0x08
+#define ACPI_PARSEOP_IN_STACK           0x10
+#define ACPI_PARSEOP_TARGET             0x20
 #define ACPI_PARSEOP_IN_CACHE           0x80
 
 /* Parse object disasm_flags */
@@ -865,12 +952,30 @@ struct acpi_bit_register_info {
  ****************************************************************************/
 
 struct acpi_db_method_info {
-       acpi_handle thread_gate;
+       acpi_handle main_thread_gate;
+       acpi_handle thread_complete_gate;
+       u32 *threads;
+       u32 num_threads;
+       u32 num_created;
+       u32 num_completed;
+
        char *name;
-       char **args;
        u32 flags;
        u32 num_loops;
        char pathname[128];
+       char **args;
+
+       /*
+        * Arguments to be passed to method for the command
+        * Threads -
+        *   the Number of threads, ID of current thread and
+        *   Index of current thread inside all them created.
+        */
+       char init_args;
+       char *arguments[4];
+       char num_threads_str[11];
+       char id_of_thread_str[11];
+       char index_of_thread_str[11];
 };
 
 struct acpi_integrity_info {
@@ -929,6 +1034,8 @@ struct acpi_memory_list {
 
        u32 total_allocated;
        u32 total_freed;
+       u32 max_occupied;
+       u32 total_size;
        u32 current_total_size;
        u32 requests;
        u32 hits;