aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/tables/tbxface.c
diff options
context:
space:
mode:
authorAlexey Starikovskiy <alexey.y.starikovskiy@intel.com>2007-02-02 11:48:22 -0500
committerLen Brown <len.brown@intel.com>2007-02-02 21:14:29 -0500
commit428f211297bc95fd41f23830eab4180339020dd0 (patch)
tree81537f25f9add9e727e9d764fdcb333a1af07528 /drivers/acpi/tables/tbxface.c
parent77f6a9fca39f4f19d2d9d5fff1ff5c2ccf20629c (diff)
ACPICA: Miscellaneous table manager updates and optimizations
Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/tables/tbxface.c')
-rw-r--r--drivers/acpi/tables/tbxface.c54
1 files changed, 39 insertions, 15 deletions
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c
index 9d451e8a4e46..77224bd0667c 100644
--- a/drivers/acpi/tables/tbxface.c
+++ b/drivers/acpi/tables/tbxface.c
@@ -220,16 +220,25 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr)
220{ 220{
221 acpi_status status; 221 acpi_status status;
222 acpi_native_uint table_index; 222 acpi_native_uint table_index;
223 struct acpi_table_desc table_desc;
224
225 if (!table_ptr)
226 return AE_BAD_PARAMETER;
227
228 ACPI_MEMSET(&table_desc, 0, sizeof(struct acpi_table_desc));
229 table_desc.pointer = table_ptr;
230 table_desc.length = table_ptr->length;
231 table_desc.flags = ACPI_TABLE_ORIGIN_UNKNOWN;
223 232
224 /* 233 /*
225 * Install the new table into the local data structures 234 * Install the new table into the local data structures
226 */ 235 */
227 status = acpi_tb_add_table(table_ptr, &table_index); 236 status = acpi_tb_add_table(&table_desc, &table_index);
228 if (ACPI_FAILURE(status)) { 237 if (ACPI_FAILURE(status)) {
229 return_ACPI_STATUS(status); 238 return status;
230 } 239 }
231 status = acpi_ns_load_table(table_index, acpi_gbl_root_node); 240 status = acpi_ns_load_table(table_index, acpi_gbl_root_node);
232 return_ACPI_STATUS(status); 241 return status;
233} 242}
234 243
235ACPI_EXPORT_SYMBOL(acpi_load_table) 244ACPI_EXPORT_SYMBOL(acpi_load_table)
@@ -240,8 +249,7 @@ ACPI_EXPORT_SYMBOL(acpi_load_table)
240 * 249 *
241 * PARAMETERS: Signature - ACPI signature of needed table 250 * PARAMETERS: Signature - ACPI signature of needed table
242 * Instance - Which instance (for SSDTs) 251 * Instance - Which instance (for SSDTs)
243 * out_table_header - Where the pointer to the table header 252 * out_table_header - The pointer to the table header to fill
244 * is returned
245 * 253 *
246 * RETURN: Status and pointer to mapped table header 254 * RETURN: Status and pointer to mapped table header
247 * 255 *
@@ -254,10 +262,11 @@ ACPI_EXPORT_SYMBOL(acpi_load_table)
254acpi_status 262acpi_status
255acpi_get_table_header(char *signature, 263acpi_get_table_header(char *signature,
256 acpi_native_uint instance, 264 acpi_native_uint instance,
257 struct acpi_table_header **out_table_header) 265 struct acpi_table_header *out_table_header)
258{ 266{
259 acpi_native_uint i; 267 acpi_native_uint i;
260 acpi_native_uint j; 268 acpi_native_uint j;
269 struct acpi_table_header *header;
261 270
262 /* Parameter validation */ 271 /* Parameter validation */
263 272
@@ -279,16 +288,31 @@ acpi_get_table_header(char *signature,
279 continue; 288 continue;
280 } 289 }
281 290
282 *out_table_header = 291 if (!acpi_gbl_root_table_list.tables[i].pointer) {
283 acpi_tb_map(acpi_gbl_root_table_list.tables[i].address, 292 if ((acpi_gbl_root_table_list.tables[i].
284 (u32) sizeof(struct acpi_table_header), 293 flags & ACPI_TABLE_ORIGIN_MASK) ==
285 acpi_gbl_root_table_list.tables[i]. 294 ACPI_TABLE_ORIGIN_MAPPED) {
286 flags & ACPI_TABLE_ORIGIN_MASK); 295 header =
287 296 acpi_os_map_memory(acpi_gbl_root_table_list.
288 if (!(*out_table_header)) { 297 tables[i].address,
289 return (AE_NO_MEMORY); 298 sizeof(struct
299 acpi_table_header));
300 if (!header) {
301 return AE_NO_MEMORY;
302 }
303 ACPI_MEMCPY(out_table_header, header,
304 sizeof(struct acpi_table_header));
305 acpi_os_unmap_memory(header,
306 sizeof(struct
307 acpi_table_header));
308 } else {
309 return AE_NOT_FOUND;
310 }
311 } else {
312 ACPI_MEMCPY(out_table_header,
313 acpi_gbl_root_table_list.tables[i].pointer,
314 sizeof(struct acpi_table_header));
290 } 315 }
291
292 return (AE_OK); 316 return (AE_OK);
293 } 317 }
294 318