diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/hardware/hwacpi.c | 29 | ||||
-rw-r--r-- | drivers/acpi/tables/tbutils.c | 238 | ||||
-rw-r--r-- | drivers/acpi/utilities/utinit.c | 95 | ||||
-rw-r--r-- | drivers/acpi/utilities/utxface.c | 14 |
4 files changed, 1 insertions, 375 deletions
diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index 14e8111769a3..9c7df711c18d 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c | |||
@@ -49,34 +49,6 @@ ACPI_MODULE_NAME("hwacpi") | |||
49 | 49 | ||
50 | /****************************************************************************** | 50 | /****************************************************************************** |
51 | * | 51 | * |
52 | * FUNCTION: acpi_hw_initialize | ||
53 | * | ||
54 | * PARAMETERS: None | ||
55 | * | ||
56 | * RETURN: Status | ||
57 | * | ||
58 | * DESCRIPTION: Initialize and validate the various ACPI registers defined in | ||
59 | * the FADT. | ||
60 | * | ||
61 | ******************************************************************************/ | ||
62 | acpi_status acpi_hw_initialize(void) | ||
63 | { | ||
64 | acpi_status status; | ||
65 | |||
66 | ACPI_FUNCTION_TRACE(hw_initialize); | ||
67 | |||
68 | /* Sanity check the FADT for valid values */ | ||
69 | |||
70 | status = acpi_ut_validate_fadt(); | ||
71 | if (ACPI_FAILURE(status)) { | ||
72 | return_ACPI_STATUS(status); | ||
73 | } | ||
74 | |||
75 | return_ACPI_STATUS(AE_OK); | ||
76 | } | ||
77 | |||
78 | /****************************************************************************** | ||
79 | * | ||
80 | * FUNCTION: acpi_hw_set_mode | 52 | * FUNCTION: acpi_hw_set_mode |
81 | * | 53 | * |
82 | * PARAMETERS: Mode - SYS_MODE_ACPI or SYS_MODE_LEGACY | 54 | * PARAMETERS: Mode - SYS_MODE_ACPI or SYS_MODE_LEGACY |
@@ -86,7 +58,6 @@ acpi_status acpi_hw_initialize(void) | |||
86 | * DESCRIPTION: Transitions the system into the requested mode. | 58 | * DESCRIPTION: Transitions the system into the requested mode. |
87 | * | 59 | * |
88 | ******************************************************************************/ | 60 | ******************************************************************************/ |
89 | |||
90 | acpi_status acpi_hw_set_mode(u32 mode) | 61 | acpi_status acpi_hw_set_mode(u32 mode) |
91 | { | 62 | { |
92 | 63 | ||
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 |
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index 5079f1943a3b..303bde70fdb6 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c | |||
@@ -50,103 +50,8 @@ | |||
50 | ACPI_MODULE_NAME("utinit") | 50 | ACPI_MODULE_NAME("utinit") |
51 | 51 | ||
52 | /* Local prototypes */ | 52 | /* Local prototypes */ |
53 | static void acpi_ut_fadt_register_error(char *register_name, u32 value); | ||
54 | |||
55 | static void acpi_ut_terminate(void); | 53 | static void acpi_ut_terminate(void); |
56 | 54 | ||
57 | /******************************************************************************* | ||
58 | * | ||
59 | * FUNCTION: acpi_ut_fadt_register_error | ||
60 | * | ||
61 | * PARAMETERS: register_name - Pointer to string identifying register | ||
62 | * Value - Actual register contents value | ||
63 | * | ||
64 | * RETURN: None | ||
65 | * | ||
66 | * DESCRIPTION: Display failure message | ||
67 | * | ||
68 | ******************************************************************************/ | ||
69 | |||
70 | static void acpi_ut_fadt_register_error(char *register_name, u32 value) | ||
71 | { | ||
72 | |||
73 | ACPI_WARNING((AE_INFO, "Invalid FADT value %s = %X", | ||
74 | register_name, value)); | ||
75 | } | ||
76 | |||
77 | /****************************************************************************** | ||
78 | * | ||
79 | * FUNCTION: acpi_ut_validate_fadt | ||
80 | * | ||
81 | * PARAMETERS: None | ||
82 | * | ||
83 | * RETURN: Status | ||
84 | * | ||
85 | * DESCRIPTION: Validate various ACPI registers in the FADT | ||
86 | * | ||
87 | ******************************************************************************/ | ||
88 | |||
89 | acpi_status acpi_ut_validate_fadt(void) | ||
90 | { | ||
91 | |||
92 | /* | ||
93 | * Verify Fixed ACPI Description Table fields, | ||
94 | * but don't abort on any problems, just display error | ||
95 | */ | ||
96 | if (acpi_gbl_FADT.pm1_event_length < 4) { | ||
97 | acpi_ut_fadt_register_error("Pm1EventLength", | ||
98 | (u32) acpi_gbl_FADT. | ||
99 | pm1_event_length); | ||
100 | } | ||
101 | |||
102 | if (acpi_gbl_FADT.pm_timer_length < 4) { | ||
103 | acpi_ut_fadt_register_error("PmTimerLength", | ||
104 | (u32) acpi_gbl_FADT. | ||
105 | pm_timer_length); | ||
106 | } | ||
107 | |||
108 | if (!acpi_gbl_FADT.pm1_control_length) { | ||
109 | acpi_ut_fadt_register_error("Pm1ControlLength", 0); | ||
110 | } | ||
111 | |||
112 | if (!acpi_gbl_FADT.xpm1a_event_block.address) { | ||
113 | acpi_ut_fadt_register_error("XPm1aEventBlock.Address", 0); | ||
114 | } | ||
115 | |||
116 | if (!acpi_gbl_FADT.xpm1a_control_block.address) { | ||
117 | acpi_ut_fadt_register_error("XPm1aControlBlock.Address", 0); | ||
118 | } | ||
119 | |||
120 | if (!acpi_gbl_FADT.xpm_timer_block.address) { | ||
121 | acpi_ut_fadt_register_error("XPmTimerBlock.Address", 0); | ||
122 | } | ||
123 | |||
124 | if ((acpi_gbl_FADT.xpm2_control_block.address && | ||
125 | !acpi_gbl_FADT.pm2_control_length)) { | ||
126 | acpi_ut_fadt_register_error("Pm2ControlLength", | ||
127 | (u32) acpi_gbl_FADT. | ||
128 | pm2_control_length); | ||
129 | } | ||
130 | |||
131 | /* Length of GPE blocks must be a multiple of 2 */ | ||
132 | |||
133 | if (acpi_gbl_FADT.xgpe0_block.address && | ||
134 | (acpi_gbl_FADT.gpe0_block_length & 1)) { | ||
135 | acpi_ut_fadt_register_error("Gpe0BlockLength", | ||
136 | (u32) acpi_gbl_FADT. | ||
137 | gpe0_block_length); | ||
138 | } | ||
139 | |||
140 | if (acpi_gbl_FADT.xgpe1_block.address && | ||
141 | (acpi_gbl_FADT.gpe1_block_length & 1)) { | ||
142 | acpi_ut_fadt_register_error("Gpe1BlockLength", | ||
143 | (u32) acpi_gbl_FADT. | ||
144 | gpe1_block_length); | ||
145 | } | ||
146 | |||
147 | return (AE_OK); | ||
148 | } | ||
149 | |||
150 | /****************************************************************************** | 55 | /****************************************************************************** |
151 | * | 56 | * |
152 | * FUNCTION: acpi_ut_terminate | 57 | * FUNCTION: acpi_ut_terminate |
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index 7ea2981d4382..bec0f543e1c7 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c | |||
@@ -127,20 +127,6 @@ acpi_status acpi_enable_subsystem(u32 flags) | |||
127 | 127 | ||
128 | ACPI_FUNCTION_TRACE(acpi_enable_subsystem); | 128 | ACPI_FUNCTION_TRACE(acpi_enable_subsystem); |
129 | 129 | ||
130 | /* | ||
131 | * We must initialize the hardware before we can enable ACPI. | ||
132 | * The values from the FADT are validated here. | ||
133 | */ | ||
134 | if (!(flags & ACPI_NO_HARDWARE_INIT)) { | ||
135 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
136 | "[Init] Initializing ACPI hardware\n")); | ||
137 | |||
138 | status = acpi_hw_initialize(); | ||
139 | if (ACPI_FAILURE(status)) { | ||
140 | return_ACPI_STATUS(status); | ||
141 | } | ||
142 | } | ||
143 | |||
144 | /* Enable ACPI mode */ | 130 | /* Enable ACPI mode */ |
145 | 131 | ||
146 | if (!(flags & ACPI_NO_ACPI_ENABLE)) { | 132 | if (!(flags & ACPI_NO_ACPI_ENABLE)) { |