diff options
Diffstat (limited to 'drivers/acpi/namespace/nsparse.c')
-rw-r--r-- | drivers/acpi/namespace/nsparse.c | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c index 155505a4ef69..e696aa847990 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/namespace/nsparse.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2006, R. Byron Moore | 8 | * Copyright (C) 2000 - 2007, R. Byron Moore |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -45,6 +45,7 @@ | |||
45 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
46 | #include <acpi/acparser.h> | 46 | #include <acpi/acparser.h> |
47 | #include <acpi/acdispat.h> | 47 | #include <acpi/acdispat.h> |
48 | #include <acpi/actables.h> | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME("nsparse") | 51 | ACPI_MODULE_NAME("nsparse") |
@@ -62,14 +63,24 @@ ACPI_MODULE_NAME("nsparse") | |||
62 | * | 63 | * |
63 | ******************************************************************************/ | 64 | ******************************************************************************/ |
64 | acpi_status | 65 | acpi_status |
65 | acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc) | 66 | acpi_ns_one_complete_parse(acpi_native_uint pass_number, |
67 | acpi_native_uint table_index) | ||
66 | { | 68 | { |
67 | union acpi_parse_object *parse_root; | 69 | union acpi_parse_object *parse_root; |
68 | acpi_status status; | 70 | acpi_status status; |
71 | acpi_native_uint aml_length; | ||
72 | u8 *aml_start; | ||
69 | struct acpi_walk_state *walk_state; | 73 | struct acpi_walk_state *walk_state; |
74 | struct acpi_table_header *table; | ||
75 | acpi_owner_id owner_id; | ||
70 | 76 | ||
71 | ACPI_FUNCTION_TRACE(ns_one_complete_parse); | 77 | ACPI_FUNCTION_TRACE(ns_one_complete_parse); |
72 | 78 | ||
79 | status = acpi_tb_get_owner_id(table_index, &owner_id); | ||
80 | if (ACPI_FAILURE(status)) { | ||
81 | return_ACPI_STATUS(status); | ||
82 | } | ||
83 | |||
73 | /* Create and init a Root Node */ | 84 | /* Create and init a Root Node */ |
74 | 85 | ||
75 | parse_root = acpi_ps_create_scope_op(); | 86 | parse_root = acpi_ps_create_scope_op(); |
@@ -79,26 +90,41 @@ acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc) | |||
79 | 90 | ||
80 | /* Create and initialize a new walk state */ | 91 | /* Create and initialize a new walk state */ |
81 | 92 | ||
82 | walk_state = acpi_ds_create_walk_state(table_desc->owner_id, | 93 | walk_state = acpi_ds_create_walk_state(owner_id, NULL, NULL, NULL); |
83 | NULL, NULL, NULL); | ||
84 | if (!walk_state) { | 94 | if (!walk_state) { |
85 | acpi_ps_free_op(parse_root); | 95 | acpi_ps_free_op(parse_root); |
86 | return_ACPI_STATUS(AE_NO_MEMORY); | 96 | return_ACPI_STATUS(AE_NO_MEMORY); |
87 | } | 97 | } |
88 | 98 | ||
89 | status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL, | 99 | status = acpi_get_table_by_index(table_index, &table); |
90 | table_desc->aml_start, | 100 | if (ACPI_FAILURE(status)) { |
91 | table_desc->aml_length, NULL, | 101 | acpi_ds_delete_walk_state(walk_state); |
92 | pass_number); | 102 | acpi_ps_free_op(parse_root); |
103 | return_ACPI_STATUS(status); | ||
104 | } | ||
105 | |||
106 | /* Table must consist of at least a complete header */ | ||
107 | |||
108 | if (table->length < sizeof(struct acpi_table_header)) { | ||
109 | status = AE_BAD_HEADER; | ||
110 | } else { | ||
111 | aml_start = (u8 *) table + sizeof(struct acpi_table_header); | ||
112 | aml_length = table->length - sizeof(struct acpi_table_header); | ||
113 | status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL, | ||
114 | aml_start, aml_length, NULL, | ||
115 | (u8) pass_number); | ||
116 | } | ||
117 | |||
93 | if (ACPI_FAILURE(status)) { | 118 | if (ACPI_FAILURE(status)) { |
94 | acpi_ds_delete_walk_state(walk_state); | 119 | acpi_ds_delete_walk_state(walk_state); |
120 | acpi_ps_delete_parse_tree(parse_root); | ||
95 | return_ACPI_STATUS(status); | 121 | return_ACPI_STATUS(status); |
96 | } | 122 | } |
97 | 123 | ||
98 | /* Parse the AML */ | 124 | /* Parse the AML */ |
99 | 125 | ||
100 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", | 126 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", |
101 | pass_number)); | 127 | (unsigned)pass_number)); |
102 | status = acpi_ps_parse_aml(walk_state); | 128 | status = acpi_ps_parse_aml(walk_state); |
103 | 129 | ||
104 | acpi_ps_delete_parse_tree(parse_root); | 130 | acpi_ps_delete_parse_tree(parse_root); |
@@ -119,7 +145,7 @@ acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc) | |||
119 | ******************************************************************************/ | 145 | ******************************************************************************/ |
120 | 146 | ||
121 | acpi_status | 147 | acpi_status |
122 | acpi_ns_parse_table(struct acpi_table_desc *table_desc, | 148 | acpi_ns_parse_table(acpi_native_uint table_index, |
123 | struct acpi_namespace_node *start_node) | 149 | struct acpi_namespace_node *start_node) |
124 | { | 150 | { |
125 | acpi_status status; | 151 | acpi_status status; |
@@ -134,10 +160,10 @@ acpi_ns_parse_table(struct acpi_table_desc *table_desc, | |||
134 | * each Parser Op subtree is deleted when it is finished. This saves | 160 | * each Parser Op subtree is deleted when it is finished. This saves |
135 | * a great deal of memory, and allows a small cache of parse objects | 161 | * a great deal of memory, and allows a small cache of parse objects |
136 | * to service the entire parse. The second pass of the parse then | 162 | * to service the entire parse. The second pass of the parse then |
137 | * performs another complete parse of the AML.. | 163 | * performs another complete parse of the AML. |
138 | */ | 164 | */ |
139 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n")); | 165 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n")); |
140 | status = acpi_ns_one_complete_parse(1, table_desc); | 166 | status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1, table_index); |
141 | if (ACPI_FAILURE(status)) { | 167 | if (ACPI_FAILURE(status)) { |
142 | return_ACPI_STATUS(status); | 168 | return_ACPI_STATUS(status); |
143 | } | 169 | } |
@@ -152,7 +178,7 @@ acpi_ns_parse_table(struct acpi_table_desc *table_desc, | |||
152 | * parse objects are all cached. | 178 | * parse objects are all cached. |
153 | */ | 179 | */ |
154 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 2\n")); | 180 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 2\n")); |
155 | status = acpi_ns_one_complete_parse(2, table_desc); | 181 | status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS2, table_index); |
156 | if (ACPI_FAILURE(status)) { | 182 | if (ACPI_FAILURE(status)) { |
157 | return_ACPI_STATUS(status); | 183 | return_ACPI_STATUS(status); |
158 | } | 184 | } |