aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/tables/tbxface.c
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2007-02-02 11:48:19 -0500
committerLen Brown <len.brown@intel.com>2007-02-02 21:14:21 -0500
commitc5fc42ac4d4d6d3e3f619290b86890cb3725d2f8 (patch)
tree884123d40fe2abf621ec436e55b2d79efa5b474a /drivers/acpi/tables/tbxface.c
parentf3d2e7865c816258c699ff965768e46b50d536d3 (diff)
ACPICA: misc fixes for new Table Manager:
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@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.c58
1 files changed, 35 insertions, 23 deletions
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c
index 77439fc36c32..78ce542f3e67 100644
--- a/drivers/acpi/tables/tbxface.c
+++ b/drivers/acpi/tables/tbxface.c
@@ -82,9 +82,8 @@ acpi_status
82acpi_initialize_tables(struct acpi_table_desc *initial_table_array, 82acpi_initialize_tables(struct acpi_table_desc *initial_table_array,
83 u32 initial_table_count, u8 allow_resize) 83 u32 initial_table_count, u8 allow_resize)
84{ 84{
85 acpi_physical_address address; 85 acpi_physical_address rsdp_address;
86 acpi_status status; 86 acpi_status status;
87 struct acpi_table_rsdp *rsdp;
88 87
89 ACPI_FUNCTION_TRACE(acpi_initialize_tables); 88 ACPI_FUNCTION_TRACE(acpi_initialize_tables);
90 89
@@ -94,7 +93,7 @@ acpi_initialize_tables(struct acpi_table_desc *initial_table_array,
94 */ 93 */
95 if (!initial_table_array) { 94 if (!initial_table_array) {
96 acpi_gbl_root_table_list.size = initial_table_count; 95 acpi_gbl_root_table_list.size = initial_table_count;
97 acpi_gbl_root_table_list.flags = ACPI_TABLE_FLAGS_ALLOW_RESIZE; 96 acpi_gbl_root_table_list.flags = ACPI_ROOT_ALLOW_RESIZE;
98 97
99 status = acpi_tb_resize_root_table_list(); 98 status = acpi_tb_resize_root_table_list();
100 if (ACPI_FAILURE(status)) { 99 if (ACPI_FAILURE(status)) {
@@ -103,37 +102,33 @@ acpi_initialize_tables(struct acpi_table_desc *initial_table_array,
103 } else { 102 } else {
104 /* Root Table Array has been statically allocated by the host */ 103 /* Root Table Array has been statically allocated by the host */
105 104
105 ACPI_MEMSET(initial_table_array,
106 initial_table_count *
107 sizeof(struct acpi_table_desc), 0);
108
106 acpi_gbl_root_table_list.tables = initial_table_array; 109 acpi_gbl_root_table_list.tables = initial_table_array;
107 acpi_gbl_root_table_list.size = initial_table_count; 110 acpi_gbl_root_table_list.size = initial_table_count;
108 acpi_gbl_root_table_list.flags = ACPI_TABLE_ORIGIN_UNKNOWN; 111 acpi_gbl_root_table_list.flags = ACPI_ROOT_ORIGIN_UNKNOWN;
109 if (allow_resize) { 112 if (allow_resize) {
110 acpi_gbl_root_table_list.flags = 113 acpi_gbl_root_table_list.flags |=
111 ACPI_TABLE_FLAGS_ALLOW_RESIZE; 114 ACPI_ROOT_ALLOW_RESIZE;
112 } 115 }
113 } 116 }
114 117
115 /* Get the RSDP and map it */ 118 /* Get the address of the RSDP */
116 119
117 address = acpi_os_get_root_pointer(); 120 rsdp_address = acpi_os_get_root_pointer();
118 if (!address) { 121 if (!rsdp_address) {
119 return_ACPI_STATUS(AE_NOT_FOUND); 122 return_ACPI_STATUS(AE_NOT_FOUND);
120 } 123 }
121 124
122 rsdp = acpi_os_map_memory(address, sizeof(struct acpi_table_rsdp));
123 if (!rsdp) {
124 return_ACPI_STATUS(AE_NO_MEMORY);
125 }
126
127 ACPI_INFO((AE_INFO, "%.8s @ 0x%p",
128 rsdp->signature, ACPI_CAST_PTR(void, address)));
129
130 /* 125 /*
131 * Get the root table (RSDT or XSDT) and extract all entries to the local 126 * Get the root table (RSDT or XSDT) and extract all entries to the local
132 * Root Table Array. This array contains the information of the RSDT/XSDT 127 * Root Table Array. This array contains the information of the RSDT/XSDT
133 * in a common, more useable format. 128 * in a common, more useable format.
134 */ 129 */
135 status = acpi_tb_parse_root_table(rsdp, ACPI_TABLE_ORIGIN_MAPPED); 130 status =
136 acpi_os_unmap_memory(rsdp, sizeof(struct acpi_table_rsdp)); 131 acpi_tb_parse_root_table(rsdp_address, ACPI_TABLE_ORIGIN_MAPPED);
137 return_ACPI_STATUS(status); 132 return_ACPI_STATUS(status);
138} 133}
139 134
@@ -164,8 +159,7 @@ acpi_status acpi_reallocate_root_table(void)
164 * Only reallocate the root table if the host provided a static buffer 159 * Only reallocate the root table if the host provided a static buffer
165 * for the table array in the call to acpi_initialize_tables. 160 * for the table array in the call to acpi_initialize_tables.
166 */ 161 */
167 if ((acpi_gbl_root_table_list.flags & ACPI_TABLE_ORIGIN_MASK) != 162 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) {
168 ACPI_TABLE_ORIGIN_UNKNOWN) {
169 return_ACPI_STATUS(AE_SUPPORT); 163 return_ACPI_STATUS(AE_SUPPORT);
170 } 164 }
171 165
@@ -185,7 +179,7 @@ acpi_status acpi_reallocate_root_table(void)
185 acpi_gbl_root_table_list.size = acpi_gbl_root_table_list.count; 179 acpi_gbl_root_table_list.size = acpi_gbl_root_table_list.count;
186 acpi_gbl_root_table_list.tables = tables; 180 acpi_gbl_root_table_list.tables = tables;
187 acpi_gbl_root_table_list.flags = 181 acpi_gbl_root_table_list.flags =
188 ACPI_TABLE_ORIGIN_ALLOCATED | ACPI_TABLE_FLAGS_ALLOW_RESIZE; 182 ACPI_ROOT_ORIGIN_ALLOCATED | ACPI_ROOT_ALLOW_RESIZE;
189 183
190 return_ACPI_STATUS(AE_OK); 184 return_ACPI_STATUS(AE_OK);
191} 185}
@@ -247,6 +241,12 @@ acpi_get_table_header(char *signature,
247 acpi_native_uint i; 241 acpi_native_uint i;
248 acpi_native_uint j; 242 acpi_native_uint j;
249 243
244 /* Parameter validation */
245
246 if (!signature || !out_table_header) {
247 return (AE_BAD_PARAMETER);
248 }
249
250 /* 250 /*
251 * Walk the root table list 251 * Walk the root table list
252 */ 252 */
@@ -267,7 +267,7 @@ acpi_get_table_header(char *signature,
267 acpi_gbl_root_table_list.tables[i]. 267 acpi_gbl_root_table_list.tables[i].
268 flags & ACPI_TABLE_ORIGIN_MASK); 268 flags & ACPI_TABLE_ORIGIN_MASK);
269 269
270 if (!out_table_header) { 270 if (!(*out_table_header)) {
271 return (AE_NO_MEMORY); 271 return (AE_NO_MEMORY);
272 } 272 }
273 273
@@ -339,6 +339,12 @@ acpi_get_table(char *signature,
339 acpi_native_uint j; 339 acpi_native_uint j;
340 acpi_status status; 340 acpi_status status;
341 341
342 /* Parameter validation */
343
344 if (!signature || !out_table) {
345 return (AE_BAD_PARAMETER);
346 }
347
342 /* 348 /*
343 * Walk the root table list 349 * Walk the root table list
344 */ 350 */
@@ -387,6 +393,12 @@ acpi_get_table_by_index(acpi_native_uint table_index,
387 393
388 ACPI_FUNCTION_TRACE(acpi_get_table_by_index); 394 ACPI_FUNCTION_TRACE(acpi_get_table_by_index);
389 395
396 /* Parameter validation */
397
398 if (!table) {
399 return_ACPI_STATUS(AE_BAD_PARAMETER);
400 }
401
390 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); 402 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
391 403
392 /* Validate index */ 404 /* Validate index */