diff options
author | Bob Moore <robert.moore@intel.com> | 2007-02-02 11:48:20 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-02-02 21:14:24 -0500 |
commit | 765ec20180fb70b4ee9d730167b2a0b76879f791 (patch) | |
tree | 1fd0a7ce30dc80be45f6ff21b1ef5c12bf0e8915 /drivers/acpi/tables | |
parent | 1ba753acb372c2955a4843302e92e49ce82e2fea (diff) |
ACPICA: Delete stale FADT functions outside tbfadt.c.
Moved all FADT-related functions to a new file, tbfadt.c.
Eliminated the acpi_hw_initialize function - the
FADT registers are now validated when the table is loaded.
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')
-rw-r--r-- | drivers/acpi/tables/tbutils.c | 238 |
1 files changed, 1 insertions, 237 deletions
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 6d13737f3f89..54e53e619e6b 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c | |||
@@ -48,57 +48,10 @@ | |||
48 | ACPI_MODULE_NAME("tbutils") | 48 | ACPI_MODULE_NAME("tbutils") |
49 | 49 | ||
50 | /* Local prototypes */ | 50 | /* Local prototypes */ |
51 | static void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags); | ||
52 | |||
53 | static void acpi_tb_convert_fadt(void); | ||
54 | |||
55 | static void | ||
56 | acpi_tb_install_table(acpi_physical_address address, | ||
57 | u8 flags, char *signature, acpi_native_uint table_index); | ||
58 | |||
59 | static void inline | ||
60 | acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, | ||
61 | u8 bit_width, u64 address); | ||
62 | |||
63 | static acpi_physical_address | 51 | static acpi_physical_address |
64 | acpi_tb_get_root_table_entry(u8 * table_entry, | 52 | acpi_tb_get_root_table_entry(u8 * table_entry, |
65 | acpi_native_uint table_entry_size); | 53 | acpi_native_uint table_entry_size); |
66 | 54 | ||
67 | /* Table used for conversion of FADT to common format */ | ||
68 | |||
69 | typedef struct acpi_fadt_conversion { | ||
70 | u8 target; | ||
71 | u8 source; | ||
72 | u8 length; | ||
73 | |||
74 | } acpi_fadt_conversion; | ||
75 | |||
76 | static struct acpi_fadt_conversion fadt_conversion_table[] = { | ||
77 | {ACPI_FADT_OFFSET(xpm1a_event_block), | ||
78 | ACPI_FADT_OFFSET(pm1a_event_block), | ||
79 | ACPI_FADT_OFFSET(pm1_event_length)}, | ||
80 | {ACPI_FADT_OFFSET(xpm1b_event_block), | ||
81 | ACPI_FADT_OFFSET(pm1b_event_block), | ||
82 | ACPI_FADT_OFFSET(pm1_event_length)}, | ||
83 | {ACPI_FADT_OFFSET(xpm1a_control_block), | ||
84 | ACPI_FADT_OFFSET(pm1a_control_block), | ||
85 | ACPI_FADT_OFFSET(pm1_control_length)}, | ||
86 | {ACPI_FADT_OFFSET(xpm1b_control_block), | ||
87 | ACPI_FADT_OFFSET(pm1b_control_block), | ||
88 | ACPI_FADT_OFFSET(pm1_control_length)}, | ||
89 | {ACPI_FADT_OFFSET(xpm2_control_block), | ||
90 | ACPI_FADT_OFFSET(pm2_control_block), | ||
91 | ACPI_FADT_OFFSET(pm2_control_length)}, | ||
92 | {ACPI_FADT_OFFSET(xpm_timer_block), ACPI_FADT_OFFSET(pm_timer_block), | ||
93 | ACPI_FADT_OFFSET(pm_timer_length)}, | ||
94 | {ACPI_FADT_OFFSET(xgpe0_block), ACPI_FADT_OFFSET(gpe0_block), | ||
95 | ACPI_FADT_OFFSET(gpe0_block_length)}, | ||
96 | {ACPI_FADT_OFFSET(xgpe1_block), ACPI_FADT_OFFSET(gpe1_block), | ||
97 | ACPI_FADT_OFFSET(gpe1_block_length)} | ||
98 | }; | ||
99 | |||
100 | #define ACPI_FADT_CONVERSION_ENTRIES (sizeof (fadt_conversion_table) / sizeof (struct acpi_fadt_conversion)) | ||
101 | |||
102 | /******************************************************************************* | 55 | /******************************************************************************* |
103 | * | 56 | * |
104 | * FUNCTION: acpi_tb_print_table_header | 57 | * FUNCTION: acpi_tb_print_table_header |
@@ -153,32 +106,6 @@ acpi_tb_print_table_header(acpi_physical_address address, | |||
153 | 106 | ||
154 | /******************************************************************************* | 107 | /******************************************************************************* |
155 | * | 108 | * |
156 | * FUNCTION: acpi_tb_init_generic_address | ||
157 | * | ||
158 | * PARAMETERS: new_gas_struct - GAS struct to be initialized | ||
159 | * bit_width - Width of this register | ||
160 | * Address - Address of the register | ||
161 | * | ||
162 | * RETURN: None | ||
163 | * | ||
164 | * DESCRIPTION: Initialize a GAS structure. | ||
165 | * | ||
166 | ******************************************************************************/ | ||
167 | |||
168 | static void inline | ||
169 | acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, | ||
170 | u8 bit_width, u64 address) | ||
171 | { | ||
172 | |||
173 | ACPI_MOVE_64_TO_64(&new_gas_struct->address, &address); | ||
174 | new_gas_struct->space_id = ACPI_ADR_SPACE_SYSTEM_IO; | ||
175 | new_gas_struct->bit_width = bit_width; | ||
176 | new_gas_struct->bit_offset = 0; | ||
177 | new_gas_struct->access_width = 0; | ||
178 | } | ||
179 | |||
180 | /******************************************************************************* | ||
181 | * | ||
182 | * FUNCTION: acpi_tb_validate_checksum | 109 | * FUNCTION: acpi_tb_validate_checksum |
183 | * | 110 | * |
184 | * PARAMETERS: Table - ACPI table to verify | 111 | * PARAMETERS: Table - ACPI table to verify |
@@ -243,107 +170,6 @@ u8 acpi_tb_checksum(u8 * buffer, acpi_native_uint length) | |||
243 | 170 | ||
244 | /******************************************************************************* | 171 | /******************************************************************************* |
245 | * | 172 | * |
246 | * FUNCTION: acpi_tb_convert_fadt | ||
247 | * | ||
248 | * PARAMETERS: None, uses acpi_gbl_FADT | ||
249 | * | ||
250 | * RETURN: None | ||
251 | * | ||
252 | * DESCRIPTION: Converts all versions of the FADT to a common internal format. | ||
253 | * | ||
254 | * NOTE: acpi_gbl_FADT must be of size (struct acpi_table_fadt), and must contain | ||
255 | * a copy of the actual FADT. | ||
256 | * | ||
257 | * ACPICA will use the "X" fields of the FADT for all addresses. | ||
258 | * | ||
259 | * "X" fields are optional extensions to the original V1.0 fields. Even if | ||
260 | * they are present in the structure, they can be optionally not used by | ||
261 | * setting them to zero. Therefore, we must selectively expand V1.0 fields | ||
262 | * if the corresponding X field is zero. | ||
263 | * | ||
264 | * For ACPI 1.0 FADTs, all address fields are expanded to the corresponding | ||
265 | * "X" fields. | ||
266 | * | ||
267 | * For ACPI 2.0 FADTs, any "X" fields that are NULL are filled in by | ||
268 | * expanding the corresponding ACPI 1.0 field. | ||
269 | * | ||
270 | ******************************************************************************/ | ||
271 | |||
272 | static void acpi_tb_convert_fadt(void) | ||
273 | { | ||
274 | u8 pm1_register_length; | ||
275 | struct acpi_generic_address *target; | ||
276 | acpi_native_uint i; | ||
277 | |||
278 | /* Expand the FACS and DSDT addresses as necessary */ | ||
279 | |||
280 | if (!acpi_gbl_FADT.Xfacs) { | ||
281 | acpi_gbl_FADT.Xfacs = (u64) acpi_gbl_FADT.facs; | ||
282 | } | ||
283 | |||
284 | if (!acpi_gbl_FADT.Xdsdt) { | ||
285 | acpi_gbl_FADT.Xdsdt = (u64) acpi_gbl_FADT.dsdt; | ||
286 | } | ||
287 | |||
288 | /* | ||
289 | * Expand the 32-bit V1.0 addresses to the 64-bit "X" generic address | ||
290 | * structures as necessary. | ||
291 | */ | ||
292 | for (i = 0; i < ACPI_FADT_CONVERSION_ENTRIES; i++) { | ||
293 | target = | ||
294 | ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, | ||
295 | fadt_conversion_table[i].target); | ||
296 | |||
297 | /* Expand only if the X target is null */ | ||
298 | |||
299 | if (!target->address) { | ||
300 | acpi_tb_init_generic_address(target, | ||
301 | *ACPI_ADD_PTR(u8, | ||
302 | &acpi_gbl_FADT, | ||
303 | fadt_conversion_table | ||
304 | [i].length), | ||
305 | (u64) * ACPI_ADD_PTR(u32, | ||
306 | &acpi_gbl_FADT, | ||
307 | fadt_conversion_table | ||
308 | [i]. | ||
309 | source)); | ||
310 | } | ||
311 | } | ||
312 | |||
313 | /* | ||
314 | * Calculate separate GAS structs for the PM1 Enable registers. | ||
315 | * These addresses do not appear (directly) in the FADT, so it is | ||
316 | * useful to calculate them once, here. | ||
317 | * | ||
318 | * The PM event blocks are split into two register blocks, first is the | ||
319 | * PM Status Register block, followed immediately by the PM Enable Register | ||
320 | * block. Each is of length (pm1_event_length/2) | ||
321 | */ | ||
322 | pm1_register_length = (u8) ACPI_DIV_2(acpi_gbl_FADT.pm1_event_length); | ||
323 | |||
324 | /* PM1A is required */ | ||
325 | |||
326 | acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable, | ||
327 | pm1_register_length, | ||
328 | (acpi_gbl_FADT.xpm1a_event_block.address + | ||
329 | pm1_register_length)); | ||
330 | |||
331 | /* PM1B is optional; leave null if not present */ | ||
332 | |||
333 | if (acpi_gbl_FADT.xpm1b_event_block.address) { | ||
334 | acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable, | ||
335 | pm1_register_length, | ||
336 | (acpi_gbl_FADT.xpm1b_event_block. | ||
337 | address + pm1_register_length)); | ||
338 | } | ||
339 | |||
340 | /* Global FADT is the new common V2.0 FADT */ | ||
341 | |||
342 | acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt); | ||
343 | } | ||
344 | |||
345 | /******************************************************************************* | ||
346 | * | ||
347 | * FUNCTION: acpi_tb_install_table | 173 | * FUNCTION: acpi_tb_install_table |
348 | * | 174 | * |
349 | * PARAMETERS: Address - Physical address of DSDT or FACS | 175 | * PARAMETERS: Address - Physical address of DSDT or FACS |
@@ -358,7 +184,7 @@ static void acpi_tb_convert_fadt(void) | |||
358 | * | 184 | * |
359 | ******************************************************************************/ | 185 | ******************************************************************************/ |
360 | 186 | ||
361 | static void | 187 | void |
362 | acpi_tb_install_table(acpi_physical_address address, | 188 | acpi_tb_install_table(acpi_physical_address address, |
363 | u8 flags, char *signature, acpi_native_uint table_index) | 189 | u8 flags, char *signature, acpi_native_uint table_index) |
364 | { | 190 | { |
@@ -412,68 +238,6 @@ acpi_tb_install_table(acpi_physical_address address, | |||
412 | 238 | ||
413 | /******************************************************************************* | 239 | /******************************************************************************* |
414 | * | 240 | * |
415 | * FUNCTION: acpi_tb_parse_fadt | ||
416 | * | ||
417 | * PARAMETERS: table_index - Index for the FADT | ||
418 | * Flags - Flags | ||
419 | * | ||
420 | * RETURN: None | ||
421 | * | ||
422 | * DESCRIPTION: Initialize the FADT, DSDT and FACS tables | ||
423 | * (FADT contains the addresses of the DSDT and FACS) | ||
424 | * | ||
425 | ******************************************************************************/ | ||
426 | |||
427 | static void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags) | ||
428 | { | ||
429 | u32 length; | ||
430 | struct acpi_table_header *table; | ||
431 | |||
432 | /* | ||
433 | * Special case for the FADT because of multiple versions and the fact | ||
434 | * that it contains pointers to both the DSDT and FACS tables. | ||
435 | * | ||
436 | * Get a local copy of the FADT and convert it to a common format | ||
437 | * Map entire FADT, assumed to be smaller than one page. | ||
438 | */ | ||
439 | length = acpi_gbl_root_table_list.tables[table_index].length; | ||
440 | |||
441 | table = | ||
442 | acpi_os_map_memory(acpi_gbl_root_table_list.tables[table_index]. | ||
443 | address, length); | ||
444 | if (!table) { | ||
445 | return; | ||
446 | } | ||
447 | |||
448 | /* | ||
449 | * Validate the FADT checksum before we copy the table. Ignore | ||
450 | * checksum error as we want to try to get the DSDT and FACS. | ||
451 | */ | ||
452 | (void)acpi_tb_verify_checksum(table, length); | ||
453 | |||
454 | /* Copy the entire FADT locally */ | ||
455 | |||
456 | ACPI_MEMSET(&acpi_gbl_FADT, 0, sizeof(struct acpi_table_fadt)); | ||
457 | |||
458 | ACPI_MEMCPY(&acpi_gbl_FADT, table, | ||
459 | ACPI_MIN(length, sizeof(struct acpi_table_fadt))); | ||
460 | acpi_os_unmap_memory(table, length); | ||
461 | |||
462 | /* Convert local FADT to the common internal format */ | ||
463 | |||
464 | acpi_tb_convert_fadt(); | ||
465 | |||
466 | /* Extract the DSDT and FACS tables from the FADT */ | ||
467 | |||
468 | acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xdsdt, | ||
469 | flags, ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT); | ||
470 | |||
471 | acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xfacs, | ||
472 | flags, ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); | ||
473 | } | ||
474 | |||
475 | /******************************************************************************* | ||
476 | * | ||
477 | * FUNCTION: acpi_tb_get_root_table_entry | 241 | * FUNCTION: acpi_tb_get_root_table_entry |
478 | * | 242 | * |
479 | * PARAMETERS: table_entry - Pointer to the RSDT/XSDT table entry | 243 | * PARAMETERS: table_entry - Pointer to the RSDT/XSDT table entry |