diff options
author | Len Brown <len.brown@intel.com> | 2005-08-05 00:44:28 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-08-05 00:45:14 -0400 |
commit | 4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch) | |
tree | 5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/tables/tbxfroot.c | |
parent | c65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff) |
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/tables/tbxfroot.c')
-rw-r--r-- | drivers/acpi/tables/tbxfroot.c | 431 |
1 files changed, 206 insertions, 225 deletions
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index 87dccdda9ae2..3b8a7e063e8a 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c | |||
@@ -46,22 +46,14 @@ | |||
46 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
47 | #include <acpi/actables.h> | 47 | #include <acpi/actables.h> |
48 | 48 | ||
49 | |||
50 | #define _COMPONENT ACPI_TABLES | 49 | #define _COMPONENT ACPI_TABLES |
51 | ACPI_MODULE_NAME ("tbxfroot") | 50 | ACPI_MODULE_NAME("tbxfroot") |
52 | 51 | ||
53 | /* Local prototypes */ | 52 | /* Local prototypes */ |
54 | |||
55 | static acpi_status | 53 | static acpi_status |
56 | acpi_tb_find_rsdp ( | 54 | acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags); |
57 | struct acpi_table_desc *table_info, | ||
58 | u32 flags); | ||
59 | |||
60 | static u8 * | ||
61 | acpi_tb_scan_memory_for_rsdp ( | ||
62 | u8 *start_address, | ||
63 | u32 length); | ||
64 | 55 | ||
56 | static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length); | ||
65 | 57 | ||
66 | /******************************************************************************* | 58 | /******************************************************************************* |
67 | * | 59 | * |
@@ -75,17 +67,14 @@ acpi_tb_scan_memory_for_rsdp ( | |||
75 | * | 67 | * |
76 | ******************************************************************************/ | 68 | ******************************************************************************/ |
77 | 69 | ||
78 | acpi_status | 70 | acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp) |
79 | acpi_tb_validate_rsdp ( | ||
80 | struct rsdp_descriptor *rsdp) | ||
81 | { | 71 | { |
82 | ACPI_FUNCTION_ENTRY (); | 72 | ACPI_FUNCTION_ENTRY(); |
83 | |||
84 | 73 | ||
85 | /* | 74 | /* |
86 | * The signature and checksum must both be correct | 75 | * The signature and checksum must both be correct |
87 | */ | 76 | */ |
88 | if (ACPI_STRNCMP ((char *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) { | 77 | if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) { |
89 | /* Nope, BAD Signature */ | 78 | /* Nope, BAD Signature */ |
90 | 79 | ||
91 | return (AE_BAD_SIGNATURE); | 80 | return (AE_BAD_SIGNATURE); |
@@ -93,21 +82,21 @@ acpi_tb_validate_rsdp ( | |||
93 | 82 | ||
94 | /* Check the standard checksum */ | 83 | /* Check the standard checksum */ |
95 | 84 | ||
96 | if (acpi_tb_generate_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { | 85 | if (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { |
97 | return (AE_BAD_CHECKSUM); | 86 | return (AE_BAD_CHECKSUM); |
98 | } | 87 | } |
99 | 88 | ||
100 | /* Check extended checksum if table version >= 2 */ | 89 | /* Check extended checksum if table version >= 2 */ |
101 | 90 | ||
102 | if ((rsdp->revision >= 2) && | 91 | if ((rsdp->revision >= 2) && |
103 | (acpi_tb_generate_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) { | 92 | (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != |
93 | 0)) { | ||
104 | return (AE_BAD_CHECKSUM); | 94 | return (AE_BAD_CHECKSUM); |
105 | } | 95 | } |
106 | 96 | ||
107 | return (AE_OK); | 97 | return (AE_OK); |
108 | } | 98 | } |
109 | 99 | ||
110 | |||
111 | /******************************************************************************* | 100 | /******************************************************************************* |
112 | * | 101 | * |
113 | * FUNCTION: acpi_tb_find_table | 102 | * FUNCTION: acpi_tb_find_table |
@@ -125,28 +114,24 @@ acpi_tb_validate_rsdp ( | |||
125 | ******************************************************************************/ | 114 | ******************************************************************************/ |
126 | 115 | ||
127 | acpi_status | 116 | acpi_status |
128 | acpi_tb_find_table ( | 117 | acpi_tb_find_table(char *signature, |
129 | char *signature, | 118 | char *oem_id, |
130 | char *oem_id, | 119 | char *oem_table_id, struct acpi_table_header ** table_ptr) |
131 | char *oem_table_id, | ||
132 | struct acpi_table_header **table_ptr) | ||
133 | { | 120 | { |
134 | acpi_status status; | 121 | acpi_status status; |
135 | struct acpi_table_header *table; | 122 | struct acpi_table_header *table; |
136 | |||
137 | |||
138 | ACPI_FUNCTION_TRACE ("tb_find_table"); | ||
139 | 123 | ||
124 | ACPI_FUNCTION_TRACE("tb_find_table"); | ||
140 | 125 | ||
141 | /* Validate string lengths */ | 126 | /* Validate string lengths */ |
142 | 127 | ||
143 | if ((ACPI_STRLEN (signature) > ACPI_NAME_SIZE) || | 128 | if ((ACPI_STRLEN(signature) > ACPI_NAME_SIZE) || |
144 | (ACPI_STRLEN (oem_id) > sizeof (table->oem_id)) || | 129 | (ACPI_STRLEN(oem_id) > sizeof(table->oem_id)) || |
145 | (ACPI_STRLEN (oem_table_id) > sizeof (table->oem_table_id))) { | 130 | (ACPI_STRLEN(oem_table_id) > sizeof(table->oem_table_id))) { |
146 | return_ACPI_STATUS (AE_AML_STRING_LIMIT); | 131 | return_ACPI_STATUS(AE_AML_STRING_LIMIT); |
147 | } | 132 | } |
148 | 133 | ||
149 | if (!ACPI_STRNCMP (signature, DSDT_SIG, ACPI_NAME_SIZE)) { | 134 | if (!ACPI_STRNCMP(signature, DSDT_SIG, ACPI_NAME_SIZE)) { |
150 | /* | 135 | /* |
151 | * The DSDT pointer is contained in the FADT, not the RSDT. | 136 | * The DSDT pointer is contained in the FADT, not the RSDT. |
152 | * This code should suffice, because the only code that would perform | 137 | * This code should suffice, because the only code that would perform |
@@ -155,40 +140,36 @@ acpi_tb_find_table ( | |||
155 | * If this becomes insufficient, the FADT will have to be found first. | 140 | * If this becomes insufficient, the FADT will have to be found first. |
156 | */ | 141 | */ |
157 | if (!acpi_gbl_DSDT) { | 142 | if (!acpi_gbl_DSDT) { |
158 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); | 143 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); |
159 | } | 144 | } |
160 | table = acpi_gbl_DSDT; | 145 | table = acpi_gbl_DSDT; |
161 | } | 146 | } else { |
162 | else { | ||
163 | /* Find the table */ | 147 | /* Find the table */ |
164 | 148 | ||
165 | status = acpi_get_firmware_table (signature, 1, | 149 | status = acpi_get_firmware_table(signature, 1, |
166 | ACPI_LOGICAL_ADDRESSING, &table); | 150 | ACPI_LOGICAL_ADDRESSING, |
167 | if (ACPI_FAILURE (status)) { | 151 | &table); |
168 | return_ACPI_STATUS (status); | 152 | if (ACPI_FAILURE(status)) { |
153 | return_ACPI_STATUS(status); | ||
169 | } | 154 | } |
170 | } | 155 | } |
171 | 156 | ||
172 | /* Check oem_id and oem_table_id */ | 157 | /* Check oem_id and oem_table_id */ |
173 | 158 | ||
174 | if ((oem_id[0] && ACPI_STRNCMP ( | 159 | if ((oem_id[0] && ACPI_STRNCMP(oem_id, table->oem_id, |
175 | oem_id, table->oem_id, | 160 | sizeof(table->oem_id))) || |
176 | sizeof (table->oem_id))) || | 161 | (oem_table_id[0] && ACPI_STRNCMP(oem_table_id, table->oem_table_id, |
177 | 162 | sizeof(table->oem_table_id)))) { | |
178 | (oem_table_id[0] && ACPI_STRNCMP ( | 163 | return_ACPI_STATUS(AE_AML_NAME_NOT_FOUND); |
179 | oem_table_id, table->oem_table_id, | ||
180 | sizeof (table->oem_table_id)))) { | ||
181 | return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND); | ||
182 | } | 164 | } |
183 | 165 | ||
184 | ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", | 166 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "Found table [%4.4s]\n", |
185 | table->signature)); | 167 | table->signature)); |
186 | 168 | ||
187 | *table_ptr = table; | 169 | *table_ptr = table; |
188 | return_ACPI_STATUS (AE_OK); | 170 | return_ACPI_STATUS(AE_OK); |
189 | } | 171 | } |
190 | 172 | ||
191 | |||
192 | /******************************************************************************* | 173 | /******************************************************************************* |
193 | * | 174 | * |
194 | * FUNCTION: acpi_get_firmware_table | 175 | * FUNCTION: acpi_get_firmware_table |
@@ -209,34 +190,28 @@ acpi_tb_find_table ( | |||
209 | ******************************************************************************/ | 190 | ******************************************************************************/ |
210 | 191 | ||
211 | acpi_status | 192 | acpi_status |
212 | acpi_get_firmware_table ( | 193 | acpi_get_firmware_table(acpi_string signature, |
213 | acpi_string signature, | 194 | u32 instance, |
214 | u32 instance, | 195 | u32 flags, struct acpi_table_header **table_pointer) |
215 | u32 flags, | ||
216 | struct acpi_table_header **table_pointer) | ||
217 | { | 196 | { |
218 | acpi_status status; | 197 | acpi_status status; |
219 | struct acpi_pointer address; | 198 | struct acpi_pointer address; |
220 | struct acpi_table_header *header = NULL; | 199 | struct acpi_table_header *header = NULL; |
221 | struct acpi_table_desc *table_info = NULL; | 200 | struct acpi_table_desc *table_info = NULL; |
222 | struct acpi_table_desc *rsdt_info; | 201 | struct acpi_table_desc *rsdt_info; |
223 | u32 table_count; | 202 | u32 table_count; |
224 | u32 i; | 203 | u32 i; |
225 | u32 j; | 204 | u32 j; |
226 | |||
227 | |||
228 | ACPI_FUNCTION_TRACE ("acpi_get_firmware_table"); | ||
229 | 205 | ||
206 | ACPI_FUNCTION_TRACE("acpi_get_firmware_table"); | ||
230 | 207 | ||
231 | /* | 208 | /* |
232 | * Ensure that at least the table manager is initialized. We don't | 209 | * Ensure that at least the table manager is initialized. We don't |
233 | * require that the entire ACPI subsystem is up for this interface. | 210 | * require that the entire ACPI subsystem is up for this interface. |
234 | * If we have a buffer, we must have a length too | 211 | * If we have a buffer, we must have a length too |
235 | */ | 212 | */ |
236 | if ((instance == 0) || | 213 | if ((instance == 0) || (!signature) || (!table_pointer)) { |
237 | (!signature) || | 214 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
238 | (!table_pointer)) { | ||
239 | return_ACPI_STATUS (AE_BAD_PARAMETER); | ||
240 | } | 215 | } |
241 | 216 | ||
242 | /* Ensure that we have a RSDP */ | 217 | /* Ensure that we have a RSDP */ |
@@ -244,40 +219,41 @@ acpi_get_firmware_table ( | |||
244 | if (!acpi_gbl_RSDP) { | 219 | if (!acpi_gbl_RSDP) { |
245 | /* Get the RSDP */ | 220 | /* Get the RSDP */ |
246 | 221 | ||
247 | status = acpi_os_get_root_pointer (flags, &address); | 222 | status = acpi_os_get_root_pointer(flags, &address); |
248 | if (ACPI_FAILURE (status)) { | 223 | if (ACPI_FAILURE(status)) { |
249 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP not found\n")); | 224 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "RSDP not found\n")); |
250 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); | 225 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); |
251 | } | 226 | } |
252 | 227 | ||
253 | /* Map and validate the RSDP */ | 228 | /* Map and validate the RSDP */ |
254 | 229 | ||
255 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { | 230 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { |
256 | status = acpi_os_map_memory (address.pointer.physical, | 231 | status = acpi_os_map_memory(address.pointer.physical, |
257 | sizeof (struct rsdp_descriptor), (void *) &acpi_gbl_RSDP); | 232 | sizeof(struct |
258 | if (ACPI_FAILURE (status)) { | 233 | rsdp_descriptor), |
259 | return_ACPI_STATUS (status); | 234 | (void *)&acpi_gbl_RSDP); |
235 | if (ACPI_FAILURE(status)) { | ||
236 | return_ACPI_STATUS(status); | ||
260 | } | 237 | } |
261 | } | 238 | } else { |
262 | else { | ||
263 | acpi_gbl_RSDP = address.pointer.logical; | 239 | acpi_gbl_RSDP = address.pointer.logical; |
264 | } | 240 | } |
265 | 241 | ||
266 | /* The RDSP signature and checksum must both be correct */ | 242 | /* The RDSP signature and checksum must both be correct */ |
267 | 243 | ||
268 | status = acpi_tb_validate_rsdp (acpi_gbl_RSDP); | 244 | status = acpi_tb_validate_rsdp(acpi_gbl_RSDP); |
269 | if (ACPI_FAILURE (status)) { | 245 | if (ACPI_FAILURE(status)) { |
270 | return_ACPI_STATUS (status); | 246 | return_ACPI_STATUS(status); |
271 | } | 247 | } |
272 | } | 248 | } |
273 | 249 | ||
274 | /* Get the RSDT address via the RSDP */ | 250 | /* Get the RSDT address via the RSDP */ |
275 | 251 | ||
276 | acpi_tb_get_rsdt_address (&address); | 252 | acpi_tb_get_rsdt_address(&address); |
277 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 253 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
278 | "RSDP located at %p, RSDT physical=%8.8X%8.8X \n", | 254 | "RSDP located at %p, RSDT physical=%8.8X%8.8X \n", |
279 | acpi_gbl_RSDP, | 255 | acpi_gbl_RSDP, |
280 | ACPI_FORMAT_UINT64 (address.pointer.value))); | 256 | ACPI_FORMAT_UINT64(address.pointer.value))); |
281 | 257 | ||
282 | /* Insert processor_mode flags */ | 258 | /* Insert processor_mode flags */ |
283 | 259 | ||
@@ -285,30 +261,30 @@ acpi_get_firmware_table ( | |||
285 | 261 | ||
286 | /* Get and validate the RSDT */ | 262 | /* Get and validate the RSDT */ |
287 | 263 | ||
288 | rsdt_info = ACPI_MEM_CALLOCATE (sizeof (struct acpi_table_desc)); | 264 | rsdt_info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc)); |
289 | if (!rsdt_info) { | 265 | if (!rsdt_info) { |
290 | return_ACPI_STATUS (AE_NO_MEMORY); | 266 | return_ACPI_STATUS(AE_NO_MEMORY); |
291 | } | 267 | } |
292 | 268 | ||
293 | status = acpi_tb_get_table (&address, rsdt_info); | 269 | status = acpi_tb_get_table(&address, rsdt_info); |
294 | if (ACPI_FAILURE (status)) { | 270 | if (ACPI_FAILURE(status)) { |
295 | goto cleanup; | 271 | goto cleanup; |
296 | } | 272 | } |
297 | 273 | ||
298 | status = acpi_tb_validate_rsdt (rsdt_info->pointer); | 274 | status = acpi_tb_validate_rsdt(rsdt_info->pointer); |
299 | if (ACPI_FAILURE (status)) { | 275 | if (ACPI_FAILURE(status)) { |
300 | goto cleanup; | 276 | goto cleanup; |
301 | } | 277 | } |
302 | 278 | ||
303 | /* Allocate a scratch table header and table descriptor */ | 279 | /* Allocate a scratch table header and table descriptor */ |
304 | 280 | ||
305 | header = ACPI_MEM_ALLOCATE (sizeof (struct acpi_table_header)); | 281 | header = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_header)); |
306 | if (!header) { | 282 | if (!header) { |
307 | status = AE_NO_MEMORY; | 283 | status = AE_NO_MEMORY; |
308 | goto cleanup; | 284 | goto cleanup; |
309 | } | 285 | } |
310 | 286 | ||
311 | table_info = ACPI_MEM_ALLOCATE (sizeof (struct acpi_table_desc)); | 287 | table_info = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_desc)); |
312 | if (!table_info) { | 288 | if (!table_info) { |
313 | status = AE_NO_MEMORY; | 289 | status = AE_NO_MEMORY; |
314 | goto cleanup; | 290 | goto cleanup; |
@@ -316,7 +292,8 @@ acpi_get_firmware_table ( | |||
316 | 292 | ||
317 | /* Get the number of table pointers within the RSDT */ | 293 | /* Get the number of table pointers within the RSDT */ |
318 | 294 | ||
319 | table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, rsdt_info->pointer); | 295 | table_count = |
296 | acpi_tb_get_table_count(acpi_gbl_RSDP, rsdt_info->pointer); | ||
320 | address.pointer_type = acpi_gbl_table_flags | flags; | 297 | address.pointer_type = acpi_gbl_table_flags | flags; |
321 | 298 | ||
322 | /* | 299 | /* |
@@ -329,32 +306,37 @@ acpi_get_firmware_table ( | |||
329 | * RSDT pointers are 32 bits, XSDT pointers are 64 bits | 306 | * RSDT pointers are 32 bits, XSDT pointers are 64 bits |
330 | */ | 307 | */ |
331 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 308 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
332 | address.pointer.value = (ACPI_CAST_PTR ( | 309 | address.pointer.value = |
333 | RSDT_DESCRIPTOR, rsdt_info->pointer))->table_offset_entry[i]; | 310 | (ACPI_CAST_PTR |
334 | } | 311 | (RSDT_DESCRIPTOR, |
335 | else { | 312 | rsdt_info->pointer))->table_offset_entry[i]; |
336 | address.pointer.value = (ACPI_CAST_PTR ( | 313 | } else { |
337 | XSDT_DESCRIPTOR, rsdt_info->pointer))->table_offset_entry[i]; | 314 | address.pointer.value = |
315 | (ACPI_CAST_PTR | ||
316 | (XSDT_DESCRIPTOR, | ||
317 | rsdt_info->pointer))->table_offset_entry[i]; | ||
338 | } | 318 | } |
339 | 319 | ||
340 | /* Get the table header */ | 320 | /* Get the table header */ |
341 | 321 | ||
342 | status = acpi_tb_get_table_header (&address, header); | 322 | status = acpi_tb_get_table_header(&address, header); |
343 | if (ACPI_FAILURE (status)) { | 323 | if (ACPI_FAILURE(status)) { |
344 | goto cleanup; | 324 | goto cleanup; |
345 | } | 325 | } |
346 | 326 | ||
347 | /* Compare table signatures and table instance */ | 327 | /* Compare table signatures and table instance */ |
348 | 328 | ||
349 | if (!ACPI_STRNCMP (header->signature, signature, ACPI_NAME_SIZE)) { | 329 | if (!ACPI_STRNCMP(header->signature, signature, ACPI_NAME_SIZE)) { |
350 | /* An instance of the table was found */ | 330 | /* An instance of the table was found */ |
351 | 331 | ||
352 | j++; | 332 | j++; |
353 | if (j >= instance) { | 333 | if (j >= instance) { |
354 | /* Found the correct instance, get the entire table */ | 334 | /* Found the correct instance, get the entire table */ |
355 | 335 | ||
356 | status = acpi_tb_get_table_body (&address, header, table_info); | 336 | status = |
357 | if (ACPI_FAILURE (status)) { | 337 | acpi_tb_get_table_body(&address, header, |
338 | table_info); | ||
339 | if (ACPI_FAILURE(status)) { | ||
358 | goto cleanup; | 340 | goto cleanup; |
359 | } | 341 | } |
360 | 342 | ||
@@ -368,24 +350,23 @@ acpi_get_firmware_table ( | |||
368 | 350 | ||
369 | status = AE_NOT_EXIST; | 351 | status = AE_NOT_EXIST; |
370 | 352 | ||
371 | 353 | cleanup: | |
372 | cleanup: | ||
373 | if (rsdt_info->pointer) { | 354 | if (rsdt_info->pointer) { |
374 | acpi_os_unmap_memory (rsdt_info->pointer, | 355 | acpi_os_unmap_memory(rsdt_info->pointer, |
375 | (acpi_size) rsdt_info->pointer->length); | 356 | (acpi_size) rsdt_info->pointer->length); |
376 | } | 357 | } |
377 | ACPI_MEM_FREE (rsdt_info); | 358 | ACPI_MEM_FREE(rsdt_info); |
378 | 359 | ||
379 | if (header) { | 360 | if (header) { |
380 | ACPI_MEM_FREE (header); | 361 | ACPI_MEM_FREE(header); |
381 | } | 362 | } |
382 | if (table_info) { | 363 | if (table_info) { |
383 | ACPI_MEM_FREE (table_info); | 364 | ACPI_MEM_FREE(table_info); |
384 | } | 365 | } |
385 | return_ACPI_STATUS (status); | 366 | return_ACPI_STATUS(status); |
386 | } | 367 | } |
387 | EXPORT_SYMBOL(acpi_get_firmware_table); | ||
388 | 368 | ||
369 | EXPORT_SYMBOL(acpi_get_firmware_table); | ||
389 | 370 | ||
390 | /* TBD: Move to a new file */ | 371 | /* TBD: Move to a new file */ |
391 | 372 | ||
@@ -404,35 +385,29 @@ EXPORT_SYMBOL(acpi_get_firmware_table); | |||
404 | * | 385 | * |
405 | ******************************************************************************/ | 386 | ******************************************************************************/ |
406 | 387 | ||
407 | acpi_status | 388 | acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) |
408 | acpi_find_root_pointer ( | ||
409 | u32 flags, | ||
410 | struct acpi_pointer *rsdp_address) | ||
411 | { | 389 | { |
412 | struct acpi_table_desc table_info; | 390 | struct acpi_table_desc table_info; |
413 | acpi_status status; | 391 | acpi_status status; |
414 | |||
415 | |||
416 | ACPI_FUNCTION_TRACE ("acpi_find_root_pointer"); | ||
417 | 392 | ||
393 | ACPI_FUNCTION_TRACE("acpi_find_root_pointer"); | ||
418 | 394 | ||
419 | /* Get the RSDP */ | 395 | /* Get the RSDP */ |
420 | 396 | ||
421 | status = acpi_tb_find_rsdp (&table_info, flags); | 397 | status = acpi_tb_find_rsdp(&table_info, flags); |
422 | if (ACPI_FAILURE (status)) { | 398 | if (ACPI_FAILURE(status)) { |
423 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 399 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
424 | "RSDP structure not found, %s Flags=%X\n", | 400 | "RSDP structure not found, %s Flags=%X\n", |
425 | acpi_format_exception (status), flags)); | 401 | acpi_format_exception(status), flags)); |
426 | 402 | ||
427 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); | 403 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); |
428 | } | 404 | } |
429 | 405 | ||
430 | rsdp_address->pointer_type = ACPI_PHYSICAL_POINTER; | 406 | rsdp_address->pointer_type = ACPI_PHYSICAL_POINTER; |
431 | rsdp_address->pointer.physical = table_info.physical_address; | 407 | rsdp_address->pointer.physical = table_info.physical_address; |
432 | return_ACPI_STATUS (AE_OK); | 408 | return_ACPI_STATUS(AE_OK); |
433 | } | 409 | } |
434 | 410 | ||
435 | |||
436 | /******************************************************************************* | 411 | /******************************************************************************* |
437 | * | 412 | * |
438 | * FUNCTION: acpi_tb_scan_memory_for_rsdp | 413 | * FUNCTION: acpi_tb_scan_memory_for_rsdp |
@@ -446,34 +421,32 @@ acpi_find_root_pointer ( | |||
446 | * | 421 | * |
447 | ******************************************************************************/ | 422 | ******************************************************************************/ |
448 | 423 | ||
449 | static u8 * | 424 | static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) |
450 | acpi_tb_scan_memory_for_rsdp ( | ||
451 | u8 *start_address, | ||
452 | u32 length) | ||
453 | { | 425 | { |
454 | acpi_status status; | 426 | acpi_status status; |
455 | u8 *mem_rover; | 427 | u8 *mem_rover; |
456 | u8 *end_address; | 428 | u8 *end_address; |
457 | |||
458 | |||
459 | ACPI_FUNCTION_TRACE ("tb_scan_memory_for_rsdp"); | ||
460 | 429 | ||
430 | ACPI_FUNCTION_TRACE("tb_scan_memory_for_rsdp"); | ||
461 | 431 | ||
462 | end_address = start_address + length; | 432 | end_address = start_address + length; |
463 | 433 | ||
464 | /* Search from given start address for the requested length */ | 434 | /* Search from given start address for the requested length */ |
465 | 435 | ||
466 | for (mem_rover = start_address; mem_rover < end_address; | 436 | for (mem_rover = start_address; mem_rover < end_address; |
467 | mem_rover += ACPI_RSDP_SCAN_STEP) { | 437 | mem_rover += ACPI_RSDP_SCAN_STEP) { |
468 | /* The RSDP signature and checksum must both be correct */ | 438 | /* The RSDP signature and checksum must both be correct */ |
469 | 439 | ||
470 | status = acpi_tb_validate_rsdp (ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover)); | 440 | status = |
471 | if (ACPI_SUCCESS (status)) { | 441 | acpi_tb_validate_rsdp(ACPI_CAST_PTR |
442 | (struct rsdp_descriptor, mem_rover)); | ||
443 | if (ACPI_SUCCESS(status)) { | ||
472 | /* Sig and checksum valid, we have found a real RSDP */ | 444 | /* Sig and checksum valid, we have found a real RSDP */ |
473 | 445 | ||
474 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 446 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
475 | "RSDP located at physical address %p\n", mem_rover)); | 447 | "RSDP located at physical address %p\n", |
476 | return_PTR (mem_rover); | 448 | mem_rover)); |
449 | return_PTR(mem_rover); | ||
477 | } | 450 | } |
478 | 451 | ||
479 | /* No sig match or bad checksum, keep searching */ | 452 | /* No sig match or bad checksum, keep searching */ |
@@ -481,13 +454,12 @@ acpi_tb_scan_memory_for_rsdp ( | |||
481 | 454 | ||
482 | /* Searched entire block, no RSDP was found */ | 455 | /* Searched entire block, no RSDP was found */ |
483 | 456 | ||
484 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 457 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
485 | "Searched entire block from %p, valid RSDP was not found\n", | 458 | "Searched entire block from %p, valid RSDP was not found\n", |
486 | start_address)); | 459 | start_address)); |
487 | return_PTR (NULL); | 460 | return_PTR(NULL); |
488 | } | 461 | } |
489 | 462 | ||
490 | |||
491 | /******************************************************************************* | 463 | /******************************************************************************* |
492 | * | 464 | * |
493 | * FUNCTION: acpi_tb_find_rsdp | 465 | * FUNCTION: acpi_tb_find_rsdp |
@@ -511,18 +483,14 @@ acpi_tb_scan_memory_for_rsdp ( | |||
511 | ******************************************************************************/ | 483 | ******************************************************************************/ |
512 | 484 | ||
513 | static acpi_status | 485 | static acpi_status |
514 | acpi_tb_find_rsdp ( | 486 | acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) |
515 | struct acpi_table_desc *table_info, | ||
516 | u32 flags) | ||
517 | { | 487 | { |
518 | u8 *table_ptr; | 488 | u8 *table_ptr; |
519 | u8 *mem_rover; | 489 | u8 *mem_rover; |
520 | u32 physical_address; | 490 | u32 physical_address; |
521 | acpi_status status; | 491 | acpi_status status; |
522 | |||
523 | |||
524 | ACPI_FUNCTION_TRACE ("tb_find_rsdp"); | ||
525 | 492 | ||
493 | ACPI_FUNCTION_TRACE("tb_find_rsdp"); | ||
526 | 494 | ||
527 | /* | 495 | /* |
528 | * Scan supports either logical addressing or physical addressing | 496 | * Scan supports either logical addressing or physical addressing |
@@ -530,23 +498,25 @@ acpi_tb_find_rsdp ( | |||
530 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { | 498 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { |
531 | /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ | 499 | /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ |
532 | 500 | ||
533 | status = acpi_os_map_memory ( | 501 | status = acpi_os_map_memory((acpi_physical_address) |
534 | (acpi_physical_address) ACPI_EBDA_PTR_LOCATION, | 502 | ACPI_EBDA_PTR_LOCATION, |
535 | ACPI_EBDA_PTR_LENGTH, (void *) &table_ptr); | 503 | ACPI_EBDA_PTR_LENGTH, |
536 | if (ACPI_FAILURE (status)) { | 504 | (void *)&table_ptr); |
537 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 505 | if (ACPI_FAILURE(status)) { |
538 | "Could not map memory at %8.8X for length %X\n", | 506 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
539 | ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); | 507 | "Could not map memory at %8.8X for length %X\n", |
540 | 508 | ACPI_EBDA_PTR_LOCATION, | |
541 | return_ACPI_STATUS (status); | 509 | ACPI_EBDA_PTR_LENGTH)); |
510 | |||
511 | return_ACPI_STATUS(status); | ||
542 | } | 512 | } |
543 | 513 | ||
544 | ACPI_MOVE_16_TO_32 (&physical_address, table_ptr); | 514 | ACPI_MOVE_16_TO_32(&physical_address, table_ptr); |
545 | 515 | ||
546 | /* Convert segment part to physical address */ | 516 | /* Convert segment part to physical address */ |
547 | 517 | ||
548 | physical_address <<= 4; | 518 | physical_address <<= 4; |
549 | acpi_os_unmap_memory (table_ptr, ACPI_EBDA_PTR_LENGTH); | 519 | acpi_os_unmap_memory(table_ptr, ACPI_EBDA_PTR_LENGTH); |
550 | 520 | ||
551 | /* EBDA present? */ | 521 | /* EBDA present? */ |
552 | 522 | ||
@@ -555,59 +525,67 @@ acpi_tb_find_rsdp ( | |||
555 | * 1b) Search EBDA paragraphs (EBDa is required to be a | 525 | * 1b) Search EBDA paragraphs (EBDa is required to be a |
556 | * minimum of 1_k length) | 526 | * minimum of 1_k length) |
557 | */ | 527 | */ |
558 | status = acpi_os_map_memory ( | 528 | status = acpi_os_map_memory((acpi_physical_address) |
559 | (acpi_physical_address) physical_address, | 529 | physical_address, |
560 | ACPI_EBDA_WINDOW_SIZE, (void *) &table_ptr); | 530 | ACPI_EBDA_WINDOW_SIZE, |
561 | if (ACPI_FAILURE (status)) { | 531 | (void *)&table_ptr); |
562 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 532 | if (ACPI_FAILURE(status)) { |
563 | "Could not map memory at %8.8X for length %X\n", | 533 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
564 | physical_address, ACPI_EBDA_WINDOW_SIZE)); | 534 | "Could not map memory at %8.8X for length %X\n", |
565 | 535 | physical_address, | |
566 | return_ACPI_STATUS (status); | 536 | ACPI_EBDA_WINDOW_SIZE)); |
537 | |||
538 | return_ACPI_STATUS(status); | ||
567 | } | 539 | } |
568 | 540 | ||
569 | mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, | 541 | mem_rover = acpi_tb_scan_memory_for_rsdp(table_ptr, |
570 | ACPI_EBDA_WINDOW_SIZE); | 542 | ACPI_EBDA_WINDOW_SIZE); |
571 | acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE); | 543 | acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE); |
572 | 544 | ||
573 | if (mem_rover) { | 545 | if (mem_rover) { |
574 | /* Return the physical address */ | 546 | /* Return the physical address */ |
575 | 547 | ||
576 | physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr); | 548 | physical_address += |
549 | ACPI_PTR_DIFF(mem_rover, table_ptr); | ||
577 | 550 | ||
578 | table_info->physical_address = | 551 | table_info->physical_address = |
579 | (acpi_physical_address) physical_address; | 552 | (acpi_physical_address) physical_address; |
580 | return_ACPI_STATUS (AE_OK); | 553 | return_ACPI_STATUS(AE_OK); |
581 | } | 554 | } |
582 | } | 555 | } |
583 | 556 | ||
584 | /* | 557 | /* |
585 | * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh | 558 | * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh |
586 | */ | 559 | */ |
587 | status = acpi_os_map_memory ( | 560 | status = acpi_os_map_memory((acpi_physical_address) |
588 | (acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE, | 561 | ACPI_HI_RSDP_WINDOW_BASE, |
589 | ACPI_HI_RSDP_WINDOW_SIZE, (void *) &table_ptr); | 562 | ACPI_HI_RSDP_WINDOW_SIZE, |
590 | 563 | (void *)&table_ptr); | |
591 | if (ACPI_FAILURE (status)) { | 564 | |
592 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 565 | if (ACPI_FAILURE(status)) { |
593 | "Could not map memory at %8.8X for length %X\n", | 566 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
594 | ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); | 567 | "Could not map memory at %8.8X for length %X\n", |
595 | 568 | ACPI_HI_RSDP_WINDOW_BASE, | |
596 | return_ACPI_STATUS (status); | 569 | ACPI_HI_RSDP_WINDOW_SIZE)); |
570 | |||
571 | return_ACPI_STATUS(status); | ||
597 | } | 572 | } |
598 | 573 | ||
599 | mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); | 574 | mem_rover = |
600 | acpi_os_unmap_memory (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); | 575 | acpi_tb_scan_memory_for_rsdp(table_ptr, |
576 | ACPI_HI_RSDP_WINDOW_SIZE); | ||
577 | acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); | ||
601 | 578 | ||
602 | if (mem_rover) { | 579 | if (mem_rover) { |
603 | /* Return the physical address */ | 580 | /* Return the physical address */ |
604 | 581 | ||
605 | physical_address = | 582 | physical_address = |
606 | ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr); | 583 | ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF(mem_rover, |
584 | table_ptr); | ||
607 | 585 | ||
608 | table_info->physical_address = | 586 | table_info->physical_address = |
609 | (acpi_physical_address) physical_address; | 587 | (acpi_physical_address) physical_address; |
610 | return_ACPI_STATUS (AE_OK); | 588 | return_ACPI_STATUS(AE_OK); |
611 | } | 589 | } |
612 | } | 590 | } |
613 | 591 | ||
@@ -617,8 +595,8 @@ acpi_tb_find_rsdp ( | |||
617 | else { | 595 | else { |
618 | /* 1a) Get the location of the EBDA */ | 596 | /* 1a) Get the location of the EBDA */ |
619 | 597 | ||
620 | ACPI_MOVE_16_TO_32 (&physical_address, ACPI_EBDA_PTR_LOCATION); | 598 | ACPI_MOVE_16_TO_32(&physical_address, ACPI_EBDA_PTR_LOCATION); |
621 | physical_address <<= 4; /* Convert segment to physical address */ | 599 | physical_address <<= 4; /* Convert segment to physical address */ |
622 | 600 | ||
623 | /* EBDA present? */ | 601 | /* EBDA present? */ |
624 | 602 | ||
@@ -627,35 +605,38 @@ acpi_tb_find_rsdp ( | |||
627 | * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of | 605 | * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of |
628 | * 1_k length) | 606 | * 1_k length) |
629 | */ | 607 | */ |
630 | mem_rover = acpi_tb_scan_memory_for_rsdp ( | 608 | mem_rover = |
631 | ACPI_PHYSADDR_TO_PTR (physical_address), | 609 | acpi_tb_scan_memory_for_rsdp(ACPI_PHYSADDR_TO_PTR |
632 | ACPI_EBDA_WINDOW_SIZE); | 610 | (physical_address), |
611 | ACPI_EBDA_WINDOW_SIZE); | ||
633 | if (mem_rover) { | 612 | if (mem_rover) { |
634 | /* Return the physical address */ | 613 | /* Return the physical address */ |
635 | 614 | ||
636 | table_info->physical_address = ACPI_TO_INTEGER (mem_rover); | 615 | table_info->physical_address = |
637 | return_ACPI_STATUS (AE_OK); | 616 | ACPI_TO_INTEGER(mem_rover); |
617 | return_ACPI_STATUS(AE_OK); | ||
638 | } | 618 | } |
639 | } | 619 | } |
640 | 620 | ||
641 | /* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */ | 621 | /* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */ |
642 | 622 | ||
643 | mem_rover = acpi_tb_scan_memory_for_rsdp ( | 623 | mem_rover = |
644 | ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE), | 624 | acpi_tb_scan_memory_for_rsdp(ACPI_PHYSADDR_TO_PTR |
645 | ACPI_HI_RSDP_WINDOW_SIZE); | 625 | (ACPI_HI_RSDP_WINDOW_BASE), |
626 | ACPI_HI_RSDP_WINDOW_SIZE); | ||
646 | if (mem_rover) { | 627 | if (mem_rover) { |
647 | /* Found it, return the physical address */ | 628 | /* Found it, return the physical address */ |
648 | 629 | ||
649 | table_info->physical_address = ACPI_TO_INTEGER (mem_rover); | 630 | table_info->physical_address = |
650 | return_ACPI_STATUS (AE_OK); | 631 | ACPI_TO_INTEGER(mem_rover); |
632 | return_ACPI_STATUS(AE_OK); | ||
651 | } | 633 | } |
652 | } | 634 | } |
653 | 635 | ||
654 | /* A valid RSDP was not found */ | 636 | /* A valid RSDP was not found */ |
655 | 637 | ||
656 | ACPI_REPORT_ERROR (("No valid RSDP was found\n")); | 638 | ACPI_REPORT_ERROR(("No valid RSDP was found\n")); |
657 | return_ACPI_STATUS (AE_NOT_FOUND); | 639 | return_ACPI_STATUS(AE_NOT_FOUND); |
658 | } | 640 | } |
659 | 641 | ||
660 | #endif | 642 | #endif |
661 | |||