diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpi_extlog.c | 14 | ||||
-rw-r--r-- | drivers/acpi/acpica/Makefile | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/acapps.h | 9 | ||||
-rw-r--r-- | drivers/acpi/acpica/acdebug.h | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/acglobal.h | 8 | ||||
-rw-r--r-- | drivers/acpi/acpica/acutils.h | 39 | ||||
-rw-r--r-- | drivers/acpi/acpica/evgpe.c | 32 | ||||
-rw-r--r-- | drivers/acpi/acpica/evxfgpe.c | 61 | ||||
-rw-r--r-- | drivers/acpi/acpica/exfield.c | 4 | ||||
-rw-r--r-- | drivers/acpi/acpica/hwregs.c | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsobject.c | 10 | ||||
-rw-r--r-- | drivers/acpi/acpica/utbuffer.c | 128 | ||||
-rw-r--r-- | drivers/acpi/acpica/utcopy.c | 6 | ||||
-rw-r--r-- | drivers/acpi/acpica/utdebug.c | 26 | ||||
-rw-r--r-- | drivers/acpi/acpica/utfileio.c | 332 | ||||
-rw-r--r-- | drivers/acpi/acpica/utglobal.c | 146 | ||||
-rw-r--r-- | drivers/acpi/acpica/utinit.c | 145 | ||||
-rw-r--r-- | drivers/acpi/acpica/utprint.c | 661 | ||||
-rw-r--r-- | drivers/acpi/apei/apei-internal.h | 10 | ||||
-rw-r--r-- | drivers/acpi/apei/ghes.c | 32 | ||||
-rw-r--r-- | drivers/acpi/video.c | 10 |
21 files changed, 1475 insertions, 206 deletions
diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c index 185334114d71..340d09518f8e 100644 --- a/drivers/acpi/acpi_extlog.c +++ b/drivers/acpi/acpi_extlog.c | |||
@@ -69,11 +69,11 @@ static u32 l1_percpu_entry; | |||
69 | #define ELOG_ENTRY_ADDR(phyaddr) \ | 69 | #define ELOG_ENTRY_ADDR(phyaddr) \ |
70 | (phyaddr - elog_base + (u8 *)elog_addr) | 70 | (phyaddr - elog_base + (u8 *)elog_addr) |
71 | 71 | ||
72 | static struct acpi_generic_status *extlog_elog_entry_check(int cpu, int bank) | 72 | static struct acpi_hest_generic_status *extlog_elog_entry_check(int cpu, int bank) |
73 | { | 73 | { |
74 | int idx; | 74 | int idx; |
75 | u64 data; | 75 | u64 data; |
76 | struct acpi_generic_status *estatus; | 76 | struct acpi_hest_generic_status *estatus; |
77 | 77 | ||
78 | WARN_ON(cpu < 0); | 78 | WARN_ON(cpu < 0); |
79 | idx = ELOG_IDX(cpu, bank); | 79 | idx = ELOG_IDX(cpu, bank); |
@@ -82,7 +82,7 @@ static struct acpi_generic_status *extlog_elog_entry_check(int cpu, int bank) | |||
82 | return NULL; | 82 | return NULL; |
83 | 83 | ||
84 | data &= EXT_ELOG_ENTRY_MASK; | 84 | data &= EXT_ELOG_ENTRY_MASK; |
85 | estatus = (struct acpi_generic_status *)ELOG_ENTRY_ADDR(data); | 85 | estatus = (struct acpi_hest_generic_status *)ELOG_ENTRY_ADDR(data); |
86 | 86 | ||
87 | /* if no valid data in elog entry, just return */ | 87 | /* if no valid data in elog entry, just return */ |
88 | if (estatus->block_status == 0) | 88 | if (estatus->block_status == 0) |
@@ -92,7 +92,7 @@ static struct acpi_generic_status *extlog_elog_entry_check(int cpu, int bank) | |||
92 | } | 92 | } |
93 | 93 | ||
94 | static void __print_extlog_rcd(const char *pfx, | 94 | static void __print_extlog_rcd(const char *pfx, |
95 | struct acpi_generic_status *estatus, int cpu) | 95 | struct acpi_hest_generic_status *estatus, int cpu) |
96 | { | 96 | { |
97 | static atomic_t seqno; | 97 | static atomic_t seqno; |
98 | unsigned int curr_seqno; | 98 | unsigned int curr_seqno; |
@@ -111,7 +111,7 @@ static void __print_extlog_rcd(const char *pfx, | |||
111 | } | 111 | } |
112 | 112 | ||
113 | static int print_extlog_rcd(const char *pfx, | 113 | static int print_extlog_rcd(const char *pfx, |
114 | struct acpi_generic_status *estatus, int cpu) | 114 | struct acpi_hest_generic_status *estatus, int cpu) |
115 | { | 115 | { |
116 | /* Not more than 2 messages every 5 seconds */ | 116 | /* Not more than 2 messages every 5 seconds */ |
117 | static DEFINE_RATELIMIT_STATE(ratelimit_corrected, 5*HZ, 2); | 117 | static DEFINE_RATELIMIT_STATE(ratelimit_corrected, 5*HZ, 2); |
@@ -137,7 +137,7 @@ static int extlog_print(struct notifier_block *nb, unsigned long val, | |||
137 | struct mce *mce = (struct mce *)data; | 137 | struct mce *mce = (struct mce *)data; |
138 | int bank = mce->bank; | 138 | int bank = mce->bank; |
139 | int cpu = mce->extcpu; | 139 | int cpu = mce->extcpu; |
140 | struct acpi_generic_status *estatus; | 140 | struct acpi_hest_generic_status *estatus; |
141 | int rc; | 141 | int rc; |
142 | 142 | ||
143 | estatus = extlog_elog_entry_check(cpu, bank); | 143 | estatus = extlog_elog_entry_check(cpu, bank); |
@@ -148,7 +148,7 @@ static int extlog_print(struct notifier_block *nb, unsigned long val, | |||
148 | /* clear record status to enable BIOS to update it again */ | 148 | /* clear record status to enable BIOS to update it again */ |
149 | estatus->block_status = 0; | 149 | estatus->block_status = 0; |
150 | 150 | ||
151 | rc = print_extlog_rcd(NULL, (struct acpi_generic_status *)elog_buf, cpu); | 151 | rc = print_extlog_rcd(NULL, (struct acpi_hest_generic_status *)elog_buf, cpu); |
152 | 152 | ||
153 | return NOTIFY_STOP; | 153 | return NOTIFY_STOP; |
154 | } | 154 | } |
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index 87a24ac21363..4be4cc94572d 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
@@ -175,5 +175,5 @@ acpi-y += \ | |||
175 | utxferror.o \ | 175 | utxferror.o \ |
176 | utxfmutex.o | 176 | utxfmutex.o |
177 | 177 | ||
178 | acpi-$(ACPI_FUTURE_USAGE) += uttrack.o utcache.o | 178 | acpi-$(ACPI_FUTURE_USAGE) += utfileio.o utprint.o uttrack.o utcache.o |
179 | 179 | ||
diff --git a/drivers/acpi/acpica/acapps.h b/drivers/acpi/acpica/acapps.h index 8698ffba6f39..3d2c88289da9 100644 --- a/drivers/acpi/acpica/acapps.h +++ b/drivers/acpi/acpica/acapps.h | |||
@@ -79,10 +79,13 @@ | |||
79 | /* Macros for usage messages */ | 79 | /* Macros for usage messages */ |
80 | 80 | ||
81 | #define ACPI_USAGE_HEADER(usage) \ | 81 | #define ACPI_USAGE_HEADER(usage) \ |
82 | printf ("Usage: %s\nOptions:\n", usage); | 82 | acpi_os_printf ("Usage: %s\nOptions:\n", usage); |
83 | |||
84 | #define ACPI_USAGE_TEXT(description) \ | ||
85 | acpi_os_printf (description); | ||
83 | 86 | ||
84 | #define ACPI_OPTION(name, description) \ | 87 | #define ACPI_OPTION(name, description) \ |
85 | printf (" %-18s%s\n", name, description); | 88 | acpi_os_printf (" %-18s%s\n", name, description); |
86 | 89 | ||
87 | #define FILE_SUFFIX_DISASSEMBLY "dsl" | 90 | #define FILE_SUFFIX_DISASSEMBLY "dsl" |
88 | #define ACPI_TABLE_FILE_SUFFIX ".dat" | 91 | #define ACPI_TABLE_FILE_SUFFIX ".dat" |
@@ -102,7 +105,7 @@ extern char *acpi_gbl_optarg; | |||
102 | /* | 105 | /* |
103 | * cmfsize - Common get file size function | 106 | * cmfsize - Common get file size function |
104 | */ | 107 | */ |
105 | u32 cm_get_file_size(FILE * file); | 108 | u32 cm_get_file_size(ACPI_FILE file); |
106 | 109 | ||
107 | #ifndef ACPI_DUMP_APP | 110 | #ifndef ACPI_DUMP_APP |
108 | /* | 111 | /* |
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h index 68a91eb0fa48..1d026ff1683f 100644 --- a/drivers/acpi/acpica/acdebug.h +++ b/drivers/acpi/acpica/acdebug.h | |||
@@ -233,9 +233,6 @@ acpi_status acpi_db_load_acpi_table(char *filename); | |||
233 | acpi_status | 233 | acpi_status |
234 | acpi_db_get_table_from_file(char *filename, struct acpi_table_header **table); | 234 | acpi_db_get_table_from_file(char *filename, struct acpi_table_header **table); |
235 | 235 | ||
236 | acpi_status | ||
237 | acpi_db_read_table_from_file(char *filename, struct acpi_table_header **table); | ||
238 | |||
239 | /* | 236 | /* |
240 | * dbhistry - debugger HISTORY command | 237 | * dbhistry - debugger HISTORY command |
241 | */ | 238 | */ |
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 115eedcade1e..ebf02cc10a43 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -297,7 +297,7 @@ ACPI_GLOBAL(u32, acpi_gbl_trace_dbg_layer); | |||
297 | * | 297 | * |
298 | ****************************************************************************/ | 298 | ****************************************************************************/ |
299 | 299 | ||
300 | ACPI_GLOBAL(u8, acpi_gbl_db_output_flags); | 300 | ACPI_INIT_GLOBAL(u8, acpi_gbl_db_output_flags, ACPI_DB_CONSOLE_OUTPUT); |
301 | 301 | ||
302 | #ifdef ACPI_DISASSEMBLER | 302 | #ifdef ACPI_DISASSEMBLER |
303 | 303 | ||
@@ -362,6 +362,12 @@ ACPI_GLOBAL(u32, acpi_gbl_num_objects); | |||
362 | #ifdef ACPI_APPLICATION | 362 | #ifdef ACPI_APPLICATION |
363 | 363 | ||
364 | ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_debug_file, NULL); | 364 | ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_debug_file, NULL); |
365 | ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_output_file, NULL); | ||
366 | |||
367 | /* Print buffer */ | ||
368 | |||
369 | ACPI_GLOBAL(acpi_spinlock, acpi_gbl_print_lock); /* For print buffer */ | ||
370 | ACPI_GLOBAL(char, acpi_gbl_print_buffer[1024]); | ||
365 | 371 | ||
366 | #endif /* ACPI_APPLICATION */ | 372 | #endif /* ACPI_APPLICATION */ |
367 | 373 | ||
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index 1e256c5bda20..ed614f4b2182 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h | |||
@@ -95,7 +95,6 @@ extern const char *acpi_gbl_pt_decode[]; | |||
95 | #ifdef ACPI_ASL_COMPILER | 95 | #ifdef ACPI_ASL_COMPILER |
96 | 96 | ||
97 | #include <stdio.h> | 97 | #include <stdio.h> |
98 | extern FILE *acpi_gbl_output_file; | ||
99 | 98 | ||
100 | #define ACPI_MSG_REDIRECT_BEGIN \ | 99 | #define ACPI_MSG_REDIRECT_BEGIN \ |
101 | FILE *output_file = acpi_gbl_output_file; \ | 100 | FILE *output_file = acpi_gbl_output_file; \ |
@@ -211,6 +210,8 @@ void acpi_ut_subsystem_shutdown(void); | |||
211 | 210 | ||
212 | acpi_size acpi_ut_strlen(const char *string); | 211 | acpi_size acpi_ut_strlen(const char *string); |
213 | 212 | ||
213 | char *acpi_ut_strchr(const char *string, int ch); | ||
214 | |||
214 | char *acpi_ut_strcpy(char *dst_string, const char *src_string); | 215 | char *acpi_ut_strcpy(char *dst_string, const char *src_string); |
215 | 216 | ||
216 | char *acpi_ut_strncpy(char *dst_string, | 217 | char *acpi_ut_strncpy(char *dst_string, |
@@ -257,7 +258,7 @@ extern const u8 _acpi_ctype[]; | |||
257 | #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) | 258 | #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) |
258 | #define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP)) | 259 | #define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP)) |
259 | #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) | 260 | #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) |
260 | #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU)) | 261 | #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU)) |
261 | #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) | 262 | #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) |
262 | 263 | ||
263 | #endif /* !ACPI_USE_SYSTEM_CLIBRARY */ | 264 | #endif /* !ACPI_USE_SYSTEM_CLIBRARY */ |
@@ -352,6 +353,13 @@ acpi_ut_debug_dump_buffer(u8 *buffer, u32 count, u32 display, u32 component_id); | |||
352 | 353 | ||
353 | void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 offset); | 354 | void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 offset); |
354 | 355 | ||
356 | #ifdef ACPI_APPLICATION | ||
357 | void | ||
358 | acpi_ut_dump_buffer_to_file(ACPI_FILE file, | ||
359 | u8 *buffer, | ||
360 | u32 count, u32 display, u32 base_offset); | ||
361 | #endif | ||
362 | |||
355 | void acpi_ut_report_error(char *module_name, u32 line_number); | 363 | void acpi_ut_report_error(char *module_name, u32 line_number); |
356 | 364 | ||
357 | void acpi_ut_report_info(char *module_name, u32 line_number); | 365 | void acpi_ut_report_info(char *module_name, u32 line_number); |
@@ -394,6 +402,14 @@ acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node, | |||
394 | u8 method_count, u8 *out_values); | 402 | u8 method_count, u8 *out_values); |
395 | 403 | ||
396 | /* | 404 | /* |
405 | * utfileio - file operations | ||
406 | */ | ||
407 | #ifdef ACPI_APPLICATION | ||
408 | acpi_status | ||
409 | acpi_ut_read_table_from_file(char *filename, struct acpi_table_header **table); | ||
410 | #endif | ||
411 | |||
412 | /* | ||
397 | * utids - device ID support | 413 | * utids - device ID support |
398 | */ | 414 | */ |
399 | acpi_status | 415 | acpi_status |
@@ -743,4 +759,23 @@ const struct ah_predefined_name *acpi_ah_match_predefined_name(char *nameseg); | |||
743 | 759 | ||
744 | const struct ah_device_id *acpi_ah_match_hardware_id(char *hid); | 760 | const struct ah_device_id *acpi_ah_match_hardware_id(char *hid); |
745 | 761 | ||
762 | /* | ||
763 | * utprint - printf/vprintf output functions | ||
764 | */ | ||
765 | const char *acpi_ut_scan_number(const char *string, u64 *number_ptr); | ||
766 | |||
767 | const char *acpi_ut_print_number(char *string, u64 number); | ||
768 | |||
769 | int | ||
770 | acpi_ut_vsnprintf(char *string, | ||
771 | acpi_size size, const char *format, va_list args); | ||
772 | |||
773 | int acpi_ut_snprintf(char *string, acpi_size size, const char *format, ...); | ||
774 | |||
775 | #ifdef ACPI_APPLICATION | ||
776 | int acpi_ut_file_vprintf(ACPI_FILE file, const char *format, va_list args); | ||
777 | |||
778 | int acpi_ut_file_printf(ACPI_FILE file, const char *format, ...); | ||
779 | #endif | ||
780 | |||
746 | #endif /* _ACUTILS_H */ | 781 | #endif /* _ACUTILS_H */ |
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index 48f70013b488..e4ba4dec86af 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
@@ -698,21 +698,6 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, | |||
698 | } | 698 | } |
699 | 699 | ||
700 | /* | 700 | /* |
701 | * If edge-triggered, clear the GPE status bit now. Note that | ||
702 | * level-triggered events are cleared after the GPE is serviced. | ||
703 | */ | ||
704 | if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == | ||
705 | ACPI_GPE_EDGE_TRIGGERED) { | ||
706 | status = acpi_hw_clear_gpe(gpe_event_info); | ||
707 | if (ACPI_FAILURE(status)) { | ||
708 | ACPI_EXCEPTION((AE_INFO, status, | ||
709 | "Unable to clear GPE %02X", | ||
710 | gpe_number)); | ||
711 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); | ||
712 | } | ||
713 | } | ||
714 | |||
715 | /* | ||
716 | * Always disable the GPE so that it does not keep firing before | 701 | * Always disable the GPE so that it does not keep firing before |
717 | * any asynchronous activity completes (either from the execution | 702 | * any asynchronous activity completes (either from the execution |
718 | * of a GPE method or an asynchronous GPE handler.) | 703 | * of a GPE method or an asynchronous GPE handler.) |
@@ -729,6 +714,23 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, | |||
729 | } | 714 | } |
730 | 715 | ||
731 | /* | 716 | /* |
717 | * If edge-triggered, clear the GPE status bit now. Note that | ||
718 | * level-triggered events are cleared after the GPE is serviced. | ||
719 | */ | ||
720 | if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == | ||
721 | ACPI_GPE_EDGE_TRIGGERED) { | ||
722 | status = acpi_hw_clear_gpe(gpe_event_info); | ||
723 | if (ACPI_FAILURE(status)) { | ||
724 | ACPI_EXCEPTION((AE_INFO, status, | ||
725 | "Unable to clear GPE %02X", | ||
726 | gpe_number)); | ||
727 | (void)acpi_hw_low_set_gpe(gpe_event_info, | ||
728 | ACPI_GPE_CONDITIONAL_ENABLE); | ||
729 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); | ||
730 | } | ||
731 | } | ||
732 | |||
733 | /* | ||
732 | * Dispatch the GPE to either an installed handler or the control | 734 | * Dispatch the GPE to either an installed handler or the control |
733 | * method associated with this GPE (_Lxx or _Exx). If a handler | 735 | * method associated with this GPE (_Lxx or _Exx). If a handler |
734 | * exists, we invoke it and do not attempt to run the method. | 736 | * exists, we invoke it and do not attempt to run the method. |
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c index cb534faf5369..0cf159cc6e6d 100644 --- a/drivers/acpi/acpica/evxfgpe.c +++ b/drivers/acpi/acpica/evxfgpe.c | |||
@@ -126,11 +126,19 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number) | |||
126 | 126 | ||
127 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 127 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
128 | 128 | ||
129 | /* Ensure that we have a valid GPE number */ | 129 | /* |
130 | 130 | * Ensure that we have a valid GPE number and that there is some way | |
131 | * of handling the GPE (handler or a GPE method). In other words, we | ||
132 | * won't allow a valid GPE to be enabled if there is no way to handle it. | ||
133 | */ | ||
131 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); | 134 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
132 | if (gpe_event_info) { | 135 | if (gpe_event_info) { |
133 | status = acpi_ev_add_gpe_reference(gpe_event_info); | 136 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) != |
137 | ACPI_GPE_DISPATCH_NONE) { | ||
138 | status = acpi_ev_add_gpe_reference(gpe_event_info); | ||
139 | } else { | ||
140 | status = AE_NO_HANDLER; | ||
141 | } | ||
134 | } | 142 | } |
135 | 143 | ||
136 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 144 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
@@ -179,6 +187,53 @@ ACPI_EXPORT_SYMBOL(acpi_disable_gpe) | |||
179 | 187 | ||
180 | /******************************************************************************* | 188 | /******************************************************************************* |
181 | * | 189 | * |
190 | * FUNCTION: acpi_mark_gpe_for_wake | ||
191 | * | ||
192 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 | ||
193 | * gpe_number - GPE level within the GPE block | ||
194 | * | ||
195 | * RETURN: Status | ||
196 | * | ||
197 | * DESCRIPTION: Mark a GPE as having the ability to wake the system. Simply | ||
198 | * sets the ACPI_GPE_CAN_WAKE flag. | ||
199 | * | ||
200 | * Some potential callers of acpi_setup_gpe_for_wake may know in advance that | ||
201 | * there won't be any notify handlers installed for device wake notifications | ||
202 | * from the given GPE (one example is a button GPE in Linux). For these cases, | ||
203 | * acpi_mark_gpe_for_wake should be used instead of acpi_setup_gpe_for_wake. | ||
204 | * This will set the ACPI_GPE_CAN_WAKE flag for the GPE without trying to | ||
205 | * setup implicit wake notification for it (since there's no handler method). | ||
206 | * | ||
207 | ******************************************************************************/ | ||
208 | acpi_status acpi_mark_gpe_for_wake(acpi_handle gpe_device, u32 gpe_number) | ||
209 | { | ||
210 | struct acpi_gpe_event_info *gpe_event_info; | ||
211 | acpi_status status = AE_BAD_PARAMETER; | ||
212 | acpi_cpu_flags flags; | ||
213 | |||
214 | ACPI_FUNCTION_TRACE(acpi_mark_gpe_for_wake); | ||
215 | |||
216 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | ||
217 | |||
218 | /* Ensure that we have a valid GPE number */ | ||
219 | |||
220 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); | ||
221 | if (gpe_event_info) { | ||
222 | |||
223 | /* Mark the GPE as a possible wake event */ | ||
224 | |||
225 | gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; | ||
226 | status = AE_OK; | ||
227 | } | ||
228 | |||
229 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
230 | return_ACPI_STATUS(status); | ||
231 | } | ||
232 | |||
233 | ACPI_EXPORT_SYMBOL(acpi_mark_gpe_for_wake) | ||
234 | |||
235 | /******************************************************************************* | ||
236 | * | ||
182 | * FUNCTION: acpi_setup_gpe_for_wake | 237 | * FUNCTION: acpi_setup_gpe_for_wake |
183 | * | 238 | * |
184 | * PARAMETERS: wake_device - Device associated with the GPE (via _PRW) | 239 | * PARAMETERS: wake_device - Device associated with the GPE (via _PRW) |
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c index 12878e1982f7..1ff42c07b42b 100644 --- a/drivers/acpi/acpica/exfield.c +++ b/drivers/acpi/acpica/exfield.c | |||
@@ -56,7 +56,7 @@ acpi_ex_get_serial_access_length(u32 accessor_type, u32 access_length); | |||
56 | 56 | ||
57 | /******************************************************************************* | 57 | /******************************************************************************* |
58 | * | 58 | * |
59 | * FUNCTION: acpi_get_serial_access_bytes | 59 | * FUNCTION: acpi_ex_get_serial_access_length |
60 | * | 60 | * |
61 | * PARAMETERS: accessor_type - The type of the protocol indicated by region | 61 | * PARAMETERS: accessor_type - The type of the protocol indicated by region |
62 | * field access attributes | 62 | * field access attributes |
@@ -103,7 +103,7 @@ acpi_ex_get_serial_access_length(u32 accessor_type, u32 access_length) | |||
103 | case AML_FIELD_ATTRIB_BLOCK_CALL: | 103 | case AML_FIELD_ATTRIB_BLOCK_CALL: |
104 | default: | 104 | default: |
105 | 105 | ||
106 | length = ACPI_GSBUS_BUFFER_SIZE; | 106 | length = ACPI_GSBUS_BUFFER_SIZE - 2; |
107 | break; | 107 | break; |
108 | } | 108 | } |
109 | 109 | ||
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c index e0fd9b4978cd..a4c34d2c556b 100644 --- a/drivers/acpi/acpica/hwregs.c +++ b/drivers/acpi/acpica/hwregs.c | |||
@@ -278,8 +278,9 @@ acpi_status acpi_hw_clear_acpi_status(void) | |||
278 | 278 | ||
279 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); | 279 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
280 | 280 | ||
281 | if (ACPI_FAILURE(status)) | 281 | if (ACPI_FAILURE(status)) { |
282 | goto exit; | 282 | goto exit; |
283 | } | ||
283 | 284 | ||
284 | /* Clear the GPE Bits in all GPE registers in all GPE blocks */ | 285 | /* Clear the GPE Bits in all GPE registers in all GPE blocks */ |
285 | 286 | ||
diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c index fe54a8c73b8c..a42ee9d6970d 100644 --- a/drivers/acpi/acpica/nsobject.c +++ b/drivers/acpi/acpica/nsobject.c | |||
@@ -237,6 +237,16 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node) | |||
237 | (node->object->common.type != ACPI_TYPE_LOCAL_DATA)) { | 237 | (node->object->common.type != ACPI_TYPE_LOCAL_DATA)) { |
238 | node->object = node->object->common.next_object; | 238 | node->object = node->object->common.next_object; |
239 | } | 239 | } |
240 | |||
241 | /* | ||
242 | * Detach the object from any data objects (which are still held by | ||
243 | * the namespace node) | ||
244 | */ | ||
245 | if (obj_desc->common.next_object && | ||
246 | ((obj_desc->common.next_object)->common.type == | ||
247 | ACPI_TYPE_LOCAL_DATA)) { | ||
248 | obj_desc->common.next_object = NULL; | ||
249 | } | ||
240 | } | 250 | } |
241 | 251 | ||
242 | /* Reset the node type to untyped */ | 252 | /* Reset the node type to untyped */ |
diff --git a/drivers/acpi/acpica/utbuffer.c b/drivers/acpi/acpica/utbuffer.c index 3c1699740653..038ea887f562 100644 --- a/drivers/acpi/acpica/utbuffer.c +++ b/drivers/acpi/acpica/utbuffer.c | |||
@@ -199,3 +199,131 @@ acpi_ut_debug_dump_buffer(u8 *buffer, u32 count, u32 display, u32 component_id) | |||
199 | 199 | ||
200 | acpi_ut_dump_buffer(buffer, count, display, 0); | 200 | acpi_ut_dump_buffer(buffer, count, display, 0); |
201 | } | 201 | } |
202 | |||
203 | #ifdef ACPI_APPLICATION | ||
204 | /******************************************************************************* | ||
205 | * | ||
206 | * FUNCTION: acpi_ut_dump_buffer_to_file | ||
207 | * | ||
208 | * PARAMETERS: file - File descriptor | ||
209 | * buffer - Buffer to dump | ||
210 | * count - Amount to dump, in bytes | ||
211 | * display - BYTE, WORD, DWORD, or QWORD display: | ||
212 | * DB_BYTE_DISPLAY | ||
213 | * DB_WORD_DISPLAY | ||
214 | * DB_DWORD_DISPLAY | ||
215 | * DB_QWORD_DISPLAY | ||
216 | * base_offset - Beginning buffer offset (display only) | ||
217 | * | ||
218 | * RETURN: None | ||
219 | * | ||
220 | * DESCRIPTION: Generic dump buffer in both hex and ascii to a file. | ||
221 | * | ||
222 | ******************************************************************************/ | ||
223 | |||
224 | void | ||
225 | acpi_ut_dump_buffer_to_file(ACPI_FILE file, | ||
226 | u8 *buffer, u32 count, u32 display, u32 base_offset) | ||
227 | { | ||
228 | u32 i = 0; | ||
229 | u32 j; | ||
230 | u32 temp32; | ||
231 | u8 buf_char; | ||
232 | |||
233 | if (!buffer) { | ||
234 | acpi_ut_file_printf(file, | ||
235 | "Null Buffer Pointer in DumpBuffer!\n"); | ||
236 | return; | ||
237 | } | ||
238 | |||
239 | if ((count < 4) || (count & 0x01)) { | ||
240 | display = DB_BYTE_DISPLAY; | ||
241 | } | ||
242 | |||
243 | /* Nasty little dump buffer routine! */ | ||
244 | |||
245 | while (i < count) { | ||
246 | |||
247 | /* Print current offset */ | ||
248 | |||
249 | acpi_ut_file_printf(file, "%6.4X: ", (base_offset + i)); | ||
250 | |||
251 | /* Print 16 hex chars */ | ||
252 | |||
253 | for (j = 0; j < 16;) { | ||
254 | if (i + j >= count) { | ||
255 | |||
256 | /* Dump fill spaces */ | ||
257 | |||
258 | acpi_ut_file_printf(file, "%*s", | ||
259 | ((display * 2) + 1), " "); | ||
260 | j += display; | ||
261 | continue; | ||
262 | } | ||
263 | |||
264 | switch (display) { | ||
265 | case DB_BYTE_DISPLAY: | ||
266 | default: /* Default is BYTE display */ | ||
267 | |||
268 | acpi_ut_file_printf(file, "%02X ", | ||
269 | buffer[(acpi_size) i + j]); | ||
270 | break; | ||
271 | |||
272 | case DB_WORD_DISPLAY: | ||
273 | |||
274 | ACPI_MOVE_16_TO_32(&temp32, | ||
275 | &buffer[(acpi_size) i + j]); | ||
276 | acpi_ut_file_printf(file, "%04X ", temp32); | ||
277 | break; | ||
278 | |||
279 | case DB_DWORD_DISPLAY: | ||
280 | |||
281 | ACPI_MOVE_32_TO_32(&temp32, | ||
282 | &buffer[(acpi_size) i + j]); | ||
283 | acpi_ut_file_printf(file, "%08X ", temp32); | ||
284 | break; | ||
285 | |||
286 | case DB_QWORD_DISPLAY: | ||
287 | |||
288 | ACPI_MOVE_32_TO_32(&temp32, | ||
289 | &buffer[(acpi_size) i + j]); | ||
290 | acpi_ut_file_printf(file, "%08X", temp32); | ||
291 | |||
292 | ACPI_MOVE_32_TO_32(&temp32, | ||
293 | &buffer[(acpi_size) i + j + | ||
294 | 4]); | ||
295 | acpi_ut_file_printf(file, "%08X ", temp32); | ||
296 | break; | ||
297 | } | ||
298 | |||
299 | j += display; | ||
300 | } | ||
301 | |||
302 | /* | ||
303 | * Print the ASCII equivalent characters but watch out for the bad | ||
304 | * unprintable ones (printable chars are 0x20 through 0x7E) | ||
305 | */ | ||
306 | acpi_ut_file_printf(file, " "); | ||
307 | for (j = 0; j < 16; j++) { | ||
308 | if (i + j >= count) { | ||
309 | acpi_ut_file_printf(file, "\n"); | ||
310 | return; | ||
311 | } | ||
312 | |||
313 | buf_char = buffer[(acpi_size) i + j]; | ||
314 | if (ACPI_IS_PRINT(buf_char)) { | ||
315 | acpi_ut_file_printf(file, "%c", buf_char); | ||
316 | } else { | ||
317 | acpi_ut_file_printf(file, "."); | ||
318 | } | ||
319 | } | ||
320 | |||
321 | /* Done with that line. */ | ||
322 | |||
323 | acpi_ut_file_printf(file, "\n"); | ||
324 | i += 16; | ||
325 | } | ||
326 | |||
327 | return; | ||
328 | } | ||
329 | #endif | ||
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c index 270c16464dd9..ff601c0f7c7a 100644 --- a/drivers/acpi/acpica/utcopy.c +++ b/drivers/acpi/acpica/utcopy.c | |||
@@ -1001,5 +1001,11 @@ acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc, | |||
1001 | status = acpi_ut_copy_simple_object(source_desc, *dest_desc); | 1001 | status = acpi_ut_copy_simple_object(source_desc, *dest_desc); |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | /* Delete the allocated object if copy failed */ | ||
1005 | |||
1006 | if (ACPI_FAILURE(status)) { | ||
1007 | acpi_ut_remove_reference(*dest_desc); | ||
1008 | } | ||
1009 | |||
1004 | return_ACPI_STATUS(status); | 1010 | return_ACPI_STATUS(status); |
1005 | } | 1011 | } |
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c index 21a20ac5b1e1..e516254c63b2 100644 --- a/drivers/acpi/acpica/utdebug.c +++ b/drivers/acpi/acpica/utdebug.c | |||
@@ -561,3 +561,29 @@ acpi_ut_ptr_exit(u32 line_number, | |||
561 | } | 561 | } |
562 | 562 | ||
563 | #endif | 563 | #endif |
564 | |||
565 | #ifdef ACPI_APPLICATION | ||
566 | /******************************************************************************* | ||
567 | * | ||
568 | * FUNCTION: acpi_log_error | ||
569 | * | ||
570 | * PARAMETERS: format - Printf format field | ||
571 | * ... - Optional printf arguments | ||
572 | * | ||
573 | * RETURN: None | ||
574 | * | ||
575 | * DESCRIPTION: Print error message to the console, used by applications. | ||
576 | * | ||
577 | ******************************************************************************/ | ||
578 | |||
579 | void ACPI_INTERNAL_VAR_XFACE acpi_log_error(const char *format, ...) | ||
580 | { | ||
581 | va_list args; | ||
582 | |||
583 | va_start(args, format); | ||
584 | (void)acpi_ut_file_vprintf(ACPI_FILE_ERR, format, args); | ||
585 | va_end(args); | ||
586 | } | ||
587 | |||
588 | ACPI_EXPORT_SYMBOL(acpi_log_error) | ||
589 | #endif | ||
diff --git a/drivers/acpi/acpica/utfileio.c b/drivers/acpi/acpica/utfileio.c new file mode 100644 index 000000000000..bdf9914733cb --- /dev/null +++ b/drivers/acpi/acpica/utfileio.c | |||
@@ -0,0 +1,332 @@ | |||
1 | /******************************************************************************* | ||
2 | * | ||
3 | * Module Name: utfileio - simple file I/O routines | ||
4 | * | ||
5 | ******************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2014, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | #include "actables.h" | ||
47 | #include "acapps.h" | ||
48 | |||
49 | #ifdef ACPI_ASL_COMPILER | ||
50 | #include "aslcompiler.h" | ||
51 | #endif | ||
52 | |||
53 | #define _COMPONENT ACPI_CA_DEBUGGER | ||
54 | ACPI_MODULE_NAME("utfileio") | ||
55 | |||
56 | #ifdef ACPI_APPLICATION | ||
57 | /* Local prototypes */ | ||
58 | static acpi_status | ||
59 | acpi_ut_check_text_mode_corruption(u8 *table, | ||
60 | u32 table_length, u32 file_length); | ||
61 | |||
62 | static acpi_status | ||
63 | acpi_ut_read_table(FILE * fp, | ||
64 | struct acpi_table_header **table, u32 *table_length); | ||
65 | |||
66 | /******************************************************************************* | ||
67 | * | ||
68 | * FUNCTION: acpi_ut_check_text_mode_corruption | ||
69 | * | ||
70 | * PARAMETERS: table - Table buffer | ||
71 | * table_length - Length of table from the table header | ||
72 | * file_length - Length of the file that contains the table | ||
73 | * | ||
74 | * RETURN: Status | ||
75 | * | ||
76 | * DESCRIPTION: Check table for text mode file corruption where all linefeed | ||
77 | * characters (LF) have been replaced by carriage return linefeed | ||
78 | * pairs (CR/LF). | ||
79 | * | ||
80 | ******************************************************************************/ | ||
81 | |||
82 | static acpi_status | ||
83 | acpi_ut_check_text_mode_corruption(u8 *table, u32 table_length, u32 file_length) | ||
84 | { | ||
85 | u32 i; | ||
86 | u32 pairs = 0; | ||
87 | |||
88 | if (table_length != file_length) { | ||
89 | ACPI_WARNING((AE_INFO, | ||
90 | "File length (0x%X) is not the same as the table length (0x%X)", | ||
91 | file_length, table_length)); | ||
92 | } | ||
93 | |||
94 | /* Scan entire table to determine if each LF has been prefixed with a CR */ | ||
95 | |||
96 | for (i = 1; i < file_length; i++) { | ||
97 | if (table[i] == 0x0A) { | ||
98 | if (table[i - 1] != 0x0D) { | ||
99 | |||
100 | /* The LF does not have a preceding CR, table not corrupted */ | ||
101 | |||
102 | return (AE_OK); | ||
103 | } else { | ||
104 | /* Found a CR/LF pair */ | ||
105 | |||
106 | pairs++; | ||
107 | } | ||
108 | i++; | ||
109 | } | ||
110 | } | ||
111 | |||
112 | if (!pairs) { | ||
113 | return (AE_OK); | ||
114 | } | ||
115 | |||
116 | /* | ||
117 | * Entire table scanned, each CR is part of a CR/LF pair -- | ||
118 | * meaning that the table was treated as a text file somewhere. | ||
119 | * | ||
120 | * NOTE: We can't "fix" the table, because any existing CR/LF pairs in the | ||
121 | * original table are left untouched by the text conversion process -- | ||
122 | * meaning that we cannot simply replace CR/LF pairs with LFs. | ||
123 | */ | ||
124 | acpi_os_printf("Table has been corrupted by text mode conversion\n"); | ||
125 | acpi_os_printf("All LFs (%u) were changed to CR/LF pairs\n", pairs); | ||
126 | acpi_os_printf("Table cannot be repaired!\n"); | ||
127 | return (AE_BAD_VALUE); | ||
128 | } | ||
129 | |||
130 | /******************************************************************************* | ||
131 | * | ||
132 | * FUNCTION: acpi_ut_read_table | ||
133 | * | ||
134 | * PARAMETERS: fp - File that contains table | ||
135 | * table - Return value, buffer with table | ||
136 | * table_length - Return value, length of table | ||
137 | * | ||
138 | * RETURN: Status | ||
139 | * | ||
140 | * DESCRIPTION: Load the DSDT from the file pointer | ||
141 | * | ||
142 | ******************************************************************************/ | ||
143 | |||
144 | static acpi_status | ||
145 | acpi_ut_read_table(FILE * fp, | ||
146 | struct acpi_table_header **table, u32 *table_length) | ||
147 | { | ||
148 | struct acpi_table_header table_header; | ||
149 | u32 actual; | ||
150 | acpi_status status; | ||
151 | u32 file_size; | ||
152 | u8 standard_header = TRUE; | ||
153 | s32 count; | ||
154 | |||
155 | /* Get the file size */ | ||
156 | |||
157 | file_size = cm_get_file_size(fp); | ||
158 | if (file_size == ACPI_UINT32_MAX) { | ||
159 | return (AE_ERROR); | ||
160 | } | ||
161 | |||
162 | if (file_size < 4) { | ||
163 | return (AE_BAD_HEADER); | ||
164 | } | ||
165 | |||
166 | /* Read the signature */ | ||
167 | |||
168 | fseek(fp, 0, SEEK_SET); | ||
169 | |||
170 | count = fread(&table_header, 1, sizeof(struct acpi_table_header), fp); | ||
171 | if (count != sizeof(struct acpi_table_header)) { | ||
172 | acpi_os_printf("Could not read the table header\n"); | ||
173 | return (AE_BAD_HEADER); | ||
174 | } | ||
175 | |||
176 | /* The RSDP table does not have standard ACPI header */ | ||
177 | |||
178 | if (ACPI_VALIDATE_RSDP_SIG(table_header.signature)) { | ||
179 | *table_length = file_size; | ||
180 | standard_header = FALSE; | ||
181 | } else { | ||
182 | |||
183 | #if 0 | ||
184 | /* Validate the table header/length */ | ||
185 | |||
186 | status = acpi_tb_validate_table_header(&table_header); | ||
187 | if (ACPI_FAILURE(status)) { | ||
188 | acpi_os_printf("Table header is invalid!\n"); | ||
189 | return (status); | ||
190 | } | ||
191 | #endif | ||
192 | |||
193 | /* File size must be at least as long as the Header-specified length */ | ||
194 | |||
195 | if (table_header.length > file_size) { | ||
196 | acpi_os_printf | ||
197 | ("TableHeader length [0x%X] greater than the input file size [0x%X]\n", | ||
198 | table_header.length, file_size); | ||
199 | |||
200 | #ifdef ACPI_ASL_COMPILER | ||
201 | status = fl_check_for_ascii(fp, NULL, FALSE); | ||
202 | if (ACPI_SUCCESS(status)) { | ||
203 | acpi_os_printf | ||
204 | ("File appears to be ASCII only, must be binary\n", | ||
205 | table_header.length, file_size); | ||
206 | } | ||
207 | #endif | ||
208 | return (AE_BAD_HEADER); | ||
209 | } | ||
210 | #ifdef ACPI_OBSOLETE_CODE | ||
211 | /* We only support a limited number of table types */ | ||
212 | |||
213 | if (!ACPI_COMPARE_NAME | ||
214 | ((char *)table_header.signature, ACPI_SIG_DSDT) | ||
215 | && !ACPI_COMPARE_NAME((char *)table_header.signature, | ||
216 | ACPI_SIG_PSDT) | ||
217 | && !ACPI_COMPARE_NAME((char *)table_header.signature, | ||
218 | ACPI_SIG_SSDT)) { | ||
219 | acpi_os_printf | ||
220 | ("Table signature [%4.4s] is invalid or not supported\n", | ||
221 | (char *)table_header.signature); | ||
222 | ACPI_DUMP_BUFFER(&table_header, | ||
223 | sizeof(struct acpi_table_header)); | ||
224 | return (AE_ERROR); | ||
225 | } | ||
226 | #endif | ||
227 | |||
228 | *table_length = table_header.length; | ||
229 | } | ||
230 | |||
231 | /* Allocate a buffer for the table */ | ||
232 | |||
233 | *table = acpi_os_allocate((size_t) file_size); | ||
234 | if (!*table) { | ||
235 | acpi_os_printf | ||
236 | ("Could not allocate memory for ACPI table %4.4s (size=0x%X)\n", | ||
237 | table_header.signature, *table_length); | ||
238 | return (AE_NO_MEMORY); | ||
239 | } | ||
240 | |||
241 | /* Get the rest of the table */ | ||
242 | |||
243 | fseek(fp, 0, SEEK_SET); | ||
244 | actual = fread(*table, 1, (size_t) file_size, fp); | ||
245 | if (actual == file_size) { | ||
246 | if (standard_header) { | ||
247 | |||
248 | /* Now validate the checksum */ | ||
249 | |||
250 | status = acpi_tb_verify_checksum((void *)*table, | ||
251 | ACPI_CAST_PTR(struct | ||
252 | acpi_table_header, | ||
253 | *table)-> | ||
254 | length); | ||
255 | |||
256 | if (status == AE_BAD_CHECKSUM) { | ||
257 | status = | ||
258 | acpi_ut_check_text_mode_corruption((u8 *) | ||
259 | *table, | ||
260 | file_size, | ||
261 | (*table)-> | ||
262 | length); | ||
263 | return (status); | ||
264 | } | ||
265 | } | ||
266 | return (AE_OK); | ||
267 | } | ||
268 | |||
269 | if (actual > 0) { | ||
270 | acpi_os_printf("Warning - reading table, asked for %X got %X\n", | ||
271 | file_size, actual); | ||
272 | return (AE_OK); | ||
273 | } | ||
274 | |||
275 | acpi_os_printf("Error - could not read the table file\n"); | ||
276 | acpi_os_free(*table); | ||
277 | *table = NULL; | ||
278 | *table_length = 0; | ||
279 | return (AE_ERROR); | ||
280 | } | ||
281 | |||
282 | /******************************************************************************* | ||
283 | * | ||
284 | * FUNCTION: acpi_ut_read_table_from_file | ||
285 | * | ||
286 | * PARAMETERS: filename - File where table is located | ||
287 | * table - Where a pointer to the table is returned | ||
288 | * | ||
289 | * RETURN: Status | ||
290 | * | ||
291 | * DESCRIPTION: Get an ACPI table from a file | ||
292 | * | ||
293 | ******************************************************************************/ | ||
294 | |||
295 | acpi_status | ||
296 | acpi_ut_read_table_from_file(char *filename, struct acpi_table_header ** table) | ||
297 | { | ||
298 | FILE *file; | ||
299 | u32 file_size; | ||
300 | u32 table_length; | ||
301 | acpi_status status = AE_ERROR; | ||
302 | |||
303 | /* Open the file, get current size */ | ||
304 | |||
305 | file = fopen(filename, "rb"); | ||
306 | if (!file) { | ||
307 | perror("Could not open input file"); | ||
308 | return (status); | ||
309 | } | ||
310 | |||
311 | file_size = cm_get_file_size(file); | ||
312 | if (file_size == ACPI_UINT32_MAX) { | ||
313 | goto exit; | ||
314 | } | ||
315 | |||
316 | /* Get the entire file */ | ||
317 | |||
318 | fprintf(stderr, | ||
319 | "Loading Acpi table from file %10s - Length %.8u (%06X)\n", | ||
320 | filename, file_size, file_size); | ||
321 | |||
322 | status = acpi_ut_read_table(file, table, &table_length); | ||
323 | if (ACPI_FAILURE(status)) { | ||
324 | acpi_os_printf("Could not get table from the file\n"); | ||
325 | } | ||
326 | |||
327 | exit: | ||
328 | fclose(file); | ||
329 | return (status); | ||
330 | } | ||
331 | |||
332 | #endif | ||
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index d69be3cb3fae..77ceac715f28 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c | |||
@@ -214,152 +214,6 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = | |||
214 | }; | 214 | }; |
215 | #endif /* !ACPI_REDUCED_HARDWARE */ | 215 | #endif /* !ACPI_REDUCED_HARDWARE */ |
216 | 216 | ||
217 | /******************************************************************************* | ||
218 | * | ||
219 | * FUNCTION: acpi_ut_init_globals | ||
220 | * | ||
221 | * PARAMETERS: None | ||
222 | * | ||
223 | * RETURN: Status | ||
224 | * | ||
225 | * DESCRIPTION: Initialize ACPICA globals. All globals that require specific | ||
226 | * initialization should be initialized here. This allows for | ||
227 | * a warm restart. | ||
228 | * | ||
229 | ******************************************************************************/ | ||
230 | |||
231 | acpi_status acpi_ut_init_globals(void) | ||
232 | { | ||
233 | acpi_status status; | ||
234 | u32 i; | ||
235 | |||
236 | ACPI_FUNCTION_TRACE(ut_init_globals); | ||
237 | |||
238 | /* Create all memory caches */ | ||
239 | |||
240 | status = acpi_ut_create_caches(); | ||
241 | if (ACPI_FAILURE(status)) { | ||
242 | return_ACPI_STATUS(status); | ||
243 | } | ||
244 | |||
245 | /* Address Range lists */ | ||
246 | |||
247 | for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) { | ||
248 | acpi_gbl_address_range_list[i] = NULL; | ||
249 | } | ||
250 | |||
251 | /* Mutex locked flags */ | ||
252 | |||
253 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { | ||
254 | acpi_gbl_mutex_info[i].mutex = NULL; | ||
255 | acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; | ||
256 | acpi_gbl_mutex_info[i].use_count = 0; | ||
257 | } | ||
258 | |||
259 | for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) { | ||
260 | acpi_gbl_owner_id_mask[i] = 0; | ||
261 | } | ||
262 | |||
263 | /* Last owner_ID is never valid */ | ||
264 | |||
265 | acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; | ||
266 | |||
267 | /* Event counters */ | ||
268 | |||
269 | acpi_method_count = 0; | ||
270 | acpi_sci_count = 0; | ||
271 | acpi_gpe_count = 0; | ||
272 | |||
273 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { | ||
274 | acpi_fixed_event_count[i] = 0; | ||
275 | } | ||
276 | |||
277 | #if (!ACPI_REDUCED_HARDWARE) | ||
278 | |||
279 | /* GPE/SCI support */ | ||
280 | |||
281 | acpi_gbl_all_gpes_initialized = FALSE; | ||
282 | acpi_gbl_gpe_xrupt_list_head = NULL; | ||
283 | acpi_gbl_gpe_fadt_blocks[0] = NULL; | ||
284 | acpi_gbl_gpe_fadt_blocks[1] = NULL; | ||
285 | acpi_current_gpe_count = 0; | ||
286 | |||
287 | acpi_gbl_global_event_handler = NULL; | ||
288 | acpi_gbl_sci_handler_list = NULL; | ||
289 | |||
290 | #endif /* !ACPI_REDUCED_HARDWARE */ | ||
291 | |||
292 | /* Global handlers */ | ||
293 | |||
294 | acpi_gbl_global_notify[0].handler = NULL; | ||
295 | acpi_gbl_global_notify[1].handler = NULL; | ||
296 | acpi_gbl_exception_handler = NULL; | ||
297 | acpi_gbl_init_handler = NULL; | ||
298 | acpi_gbl_table_handler = NULL; | ||
299 | acpi_gbl_interface_handler = NULL; | ||
300 | |||
301 | /* Global Lock support */ | ||
302 | |||
303 | acpi_gbl_global_lock_semaphore = NULL; | ||
304 | acpi_gbl_global_lock_mutex = NULL; | ||
305 | acpi_gbl_global_lock_acquired = FALSE; | ||
306 | acpi_gbl_global_lock_handle = 0; | ||
307 | acpi_gbl_global_lock_present = FALSE; | ||
308 | |||
309 | /* Miscellaneous variables */ | ||
310 | |||
311 | acpi_gbl_DSDT = NULL; | ||
312 | acpi_gbl_cm_single_step = FALSE; | ||
313 | acpi_gbl_shutdown = FALSE; | ||
314 | acpi_gbl_ns_lookup_count = 0; | ||
315 | acpi_gbl_ps_find_count = 0; | ||
316 | acpi_gbl_acpi_hardware_present = TRUE; | ||
317 | acpi_gbl_last_owner_id_index = 0; | ||
318 | acpi_gbl_next_owner_id_offset = 0; | ||
319 | acpi_gbl_trace_dbg_level = 0; | ||
320 | acpi_gbl_trace_dbg_layer = 0; | ||
321 | acpi_gbl_debugger_configuration = DEBUGGER_THREADING; | ||
322 | acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; | ||
323 | acpi_gbl_osi_mutex = NULL; | ||
324 | acpi_gbl_reg_methods_executed = FALSE; | ||
325 | |||
326 | /* Hardware oriented */ | ||
327 | |||
328 | acpi_gbl_events_initialized = FALSE; | ||
329 | acpi_gbl_system_awake_and_running = TRUE; | ||
330 | |||
331 | /* Namespace */ | ||
332 | |||
333 | acpi_gbl_module_code_list = NULL; | ||
334 | acpi_gbl_root_node = NULL; | ||
335 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; | ||
336 | acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED; | ||
337 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; | ||
338 | acpi_gbl_root_node_struct.parent = NULL; | ||
339 | acpi_gbl_root_node_struct.child = NULL; | ||
340 | acpi_gbl_root_node_struct.peer = NULL; | ||
341 | acpi_gbl_root_node_struct.object = NULL; | ||
342 | |||
343 | #ifdef ACPI_DISASSEMBLER | ||
344 | acpi_gbl_external_list = NULL; | ||
345 | acpi_gbl_num_external_methods = 0; | ||
346 | acpi_gbl_resolved_external_methods = 0; | ||
347 | #endif | ||
348 | |||
349 | #ifdef ACPI_DEBUG_OUTPUT | ||
350 | acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX); | ||
351 | #endif | ||
352 | |||
353 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
354 | acpi_gbl_display_final_mem_stats = FALSE; | ||
355 | acpi_gbl_disable_mem_tracking = FALSE; | ||
356 | #endif | ||
357 | |||
358 | ACPI_DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = FALSE); | ||
359 | |||
360 | return_ACPI_STATUS(AE_OK); | ||
361 | } | ||
362 | |||
363 | /* Public globals */ | 217 | /* Public globals */ |
364 | 218 | ||
365 | ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) | 219 | ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) |
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c index 5f56fc49021e..77120ec9ea86 100644 --- a/drivers/acpi/acpica/utinit.c +++ b/drivers/acpi/acpica/utinit.c | |||
@@ -102,6 +102,151 @@ static void acpi_ut_free_gpe_lists(void) | |||
102 | } | 102 | } |
103 | #endif /* !ACPI_REDUCED_HARDWARE */ | 103 | #endif /* !ACPI_REDUCED_HARDWARE */ |
104 | 104 | ||
105 | /******************************************************************************* | ||
106 | * | ||
107 | * FUNCTION: acpi_ut_init_globals | ||
108 | * | ||
109 | * PARAMETERS: None | ||
110 | * | ||
111 | * RETURN: Status | ||
112 | * | ||
113 | * DESCRIPTION: Initialize ACPICA globals. All globals that require specific | ||
114 | * initialization should be initialized here. This allows for | ||
115 | * a warm restart. | ||
116 | * | ||
117 | ******************************************************************************/ | ||
118 | |||
119 | acpi_status acpi_ut_init_globals(void) | ||
120 | { | ||
121 | acpi_status status; | ||
122 | u32 i; | ||
123 | |||
124 | ACPI_FUNCTION_TRACE(ut_init_globals); | ||
125 | |||
126 | /* Create all memory caches */ | ||
127 | |||
128 | status = acpi_ut_create_caches(); | ||
129 | if (ACPI_FAILURE(status)) { | ||
130 | return_ACPI_STATUS(status); | ||
131 | } | ||
132 | |||
133 | /* Address Range lists */ | ||
134 | |||
135 | for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) { | ||
136 | acpi_gbl_address_range_list[i] = NULL; | ||
137 | } | ||
138 | |||
139 | /* Mutex locked flags */ | ||
140 | |||
141 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { | ||
142 | acpi_gbl_mutex_info[i].mutex = NULL; | ||
143 | acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; | ||
144 | acpi_gbl_mutex_info[i].use_count = 0; | ||
145 | } | ||
146 | |||
147 | for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) { | ||
148 | acpi_gbl_owner_id_mask[i] = 0; | ||
149 | } | ||
150 | |||
151 | /* Last owner_ID is never valid */ | ||
152 | |||
153 | acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; | ||
154 | |||
155 | /* Event counters */ | ||
156 | |||
157 | acpi_method_count = 0; | ||
158 | acpi_sci_count = 0; | ||
159 | acpi_gpe_count = 0; | ||
160 | |||
161 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { | ||
162 | acpi_fixed_event_count[i] = 0; | ||
163 | } | ||
164 | |||
165 | #if (!ACPI_REDUCED_HARDWARE) | ||
166 | |||
167 | /* GPE/SCI support */ | ||
168 | |||
169 | acpi_gbl_all_gpes_initialized = FALSE; | ||
170 | acpi_gbl_gpe_xrupt_list_head = NULL; | ||
171 | acpi_gbl_gpe_fadt_blocks[0] = NULL; | ||
172 | acpi_gbl_gpe_fadt_blocks[1] = NULL; | ||
173 | acpi_current_gpe_count = 0; | ||
174 | |||
175 | acpi_gbl_global_event_handler = NULL; | ||
176 | acpi_gbl_sci_handler_list = NULL; | ||
177 | |||
178 | #endif /* !ACPI_REDUCED_HARDWARE */ | ||
179 | |||
180 | /* Global handlers */ | ||
181 | |||
182 | acpi_gbl_global_notify[0].handler = NULL; | ||
183 | acpi_gbl_global_notify[1].handler = NULL; | ||
184 | acpi_gbl_exception_handler = NULL; | ||
185 | acpi_gbl_init_handler = NULL; | ||
186 | acpi_gbl_table_handler = NULL; | ||
187 | acpi_gbl_interface_handler = NULL; | ||
188 | |||
189 | /* Global Lock support */ | ||
190 | |||
191 | acpi_gbl_global_lock_semaphore = NULL; | ||
192 | acpi_gbl_global_lock_mutex = NULL; | ||
193 | acpi_gbl_global_lock_acquired = FALSE; | ||
194 | acpi_gbl_global_lock_handle = 0; | ||
195 | acpi_gbl_global_lock_present = FALSE; | ||
196 | |||
197 | /* Miscellaneous variables */ | ||
198 | |||
199 | acpi_gbl_DSDT = NULL; | ||
200 | acpi_gbl_cm_single_step = FALSE; | ||
201 | acpi_gbl_shutdown = FALSE; | ||
202 | acpi_gbl_ns_lookup_count = 0; | ||
203 | acpi_gbl_ps_find_count = 0; | ||
204 | acpi_gbl_acpi_hardware_present = TRUE; | ||
205 | acpi_gbl_last_owner_id_index = 0; | ||
206 | acpi_gbl_next_owner_id_offset = 0; | ||
207 | acpi_gbl_trace_dbg_level = 0; | ||
208 | acpi_gbl_trace_dbg_layer = 0; | ||
209 | acpi_gbl_debugger_configuration = DEBUGGER_THREADING; | ||
210 | acpi_gbl_osi_mutex = NULL; | ||
211 | acpi_gbl_reg_methods_executed = FALSE; | ||
212 | |||
213 | /* Hardware oriented */ | ||
214 | |||
215 | acpi_gbl_events_initialized = FALSE; | ||
216 | acpi_gbl_system_awake_and_running = TRUE; | ||
217 | |||
218 | /* Namespace */ | ||
219 | |||
220 | acpi_gbl_module_code_list = NULL; | ||
221 | acpi_gbl_root_node = NULL; | ||
222 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; | ||
223 | acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED; | ||
224 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; | ||
225 | acpi_gbl_root_node_struct.parent = NULL; | ||
226 | acpi_gbl_root_node_struct.child = NULL; | ||
227 | acpi_gbl_root_node_struct.peer = NULL; | ||
228 | acpi_gbl_root_node_struct.object = NULL; | ||
229 | |||
230 | #ifdef ACPI_DISASSEMBLER | ||
231 | acpi_gbl_external_list = NULL; | ||
232 | acpi_gbl_num_external_methods = 0; | ||
233 | acpi_gbl_resolved_external_methods = 0; | ||
234 | #endif | ||
235 | |||
236 | #ifdef ACPI_DEBUG_OUTPUT | ||
237 | acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX); | ||
238 | #endif | ||
239 | |||
240 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
241 | acpi_gbl_display_final_mem_stats = FALSE; | ||
242 | acpi_gbl_disable_mem_tracking = FALSE; | ||
243 | #endif | ||
244 | |||
245 | ACPI_DEBUGGER_EXEC(acpi_gbl_db_terminate_threads = FALSE); | ||
246 | |||
247 | return_ACPI_STATUS(AE_OK); | ||
248 | } | ||
249 | |||
105 | /****************************************************************************** | 250 | /****************************************************************************** |
106 | * | 251 | * |
107 | * FUNCTION: acpi_ut_terminate | 252 | * FUNCTION: acpi_ut_terminate |
diff --git a/drivers/acpi/acpica/utprint.c b/drivers/acpi/acpica/utprint.c new file mode 100644 index 000000000000..10311648f701 --- /dev/null +++ b/drivers/acpi/acpica/utprint.c | |||
@@ -0,0 +1,661 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: utprint - Formatted printing routines | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2014, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | |||
47 | #define _COMPONENT ACPI_UTILITIES | ||
48 | ACPI_MODULE_NAME("utprint") | ||
49 | |||
50 | #define ACPI_FORMAT_SIGN 0x01 | ||
51 | #define ACPI_FORMAT_SIGN_PLUS 0x02 | ||
52 | #define ACPI_FORMAT_SIGN_PLUS_SPACE 0x04 | ||
53 | #define ACPI_FORMAT_ZERO 0x08 | ||
54 | #define ACPI_FORMAT_LEFT 0x10 | ||
55 | #define ACPI_FORMAT_UPPER 0x20 | ||
56 | #define ACPI_FORMAT_PREFIX 0x40 | ||
57 | /* Local prototypes */ | ||
58 | static acpi_size | ||
59 | acpi_ut_bound_string_length(const char *string, acpi_size count); | ||
60 | |||
61 | static char *acpi_ut_bound_string_output(char *string, const char *end, char c); | ||
62 | |||
63 | static char *acpi_ut_format_number(char *string, | ||
64 | char *end, | ||
65 | u64 number, | ||
66 | u8 base, s32 width, s32 precision, u8 type); | ||
67 | |||
68 | static char *acpi_ut_put_number(char *string, u64 number, u8 base, u8 upper); | ||
69 | |||
70 | /* Module globals */ | ||
71 | |||
72 | static const char acpi_gbl_lower_hex_digits[] = "0123456789abcdef"; | ||
73 | static const char acpi_gbl_upper_hex_digits[] = "0123456789ABCDEF"; | ||
74 | |||
75 | /******************************************************************************* | ||
76 | * | ||
77 | * FUNCTION: acpi_ut_bound_string_length | ||
78 | * | ||
79 | * PARAMETERS: string - String with boundary | ||
80 | * count - Boundary of the string | ||
81 | * | ||
82 | * RETURN: Length of the string. Less than or equal to Count. | ||
83 | * | ||
84 | * DESCRIPTION: Calculate the length of a string with boundary. | ||
85 | * | ||
86 | ******************************************************************************/ | ||
87 | |||
88 | static acpi_size | ||
89 | acpi_ut_bound_string_length(const char *string, acpi_size count) | ||
90 | { | ||
91 | u32 length = 0; | ||
92 | |||
93 | while (*string && count) { | ||
94 | length++; | ||
95 | string++; | ||
96 | count--; | ||
97 | } | ||
98 | |||
99 | return (length); | ||
100 | } | ||
101 | |||
102 | /******************************************************************************* | ||
103 | * | ||
104 | * FUNCTION: acpi_ut_bound_string_output | ||
105 | * | ||
106 | * PARAMETERS: string - String with boundary | ||
107 | * end - Boundary of the string | ||
108 | * c - Character to be output to the string | ||
109 | * | ||
110 | * RETURN: Updated position for next valid character | ||
111 | * | ||
112 | * DESCRIPTION: Output a character into a string with boundary check. | ||
113 | * | ||
114 | ******************************************************************************/ | ||
115 | |||
116 | static char *acpi_ut_bound_string_output(char *string, const char *end, char c) | ||
117 | { | ||
118 | |||
119 | if (string < end) { | ||
120 | *string = c; | ||
121 | } | ||
122 | |||
123 | ++string; | ||
124 | return (string); | ||
125 | } | ||
126 | |||
127 | /******************************************************************************* | ||
128 | * | ||
129 | * FUNCTION: acpi_ut_put_number | ||
130 | * | ||
131 | * PARAMETERS: string - Buffer to hold reverse-ordered string | ||
132 | * number - Integer to be converted | ||
133 | * base - Base of the integer | ||
134 | * upper - Whether or not using upper cased digits | ||
135 | * | ||
136 | * RETURN: Updated position for next valid character | ||
137 | * | ||
138 | * DESCRIPTION: Convert an integer into a string, note that, the string holds a | ||
139 | * reversed ordered number without the trailing zero. | ||
140 | * | ||
141 | ******************************************************************************/ | ||
142 | |||
143 | static char *acpi_ut_put_number(char *string, u64 number, u8 base, u8 upper) | ||
144 | { | ||
145 | const char *digits; | ||
146 | u64 digit_index; | ||
147 | char *pos; | ||
148 | |||
149 | pos = string; | ||
150 | digits = upper ? acpi_gbl_upper_hex_digits : acpi_gbl_lower_hex_digits; | ||
151 | |||
152 | if (number == 0) { | ||
153 | *(pos++) = '0'; | ||
154 | } else { | ||
155 | while (number) { | ||
156 | (void)acpi_ut_divide(number, base, &number, | ||
157 | &digit_index); | ||
158 | *(pos++) = digits[digit_index]; | ||
159 | } | ||
160 | } | ||
161 | |||
162 | /* *(Pos++) = '0'; */ | ||
163 | return (pos); | ||
164 | } | ||
165 | |||
166 | /******************************************************************************* | ||
167 | * | ||
168 | * FUNCTION: acpi_ut_scan_number | ||
169 | * | ||
170 | * PARAMETERS: string - String buffer | ||
171 | * number_ptr - Where the number is returned | ||
172 | * | ||
173 | * RETURN: Updated position for next valid character | ||
174 | * | ||
175 | * DESCRIPTION: Scan a string for a decimal integer. | ||
176 | * | ||
177 | ******************************************************************************/ | ||
178 | |||
179 | const char *acpi_ut_scan_number(const char *string, u64 *number_ptr) | ||
180 | { | ||
181 | u64 number = 0; | ||
182 | |||
183 | while (ACPI_IS_DIGIT(*string)) { | ||
184 | number *= 10; | ||
185 | number += *(string++) - '0'; | ||
186 | } | ||
187 | |||
188 | *number_ptr = number; | ||
189 | return (string); | ||
190 | } | ||
191 | |||
192 | /******************************************************************************* | ||
193 | * | ||
194 | * FUNCTION: acpi_ut_print_number | ||
195 | * | ||
196 | * PARAMETERS: string - String buffer | ||
197 | * number - The number to be converted | ||
198 | * | ||
199 | * RETURN: Updated position for next valid character | ||
200 | * | ||
201 | * DESCRIPTION: Print a decimal integer into a string. | ||
202 | * | ||
203 | ******************************************************************************/ | ||
204 | |||
205 | const char *acpi_ut_print_number(char *string, u64 number) | ||
206 | { | ||
207 | char ascii_string[20]; | ||
208 | const char *pos1; | ||
209 | char *pos2; | ||
210 | |||
211 | pos1 = acpi_ut_put_number(ascii_string, number, 10, FALSE); | ||
212 | pos2 = string; | ||
213 | |||
214 | while (pos1 != ascii_string) { | ||
215 | *(pos2++) = *(--pos1); | ||
216 | } | ||
217 | |||
218 | *pos2 = 0; | ||
219 | return (string); | ||
220 | } | ||
221 | |||
222 | /******************************************************************************* | ||
223 | * | ||
224 | * FUNCTION: acpi_ut_format_number | ||
225 | * | ||
226 | * PARAMETERS: string - String buffer with boundary | ||
227 | * end - Boundary of the string | ||
228 | * number - The number to be converted | ||
229 | * base - Base of the integer | ||
230 | * width - Field width | ||
231 | * precision - Precision of the integer | ||
232 | * type - Special printing flags | ||
233 | * | ||
234 | * RETURN: Updated position for next valid character | ||
235 | * | ||
236 | * DESCRIPTION: Print an integer into a string with any base and any precision. | ||
237 | * | ||
238 | ******************************************************************************/ | ||
239 | |||
240 | static char *acpi_ut_format_number(char *string, | ||
241 | char *end, | ||
242 | u64 number, | ||
243 | u8 base, s32 width, s32 precision, u8 type) | ||
244 | { | ||
245 | char sign; | ||
246 | char zero; | ||
247 | u8 need_prefix; | ||
248 | u8 upper; | ||
249 | s32 i; | ||
250 | char reversed_string[66]; | ||
251 | |||
252 | /* Parameter validation */ | ||
253 | |||
254 | if (base < 2 || base > 16) { | ||
255 | return (NULL); | ||
256 | } | ||
257 | |||
258 | if (type & ACPI_FORMAT_LEFT) { | ||
259 | type &= ~ACPI_FORMAT_ZERO; | ||
260 | } | ||
261 | |||
262 | need_prefix = ((type & ACPI_FORMAT_PREFIX) | ||
263 | && base != 10) ? TRUE : FALSE; | ||
264 | upper = (type & ACPI_FORMAT_UPPER) ? TRUE : FALSE; | ||
265 | zero = (type & ACPI_FORMAT_ZERO) ? '0' : ' '; | ||
266 | |||
267 | /* Calculate size according to sign and prefix */ | ||
268 | |||
269 | sign = '\0'; | ||
270 | if (type & ACPI_FORMAT_SIGN) { | ||
271 | if ((s64) number < 0) { | ||
272 | sign = '-'; | ||
273 | number = -(s64) number; | ||
274 | width--; | ||
275 | } else if (type & ACPI_FORMAT_SIGN_PLUS) { | ||
276 | sign = '+'; | ||
277 | width--; | ||
278 | } else if (type & ACPI_FORMAT_SIGN_PLUS_SPACE) { | ||
279 | sign = ' '; | ||
280 | width--; | ||
281 | } | ||
282 | } | ||
283 | if (need_prefix) { | ||
284 | width--; | ||
285 | if (base == 16) { | ||
286 | width--; | ||
287 | } | ||
288 | } | ||
289 | |||
290 | /* Generate full string in reverse order */ | ||
291 | |||
292 | i = ACPI_PTR_DIFF(acpi_ut_put_number | ||
293 | (reversed_string, number, base, upper), | ||
294 | reversed_string); | ||
295 | |||
296 | /* Printing 100 using %2d gives "100", not "00" */ | ||
297 | |||
298 | if (i > precision) { | ||
299 | precision = i; | ||
300 | } | ||
301 | |||
302 | width -= precision; | ||
303 | |||
304 | /* Output the string */ | ||
305 | |||
306 | if (!(type & (ACPI_FORMAT_ZERO | ACPI_FORMAT_LEFT))) { | ||
307 | while (--width >= 0) { | ||
308 | string = acpi_ut_bound_string_output(string, end, ' '); | ||
309 | } | ||
310 | } | ||
311 | if (sign) { | ||
312 | string = acpi_ut_bound_string_output(string, end, sign); | ||
313 | } | ||
314 | if (need_prefix) { | ||
315 | string = acpi_ut_bound_string_output(string, end, '0'); | ||
316 | if (base == 16) { | ||
317 | string = acpi_ut_bound_string_output(string, end, | ||
318 | upper ? 'X' : 'x'); | ||
319 | } | ||
320 | } | ||
321 | if (!(type & ACPI_FORMAT_LEFT)) { | ||
322 | while (--width >= 0) { | ||
323 | string = acpi_ut_bound_string_output(string, end, zero); | ||
324 | } | ||
325 | } | ||
326 | |||
327 | while (i <= --precision) { | ||
328 | string = acpi_ut_bound_string_output(string, end, '0'); | ||
329 | } | ||
330 | while (--i >= 0) { | ||
331 | string = acpi_ut_bound_string_output(string, end, | ||
332 | reversed_string[i]); | ||
333 | } | ||
334 | while (--width >= 0) { | ||
335 | string = acpi_ut_bound_string_output(string, end, ' '); | ||
336 | } | ||
337 | |||
338 | return (string); | ||
339 | } | ||
340 | |||
341 | /******************************************************************************* | ||
342 | * | ||
343 | * FUNCTION: acpi_ut_vsnprintf | ||
344 | * | ||
345 | * PARAMETERS: string - String with boundary | ||
346 | * size - Boundary of the string | ||
347 | * format - Standard printf format | ||
348 | * args - Argument list | ||
349 | * | ||
350 | * RETURN: Number of bytes actually written. | ||
351 | * | ||
352 | * DESCRIPTION: Formatted output to a string using argument list pointer. | ||
353 | * | ||
354 | ******************************************************************************/ | ||
355 | |||
356 | int | ||
357 | acpi_ut_vsnprintf(char *string, | ||
358 | acpi_size size, const char *format, va_list args) | ||
359 | { | ||
360 | u8 base = 10; | ||
361 | u8 type = 0; | ||
362 | s32 width = -1; | ||
363 | s32 precision = -1; | ||
364 | char qualifier = 0; | ||
365 | u64 number; | ||
366 | char *pos; | ||
367 | char *end; | ||
368 | char c; | ||
369 | const char *s; | ||
370 | const void *p; | ||
371 | s32 length; | ||
372 | int i; | ||
373 | |||
374 | pos = string; | ||
375 | end = string + size; | ||
376 | |||
377 | for (; *format; ++format) { | ||
378 | if (*format != '%') { | ||
379 | pos = acpi_ut_bound_string_output(pos, end, *format); | ||
380 | continue; | ||
381 | } | ||
382 | |||
383 | /* Process sign */ | ||
384 | |||
385 | do { | ||
386 | ++format; | ||
387 | if (*format == '#') { | ||
388 | type |= ACPI_FORMAT_PREFIX; | ||
389 | } else if (*format == '0') { | ||
390 | type |= ACPI_FORMAT_ZERO; | ||
391 | } else if (*format == '+') { | ||
392 | type |= ACPI_FORMAT_SIGN_PLUS; | ||
393 | } else if (*format == ' ') { | ||
394 | type |= ACPI_FORMAT_SIGN_PLUS_SPACE; | ||
395 | } else if (*format == '-') { | ||
396 | type |= ACPI_FORMAT_LEFT; | ||
397 | } else { | ||
398 | break; | ||
399 | } | ||
400 | } while (1); | ||
401 | |||
402 | /* Process width */ | ||
403 | |||
404 | if (ACPI_IS_DIGIT(*format)) { | ||
405 | format = acpi_ut_scan_number(format, &number); | ||
406 | width = (s32) number; | ||
407 | } else if (*format == '*') { | ||
408 | ++format; | ||
409 | width = va_arg(args, int); | ||
410 | if (width < 0) { | ||
411 | width = -width; | ||
412 | type |= ACPI_FORMAT_LEFT; | ||
413 | } | ||
414 | } | ||
415 | |||
416 | /* Process precision */ | ||
417 | |||
418 | if (*format == '.') { | ||
419 | ++format; | ||
420 | if (ACPI_IS_DIGIT(*format)) { | ||
421 | format = acpi_ut_scan_number(format, &number); | ||
422 | precision = (s32) number; | ||
423 | } else if (*format == '*') { | ||
424 | ++format; | ||
425 | precision = va_arg(args, int); | ||
426 | } | ||
427 | if (precision < 0) { | ||
428 | precision = 0; | ||
429 | } | ||
430 | } | ||
431 | |||
432 | /* Process qualifier */ | ||
433 | |||
434 | if (*format == 'h' || *format == 'l' || *format == 'L') { | ||
435 | qualifier = *format; | ||
436 | ++format; | ||
437 | |||
438 | if (qualifier == 'l' && *format == 'l') { | ||
439 | qualifier = 'L'; | ||
440 | ++format; | ||
441 | } | ||
442 | } | ||
443 | |||
444 | switch (*format) { | ||
445 | case '%': | ||
446 | |||
447 | pos = acpi_ut_bound_string_output(pos, end, '%'); | ||
448 | continue; | ||
449 | |||
450 | case 'c': | ||
451 | |||
452 | if (!(type & ACPI_FORMAT_LEFT)) { | ||
453 | while (--width > 0) { | ||
454 | pos = | ||
455 | acpi_ut_bound_string_output(pos, | ||
456 | end, | ||
457 | ' '); | ||
458 | } | ||
459 | } | ||
460 | |||
461 | c = (char)va_arg(args, int); | ||
462 | pos = acpi_ut_bound_string_output(pos, end, c); | ||
463 | |||
464 | while (--width > 0) { | ||
465 | pos = | ||
466 | acpi_ut_bound_string_output(pos, end, ' '); | ||
467 | } | ||
468 | continue; | ||
469 | |||
470 | case 's': | ||
471 | |||
472 | s = va_arg(args, char *); | ||
473 | if (!s) { | ||
474 | s = "<NULL>"; | ||
475 | } | ||
476 | length = acpi_ut_bound_string_length(s, precision); | ||
477 | if (!(type & ACPI_FORMAT_LEFT)) { | ||
478 | while (length < width--) { | ||
479 | pos = | ||
480 | acpi_ut_bound_string_output(pos, | ||
481 | end, | ||
482 | ' '); | ||
483 | } | ||
484 | } | ||
485 | for (i = 0; i < length; ++i) { | ||
486 | pos = acpi_ut_bound_string_output(pos, end, *s); | ||
487 | ++s; | ||
488 | } | ||
489 | while (length < width--) { | ||
490 | pos = | ||
491 | acpi_ut_bound_string_output(pos, end, ' '); | ||
492 | } | ||
493 | continue; | ||
494 | |||
495 | case 'o': | ||
496 | |||
497 | base = 8; | ||
498 | break; | ||
499 | |||
500 | case 'X': | ||
501 | |||
502 | type |= ACPI_FORMAT_UPPER; | ||
503 | |||
504 | case 'x': | ||
505 | |||
506 | base = 16; | ||
507 | break; | ||
508 | |||
509 | case 'd': | ||
510 | case 'i': | ||
511 | |||
512 | type |= ACPI_FORMAT_SIGN; | ||
513 | |||
514 | case 'u': | ||
515 | |||
516 | break; | ||
517 | |||
518 | case 'p': | ||
519 | |||
520 | if (width == -1) { | ||
521 | width = 2 * sizeof(void *); | ||
522 | type |= ACPI_FORMAT_ZERO; | ||
523 | } | ||
524 | |||
525 | p = va_arg(args, void *); | ||
526 | pos = acpi_ut_format_number(pos, end, | ||
527 | ACPI_TO_INTEGER(p), 16, | ||
528 | width, precision, type); | ||
529 | continue; | ||
530 | |||
531 | default: | ||
532 | |||
533 | pos = acpi_ut_bound_string_output(pos, end, '%'); | ||
534 | if (*format) { | ||
535 | pos = | ||
536 | acpi_ut_bound_string_output(pos, end, | ||
537 | *format); | ||
538 | } else { | ||
539 | --format; | ||
540 | } | ||
541 | continue; | ||
542 | } | ||
543 | |||
544 | if (qualifier == 'L') { | ||
545 | number = va_arg(args, u64); | ||
546 | if (type & ACPI_FORMAT_SIGN) { | ||
547 | number = (s64) number; | ||
548 | } | ||
549 | } else if (qualifier == 'l') { | ||
550 | number = va_arg(args, unsigned long); | ||
551 | if (type & ACPI_FORMAT_SIGN) { | ||
552 | number = (s32) number; | ||
553 | } | ||
554 | } else if (qualifier == 'h') { | ||
555 | number = (u16)va_arg(args, int); | ||
556 | if (type & ACPI_FORMAT_SIGN) { | ||
557 | number = (s16) number; | ||
558 | } | ||
559 | } else { | ||
560 | number = va_arg(args, unsigned int); | ||
561 | if (type & ACPI_FORMAT_SIGN) { | ||
562 | number = (signed int)number; | ||
563 | } | ||
564 | } | ||
565 | |||
566 | pos = acpi_ut_format_number(pos, end, number, base, | ||
567 | width, precision, type); | ||
568 | } | ||
569 | |||
570 | if (size > 0) { | ||
571 | if (pos < end) { | ||
572 | *pos = '\0'; | ||
573 | } else { | ||
574 | end[-1] = '\0'; | ||
575 | } | ||
576 | } | ||
577 | |||
578 | return (ACPI_PTR_DIFF(pos, string)); | ||
579 | } | ||
580 | |||
581 | /******************************************************************************* | ||
582 | * | ||
583 | * FUNCTION: acpi_ut_snprintf | ||
584 | * | ||
585 | * PARAMETERS: string - String with boundary | ||
586 | * size - Boundary of the string | ||
587 | * Format, ... - Standard printf format | ||
588 | * | ||
589 | * RETURN: Number of bytes actually written. | ||
590 | * | ||
591 | * DESCRIPTION: Formatted output to a string. | ||
592 | * | ||
593 | ******************************************************************************/ | ||
594 | |||
595 | int acpi_ut_snprintf(char *string, acpi_size size, const char *format, ...) | ||
596 | { | ||
597 | va_list args; | ||
598 | int length; | ||
599 | |||
600 | va_start(args, format); | ||
601 | length = acpi_ut_vsnprintf(string, size, format, args); | ||
602 | va_end(args); | ||
603 | |||
604 | return (length); | ||
605 | } | ||
606 | |||
607 | #ifdef ACPI_APPLICATION | ||
608 | /******************************************************************************* | ||
609 | * | ||
610 | * FUNCTION: acpi_ut_file_vprintf | ||
611 | * | ||
612 | * PARAMETERS: file - File descriptor | ||
613 | * format - Standard printf format | ||
614 | * args - Argument list | ||
615 | * | ||
616 | * RETURN: Number of bytes actually written. | ||
617 | * | ||
618 | * DESCRIPTION: Formatted output to a file using argument list pointer. | ||
619 | * | ||
620 | ******************************************************************************/ | ||
621 | |||
622 | int acpi_ut_file_vprintf(ACPI_FILE file, const char *format, va_list args) | ||
623 | { | ||
624 | acpi_cpu_flags flags; | ||
625 | int length; | ||
626 | |||
627 | flags = acpi_os_acquire_lock(acpi_gbl_print_lock); | ||
628 | length = acpi_ut_vsnprintf(acpi_gbl_print_buffer, | ||
629 | sizeof(acpi_gbl_print_buffer), format, args); | ||
630 | |||
631 | (void)acpi_os_write_file(file, acpi_gbl_print_buffer, length, 1); | ||
632 | acpi_os_release_lock(acpi_gbl_print_lock, flags); | ||
633 | |||
634 | return (length); | ||
635 | } | ||
636 | |||
637 | /******************************************************************************* | ||
638 | * | ||
639 | * FUNCTION: acpi_ut_file_printf | ||
640 | * | ||
641 | * PARAMETERS: file - File descriptor | ||
642 | * Format, ... - Standard printf format | ||
643 | * | ||
644 | * RETURN: Number of bytes actually written. | ||
645 | * | ||
646 | * DESCRIPTION: Formatted output to a file. | ||
647 | * | ||
648 | ******************************************************************************/ | ||
649 | |||
650 | int acpi_ut_file_printf(ACPI_FILE file, const char *format, ...) | ||
651 | { | ||
652 | va_list args; | ||
653 | int length; | ||
654 | |||
655 | va_start(args, format); | ||
656 | length = acpi_ut_file_vprintf(file, format, args); | ||
657 | va_end(args); | ||
658 | |||
659 | return (length); | ||
660 | } | ||
661 | #endif | ||
diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h index e5bcd919d4e6..16129c78b489 100644 --- a/drivers/acpi/apei/apei-internal.h +++ b/drivers/acpi/apei/apei-internal.h | |||
@@ -121,11 +121,11 @@ struct dentry; | |||
121 | struct dentry *apei_get_debugfs_dir(void); | 121 | struct dentry *apei_get_debugfs_dir(void); |
122 | 122 | ||
123 | #define apei_estatus_for_each_section(estatus, section) \ | 123 | #define apei_estatus_for_each_section(estatus, section) \ |
124 | for (section = (struct acpi_generic_data *)(estatus + 1); \ | 124 | for (section = (struct acpi_hest_generic_data *)(estatus + 1); \ |
125 | (void *)section - (void *)estatus < estatus->data_length; \ | 125 | (void *)section - (void *)estatus < estatus->data_length; \ |
126 | section = (void *)(section+1) + section->error_data_length) | 126 | section = (void *)(section+1) + section->error_data_length) |
127 | 127 | ||
128 | static inline u32 cper_estatus_len(struct acpi_generic_status *estatus) | 128 | static inline u32 cper_estatus_len(struct acpi_hest_generic_status *estatus) |
129 | { | 129 | { |
130 | if (estatus->raw_data_length) | 130 | if (estatus->raw_data_length) |
131 | return estatus->raw_data_offset + \ | 131 | return estatus->raw_data_offset + \ |
@@ -135,9 +135,9 @@ static inline u32 cper_estatus_len(struct acpi_generic_status *estatus) | |||
135 | } | 135 | } |
136 | 136 | ||
137 | void cper_estatus_print(const char *pfx, | 137 | void cper_estatus_print(const char *pfx, |
138 | const struct acpi_generic_status *estatus); | 138 | const struct acpi_hest_generic_status *estatus); |
139 | int cper_estatus_check_header(const struct acpi_generic_status *estatus); | 139 | int cper_estatus_check_header(const struct acpi_hest_generic_status *estatus); |
140 | int cper_estatus_check(const struct acpi_generic_status *estatus); | 140 | int cper_estatus_check(const struct acpi_hest_generic_status *estatus); |
141 | 141 | ||
142 | int apei_osc_setup(void); | 142 | int apei_osc_setup(void); |
143 | #endif | 143 | #endif |
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index dab7cb7349df..7a38d1465b61 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c | |||
@@ -74,13 +74,13 @@ | |||
74 | #define GHES_ESTATUS_CACHE_LEN(estatus_len) \ | 74 | #define GHES_ESTATUS_CACHE_LEN(estatus_len) \ |
75 | (sizeof(struct ghes_estatus_cache) + (estatus_len)) | 75 | (sizeof(struct ghes_estatus_cache) + (estatus_len)) |
76 | #define GHES_ESTATUS_FROM_CACHE(estatus_cache) \ | 76 | #define GHES_ESTATUS_FROM_CACHE(estatus_cache) \ |
77 | ((struct acpi_generic_status *) \ | 77 | ((struct acpi_hest_generic_status *) \ |
78 | ((struct ghes_estatus_cache *)(estatus_cache) + 1)) | 78 | ((struct ghes_estatus_cache *)(estatus_cache) + 1)) |
79 | 79 | ||
80 | #define GHES_ESTATUS_NODE_LEN(estatus_len) \ | 80 | #define GHES_ESTATUS_NODE_LEN(estatus_len) \ |
81 | (sizeof(struct ghes_estatus_node) + (estatus_len)) | 81 | (sizeof(struct ghes_estatus_node) + (estatus_len)) |
82 | #define GHES_ESTATUS_FROM_NODE(estatus_node) \ | 82 | #define GHES_ESTATUS_FROM_NODE(estatus_node) \ |
83 | ((struct acpi_generic_status *) \ | 83 | ((struct acpi_hest_generic_status *) \ |
84 | ((struct ghes_estatus_node *)(estatus_node) + 1)) | 84 | ((struct ghes_estatus_node *)(estatus_node) + 1)) |
85 | 85 | ||
86 | bool ghes_disable; | 86 | bool ghes_disable; |
@@ -408,7 +408,7 @@ static void ghes_clear_estatus(struct ghes *ghes) | |||
408 | ghes->flags &= ~GHES_TO_CLEAR; | 408 | ghes->flags &= ~GHES_TO_CLEAR; |
409 | } | 409 | } |
410 | 410 | ||
411 | static void ghes_handle_memory_failure(struct acpi_generic_data *gdata, int sev) | 411 | static void ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata, int sev) |
412 | { | 412 | { |
413 | #ifdef CONFIG_ACPI_APEI_MEMORY_FAILURE | 413 | #ifdef CONFIG_ACPI_APEI_MEMORY_FAILURE |
414 | unsigned long pfn; | 414 | unsigned long pfn; |
@@ -441,10 +441,10 @@ static void ghes_handle_memory_failure(struct acpi_generic_data *gdata, int sev) | |||
441 | } | 441 | } |
442 | 442 | ||
443 | static void ghes_do_proc(struct ghes *ghes, | 443 | static void ghes_do_proc(struct ghes *ghes, |
444 | const struct acpi_generic_status *estatus) | 444 | const struct acpi_hest_generic_status *estatus) |
445 | { | 445 | { |
446 | int sev, sec_sev; | 446 | int sev, sec_sev; |
447 | struct acpi_generic_data *gdata; | 447 | struct acpi_hest_generic_data *gdata; |
448 | 448 | ||
449 | sev = ghes_severity(estatus->error_severity); | 449 | sev = ghes_severity(estatus->error_severity); |
450 | apei_estatus_for_each_section(estatus, gdata) { | 450 | apei_estatus_for_each_section(estatus, gdata) { |
@@ -498,7 +498,7 @@ static void ghes_do_proc(struct ghes *ghes, | |||
498 | 498 | ||
499 | static void __ghes_print_estatus(const char *pfx, | 499 | static void __ghes_print_estatus(const char *pfx, |
500 | const struct acpi_hest_generic *generic, | 500 | const struct acpi_hest_generic *generic, |
501 | const struct acpi_generic_status *estatus) | 501 | const struct acpi_hest_generic_status *estatus) |
502 | { | 502 | { |
503 | static atomic_t seqno; | 503 | static atomic_t seqno; |
504 | unsigned int curr_seqno; | 504 | unsigned int curr_seqno; |
@@ -520,7 +520,7 @@ static void __ghes_print_estatus(const char *pfx, | |||
520 | 520 | ||
521 | static int ghes_print_estatus(const char *pfx, | 521 | static int ghes_print_estatus(const char *pfx, |
522 | const struct acpi_hest_generic *generic, | 522 | const struct acpi_hest_generic *generic, |
523 | const struct acpi_generic_status *estatus) | 523 | const struct acpi_hest_generic_status *estatus) |
524 | { | 524 | { |
525 | /* Not more than 2 messages every 5 seconds */ | 525 | /* Not more than 2 messages every 5 seconds */ |
526 | static DEFINE_RATELIMIT_STATE(ratelimit_corrected, 5*HZ, 2); | 526 | static DEFINE_RATELIMIT_STATE(ratelimit_corrected, 5*HZ, 2); |
@@ -542,13 +542,13 @@ static int ghes_print_estatus(const char *pfx, | |||
542 | * GHES error status reporting throttle, to report more kinds of | 542 | * GHES error status reporting throttle, to report more kinds of |
543 | * errors, instead of just most frequently occurred errors. | 543 | * errors, instead of just most frequently occurred errors. |
544 | */ | 544 | */ |
545 | static int ghes_estatus_cached(struct acpi_generic_status *estatus) | 545 | static int ghes_estatus_cached(struct acpi_hest_generic_status *estatus) |
546 | { | 546 | { |
547 | u32 len; | 547 | u32 len; |
548 | int i, cached = 0; | 548 | int i, cached = 0; |
549 | unsigned long long now; | 549 | unsigned long long now; |
550 | struct ghes_estatus_cache *cache; | 550 | struct ghes_estatus_cache *cache; |
551 | struct acpi_generic_status *cache_estatus; | 551 | struct acpi_hest_generic_status *cache_estatus; |
552 | 552 | ||
553 | len = cper_estatus_len(estatus); | 553 | len = cper_estatus_len(estatus); |
554 | rcu_read_lock(); | 554 | rcu_read_lock(); |
@@ -573,12 +573,12 @@ static int ghes_estatus_cached(struct acpi_generic_status *estatus) | |||
573 | 573 | ||
574 | static struct ghes_estatus_cache *ghes_estatus_cache_alloc( | 574 | static struct ghes_estatus_cache *ghes_estatus_cache_alloc( |
575 | struct acpi_hest_generic *generic, | 575 | struct acpi_hest_generic *generic, |
576 | struct acpi_generic_status *estatus) | 576 | struct acpi_hest_generic_status *estatus) |
577 | { | 577 | { |
578 | int alloced; | 578 | int alloced; |
579 | u32 len, cache_len; | 579 | u32 len, cache_len; |
580 | struct ghes_estatus_cache *cache; | 580 | struct ghes_estatus_cache *cache; |
581 | struct acpi_generic_status *cache_estatus; | 581 | struct acpi_hest_generic_status *cache_estatus; |
582 | 582 | ||
583 | alloced = atomic_add_return(1, &ghes_estatus_cache_alloced); | 583 | alloced = atomic_add_return(1, &ghes_estatus_cache_alloced); |
584 | if (alloced > GHES_ESTATUS_CACHE_ALLOCED_MAX) { | 584 | if (alloced > GHES_ESTATUS_CACHE_ALLOCED_MAX) { |
@@ -621,7 +621,7 @@ static void ghes_estatus_cache_rcu_free(struct rcu_head *head) | |||
621 | 621 | ||
622 | static void ghes_estatus_cache_add( | 622 | static void ghes_estatus_cache_add( |
623 | struct acpi_hest_generic *generic, | 623 | struct acpi_hest_generic *generic, |
624 | struct acpi_generic_status *estatus) | 624 | struct acpi_hest_generic_status *estatus) |
625 | { | 625 | { |
626 | int i, slot = -1, count; | 626 | int i, slot = -1, count; |
627 | unsigned long long now, duration, period, max_period = 0; | 627 | unsigned long long now, duration, period, max_period = 0; |
@@ -753,7 +753,7 @@ static void ghes_proc_in_irq(struct irq_work *irq_work) | |||
753 | struct llist_node *llnode, *next; | 753 | struct llist_node *llnode, *next; |
754 | struct ghes_estatus_node *estatus_node; | 754 | struct ghes_estatus_node *estatus_node; |
755 | struct acpi_hest_generic *generic; | 755 | struct acpi_hest_generic *generic; |
756 | struct acpi_generic_status *estatus; | 756 | struct acpi_hest_generic_status *estatus; |
757 | u32 len, node_len; | 757 | u32 len, node_len; |
758 | 758 | ||
759 | llnode = llist_del_all(&ghes_estatus_llist); | 759 | llnode = llist_del_all(&ghes_estatus_llist); |
@@ -786,7 +786,7 @@ static void ghes_print_queued_estatus(void) | |||
786 | struct llist_node *llnode; | 786 | struct llist_node *llnode; |
787 | struct ghes_estatus_node *estatus_node; | 787 | struct ghes_estatus_node *estatus_node; |
788 | struct acpi_hest_generic *generic; | 788 | struct acpi_hest_generic *generic; |
789 | struct acpi_generic_status *estatus; | 789 | struct acpi_hest_generic_status *estatus; |
790 | u32 len, node_len; | 790 | u32 len, node_len; |
791 | 791 | ||
792 | llnode = llist_del_all(&ghes_estatus_llist); | 792 | llnode = llist_del_all(&ghes_estatus_llist); |
@@ -845,7 +845,7 @@ static int ghes_notify_nmi(unsigned int cmd, struct pt_regs *regs) | |||
845 | #ifdef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG | 845 | #ifdef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG |
846 | u32 len, node_len; | 846 | u32 len, node_len; |
847 | struct ghes_estatus_node *estatus_node; | 847 | struct ghes_estatus_node *estatus_node; |
848 | struct acpi_generic_status *estatus; | 848 | struct acpi_hest_generic_status *estatus; |
849 | #endif | 849 | #endif |
850 | if (!(ghes->flags & GHES_TO_CLEAR)) | 850 | if (!(ghes->flags & GHES_TO_CLEAR)) |
851 | continue; | 851 | continue; |
@@ -925,7 +925,7 @@ static int ghes_probe(struct platform_device *ghes_dev) | |||
925 | 925 | ||
926 | rc = -EIO; | 926 | rc = -EIO; |
927 | if (generic->error_block_length < | 927 | if (generic->error_block_length < |
928 | sizeof(struct acpi_generic_status)) { | 928 | sizeof(struct acpi_hest_generic_status)) { |
929 | pr_warning(FW_BUG GHES_PFX "Invalid error block length: %u for generic hardware error source: %d\n", | 929 | pr_warning(FW_BUG GHES_PFX "Invalid error block length: %u for generic hardware error source: %d\n", |
930 | generic->error_block_length, | 930 | generic->error_block_length, |
931 | generic->header.source_id); | 931 | generic->header.source_id); |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 071c1dfb93f3..350d52a8f781 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -68,7 +68,7 @@ MODULE_AUTHOR("Bruno Ducrot"); | |||
68 | MODULE_DESCRIPTION("ACPI Video Driver"); | 68 | MODULE_DESCRIPTION("ACPI Video Driver"); |
69 | MODULE_LICENSE("GPL"); | 69 | MODULE_LICENSE("GPL"); |
70 | 70 | ||
71 | static bool brightness_switch_enabled; | 71 | static bool brightness_switch_enabled = 1; |
72 | module_param(brightness_switch_enabled, bool, 0644); | 72 | module_param(brightness_switch_enabled, bool, 0644); |
73 | 73 | ||
74 | /* | 74 | /* |
@@ -581,6 +581,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
581 | }, | 581 | }, |
582 | { | 582 | { |
583 | .callback = video_set_use_native_backlight, | 583 | .callback = video_set_use_native_backlight, |
584 | .ident = "HP ProBook 4540s", | ||
585 | .matches = { | ||
586 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
587 | DMI_MATCH(DMI_PRODUCT_VERSION, "HP ProBook 4540s"), | ||
588 | }, | ||
589 | }, | ||
590 | { | ||
591 | .callback = video_set_use_native_backlight, | ||
584 | .ident = "HP ProBook 2013 models", | 592 | .ident = "HP ProBook 2013 models", |
585 | .matches = { | 593 | .matches = { |
586 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | 594 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), |