From 53c78d75d8a4615e5c2f1d9fe94f25e049f0e61b Mon Sep 17 00:00:00 2001 From: Will Miles Date: Thu, 24 Mar 2016 09:40:26 +0800 Subject: ACPICA: Add support for QNX 6.6 platform ACPICA commit 37a1dec2391272251e59948c16c60713183ae78f Link: https://github.com/acpica/acpica/commit/37a1dec2 Signed-off-by: Will Miles Signed-off-by: Bob Moore Signed-off-by: Lv Zheng Signed-off-by: Rafael J. Wysocki --- tools/power/acpi/os_specific/service_layers/osunixmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/power') diff --git a/tools/power/acpi/os_specific/service_layers/osunixmap.c b/tools/power/acpi/os_specific/service_layers/osunixmap.c index 3818fd07e50f..cbfbce18783d 100644 --- a/tools/power/acpi/os_specific/service_layers/osunixmap.c +++ b/tools/power/acpi/os_specific/service_layers/osunixmap.c @@ -54,7 +54,7 @@ ACPI_MODULE_NAME("osunixmap") #ifndef O_BINARY #define O_BINARY 0 #endif -#if defined(_dragon_fly) || defined(_free_BSD) +#if defined(_dragon_fly) || defined(_free_BSD) || defined(_QNX) #define MMAP_FLAGS MAP_SHARED #else #define MMAP_FLAGS MAP_PRIVATE -- cgit v1.2.1 From 3a05be7575a46cf3b16abb77e1072afa13307a1b Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Thu, 24 Mar 2016 09:40:33 +0800 Subject: ACPICA: Utilities: Update for strtoul64 merger ACPICA commit 795e136d2ac77c1c8b091fba019b5fe36a44a323 Fixes a problem with the merger of the two internal versions of this function. Make the maximum integer width (32-bit or 64-bit) a parameter to the function so that it no longer exclusively uses the integer width specified in the DSDT/SSDT. ACPICA BZ 1260 Link: https://github.com/acpica/acpica/commit/795e136d Signed-off-by: Bob Moore Signed-off-by: Lv Zheng Signed-off-by: Rafael J. Wysocki --- tools/power/acpi/tools/acpidump/apdump.c | 3 ++- tools/power/acpi/tools/acpidump/apmain.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'tools/power') diff --git a/tools/power/acpi/tools/acpidump/apdump.c b/tools/power/acpi/tools/acpidump/apdump.c index da44458d3b6c..9c2db0eb467f 100644 --- a/tools/power/acpi/tools/acpidump/apdump.c +++ b/tools/power/acpi/tools/acpidump/apdump.c @@ -286,7 +286,8 @@ int ap_dump_table_by_address(char *ascii_address) /* Convert argument to an integer physical address */ - status = acpi_ut_strtoul64(ascii_address, 0, &long_address); + status = acpi_ut_strtoul64(ascii_address, ACPI_ANY_BASE, + ACPI_MAX64_BYTE_WIDTH, &long_address); if (ACPI_FAILURE(status)) { acpi_log_error("%s: Could not convert to a physical address\n", ascii_address); diff --git a/tools/power/acpi/tools/acpidump/apmain.c b/tools/power/acpi/tools/acpidump/apmain.c index c3c09152fac6..7692e6b887e1 100644 --- a/tools/power/acpi/tools/acpidump/apmain.c +++ b/tools/power/acpi/tools/acpidump/apmain.c @@ -209,7 +209,8 @@ static int ap_do_options(int argc, char **argv) case 'r': /* Dump tables from specified RSDP */ status = - acpi_ut_strtoul64(acpi_gbl_optarg, 0, + acpi_ut_strtoul64(acpi_gbl_optarg, ACPI_ANY_BASE, + ACPI_MAX64_BYTE_WIDTH, &gbl_rsdp_base); if (ACPI_FAILURE(status)) { acpi_log_error -- cgit v1.2.1 From 60438d9a1ef4176d79739efadee122afe92904b8 Mon Sep 17 00:00:00 2001 From: Lv Zheng Date: Thu, 24 Mar 2016 13:01:28 +0800 Subject: tools/power/acpi: close file only if it is open The logic on the test for a valid fd to close is incorrect. This was just a mistake and was pointed out by Colin Ian King. Link: https://patchwork.kernel.org/patch/8620201/ Original-by: Colin Ian King Signed-off-by: Lv Zheng Signed-off-by: Rafael J. Wysocki --- tools/power/acpi/tools/acpidbg/acpidbg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/power') diff --git a/tools/power/acpi/tools/acpidbg/acpidbg.c b/tools/power/acpi/tools/acpidbg/acpidbg.c index d070fccdba6d..a88ac45b7756 100644 --- a/tools/power/acpi/tools/acpidbg/acpidbg.c +++ b/tools/power/acpi/tools/acpidbg/acpidbg.c @@ -375,7 +375,7 @@ void usage(FILE *file, char *progname) int main(int argc, char **argv) { - int fd = 0; + int fd = -1; int ch; int len; int ret = EXIT_SUCCESS; @@ -430,7 +430,7 @@ int main(int argc, char **argv) acpi_aml_loop(fd); exit: - if (fd < 0) + if (fd >= 0) close(fd); if (acpi_aml_batch_cmd) free(acpi_aml_batch_cmd); -- cgit v1.2.1 From f5c1e1c5a652e4b43eb9b571577ef72731f3fa8b Mon Sep 17 00:00:00 2001 From: Lv Zheng Date: Thu, 5 May 2016 12:57:53 +0800 Subject: ACPICA: Divergence: remove unwanted spaces for typedef ACPICA commit b2294cae776f5a66a7697414b21949d307e6856f This patch removes unwanted spaces for typedef. This solution doesn't cover function types. Note that the linuxize result of this commit is very giant and should have many conflicts against the current Linux upstream. Thus it is required to modify the linuxize result of this commit and the commits around it manually in order to have them merged to the Linux upstream. Since this is very costy, we should do this only once, and if we can't ensure to do this only once, we need to revert the Linux code to the wrong indentation result before merging the linuxize result of this commit. Lv Zheng. Link: https://github.com/acpica/acpica/commit/b2294cae Signed-off-by: Lv Zheng Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki --- .../acpi/os_specific/service_layers/oslinuxtbl.c | 47 +++++++++++----------- .../acpi/os_specific/service_layers/osunixxf.c | 24 +++++------ tools/power/acpi/tools/acpidump/apdump.c | 2 +- 3 files changed, 36 insertions(+), 37 deletions(-) (limited to 'tools/power') diff --git a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c index d0e6b857d8d1..546cf4a503b7 100644 --- a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c +++ b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c @@ -91,7 +91,7 @@ osl_get_customized_table(char *pathname, char *signature, u32 instance, struct acpi_table_header **table, - acpi_physical_address * address); + acpi_physical_address *address); static acpi_status osl_list_bios_tables(void); @@ -99,7 +99,7 @@ static acpi_status osl_get_bios_table(char *signature, u32 instance, struct acpi_table_header **table, - acpi_physical_address * address); + acpi_physical_address *address); static acpi_status osl_get_last_status(acpi_status default_status); @@ -187,7 +187,7 @@ static acpi_status osl_get_last_status(acpi_status default_status) acpi_status acpi_os_get_table_by_address(acpi_physical_address address, - struct acpi_table_header ** table) + struct acpi_table_header **table) { u32 table_length; struct acpi_table_header *mapped_table; @@ -252,8 +252,8 @@ exit: acpi_status acpi_os_get_table_by_name(char *signature, u32 instance, - struct acpi_table_header ** table, - acpi_physical_address * address) + struct acpi_table_header **table, + acpi_physical_address *address) { acpi_status status; @@ -380,8 +380,8 @@ static acpi_status osl_add_table_to_list(char *signature, u32 instance) acpi_status acpi_os_get_table_by_index(u32 index, - struct acpi_table_header ** table, - u32 *instance, acpi_physical_address * address) + struct acpi_table_header **table, + u32 *instance, acpi_physical_address *address) { struct osl_table_info *info; acpi_status status; @@ -447,7 +447,7 @@ osl_find_rsdp_via_efi_by_keyword(FILE * file, const char *keyword) } } - return ((acpi_physical_address) (address)); + return ((acpi_physical_address)(address)); } /****************************************************************************** @@ -751,10 +751,10 @@ static acpi_status osl_list_bios_tables(void) for (i = 0; i < number_of_tables; ++i, table_data += item_size) { if (osl_can_use_xsdt()) { table_address = - (acpi_physical_address) (*ACPI_CAST64(table_data)); + (acpi_physical_address)(*ACPI_CAST64(table_data)); } else { table_address = - (acpi_physical_address) (*ACPI_CAST32(table_data)); + (acpi_physical_address)(*ACPI_CAST32(table_data)); } /* Skip NULL entries in RSDT/XSDT */ @@ -800,7 +800,7 @@ static acpi_status osl_get_bios_table(char *signature, u32 instance, struct acpi_table_header **table, - acpi_physical_address * address) + acpi_physical_address *address) { struct acpi_table_header *local_table = NULL; struct acpi_table_header *mapped_table = NULL; @@ -833,38 +833,37 @@ osl_get_bios_table(char *signature, if ((gbl_fadt->header.length >= MIN_FADT_FOR_XDSDT) && gbl_fadt->Xdsdt) { table_address = - (acpi_physical_address) gbl_fadt->Xdsdt; + (acpi_physical_address)gbl_fadt->Xdsdt; } else if ((gbl_fadt->header.length >= MIN_FADT_FOR_DSDT) && gbl_fadt->dsdt) { table_address = - (acpi_physical_address) gbl_fadt->dsdt; + (acpi_physical_address)gbl_fadt->dsdt; } } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_FACS)) { if ((gbl_fadt->header.length >= MIN_FADT_FOR_XFACS) && gbl_fadt->Xfacs) { table_address = - (acpi_physical_address) gbl_fadt->Xfacs; + (acpi_physical_address)gbl_fadt->Xfacs; } else if ((gbl_fadt->header.length >= MIN_FADT_FOR_FACS) && gbl_fadt->facs) { table_address = - (acpi_physical_address) gbl_fadt->facs; + (acpi_physical_address)gbl_fadt->facs; } } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_XSDT)) { if (!gbl_revision) { return (AE_BAD_SIGNATURE); } table_address = - (acpi_physical_address) gbl_rsdp. + (acpi_physical_address)gbl_rsdp. xsdt_physical_address; } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_RSDT)) { table_address = - (acpi_physical_address) gbl_rsdp. + (acpi_physical_address)gbl_rsdp. rsdt_physical_address; } else { - table_address = - (acpi_physical_address) gbl_rsdp_address; + table_address = (acpi_physical_address)gbl_rsdp_address; signature = ACPI_SIG_RSDP; } @@ -904,12 +903,12 @@ osl_get_bios_table(char *signature, for (i = 0; i < number_of_tables; ++i, table_data += item_size) { if (osl_can_use_xsdt()) { table_address = - (acpi_physical_address) (*ACPI_CAST64 - (table_data)); + (acpi_physical_address)(*ACPI_CAST64 + (table_data)); } else { table_address = - (acpi_physical_address) (*ACPI_CAST32 - (table_data)); + (acpi_physical_address)(*ACPI_CAST32 + (table_data)); } /* Skip NULL entries in RSDT/XSDT */ @@ -1301,7 +1300,7 @@ osl_get_customized_table(char *pathname, char *signature, u32 instance, struct acpi_table_header **table, - acpi_physical_address * address) + acpi_physical_address *address) { void *table_dir; u32 current_instance = 0; diff --git a/tools/power/acpi/os_specific/service_layers/osunixxf.c b/tools/power/acpi/os_specific/service_layers/osunixxf.c index 08cb8b2035f2..88aa66ef4ad5 100644 --- a/tools/power/acpi/os_specific/service_layers/osunixxf.c +++ b/tools/power/acpi/os_specific/service_layers/osunixxf.c @@ -246,8 +246,8 @@ acpi_physical_address acpi_os_get_root_pointer(void) *****************************************************************************/ acpi_status -acpi_os_predefined_override(const struct acpi_predefined_names * init_val, - acpi_string * new_val) +acpi_os_predefined_override(const struct acpi_predefined_names *init_val, + acpi_string *new_val) { if (!init_val || !new_val) { @@ -274,8 +274,8 @@ acpi_os_predefined_override(const struct acpi_predefined_names * init_val, *****************************************************************************/ acpi_status -acpi_os_table_override(struct acpi_table_header * existing_table, - struct acpi_table_header ** new_table) +acpi_os_table_override(struct acpi_table_header *existing_table, + struct acpi_table_header **new_table) { if (!existing_table || !new_table) { @@ -311,8 +311,8 @@ acpi_os_table_override(struct acpi_table_header * existing_table, *****************************************************************************/ acpi_status -acpi_os_physical_table_override(struct acpi_table_header * existing_table, - acpi_physical_address * new_address, +acpi_os_physical_table_override(struct acpi_table_header *existing_table, + acpi_physical_address *new_address, u32 *new_table_length) { @@ -506,7 +506,7 @@ acpi_status acpi_os_get_line(char *buffer, u32 buffer_length, u32 *bytes_read) void *acpi_os_map_memory(acpi_physical_address where, acpi_size length) { - return (ACPI_TO_POINTER((acpi_size) where)); + return (ACPI_TO_POINTER((acpi_size)where)); } /****************************************************************************** @@ -603,9 +603,9 @@ void acpi_os_free(void *mem) acpi_status acpi_os_create_semaphore(u32 max_units, - u32 initial_units, acpi_handle * out_handle) + u32 initial_units, acpi_handle *out_handle) { - *out_handle = (acpi_handle) 1; + *out_handle = (acpi_handle)1; return (AE_OK); } @@ -640,7 +640,7 @@ acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units) acpi_status acpi_os_create_semaphore(u32 max_units, - u32 initial_units, acpi_handle * out_handle) + u32 initial_units, acpi_handle *out_handle) { sem_t *sem; @@ -672,7 +672,7 @@ acpi_os_create_semaphore(u32 max_units, } #endif - *out_handle = (acpi_handle) sem; + *out_handle = (acpi_handle)sem; return (AE_OK); } @@ -1035,7 +1035,7 @@ acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id, *****************************************************************************/ acpi_status -acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, +acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id, u32 pci_register, u64 value, u32 width) { diff --git a/tools/power/acpi/tools/acpidump/apdump.c b/tools/power/acpi/tools/acpidump/apdump.c index 9c2db0eb467f..a39e44533369 100644 --- a/tools/power/acpi/tools/acpidump/apdump.c +++ b/tools/power/acpi/tools/acpidump/apdump.c @@ -294,7 +294,7 @@ int ap_dump_table_by_address(char *ascii_address) return (-1); } - address = (acpi_physical_address) long_address; + address = (acpi_physical_address)long_address; status = acpi_os_get_table_by_address(address, &table); if (ACPI_FAILURE(status)) { acpi_log_error("Could not get table at 0x%8.8X%8.8X, %s\n", -- cgit v1.2.1 From 6a0df32c22fdfc414e6613c1bc911f19f39df01b Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Thu, 5 May 2016 13:00:36 +0800 Subject: ACPICA: Move all ASCII utilities to a common file ACPICA commit ba60e4500053010bf775d58f6f61febbdb94d817 New file is utascii.c Link: https://github.com/acpica/acpica/commit/ba60e450 Signed-off-by: Bob Moore Signed-off-by: Lv Zheng Signed-off-by: Rafael J. Wysocki --- tools/power/acpi/tools/acpidump/Makefile | 1 + tools/power/acpi/tools/acpidump/apdump.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'tools/power') diff --git a/tools/power/acpi/tools/acpidump/Makefile b/tools/power/acpi/tools/acpidump/Makefile index 8d761576e91b..2942cdced2ad 100644 --- a/tools/power/acpi/tools/acpidump/Makefile +++ b/tools/power/acpi/tools/acpidump/Makefile @@ -31,6 +31,7 @@ TOOL_OBJS = \ osunixxf.o\ tbprint.o\ tbxfroot.o\ + utascii.o\ utbuffer.o\ utdebug.o\ utexcep.o\ diff --git a/tools/power/acpi/tools/acpidump/apdump.c b/tools/power/acpi/tools/acpidump/apdump.c index a39e44533369..fb8f1d9e3b1b 100644 --- a/tools/power/acpi/tools/acpidump/apdump.c +++ b/tools/power/acpi/tools/acpidump/apdump.c @@ -68,7 +68,7 @@ u8 ap_is_valid_header(struct acpi_table_header *table) /* Make sure signature is all ASCII and a valid ACPI name */ - if (!acpi_ut_valid_acpi_name(table->signature)) { + if (!acpi_ut_valid_nameseg(table->signature)) { acpi_log_error("Table signature (0x%8.8X) is invalid\n", *(u32 *)table->signature); return (FALSE); @@ -407,6 +407,12 @@ int ap_dump_table_from_file(char *pathname) return (-1); } + if (!acpi_ut_valid_nameseg(table->signature)) { + acpi_log_error + ("No valid ACPI signature was found in input file %s\n", + pathname); + } + /* File must be at least as long as the table length */ if (table->length > file_size) { -- cgit v1.2.1