diff options
Diffstat (limited to 'drivers/acpi/tables/tbconvrt.c')
-rw-r--r-- | drivers/acpi/tables/tbconvrt.c | 402 |
1 files changed, 204 insertions, 198 deletions
diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c index d4ff71f5fe5d..a03939399fa9 100644 --- a/drivers/acpi/tables/tbconvrt.c +++ b/drivers/acpi/tables/tbconvrt.c | |||
@@ -46,28 +46,22 @@ | |||
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 ("tbconvrt") | 50 | ACPI_MODULE_NAME("tbconvrt") |
52 | 51 | ||
53 | /* Local prototypes */ | 52 | /* Local prototypes */ |
54 | |||
55 | static void | 53 | static void |
56 | acpi_tb_init_generic_address ( | 54 | acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, |
57 | struct acpi_generic_address *new_gas_struct, | 55 | u8 register_bit_width, |
58 | u8 register_bit_width, | 56 | acpi_physical_address address); |
59 | acpi_physical_address address); | ||
60 | 57 | ||
61 | static void | 58 | static void |
62 | acpi_tb_convert_fadt1 ( | 59 | acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, |
63 | struct fadt_descriptor_rev2 *local_fadt, | 60 | struct fadt_descriptor_rev1 *original_fadt); |
64 | struct fadt_descriptor_rev1 *original_fadt); | ||
65 | 61 | ||
66 | static void | 62 | static void |
67 | acpi_tb_convert_fadt2 ( | 63 | acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, |
68 | struct fadt_descriptor_rev2 *local_fadt, | 64 | struct fadt_descriptor_rev2 *original_fadt); |
69 | struct fadt_descriptor_rev2 *original_fadt); | ||
70 | |||
71 | 65 | ||
72 | u8 acpi_fadt_is_v1; | 66 | u8 acpi_fadt_is_v1; |
73 | EXPORT_SYMBOL(acpi_fadt_is_v1); | 67 | EXPORT_SYMBOL(acpi_fadt_is_v1); |
@@ -87,23 +81,19 @@ EXPORT_SYMBOL(acpi_fadt_is_v1); | |||
87 | ******************************************************************************/ | 81 | ******************************************************************************/ |
88 | 82 | ||
89 | u32 | 83 | u32 |
90 | acpi_tb_get_table_count ( | 84 | acpi_tb_get_table_count(struct rsdp_descriptor *RSDP, |
91 | struct rsdp_descriptor *RSDP, | 85 | struct acpi_table_header *RSDT) |
92 | struct acpi_table_header *RSDT) | ||
93 | { | 86 | { |
94 | u32 pointer_size; | 87 | u32 pointer_size; |
95 | |||
96 | |||
97 | ACPI_FUNCTION_ENTRY (); | ||
98 | 88 | ||
89 | ACPI_FUNCTION_ENTRY(); | ||
99 | 90 | ||
100 | /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ | 91 | /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ |
101 | 92 | ||
102 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 93 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
103 | pointer_size = sizeof (u32); | 94 | pointer_size = sizeof(u32); |
104 | } | 95 | } else { |
105 | else { | 96 | pointer_size = sizeof(u64); |
106 | pointer_size = sizeof (u64); | ||
107 | } | 97 | } |
108 | 98 | ||
109 | /* | 99 | /* |
@@ -112,10 +102,10 @@ acpi_tb_get_table_count ( | |||
112 | * pointers contained within the RSDT/XSDT. The size of the pointers | 102 | * pointers contained within the RSDT/XSDT. The size of the pointers |
113 | * is architecture-dependent. | 103 | * is architecture-dependent. |
114 | */ | 104 | */ |
115 | return ((RSDT->length - sizeof (struct acpi_table_header)) / pointer_size); | 105 | return ((RSDT->length - |
106 | sizeof(struct acpi_table_header)) / pointer_size); | ||
116 | } | 107 | } |
117 | 108 | ||
118 | |||
119 | /******************************************************************************* | 109 | /******************************************************************************* |
120 | * | 110 | * |
121 | * FUNCTION: acpi_tb_convert_to_xsdt | 111 | * FUNCTION: acpi_tb_convert_to_xsdt |
@@ -128,33 +118,30 @@ acpi_tb_get_table_count ( | |||
128 | * | 118 | * |
129 | ******************************************************************************/ | 119 | ******************************************************************************/ |
130 | 120 | ||
131 | acpi_status | 121 | acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info) |
132 | acpi_tb_convert_to_xsdt ( | ||
133 | struct acpi_table_desc *table_info) | ||
134 | { | 122 | { |
135 | acpi_size table_size; | 123 | acpi_size table_size; |
136 | u32 i; | 124 | u32 i; |
137 | XSDT_DESCRIPTOR *new_table; | 125 | XSDT_DESCRIPTOR *new_table; |
138 | |||
139 | |||
140 | ACPI_FUNCTION_ENTRY (); | ||
141 | 126 | ||
127 | ACPI_FUNCTION_ENTRY(); | ||
142 | 128 | ||
143 | /* Compute size of the converted XSDT */ | 129 | /* Compute size of the converted XSDT */ |
144 | 130 | ||
145 | table_size = ((acpi_size) acpi_gbl_rsdt_table_count * sizeof (u64)) + | 131 | table_size = ((acpi_size) acpi_gbl_rsdt_table_count * sizeof(u64)) + |
146 | sizeof (struct acpi_table_header); | 132 | sizeof(struct acpi_table_header); |
147 | 133 | ||
148 | /* Allocate an XSDT */ | 134 | /* Allocate an XSDT */ |
149 | 135 | ||
150 | new_table = ACPI_MEM_CALLOCATE (table_size); | 136 | new_table = ACPI_MEM_CALLOCATE(table_size); |
151 | if (!new_table) { | 137 | if (!new_table) { |
152 | return (AE_NO_MEMORY); | 138 | return (AE_NO_MEMORY); |
153 | } | 139 | } |
154 | 140 | ||
155 | /* Copy the header and set the length */ | 141 | /* Copy the header and set the length */ |
156 | 142 | ||
157 | ACPI_MEMCPY (new_table, table_info->pointer, sizeof (struct acpi_table_header)); | 143 | ACPI_MEMCPY(new_table, table_info->pointer, |
144 | sizeof(struct acpi_table_header)); | ||
158 | new_table->length = (u32) table_size; | 145 | new_table->length = (u32) table_size; |
159 | 146 | ||
160 | /* Copy the table pointers */ | 147 | /* Copy the table pointers */ |
@@ -163,31 +150,33 @@ acpi_tb_convert_to_xsdt ( | |||
163 | /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ | 150 | /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ |
164 | 151 | ||
165 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 152 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
166 | ACPI_STORE_ADDRESS (new_table->table_offset_entry[i], | 153 | ACPI_STORE_ADDRESS(new_table->table_offset_entry[i], |
167 | (ACPI_CAST_PTR (struct rsdt_descriptor_rev1, | 154 | (ACPI_CAST_PTR |
168 | table_info->pointer))->table_offset_entry[i]); | 155 | (struct rsdt_descriptor_rev1, |
169 | } | 156 | table_info->pointer))-> |
170 | else { | 157 | table_offset_entry[i]); |
158 | } else { | ||
171 | new_table->table_offset_entry[i] = | 159 | new_table->table_offset_entry[i] = |
172 | (ACPI_CAST_PTR (XSDT_DESCRIPTOR, | 160 | (ACPI_CAST_PTR(XSDT_DESCRIPTOR, |
173 | table_info->pointer))->table_offset_entry[i]; | 161 | table_info->pointer))-> |
162 | table_offset_entry[i]; | ||
174 | } | 163 | } |
175 | } | 164 | } |
176 | 165 | ||
177 | /* Delete the original table (either mapped or in a buffer) */ | 166 | /* Delete the original table (either mapped or in a buffer) */ |
178 | 167 | ||
179 | acpi_tb_delete_single_table (table_info); | 168 | acpi_tb_delete_single_table(table_info); |
180 | 169 | ||
181 | /* Point the table descriptor to the new table */ | 170 | /* Point the table descriptor to the new table */ |
182 | 171 | ||
183 | table_info->pointer = ACPI_CAST_PTR (struct acpi_table_header, new_table); | 172 | table_info->pointer = |
184 | table_info->length = table_size; | 173 | ACPI_CAST_PTR(struct acpi_table_header, new_table); |
185 | table_info->allocation = ACPI_MEM_ALLOCATED; | 174 | table_info->length = table_size; |
175 | table_info->allocation = ACPI_MEM_ALLOCATED; | ||
186 | 176 | ||
187 | return (AE_OK); | 177 | return (AE_OK); |
188 | } | 178 | } |
189 | 179 | ||
190 | |||
191 | /******************************************************************************* | 180 | /******************************************************************************* |
192 | * | 181 | * |
193 | * FUNCTION: acpi_tb_init_generic_address | 182 | * FUNCTION: acpi_tb_init_generic_address |
@@ -203,21 +192,19 @@ acpi_tb_convert_to_xsdt ( | |||
203 | ******************************************************************************/ | 192 | ******************************************************************************/ |
204 | 193 | ||
205 | static void | 194 | static void |
206 | acpi_tb_init_generic_address ( | 195 | acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, |
207 | struct acpi_generic_address *new_gas_struct, | 196 | u8 register_bit_width, |
208 | u8 register_bit_width, | 197 | acpi_physical_address address) |
209 | acpi_physical_address address) | ||
210 | { | 198 | { |
211 | 199 | ||
212 | ACPI_STORE_ADDRESS (new_gas_struct->address, address); | 200 | ACPI_STORE_ADDRESS(new_gas_struct->address, address); |
213 | 201 | ||
214 | new_gas_struct->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO; | 202 | new_gas_struct->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO; |
215 | new_gas_struct->register_bit_width = register_bit_width; | 203 | new_gas_struct->register_bit_width = register_bit_width; |
216 | new_gas_struct->register_bit_offset = 0; | 204 | new_gas_struct->register_bit_offset = 0; |
217 | new_gas_struct->access_width = 0; | 205 | new_gas_struct->access_width = 0; |
218 | } | 206 | } |
219 | 207 | ||
220 | |||
221 | /******************************************************************************* | 208 | /******************************************************************************* |
222 | * | 209 | * |
223 | * FUNCTION: acpi_tb_convert_fadt1 | 210 | * FUNCTION: acpi_tb_convert_fadt1 |
@@ -232,9 +219,8 @@ acpi_tb_init_generic_address ( | |||
232 | ******************************************************************************/ | 219 | ******************************************************************************/ |
233 | 220 | ||
234 | static void | 221 | static void |
235 | acpi_tb_convert_fadt1 ( | 222 | acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, |
236 | struct fadt_descriptor_rev2 *local_fadt, | 223 | struct fadt_descriptor_rev1 *original_fadt) |
237 | struct fadt_descriptor_rev1 *original_fadt) | ||
238 | { | 224 | { |
239 | 225 | ||
240 | /* ACPI 1.0 FACS */ | 226 | /* ACPI 1.0 FACS */ |
@@ -247,12 +233,14 @@ acpi_tb_convert_fadt1 ( | |||
247 | * The 2.0 table is an extension of the 1.0 table, so the entire 1.0 | 233 | * The 2.0 table is an extension of the 1.0 table, so the entire 1.0 |
248 | * table can be copied first, then expand some fields to 64 bits. | 234 | * table can be copied first, then expand some fields to 64 bits. |
249 | */ | 235 | */ |
250 | ACPI_MEMCPY (local_fadt, original_fadt, sizeof (struct fadt_descriptor_rev1)); | 236 | ACPI_MEMCPY(local_fadt, original_fadt, |
237 | sizeof(struct fadt_descriptor_rev1)); | ||
251 | 238 | ||
252 | /* Convert table pointers to 64-bit fields */ | 239 | /* Convert table pointers to 64-bit fields */ |
253 | 240 | ||
254 | ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, local_fadt->V1_firmware_ctrl); | 241 | ACPI_STORE_ADDRESS(local_fadt->xfirmware_ctrl, |
255 | ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt); | 242 | local_fadt->V1_firmware_ctrl); |
243 | ACPI_STORE_ADDRESS(local_fadt->Xdsdt, local_fadt->V1_dsdt); | ||
256 | 244 | ||
257 | /* | 245 | /* |
258 | * System Interrupt Model isn't used in ACPI 2.0 | 246 | * System Interrupt Model isn't used in ACPI 2.0 |
@@ -287,17 +275,17 @@ acpi_tb_convert_fadt1 ( | |||
287 | * It primarily adds the FADT reset mechanism. | 275 | * It primarily adds the FADT reset mechanism. |
288 | */ | 276 | */ |
289 | if ((original_fadt->revision == 2) && | 277 | if ((original_fadt->revision == 2) && |
290 | (original_fadt->length == sizeof (struct fadt_descriptor_rev2_minus))) { | 278 | (original_fadt->length == |
279 | sizeof(struct fadt_descriptor_rev2_minus))) { | ||
291 | /* | 280 | /* |
292 | * Grab the entire generic address struct, plus the 1-byte reset value | 281 | * Grab the entire generic address struct, plus the 1-byte reset value |
293 | * that immediately follows. | 282 | * that immediately follows. |
294 | */ | 283 | */ |
295 | ACPI_MEMCPY (&local_fadt->reset_register, | 284 | ACPI_MEMCPY(&local_fadt->reset_register, |
296 | &(ACPI_CAST_PTR (struct fadt_descriptor_rev2_minus, | 285 | &(ACPI_CAST_PTR(struct fadt_descriptor_rev2_minus, |
297 | original_fadt))->reset_register, | 286 | original_fadt))->reset_register, |
298 | sizeof (struct acpi_generic_address) + 1); | 287 | sizeof(struct acpi_generic_address) + 1); |
299 | } | 288 | } else { |
300 | else { | ||
301 | /* | 289 | /* |
302 | * Since there isn't any equivalence in 1.0 and since it is highly | 290 | * Since there isn't any equivalence in 1.0 and since it is highly |
303 | * likely that a 1.0 system has legacy support. | 291 | * likely that a 1.0 system has legacy support. |
@@ -308,43 +296,60 @@ acpi_tb_convert_fadt1 ( | |||
308 | /* | 296 | /* |
309 | * Convert the V1.0 block addresses to V2.0 GAS structures | 297 | * Convert the V1.0 block addresses to V2.0 GAS structures |
310 | */ | 298 | */ |
311 | acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk, local_fadt->pm1_evt_len, | 299 | acpi_tb_init_generic_address(&local_fadt->xpm1a_evt_blk, |
312 | (acpi_physical_address) local_fadt->V1_pm1a_evt_blk); | 300 | local_fadt->pm1_evt_len, |
313 | acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk, local_fadt->pm1_evt_len, | 301 | (acpi_physical_address) local_fadt-> |
314 | (acpi_physical_address) local_fadt->V1_pm1b_evt_blk); | 302 | V1_pm1a_evt_blk); |
315 | acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk, local_fadt->pm1_cnt_len, | 303 | acpi_tb_init_generic_address(&local_fadt->xpm1b_evt_blk, |
316 | (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk); | 304 | local_fadt->pm1_evt_len, |
317 | acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk, local_fadt->pm1_cnt_len, | 305 | (acpi_physical_address) local_fadt-> |
318 | (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk); | 306 | V1_pm1b_evt_blk); |
319 | acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk, local_fadt->pm2_cnt_len, | 307 | acpi_tb_init_generic_address(&local_fadt->xpm1a_cnt_blk, |
320 | (acpi_physical_address) local_fadt->V1_pm2_cnt_blk); | 308 | local_fadt->pm1_cnt_len, |
321 | acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk, local_fadt->pm_tm_len, | 309 | (acpi_physical_address) local_fadt-> |
322 | (acpi_physical_address) local_fadt->V1_pm_tmr_blk); | 310 | V1_pm1a_cnt_blk); |
323 | acpi_tb_init_generic_address (&local_fadt->xgpe0_blk, 0, | 311 | acpi_tb_init_generic_address(&local_fadt->xpm1b_cnt_blk, |
324 | (acpi_physical_address) local_fadt->V1_gpe0_blk); | 312 | local_fadt->pm1_cnt_len, |
325 | acpi_tb_init_generic_address (&local_fadt->xgpe1_blk, 0, | 313 | (acpi_physical_address) local_fadt-> |
326 | (acpi_physical_address) local_fadt->V1_gpe1_blk); | 314 | V1_pm1b_cnt_blk); |
315 | acpi_tb_init_generic_address(&local_fadt->xpm2_cnt_blk, | ||
316 | local_fadt->pm2_cnt_len, | ||
317 | (acpi_physical_address) local_fadt-> | ||
318 | V1_pm2_cnt_blk); | ||
319 | acpi_tb_init_generic_address(&local_fadt->xpm_tmr_blk, | ||
320 | local_fadt->pm_tm_len, | ||
321 | (acpi_physical_address) local_fadt-> | ||
322 | V1_pm_tmr_blk); | ||
323 | acpi_tb_init_generic_address(&local_fadt->xgpe0_blk, 0, | ||
324 | (acpi_physical_address) local_fadt-> | ||
325 | V1_gpe0_blk); | ||
326 | acpi_tb_init_generic_address(&local_fadt->xgpe1_blk, 0, | ||
327 | (acpi_physical_address) local_fadt-> | ||
328 | V1_gpe1_blk); | ||
327 | 329 | ||
328 | /* Create separate GAS structs for the PM1 Enable registers */ | 330 | /* Create separate GAS structs for the PM1 Enable registers */ |
329 | 331 | ||
330 | acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, | 332 | acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable, |
331 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), | 333 | (u8) ACPI_DIV_2(acpi_gbl_FADT-> |
332 | (acpi_physical_address) | 334 | pm1_evt_len), |
333 | (local_fadt->xpm1a_evt_blk.address + | 335 | (acpi_physical_address) |
334 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); | 336 | (local_fadt->xpm1a_evt_blk.address + |
337 | ACPI_DIV_2(acpi_gbl_FADT->pm1_evt_len))); | ||
335 | 338 | ||
336 | /* PM1B is optional; leave null if not present */ | 339 | /* PM1B is optional; leave null if not present */ |
337 | 340 | ||
338 | if (local_fadt->xpm1b_evt_blk.address) { | 341 | if (local_fadt->xpm1b_evt_blk.address) { |
339 | acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, | 342 | acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable, |
340 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), | 343 | (u8) ACPI_DIV_2(acpi_gbl_FADT-> |
341 | (acpi_physical_address) | 344 | pm1_evt_len), |
342 | (local_fadt->xpm1b_evt_blk.address + | 345 | (acpi_physical_address) |
343 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); | 346 | (local_fadt->xpm1b_evt_blk. |
347 | address + | ||
348 | ACPI_DIV_2(acpi_gbl_FADT-> | ||
349 | pm1_evt_len))); | ||
344 | } | 350 | } |
345 | } | 351 | } |
346 | 352 | ||
347 | |||
348 | /******************************************************************************* | 353 | /******************************************************************************* |
349 | * | 354 | * |
350 | * FUNCTION: acpi_tb_convert_fadt2 | 355 | * FUNCTION: acpi_tb_convert_fadt2 |
@@ -360,14 +365,14 @@ acpi_tb_convert_fadt1 ( | |||
360 | ******************************************************************************/ | 365 | ******************************************************************************/ |
361 | 366 | ||
362 | static void | 367 | static void |
363 | acpi_tb_convert_fadt2 ( | 368 | acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, |
364 | struct fadt_descriptor_rev2 *local_fadt, | 369 | struct fadt_descriptor_rev2 *original_fadt) |
365 | struct fadt_descriptor_rev2 *original_fadt) | ||
366 | { | 370 | { |
367 | 371 | ||
368 | /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */ | 372 | /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */ |
369 | 373 | ||
370 | ACPI_MEMCPY (local_fadt, original_fadt, sizeof (struct fadt_descriptor_rev2)); | 374 | ACPI_MEMCPY(local_fadt, original_fadt, |
375 | sizeof(struct fadt_descriptor_rev2)); | ||
371 | 376 | ||
372 | /* | 377 | /* |
373 | * "X" fields are optional extensions to the original V1.0 fields, so | 378 | * "X" fields are optional extensions to the original V1.0 fields, so |
@@ -375,86 +380,99 @@ acpi_tb_convert_fadt2 ( | |||
375 | * is zero. | 380 | * is zero. |
376 | */ | 381 | */ |
377 | if (!(local_fadt->xfirmware_ctrl)) { | 382 | if (!(local_fadt->xfirmware_ctrl)) { |
378 | ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, | 383 | ACPI_STORE_ADDRESS(local_fadt->xfirmware_ctrl, |
379 | local_fadt->V1_firmware_ctrl); | 384 | local_fadt->V1_firmware_ctrl); |
380 | } | 385 | } |
381 | 386 | ||
382 | if (!(local_fadt->Xdsdt)) { | 387 | if (!(local_fadt->Xdsdt)) { |
383 | ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt); | 388 | ACPI_STORE_ADDRESS(local_fadt->Xdsdt, local_fadt->V1_dsdt); |
384 | } | 389 | } |
385 | 390 | ||
386 | if (!(local_fadt->xpm1a_evt_blk.address)) { | 391 | if (!(local_fadt->xpm1a_evt_blk.address)) { |
387 | acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk, | 392 | acpi_tb_init_generic_address(&local_fadt->xpm1a_evt_blk, |
388 | local_fadt->pm1_evt_len, | 393 | local_fadt->pm1_evt_len, |
389 | (acpi_physical_address) local_fadt->V1_pm1a_evt_blk); | 394 | (acpi_physical_address) |
395 | local_fadt->V1_pm1a_evt_blk); | ||
390 | } | 396 | } |
391 | 397 | ||
392 | if (!(local_fadt->xpm1b_evt_blk.address)) { | 398 | if (!(local_fadt->xpm1b_evt_blk.address)) { |
393 | acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk, | 399 | acpi_tb_init_generic_address(&local_fadt->xpm1b_evt_blk, |
394 | local_fadt->pm1_evt_len, | 400 | local_fadt->pm1_evt_len, |
395 | (acpi_physical_address) local_fadt->V1_pm1b_evt_blk); | 401 | (acpi_physical_address) |
402 | local_fadt->V1_pm1b_evt_blk); | ||
396 | } | 403 | } |
397 | 404 | ||
398 | if (!(local_fadt->xpm1a_cnt_blk.address)) { | 405 | if (!(local_fadt->xpm1a_cnt_blk.address)) { |
399 | acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk, | 406 | acpi_tb_init_generic_address(&local_fadt->xpm1a_cnt_blk, |
400 | local_fadt->pm1_cnt_len, | 407 | local_fadt->pm1_cnt_len, |
401 | (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk); | 408 | (acpi_physical_address) |
409 | local_fadt->V1_pm1a_cnt_blk); | ||
402 | } | 410 | } |
403 | 411 | ||
404 | if (!(local_fadt->xpm1b_cnt_blk.address)) { | 412 | if (!(local_fadt->xpm1b_cnt_blk.address)) { |
405 | acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk, | 413 | acpi_tb_init_generic_address(&local_fadt->xpm1b_cnt_blk, |
406 | local_fadt->pm1_cnt_len, | 414 | local_fadt->pm1_cnt_len, |
407 | (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk); | 415 | (acpi_physical_address) |
416 | local_fadt->V1_pm1b_cnt_blk); | ||
408 | } | 417 | } |
409 | 418 | ||
410 | if (!(local_fadt->xpm2_cnt_blk.address)) { | 419 | if (!(local_fadt->xpm2_cnt_blk.address)) { |
411 | acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk, | 420 | acpi_tb_init_generic_address(&local_fadt->xpm2_cnt_blk, |
412 | local_fadt->pm2_cnt_len, | 421 | local_fadt->pm2_cnt_len, |
413 | (acpi_physical_address) local_fadt->V1_pm2_cnt_blk); | 422 | (acpi_physical_address) |
423 | local_fadt->V1_pm2_cnt_blk); | ||
414 | } | 424 | } |
415 | 425 | ||
416 | if (!(local_fadt->xpm_tmr_blk.address)) { | 426 | if (!(local_fadt->xpm_tmr_blk.address)) { |
417 | acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk, | 427 | acpi_tb_init_generic_address(&local_fadt->xpm_tmr_blk, |
418 | local_fadt->pm_tm_len, | 428 | local_fadt->pm_tm_len, |
419 | (acpi_physical_address) local_fadt->V1_pm_tmr_blk); | 429 | (acpi_physical_address) |
430 | local_fadt->V1_pm_tmr_blk); | ||
420 | } | 431 | } |
421 | 432 | ||
422 | if (!(local_fadt->xgpe0_blk.address)) { | 433 | if (!(local_fadt->xgpe0_blk.address)) { |
423 | acpi_tb_init_generic_address (&local_fadt->xgpe0_blk, | 434 | acpi_tb_init_generic_address(&local_fadt->xgpe0_blk, |
424 | 0, (acpi_physical_address) local_fadt->V1_gpe0_blk); | 435 | 0, |
436 | (acpi_physical_address) | ||
437 | local_fadt->V1_gpe0_blk); | ||
425 | } | 438 | } |
426 | 439 | ||
427 | if (!(local_fadt->xgpe1_blk.address)) { | 440 | if (!(local_fadt->xgpe1_blk.address)) { |
428 | acpi_tb_init_generic_address (&local_fadt->xgpe1_blk, | 441 | acpi_tb_init_generic_address(&local_fadt->xgpe1_blk, |
429 | 0, (acpi_physical_address) local_fadt->V1_gpe1_blk); | 442 | 0, |
443 | (acpi_physical_address) | ||
444 | local_fadt->V1_gpe1_blk); | ||
430 | } | 445 | } |
431 | 446 | ||
432 | /* Create separate GAS structs for the PM1 Enable registers */ | 447 | /* Create separate GAS structs for the PM1 Enable registers */ |
433 | 448 | ||
434 | acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable, | 449 | acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable, |
435 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), | 450 | (u8) ACPI_DIV_2(acpi_gbl_FADT-> |
436 | (acpi_physical_address) | 451 | pm1_evt_len), |
437 | (local_fadt->xpm1a_evt_blk.address + | 452 | (acpi_physical_address) |
438 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); | 453 | (local_fadt->xpm1a_evt_blk.address + |
454 | ACPI_DIV_2(acpi_gbl_FADT->pm1_evt_len))); | ||
439 | 455 | ||
440 | acpi_gbl_xpm1a_enable.address_space_id = | 456 | acpi_gbl_xpm1a_enable.address_space_id = |
441 | local_fadt->xpm1a_evt_blk.address_space_id; | 457 | local_fadt->xpm1a_evt_blk.address_space_id; |
442 | 458 | ||
443 | /* PM1B is optional; leave null if not present */ | 459 | /* PM1B is optional; leave null if not present */ |
444 | 460 | ||
445 | if (local_fadt->xpm1b_evt_blk.address) { | 461 | if (local_fadt->xpm1b_evt_blk.address) { |
446 | acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable, | 462 | acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable, |
447 | (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len), | 463 | (u8) ACPI_DIV_2(acpi_gbl_FADT-> |
448 | (acpi_physical_address) | 464 | pm1_evt_len), |
449 | (local_fadt->xpm1b_evt_blk.address + | 465 | (acpi_physical_address) |
450 | ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len))); | 466 | (local_fadt->xpm1b_evt_blk. |
467 | address + | ||
468 | ACPI_DIV_2(acpi_gbl_FADT-> | ||
469 | pm1_evt_len))); | ||
451 | 470 | ||
452 | acpi_gbl_xpm1b_enable.address_space_id = | 471 | acpi_gbl_xpm1b_enable.address_space_id = |
453 | local_fadt->xpm1b_evt_blk.address_space_id; | 472 | local_fadt->xpm1b_evt_blk.address_space_id; |
454 | } | 473 | } |
455 | } | 474 | } |
456 | 475 | ||
457 | |||
458 | /******************************************************************************* | 476 | /******************************************************************************* |
459 | * | 477 | * |
460 | * FUNCTION: acpi_tb_convert_table_fadt | 478 | * FUNCTION: acpi_tb_convert_table_fadt |
@@ -471,83 +489,76 @@ acpi_tb_convert_fadt2 ( | |||
471 | * | 489 | * |
472 | ******************************************************************************/ | 490 | ******************************************************************************/ |
473 | 491 | ||
474 | acpi_status | 492 | acpi_status acpi_tb_convert_table_fadt(void) |
475 | acpi_tb_convert_table_fadt ( | ||
476 | void) | ||
477 | { | 493 | { |
478 | struct fadt_descriptor_rev2 *local_fadt; | 494 | struct fadt_descriptor_rev2 *local_fadt; |
479 | struct acpi_table_desc *table_desc; | 495 | struct acpi_table_desc *table_desc; |
480 | |||
481 | |||
482 | ACPI_FUNCTION_TRACE ("tb_convert_table_fadt"); | ||
483 | 496 | ||
497 | ACPI_FUNCTION_TRACE("tb_convert_table_fadt"); | ||
484 | 498 | ||
485 | /* | 499 | /* |
486 | * acpi_gbl_FADT is valid. Validate the FADT length. The table must be | 500 | * acpi_gbl_FADT is valid. Validate the FADT length. The table must be |
487 | * at least as long as the version 1.0 FADT | 501 | * at least as long as the version 1.0 FADT |
488 | */ | 502 | */ |
489 | if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) { | 503 | if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev1)) { |
490 | ACPI_REPORT_ERROR (("FADT is invalid, too short: 0x%X\n", | 504 | ACPI_REPORT_ERROR(("FADT is invalid, too short: 0x%X\n", |
491 | acpi_gbl_FADT->length)); | 505 | acpi_gbl_FADT->length)); |
492 | return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); | 506 | return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); |
493 | } | 507 | } |
494 | 508 | ||
495 | /* Allocate buffer for the ACPI 2.0(+) FADT */ | 509 | /* Allocate buffer for the ACPI 2.0(+) FADT */ |
496 | 510 | ||
497 | local_fadt = ACPI_MEM_CALLOCATE (sizeof (struct fadt_descriptor_rev2)); | 511 | local_fadt = ACPI_MEM_CALLOCATE(sizeof(struct fadt_descriptor_rev2)); |
498 | if (!local_fadt) { | 512 | if (!local_fadt) { |
499 | return_ACPI_STATUS (AE_NO_MEMORY); | 513 | return_ACPI_STATUS(AE_NO_MEMORY); |
500 | } | 514 | } |
501 | 515 | ||
502 | if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) { | 516 | if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) { |
503 | if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) { | 517 | if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) { |
504 | /* Length is too short to be a V2.0 table */ | 518 | /* Length is too short to be a V2.0 table */ |
505 | 519 | ||
506 | ACPI_REPORT_WARNING (( | 520 | ACPI_REPORT_WARNING(("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", acpi_gbl_FADT->length, acpi_gbl_FADT->revision)); |
507 | "Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", | ||
508 | acpi_gbl_FADT->length, acpi_gbl_FADT->revision)); | ||
509 | 521 | ||
510 | acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); | 522 | acpi_tb_convert_fadt1(local_fadt, |
511 | } | 523 | (void *)acpi_gbl_FADT); |
512 | else { | 524 | } else { |
513 | /* Valid V2.0 table */ | 525 | /* Valid V2.0 table */ |
514 | 526 | ||
515 | acpi_tb_convert_fadt2 (local_fadt, acpi_gbl_FADT); | 527 | acpi_tb_convert_fadt2(local_fadt, acpi_gbl_FADT); |
516 | } | 528 | } |
517 | } | 529 | } else { |
518 | else { | ||
519 | /* Valid V1.0 table */ | 530 | /* Valid V1.0 table */ |
520 | 531 | ||
521 | acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT); | 532 | acpi_tb_convert_fadt1(local_fadt, (void *)acpi_gbl_FADT); |
522 | } | 533 | } |
523 | 534 | ||
524 | /* Global FADT pointer will point to the new common V2.0 FADT */ | 535 | /* Global FADT pointer will point to the new common V2.0 FADT */ |
525 | 536 | ||
526 | acpi_gbl_FADT = local_fadt; | 537 | acpi_gbl_FADT = local_fadt; |
527 | acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR); | 538 | acpi_gbl_FADT->length = sizeof(FADT_DESCRIPTOR); |
528 | 539 | ||
529 | /* Free the original table */ | 540 | /* Free the original table */ |
530 | 541 | ||
531 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_FADT].next; | 542 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_FADT].next; |
532 | acpi_tb_delete_single_table (table_desc); | 543 | acpi_tb_delete_single_table(table_desc); |
533 | 544 | ||
534 | /* Install the new table */ | 545 | /* Install the new table */ |
535 | 546 | ||
536 | table_desc->pointer = ACPI_CAST_PTR (struct acpi_table_header, acpi_gbl_FADT); | 547 | table_desc->pointer = |
537 | table_desc->allocation = ACPI_MEM_ALLOCATED; | 548 | ACPI_CAST_PTR(struct acpi_table_header, acpi_gbl_FADT); |
538 | table_desc->length = sizeof (struct fadt_descriptor_rev2); | 549 | table_desc->allocation = ACPI_MEM_ALLOCATED; |
550 | table_desc->length = sizeof(struct fadt_descriptor_rev2); | ||
539 | 551 | ||
540 | /* Dump the entire FADT */ | 552 | /* Dump the entire FADT */ |
541 | 553 | ||
542 | ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, | 554 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, |
543 | "Hex dump of common internal FADT, size %d (%X)\n", | 555 | "Hex dump of common internal FADT, size %d (%X)\n", |
544 | acpi_gbl_FADT->length, acpi_gbl_FADT->length)); | 556 | acpi_gbl_FADT->length, acpi_gbl_FADT->length)); |
545 | ACPI_DUMP_BUFFER ((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->length); | 557 | ACPI_DUMP_BUFFER((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->length); |
546 | 558 | ||
547 | return_ACPI_STATUS (AE_OK); | 559 | return_ACPI_STATUS(AE_OK); |
548 | } | 560 | } |
549 | 561 | ||
550 | |||
551 | /******************************************************************************* | 562 | /******************************************************************************* |
552 | * | 563 | * |
553 | * FUNCTION: acpi_tb_build_common_facs | 564 | * FUNCTION: acpi_tb_build_common_facs |
@@ -561,26 +572,21 @@ acpi_tb_convert_table_fadt ( | |||
561 | * | 572 | * |
562 | ******************************************************************************/ | 573 | ******************************************************************************/ |
563 | 574 | ||
564 | acpi_status | 575 | acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info) |
565 | acpi_tb_build_common_facs ( | ||
566 | struct acpi_table_desc *table_info) | ||
567 | { | 576 | { |
568 | 577 | ||
569 | ACPI_FUNCTION_TRACE ("tb_build_common_facs"); | 578 | ACPI_FUNCTION_TRACE("tb_build_common_facs"); |
570 | |||
571 | 579 | ||
572 | /* Absolute minimum length is 24, but the ACPI spec says 64 */ | 580 | /* Absolute minimum length is 24, but the ACPI spec says 64 */ |
573 | 581 | ||
574 | if (acpi_gbl_FACS->length < 24) { | 582 | if (acpi_gbl_FACS->length < 24) { |
575 | ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n", | 583 | ACPI_REPORT_ERROR(("Invalid FACS table length: 0x%X\n", |
576 | acpi_gbl_FACS->length)); | 584 | acpi_gbl_FACS->length)); |
577 | return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); | 585 | return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); |
578 | } | 586 | } |
579 | 587 | ||
580 | if (acpi_gbl_FACS->length < 64) { | 588 | if (acpi_gbl_FACS->length < 64) { |
581 | ACPI_REPORT_WARNING (( | 589 | ACPI_REPORT_WARNING(("FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", acpi_gbl_FACS->length)); |
582 | "FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", | ||
583 | acpi_gbl_FACS->length)); | ||
584 | } | 590 | } |
585 | 591 | ||
586 | /* Copy fields to the new FACS */ | 592 | /* Copy fields to the new FACS */ |
@@ -588,22 +594,22 @@ acpi_tb_build_common_facs ( | |||
588 | acpi_gbl_common_fACS.global_lock = &(acpi_gbl_FACS->global_lock); | 594 | acpi_gbl_common_fACS.global_lock = &(acpi_gbl_FACS->global_lock); |
589 | 595 | ||
590 | if ((acpi_gbl_RSDP->revision < 2) || | 596 | if ((acpi_gbl_RSDP->revision < 2) || |
591 | (acpi_gbl_FACS->length < 32) || | 597 | (acpi_gbl_FACS->length < 32) || |
592 | (!(acpi_gbl_FACS->xfirmware_waking_vector))) { | 598 | (!(acpi_gbl_FACS->xfirmware_waking_vector))) { |
593 | /* ACPI 1.0 FACS or short table or optional X_ field is zero */ | 599 | /* ACPI 1.0 FACS or short table or optional X_ field is zero */ |
594 | 600 | ||
595 | acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR (u64, | 601 | acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64, |
596 | &(acpi_gbl_FACS->firmware_waking_vector)); | 602 | & |
603 | (acpi_gbl_FACS-> | ||
604 | firmware_waking_vector)); | ||
597 | acpi_gbl_common_fACS.vector_width = 32; | 605 | acpi_gbl_common_fACS.vector_width = 32; |
598 | } | 606 | } else { |
599 | else { | ||
600 | /* ACPI 2.0 FACS with valid X_ field */ | 607 | /* ACPI 2.0 FACS with valid X_ field */ |
601 | 608 | ||
602 | acpi_gbl_common_fACS.firmware_waking_vector = &acpi_gbl_FACS->xfirmware_waking_vector; | 609 | acpi_gbl_common_fACS.firmware_waking_vector = |
610 | &acpi_gbl_FACS->xfirmware_waking_vector; | ||
603 | acpi_gbl_common_fACS.vector_width = 64; | 611 | acpi_gbl_common_fACS.vector_width = 64; |
604 | } | 612 | } |
605 | 613 | ||
606 | return_ACPI_STATUS (AE_OK); | 614 | return_ACPI_STATUS(AE_OK); |
607 | } | 615 | } |
608 | |||
609 | |||