diff options
author | Bob Moore <robert.moore@intel.com> | 2007-02-02 11:48:18 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-02-02 21:14:21 -0500 |
commit | f3d2e7865c816258c699ff965768e46b50d536d3 (patch) | |
tree | 83d21269e506109275b77d3ed161883bba8a39cf /drivers/acpi/namespace/nsload.c | |
parent | 2e42005bcdb4f63bed1cea7f537a5534d4bd7a57 (diff) |
ACPICA: Implement simplified Table Manager
The Table Manager component has been completely
redesigned and reimplemented. The new design is much
simpler, and reduces the overall code and data size of
the kernel-resident ACPICA by approximately 5%. Also,
it is now possible to obtain the ACPI tables very early
during kernel initialization, even before dynamic memory
management is initialized.
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/namespace/nsload.c')
-rw-r--r-- | drivers/acpi/namespace/nsload.c | 158 |
1 files changed, 28 insertions, 130 deletions
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index fe75d888e183..5d555f8c167b 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c | |||
@@ -44,13 +44,12 @@ | |||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
46 | #include <acpi/acdispat.h> | 46 | #include <acpi/acdispat.h> |
47 | #include <acpi/actables.h> | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
49 | ACPI_MODULE_NAME("nsload") | 50 | ACPI_MODULE_NAME("nsload") |
50 | 51 | ||
51 | /* Local prototypes */ | 52 | /* Local prototypes */ |
52 | static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type); | ||
53 | |||
54 | #ifdef ACPI_FUTURE_IMPLEMENTATION | 53 | #ifdef ACPI_FUTURE_IMPLEMENTATION |
55 | acpi_status acpi_ns_unload_namespace(acpi_handle handle); | 54 | acpi_status acpi_ns_unload_namespace(acpi_handle handle); |
56 | 55 | ||
@@ -62,7 +61,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle); | |||
62 | * | 61 | * |
63 | * FUNCTION: acpi_ns_load_table | 62 | * FUNCTION: acpi_ns_load_table |
64 | * | 63 | * |
65 | * PARAMETERS: table_desc - Descriptor for table to be loaded | 64 | * PARAMETERS: table_index - Index for table to be loaded |
66 | * Node - Owning NS node | 65 | * Node - Owning NS node |
67 | * | 66 | * |
68 | * RETURN: Status | 67 | * RETURN: Status |
@@ -72,42 +71,13 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle); | |||
72 | ******************************************************************************/ | 71 | ******************************************************************************/ |
73 | 72 | ||
74 | acpi_status | 73 | acpi_status |
75 | acpi_ns_load_table(struct acpi_table_desc *table_desc, | 74 | acpi_ns_load_table(acpi_native_uint table_index, |
76 | struct acpi_namespace_node *node) | 75 | struct acpi_namespace_node *node) |
77 | { | 76 | { |
78 | acpi_status status; | 77 | acpi_status status; |
79 | 78 | ||
80 | ACPI_FUNCTION_TRACE(ns_load_table); | 79 | ACPI_FUNCTION_TRACE(ns_load_table); |
81 | 80 | ||
82 | /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */ | ||
83 | |||
84 | if (! | ||
85 | (acpi_gbl_table_data[table_desc->type]. | ||
86 | flags & ACPI_TABLE_EXECUTABLE)) { | ||
87 | |||
88 | /* Just ignore this table */ | ||
89 | |||
90 | return_ACPI_STATUS(AE_OK); | ||
91 | } | ||
92 | |||
93 | /* Check validity of the AML start and length */ | ||
94 | |||
95 | if (!table_desc->aml_start) { | ||
96 | ACPI_ERROR((AE_INFO, "Null AML pointer")); | ||
97 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
98 | } | ||
99 | |||
100 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AML block at %p\n", | ||
101 | table_desc->aml_start)); | ||
102 | |||
103 | /* Ignore table if there is no AML contained within */ | ||
104 | |||
105 | if (!table_desc->aml_length) { | ||
106 | ACPI_WARNING((AE_INFO, "Zero-length AML block in table [%4.4s]", | ||
107 | table_desc->pointer->signature)); | ||
108 | return_ACPI_STATUS(AE_OK); | ||
109 | } | ||
110 | |||
111 | /* | 81 | /* |
112 | * Parse the table and load the namespace with all named | 82 | * Parse the table and load the namespace with all named |
113 | * objects found within. Control methods are NOT parsed | 83 | * objects found within. Control methods are NOT parsed |
@@ -117,15 +87,34 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc, | |||
117 | * to another control method, we can't continue parsing | 87 | * to another control method, we can't continue parsing |
118 | * because we don't know how many arguments to parse next! | 88 | * because we don't know how many arguments to parse next! |
119 | */ | 89 | */ |
90 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
91 | if (ACPI_FAILURE(status)) { | ||
92 | return_ACPI_STATUS(status); | ||
93 | } | ||
94 | |||
95 | /* If table already loaded into namespace, just return */ | ||
96 | |||
97 | if (acpi_tb_is_table_loaded(table_index)) { | ||
98 | status = AE_ALREADY_EXISTS; | ||
99 | goto unlock; | ||
100 | } | ||
101 | |||
120 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 102 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
121 | "**** Loading table into namespace ****\n")); | 103 | "**** Loading table into namespace ****\n")); |
122 | 104 | ||
123 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 105 | status = acpi_tb_allocate_owner_id(table_index); |
124 | if (ACPI_FAILURE(status)) { | 106 | if (ACPI_FAILURE(status)) { |
125 | return_ACPI_STATUS(status); | 107 | goto unlock; |
108 | } | ||
109 | |||
110 | status = acpi_ns_parse_table(table_index, node->child); | ||
111 | if (ACPI_SUCCESS(status)) { | ||
112 | acpi_tb_set_table_loaded_flag(table_index, TRUE); | ||
113 | } else { | ||
114 | acpi_tb_release_owner_id(table_index); | ||
126 | } | 115 | } |
127 | 116 | ||
128 | status = acpi_ns_parse_table(table_desc, node->child); | 117 | unlock: |
129 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 118 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
130 | 119 | ||
131 | if (ACPI_FAILURE(status)) { | 120 | if (ACPI_FAILURE(status)) { |
@@ -141,7 +130,7 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc, | |||
141 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 130 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
142 | "**** Begin Table Method Parsing and Object Initialization ****\n")); | 131 | "**** Begin Table Method Parsing and Object Initialization ****\n")); |
143 | 132 | ||
144 | status = acpi_ds_initialize_objects(table_desc, node); | 133 | status = acpi_ds_initialize_objects(table_index, node); |
145 | 134 | ||
146 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 135 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
147 | "**** Completed Table Method Parsing and Object Initialization ****\n")); | 136 | "**** Completed Table Method Parsing and Object Initialization ****\n")); |
@@ -149,99 +138,7 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc, | |||
149 | return_ACPI_STATUS(status); | 138 | return_ACPI_STATUS(status); |
150 | } | 139 | } |
151 | 140 | ||
152 | /******************************************************************************* | 141 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
153 | * | ||
154 | * FUNCTION: acpi_ns_load_table_by_type | ||
155 | * | ||
156 | * PARAMETERS: table_type - Id of the table type to load | ||
157 | * | ||
158 | * RETURN: Status | ||
159 | * | ||
160 | * DESCRIPTION: Load an ACPI table or tables into the namespace. All tables | ||
161 | * of the given type are loaded. The mechanism allows this | ||
162 | * routine to be called repeatedly. | ||
163 | * | ||
164 | ******************************************************************************/ | ||
165 | |||
166 | static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) | ||
167 | { | ||
168 | u32 i; | ||
169 | acpi_status status; | ||
170 | struct acpi_table_desc *table_desc; | ||
171 | |||
172 | ACPI_FUNCTION_TRACE(ns_load_table_by_type); | ||
173 | |||
174 | status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
175 | if (ACPI_FAILURE(status)) { | ||
176 | return_ACPI_STATUS(status); | ||
177 | } | ||
178 | |||
179 | /* | ||
180 | * Table types supported are: | ||
181 | * DSDT (one), SSDT/PSDT (multiple) | ||
182 | */ | ||
183 | switch (table_type) { | ||
184 | case ACPI_TABLE_ID_DSDT: | ||
185 | |||
186 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n")); | ||
187 | |||
188 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_ID_DSDT].next; | ||
189 | |||
190 | /* If table already loaded into namespace, just return */ | ||
191 | |||
192 | if (table_desc->loaded_into_namespace) { | ||
193 | goto unlock_and_exit; | ||
194 | } | ||
195 | |||
196 | /* Now load the single DSDT */ | ||
197 | |||
198 | status = acpi_ns_load_table(table_desc, acpi_gbl_root_node); | ||
199 | if (ACPI_SUCCESS(status)) { | ||
200 | table_desc->loaded_into_namespace = TRUE; | ||
201 | } | ||
202 | break; | ||
203 | |||
204 | case ACPI_TABLE_ID_SSDT: | ||
205 | case ACPI_TABLE_ID_PSDT: | ||
206 | |||
207 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
208 | "Namespace load: %d SSDT or PSDTs\n", | ||
209 | acpi_gbl_table_lists[table_type].count)); | ||
210 | |||
211 | /* | ||
212 | * Traverse list of SSDT or PSDT tables | ||
213 | */ | ||
214 | table_desc = acpi_gbl_table_lists[table_type].next; | ||
215 | for (i = 0; i < acpi_gbl_table_lists[table_type].count; i++) { | ||
216 | /* | ||
217 | * Only attempt to load table into namespace if it is not | ||
218 | * already loaded! | ||
219 | */ | ||
220 | if (!table_desc->loaded_into_namespace) { | ||
221 | status = | ||
222 | acpi_ns_load_table(table_desc, | ||
223 | acpi_gbl_root_node); | ||
224 | if (ACPI_FAILURE(status)) { | ||
225 | break; | ||
226 | } | ||
227 | |||
228 | table_desc->loaded_into_namespace = TRUE; | ||
229 | } | ||
230 | |||
231 | table_desc = table_desc->next; | ||
232 | } | ||
233 | break; | ||
234 | |||
235 | default: | ||
236 | status = AE_SUPPORT; | ||
237 | break; | ||
238 | } | ||
239 | |||
240 | unlock_and_exit: | ||
241 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
242 | return_ACPI_STATUS(status); | ||
243 | } | ||
244 | |||
245 | /******************************************************************************* | 142 | /******************************************************************************* |
246 | * | 143 | * |
247 | * FUNCTION: acpi_load_namespace | 144 | * FUNCTION: acpi_load_namespace |
@@ -288,6 +185,7 @@ acpi_status acpi_ns_load_namespace(void) | |||
288 | 185 | ||
289 | return_ACPI_STATUS(status); | 186 | return_ACPI_STATUS(status); |
290 | } | 187 | } |
188 | #endif | ||
291 | 189 | ||
292 | #ifdef ACPI_FUTURE_IMPLEMENTATION | 190 | #ifdef ACPI_FUTURE_IMPLEMENTATION |
293 | /******************************************************************************* | 191 | /******************************************************************************* |