diff options
Diffstat (limited to 'drivers/acpi')
51 files changed, 758 insertions, 500 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 5d9248526d78..4770de5707b9 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -348,7 +348,6 @@ source "drivers/acpi/apei/Kconfig" | |||
348 | config ACPI_EXTLOG | 348 | config ACPI_EXTLOG |
349 | tristate "Extended Error Log support" | 349 | tristate "Extended Error Log support" |
350 | depends on X86_MCE && X86_LOCAL_APIC | 350 | depends on X86_MCE && X86_LOCAL_APIC |
351 | select EFI | ||
352 | select UEFI_CPER | 351 | select UEFI_CPER |
353 | default n | 352 | default n |
354 | help | 353 | help |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 8095943e6e11..e7515aa43d6b 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -206,7 +206,7 @@ static int acpi_ac_probe(struct platform_device *pdev) | |||
206 | goto end; | 206 | goto end; |
207 | 207 | ||
208 | result = acpi_install_notify_handler(ACPI_HANDLE(&pdev->dev), | 208 | result = acpi_install_notify_handler(ACPI_HANDLE(&pdev->dev), |
209 | ACPI_DEVICE_NOTIFY, acpi_ac_notify_handler, ac); | 209 | ACPI_ALL_NOTIFY, acpi_ac_notify_handler, ac); |
210 | if (result) { | 210 | if (result) { |
211 | power_supply_unregister(&ac->charger); | 211 | power_supply_unregister(&ac->charger); |
212 | goto end; | 212 | goto end; |
@@ -254,7 +254,7 @@ static int acpi_ac_remove(struct platform_device *pdev) | |||
254 | return -EINVAL; | 254 | return -EINVAL; |
255 | 255 | ||
256 | acpi_remove_notify_handler(ACPI_HANDLE(&pdev->dev), | 256 | acpi_remove_notify_handler(ACPI_HANDLE(&pdev->dev), |
257 | ACPI_DEVICE_NOTIFY, acpi_ac_notify_handler); | 257 | ACPI_ALL_NOTIFY, acpi_ac_notify_handler); |
258 | 258 | ||
259 | ac = platform_get_drvdata(pdev); | 259 | ac = platform_get_drvdata(pdev); |
260 | if (ac->charger.dev) | 260 | if (ac->charger.dev) |
diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c index 2635a01c5b3e..94166680b3a3 100644 --- a/drivers/acpi/acpi_extlog.c +++ b/drivers/acpi/acpi_extlog.c | |||
@@ -19,11 +19,9 @@ | |||
19 | #define EXT_ELOG_ENTRY_MASK GENMASK_ULL(51, 0) /* elog entry address mask */ | 19 | #define EXT_ELOG_ENTRY_MASK GENMASK_ULL(51, 0) /* elog entry address mask */ |
20 | 20 | ||
21 | #define EXTLOG_DSM_REV 0x0 | 21 | #define EXTLOG_DSM_REV 0x0 |
22 | #define EXTLOG_FN_QUERY 0x0 | ||
23 | #define EXTLOG_FN_ADDR 0x1 | 22 | #define EXTLOG_FN_ADDR 0x1 |
24 | 23 | ||
25 | #define FLAG_OS_OPTIN BIT(0) | 24 | #define FLAG_OS_OPTIN BIT(0) |
26 | #define EXTLOG_QUERY_L1_EXIST BIT(1) | ||
27 | #define ELOG_ENTRY_VALID (1ULL<<63) | 25 | #define ELOG_ENTRY_VALID (1ULL<<63) |
28 | #define ELOG_ENTRY_LEN 0x1000 | 26 | #define ELOG_ENTRY_LEN 0x1000 |
29 | 27 | ||
@@ -42,7 +40,7 @@ struct extlog_l1_head { | |||
42 | u8 rev1[12]; | 40 | u8 rev1[12]; |
43 | }; | 41 | }; |
44 | 42 | ||
45 | static u8 extlog_dsm_uuid[] = "663E35AF-CC10-41A4-88EA-5470AF055295"; | 43 | static u8 extlog_dsm_uuid[] __initdata = "663E35AF-CC10-41A4-88EA-5470AF055295"; |
46 | 44 | ||
47 | /* L1 table related physical address */ | 45 | /* L1 table related physical address */ |
48 | static u64 elog_base; | 46 | static u64 elog_base; |
@@ -152,62 +150,27 @@ static int extlog_print(struct notifier_block *nb, unsigned long val, | |||
152 | return NOTIFY_DONE; | 150 | return NOTIFY_DONE; |
153 | } | 151 | } |
154 | 152 | ||
155 | static int extlog_get_dsm(acpi_handle handle, int rev, int func, u64 *ret) | 153 | static bool __init extlog_get_l1addr(void) |
156 | { | 154 | { |
157 | struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER, NULL}; | ||
158 | struct acpi_object_list input; | ||
159 | union acpi_object params[4], *obj; | ||
160 | u8 uuid[16]; | 155 | u8 uuid[16]; |
161 | int i; | 156 | acpi_handle handle; |
157 | union acpi_object *obj; | ||
162 | 158 | ||
163 | acpi_str_to_uuid(extlog_dsm_uuid, uuid); | 159 | acpi_str_to_uuid(extlog_dsm_uuid, uuid); |
164 | input.count = 4; | ||
165 | input.pointer = params; | ||
166 | params[0].type = ACPI_TYPE_BUFFER; | ||
167 | params[0].buffer.length = 16; | ||
168 | params[0].buffer.pointer = uuid; | ||
169 | params[1].type = ACPI_TYPE_INTEGER; | ||
170 | params[1].integer.value = rev; | ||
171 | params[2].type = ACPI_TYPE_INTEGER; | ||
172 | params[2].integer.value = func; | ||
173 | params[3].type = ACPI_TYPE_PACKAGE; | ||
174 | params[3].package.count = 0; | ||
175 | params[3].package.elements = NULL; | ||
176 | |||
177 | if (ACPI_FAILURE(acpi_evaluate_object(handle, "_DSM", &input, &buf))) | ||
178 | return -1; | ||
179 | |||
180 | *ret = 0; | ||
181 | obj = (union acpi_object *)buf.pointer; | ||
182 | if (obj->type == ACPI_TYPE_INTEGER) { | ||
183 | *ret = obj->integer.value; | ||
184 | } else if (obj->type == ACPI_TYPE_BUFFER) { | ||
185 | if (obj->buffer.length <= 8) { | ||
186 | for (i = 0; i < obj->buffer.length; i++) | ||
187 | *ret |= (obj->buffer.pointer[i] << (i * 8)); | ||
188 | } | ||
189 | } | ||
190 | kfree(buf.pointer); | ||
191 | |||
192 | return 0; | ||
193 | } | ||
194 | |||
195 | static bool extlog_get_l1addr(void) | ||
196 | { | ||
197 | acpi_handle handle; | ||
198 | u64 ret; | ||
199 | 160 | ||
200 | if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) | 161 | if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) |
201 | return false; | 162 | return false; |
202 | 163 | if (!acpi_check_dsm(handle, uuid, EXTLOG_DSM_REV, 1 << EXTLOG_FN_ADDR)) | |
203 | if (extlog_get_dsm(handle, EXTLOG_DSM_REV, EXTLOG_FN_QUERY, &ret) || | ||
204 | !(ret & EXTLOG_QUERY_L1_EXIST)) | ||
205 | return false; | 164 | return false; |
206 | 165 | obj = acpi_evaluate_dsm_typed(handle, uuid, EXTLOG_DSM_REV, | |
207 | if (extlog_get_dsm(handle, EXTLOG_DSM_REV, EXTLOG_FN_ADDR, &ret)) | 166 | EXTLOG_FN_ADDR, NULL, ACPI_TYPE_INTEGER); |
167 | if (!obj) { | ||
208 | return false; | 168 | return false; |
169 | } else { | ||
170 | l1_dirbase = obj->integer.value; | ||
171 | ACPI_FREE(obj); | ||
172 | } | ||
209 | 173 | ||
210 | l1_dirbase = ret; | ||
211 | /* Spec says L1 directory must be 4K aligned, bail out if it isn't */ | 174 | /* Spec says L1 directory must be 4K aligned, bail out if it isn't */ |
212 | if (l1_dirbase & ((1 << 12) - 1)) { | 175 | if (l1_dirbase & ((1 << 12) - 1)) { |
213 | pr_warn(FW_BUG "L1 Directory is invalid at physical %llx\n", | 176 | pr_warn(FW_BUG "L1 Directory is invalid at physical %llx\n", |
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 6745fe137b9e..e60390597372 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -162,6 +162,7 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = { | |||
162 | { "80860F14", (unsigned long)&byt_sdio_dev_desc }, | 162 | { "80860F14", (unsigned long)&byt_sdio_dev_desc }, |
163 | { "80860F41", (unsigned long)&byt_i2c_dev_desc }, | 163 | { "80860F41", (unsigned long)&byt_i2c_dev_desc }, |
164 | { "INT33B2", }, | 164 | { "INT33B2", }, |
165 | { "INT33FC", }, | ||
165 | 166 | ||
166 | { "INT3430", (unsigned long)&lpt_dev_desc }, | 167 | { "INT3430", (unsigned long)&lpt_dev_desc }, |
167 | { "INT3431", (unsigned long)&lpt_dev_desc }, | 168 | { "INT3431", (unsigned long)&lpt_dev_desc }, |
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index d58a2aba0930..c9311be29a64 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c | |||
@@ -212,7 +212,7 @@ static int acpi_processor_get_info(struct acpi_device *device) | |||
212 | union acpi_object object = { 0 }; | 212 | union acpi_object object = { 0 }; |
213 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; | 213 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; |
214 | struct acpi_processor *pr = acpi_driver_data(device); | 214 | struct acpi_processor *pr = acpi_driver_data(device); |
215 | int cpu_index, device_declaration = 0; | 215 | int apic_id, cpu_index, device_declaration = 0; |
216 | acpi_status status = AE_OK; | 216 | acpi_status status = AE_OK; |
217 | static int cpu0_initialized; | 217 | static int cpu0_initialized; |
218 | unsigned long long value; | 218 | unsigned long long value; |
@@ -258,18 +258,21 @@ static int acpi_processor_get_info(struct acpi_device *device) | |||
258 | device_declaration = 1; | 258 | device_declaration = 1; |
259 | pr->acpi_id = value; | 259 | pr->acpi_id = value; |
260 | } | 260 | } |
261 | pr->apic_id = acpi_get_apicid(pr->handle, device_declaration, | ||
262 | pr->acpi_id); | ||
263 | cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id); | ||
264 | 261 | ||
265 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ | 262 | apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id); |
266 | if (!cpu0_initialized && (cpu_index == -1) && | 263 | if (apic_id < 0) { |
267 | (num_online_cpus() == 1)) { | 264 | acpi_handle_err(pr->handle, "failed to get CPU APIC ID.\n"); |
268 | cpu_index = 0; | 265 | return -ENODEV; |
269 | } | 266 | } |
267 | pr->apic_id = apic_id; | ||
270 | 268 | ||
271 | cpu0_initialized = 1; | 269 | cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id); |
272 | 270 | if (!cpu0_initialized) { | |
271 | cpu0_initialized = 1; | ||
272 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ | ||
273 | if ((cpu_index == -1) && (num_online_cpus() == 1)) | ||
274 | cpu_index = 0; | ||
275 | } | ||
273 | pr->id = cpu_index; | 276 | pr->id = cpu_index; |
274 | 277 | ||
275 | /* | 278 | /* |
@@ -282,6 +285,7 @@ static int acpi_processor_get_info(struct acpi_device *device) | |||
282 | if (ret) | 285 | if (ret) |
283 | return ret; | 286 | return ret; |
284 | } | 287 | } |
288 | |||
285 | /* | 289 | /* |
286 | * On some boxes several processors use the same processor bus id. | 290 | * On some boxes several processors use the same processor bus id. |
287 | * But they are located in different scope. For example: | 291 | * But they are located in different scope. For example: |
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h index a9fd0b872062..2bf3ca2b8a7a 100644 --- a/drivers/acpi/acpica/acdebug.h +++ b/drivers/acpi/acpica/acdebug.h | |||
@@ -113,7 +113,6 @@ void acpi_db_display_handlers(void); | |||
113 | ACPI_HW_DEPENDENT_RETURN_VOID(void | 113 | ACPI_HW_DEPENDENT_RETURN_VOID(void |
114 | acpi_db_generate_gpe(char *gpe_arg, | 114 | acpi_db_generate_gpe(char *gpe_arg, |
115 | char *block_arg)) | 115 | char *block_arg)) |
116 | |||
117 | ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_generate_sci(void)) | 116 | ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_generate_sci(void)) |
118 | 117 | ||
119 | /* | 118 | /* |
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index 41abe552c7a3..0fb0adf435d6 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h | |||
@@ -71,9 +71,8 @@ acpi_status acpi_ev_init_global_lock_handler(void); | |||
71 | 71 | ||
72 | ACPI_HW_DEPENDENT_RETURN_OK(acpi_status | 72 | ACPI_HW_DEPENDENT_RETURN_OK(acpi_status |
73 | acpi_ev_acquire_global_lock(u16 timeout)) | 73 | acpi_ev_acquire_global_lock(u16 timeout)) |
74 | |||
75 | ACPI_HW_DEPENDENT_RETURN_OK(acpi_status acpi_ev_release_global_lock(void)) | 74 | ACPI_HW_DEPENDENT_RETURN_OK(acpi_status acpi_ev_release_global_lock(void)) |
76 | acpi_status acpi_ev_remove_global_lock_handler(void); | 75 | acpi_status acpi_ev_remove_global_lock_handler(void); |
77 | 76 | ||
78 | /* | 77 | /* |
79 | * evgpe - Low-level GPE support | 78 | * evgpe - Low-level GPE support |
@@ -133,7 +132,7 @@ acpi_status acpi_ev_gpe_initialize(void); | |||
133 | ACPI_HW_DEPENDENT_RETURN_VOID(void | 132 | ACPI_HW_DEPENDENT_RETURN_VOID(void |
134 | acpi_ev_update_gpes(acpi_owner_id table_owner_id)) | 133 | acpi_ev_update_gpes(acpi_owner_id table_owner_id)) |
135 | 134 | ||
136 | acpi_status | 135 | acpi_status |
137 | acpi_ev_match_gpe_method(acpi_handle obj_handle, | 136 | acpi_ev_match_gpe_method(acpi_handle obj_handle, |
138 | u32 level, void *context, void **return_value); | 137 | u32 level, void *context, void **return_value); |
139 | 138 | ||
@@ -149,7 +148,9 @@ acpi_status | |||
149 | acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 148 | acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
150 | struct acpi_gpe_block_info *gpe_block, void *context); | 149 | struct acpi_gpe_block_info *gpe_block, void *context); |
151 | 150 | ||
152 | struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 interrupt_number); | 151 | acpi_status |
152 | acpi_ev_get_gpe_xrupt_block(u32 interrupt_number, | ||
153 | struct acpi_gpe_xrupt_info **gpe_xrupt_block); | ||
153 | 154 | ||
154 | acpi_status acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt); | 155 | acpi_status acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt); |
155 | 156 | ||
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index e9f1fc7f99c7..24db8e153bf0 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -119,6 +119,24 @@ bool ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE); | |||
119 | u8 ACPI_INIT_GLOBAL(acpi_gbl_copy_dsdt_locally, FALSE); | 119 | u8 ACPI_INIT_GLOBAL(acpi_gbl_copy_dsdt_locally, FALSE); |
120 | 120 | ||
121 | /* | 121 | /* |
122 | * Optionally ignore an XSDT if present and use the RSDT instead. | ||
123 | * Although the ACPI specification requires that an XSDT be used instead | ||
124 | * of the RSDT, the XSDT has been found to be corrupt or ill-formed on | ||
125 | * some machines. Default behavior is to use the XSDT if present. | ||
126 | */ | ||
127 | u8 ACPI_INIT_GLOBAL(acpi_gbl_do_not_use_xsdt, FALSE); | ||
128 | |||
129 | /* | ||
130 | * Optionally use 32-bit FADT addresses if and when there is a conflict | ||
131 | * (address mismatch) between the 32-bit and 64-bit versions of the | ||
132 | * address. Although ACPICA adheres to the ACPI specification which | ||
133 | * requires the use of the corresponding 64-bit address if it is non-zero, | ||
134 | * some machines have been found to have a corrupted non-zero 64-bit | ||
135 | * address. Default is FALSE, do not favor the 32-bit addresses. | ||
136 | */ | ||
137 | u8 ACPI_INIT_GLOBAL(acpi_gbl_use32_bit_fadt_addresses, FALSE); | ||
138 | |||
139 | /* | ||
122 | * Optionally truncate I/O addresses to 16 bits. Provides compatibility | 140 | * Optionally truncate I/O addresses to 16 bits. Provides compatibility |
123 | * with other ACPI implementations. NOTE: During ACPICA initialization, | 141 | * with other ACPI implementations. NOTE: During ACPICA initialization, |
124 | * this value is set to TRUE if any Windows OSI strings have been | 142 | * this value is set to TRUE if any Windows OSI strings have been |
@@ -484,6 +502,18 @@ ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects; | |||
484 | 502 | ||
485 | /***************************************************************************** | 503 | /***************************************************************************** |
486 | * | 504 | * |
505 | * Application globals | ||
506 | * | ||
507 | ****************************************************************************/ | ||
508 | |||
509 | #ifdef ACPI_APPLICATION | ||
510 | |||
511 | ACPI_FILE ACPI_INIT_GLOBAL(acpi_gbl_debug_file, NULL); | ||
512 | |||
513 | #endif /* ACPI_APPLICATION */ | ||
514 | |||
515 | /***************************************************************************** | ||
516 | * | ||
487 | * Info/help support | 517 | * Info/help support |
488 | * | 518 | * |
489 | ****************************************************************************/ | 519 | ****************************************************************************/ |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 53ed1a8ba4f0..d95ca5449ace 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -1038,15 +1038,16 @@ struct acpi_external_list { | |||
1038 | struct acpi_external_list *next; | 1038 | struct acpi_external_list *next; |
1039 | u32 value; | 1039 | u32 value; |
1040 | u16 length; | 1040 | u16 length; |
1041 | u16 flags; | ||
1041 | u8 type; | 1042 | u8 type; |
1042 | u8 flags; | ||
1043 | u8 resolved; | ||
1044 | u8 emitted; | ||
1045 | }; | 1043 | }; |
1046 | 1044 | ||
1047 | /* Values for Flags field above */ | 1045 | /* Values for Flags field above */ |
1048 | 1046 | ||
1049 | #define ACPI_IPATH_ALLOCATED 0x01 | 1047 | #define ACPI_EXT_RESOLVED_REFERENCE 0x01 /* Object was resolved during cross ref */ |
1048 | #define ACPI_EXT_ORIGIN_FROM_FILE 0x02 /* External came from a file */ | ||
1049 | #define ACPI_EXT_INTERNAL_PATH_ALLOCATED 0x04 /* Deallocate internal path on completion */ | ||
1050 | #define ACPI_EXT_EXTERNAL_EMITTED 0x08 /* External() statement has been emitted */ | ||
1050 | 1051 | ||
1051 | struct acpi_external_file { | 1052 | struct acpi_external_file { |
1052 | char *path; | 1053 | char *path; |
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c index 2d4c07322576..e7a57c554e84 100644 --- a/drivers/acpi/acpica/dsfield.c +++ b/drivers/acpi/acpica/dsfield.c | |||
@@ -105,7 +105,7 @@ acpi_ds_create_external_region(acpi_status lookup_status, | |||
105 | * operation_region not found. Generate an External for it, and | 105 | * operation_region not found. Generate an External for it, and |
106 | * insert the name into the namespace. | 106 | * insert the name into the namespace. |
107 | */ | 107 | */ |
108 | acpi_dm_add_to_external_list(op, path, ACPI_TYPE_REGION, 0); | 108 | acpi_dm_add_op_to_external_list(op, path, ACPI_TYPE_REGION, 0, 0); |
109 | status = acpi_ns_lookup(walk_state->scope_info, path, ACPI_TYPE_REGION, | 109 | status = acpi_ns_lookup(walk_state->scope_info, path, ACPI_TYPE_REGION, |
110 | ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, | 110 | ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, |
111 | walk_state, node); | 111 | walk_state, node); |
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c index ade44e49deb4..d7f53fb2979a 100644 --- a/drivers/acpi/acpica/dsutils.c +++ b/drivers/acpi/acpica/dsutils.c | |||
@@ -727,27 +727,26 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, | |||
727 | index++; | 727 | index++; |
728 | } | 728 | } |
729 | 729 | ||
730 | index--; | 730 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
731 | "NumOperands %d, ArgCount %d, Index %d\n", | ||
732 | walk_state->num_operands, arg_count, index)); | ||
731 | 733 | ||
732 | /* It is the appropriate order to get objects from the Result stack */ | 734 | /* Create the interpreter arguments, in reverse order */ |
733 | 735 | ||
736 | index--; | ||
734 | for (i = 0; i < arg_count; i++) { | 737 | for (i = 0; i < arg_count; i++) { |
735 | arg = arguments[index]; | 738 | arg = arguments[index]; |
736 | 739 | walk_state->operand_index = (u8)index; | |
737 | /* Force the filling of the operand stack in inverse order */ | ||
738 | |||
739 | walk_state->operand_index = (u8) index; | ||
740 | 740 | ||
741 | status = acpi_ds_create_operand(walk_state, arg, index); | 741 | status = acpi_ds_create_operand(walk_state, arg, index); |
742 | if (ACPI_FAILURE(status)) { | 742 | if (ACPI_FAILURE(status)) { |
743 | goto cleanup; | 743 | goto cleanup; |
744 | } | 744 | } |
745 | 745 | ||
746 | index--; | ||
747 | |||
748 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 746 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
749 | "Arg #%u (%p) done, Arg1=%p\n", index, arg, | 747 | "Created Arg #%u (%p) %u args total\n", |
750 | first_arg)); | 748 | index, arg, arg_count)); |
749 | index--; | ||
751 | } | 750 | } |
752 | 751 | ||
753 | return_ACPI_STATUS(status); | 752 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c index 95e681a36f9c..2dbe109727c8 100644 --- a/drivers/acpi/acpica/dswload.c +++ b/drivers/acpi/acpica/dswload.c | |||
@@ -181,8 +181,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
181 | * Target of Scope() not found. Generate an External for it, and | 181 | * Target of Scope() not found. Generate an External for it, and |
182 | * insert the name into the namespace. | 182 | * insert the name into the namespace. |
183 | */ | 183 | */ |
184 | acpi_dm_add_to_external_list(op, path, ACPI_TYPE_DEVICE, | 184 | acpi_dm_add_op_to_external_list(op, path, |
185 | 0); | 185 | ACPI_TYPE_DEVICE, 0, 0); |
186 | status = | 186 | status = |
187 | acpi_ns_lookup(walk_state->scope_info, path, | 187 | acpi_ns_lookup(walk_state->scope_info, path, |
188 | object_type, ACPI_IMODE_LOAD_PASS1, | 188 | object_type, ACPI_IMODE_LOAD_PASS1, |
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c index a9e76bc4ad97..a31e549e64cc 100644 --- a/drivers/acpi/acpica/evgpeblk.c +++ b/drivers/acpi/acpica/evgpeblk.c | |||
@@ -87,9 +87,9 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, | |||
87 | return_ACPI_STATUS(status); | 87 | return_ACPI_STATUS(status); |
88 | } | 88 | } |
89 | 89 | ||
90 | gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block(interrupt_number); | 90 | status = |
91 | if (!gpe_xrupt_block) { | 91 | acpi_ev_get_gpe_xrupt_block(interrupt_number, &gpe_xrupt_block); |
92 | status = AE_NO_MEMORY; | 92 | if (ACPI_FAILURE(status)) { |
93 | goto unlock_and_exit; | 93 | goto unlock_and_exit; |
94 | } | 94 | } |
95 | 95 | ||
@@ -112,7 +112,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, | |||
112 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 112 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
113 | 113 | ||
114 | unlock_and_exit: | 114 | unlock_and_exit: |
115 | status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 115 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
116 | return_ACPI_STATUS(status); | 116 | return_ACPI_STATUS(status); |
117 | } | 117 | } |
118 | 118 | ||
diff --git a/drivers/acpi/acpica/evgpeutil.c b/drivers/acpi/acpica/evgpeutil.c index d3f5e1e2a2b1..4d764e847a08 100644 --- a/drivers/acpi/acpica/evgpeutil.c +++ b/drivers/acpi/acpica/evgpeutil.c | |||
@@ -197,8 +197,9 @@ acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
197 | * FUNCTION: acpi_ev_get_gpe_xrupt_block | 197 | * FUNCTION: acpi_ev_get_gpe_xrupt_block |
198 | * | 198 | * |
199 | * PARAMETERS: interrupt_number - Interrupt for a GPE block | 199 | * PARAMETERS: interrupt_number - Interrupt for a GPE block |
200 | * gpe_xrupt_block - Where the block is returned | ||
200 | * | 201 | * |
201 | * RETURN: A GPE interrupt block | 202 | * RETURN: Status |
202 | * | 203 | * |
203 | * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt | 204 | * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt |
204 | * block per unique interrupt level used for GPEs. Should be | 205 | * block per unique interrupt level used for GPEs. Should be |
@@ -207,7 +208,9 @@ acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
207 | * | 208 | * |
208 | ******************************************************************************/ | 209 | ******************************************************************************/ |
209 | 210 | ||
210 | struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 interrupt_number) | 211 | acpi_status |
212 | acpi_ev_get_gpe_xrupt_block(u32 interrupt_number, | ||
213 | struct acpi_gpe_xrupt_info ** gpe_xrupt_block) | ||
211 | { | 214 | { |
212 | struct acpi_gpe_xrupt_info *next_gpe_xrupt; | 215 | struct acpi_gpe_xrupt_info *next_gpe_xrupt; |
213 | struct acpi_gpe_xrupt_info *gpe_xrupt; | 216 | struct acpi_gpe_xrupt_info *gpe_xrupt; |
@@ -221,7 +224,8 @@ struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 interrupt_number) | |||
221 | next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; | 224 | next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head; |
222 | while (next_gpe_xrupt) { | 225 | while (next_gpe_xrupt) { |
223 | if (next_gpe_xrupt->interrupt_number == interrupt_number) { | 226 | if (next_gpe_xrupt->interrupt_number == interrupt_number) { |
224 | return_PTR(next_gpe_xrupt); | 227 | *gpe_xrupt_block = next_gpe_xrupt; |
228 | return_ACPI_STATUS(AE_OK); | ||
225 | } | 229 | } |
226 | 230 | ||
227 | next_gpe_xrupt = next_gpe_xrupt->next; | 231 | next_gpe_xrupt = next_gpe_xrupt->next; |
@@ -231,7 +235,7 @@ struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 interrupt_number) | |||
231 | 235 | ||
232 | gpe_xrupt = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_xrupt_info)); | 236 | gpe_xrupt = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_xrupt_info)); |
233 | if (!gpe_xrupt) { | 237 | if (!gpe_xrupt) { |
234 | return_PTR(NULL); | 238 | return_ACPI_STATUS(AE_NO_MEMORY); |
235 | } | 239 | } |
236 | 240 | ||
237 | gpe_xrupt->interrupt_number = interrupt_number; | 241 | gpe_xrupt->interrupt_number = interrupt_number; |
@@ -250,6 +254,7 @@ struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 interrupt_number) | |||
250 | } else { | 254 | } else { |
251 | acpi_gbl_gpe_xrupt_list_head = gpe_xrupt; | 255 | acpi_gbl_gpe_xrupt_list_head = gpe_xrupt; |
252 | } | 256 | } |
257 | |||
253 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 258 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
254 | 259 | ||
255 | /* Install new interrupt handler if not SCI_INT */ | 260 | /* Install new interrupt handler if not SCI_INT */ |
@@ -259,14 +264,15 @@ struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 interrupt_number) | |||
259 | acpi_ev_gpe_xrupt_handler, | 264 | acpi_ev_gpe_xrupt_handler, |
260 | gpe_xrupt); | 265 | gpe_xrupt); |
261 | if (ACPI_FAILURE(status)) { | 266 | if (ACPI_FAILURE(status)) { |
262 | ACPI_ERROR((AE_INFO, | 267 | ACPI_EXCEPTION((AE_INFO, status, |
263 | "Could not install GPE interrupt handler at level 0x%X", | 268 | "Could not install GPE interrupt handler at level 0x%X", |
264 | interrupt_number)); | 269 | interrupt_number)); |
265 | return_PTR(NULL); | 270 | return_ACPI_STATUS(status); |
266 | } | 271 | } |
267 | } | 272 | } |
268 | 273 | ||
269 | return_PTR(gpe_xrupt); | 274 | *gpe_xrupt_block = gpe_xrupt; |
275 | return_ACPI_STATUS(AE_OK); | ||
270 | } | 276 | } |
271 | 277 | ||
272 | /******************************************************************************* | 278 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/exresnte.c b/drivers/acpi/acpica/exresnte.c index acd34f599313..7ca6925a87ca 100644 --- a/drivers/acpi/acpica/exresnte.c +++ b/drivers/acpi/acpica/exresnte.c | |||
@@ -124,7 +124,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
124 | } | 124 | } |
125 | 125 | ||
126 | if (!source_desc) { | 126 | if (!source_desc) { |
127 | ACPI_ERROR((AE_INFO, "No object attached to node %p", node)); | 127 | ACPI_ERROR((AE_INFO, "No object attached to node [%4.4s] %p", |
128 | node->name.ascii, node)); | ||
128 | return_ACPI_STATUS(AE_AML_NO_OPERAND); | 129 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
129 | } | 130 | } |
130 | 131 | ||
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c index e973e311f856..1f0c28ba50df 100644 --- a/drivers/acpi/acpica/nsxfeval.c +++ b/drivers/acpi/acpica/nsxfeval.c | |||
@@ -84,7 +84,7 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
84 | acpi_object_type return_type) | 84 | acpi_object_type return_type) |
85 | { | 85 | { |
86 | acpi_status status; | 86 | acpi_status status; |
87 | u8 must_free = FALSE; | 87 | u8 free_buffer_on_error = FALSE; |
88 | 88 | ||
89 | ACPI_FUNCTION_TRACE(acpi_evaluate_object_typed); | 89 | ACPI_FUNCTION_TRACE(acpi_evaluate_object_typed); |
90 | 90 | ||
@@ -95,14 +95,13 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
95 | } | 95 | } |
96 | 96 | ||
97 | if (return_buffer->length == ACPI_ALLOCATE_BUFFER) { | 97 | if (return_buffer->length == ACPI_ALLOCATE_BUFFER) { |
98 | must_free = TRUE; | 98 | free_buffer_on_error = TRUE; |
99 | } | 99 | } |
100 | 100 | ||
101 | /* Evaluate the object */ | 101 | /* Evaluate the object */ |
102 | 102 | ||
103 | status = | 103 | status = acpi_evaluate_object(handle, pathname, |
104 | acpi_evaluate_object(handle, pathname, external_params, | 104 | external_params, return_buffer); |
105 | return_buffer); | ||
106 | if (ACPI_FAILURE(status)) { | 105 | if (ACPI_FAILURE(status)) { |
107 | return_ACPI_STATUS(status); | 106 | return_ACPI_STATUS(status); |
108 | } | 107 | } |
@@ -135,11 +134,15 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
135 | pointer)->type), | 134 | pointer)->type), |
136 | acpi_ut_get_type_name(return_type))); | 135 | acpi_ut_get_type_name(return_type))); |
137 | 136 | ||
138 | if (must_free) { | 137 | if (free_buffer_on_error) { |
139 | 138 | /* | |
140 | /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ | 139 | * Free a buffer created via ACPI_ALLOCATE_BUFFER. |
141 | 140 | * Note: We use acpi_os_free here because acpi_os_allocate was used | |
142 | ACPI_FREE_BUFFER(*return_buffer); | 141 | * to allocate the buffer. This purposefully bypasses the |
142 | * (optionally enabled) allocation tracking mechanism since we | ||
143 | * only want to track internal allocations. | ||
144 | */ | ||
145 | acpi_os_free(return_buffer->pointer); | ||
143 | return_buffer->pointer = NULL; | 146 | return_buffer->pointer = NULL; |
144 | } | 147 | } |
145 | 148 | ||
diff --git a/drivers/acpi/acpica/psopinfo.c b/drivers/acpi/acpica/psopinfo.c index 9ba5301e5751..b0c9787dbe61 100644 --- a/drivers/acpi/acpica/psopinfo.c +++ b/drivers/acpi/acpica/psopinfo.c | |||
@@ -71,6 +71,10 @@ static const u8 acpi_gbl_argument_count[] = | |||
71 | 71 | ||
72 | const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) | 72 | const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) |
73 | { | 73 | { |
74 | #ifdef ACPI_DEBUG_OUTPUT | ||
75 | const char *opcode_name = "Unknown AML opcode"; | ||
76 | #endif | ||
77 | |||
74 | ACPI_FUNCTION_NAME(ps_get_opcode_info); | 78 | ACPI_FUNCTION_NAME(ps_get_opcode_info); |
75 | 79 | ||
76 | /* | 80 | /* |
@@ -92,11 +96,54 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) | |||
92 | return (&acpi_gbl_aml_op_info | 96 | return (&acpi_gbl_aml_op_info |
93 | [acpi_gbl_long_op_index[(u8)opcode]]); | 97 | [acpi_gbl_long_op_index[(u8)opcode]]); |
94 | } | 98 | } |
99 | #if defined ACPI_ASL_COMPILER && defined ACPI_DEBUG_OUTPUT | ||
100 | #include "asldefine.h" | ||
101 | |||
102 | switch (opcode) { | ||
103 | case AML_RAW_DATA_BYTE: | ||
104 | opcode_name = "-Raw Data Byte-"; | ||
105 | break; | ||
106 | |||
107 | case AML_RAW_DATA_WORD: | ||
108 | opcode_name = "-Raw Data Word-"; | ||
109 | break; | ||
110 | |||
111 | case AML_RAW_DATA_DWORD: | ||
112 | opcode_name = "-Raw Data Dword-"; | ||
113 | break; | ||
114 | |||
115 | case AML_RAW_DATA_QWORD: | ||
116 | opcode_name = "-Raw Data Qword-"; | ||
117 | break; | ||
118 | |||
119 | case AML_RAW_DATA_BUFFER: | ||
120 | opcode_name = "-Raw Data Buffer-"; | ||
121 | break; | ||
122 | |||
123 | case AML_RAW_DATA_CHAIN: | ||
124 | opcode_name = "-Raw Data Buffer Chain-"; | ||
125 | break; | ||
126 | |||
127 | case AML_PACKAGE_LENGTH: | ||
128 | opcode_name = "-Package Length-"; | ||
129 | break; | ||
130 | |||
131 | case AML_UNASSIGNED_OPCODE: | ||
132 | opcode_name = "-Unassigned Opcode-"; | ||
133 | break; | ||
134 | |||
135 | case AML_DEFAULT_ARG_OP: | ||
136 | opcode_name = "-Default Arg-"; | ||
137 | break; | ||
138 | |||
139 | default: | ||
140 | break; | ||
141 | } | ||
142 | #endif | ||
95 | 143 | ||
96 | /* Unknown AML opcode */ | 144 | /* Unknown AML opcode */ |
97 | 145 | ||
98 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 146 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%4.4X]\n", opcode_name, opcode)); |
99 | "Unknown AML opcode [%4.4X]\n", opcode)); | ||
100 | 147 | ||
101 | return (&acpi_gbl_aml_op_info[_UNK]); | 148 | return (&acpi_gbl_aml_op_info[_UNK]); |
102 | } | 149 | } |
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index 9d99f2189693..8f89263ac47e 100644 --- a/drivers/acpi/acpica/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c | |||
@@ -56,10 +56,11 @@ acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | |||
56 | 56 | ||
57 | static void acpi_tb_convert_fadt(void); | 57 | static void acpi_tb_convert_fadt(void); |
58 | 58 | ||
59 | static void acpi_tb_validate_fadt(void); | ||
60 | |||
61 | static void acpi_tb_setup_fadt_registers(void); | 59 | static void acpi_tb_setup_fadt_registers(void); |
62 | 60 | ||
61 | static u64 | ||
62 | acpi_tb_select_address(char *register_name, u32 address32, u64 address64); | ||
63 | |||
63 | /* Table for conversion of FADT to common internal format and FADT validation */ | 64 | /* Table for conversion of FADT to common internal format and FADT validation */ |
64 | 65 | ||
65 | typedef struct acpi_fadt_info { | 66 | typedef struct acpi_fadt_info { |
@@ -175,6 +176,7 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = { | |||
175 | * space_id - ACPI Space ID for this register | 176 | * space_id - ACPI Space ID for this register |
176 | * byte_width - Width of this register | 177 | * byte_width - Width of this register |
177 | * address - Address of the register | 178 | * address - Address of the register |
179 | * register_name - ASCII name of the ACPI register | ||
178 | * | 180 | * |
179 | * RETURN: None | 181 | * RETURN: None |
180 | * | 182 | * |
@@ -220,6 +222,68 @@ acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | |||
220 | 222 | ||
221 | /******************************************************************************* | 223 | /******************************************************************************* |
222 | * | 224 | * |
225 | * FUNCTION: acpi_tb_select_address | ||
226 | * | ||
227 | * PARAMETERS: register_name - ASCII name of the ACPI register | ||
228 | * address32 - 32-bit address of the register | ||
229 | * address64 - 64-bit address of the register | ||
230 | * | ||
231 | * RETURN: The resolved 64-bit address | ||
232 | * | ||
233 | * DESCRIPTION: Select between 32-bit and 64-bit versions of addresses within | ||
234 | * the FADT. Used for the FACS and DSDT addresses. | ||
235 | * | ||
236 | * NOTES: | ||
237 | * | ||
238 | * Check for FACS and DSDT address mismatches. An address mismatch between | ||
239 | * the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and | ||
240 | * DSDT/X_DSDT) could be a corrupted address field or it might indicate | ||
241 | * the presence of two FACS or two DSDT tables. | ||
242 | * | ||
243 | * November 2013: | ||
244 | * By default, as per the ACPICA specification, a valid 64-bit address is | ||
245 | * used regardless of the value of the 32-bit address. However, this | ||
246 | * behavior can be overridden via the acpi_gbl_use32_bit_fadt_addresses flag. | ||
247 | * | ||
248 | ******************************************************************************/ | ||
249 | |||
250 | static u64 | ||
251 | acpi_tb_select_address(char *register_name, u32 address32, u64 address64) | ||
252 | { | ||
253 | |||
254 | if (!address64) { | ||
255 | |||
256 | /* 64-bit address is zero, use 32-bit address */ | ||
257 | |||
258 | return ((u64)address32); | ||
259 | } | ||
260 | |||
261 | if (address32 && (address64 != (u64)address32)) { | ||
262 | |||
263 | /* Address mismatch between 32-bit and 64-bit versions */ | ||
264 | |||
265 | ACPI_BIOS_WARNING((AE_INFO, | ||
266 | "32/64X %s address mismatch in FADT: " | ||
267 | "0x%8.8X/0x%8.8X%8.8X, using %u-bit address", | ||
268 | register_name, address32, | ||
269 | ACPI_FORMAT_UINT64(address64), | ||
270 | acpi_gbl_use32_bit_fadt_addresses ? 32 : | ||
271 | 64)); | ||
272 | |||
273 | /* 32-bit address override */ | ||
274 | |||
275 | if (acpi_gbl_use32_bit_fadt_addresses) { | ||
276 | return ((u64)address32); | ||
277 | } | ||
278 | } | ||
279 | |||
280 | /* Default is to use the 64-bit address */ | ||
281 | |||
282 | return (address64); | ||
283 | } | ||
284 | |||
285 | /******************************************************************************* | ||
286 | * | ||
223 | * FUNCTION: acpi_tb_parse_fadt | 287 | * FUNCTION: acpi_tb_parse_fadt |
224 | * | 288 | * |
225 | * PARAMETERS: table_index - Index for the FADT | 289 | * PARAMETERS: table_index - Index for the FADT |
@@ -331,10 +395,6 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length) | |||
331 | 395 | ||
332 | acpi_tb_convert_fadt(); | 396 | acpi_tb_convert_fadt(); |
333 | 397 | ||
334 | /* Validate FADT values now, before we make any changes */ | ||
335 | |||
336 | acpi_tb_validate_fadt(); | ||
337 | |||
338 | /* Initialize the global ACPI register structures */ | 398 | /* Initialize the global ACPI register structures */ |
339 | 399 | ||
340 | acpi_tb_setup_fadt_registers(); | 400 | acpi_tb_setup_fadt_registers(); |
@@ -344,66 +404,55 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length) | |||
344 | * | 404 | * |
345 | * FUNCTION: acpi_tb_convert_fadt | 405 | * FUNCTION: acpi_tb_convert_fadt |
346 | * | 406 | * |
347 | * PARAMETERS: None, uses acpi_gbl_FADT | 407 | * PARAMETERS: none - acpi_gbl_FADT is used. |
348 | * | 408 | * |
349 | * RETURN: None | 409 | * RETURN: None |
350 | * | 410 | * |
351 | * DESCRIPTION: Converts all versions of the FADT to a common internal format. | 411 | * DESCRIPTION: Converts all versions of the FADT to a common internal format. |
352 | * Expand 32-bit addresses to 64-bit as necessary. | 412 | * Expand 32-bit addresses to 64-bit as necessary. Also validate |
413 | * important fields within the FADT. | ||
353 | * | 414 | * |
354 | * NOTE: acpi_gbl_FADT must be of size (struct acpi_table_fadt), | 415 | * NOTE: acpi_gbl_FADT must be of size (struct acpi_table_fadt), and must |
355 | * and must contain a copy of the actual FADT. | 416 | * contain a copy of the actual BIOS-provided FADT. |
356 | * | 417 | * |
357 | * Notes on 64-bit register addresses: | 418 | * Notes on 64-bit register addresses: |
358 | * | 419 | * |
359 | * After this FADT conversion, later ACPICA code will only use the 64-bit "X" | 420 | * After this FADT conversion, later ACPICA code will only use the 64-bit "X" |
360 | * fields of the FADT for all ACPI register addresses. | 421 | * fields of the FADT for all ACPI register addresses. |
361 | * | 422 | * |
362 | * The 64-bit "X" fields are optional extensions to the original 32-bit FADT | 423 | * The 64-bit X fields are optional extensions to the original 32-bit FADT |
363 | * V1.0 fields. Even if they are present in the FADT, they are optional and | 424 | * V1.0 fields. Even if they are present in the FADT, they are optional and |
364 | * are unused if the BIOS sets them to zero. Therefore, we must copy/expand | 425 | * are unused if the BIOS sets them to zero. Therefore, we must copy/expand |
365 | * 32-bit V1.0 fields if the corresponding X field is zero. | 426 | * 32-bit V1.0 fields to the 64-bit X fields if the the 64-bit X field is |
427 | * originally zero. | ||
366 | * | 428 | * |
367 | * For ACPI 1.0 FADTs, all 32-bit address fields are expanded to the | 429 | * For ACPI 1.0 FADTs (that contain no 64-bit addresses), all 32-bit address |
368 | * corresponding "X" fields in the internal FADT. | 430 | * fields are expanded to the corresponding 64-bit X fields in the internal |
431 | * common FADT. | ||
369 | * | 432 | * |
370 | * For ACPI 2.0+ FADTs, all valid (non-zero) 32-bit address fields are expanded | 433 | * For ACPI 2.0+ FADTs, all valid (non-zero) 32-bit address fields are expanded |
371 | * to the corresponding 64-bit X fields. For compatibility with other ACPI | 434 | * to the corresponding 64-bit X fields, if the 64-bit field is originally |
372 | * implementations, we ignore the 64-bit field if the 32-bit field is valid, | 435 | * zero. Adhering to the ACPI specification, we completely ignore the 32-bit |
373 | * regardless of whether the host OS is 32-bit or 64-bit. | 436 | * field if the 64-bit field is valid, regardless of whether the host OS is |
437 | * 32-bit or 64-bit. | ||
438 | * | ||
439 | * Possible additional checks: | ||
440 | * (acpi_gbl_FADT.pm1_event_length >= 4) | ||
441 | * (acpi_gbl_FADT.pm1_control_length >= 2) | ||
442 | * (acpi_gbl_FADT.pm_timer_length >= 4) | ||
443 | * Gpe block lengths must be multiple of 2 | ||
374 | * | 444 | * |
375 | ******************************************************************************/ | 445 | ******************************************************************************/ |
376 | 446 | ||
377 | static void acpi_tb_convert_fadt(void) | 447 | static void acpi_tb_convert_fadt(void) |
378 | { | 448 | { |
449 | char *name; | ||
379 | struct acpi_generic_address *address64; | 450 | struct acpi_generic_address *address64; |
380 | u32 address32; | 451 | u32 address32; |
452 | u8 length; | ||
381 | u32 i; | 453 | u32 i; |
382 | 454 | ||
383 | /* | 455 | /* |
384 | * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary. | ||
385 | * Later code will always use the X 64-bit field. Also, check for an | ||
386 | * address mismatch between the 32-bit and 64-bit address fields | ||
387 | * (FIRMWARE_CTRL/X_FIRMWARE_CTRL, DSDT/X_DSDT) which would indicate | ||
388 | * the presence of two FACS or two DSDT tables. | ||
389 | */ | ||
390 | if (!acpi_gbl_FADT.Xfacs) { | ||
391 | acpi_gbl_FADT.Xfacs = (u64) acpi_gbl_FADT.facs; | ||
392 | } else if (acpi_gbl_FADT.facs && | ||
393 | (acpi_gbl_FADT.Xfacs != (u64) acpi_gbl_FADT.facs)) { | ||
394 | ACPI_WARNING((AE_INFO, | ||
395 | "32/64 FACS address mismatch in FADT - two FACS tables!")); | ||
396 | } | ||
397 | |||
398 | if (!acpi_gbl_FADT.Xdsdt) { | ||
399 | acpi_gbl_FADT.Xdsdt = (u64) acpi_gbl_FADT.dsdt; | ||
400 | } else if (acpi_gbl_FADT.dsdt && | ||
401 | (acpi_gbl_FADT.Xdsdt != (u64) acpi_gbl_FADT.dsdt)) { | ||
402 | ACPI_WARNING((AE_INFO, | ||
403 | "32/64 DSDT address mismatch in FADT - two DSDT tables!")); | ||
404 | } | ||
405 | |||
406 | /* | ||
407 | * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which | 456 | * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which |
408 | * should be zero are indeed zero. This will workaround BIOSs that | 457 | * should be zero are indeed zero. This will workaround BIOSs that |
409 | * inadvertently place values in these fields. | 458 | * inadvertently place values in these fields. |
@@ -421,119 +470,24 @@ static void acpi_tb_convert_fadt(void) | |||
421 | acpi_gbl_FADT.boot_flags = 0; | 470 | acpi_gbl_FADT.boot_flags = 0; |
422 | } | 471 | } |
423 | 472 | ||
424 | /* Update the local FADT table header length */ | ||
425 | |||
426 | acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt); | ||
427 | |||
428 | /* | 473 | /* |
429 | * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X" | 474 | * Now we can update the local FADT length to the length of the |
430 | * generic address structures as necessary. Later code will always use | 475 | * current FADT version as defined by the ACPI specification. |
431 | * the 64-bit address structures. | 476 | * Thus, we will have a common FADT internally. |
432 | * | ||
433 | * March 2009: | ||
434 | * We now always use the 32-bit address if it is valid (non-null). This | ||
435 | * is not in accordance with the ACPI specification which states that | ||
436 | * the 64-bit address supersedes the 32-bit version, but we do this for | ||
437 | * compatibility with other ACPI implementations. Most notably, in the | ||
438 | * case where both the 32 and 64 versions are non-null, we use the 32-bit | ||
439 | * version. This is the only address that is guaranteed to have been | ||
440 | * tested by the BIOS manufacturer. | ||
441 | */ | 477 | */ |
442 | for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { | 478 | acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt); |
443 | address32 = *ACPI_ADD_PTR(u32, | ||
444 | &acpi_gbl_FADT, | ||
445 | fadt_info_table[i].address32); | ||
446 | |||
447 | address64 = ACPI_ADD_PTR(struct acpi_generic_address, | ||
448 | &acpi_gbl_FADT, | ||
449 | fadt_info_table[i].address64); | ||
450 | |||
451 | /* | ||
452 | * If both 32- and 64-bit addresses are valid (non-zero), | ||
453 | * they must match. | ||
454 | */ | ||
455 | if (address64->address && address32 && | ||
456 | (address64->address != (u64)address32)) { | ||
457 | ACPI_BIOS_ERROR((AE_INFO, | ||
458 | "32/64X address mismatch in FADT/%s: " | ||
459 | "0x%8.8X/0x%8.8X%8.8X, using 32", | ||
460 | fadt_info_table[i].name, address32, | ||
461 | ACPI_FORMAT_UINT64(address64-> | ||
462 | address))); | ||
463 | } | ||
464 | |||
465 | /* Always use 32-bit address if it is valid (non-null) */ | ||
466 | |||
467 | if (address32) { | ||
468 | /* | ||
469 | * Copy the 32-bit address to the 64-bit GAS structure. The | ||
470 | * Space ID is always I/O for 32-bit legacy address fields | ||
471 | */ | ||
472 | acpi_tb_init_generic_address(address64, | ||
473 | ACPI_ADR_SPACE_SYSTEM_IO, | ||
474 | *ACPI_ADD_PTR(u8, | ||
475 | &acpi_gbl_FADT, | ||
476 | fadt_info_table | ||
477 | [i].length), | ||
478 | (u64) address32, | ||
479 | fadt_info_table[i].name); | ||
480 | } | ||
481 | } | ||
482 | } | ||
483 | |||
484 | /******************************************************************************* | ||
485 | * | ||
486 | * FUNCTION: acpi_tb_validate_fadt | ||
487 | * | ||
488 | * PARAMETERS: table - Pointer to the FADT to be validated | ||
489 | * | ||
490 | * RETURN: None | ||
491 | * | ||
492 | * DESCRIPTION: Validate various important fields within the FADT. If a problem | ||
493 | * is found, issue a message, but no status is returned. | ||
494 | * Used by both the table manager and the disassembler. | ||
495 | * | ||
496 | * Possible additional checks: | ||
497 | * (acpi_gbl_FADT.pm1_event_length >= 4) | ||
498 | * (acpi_gbl_FADT.pm1_control_length >= 2) | ||
499 | * (acpi_gbl_FADT.pm_timer_length >= 4) | ||
500 | * Gpe block lengths must be multiple of 2 | ||
501 | * | ||
502 | ******************************************************************************/ | ||
503 | |||
504 | static void acpi_tb_validate_fadt(void) | ||
505 | { | ||
506 | char *name; | ||
507 | struct acpi_generic_address *address64; | ||
508 | u8 length; | ||
509 | u32 i; | ||
510 | 479 | ||
511 | /* | 480 | /* |
512 | * Check for FACS and DSDT address mismatches. An address mismatch between | 481 | * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary. |
513 | * the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and | 482 | * Later ACPICA code will always use the X 64-bit field. |
514 | * DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT tables. | ||
515 | */ | 483 | */ |
516 | if (acpi_gbl_FADT.facs && | 484 | acpi_gbl_FADT.Xfacs = acpi_tb_select_address("FACS", |
517 | (acpi_gbl_FADT.Xfacs != (u64)acpi_gbl_FADT.facs)) { | 485 | acpi_gbl_FADT.facs, |
518 | ACPI_BIOS_WARNING((AE_INFO, | 486 | acpi_gbl_FADT.Xfacs); |
519 | "32/64X FACS address mismatch in FADT - " | ||
520 | "0x%8.8X/0x%8.8X%8.8X, using 32", | ||
521 | acpi_gbl_FADT.facs, | ||
522 | ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xfacs))); | ||
523 | |||
524 | acpi_gbl_FADT.Xfacs = (u64)acpi_gbl_FADT.facs; | ||
525 | } | ||
526 | |||
527 | if (acpi_gbl_FADT.dsdt && | ||
528 | (acpi_gbl_FADT.Xdsdt != (u64)acpi_gbl_FADT.dsdt)) { | ||
529 | ACPI_BIOS_WARNING((AE_INFO, | ||
530 | "32/64X DSDT address mismatch in FADT - " | ||
531 | "0x%8.8X/0x%8.8X%8.8X, using 32", | ||
532 | acpi_gbl_FADT.dsdt, | ||
533 | ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xdsdt))); | ||
534 | 487 | ||
535 | acpi_gbl_FADT.Xdsdt = (u64)acpi_gbl_FADT.dsdt; | 488 | acpi_gbl_FADT.Xdsdt = acpi_tb_select_address("DSDT", |
536 | } | 489 | acpi_gbl_FADT.dsdt, |
490 | acpi_gbl_FADT.Xdsdt); | ||
537 | 491 | ||
538 | /* If Hardware Reduced flag is set, we are all done */ | 492 | /* If Hardware Reduced flag is set, we are all done */ |
539 | 493 | ||
@@ -545,18 +499,95 @@ static void acpi_tb_validate_fadt(void) | |||
545 | 499 | ||
546 | for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { | 500 | for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { |
547 | /* | 501 | /* |
548 | * Generate pointer to the 64-bit address, get the register | 502 | * Get the 32-bit and 64-bit addresses, as well as the register |
549 | * length (width) and the register name | 503 | * length and register name. |
550 | */ | 504 | */ |
505 | address32 = *ACPI_ADD_PTR(u32, | ||
506 | &acpi_gbl_FADT, | ||
507 | fadt_info_table[i].address32); | ||
508 | |||
551 | address64 = ACPI_ADD_PTR(struct acpi_generic_address, | 509 | address64 = ACPI_ADD_PTR(struct acpi_generic_address, |
552 | &acpi_gbl_FADT, | 510 | &acpi_gbl_FADT, |
553 | fadt_info_table[i].address64); | 511 | fadt_info_table[i].address64); |
554 | length = | 512 | |
555 | *ACPI_ADD_PTR(u8, &acpi_gbl_FADT, | 513 | length = *ACPI_ADD_PTR(u8, |
556 | fadt_info_table[i].length); | 514 | &acpi_gbl_FADT, |
515 | fadt_info_table[i].length); | ||
516 | |||
557 | name = fadt_info_table[i].name; | 517 | name = fadt_info_table[i].name; |
558 | 518 | ||
559 | /* | 519 | /* |
520 | * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X" | ||
521 | * generic address structures as necessary. Later code will always use | ||
522 | * the 64-bit address structures. | ||
523 | * | ||
524 | * November 2013: | ||
525 | * Now always use the 64-bit address if it is valid (non-zero), in | ||
526 | * accordance with the ACPI specification which states that a 64-bit | ||
527 | * address supersedes the 32-bit version. This behavior can be | ||
528 | * overridden by the acpi_gbl_use32_bit_fadt_addresses flag. | ||
529 | * | ||
530 | * During 64-bit address construction and verification, | ||
531 | * these cases are handled: | ||
532 | * | ||
533 | * Address32 zero, Address64 [don't care] - Use Address64 | ||
534 | * | ||
535 | * Address32 non-zero, Address64 zero - Copy/use Address32 | ||
536 | * Address32 non-zero == Address64 non-zero - Use Address64 | ||
537 | * Address32 non-zero != Address64 non-zero - Warning, use Address64 | ||
538 | * | ||
539 | * Override: if acpi_gbl_use32_bit_fadt_addresses is TRUE, and: | ||
540 | * Address32 non-zero != Address64 non-zero - Warning, copy/use Address32 | ||
541 | * | ||
542 | * Note: space_id is always I/O for 32-bit legacy address fields | ||
543 | */ | ||
544 | if (address32) { | ||
545 | if (!address64->address) { | ||
546 | |||
547 | /* 64-bit address is zero, use 32-bit address */ | ||
548 | |||
549 | acpi_tb_init_generic_address(address64, | ||
550 | ACPI_ADR_SPACE_SYSTEM_IO, | ||
551 | *ACPI_ADD_PTR(u8, | ||
552 | &acpi_gbl_FADT, | ||
553 | fadt_info_table | ||
554 | [i]. | ||
555 | length), | ||
556 | (u64)address32, | ||
557 | name); | ||
558 | } else if (address64->address != (u64)address32) { | ||
559 | |||
560 | /* Address mismatch */ | ||
561 | |||
562 | ACPI_BIOS_WARNING((AE_INFO, | ||
563 | "32/64X address mismatch in FADT/%s: " | ||
564 | "0x%8.8X/0x%8.8X%8.8X, using %u-bit address", | ||
565 | name, address32, | ||
566 | ACPI_FORMAT_UINT64 | ||
567 | (address64->address), | ||
568 | acpi_gbl_use32_bit_fadt_addresses | ||
569 | ? 32 : 64)); | ||
570 | |||
571 | if (acpi_gbl_use32_bit_fadt_addresses) { | ||
572 | |||
573 | /* 32-bit address override */ | ||
574 | |||
575 | acpi_tb_init_generic_address(address64, | ||
576 | ACPI_ADR_SPACE_SYSTEM_IO, | ||
577 | *ACPI_ADD_PTR | ||
578 | (u8, | ||
579 | &acpi_gbl_FADT, | ||
580 | fadt_info_table | ||
581 | [i]. | ||
582 | length), | ||
583 | (u64) | ||
584 | address32, | ||
585 | name); | ||
586 | } | ||
587 | } | ||
588 | } | ||
589 | |||
590 | /* | ||
560 | * For each extended field, check for length mismatch between the | 591 | * For each extended field, check for length mismatch between the |
561 | * legacy length field and the corresponding 64-bit X length field. | 592 | * legacy length field and the corresponding 64-bit X length field. |
562 | * Note: If the legacy length field is > 0xFF bits, ignore this | 593 | * Note: If the legacy length field is > 0xFF bits, ignore this |
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index 3d6bb83aa7e7..6412d3c301cb 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c | |||
@@ -49,69 +49,11 @@ | |||
49 | ACPI_MODULE_NAME("tbutils") | 49 | ACPI_MODULE_NAME("tbutils") |
50 | 50 | ||
51 | /* Local prototypes */ | 51 | /* Local prototypes */ |
52 | static acpi_status acpi_tb_validate_xsdt(acpi_physical_address address); | ||
53 | |||
52 | static acpi_physical_address | 54 | static acpi_physical_address |
53 | acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size); | 55 | acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size); |
54 | 56 | ||
55 | /******************************************************************************* | ||
56 | * | ||
57 | * FUNCTION: acpi_tb_check_xsdt | ||
58 | * | ||
59 | * PARAMETERS: address - Pointer to the XSDT | ||
60 | * | ||
61 | * RETURN: status | ||
62 | * AE_OK - XSDT is okay | ||
63 | * AE_NO_MEMORY - can't map XSDT | ||
64 | * AE_INVALID_TABLE_LENGTH - invalid table length | ||
65 | * AE_NULL_ENTRY - XSDT has NULL entry | ||
66 | * | ||
67 | * DESCRIPTION: validate XSDT | ||
68 | ******************************************************************************/ | ||
69 | |||
70 | static acpi_status | ||
71 | acpi_tb_check_xsdt(acpi_physical_address address) | ||
72 | { | ||
73 | struct acpi_table_header *table; | ||
74 | u32 length; | ||
75 | u64 xsdt_entry_address; | ||
76 | u8 *table_entry; | ||
77 | u32 table_count; | ||
78 | int i; | ||
79 | |||
80 | table = acpi_os_map_memory(address, sizeof(struct acpi_table_header)); | ||
81 | if (!table) | ||
82 | return AE_NO_MEMORY; | ||
83 | |||
84 | length = table->length; | ||
85 | acpi_os_unmap_memory(table, sizeof(struct acpi_table_header)); | ||
86 | if (length < sizeof(struct acpi_table_header)) | ||
87 | return AE_INVALID_TABLE_LENGTH; | ||
88 | |||
89 | table = acpi_os_map_memory(address, length); | ||
90 | if (!table) | ||
91 | return AE_NO_MEMORY; | ||
92 | |||
93 | /* Calculate the number of tables described in XSDT */ | ||
94 | table_count = | ||
95 | (u32) ((table->length - | ||
96 | sizeof(struct acpi_table_header)) / sizeof(u64)); | ||
97 | table_entry = | ||
98 | ACPI_CAST_PTR(u8, table) + sizeof(struct acpi_table_header); | ||
99 | for (i = 0; i < table_count; i++) { | ||
100 | ACPI_MOVE_64_TO_64(&xsdt_entry_address, table_entry); | ||
101 | if (!xsdt_entry_address) { | ||
102 | /* XSDT has NULL entry */ | ||
103 | break; | ||
104 | } | ||
105 | table_entry += sizeof(u64); | ||
106 | } | ||
107 | acpi_os_unmap_memory(table, length); | ||
108 | |||
109 | if (i < table_count) | ||
110 | return AE_NULL_ENTRY; | ||
111 | else | ||
112 | return AE_OK; | ||
113 | } | ||
114 | |||
115 | #if (!ACPI_REDUCED_HARDWARE) | 57 | #if (!ACPI_REDUCED_HARDWARE) |
116 | /******************************************************************************* | 58 | /******************************************************************************* |
117 | * | 59 | * |
@@ -383,7 +325,7 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size) | |||
383 | * Get the table physical address (32-bit for RSDT, 64-bit for XSDT): | 325 | * Get the table physical address (32-bit for RSDT, 64-bit for XSDT): |
384 | * Note: Addresses are 32-bit aligned (not 64) in both RSDT and XSDT | 326 | * Note: Addresses are 32-bit aligned (not 64) in both RSDT and XSDT |
385 | */ | 327 | */ |
386 | if (table_entry_size == sizeof(u32)) { | 328 | if (table_entry_size == ACPI_RSDT_ENTRY_SIZE) { |
387 | /* | 329 | /* |
388 | * 32-bit platform, RSDT: Return 32-bit table entry | 330 | * 32-bit platform, RSDT: Return 32-bit table entry |
389 | * 64-bit platform, RSDT: Expand 32-bit to 64-bit and return | 331 | * 64-bit platform, RSDT: Expand 32-bit to 64-bit and return |
@@ -415,6 +357,87 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size) | |||
415 | 357 | ||
416 | /******************************************************************************* | 358 | /******************************************************************************* |
417 | * | 359 | * |
360 | * FUNCTION: acpi_tb_validate_xsdt | ||
361 | * | ||
362 | * PARAMETERS: address - Physical address of the XSDT (from RSDP) | ||
363 | * | ||
364 | * RETURN: Status. AE_OK if the table appears to be valid. | ||
365 | * | ||
366 | * DESCRIPTION: Validate an XSDT to ensure that it is of minimum size and does | ||
367 | * not contain any NULL entries. A problem that is seen in the | ||
368 | * field is that the XSDT exists, but is actually useless because | ||
369 | * of one or more (or all) NULL entries. | ||
370 | * | ||
371 | ******************************************************************************/ | ||
372 | |||
373 | static acpi_status acpi_tb_validate_xsdt(acpi_physical_address xsdt_address) | ||
374 | { | ||
375 | struct acpi_table_header *table; | ||
376 | u8 *next_entry; | ||
377 | acpi_physical_address address; | ||
378 | u32 length; | ||
379 | u32 entry_count; | ||
380 | acpi_status status; | ||
381 | u32 i; | ||
382 | |||
383 | /* Get the XSDT length */ | ||
384 | |||
385 | table = | ||
386 | acpi_os_map_memory(xsdt_address, sizeof(struct acpi_table_header)); | ||
387 | if (!table) { | ||
388 | return (AE_NO_MEMORY); | ||
389 | } | ||
390 | |||
391 | length = table->length; | ||
392 | acpi_os_unmap_memory(table, sizeof(struct acpi_table_header)); | ||
393 | |||
394 | /* | ||
395 | * Minimum XSDT length is the size of the standard ACPI header | ||
396 | * plus one physical address entry | ||
397 | */ | ||
398 | if (length < (sizeof(struct acpi_table_header) + ACPI_XSDT_ENTRY_SIZE)) { | ||
399 | return (AE_INVALID_TABLE_LENGTH); | ||
400 | } | ||
401 | |||
402 | /* Map the entire XSDT */ | ||
403 | |||
404 | table = acpi_os_map_memory(xsdt_address, length); | ||
405 | if (!table) { | ||
406 | return (AE_NO_MEMORY); | ||
407 | } | ||
408 | |||
409 | /* Get the number of entries and pointer to first entry */ | ||
410 | |||
411 | status = AE_OK; | ||
412 | next_entry = ACPI_ADD_PTR(u8, table, sizeof(struct acpi_table_header)); | ||
413 | entry_count = (u32)((table->length - sizeof(struct acpi_table_header)) / | ||
414 | ACPI_XSDT_ENTRY_SIZE); | ||
415 | |||
416 | /* Validate each entry (physical address) within the XSDT */ | ||
417 | |||
418 | for (i = 0; i < entry_count; i++) { | ||
419 | address = | ||
420 | acpi_tb_get_root_table_entry(next_entry, | ||
421 | ACPI_XSDT_ENTRY_SIZE); | ||
422 | if (!address) { | ||
423 | |||
424 | /* Detected a NULL entry, XSDT is invalid */ | ||
425 | |||
426 | status = AE_NULL_ENTRY; | ||
427 | break; | ||
428 | } | ||
429 | |||
430 | next_entry += ACPI_XSDT_ENTRY_SIZE; | ||
431 | } | ||
432 | |||
433 | /* Unmap table */ | ||
434 | |||
435 | acpi_os_unmap_memory(table, length); | ||
436 | return (status); | ||
437 | } | ||
438 | |||
439 | /******************************************************************************* | ||
440 | * | ||
418 | * FUNCTION: acpi_tb_parse_root_table | 441 | * FUNCTION: acpi_tb_parse_root_table |
419 | * | 442 | * |
420 | * PARAMETERS: rsdp - Pointer to the RSDP | 443 | * PARAMETERS: rsdp - Pointer to the RSDP |
@@ -438,16 +461,14 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) | |||
438 | u32 table_count; | 461 | u32 table_count; |
439 | struct acpi_table_header *table; | 462 | struct acpi_table_header *table; |
440 | acpi_physical_address address; | 463 | acpi_physical_address address; |
441 | acpi_physical_address uninitialized_var(rsdt_address); | ||
442 | u32 length; | 464 | u32 length; |
443 | u8 *table_entry; | 465 | u8 *table_entry; |
444 | acpi_status status; | 466 | acpi_status status; |
445 | 467 | ||
446 | ACPI_FUNCTION_TRACE(tb_parse_root_table); | 468 | ACPI_FUNCTION_TRACE(tb_parse_root_table); |
447 | 469 | ||
448 | /* | 470 | /* Map the entire RSDP and extract the address of the RSDT or XSDT */ |
449 | * Map the entire RSDP and extract the address of the RSDT or XSDT | 471 | |
450 | */ | ||
451 | rsdp = acpi_os_map_memory(rsdp_address, sizeof(struct acpi_table_rsdp)); | 472 | rsdp = acpi_os_map_memory(rsdp_address, sizeof(struct acpi_table_rsdp)); |
452 | if (!rsdp) { | 473 | if (!rsdp) { |
453 | return_ACPI_STATUS(AE_NO_MEMORY); | 474 | return_ACPI_STATUS(AE_NO_MEMORY); |
@@ -457,24 +478,22 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) | |||
457 | ACPI_CAST_PTR(struct acpi_table_header, | 478 | ACPI_CAST_PTR(struct acpi_table_header, |
458 | rsdp)); | 479 | rsdp)); |
459 | 480 | ||
460 | /* Differentiate between RSDT and XSDT root tables */ | 481 | /* Use XSDT if present and not overridden. Otherwise, use RSDT */ |
461 | 482 | ||
462 | if (rsdp->revision > 1 && rsdp->xsdt_physical_address | 483 | if ((rsdp->revision > 1) && |
463 | && !acpi_rsdt_forced) { | 484 | rsdp->xsdt_physical_address && !acpi_gbl_do_not_use_xsdt) { |
464 | /* | 485 | /* |
465 | * Root table is an XSDT (64-bit physical addresses). We must use the | 486 | * RSDP contains an XSDT (64-bit physical addresses). We must use |
466 | * XSDT if the revision is > 1 and the XSDT pointer is present, as per | 487 | * the XSDT if the revision is > 1 and the XSDT pointer is present, |
467 | * the ACPI specification. | 488 | * as per the ACPI specification. |
468 | */ | 489 | */ |
469 | address = (acpi_physical_address) rsdp->xsdt_physical_address; | 490 | address = (acpi_physical_address) rsdp->xsdt_physical_address; |
470 | table_entry_size = sizeof(u64); | 491 | table_entry_size = ACPI_XSDT_ENTRY_SIZE; |
471 | rsdt_address = (acpi_physical_address) | ||
472 | rsdp->rsdt_physical_address; | ||
473 | } else { | 492 | } else { |
474 | /* Root table is an RSDT (32-bit physical addresses) */ | 493 | /* Root table is an RSDT (32-bit physical addresses) */ |
475 | 494 | ||
476 | address = (acpi_physical_address) rsdp->rsdt_physical_address; | 495 | address = (acpi_physical_address) rsdp->rsdt_physical_address; |
477 | table_entry_size = sizeof(u32); | 496 | table_entry_size = ACPI_RSDT_ENTRY_SIZE; |
478 | } | 497 | } |
479 | 498 | ||
480 | /* | 499 | /* |
@@ -483,15 +502,25 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) | |||
483 | */ | 502 | */ |
484 | acpi_os_unmap_memory(rsdp, sizeof(struct acpi_table_rsdp)); | 503 | acpi_os_unmap_memory(rsdp, sizeof(struct acpi_table_rsdp)); |
485 | 504 | ||
486 | if (table_entry_size == sizeof(u64)) { | 505 | /* |
487 | if (acpi_tb_check_xsdt(address) == AE_NULL_ENTRY) { | 506 | * If it is present and used, validate the XSDT for access/size |
488 | /* XSDT has NULL entry, RSDT is used */ | 507 | * and ensure that all table entries are at least non-NULL |
489 | address = rsdt_address; | 508 | */ |
490 | table_entry_size = sizeof(u32); | 509 | if (table_entry_size == ACPI_XSDT_ENTRY_SIZE) { |
491 | ACPI_WARNING((AE_INFO, "BIOS XSDT has NULL entry, " | 510 | status = acpi_tb_validate_xsdt(address); |
492 | "using RSDT")); | 511 | if (ACPI_FAILURE(status)) { |
512 | ACPI_BIOS_WARNING((AE_INFO, | ||
513 | "XSDT is invalid (%s), using RSDT", | ||
514 | acpi_format_exception(status))); | ||
515 | |||
516 | /* Fall back to the RSDT */ | ||
517 | |||
518 | address = | ||
519 | (acpi_physical_address) rsdp->rsdt_physical_address; | ||
520 | table_entry_size = ACPI_RSDT_ENTRY_SIZE; | ||
493 | } | 521 | } |
494 | } | 522 | } |
523 | |||
495 | /* Map the RSDT/XSDT table header to get the full table length */ | 524 | /* Map the RSDT/XSDT table header to get the full table length */ |
496 | 525 | ||
497 | table = acpi_os_map_memory(address, sizeof(struct acpi_table_header)); | 526 | table = acpi_os_map_memory(address, sizeof(struct acpi_table_header)); |
@@ -501,12 +530,14 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) | |||
501 | 530 | ||
502 | acpi_tb_print_table_header(address, table); | 531 | acpi_tb_print_table_header(address, table); |
503 | 532 | ||
504 | /* Get the length of the full table, verify length and map entire table */ | 533 | /* |
505 | 534 | * Validate length of the table, and map entire table. | |
535 | * Minimum length table must contain at least one entry. | ||
536 | */ | ||
506 | length = table->length; | 537 | length = table->length; |
507 | acpi_os_unmap_memory(table, sizeof(struct acpi_table_header)); | 538 | acpi_os_unmap_memory(table, sizeof(struct acpi_table_header)); |
508 | 539 | ||
509 | if (length < sizeof(struct acpi_table_header)) { | 540 | if (length < (sizeof(struct acpi_table_header) + table_entry_size)) { |
510 | ACPI_BIOS_ERROR((AE_INFO, | 541 | ACPI_BIOS_ERROR((AE_INFO, |
511 | "Invalid table length 0x%X in RSDT/XSDT", | 542 | "Invalid table length 0x%X in RSDT/XSDT", |
512 | length)); | 543 | length)); |
@@ -526,22 +557,21 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) | |||
526 | return_ACPI_STATUS(status); | 557 | return_ACPI_STATUS(status); |
527 | } | 558 | } |
528 | 559 | ||
529 | /* Calculate the number of tables described in the root table */ | 560 | /* Get the number of entries and pointer to first entry */ |
530 | 561 | ||
531 | table_count = (u32)((table->length - sizeof(struct acpi_table_header)) / | 562 | table_count = (u32)((table->length - sizeof(struct acpi_table_header)) / |
532 | table_entry_size); | 563 | table_entry_size); |
564 | table_entry = ACPI_ADD_PTR(u8, table, sizeof(struct acpi_table_header)); | ||
565 | |||
533 | /* | 566 | /* |
534 | * First two entries in the table array are reserved for the DSDT | 567 | * First two entries in the table array are reserved for the DSDT |
535 | * and FACS, which are not actually present in the RSDT/XSDT - they | 568 | * and FACS, which are not actually present in the RSDT/XSDT - they |
536 | * come from the FADT | 569 | * come from the FADT |
537 | */ | 570 | */ |
538 | table_entry = | ||
539 | ACPI_CAST_PTR(u8, table) + sizeof(struct acpi_table_header); | ||
540 | acpi_gbl_root_table_list.current_table_count = 2; | 571 | acpi_gbl_root_table_list.current_table_count = 2; |
541 | 572 | ||
542 | /* | 573 | /* Initialize the root table array from the RSDT/XSDT */ |
543 | * Initialize the root table array from the RSDT/XSDT | 574 | |
544 | */ | ||
545 | for (i = 0; i < table_count; i++) { | 575 | for (i = 0; i < table_count; i++) { |
546 | if (acpi_gbl_root_table_list.current_table_count >= | 576 | if (acpi_gbl_root_table_list.current_table_count >= |
547 | acpi_gbl_root_table_list.max_table_count) { | 577 | acpi_gbl_root_table_list.max_table_count) { |
@@ -584,7 +614,7 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) | |||
584 | acpi_tb_install_table(acpi_gbl_root_table_list.tables[i]. | 614 | acpi_tb_install_table(acpi_gbl_root_table_list.tables[i]. |
585 | address, NULL, i); | 615 | address, NULL, i); |
586 | 616 | ||
587 | /* Special case for FADT - get the DSDT and FACS */ | 617 | /* Special case for FADT - validate it then get the DSDT and FACS */ |
588 | 618 | ||
589 | if (ACPI_COMPARE_NAME | 619 | if (ACPI_COMPARE_NAME |
590 | (&acpi_gbl_root_table_list.tables[i].signature, | 620 | (&acpi_gbl_root_table_list.tables[i].signature, |
diff --git a/drivers/acpi/acpica/utaddress.c b/drivers/acpi/acpica/utaddress.c index e0a2e2779c2e..2c2b6ae5dfc4 100644 --- a/drivers/acpi/acpica/utaddress.c +++ b/drivers/acpi/acpica/utaddress.c | |||
@@ -224,10 +224,11 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id, | |||
224 | 224 | ||
225 | while (range_info) { | 225 | while (range_info) { |
226 | /* | 226 | /* |
227 | * Check if the requested Address/Length overlaps this address_range. | 227 | * Check if the requested address/length overlaps this |
228 | * Four cases to consider: | 228 | * address range. There are four cases to consider: |
229 | * | 229 | * |
230 | * 1) Input address/length is contained completely in the address range | 230 | * 1) Input address/length is contained completely in the |
231 | * address range | ||
231 | * 2) Input address/length overlaps range at the range start | 232 | * 2) Input address/length overlaps range at the range start |
232 | * 3) Input address/length overlaps range at the range end | 233 | * 3) Input address/length overlaps range at the range end |
233 | * 4) Input address/length completely encompasses the range | 234 | * 4) Input address/length completely encompasses the range |
@@ -244,11 +245,17 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id, | |||
244 | region_node); | 245 | region_node); |
245 | 246 | ||
246 | ACPI_WARNING((AE_INFO, | 247 | ACPI_WARNING((AE_INFO, |
247 | "0x%p-0x%p %s conflicts with Region %s %d", | 248 | "%s range 0x%p-0x%p conflicts with OpRegion 0x%p-0x%p (%s)", |
249 | acpi_ut_get_region_name(space_id), | ||
248 | ACPI_CAST_PTR(void, address), | 250 | ACPI_CAST_PTR(void, address), |
249 | ACPI_CAST_PTR(void, end_address), | 251 | ACPI_CAST_PTR(void, end_address), |
250 | acpi_ut_get_region_name(space_id), | 252 | ACPI_CAST_PTR(void, |
251 | pathname, overlap_count)); | 253 | range_info-> |
254 | start_address), | ||
255 | ACPI_CAST_PTR(void, | ||
256 | range_info-> | ||
257 | end_address), | ||
258 | pathname)); | ||
252 | ACPI_FREE(pathname); | 259 | ACPI_FREE(pathname); |
253 | } | 260 | } |
254 | } | 261 | } |
diff --git a/drivers/acpi/acpica/utalloc.c b/drivers/acpi/acpica/utalloc.c index 814267f52715..1851762fc5b5 100644 --- a/drivers/acpi/acpica/utalloc.c +++ b/drivers/acpi/acpica/utalloc.c | |||
@@ -302,9 +302,13 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, | |||
302 | return (AE_BUFFER_OVERFLOW); | 302 | return (AE_BUFFER_OVERFLOW); |
303 | 303 | ||
304 | case ACPI_ALLOCATE_BUFFER: | 304 | case ACPI_ALLOCATE_BUFFER: |
305 | 305 | /* | |
306 | /* Allocate a new buffer */ | 306 | * Allocate a new buffer. We directectly call acpi_os_allocate here to |
307 | 307 | * purposefully bypass the (optionally enabled) internal allocation | |
308 | * tracking mechanism since we only want to track internal | ||
309 | * allocations. Note: The caller should use acpi_os_free to free this | ||
310 | * buffer created via ACPI_ALLOCATE_BUFFER. | ||
311 | */ | ||
308 | buffer->pointer = acpi_os_allocate(required_length); | 312 | buffer->pointer = acpi_os_allocate(required_length); |
309 | break; | 313 | break; |
310 | 314 | ||
diff --git a/drivers/acpi/acpica/utcache.c b/drivers/acpi/acpica/utcache.c index 366bfec4b770..cacd2fd9e665 100644 --- a/drivers/acpi/acpica/utcache.c +++ b/drivers/acpi/acpica/utcache.c | |||
@@ -248,12 +248,12 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
248 | ACPI_FUNCTION_NAME(os_acquire_object); | 248 | ACPI_FUNCTION_NAME(os_acquire_object); |
249 | 249 | ||
250 | if (!cache) { | 250 | if (!cache) { |
251 | return (NULL); | 251 | return_PTR(NULL); |
252 | } | 252 | } |
253 | 253 | ||
254 | status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); | 254 | status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); |
255 | if (ACPI_FAILURE(status)) { | 255 | if (ACPI_FAILURE(status)) { |
256 | return (NULL); | 256 | return_PTR(NULL); |
257 | } | 257 | } |
258 | 258 | ||
259 | ACPI_MEM_TRACKING(cache->requests++); | 259 | ACPI_MEM_TRACKING(cache->requests++); |
@@ -276,7 +276,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
276 | 276 | ||
277 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); | 277 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); |
278 | if (ACPI_FAILURE(status)) { | 278 | if (ACPI_FAILURE(status)) { |
279 | return (NULL); | 279 | return_PTR(NULL); |
280 | } | 280 | } |
281 | 281 | ||
282 | /* Clear (zero) the previously used Object */ | 282 | /* Clear (zero) the previously used Object */ |
@@ -299,15 +299,15 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
299 | 299 | ||
300 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); | 300 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); |
301 | if (ACPI_FAILURE(status)) { | 301 | if (ACPI_FAILURE(status)) { |
302 | return (NULL); | 302 | return_PTR(NULL); |
303 | } | 303 | } |
304 | 304 | ||
305 | object = ACPI_ALLOCATE_ZEROED(cache->object_size); | 305 | object = ACPI_ALLOCATE_ZEROED(cache->object_size); |
306 | if (!object) { | 306 | if (!object) { |
307 | return (NULL); | 307 | return_PTR(NULL); |
308 | } | 308 | } |
309 | } | 309 | } |
310 | 310 | ||
311 | return (object); | 311 | return_PTR(object); |
312 | } | 312 | } |
313 | #endif /* ACPI_USE_LOCAL_CACHE */ | 313 | #endif /* ACPI_USE_LOCAL_CACHE */ |
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c index 03ae8affe48f..d971c8631263 100644 --- a/drivers/acpi/acpica/utdebug.c +++ b/drivers/acpi/acpica/utdebug.c | |||
@@ -194,9 +194,9 @@ acpi_debug_print(u32 requested_debug_level, | |||
194 | */ | 194 | */ |
195 | acpi_os_printf("%9s-%04ld ", module_name, line_number); | 195 | acpi_os_printf("%9s-%04ld ", module_name, line_number); |
196 | 196 | ||
197 | #ifdef ACPI_EXEC_APP | 197 | #ifdef ACPI_APPLICATION |
198 | /* | 198 | /* |
199 | * For acpi_exec only, emit the thread ID and nesting level. | 199 | * For acpi_exec/iASL only, emit the thread ID and nesting level. |
200 | * Note: nesting level is really only useful during a single-thread | 200 | * Note: nesting level is really only useful during a single-thread |
201 | * execution. Otherwise, multiple threads will keep resetting the | 201 | * execution. Otherwise, multiple threads will keep resetting the |
202 | * level. | 202 | * level. |
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index 81f9a9584451..030cb0dc673c 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c | |||
@@ -388,11 +388,7 @@ acpi_status acpi_ut_init_globals(void) | |||
388 | /* Public globals */ | 388 | /* Public globals */ |
389 | 389 | ||
390 | ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) | 390 | ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) |
391 | |||
392 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) | 391 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) |
393 | |||
394 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) | 392 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) |
395 | |||
396 | ACPI_EXPORT_SYMBOL(acpi_gpe_count) | 393 | ACPI_EXPORT_SYMBOL(acpi_gpe_count) |
397 | |||
398 | ACPI_EXPORT_SYMBOL(acpi_current_gpe_count) | 394 | ACPI_EXPORT_SYMBOL(acpi_current_gpe_count) |
diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c index 75efea0539c1..246ef68681f4 100644 --- a/drivers/acpi/acpica/utxfinit.c +++ b/drivers/acpi/acpica/utxfinit.c | |||
@@ -122,8 +122,16 @@ acpi_status __init acpi_initialize_subsystem(void) | |||
122 | 122 | ||
123 | /* If configured, initialize the AML debugger */ | 123 | /* If configured, initialize the AML debugger */ |
124 | 124 | ||
125 | ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); | 125 | #ifdef ACPI_DEBUGGER |
126 | return_ACPI_STATUS(status); | 126 | status = acpi_db_initialize(); |
127 | if (ACPI_FAILURE(status)) { | ||
128 | ACPI_EXCEPTION((AE_INFO, status, | ||
129 | "During Debugger initialization")); | ||
130 | return_ACPI_STATUS(status); | ||
131 | } | ||
132 | #endif | ||
133 | |||
134 | return_ACPI_STATUS(AE_OK); | ||
127 | } | 135 | } |
128 | 136 | ||
129 | ACPI_EXPORT_SYMBOL_INIT(acpi_initialize_subsystem) | 137 | ACPI_EXPORT_SYMBOL_INIT(acpi_initialize_subsystem) |
diff --git a/drivers/acpi/apei/Kconfig b/drivers/acpi/apei/Kconfig index 786294bb682c..3650b2183227 100644 --- a/drivers/acpi/apei/Kconfig +++ b/drivers/acpi/apei/Kconfig | |||
@@ -2,7 +2,6 @@ config ACPI_APEI | |||
2 | bool "ACPI Platform Error Interface (APEI)" | 2 | bool "ACPI Platform Error Interface (APEI)" |
3 | select MISC_FILESYSTEMS | 3 | select MISC_FILESYSTEMS |
4 | select PSTORE | 4 | select PSTORE |
5 | select EFI | ||
6 | select UEFI_CPER | 5 | select UEFI_CPER |
7 | depends on X86 | 6 | depends on X86 |
8 | help | 7 | help |
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c index 6d2c49b86b7f..0760b75f79cc 100644 --- a/drivers/acpi/apei/apei-base.c +++ b/drivers/acpi/apei/apei-base.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/acpi.h> | 36 | #include <linux/acpi.h> |
37 | #include <linux/acpi_io.h> | ||
38 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
39 | #include <linux/io.h> | 38 | #include <linux/io.h> |
40 | #include <linux/kref.h> | 39 | #include <linux/kref.h> |
diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h index 21ba34a73883..e5bcd919d4e6 100644 --- a/drivers/acpi/apei/apei-internal.h +++ b/drivers/acpi/apei/apei-internal.h | |||
@@ -8,7 +8,6 @@ | |||
8 | 8 | ||
9 | #include <linux/cper.h> | 9 | #include <linux/cper.h> |
10 | #include <linux/acpi.h> | 10 | #include <linux/acpi.h> |
11 | #include <linux/acpi_io.h> | ||
12 | 11 | ||
13 | struct apei_exec_context; | 12 | struct apei_exec_context; |
14 | 13 | ||
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 26311f23c824..cb1d557fc22c 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c | |||
@@ -942,6 +942,7 @@ static int erst_clearer(enum pstore_type_id type, u64 id, int count, | |||
942 | static struct pstore_info erst_info = { | 942 | static struct pstore_info erst_info = { |
943 | .owner = THIS_MODULE, | 943 | .owner = THIS_MODULE, |
944 | .name = "erst", | 944 | .name = "erst", |
945 | .flags = PSTORE_FLAGS_FRAGILE, | ||
945 | .open = erst_open_pstore, | 946 | .open = erst_open_pstore, |
946 | .close = erst_close_pstore, | 947 | .close = erst_close_pstore, |
947 | .read = erst_reader, | 948 | .read = erst_reader, |
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index a30bc313787b..694c486a12ed 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
34 | #include <linux/init.h> | 34 | #include <linux/init.h> |
35 | #include <linux/acpi.h> | 35 | #include <linux/acpi.h> |
36 | #include <linux/acpi_io.h> | ||
37 | #include <linux/io.h> | 36 | #include <linux/io.h> |
38 | #include <linux/interrupt.h> | 37 | #include <linux/interrupt.h> |
39 | #include <linux/timer.h> | 38 | #include <linux/timer.h> |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index e90ef8b96f26..470e7542bf31 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -61,6 +61,7 @@ MODULE_AUTHOR("Alexey Starikovskiy <astarikovskiy@suse.de>"); | |||
61 | MODULE_DESCRIPTION("ACPI Battery Driver"); | 61 | MODULE_DESCRIPTION("ACPI Battery Driver"); |
62 | MODULE_LICENSE("GPL"); | 62 | MODULE_LICENSE("GPL"); |
63 | 63 | ||
64 | static int battery_bix_broken_package; | ||
64 | static unsigned int cache_time = 1000; | 65 | static unsigned int cache_time = 1000; |
65 | module_param(cache_time, uint, 0644); | 66 | module_param(cache_time, uint, 0644); |
66 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); | 67 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); |
@@ -415,7 +416,12 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
415 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating %s", name)); | 416 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating %s", name)); |
416 | return -ENODEV; | 417 | return -ENODEV; |
417 | } | 418 | } |
418 | if (test_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags)) | 419 | |
420 | if (battery_bix_broken_package) | ||
421 | result = extract_package(battery, buffer.pointer, | ||
422 | extended_info_offsets + 1, | ||
423 | ARRAY_SIZE(extended_info_offsets) - 1); | ||
424 | else if (test_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags)) | ||
419 | result = extract_package(battery, buffer.pointer, | 425 | result = extract_package(battery, buffer.pointer, |
420 | extended_info_offsets, | 426 | extended_info_offsets, |
421 | ARRAY_SIZE(extended_info_offsets)); | 427 | ARRAY_SIZE(extended_info_offsets)); |
@@ -753,6 +759,17 @@ static int battery_notify(struct notifier_block *nb, | |||
753 | return 0; | 759 | return 0; |
754 | } | 760 | } |
755 | 761 | ||
762 | static struct dmi_system_id bat_dmi_table[] = { | ||
763 | { | ||
764 | .ident = "NEC LZ750/LS", | ||
765 | .matches = { | ||
766 | DMI_MATCH(DMI_SYS_VENDOR, "NEC"), | ||
767 | DMI_MATCH(DMI_PRODUCT_NAME, "PC-LZ750LS"), | ||
768 | }, | ||
769 | }, | ||
770 | {}, | ||
771 | }; | ||
772 | |||
756 | static int acpi_battery_add(struct acpi_device *device) | 773 | static int acpi_battery_add(struct acpi_device *device) |
757 | { | 774 | { |
758 | int result = 0; | 775 | int result = 0; |
@@ -845,6 +862,9 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie) | |||
845 | { | 862 | { |
846 | if (acpi_disabled) | 863 | if (acpi_disabled) |
847 | return; | 864 | return; |
865 | |||
866 | if (dmi_check_system(bat_dmi_table)) | ||
867 | battery_bix_broken_package = 1; | ||
848 | acpi_bus_register_driver(&acpi_battery_driver); | 868 | acpi_bus_register_driver(&acpi_battery_driver); |
849 | } | 869 | } |
850 | 870 | ||
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index 05ee8f61bfb5..10e4964d051a 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c | |||
@@ -322,6 +322,56 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { | |||
322 | DMI_MATCH(DMI_PRODUCT_VERSION, "2349D15"), | 322 | DMI_MATCH(DMI_PRODUCT_VERSION, "2349D15"), |
323 | }, | 323 | }, |
324 | }, | 324 | }, |
325 | { | ||
326 | .callback = dmi_disable_osi_win8, | ||
327 | .ident = "HP ProBook 2013 models", | ||
328 | .matches = { | ||
329 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
330 | DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook "), | ||
331 | DMI_MATCH(DMI_PRODUCT_NAME, " G1"), | ||
332 | }, | ||
333 | }, | ||
334 | { | ||
335 | .callback = dmi_disable_osi_win8, | ||
336 | .ident = "HP EliteBook 2013 models", | ||
337 | .matches = { | ||
338 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
339 | DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook "), | ||
340 | DMI_MATCH(DMI_PRODUCT_NAME, " G1"), | ||
341 | }, | ||
342 | }, | ||
343 | { | ||
344 | .callback = dmi_disable_osi_win8, | ||
345 | .ident = "HP ZBook 14", | ||
346 | .matches = { | ||
347 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
348 | DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 14"), | ||
349 | }, | ||
350 | }, | ||
351 | { | ||
352 | .callback = dmi_disable_osi_win8, | ||
353 | .ident = "HP ZBook 15", | ||
354 | .matches = { | ||
355 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
356 | DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 15"), | ||
357 | }, | ||
358 | }, | ||
359 | { | ||
360 | .callback = dmi_disable_osi_win8, | ||
361 | .ident = "HP ZBook 17", | ||
362 | .matches = { | ||
363 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
364 | DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 17"), | ||
365 | }, | ||
366 | }, | ||
367 | { | ||
368 | .callback = dmi_disable_osi_win8, | ||
369 | .ident = "HP EliteBook 8780w", | ||
370 | .matches = { | ||
371 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
372 | DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8780w"), | ||
373 | }, | ||
374 | }, | ||
325 | 375 | ||
326 | /* | 376 | /* |
327 | * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. | 377 | * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 9e3a6cb99f90..11c11f6b8fa1 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -100,7 +100,6 @@ struct acpi_button { | |||
100 | struct input_dev *input; | 100 | struct input_dev *input; |
101 | char phys[32]; /* for input device */ | 101 | char phys[32]; /* for input device */ |
102 | unsigned long pushed; | 102 | unsigned long pushed; |
103 | bool wakeup_enabled; | ||
104 | }; | 103 | }; |
105 | 104 | ||
106 | static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier); | 105 | static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier); |
@@ -406,16 +405,6 @@ static int acpi_button_add(struct acpi_device *device) | |||
406 | lid_device = device; | 405 | lid_device = device; |
407 | } | 406 | } |
408 | 407 | ||
409 | if (device->wakeup.flags.valid) { | ||
410 | /* Button's GPE is run-wake GPE */ | ||
411 | acpi_enable_gpe(device->wakeup.gpe_device, | ||
412 | device->wakeup.gpe_number); | ||
413 | if (!device_may_wakeup(&device->dev)) { | ||
414 | device_set_wakeup_enable(&device->dev, true); | ||
415 | button->wakeup_enabled = true; | ||
416 | } | ||
417 | } | ||
418 | |||
419 | printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device)); | 408 | printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device)); |
420 | return 0; | 409 | return 0; |
421 | 410 | ||
@@ -432,13 +421,6 @@ static int acpi_button_remove(struct acpi_device *device) | |||
432 | { | 421 | { |
433 | struct acpi_button *button = acpi_driver_data(device); | 422 | struct acpi_button *button = acpi_driver_data(device); |
434 | 423 | ||
435 | if (device->wakeup.flags.valid) { | ||
436 | acpi_disable_gpe(device->wakeup.gpe_device, | ||
437 | device->wakeup.gpe_number); | ||
438 | if (button->wakeup_enabled) | ||
439 | device_set_wakeup_enable(&device->dev, false); | ||
440 | } | ||
441 | |||
442 | acpi_button_remove_fs(device); | 424 | acpi_button_remove_fs(device); |
443 | input_unregister_device(button->input); | 425 | input_unregister_device(button->input); |
444 | kfree(button); | 426 | kfree(button); |
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 8da6be99ba42..c431c88faaff 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #include <linux/stddef.h> | 33 | #include <linux/stddef.h> |
34 | #include <linux/acpi.h> | 34 | #include <linux/acpi.h> |
35 | 35 | ||
36 | #include "internal.h" | ||
37 | |||
36 | #define PREFIX "ACPI: " | 38 | #define PREFIX "ACPI: " |
37 | 39 | ||
38 | #define ACPI_DOCK_DRIVER_DESCRIPTION "ACPI Dock Station Driver" | 40 | #define ACPI_DOCK_DRIVER_DESCRIPTION "ACPI Dock Station Driver" |
@@ -893,9 +895,6 @@ find_dock_and_bay(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
893 | 895 | ||
894 | void __init acpi_dock_init(void) | 896 | void __init acpi_dock_init(void) |
895 | { | 897 | { |
896 | if (acpi_disabled) | ||
897 | return; | ||
898 | |||
899 | /* look for dock stations and bays */ | 898 | /* look for dock stations and bays */ |
900 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | 899 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, |
901 | ACPI_UINT32_MAX, find_dock_and_bay, NULL, NULL, NULL); | 900 | ACPI_UINT32_MAX, find_dock_and_bay, NULL, NULL, NULL); |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index ff40120e930e..959d41acc108 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -90,10 +90,6 @@ static unsigned int ec_storm_threshold __read_mostly = 8; | |||
90 | module_param(ec_storm_threshold, uint, 0644); | 90 | module_param(ec_storm_threshold, uint, 0644); |
91 | MODULE_PARM_DESC(ec_storm_threshold, "Maxim false GPE numbers not considered as GPE storm"); | 91 | MODULE_PARM_DESC(ec_storm_threshold, "Maxim false GPE numbers not considered as GPE storm"); |
92 | 92 | ||
93 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ | ||
94 | /* External interfaces use first EC only, so remember */ | ||
95 | typedef int (*acpi_ec_query_func) (void *data); | ||
96 | |||
97 | struct acpi_ec_query_handler { | 93 | struct acpi_ec_query_handler { |
98 | struct list_head node; | 94 | struct list_head node; |
99 | acpi_ec_query_func func; | 95 | acpi_ec_query_func func; |
@@ -386,27 +382,6 @@ static int acpi_ec_write(struct acpi_ec *ec, u8 address, u8 data) | |||
386 | return acpi_ec_transaction(ec, &t); | 382 | return acpi_ec_transaction(ec, &t); |
387 | } | 383 | } |
388 | 384 | ||
389 | /* | ||
390 | * Externally callable EC access functions. For now, assume 1 EC only | ||
391 | */ | ||
392 | int ec_burst_enable(void) | ||
393 | { | ||
394 | if (!first_ec) | ||
395 | return -ENODEV; | ||
396 | return acpi_ec_burst_enable(first_ec); | ||
397 | } | ||
398 | |||
399 | EXPORT_SYMBOL(ec_burst_enable); | ||
400 | |||
401 | int ec_burst_disable(void) | ||
402 | { | ||
403 | if (!first_ec) | ||
404 | return -ENODEV; | ||
405 | return acpi_ec_burst_disable(first_ec); | ||
406 | } | ||
407 | |||
408 | EXPORT_SYMBOL(ec_burst_disable); | ||
409 | |||
410 | int ec_read(u8 addr, u8 *val) | 385 | int ec_read(u8 addr, u8 *val) |
411 | { | 386 | { |
412 | int err; | 387 | int err; |
@@ -778,9 +753,9 @@ static int ec_install_handlers(struct acpi_ec *ec) | |||
778 | pr_err("Fail in evaluating the _REG object" | 753 | pr_err("Fail in evaluating the _REG object" |
779 | " of EC device. Broken bios is suspected.\n"); | 754 | " of EC device. Broken bios is suspected.\n"); |
780 | } else { | 755 | } else { |
756 | acpi_disable_gpe(NULL, ec->gpe); | ||
781 | acpi_remove_gpe_handler(NULL, ec->gpe, | 757 | acpi_remove_gpe_handler(NULL, ec->gpe, |
782 | &acpi_ec_gpe_handler); | 758 | &acpi_ec_gpe_handler); |
783 | acpi_disable_gpe(NULL, ec->gpe); | ||
784 | return -ENODEV; | 759 | return -ENODEV; |
785 | } | 760 | } |
786 | } | 761 | } |
diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c index 4e7b798900f2..b4c216bab22b 100644 --- a/drivers/acpi/ec_sys.c +++ b/drivers/acpi/ec_sys.c | |||
@@ -105,7 +105,7 @@ static const struct file_operations acpi_ec_io_ops = { | |||
105 | .llseek = default_llseek, | 105 | .llseek = default_llseek, |
106 | }; | 106 | }; |
107 | 107 | ||
108 | int acpi_ec_add_debugfs(struct acpi_ec *ec, unsigned int ec_device_count) | 108 | static int acpi_ec_add_debugfs(struct acpi_ec *ec, unsigned int ec_device_count) |
109 | { | 109 | { |
110 | struct dentry *dev_dir; | 110 | struct dentry *dev_dir; |
111 | char name[64]; | 111 | char name[64]; |
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 3375129bb5b7..dedbb2d802f1 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
@@ -131,12 +131,21 @@ struct acpi_ec { | |||
131 | 131 | ||
132 | extern struct acpi_ec *first_ec; | 132 | extern struct acpi_ec *first_ec; |
133 | 133 | ||
134 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ | ||
135 | /* External interfaces use first EC only, so remember */ | ||
136 | typedef int (*acpi_ec_query_func) (void *data); | ||
137 | |||
134 | int acpi_ec_init(void); | 138 | int acpi_ec_init(void); |
135 | int acpi_ec_ecdt_probe(void); | 139 | int acpi_ec_ecdt_probe(void); |
136 | int acpi_boot_ec_enable(void); | 140 | int acpi_boot_ec_enable(void); |
137 | void acpi_ec_block_transactions(void); | 141 | void acpi_ec_block_transactions(void); |
138 | void acpi_ec_unblock_transactions(void); | 142 | void acpi_ec_unblock_transactions(void); |
139 | void acpi_ec_unblock_transactions_early(void); | 143 | void acpi_ec_unblock_transactions_early(void); |
144 | int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit, | ||
145 | acpi_handle handle, acpi_ec_query_func func, | ||
146 | void *data); | ||
147 | void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit); | ||
148 | |||
140 | 149 | ||
141 | /*-------------------------------------------------------------------------- | 150 | /*-------------------------------------------------------------------------- |
142 | Suspend/Resume | 151 | Suspend/Resume |
diff --git a/drivers/acpi/nvs.c b/drivers/acpi/nvs.c index 266bc58ce0ce..de4fe03873c5 100644 --- a/drivers/acpi/nvs.c +++ b/drivers/acpi/nvs.c | |||
@@ -12,8 +12,8 @@ | |||
12 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
14 | #include <linux/acpi.h> | 14 | #include <linux/acpi.h> |
15 | #include <linux/acpi_io.h> | 15 | |
16 | #include <acpi/acpiosxf.h> | 16 | #include "internal.h" |
17 | 17 | ||
18 | /* ACPI NVS regions, APEI may use it */ | 18 | /* ACPI NVS regions, APEI may use it */ |
19 | 19 | ||
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 7e2d8140c334..fc1aa7909690 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <linux/workqueue.h> | 39 | #include <linux/workqueue.h> |
40 | #include <linux/nmi.h> | 40 | #include <linux/nmi.h> |
41 | #include <linux/acpi.h> | 41 | #include <linux/acpi.h> |
42 | #include <linux/acpi_io.h> | ||
43 | #include <linux/efi.h> | 42 | #include <linux/efi.h> |
44 | #include <linux/ioport.h> | 43 | #include <linux/ioport.h> |
45 | #include <linux/list.h> | 44 | #include <linux/list.h> |
@@ -541,7 +540,7 @@ static u64 acpi_tables_addr; | |||
541 | static int all_tables_size; | 540 | static int all_tables_size; |
542 | 541 | ||
543 | /* Copied from acpica/tbutils.c:acpi_tb_checksum() */ | 542 | /* Copied from acpica/tbutils.c:acpi_tb_checksum() */ |
544 | u8 __init acpi_table_checksum(u8 *buffer, u32 length) | 543 | static u8 __init acpi_table_checksum(u8 *buffer, u32 length) |
545 | { | 544 | { |
546 | u8 sum = 0; | 545 | u8 sum = 0; |
547 | u8 *end = buffer + length; | 546 | u8 *end = buffer + length; |
@@ -1283,7 +1282,7 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) | |||
1283 | jiffies = MAX_SCHEDULE_TIMEOUT; | 1282 | jiffies = MAX_SCHEDULE_TIMEOUT; |
1284 | else | 1283 | else |
1285 | jiffies = msecs_to_jiffies(timeout); | 1284 | jiffies = msecs_to_jiffies(timeout); |
1286 | 1285 | ||
1287 | ret = down_timeout(sem, jiffies); | 1286 | ret = down_timeout(sem, jiffies); |
1288 | if (ret) | 1287 | if (ret) |
1289 | status = AE_TIME; | 1288 | status = AE_TIME; |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index ea6b8d16dcc8..9418c7a1f786 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -41,6 +41,8 @@ | |||
41 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
42 | #include <linux/acpi.h> | 42 | #include <linux/acpi.h> |
43 | 43 | ||
44 | #include "internal.h" | ||
45 | |||
44 | #define PREFIX "ACPI: " | 46 | #define PREFIX "ACPI: " |
45 | 47 | ||
46 | #define _COMPONENT ACPI_PCI_COMPONENT | 48 | #define _COMPONENT ACPI_PCI_COMPONENT |
diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c index d678a180ca2a..139d9e479370 100644 --- a/drivers/acpi/pci_slot.c +++ b/drivers/acpi/pci_slot.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/pci.h> | 35 | #include <linux/pci.h> |
36 | #include <linux/acpi.h> | 36 | #include <linux/acpi.h> |
37 | #include <linux/dmi.h> | 37 | #include <linux/dmi.h> |
38 | #include <linux/pci-acpi.h> | ||
38 | 39 | ||
39 | static bool debug; | 40 | static bool debug; |
40 | static int check_sta_before_sun; | 41 | static int check_sta_before_sun; |
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c index db061bfd95a8..50fe34ffe932 100644 --- a/drivers/acpi/proc.c +++ b/drivers/acpi/proc.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <asm/uaccess.h> | 7 | #include <asm/uaccess.h> |
8 | 8 | ||
9 | #include "sleep.h" | 9 | #include "sleep.h" |
10 | #include "internal.h" | ||
10 | 11 | ||
11 | #define _COMPONENT ACPI_SYSTEM_COMPONENT | 12 | #define _COMPONENT ACPI_SYSTEM_COMPONENT |
12 | 13 | ||
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index 146ab7e2b81d..c1c35623550f 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c | |||
@@ -224,9 +224,9 @@ static int __acpi_processor_start(struct acpi_device *device) | |||
224 | 224 | ||
225 | static int acpi_processor_start(struct device *dev) | 225 | static int acpi_processor_start(struct device *dev) |
226 | { | 226 | { |
227 | struct acpi_device *device; | 227 | struct acpi_device *device = ACPI_COMPANION(dev); |
228 | 228 | ||
229 | if (acpi_bus_get_device(ACPI_HANDLE(dev), &device)) | 229 | if (!device) |
230 | return -ENODEV; | 230 | return -ENODEV; |
231 | 231 | ||
232 | return __acpi_processor_start(device); | 232 | return __acpi_processor_start(device); |
@@ -234,10 +234,10 @@ static int acpi_processor_start(struct device *dev) | |||
234 | 234 | ||
235 | static int acpi_processor_stop(struct device *dev) | 235 | static int acpi_processor_stop(struct device *dev) |
236 | { | 236 | { |
237 | struct acpi_device *device; | 237 | struct acpi_device *device = ACPI_COMPANION(dev); |
238 | struct acpi_processor *pr; | 238 | struct acpi_processor *pr; |
239 | 239 | ||
240 | if (acpi_bus_get_device(ACPI_HANDLE(dev), &device)) | 240 | if (!device) |
241 | return 0; | 241 | return 0; |
242 | 242 | ||
243 | acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, | 243 | acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index d2d44e0190a3..1fc455b8ce17 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -211,7 +211,7 @@ static int acpi_processor_suspend(void) | |||
211 | 211 | ||
212 | static void acpi_processor_resume(void) | 212 | static void acpi_processor_resume(void) |
213 | { | 213 | { |
214 | u32 resumed_bm_rld; | 214 | u32 resumed_bm_rld = 0; |
215 | 215 | ||
216 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld); | 216 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld); |
217 | if (resumed_bm_rld == saved_bm_rld) | 217 | if (resumed_bm_rld == saved_bm_rld) |
@@ -596,7 +596,7 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) | |||
596 | case ACPI_STATE_C2: | 596 | case ACPI_STATE_C2: |
597 | if (!cx->address) | 597 | if (!cx->address) |
598 | break; | 598 | break; |
599 | cx->valid = 1; | 599 | cx->valid = 1; |
600 | break; | 600 | break; |
601 | 601 | ||
602 | case ACPI_STATE_C3: | 602 | case ACPI_STATE_C3: |
@@ -783,6 +783,13 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
783 | if (unlikely(!pr)) | 783 | if (unlikely(!pr)) |
784 | return -EINVAL; | 784 | return -EINVAL; |
785 | 785 | ||
786 | #ifdef CONFIG_HOTPLUG_CPU | ||
787 | if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && | ||
788 | !pr->flags.has_cst && | ||
789 | !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) | ||
790 | return acpi_idle_enter_c1(dev, drv, CPUIDLE_DRIVER_STATE_START); | ||
791 | #endif | ||
792 | |||
786 | if (cx->entry_method == ACPI_CSTATE_FFH) { | 793 | if (cx->entry_method == ACPI_CSTATE_FFH) { |
787 | if (current_set_polling_and_test()) | 794 | if (current_set_polling_and_test()) |
788 | return -EINVAL; | 795 | return -EINVAL; |
@@ -829,6 +836,13 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
829 | if (unlikely(!pr)) | 836 | if (unlikely(!pr)) |
830 | return -EINVAL; | 837 | return -EINVAL; |
831 | 838 | ||
839 | #ifdef CONFIG_HOTPLUG_CPU | ||
840 | if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && | ||
841 | !pr->flags.has_cst && | ||
842 | !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) | ||
843 | return acpi_idle_enter_c1(dev, drv, CPUIDLE_DRIVER_STATE_START); | ||
844 | #endif | ||
845 | |||
832 | if (!cx->bm_sts_skip && acpi_idle_bm_check()) { | 846 | if (!cx->bm_sts_skip && acpi_idle_bm_check()) { |
833 | if (drv->safe_state_index >= 0) { | 847 | if (drv->safe_state_index >= 0) { |
834 | return drv->states[drv->safe_state_index].enter(dev, | 848 | return drv->states[drv->safe_state_index].enter(dev, |
@@ -930,12 +944,6 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr, | |||
930 | if (!cx->valid) | 944 | if (!cx->valid) |
931 | continue; | 945 | continue; |
932 | 946 | ||
933 | #ifdef CONFIG_HOTPLUG_CPU | ||
934 | if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && | ||
935 | !pr->flags.has_cst && | ||
936 | !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) | ||
937 | continue; | ||
938 | #endif | ||
939 | per_cpu(acpi_cstate[count], dev->cpu) = cx; | 947 | per_cpu(acpi_cstate[count], dev->cpu) = cx; |
940 | 948 | ||
941 | count++; | 949 | count++; |
@@ -943,8 +951,6 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr, | |||
943 | break; | 951 | break; |
944 | } | 952 | } |
945 | 953 | ||
946 | dev->state_count = count; | ||
947 | |||
948 | if (!count) | 954 | if (!count) |
949 | return -EINVAL; | 955 | return -EINVAL; |
950 | 956 | ||
@@ -985,13 +991,6 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr) | |||
985 | if (!cx->valid) | 991 | if (!cx->valid) |
986 | continue; | 992 | continue; |
987 | 993 | ||
988 | #ifdef CONFIG_HOTPLUG_CPU | ||
989 | if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && | ||
990 | !pr->flags.has_cst && | ||
991 | !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) | ||
992 | continue; | ||
993 | #endif | ||
994 | |||
995 | state = &drv->states[count]; | 994 | state = &drv->states[count]; |
996 | snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i); | 995 | snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i); |
997 | strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN); | 996 | strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN); |
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index f95e7584d6e6..e003663b2f8e 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c | |||
@@ -183,14 +183,14 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) | |||
183 | 183 | ||
184 | #endif | 184 | #endif |
185 | 185 | ||
186 | /* thermal coolign device callbacks */ | 186 | /* thermal cooling device callbacks */ |
187 | static int acpi_processor_max_state(struct acpi_processor *pr) | 187 | static int acpi_processor_max_state(struct acpi_processor *pr) |
188 | { | 188 | { |
189 | int max_state = 0; | 189 | int max_state = 0; |
190 | 190 | ||
191 | /* | 191 | /* |
192 | * There exists four states according to | 192 | * There exists four states according to |
193 | * cpufreq_thermal_reduction_ptg. 0, 1, 2, 3 | 193 | * cpufreq_thermal_reduction_pctg. 0, 1, 2, 3 |
194 | */ | 194 | */ |
195 | max_state += cpufreq_get_max_state(pr->id); | 195 | max_state += cpufreq_get_max_state(pr->id); |
196 | if (pr->flags.throttling) | 196 | if (pr->flags.throttling) |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index ea9cc373ffd8..b718806657cd 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -521,7 +521,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
521 | * generate wakeup events. | 521 | * generate wakeup events. |
522 | */ | 522 | */ |
523 | if (ACPI_SUCCESS(status) && (acpi_state == ACPI_STATE_S3)) { | 523 | if (ACPI_SUCCESS(status) && (acpi_state == ACPI_STATE_S3)) { |
524 | acpi_event_status pwr_btn_status; | 524 | acpi_event_status pwr_btn_status = ACPI_EVENT_FLAG_DISABLED; |
525 | 525 | ||
526 | acpi_get_event_status(ACPI_EVENT_POWER_BUTTON, &pwr_btn_status); | 526 | acpi_get_event_status(ACPI_EVENT_POWER_BUTTON, &pwr_btn_status); |
527 | 527 | ||
@@ -666,11 +666,8 @@ static void acpi_hibernation_leave(void) | |||
666 | /* Reprogram control registers */ | 666 | /* Reprogram control registers */ |
667 | acpi_leave_sleep_state_prep(ACPI_STATE_S4); | 667 | acpi_leave_sleep_state_prep(ACPI_STATE_S4); |
668 | /* Check the hardware signature */ | 668 | /* Check the hardware signature */ |
669 | if (facs && s4_hardware_signature != facs->hardware_signature) { | 669 | if (facs && s4_hardware_signature != facs->hardware_signature) |
670 | printk(KERN_EMERG "ACPI: Hardware changed while hibernated, " | 670 | pr_crit("ACPI: Hardware changed while hibernated, success doubtful!\n"); |
671 | "cannot resume!\n"); | ||
672 | panic("ACPI S4 hardware signature mismatch"); | ||
673 | } | ||
674 | /* Restore the NVS memory area */ | 671 | /* Restore the NVS memory area */ |
675 | suspend_nvs_restore(); | 672 | suspend_nvs_restore(); |
676 | /* Allow EC transactions to happen. */ | 673 | /* Allow EC transactions to happen. */ |
@@ -802,9 +799,6 @@ int __init acpi_sleep_init(void) | |||
802 | char *pos = supported; | 799 | char *pos = supported; |
803 | int i; | 800 | int i; |
804 | 801 | ||
805 | if (acpi_disabled) | ||
806 | return 0; | ||
807 | |||
808 | acpi_sleep_dmi_check(); | 802 | acpi_sleep_dmi_check(); |
809 | 803 | ||
810 | sleep_states[ACPI_STATE_S0] = 1; | 804 | sleep_states[ACPI_STATE_S0] = 1; |
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index ba07d9a927ab..443dc9366052 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
@@ -309,7 +309,7 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr, | |||
309 | sprintf(table_attr->name + ACPI_NAME_SIZE, "%d", | 309 | sprintf(table_attr->name + ACPI_NAME_SIZE, "%d", |
310 | table_attr->instance); | 310 | table_attr->instance); |
311 | 311 | ||
312 | table_attr->attr.size = 0; | 312 | table_attr->attr.size = table_header->length; |
313 | table_attr->attr.read = acpi_table_show; | 313 | table_attr->attr.read = acpi_table_show; |
314 | table_attr->attr.attr.name = table_attr->name; | 314 | table_attr->attr.attr.name = table_attr->name; |
315 | table_attr->attr.attr.mode = 0400; | 315 | table_attr->attr.attr.mode = 0400; |
@@ -354,8 +354,9 @@ static int acpi_tables_sysfs_init(void) | |||
354 | { | 354 | { |
355 | struct acpi_table_attr *table_attr; | 355 | struct acpi_table_attr *table_attr; |
356 | struct acpi_table_header *table_header = NULL; | 356 | struct acpi_table_header *table_header = NULL; |
357 | int table_index = 0; | 357 | int table_index; |
358 | int result; | 358 | acpi_status status; |
359 | int ret; | ||
359 | 360 | ||
360 | tables_kobj = kobject_create_and_add("tables", acpi_kobj); | 361 | tables_kobj = kobject_create_and_add("tables", acpi_kobj); |
361 | if (!tables_kobj) | 362 | if (!tables_kobj) |
@@ -365,33 +366,34 @@ static int acpi_tables_sysfs_init(void) | |||
365 | if (!dynamic_tables_kobj) | 366 | if (!dynamic_tables_kobj) |
366 | goto err_dynamic_tables; | 367 | goto err_dynamic_tables; |
367 | 368 | ||
368 | do { | 369 | for (table_index = 0;; table_index++) { |
369 | result = acpi_get_table_by_index(table_index, &table_header); | 370 | status = acpi_get_table_by_index(table_index, &table_header); |
370 | if (!result) { | 371 | |
371 | table_index++; | 372 | if (status == AE_BAD_PARAMETER) |
372 | table_attr = NULL; | 373 | break; |
373 | table_attr = | 374 | |
374 | kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL); | 375 | if (ACPI_FAILURE(status)) |
375 | if (!table_attr) | 376 | continue; |
376 | return -ENOMEM; | 377 | |
377 | 378 | table_attr = NULL; | |
378 | acpi_table_attr_init(table_attr, table_header); | 379 | table_attr = kzalloc(sizeof(*table_attr), GFP_KERNEL); |
379 | result = | 380 | if (!table_attr) |
380 | sysfs_create_bin_file(tables_kobj, | 381 | return -ENOMEM; |
381 | &table_attr->attr); | 382 | |
382 | if (result) { | 383 | acpi_table_attr_init(table_attr, table_header); |
383 | kfree(table_attr); | 384 | ret = sysfs_create_bin_file(tables_kobj, &table_attr->attr); |
384 | return result; | 385 | if (ret) { |
385 | } else | 386 | kfree(table_attr); |
386 | list_add_tail(&table_attr->node, | 387 | return ret; |
387 | &acpi_table_attr_list); | ||
388 | } | 388 | } |
389 | } while (!result); | 389 | list_add_tail(&table_attr->node, &acpi_table_attr_list); |
390 | } | ||
391 | |||
390 | kobject_uevent(tables_kobj, KOBJ_ADD); | 392 | kobject_uevent(tables_kobj, KOBJ_ADD); |
391 | kobject_uevent(dynamic_tables_kobj, KOBJ_ADD); | 393 | kobject_uevent(dynamic_tables_kobj, KOBJ_ADD); |
392 | result = acpi_install_table_handler(acpi_sysfs_table_handler, NULL); | 394 | status = acpi_install_table_handler(acpi_sysfs_table_handler, NULL); |
393 | 395 | ||
394 | return result == AE_OK ? 0 : -EINVAL; | 396 | return ACPI_FAILURE(status) ? -EINVAL : 0; |
395 | err_dynamic_tables: | 397 | err_dynamic_tables: |
396 | kobject_put(tables_kobj); | 398 | kobject_put(tables_kobj); |
397 | err: | 399 | err: |
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index d67a1fe07f0e..5837f857ac2e 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
@@ -278,12 +278,13 @@ acpi_table_parse_madt(enum acpi_madt_type id, | |||
278 | 278 | ||
279 | /** | 279 | /** |
280 | * acpi_table_parse - find table with @id, run @handler on it | 280 | * acpi_table_parse - find table with @id, run @handler on it |
281 | * | ||
282 | * @id: table id to find | 281 | * @id: table id to find |
283 | * @handler: handler to run | 282 | * @handler: handler to run |
284 | * | 283 | * |
285 | * Scan the ACPI System Descriptor Table (STD) for a table matching @id, | 284 | * Scan the ACPI System Descriptor Table (STD) for a table matching @id, |
286 | * run @handler on it. Return 0 if table found, return on if not. | 285 | * run @handler on it. |
286 | * | ||
287 | * Return 0 if table found, -errno if not. | ||
287 | */ | 288 | */ |
288 | int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler) | 289 | int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler) |
289 | { | 290 | { |
@@ -293,7 +294,7 @@ int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler) | |||
293 | if (acpi_disabled) | 294 | if (acpi_disabled) |
294 | return -ENODEV; | 295 | return -ENODEV; |
295 | 296 | ||
296 | if (!handler) | 297 | if (!id || !handler) |
297 | return -EINVAL; | 298 | return -EINVAL; |
298 | 299 | ||
299 | if (strncmp(id, ACPI_SIG_MADT, 4) == 0) | 300 | if (strncmp(id, ACPI_SIG_MADT, 4) == 0) |
@@ -306,7 +307,7 @@ int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler) | |||
306 | early_acpi_os_unmap_memory(table, tbl_size); | 307 | early_acpi_os_unmap_memory(table, tbl_size); |
307 | return 0; | 308 | return 0; |
308 | } else | 309 | } else |
309 | return 1; | 310 | return -ENODEV; |
310 | } | 311 | } |
311 | 312 | ||
312 | /* | 313 | /* |
@@ -351,7 +352,7 @@ int __init acpi_table_init(void) | |||
351 | 352 | ||
352 | status = acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); | 353 | status = acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); |
353 | if (ACPI_FAILURE(status)) | 354 | if (ACPI_FAILURE(status)) |
354 | return 1; | 355 | return -EINVAL; |
355 | 356 | ||
356 | check_multiple_madt(); | 357 | check_multiple_madt(); |
357 | return 0; | 358 | return 0; |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 1fd21ad69c98..8349a555b92b 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -861,7 +861,7 @@ acpi_thermal_unbind_cooling_device(struct thermal_zone_device *thermal, | |||
861 | return acpi_thermal_cooling_device_cb(thermal, cdev, false); | 861 | return acpi_thermal_cooling_device_cb(thermal, cdev, false); |
862 | } | 862 | } |
863 | 863 | ||
864 | static const struct thermal_zone_device_ops acpi_thermal_zone_ops = { | 864 | static struct thermal_zone_device_ops acpi_thermal_zone_ops = { |
865 | .bind = acpi_thermal_bind_cooling_device, | 865 | .bind = acpi_thermal_bind_cooling_device, |
866 | .unbind = acpi_thermal_unbind_cooling_device, | 866 | .unbind = acpi_thermal_unbind_cooling_device, |
867 | .get_temp = thermal_get_temp, | 867 | .get_temp = thermal_get_temp, |
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 1336b9151479..0347a37eb438 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -572,3 +572,100 @@ acpi_status acpi_evaluate_lck(acpi_handle handle, int lock) | |||
572 | 572 | ||
573 | return status; | 573 | return status; |
574 | } | 574 | } |
575 | |||
576 | /** | ||
577 | * acpi_evaluate_dsm - evaluate device's _DSM method | ||
578 | * @handle: ACPI device handle | ||
579 | * @uuid: UUID of requested functions, should be 16 bytes | ||
580 | * @rev: revision number of requested function | ||
581 | * @func: requested function number | ||
582 | * @argv4: the function specific parameter | ||
583 | * | ||
584 | * Evaluate device's _DSM method with specified UUID, revision id and | ||
585 | * function number. Caller needs to free the returned object. | ||
586 | * | ||
587 | * Though ACPI defines the fourth parameter for _DSM should be a package, | ||
588 | * some old BIOSes do expect a buffer or an integer etc. | ||
589 | */ | ||
590 | union acpi_object * | ||
591 | acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid, int rev, int func, | ||
592 | union acpi_object *argv4) | ||
593 | { | ||
594 | acpi_status ret; | ||
595 | struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER, NULL}; | ||
596 | union acpi_object params[4]; | ||
597 | struct acpi_object_list input = { | ||
598 | .count = 4, | ||
599 | .pointer = params, | ||
600 | }; | ||
601 | |||
602 | params[0].type = ACPI_TYPE_BUFFER; | ||
603 | params[0].buffer.length = 16; | ||
604 | params[0].buffer.pointer = (char *)uuid; | ||
605 | params[1].type = ACPI_TYPE_INTEGER; | ||
606 | params[1].integer.value = rev; | ||
607 | params[2].type = ACPI_TYPE_INTEGER; | ||
608 | params[2].integer.value = func; | ||
609 | if (argv4) { | ||
610 | params[3] = *argv4; | ||
611 | } else { | ||
612 | params[3].type = ACPI_TYPE_PACKAGE; | ||
613 | params[3].package.count = 0; | ||
614 | params[3].package.elements = NULL; | ||
615 | } | ||
616 | |||
617 | ret = acpi_evaluate_object(handle, "_DSM", &input, &buf); | ||
618 | if (ACPI_SUCCESS(ret)) | ||
619 | return (union acpi_object *)buf.pointer; | ||
620 | |||
621 | if (ret != AE_NOT_FOUND) | ||
622 | acpi_handle_warn(handle, | ||
623 | "failed to evaluate _DSM (0x%x)\n", ret); | ||
624 | |||
625 | return NULL; | ||
626 | } | ||
627 | EXPORT_SYMBOL(acpi_evaluate_dsm); | ||
628 | |||
629 | /** | ||
630 | * acpi_check_dsm - check if _DSM method supports requested functions. | ||
631 | * @handle: ACPI device handle | ||
632 | * @uuid: UUID of requested functions, should be 16 bytes at least | ||
633 | * @rev: revision number of requested functions | ||
634 | * @funcs: bitmap of requested functions | ||
635 | * @exclude: excluding special value, used to support i915 and nouveau | ||
636 | * | ||
637 | * Evaluate device's _DSM method to check whether it supports requested | ||
638 | * functions. Currently only support 64 functions at maximum, should be | ||
639 | * enough for now. | ||
640 | */ | ||
641 | bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, int rev, u64 funcs) | ||
642 | { | ||
643 | int i; | ||
644 | u64 mask = 0; | ||
645 | union acpi_object *obj; | ||
646 | |||
647 | if (funcs == 0) | ||
648 | return false; | ||
649 | |||
650 | obj = acpi_evaluate_dsm(handle, uuid, rev, 0, NULL); | ||
651 | if (!obj) | ||
652 | return false; | ||
653 | |||
654 | /* For compatibility, old BIOSes may return an integer */ | ||
655 | if (obj->type == ACPI_TYPE_INTEGER) | ||
656 | mask = obj->integer.value; | ||
657 | else if (obj->type == ACPI_TYPE_BUFFER) | ||
658 | for (i = 0; i < obj->buffer.length && i < 8; i++) | ||
659 | mask |= (((u8)obj->buffer.pointer[i]) << (i * 8)); | ||
660 | ACPI_FREE(obj); | ||
661 | |||
662 | /* | ||
663 | * Bit 0 indicates whether there's support for any functions other than | ||
664 | * function 0 for the specified UUID and revision. | ||
665 | */ | ||
666 | if ((mask & 0x1) && (mask & funcs) == funcs) | ||
667 | return true; | ||
668 | |||
669 | return false; | ||
670 | } | ||
671 | EXPORT_SYMBOL(acpi_check_dsm); | ||
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 84875fd4c74f..f0447d3daf2c 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
@@ -50,7 +50,7 @@ static bool acpi_video_caps_checked; | |||
50 | 50 | ||
51 | static acpi_status | 51 | static acpi_status |
52 | acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context, | 52 | acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context, |
53 | void **retyurn_value) | 53 | void **return_value) |
54 | { | 54 | { |
55 | long *cap = context; | 55 | long *cap = context; |
56 | 56 | ||