Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'acpica-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPICA updates from Rafael Wysocki:
"Additional ACPICA material for v4.2-rc1

This will update the ACPICA code in the kernel to upstream revision
20150619 (a bug-fix release mostly including stable-candidate fixes)
and restore an earlier ACPICA commit that had to be reverted due to a
regression introduced by it (the regression is addressed by
blacklisting the only known system affected by it to date).

The only new feature added by this update is the support for
overriding objects in the ACPI namespace and a new ACPI table that can
be used for that called the Override System Definition Table (OSDT).
That should allow us to "patch" the ACPI namespace built from
incomplete or incorrect ACPI System Definition tables (DSDT, SSDT)
during system startup without the need to provide replacements for all
of those tables in the future.

Specifics:

- Fix system resume problems related to 32-bit and 64-bit versions of
the Firmware ACPI Control Structure (FACS) in the firmare (Lv
Zheng)

- Fix double initialization of the FACS (Lv Zheng)

- Add _CLS object processing code to ACPICA (Suravee Suthikulpanit)

- Add support for the (currently missing) new GIC version field in
the Multiple APIC Description Table (MADT) (Hanjun Guo)

- Add support for overriding objects in the ACPI namespace to ACPICA
and OSDT support (Lv Zheng, Bob Moore, Zhang Rui)

- Updates related to the TCPA and TPM2 ACPI tables (Bob Moore)

- Restore the commit modifying _REV to always return "2" (as required
by ACPI 6) and add a blacklisting mechanism for systems that may be
affected by that change (Rafael J Wysocki)

- Assorted fixes and cleanups (Bob Moore, Lv Zheng, Sascha Wildner)"

* tag 'acpica-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (28 commits)
Revert 'Revert "ACPICA: Permanently set _REV to the value '2'."'
ACPI / init: Make it possible to override _REV
ACPICA: Update version to 20150619
ACPICA: Comment update, no functional change
ACPICA: Update TPM2 ACPI table
ACPICA: Update definitions for the TCPA and TPM2 ACPI tables
ACPICA: Split C library prototypes to new header
ACPICA: De-macroize calls to standard C library functions
ACPI / acpidump: Update acpidump manual
ACPICA: acpidump: Convert the default behavior to dump from /sys/firmware/acpi/tables
ACPICA: acpidump: Allow customized tables to be dumped without accessing /dev/mem
ACPICA: Cleanup output for the ASL Debug object
ACPICA: Update for acpi_install_table memory types
ACPICA: Namespace: Change namespace override to avoid node deletion
ACPICA: Namespace: Add support of OSDT table
ACPICA: Namespace: Add support to allow overriding objects
ACPICA: ACPI 6.0: Add values for MADT GIC version field
ACPICA: Utilities: Add _CLS processing
ACPICA: Add dragon_fly support to unix file mapping file
ACPICA: EFI: Add EFI interface definitions to eliminate dependency of GNU EFI
...

+988 -547
+6
Documentation/kernel-parameters.txt
··· 293 293 acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS 294 294 Format: To spoof as Windows 98: ="Microsoft Windows" 295 295 296 + acpi_rev_override [ACPI] Override the _REV object to return 5 (instead 297 + of 2 which is mandated by ACPI 6) as the supported ACPI 298 + specification revision (when using this switch, it may 299 + be necessary to carry out a cold reboot _twice_ in a 300 + row to make it take effect on the platform firmware). 301 + 296 302 acpi_osi= [HW,ACPI] Modify list of supported OS interface strings 297 303 acpi_osi="string1" # add string1 298 304 acpi_osi="!string2" # remove string2
+20
drivers/acpi/Kconfig
··· 80 80 81 81 Say N to delete power /proc/acpi/ directories that have moved to /sys/ 82 82 83 + config ACPI_REV_OVERRIDE_POSSIBLE 84 + bool "Allow supported ACPI revision to be overriden" 85 + depends on X86 86 + default y 87 + help 88 + The platform firmware on some systems expects Linux to return "5" as 89 + the supported ACPI revision which makes it expose system configuration 90 + information in a special way. 91 + 92 + For example, based on what ACPI exports as the supported revision, 93 + Dell XPS 13 (2015) configures its audio device to either work in HDA 94 + mode or in I2S mode, where the former is supposed to be used on Linux 95 + until the latter is fully supported (in the kernel as well as in user 96 + space). 97 + 98 + This option enables a DMI-based quirk for the above Dell machine (so 99 + that HDA audio is exposed by the platform firmware to the kernel) and 100 + makes it possible to force the kernel to return "5" as the supported 101 + ACPI revision via the "acpi_rev_override" command line switch. 102 + 83 103 config ACPI_EC_DEBUGFS 84 104 tristate "EC read/write access through /sys/kernel/debug/ec" 85 105 default n
+3
drivers/acpi/acpica/accommon.h
··· 59 59 #include "acglobal.h" /* All global variables */ 60 60 #include "achware.h" /* Hardware defines and interfaces */ 61 61 #include "acutils.h" /* Utility interfaces */ 62 + #ifndef ACPI_USE_SYSTEM_CLIBRARY 63 + #include "acclib.h" /* C library interfaces */ 64 + #endif /* !ACPI_USE_SYSTEM_CLIBRARY */ 62 65 63 66 #endif /* __ACCOMMON_H__ */
+2
drivers/acpi/acpica/acglobal.h
··· 61 61 62 62 #if (!ACPI_REDUCED_HARDWARE) 63 63 ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS); 64 + ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_facs32); 65 + ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_facs64); 64 66 65 67 #endif /* !ACPI_REDUCED_HARDWARE */ 66 68
+2
drivers/acpi/acpica/acinterp.h
··· 468 468 469 469 void acpi_ex_integer_to_string(char *dest, u64 value); 470 470 471 + void acpi_ex_pci_cls_to_string(char *dest, u8 class_code[3]); 472 + 471 473 u8 acpi_is_valid_space_id(u8 space_id); 472 474 473 475 /*
+1
drivers/acpi/acpica/aclocal.h
··· 213 213 214 214 #define ACPI_TABLE_INDEX_DSDT (0) 215 215 #define ACPI_TABLE_INDEX_FACS (1) 216 + #define ACPI_TABLE_INDEX_X_FACS (2) 216 217 217 218 struct acpi_find_context { 218 219 char *search_for;
+1
drivers/acpi/acpica/acnamesp.h
··· 66 66 #define ACPI_NS_PREFIX_IS_SCOPE 0x10 67 67 #define ACPI_NS_EXTERNAL 0x20 68 68 #define ACPI_NS_TEMPORARY 0x40 69 + #define ACPI_NS_OVERRIDE_IF_FOUND 0x80 69 70 70 71 /* Flags for acpi_ns_walk_namespace */ 71 72
+1
drivers/acpi/acpica/acobject.h
··· 335 335 void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ 336 336 struct acpi_namespace_node *node; /* ref_of or Namepath */ 337 337 union acpi_operand_object **where; /* Target of Index */ 338 + u8 *index_pointer; /* Used for Buffers and Strings */ 338 339 u32 value; /* Used for Local/Arg/Index/ddb_handle */ 339 340 }; 340 341
+1
drivers/acpi/acpica/acstruct.h
··· 82 82 u8 return_used; 83 83 u8 scope_depth; 84 84 u8 pass_number; /* Parse pass during table load */ 85 + u8 namespace_override; /* Override existing objects */ 85 86 u8 result_size; /* Total elements for the result stack */ 86 87 u8 result_count; /* Current number of occupied elements of result stack */ 87 88 u32 aml_offset;
+4 -60
drivers/acpi/acpica/acutils.h
··· 205 205 206 206 void acpi_ut_subsystem_shutdown(void); 207 207 208 - /* 209 - * utclib - Local implementations of C library functions 210 - */ 211 - #ifndef ACPI_USE_SYSTEM_CLIBRARY 212 - 213 - acpi_size acpi_ut_strlen(const char *string); 214 - 215 - char *acpi_ut_strchr(const char *string, int ch); 216 - 217 - char *acpi_ut_strcpy(char *dst_string, const char *src_string); 218 - 219 - char *acpi_ut_strncpy(char *dst_string, 220 - const char *src_string, acpi_size count); 221 - 222 - int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count); 223 - 224 - int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count); 225 - 226 - int acpi_ut_strcmp(const char *string1, const char *string2); 227 - 228 - char *acpi_ut_strcat(char *dst_string, const char *src_string); 229 - 230 - char *acpi_ut_strncat(char *dst_string, 231 - const char *src_string, acpi_size count); 232 - 233 - u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base); 234 - 235 - char *acpi_ut_strstr(char *string1, char *string2); 236 - 237 - void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count); 238 - 239 - void *acpi_ut_memset(void *dest, u8 value, acpi_size count); 240 - 241 - int acpi_ut_to_upper(int c); 242 - 243 - int acpi_ut_to_lower(int c); 244 - 245 - extern const u8 _acpi_ctype[]; 246 - 247 - #define _ACPI_XA 0x00 /* extra alphabetic - not supported */ 248 - #define _ACPI_XS 0x40 /* extra space */ 249 - #define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ 250 - #define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ 251 - #define _ACPI_DI 0x04 /* '0'-'9' */ 252 - #define _ACPI_LO 0x02 /* 'a'-'z' */ 253 - #define _ACPI_PU 0x10 /* punctuation */ 254 - #define _ACPI_SP 0x08 /* space, tab, CR, LF, VT, FF */ 255 - #define _ACPI_UP 0x01 /* 'A'-'Z' */ 256 - #define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ 257 - 258 - #define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI)) 259 - #define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP)) 260 - #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) 261 - #define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP)) 262 - #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) 263 - #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU)) 264 - #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) 265 - 266 - #endif /* !ACPI_USE_SYSTEM_CLIBRARY */ 267 - 268 208 #define ACPI_IS_ASCII(c) ((c) < 0x80) 269 209 270 210 /* ··· 369 429 acpi_status 370 430 acpi_ut_execute_CID(struct acpi_namespace_node *device_node, 371 431 struct acpi_pnp_device_id_list ** return_cid_list); 432 + 433 + acpi_status 434 + acpi_ut_execute_CLS(struct acpi_namespace_node *device_node, 435 + struct acpi_pnp_device_id **return_id); 372 436 373 437 /* 374 438 * utlock - reader/writer locks
+1 -1
drivers/acpi/acpica/dsfield.c
··· 502 502 } 503 503 } 504 504 505 - ACPI_MEMSET(&info, 0, sizeof(struct acpi_create_field_info)); 505 + memset(&info, 0, sizeof(struct acpi_create_field_info)); 506 506 507 507 /* Second arg is the field flags */ 508 508
+1 -1
drivers/acpi/acpica/dsinit.c
··· 207 207 208 208 /* Set all init info to zero */ 209 209 210 - ACPI_MEMSET(&info, 0, sizeof(struct acpi_init_walk_info)); 210 + memset(&info, 0, sizeof(struct acpi_init_walk_info)); 211 211 212 212 info.owner_id = owner_id; 213 213 info.table_index = table_index;
+3 -4
drivers/acpi/acpica/dsobject.c
··· 339 339 /* Initialize buffer from the byte_list (if present) */ 340 340 341 341 if (byte_list) { 342 - ACPI_MEMCPY(obj_desc->buffer.pointer, 343 - byte_list->named.data, byte_list_length); 342 + memcpy(obj_desc->buffer.pointer, byte_list->named.data, 343 + byte_list_length); 344 344 } 345 345 } 346 346 ··· 750 750 case ACPI_TYPE_STRING: 751 751 752 752 obj_desc->string.pointer = op->common.value.string; 753 - obj_desc->string.length = 754 - (u32) ACPI_STRLEN(op->common.value.string); 753 + obj_desc->string.length = (u32)strlen(op->common.value.string); 755 754 756 755 /* 757 756 * The string is contained in the ACPI table, don't ever try
+2 -2
drivers/acpi/acpica/dsutils.c
··· 572 572 obj_desc = 573 573 acpi_ut_create_string_object((acpi_size) name_length); 574 574 575 - ACPI_STRNCPY(obj_desc->string.pointer, 576 - name_string, name_length); 575 + strncpy(obj_desc->string.pointer, 576 + name_string, name_length); 577 577 status = AE_OK; 578 578 } else { 579 579 /*
+13 -4
drivers/acpi/acpica/dswload.c
··· 315 315 flags = ACPI_NS_NO_UPSEARCH; 316 316 if ((walk_state->opcode != AML_SCOPE_OP) && 317 317 (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) { 318 - flags |= ACPI_NS_ERROR_IF_FOUND; 319 - ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 320 - "[%s] Cannot already exist\n", 321 - acpi_ut_get_type_name(object_type))); 318 + if (walk_state->namespace_override) { 319 + flags |= ACPI_NS_OVERRIDE_IF_FOUND; 320 + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 321 + "[%s] Override allowed\n", 322 + acpi_ut_get_type_name 323 + (object_type))); 324 + } else { 325 + flags |= ACPI_NS_ERROR_IF_FOUND; 326 + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 327 + "[%s] Cannot already exist\n", 328 + acpi_ut_get_type_name 329 + (object_type))); 330 + } 322 331 } else { 323 332 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 324 333 "[%s] Both Find or Create allowed\n",
+1 -1
drivers/acpi/acpica/evgpeinit.c
··· 377 377 378 378 /* 4) The last two characters of the name are the hex GPE Number */ 379 379 380 - gpe_number = ACPI_STRTOUL(&name[2], NULL, 16); 380 + gpe_number = strtoul(&name[2], NULL, 16); 381 381 if (gpe_number == ACPI_UINT32_MAX) { 382 382 383 383 /* Conversion failed; invalid method, just ignore it */
+1 -1
drivers/acpi/acpica/exconfig.c
··· 470 470 return_ACPI_STATUS(AE_NO_MEMORY); 471 471 } 472 472 473 - ACPI_MEMCPY(table, table_header, length); 473 + memcpy(table, table_header, length); 474 474 break; 475 475 476 476 default:
+4 -5
drivers/acpi/acpica/exconvrt.c
··· 227 227 /* Copy the integer to the buffer, LSB first */ 228 228 229 229 new_buf = return_desc->buffer.pointer; 230 - ACPI_MEMCPY(new_buf, 231 - &obj_desc->integer.value, 232 - acpi_gbl_integer_byte_width); 230 + memcpy(new_buf, 231 + &obj_desc->integer.value, acpi_gbl_integer_byte_width); 233 232 break; 234 233 235 234 case ACPI_TYPE_STRING: ··· 251 252 /* Copy the string to the buffer */ 252 253 253 254 new_buf = return_desc->buffer.pointer; 254 - ACPI_STRNCPY((char *)new_buf, (char *)obj_desc->string.pointer, 255 - obj_desc->string.length); 255 + strncpy((char *)new_buf, (char *)obj_desc->string.pointer, 256 + obj_desc->string.length); 256 257 break; 257 258 258 259 default:
+40 -2
drivers/acpi/acpica/exdebug.c
··· 76 76 { 77 77 u32 i; 78 78 u32 timer; 79 + union acpi_operand_object *object_desc; 80 + u32 value; 79 81 80 82 ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc); 81 83 ··· 256 254 object)->object, 257 255 level + 4, 0); 258 256 } else { 259 - acpi_ex_do_debug_object(source_desc->reference. 260 - object, level + 4, 0); 257 + object_desc = source_desc->reference.object; 258 + value = source_desc->reference.value; 259 + 260 + switch (object_desc->common.type) { 261 + case ACPI_TYPE_BUFFER: 262 + 263 + acpi_os_printf("Buffer[%u] = 0x%2.2X\n", 264 + value, 265 + *source_desc->reference. 266 + index_pointer); 267 + break; 268 + 269 + case ACPI_TYPE_STRING: 270 + 271 + acpi_os_printf 272 + ("String[%u] = \"%c\" (0x%2.2X)\n", 273 + value, 274 + *source_desc->reference. 275 + index_pointer, 276 + *source_desc->reference. 277 + index_pointer); 278 + break; 279 + 280 + case ACPI_TYPE_PACKAGE: 281 + 282 + acpi_os_printf("Package[%u] = ", value); 283 + acpi_ex_do_debug_object(*source_desc-> 284 + reference.where, 285 + level + 4, 0); 286 + break; 287 + 288 + default: 289 + 290 + acpi_os_printf 291 + ("Unknown Reference object type %X\n", 292 + object_desc->common.type); 293 + break; 294 + } 261 295 } 262 296 } 263 297 break;
+5 -4
drivers/acpi/acpica/exdump.c
··· 224 224 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.data_obj), "Data Object"} 225 225 }; 226 226 227 - static struct acpi_exdump_info acpi_ex_dump_reference[8] = { 227 + static struct acpi_exdump_info acpi_ex_dump_reference[9] = { 228 228 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL}, 229 229 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.class), "Class"}, 230 230 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"}, ··· 232 232 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"}, 233 233 {ACPI_EXD_NODE, ACPI_EXD_OFFSET(reference.node), "Node"}, 234 234 {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.where), "Where"}, 235 + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.index_pointer), 236 + "Index Pointer"}, 235 237 {ACPI_EXD_REFERENCE, 0, NULL} 236 238 }; 237 239 ··· 1007 1005 } else if (obj_desc->reference.object) { 1008 1006 if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == 1009 1007 ACPI_DESC_TYPE_OPERAND) { 1010 - acpi_os_printf(" Target: %p", 1008 + acpi_os_printf("%22s %p", "Target :", 1011 1009 obj_desc->reference.object); 1012 1010 if (obj_desc->reference.class == ACPI_REFCLASS_TABLE) { 1013 1011 acpi_os_printf(" Table Index: %X\n", 1014 1012 obj_desc->reference.value); 1015 1013 } else { 1016 - acpi_os_printf(" Target: %p [%s]\n", 1017 - obj_desc->reference.object, 1014 + acpi_os_printf(" [%s]\n", 1018 1015 acpi_ut_get_type_name(((union 1019 1016 acpi_operand_object 1020 1017 *)
+1 -1
drivers/acpi/acpica/exfield.c
··· 428 428 } 429 429 430 430 buffer = buffer_desc->buffer.pointer; 431 - ACPI_MEMCPY(buffer, source_desc->buffer.pointer, length); 431 + memcpy(buffer, source_desc->buffer.pointer, length); 432 432 433 433 /* Lock entire transaction if requested */ 434 434
+26 -26
drivers/acpi/acpica/exfldio.c
··· 416 416 * Copy the data from the source buffer. 417 417 * Length is the field width in bytes. 418 418 */ 419 - ACPI_MEMCPY(value, 420 - (obj_desc->buffer_field.buffer_obj)->buffer. 421 - pointer + 422 - obj_desc->buffer_field.base_byte_offset + 423 - field_datum_byte_offset, 424 - obj_desc->common_field.access_byte_width); 419 + memcpy(value, 420 + (obj_desc->buffer_field.buffer_obj)->buffer. 421 + pointer + 422 + obj_desc->buffer_field.base_byte_offset + 423 + field_datum_byte_offset, 424 + obj_desc->common_field.access_byte_width); 425 425 } else { 426 426 /* 427 427 * Copy the data to the target buffer. 428 428 * Length is the field width in bytes. 429 429 */ 430 - ACPI_MEMCPY((obj_desc->buffer_field.buffer_obj)->buffer. 431 - pointer + 432 - obj_desc->buffer_field.base_byte_offset + 433 - field_datum_byte_offset, value, 434 - obj_desc->common_field.access_byte_width); 430 + memcpy((obj_desc->buffer_field.buffer_obj)->buffer. 431 + pointer + 432 + obj_desc->buffer_field.base_byte_offset + 433 + field_datum_byte_offset, value, 434 + obj_desc->common_field.access_byte_width); 435 435 } 436 436 437 437 status = AE_OK; ··· 703 703 return_ACPI_STATUS(AE_BUFFER_OVERFLOW); 704 704 } 705 705 706 - ACPI_MEMSET(buffer, 0, buffer_length); 706 + memset(buffer, 0, buffer_length); 707 707 access_bit_width = ACPI_MUL_8(obj_desc->common_field.access_byte_width); 708 708 709 709 /* Handle the simple case here */ ··· 720 720 status = 721 721 acpi_ex_field_datum_io(obj_desc, 0, &raw_datum, 722 722 ACPI_READ); 723 - ACPI_MEMCPY(buffer, &raw_datum, buffer_length); 723 + memcpy(buffer, &raw_datum, buffer_length); 724 724 } 725 725 726 726 return_ACPI_STATUS(status); ··· 793 793 794 794 /* Write merged datum to target buffer */ 795 795 796 - ACPI_MEMCPY(((char *)buffer) + buffer_offset, &merged_datum, 797 - ACPI_MIN(obj_desc->common_field.access_byte_width, 798 - buffer_length - buffer_offset)); 796 + memcpy(((char *)buffer) + buffer_offset, &merged_datum, 797 + ACPI_MIN(obj_desc->common_field.access_byte_width, 798 + buffer_length - buffer_offset)); 799 799 800 800 buffer_offset += obj_desc->common_field.access_byte_width; 801 801 merged_datum = ··· 811 811 812 812 /* Write the last datum to the buffer */ 813 813 814 - ACPI_MEMCPY(((char *)buffer) + buffer_offset, &merged_datum, 815 - ACPI_MIN(obj_desc->common_field.access_byte_width, 816 - buffer_length - buffer_offset)); 814 + memcpy(((char *)buffer) + buffer_offset, &merged_datum, 815 + ACPI_MIN(obj_desc->common_field.access_byte_width, 816 + buffer_length - buffer_offset)); 817 817 818 818 return_ACPI_STATUS(AE_OK); 819 819 } ··· 878 878 * at Byte zero. All unused (upper) bytes of the 879 879 * buffer will be 0. 880 880 */ 881 - ACPI_MEMCPY((char *)new_buffer, (char *)buffer, buffer_length); 881 + memcpy((char *)new_buffer, (char *)buffer, buffer_length); 882 882 buffer = new_buffer; 883 883 buffer_length = required_length; 884 884 } ··· 918 918 919 919 /* Get initial Datum from the input buffer */ 920 920 921 - ACPI_MEMCPY(&raw_datum, buffer, 922 - ACPI_MIN(obj_desc->common_field.access_byte_width, 923 - buffer_length - buffer_offset)); 921 + memcpy(&raw_datum, buffer, 922 + ACPI_MIN(obj_desc->common_field.access_byte_width, 923 + buffer_length - buffer_offset)); 924 924 925 925 merged_datum = 926 926 raw_datum << obj_desc->common_field.start_field_bit_offset; ··· 970 970 /* Get the next input datum from the buffer */ 971 971 972 972 buffer_offset += obj_desc->common_field.access_byte_width; 973 - ACPI_MEMCPY(&raw_datum, ((char *)buffer) + buffer_offset, 974 - ACPI_MIN(obj_desc->common_field.access_byte_width, 975 - buffer_length - buffer_offset)); 973 + memcpy(&raw_datum, ((char *)buffer) + buffer_offset, 974 + ACPI_MIN(obj_desc->common_field.access_byte_width, 975 + buffer_length - buffer_offset)); 976 976 977 977 merged_datum |= 978 978 raw_datum << obj_desc->common_field.start_field_bit_offset;
+18 -18
drivers/acpi/acpica/exmisc.c
··· 209 209 * end_tag descriptor is copied from Operand1. 210 210 */ 211 211 new_buf = return_desc->buffer.pointer; 212 - ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length0); 213 - ACPI_MEMCPY(new_buf + length0, operand1->buffer.pointer, length1); 212 + memcpy(new_buf, operand0->buffer.pointer, length0); 213 + memcpy(new_buf + length0, operand1->buffer.pointer, length1); 214 214 215 215 /* Insert end_tag and set the checksum to zero, means "ignore checksum" */ 216 216 ··· 318 318 319 319 /* Copy the first integer, LSB first */ 320 320 321 - ACPI_MEMCPY(new_buf, &operand0->integer.value, 322 - acpi_gbl_integer_byte_width); 321 + memcpy(new_buf, &operand0->integer.value, 322 + acpi_gbl_integer_byte_width); 323 323 324 324 /* Copy the second integer (LSB first) after the first */ 325 325 326 - ACPI_MEMCPY(new_buf + acpi_gbl_integer_byte_width, 327 - &local_operand1->integer.value, 328 - acpi_gbl_integer_byte_width); 326 + memcpy(new_buf + acpi_gbl_integer_byte_width, 327 + &local_operand1->integer.value, 328 + acpi_gbl_integer_byte_width); 329 329 break; 330 330 331 331 case ACPI_TYPE_STRING: ··· 346 346 347 347 /* Concatenate the strings */ 348 348 349 - ACPI_STRCPY(new_buf, operand0->string.pointer); 350 - ACPI_STRCPY(new_buf + operand0->string.length, 351 - local_operand1->string.pointer); 349 + strcpy(new_buf, operand0->string.pointer); 350 + strcpy(new_buf + operand0->string.length, 351 + local_operand1->string.pointer); 352 352 break; 353 353 354 354 case ACPI_TYPE_BUFFER: ··· 369 369 370 370 /* Concatenate the buffers */ 371 371 372 - ACPI_MEMCPY(new_buf, operand0->buffer.pointer, 373 - operand0->buffer.length); 374 - ACPI_MEMCPY(new_buf + operand0->buffer.length, 375 - local_operand1->buffer.pointer, 376 - local_operand1->buffer.length); 372 + memcpy(new_buf, operand0->buffer.pointer, 373 + operand0->buffer.length); 374 + memcpy(new_buf + operand0->buffer.length, 375 + local_operand1->buffer.pointer, 376 + local_operand1->buffer.length); 377 377 break; 378 378 379 379 default: ··· 660 660 661 661 /* Lexicographic compare: compare the data bytes */ 662 662 663 - compare = ACPI_MEMCMP(operand0->buffer.pointer, 664 - local_operand1->buffer.pointer, 665 - (length0 > length1) ? length1 : length0); 663 + compare = memcmp(operand0->buffer.pointer, 664 + local_operand1->buffer.pointer, 665 + (length0 > length1) ? length1 : length0); 666 666 667 667 switch (opcode) { 668 668 case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */
+1 -1
drivers/acpi/acpica/exnames.c
··· 192 192 char_buf[4] = '\0'; 193 193 194 194 if (name_string) { 195 - ACPI_STRCAT(name_string, char_buf); 195 + strcat(name_string, char_buf); 196 196 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 197 197 "Appended to - %s\n", name_string)); 198 198 } else {
+6 -2
drivers/acpi/acpica/exoparg2.c
··· 337 337 * Copy the raw buffer data with no transform. 338 338 * (NULL terminated already) 339 339 */ 340 - ACPI_MEMCPY(return_desc->string.pointer, 341 - operand[0]->buffer.pointer, length); 340 + memcpy(return_desc->string.pointer, 341 + operand[0]->buffer.pointer, length); 342 342 break; 343 343 344 344 case AML_CONCAT_RES_OP: ··· 380 380 381 381 return_desc->reference.target_type = 382 382 ACPI_TYPE_BUFFER_FIELD; 383 + return_desc->reference.index_pointer = 384 + &(operand[0]->buffer.pointer[index]); 383 385 break; 384 386 385 387 case ACPI_TYPE_BUFFER: ··· 393 391 394 392 return_desc->reference.target_type = 395 393 ACPI_TYPE_BUFFER_FIELD; 394 + return_desc->reference.index_pointer = 395 + &(operand[0]->buffer.pointer[index]); 396 396 break; 397 397 398 398 case ACPI_TYPE_PACKAGE:
+2 -2
drivers/acpi/acpica/exoparg3.c
··· 237 237 238 238 /* We have a buffer, copy the portion requested */ 239 239 240 - ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, 241 - length); 240 + memcpy(buffer, operand[0]->string.pointer + index, 241 + length); 242 242 } 243 243 244 244 /* Set the length of the new String/Buffer */
+4 -5
drivers/acpi/acpica/exregion.c
··· 517 517 switch (function) { 518 518 case ACPI_READ: 519 519 520 - ACPI_MEMCPY(ACPI_CAST_PTR(char, value), 521 - ACPI_PHYSADDR_TO_PTR(address), 522 - ACPI_DIV_8(bit_width)); 520 + memcpy(ACPI_CAST_PTR(char, value), 521 + ACPI_PHYSADDR_TO_PTR(address), ACPI_DIV_8(bit_width)); 523 522 break; 524 523 525 524 case ACPI_WRITE: 526 525 527 - ACPI_MEMCPY(ACPI_PHYSADDR_TO_PTR(address), 528 - ACPI_CAST_PTR(char, value), ACPI_DIV_8(bit_width)); 526 + memcpy(ACPI_PHYSADDR_TO_PTR(address), 527 + ACPI_CAST_PTR(char, value), ACPI_DIV_8(bit_width)); 529 528 break; 530 529 531 530 default:
+9 -9
drivers/acpi/acpica/exstorob.c
··· 100 100 101 101 /* Clear existing buffer and copy in the new one */ 102 102 103 - ACPI_MEMSET(target_desc->buffer.pointer, 0, 104 - target_desc->buffer.length); 105 - ACPI_MEMCPY(target_desc->buffer.pointer, buffer, length); 103 + memset(target_desc->buffer.pointer, 0, 104 + target_desc->buffer.length); 105 + memcpy(target_desc->buffer.pointer, buffer, length); 106 106 107 107 #ifdef ACPI_OBSOLETE_BEHAVIOR 108 108 /* ··· 129 129 } else { 130 130 /* Truncate the source, copy only what will fit */ 131 131 132 - ACPI_MEMCPY(target_desc->buffer.pointer, buffer, 133 - target_desc->buffer.length); 132 + memcpy(target_desc->buffer.pointer, buffer, 133 + target_desc->buffer.length); 134 134 135 135 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 136 136 "Truncating source buffer from %X to %X\n", ··· 187 187 * String will fit in existing non-static buffer. 188 188 * Clear old string and copy in the new one 189 189 */ 190 - ACPI_MEMSET(target_desc->string.pointer, 0, 191 - (acpi_size) target_desc->string.length + 1); 192 - ACPI_MEMCPY(target_desc->string.pointer, buffer, length); 190 + memset(target_desc->string.pointer, 0, 191 + (acpi_size) target_desc->string.length + 1); 192 + memcpy(target_desc->string.pointer, buffer, length); 193 193 } else { 194 194 /* 195 195 * Free the current buffer, then allocate a new buffer ··· 210 210 } 211 211 212 212 target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER; 213 - ACPI_MEMCPY(target_desc->string.pointer, buffer, length); 213 + memcpy(target_desc->string.pointer, buffer, length); 214 214 } 215 215 216 216 /* Set the new target length */
+32
drivers/acpi/acpica/exutils.c
··· 380 380 381 381 /******************************************************************************* 382 382 * 383 + * FUNCTION: acpi_ex_pci_cls_to_string 384 + * 385 + * PARAMETERS: out_string - Where to put the converted string (7 bytes) 386 + * PARAMETERS: class_code - PCI class code to be converted (3 bytes) 387 + * 388 + * RETURN: None 389 + * 390 + * DESCRIPTION: Convert 3-bytes PCI class code to string representation. 391 + * Return buffer must be large enough to hold the string. The 392 + * string returned is always exactly of length 393 + * ACPI_PCICLS_STRING_SIZE (includes null terminator). 394 + * 395 + ******************************************************************************/ 396 + 397 + void acpi_ex_pci_cls_to_string(char *out_string, u8 class_code[3]) 398 + { 399 + 400 + ACPI_FUNCTION_ENTRY(); 401 + 402 + /* All 3 bytes are hexadecimal */ 403 + 404 + out_string[0] = acpi_ut_hex_to_ascii_char((u64)class_code[0], 4); 405 + out_string[1] = acpi_ut_hex_to_ascii_char((u64)class_code[0], 0); 406 + out_string[2] = acpi_ut_hex_to_ascii_char((u64)class_code[1], 4); 407 + out_string[3] = acpi_ut_hex_to_ascii_char((u64)class_code[1], 0); 408 + out_string[4] = acpi_ut_hex_to_ascii_char((u64)class_code[2], 4); 409 + out_string[5] = acpi_ut_hex_to_ascii_char((u64)class_code[2], 0); 410 + out_string[6] = 0; 411 + } 412 + 413 + /******************************************************************************* 414 + * 383 415 * FUNCTION: acpi_is_valid_space_id 384 416 * 385 417 * PARAMETERS: space_id - ID to be validated
+104 -21
drivers/acpi/acpica/hwxfsleep.c
··· 50 50 ACPI_MODULE_NAME("hwxfsleep") 51 51 52 52 /* Local prototypes */ 53 + #if (!ACPI_REDUCED_HARDWARE) 54 + static acpi_status 55 + acpi_hw_set_firmware_waking_vectors(struct acpi_table_facs *facs, 56 + acpi_physical_address physical_address, 57 + acpi_physical_address physical_address64); 58 + #endif 59 + 53 60 static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id); 54 61 55 62 /* ··· 79 72 80 73 /* 81 74 * These functions are removed for the ACPI_REDUCED_HARDWARE case: 75 + * acpi_set_firmware_waking_vectors 82 76 * acpi_set_firmware_waking_vector 83 77 * acpi_set_firmware_waking_vector64 84 78 * acpi_enter_sleep_state_s4bios ··· 88 80 #if (!ACPI_REDUCED_HARDWARE) 89 81 /******************************************************************************* 90 82 * 91 - * FUNCTION: acpi_set_firmware_waking_vector 83 + * FUNCTION: acpi_hw_set_firmware_waking_vectors 92 84 * 93 - * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode 85 + * PARAMETERS: facs - Pointer to FACS table 86 + * physical_address - 32-bit physical address of ACPI real mode 94 87 * entry point. 88 + * physical_address64 - 64-bit physical address of ACPI protected 89 + * mode entry point. 95 90 * 96 91 * RETURN: Status 97 92 * 98 - * DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS 93 + * DESCRIPTION: Sets the firmware_waking_vector fields of the FACS 99 94 * 100 95 ******************************************************************************/ 101 96 102 - acpi_status acpi_set_firmware_waking_vector(u32 physical_address) 97 + static acpi_status 98 + acpi_hw_set_firmware_waking_vectors(struct acpi_table_facs *facs, 99 + acpi_physical_address physical_address, 100 + acpi_physical_address physical_address64) 103 101 { 104 - ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); 102 + ACPI_FUNCTION_TRACE(acpi_hw_set_firmware_waking_vectors); 105 103 106 104 107 105 /* ··· 120 106 121 107 /* Set the 32-bit vector */ 122 108 123 - acpi_gbl_FACS->firmware_waking_vector = physical_address; 109 + facs->firmware_waking_vector = (u32)physical_address; 124 110 125 - /* Clear the 64-bit vector if it exists */ 111 + if (facs->length > 32) { 112 + if (facs->version >= 1) { 126 113 127 - if ((acpi_gbl_FACS->length > 32) && (acpi_gbl_FACS->version >= 1)) { 128 - acpi_gbl_FACS->xfirmware_waking_vector = 0; 114 + /* Set the 64-bit vector */ 115 + 116 + facs->xfirmware_waking_vector = physical_address64; 117 + } else { 118 + /* Clear the 64-bit vector if it exists */ 119 + 120 + facs->xfirmware_waking_vector = 0; 121 + } 129 122 } 130 123 131 124 return_ACPI_STATUS(AE_OK); 125 + } 126 + 127 + /******************************************************************************* 128 + * 129 + * FUNCTION: acpi_set_firmware_waking_vectors 130 + * 131 + * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode 132 + * entry point. 133 + * physical_address64 - 64-bit physical address of ACPI protected 134 + * mode entry point. 135 + * 136 + * RETURN: Status 137 + * 138 + * DESCRIPTION: Sets the firmware_waking_vector fields of the FACS 139 + * 140 + ******************************************************************************/ 141 + 142 + acpi_status 143 + acpi_set_firmware_waking_vectors(acpi_physical_address physical_address, 144 + acpi_physical_address physical_address64) 145 + { 146 + 147 + ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vectors); 148 + 149 + /* If Hardware Reduced flag is set, there is no FACS */ 150 + 151 + if (acpi_gbl_reduced_hardware) { 152 + return_ACPI_STATUS (AE_OK); 153 + } 154 + 155 + if (acpi_gbl_facs32) { 156 + (void)acpi_hw_set_firmware_waking_vectors(acpi_gbl_facs32, 157 + physical_address, 158 + physical_address64); 159 + } 160 + if (acpi_gbl_facs64) { 161 + (void)acpi_hw_set_firmware_waking_vectors(acpi_gbl_facs64, 162 + physical_address, 163 + physical_address64); 164 + } 165 + 166 + return_ACPI_STATUS(AE_OK); 167 + } 168 + 169 + ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vectors) 170 + 171 + /******************************************************************************* 172 + * 173 + * FUNCTION: acpi_set_firmware_waking_vector 174 + * 175 + * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode 176 + * entry point. 177 + * 178 + * RETURN: Status 179 + * 180 + * DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS 181 + * 182 + ******************************************************************************/ 183 + acpi_status acpi_set_firmware_waking_vector(u32 physical_address) 184 + { 185 + acpi_status status; 186 + 187 + ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); 188 + 189 + status = acpi_set_firmware_waking_vectors((acpi_physical_address) 190 + physical_address, 0); 191 + 192 + return_ACPI_STATUS(status); 132 193 } 133 194 134 195 ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) ··· 225 136 ******************************************************************************/ 226 137 acpi_status acpi_set_firmware_waking_vector64(u64 physical_address) 227 138 { 139 + acpi_status status; 140 + 228 141 ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64); 229 142 143 + status = acpi_set_firmware_waking_vectors(0, 144 + (acpi_physical_address) 145 + physical_address); 230 146 231 - /* Determine if the 64-bit vector actually exists */ 232 - 233 - if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) { 234 - return_ACPI_STATUS(AE_NOT_EXIST); 235 - } 236 - 237 - /* Clear 32-bit vector, set the 64-bit X_ vector */ 238 - 239 - acpi_gbl_FACS->firmware_waking_vector = 0; 240 - acpi_gbl_FACS->xfirmware_waking_vector = physical_address; 241 - return_ACPI_STATUS(AE_OK); 147 + return_ACPI_STATUS(status); 242 148 } 243 149 244 150 ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64) 245 151 #endif 246 - 247 152 /******************************************************************************* 248 153 * 249 154 * FUNCTION: acpi_enter_sleep_state_s4bios
+12 -4
drivers/acpi/acpica/nsaccess.c
··· 102 102 103 103 /* _OSI is optional for now, will be permanent later */ 104 104 105 - if (!ACPI_STRCMP(init_val->name, "_OSI") 105 + if (!strcmp(init_val->name, "_OSI") 106 106 && !acpi_gbl_create_osi_method) { 107 107 continue; 108 108 } ··· 180 180 181 181 /* Build an object around the static string */ 182 182 183 - obj_desc->string.length = (u32)ACPI_STRLEN(val); 183 + obj_desc->string.length = (u32)strlen(val); 184 184 obj_desc->string.pointer = val; 185 185 obj_desc->common.flags |= AOPOBJ_STATIC_POINTER; 186 186 break; ··· 203 203 204 204 /* Special case for ACPI Global Lock */ 205 205 206 - if (ACPI_STRCMP(init_val->name, "_GL_") == 0) { 206 + if (strcmp(init_val->name, "_GL_") == 0) { 207 207 acpi_gbl_global_lock_mutex = obj_desc; 208 208 209 209 /* Create additional counting semaphore for global lock */ ··· 304 304 return_ACPI_STATUS(AE_BAD_PARAMETER); 305 305 } 306 306 307 - local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT); 307 + local_flags = flags & 308 + ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_OVERRIDE_IF_FOUND | 309 + ACPI_NS_SEARCH_PARENT); 308 310 *return_node = ACPI_ENTRY_NOT_FOUND; 309 311 acpi_gbl_ns_lookup_count++; 310 312 ··· 548 546 549 547 if (flags & ACPI_NS_ERROR_IF_FOUND) { 550 548 local_flags |= ACPI_NS_ERROR_IF_FOUND; 549 + } 550 + 551 + /* Set override flag according to caller */ 552 + 553 + if (flags & ACPI_NS_OVERRIDE_IF_FOUND) { 554 + local_flags |= ACPI_NS_OVERRIDE_IF_FOUND; 551 555 } 552 556 } 553 557
+5 -5
drivers/acpi/acpica/nsconvert.c
··· 187 187 * Copy the raw buffer data with no transform. String is already NULL 188 188 * terminated at Length+1. 189 189 */ 190 - ACPI_MEMCPY(new_object->string.pointer, 191 - original_object->buffer.pointer, length); 190 + memcpy(new_object->string.pointer, 191 + original_object->buffer.pointer, length); 192 192 break; 193 193 194 194 default: ··· 251 251 return (AE_NO_MEMORY); 252 252 } 253 253 254 - ACPI_MEMCPY(new_object->buffer.pointer, 255 - original_object->string.pointer, 256 - original_object->string.length); 254 + memcpy(new_object->buffer.pointer, 255 + original_object->string.pointer, 256 + original_object->string.length); 257 257 break; 258 258 259 259 case ACPI_TYPE_PACKAGE:
+1 -1
drivers/acpi/acpica/nsdump.c
··· 101 101 102 102 while (num_segments) { 103 103 for (i = 0; i < 4; i++) { 104 - ACPI_IS_PRINT(pathname[i]) ? 104 + isprint((int)pathname[i]) ? 105 105 acpi_os_printf("%c", pathname[i]) : 106 106 acpi_os_printf("?"); 107 107 }
+3 -4
drivers/acpi/acpica/nseval.c
··· 59 59 * 60 60 * FUNCTION: acpi_ns_evaluate 61 61 * 62 - * PARAMETERS: info - Evaluation info block, contains: 62 + * PARAMETERS: info - Evaluation info block, contains these fields 63 + * and more: 63 64 * prefix_node - Prefix or Method/Object Node to execute 64 65 * relative_path - Name of method to execute, If NULL, the 65 66 * Node is the object to execute 66 67 * parameters - List of parameters to pass to the method, 67 68 * terminated by NULL. Params itself may be 68 69 * NULL if no parameters are being passed. 69 - * return_object - Where to put method's return value (if 70 - * any). If NULL, no value is returned. 71 70 * parameter_type - Type of Parameter list 72 71 * return_object - Where to put method's return value (if 73 72 * any). If NULL, no value is returned. ··· 439 440 440 441 /* Initialize the evaluation information block */ 441 442 442 - ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info)); 443 + memset(info, 0, sizeof(struct acpi_evaluate_info)); 443 444 info->prefix_node = parent_node; 444 445 445 446 /*
+2 -2
drivers/acpi/acpica/nsinit.c
··· 90 90 91 91 /* Set all init info to zero */ 92 92 93 - ACPI_MEMSET(&info, 0, sizeof(struct acpi_init_walk_info)); 93 + memset(&info, 0, sizeof(struct acpi_init_walk_info)); 94 94 95 95 /* Walk entire namespace from the supplied root */ 96 96 ··· 566 566 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname 567 567 (ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI)); 568 568 569 - ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info)); 569 + memset(info, 0, sizeof(struct acpi_evaluate_info)); 570 570 info->prefix_node = device_node; 571 571 info->relative_pathname = METHOD_NAME__INI; 572 572 info->parameters = NULL;
+7
drivers/acpi/acpica/nsparse.c
··· 117 117 (u8) pass_number); 118 118 } 119 119 120 + /* Found OSDT table, enable the namespace override feature */ 121 + 122 + if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_OSDT) && 123 + pass_number == ACPI_IMODE_LOAD_PASS1) { 124 + walk_state->namespace_override = TRUE; 125 + } 126 + 120 127 if (ACPI_FAILURE(status)) { 121 128 acpi_ds_delete_walk_state(walk_state); 122 129 goto cleanup;
+1 -1
drivers/acpi/acpica/nsrepair2.c
··· 580 580 * # is a hex digit. 581 581 */ 582 582 for (dest = new_string->string.pointer; *source; dest++, source++) { 583 - *dest = (char)ACPI_TOUPPER(*source); 583 + *dest = (char)toupper((int)*source); 584 584 } 585 585 586 586 acpi_ut_remove_reference(return_object);
+35 -2
drivers/acpi/acpica/nssearch.c
··· 325 325 * If we found it AND the request specifies that a find is an error, 326 326 * return the error 327 327 */ 328 - if ((status == AE_OK) && (flags & ACPI_NS_ERROR_IF_FOUND)) { 329 - status = AE_ALREADY_EXISTS; 328 + if (status == AE_OK) { 329 + 330 + /* The node was found in the namespace */ 331 + 332 + /* 333 + * If the namespace override feature is enabled for this node, 334 + * delete any existing attached sub-object and make the node 335 + * look like a new node that is owned by the override table. 336 + */ 337 + if (flags & ACPI_NS_OVERRIDE_IF_FOUND) { 338 + ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 339 + "Namespace override: %4.4s pass %u type %X Owner %X\n", 340 + ACPI_CAST_PTR(char, 341 + &target_name), 342 + interpreter_mode, 343 + (*return_node)->type, 344 + walk_state->owner_id)); 345 + 346 + acpi_ns_delete_children(*return_node); 347 + if (acpi_gbl_runtime_namespace_override) { 348 + acpi_ut_remove_reference((*return_node)->object); 349 + (*return_node)->object = NULL; 350 + (*return_node)->owner_id = 351 + walk_state->owner_id; 352 + } else { 353 + acpi_ns_remove_node(*return_node); 354 + *return_node = ACPI_ENTRY_NOT_FOUND; 355 + } 356 + } 357 + 358 + /* Return an error if we don't expect to find the object */ 359 + 360 + else if (flags & ACPI_NS_ERROR_IF_FOUND) { 361 + status = AE_ALREADY_EXISTS; 362 + } 330 363 } 331 364 #ifdef ACPI_ASL_COMPILER 332 365 if (*return_node && (*return_node)->type == ACPI_TYPE_ANY) {
+1 -2
drivers/acpi/acpica/nsutils.c
··· 292 292 } else { 293 293 /* Convert the character to uppercase and save it */ 294 294 295 - result[i] = 296 - (char)ACPI_TOUPPER((int)*external_name); 295 + result[i] = (char)toupper((int)*external_name); 297 296 external_name++; 298 297 } 299 298 }
+2 -3
drivers/acpi/acpica/nsxfeval.c
··· 696 696 return (AE_CTRL_DEPTH); 697 697 } 698 698 699 - no_match = ACPI_STRCMP(hid->string, info->hid); 699 + no_match = strcmp(hid->string, info->hid); 700 700 ACPI_FREE(hid); 701 701 702 702 if (no_match) { ··· 715 715 716 716 found = FALSE; 717 717 for (i = 0; i < cid->count; i++) { 718 - if (ACPI_STRCMP(cid->ids[i].string, info->hid) 719 - == 0) { 718 + if (strcmp(cid->ids[i].string, info->hid) == 0) { 720 719 721 720 /* Found a matching CID */ 722 721
+23 -6
drivers/acpi/acpica/nsxfname.c
··· 114 114 115 115 /* Special case for root-only, since we can't search for it */ 116 116 117 - if (!ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH)) { 117 + if (!strcmp(pathname, ACPI_NS_ROOT_PATH)) { 118 118 *ret_handle = 119 119 ACPI_CAST_PTR(acpi_handle, acpi_gbl_root_node); 120 120 return (AE_OK); ··· 242 242 243 243 /* Copy actual string and return a pointer to the next string area */ 244 244 245 - ACPI_MEMCPY(string_area, source->string, source->length); 245 + memcpy(string_area, source->string, source->length); 246 246 return (string_area + source->length); 247 247 } 248 248 ··· 260 260 * control methods (Such as in the case of a device.) 261 261 * 262 262 * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB, 263 - * _STA, _ADR, _sx_w, and _sx_d methods. 263 + * _CLS, _STA, _ADR, _sx_w, and _sx_d methods. 264 264 * 265 265 * Note: Allocates the return buffer, must be freed by the caller. 266 266 * ··· 276 276 struct acpi_pnp_device_id *hid = NULL; 277 277 struct acpi_pnp_device_id *uid = NULL; 278 278 struct acpi_pnp_device_id *sub = NULL; 279 + struct acpi_pnp_device_id *cls = NULL; 279 280 char *next_id_string; 280 281 acpi_object_type type; 281 282 acpi_name name; 282 283 u8 param_count = 0; 283 - u8 valid = 0; 284 + u16 valid = 0; 284 285 u32 info_size; 285 286 u32 i; 286 287 acpi_status status; ··· 321 320 if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) { 322 321 /* 323 322 * Get extra info for ACPI Device/Processor objects only: 324 - * Run the Device _HID, _UID, _SUB, and _CID methods. 323 + * Run the Device _HID, _UID, _SUB, _CID, and _CLS methods. 325 324 * 326 325 * Note: none of these methods are required, so they may or may 327 326 * not be present for this device. The Info->Valid bitfield is used ··· 363 362 (cid_list->list_size - 364 363 sizeof(struct acpi_pnp_device_id_list)); 365 364 valid |= ACPI_VALID_CID; 365 + } 366 + 367 + /* Execute the Device._CLS method */ 368 + 369 + status = acpi_ut_execute_CLS(node, &cls); 370 + if (ACPI_SUCCESS(status)) { 371 + info_size += cls->length; 372 + valid |= ACPI_VALID_CLS; 366 373 } 367 374 } 368 375 ··· 495 486 } 496 487 } 497 488 489 + if (cls) { 490 + next_id_string = acpi_ns_copy_device_id(&info->class_code, 491 + cls, next_id_string); 492 + } 493 + 498 494 /* Copy the fixed-length data */ 499 495 500 496 info->info_size = info_size; ··· 523 509 } 524 510 if (cid_list) { 525 511 ACPI_FREE(cid_list); 512 + } 513 + if (cls) { 514 + ACPI_FREE(cls); 526 515 } 527 516 return (status); 528 517 } ··· 637 620 638 621 /* Copy the method AML to the local buffer */ 639 622 640 - ACPI_MEMCPY(aml_buffer, aml_start, aml_length); 623 + memcpy(aml_buffer, aml_start, aml_length); 641 624 642 625 /* Initialize the method object with the new method's information */ 643 626
+3 -4
drivers/acpi/acpica/psutils.c
··· 93 93 op->common.descriptor_type = ACPI_DESC_TYPE_PARSER; 94 94 op->common.aml_opcode = opcode; 95 95 96 - ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name, 97 - (acpi_ps_get_opcode_info 98 - (opcode))->name, 99 - sizeof(op->common.aml_op_name))); 96 + ACPI_DISASM_ONLY_MEMBERS(strncpy(op->common.aml_op_name, 97 + (acpi_ps_get_opcode_info(opcode))-> 98 + name, sizeof(op->common.aml_op_name))); 100 99 } 101 100 102 101 /*******************************************************************************
+3 -3
drivers/acpi/acpica/rscreate.c
··· 353 353 /* +1 to include null terminator */ 354 354 355 355 user_prt->length += 356 - (u32) ACPI_STRLEN(user_prt->source) + 1; 356 + (u32)strlen(user_prt->source) + 1; 357 357 break; 358 358 359 359 case ACPI_TYPE_STRING: 360 360 361 - ACPI_STRCPY(user_prt->source, 362 - obj_desc->string.pointer); 361 + strcpy(user_prt->source, 362 + obj_desc->string.pointer); 363 363 364 364 /* 365 365 * Add to the Length field the length of the string
+4 -4
drivers/acpi/acpica/rsmisc.c
··· 119 119 /* 120 120 * Get the resource type and the initial (minimum) length 121 121 */ 122 - ACPI_MEMSET(resource, 0, INIT_RESOURCE_LENGTH(info)); 122 + memset(resource, 0, INIT_RESOURCE_LENGTH(info)); 123 123 resource->type = INIT_RESOURCE_TYPE(info); 124 124 resource->length = INIT_RESOURCE_LENGTH(info); 125 125 break; ··· 324 324 325 325 case ACPI_RSC_SET8: 326 326 327 - ACPI_MEMSET(destination, info->aml_offset, info->value); 327 + memset(destination, info->aml_offset, info->value); 328 328 break; 329 329 330 330 case ACPI_RSC_DATA8: 331 331 332 332 target = ACPI_ADD_PTR(char, resource, info->value); 333 - ACPI_MEMCPY(destination, source, ACPI_GET16(target)); 333 + memcpy(destination, source, ACPI_GET16(target)); 334 334 break; 335 335 336 336 case ACPI_RSC_ADDRESS: ··· 502 502 switch (info->opcode) { 503 503 case ACPI_RSC_INITSET: 504 504 505 - ACPI_MEMSET(aml, 0, INIT_RESOURCE_LENGTH(info)); 505 + memset(aml, 0, INIT_RESOURCE_LENGTH(info)); 506 506 aml_length = INIT_RESOURCE_LENGTH(info); 507 507 acpi_rs_set_resource_header(INIT_RESOURCE_TYPE(info), 508 508 aml_length, aml);
+6 -7
drivers/acpi/acpica/rsutils.c
··· 148 148 case ACPI_RSC_MOVE_SERIAL_VEN: 149 149 case ACPI_RSC_MOVE_SERIAL_RES: 150 150 151 - ACPI_MEMCPY(destination, source, item_count); 151 + memcpy(destination, source, item_count); 152 152 return; 153 153 154 154 /* ··· 364 364 * Zero the entire area of the buffer. 365 365 */ 366 366 total_length = 367 - (u32) 368 - ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) + 367 + (u32)strlen(ACPI_CAST_PTR(char, &aml_resource_source[1])) + 369 368 1; 370 - total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length); 369 + total_length = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(total_length); 371 370 372 - ACPI_MEMSET(resource_source->string_ptr, 0, total_length); 371 + memset(resource_source->string_ptr, 0, total_length); 373 372 374 373 /* Copy the resource_source string to the destination */ 375 374 ··· 431 432 432 433 /* Copy the resource_source string */ 433 434 434 - ACPI_STRCPY(ACPI_CAST_PTR(char, &aml_resource_source[1]), 435 - resource_source->string_ptr); 435 + strcpy(ACPI_CAST_PTR(char, &aml_resource_source[1]), 436 + resource_source->string_ptr); 436 437 437 438 /* 438 439 * Add the length of the string (+ 1 for null terminator) to the
+4 -4
drivers/acpi/acpica/rsxface.c
··· 398 398 399 399 /* Simple copy for 64 bit source */ 400 400 401 - ACPI_MEMCPY(out, &resource->data, 402 - sizeof(struct acpi_resource_address64)); 401 + memcpy(out, &resource->data, 402 + sizeof(struct acpi_resource_address64)); 403 403 break; 404 404 405 405 default: ··· 499 499 */ 500 500 if ((vendor->byte_length < (ACPI_UUID_LENGTH + 1)) || 501 501 (vendor->uuid_subtype != info->uuid->subtype) || 502 - (ACPI_MEMCMP(vendor->uuid, info->uuid->data, ACPI_UUID_LENGTH))) { 502 + (memcmp(vendor->uuid, info->uuid->data, ACPI_UUID_LENGTH))) { 503 503 return (AE_OK); 504 504 } 505 505 ··· 513 513 514 514 /* Found the correct resource, copy and return it */ 515 515 516 - ACPI_MEMCPY(buffer->pointer, resource, resource->length); 516 + memcpy(buffer->pointer, resource, resource->length); 517 517 buffer->length = resource->length; 518 518 519 519 /* Found the desired descriptor, terminate resource walk */
+4 -4
drivers/acpi/acpica/tbdata.c
··· 73 73 * Initialize the table descriptor. Set the pointer to NULL, since the 74 74 * table is not fully mapped at this time. 75 75 */ 76 - ACPI_MEMSET(table_desc, 0, sizeof(struct acpi_table_desc)); 76 + memset(table_desc, 0, sizeof(struct acpi_table_desc)); 77 77 table_desc->address = address; 78 78 table_desc->length = table->length; 79 79 table_desc->flags = flags; ··· 465 465 /* Copy and free the previous table array */ 466 466 467 467 if (acpi_gbl_root_table_list.tables) { 468 - ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables, 469 - (acpi_size) table_count * 470 - sizeof(struct acpi_table_desc)); 468 + memcpy(tables, acpi_gbl_root_table_list.tables, 469 + (acpi_size) table_count * 470 + sizeof(struct acpi_table_desc)); 471 471 472 472 if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) { 473 473 ACPI_FREE(acpi_gbl_root_table_list.tables);
+16 -11
drivers/acpi/acpica/tbfadt.c
··· 350 350 /* If Hardware Reduced flag is set, there is no FACS */ 351 351 352 352 if (!acpi_gbl_reduced_hardware) { 353 - acpi_tb_install_fixed_table((acpi_physical_address) 354 - acpi_gbl_FADT.Xfacs, ACPI_SIG_FACS, 355 - ACPI_TABLE_INDEX_FACS); 353 + if (acpi_gbl_FADT.facs) { 354 + acpi_tb_install_fixed_table((acpi_physical_address) 355 + acpi_gbl_FADT.facs, 356 + ACPI_SIG_FACS, 357 + ACPI_TABLE_INDEX_FACS); 358 + } 359 + if (acpi_gbl_FADT.Xfacs) { 360 + acpi_tb_install_fixed_table((acpi_physical_address) 361 + acpi_gbl_FADT.Xfacs, 362 + ACPI_SIG_FACS, 363 + ACPI_TABLE_INDEX_X_FACS); 364 + } 356 365 } 357 366 } 358 367 ··· 398 389 399 390 /* Clear the entire local FADT */ 400 391 401 - ACPI_MEMSET(&acpi_gbl_FADT, 0, sizeof(struct acpi_table_fadt)); 392 + memset(&acpi_gbl_FADT, 0, sizeof(struct acpi_table_fadt)); 402 393 403 394 /* Copy the original FADT, up to sizeof (struct acpi_table_fadt) */ 404 395 405 - ACPI_MEMCPY(&acpi_gbl_FADT, table, 406 - ACPI_MIN(length, sizeof(struct acpi_table_fadt))); 396 + memcpy(&acpi_gbl_FADT, table, 397 + ACPI_MIN(length, sizeof(struct acpi_table_fadt))); 407 398 408 399 /* Take a copy of the Hardware Reduced flag */ 409 400 ··· 500 491 acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt); 501 492 502 493 /* 503 - * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary. 494 + * Expand the 32-bit DSDT addresses to 64-bit as necessary. 504 495 * Later ACPICA code will always use the X 64-bit field. 505 496 */ 506 - acpi_gbl_FADT.Xfacs = acpi_tb_select_address("FACS", 507 - acpi_gbl_FADT.facs, 508 - acpi_gbl_FADT.Xfacs); 509 - 510 497 acpi_gbl_FADT.Xdsdt = acpi_tb_select_address("DSDT", 511 498 acpi_gbl_FADT.dsdt, 512 499 acpi_gbl_FADT.Xdsdt);
+10 -11
drivers/acpi/acpica/tbfind.c
··· 76 76 77 77 /* Normalize the input strings */ 78 78 79 - ACPI_MEMSET(&header, 0, sizeof(struct acpi_table_header)); 79 + memset(&header, 0, sizeof(struct acpi_table_header)); 80 80 ACPI_MOVE_NAME(header.signature, signature); 81 - ACPI_STRNCPY(header.oem_id, oem_id, ACPI_OEM_ID_SIZE); 82 - ACPI_STRNCPY(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE); 81 + strncpy(header.oem_id, oem_id, ACPI_OEM_ID_SIZE); 82 + strncpy(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE); 83 83 84 84 /* Search for the table */ 85 85 86 86 for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) { 87 - if (ACPI_MEMCMP(&(acpi_gbl_root_table_list.tables[i].signature), 88 - header.signature, ACPI_NAME_SIZE)) { 87 + if (memcmp(&(acpi_gbl_root_table_list.tables[i].signature), 88 + header.signature, ACPI_NAME_SIZE)) { 89 89 90 90 /* Not the requested table */ 91 91 ··· 112 112 113 113 /* Check for table match on all IDs */ 114 114 115 - if (!ACPI_MEMCMP 115 + if (!memcmp 116 116 (acpi_gbl_root_table_list.tables[i].pointer->signature, 117 117 header.signature, ACPI_NAME_SIZE) && (!oem_id[0] 118 118 || 119 - !ACPI_MEMCMP 119 + !memcmp 120 120 (acpi_gbl_root_table_list. 121 121 tables[i].pointer-> 122 122 oem_id, 123 123 header.oem_id, 124 124 ACPI_OEM_ID_SIZE)) 125 125 && (!oem_table_id[0] 126 - || !ACPI_MEMCMP(acpi_gbl_root_table_list.tables[i]. 127 - pointer->oem_table_id, 128 - header.oem_table_id, 129 - ACPI_OEM_TABLE_ID_SIZE))) { 126 + || !memcmp(acpi_gbl_root_table_list.tables[i].pointer-> 127 + oem_table_id, header.oem_table_id, 128 + ACPI_OEM_TABLE_ID_SIZE))) { 130 129 *table_index = i; 131 130 132 131 ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
+3 -4
drivers/acpi/acpica/tbinstal.c
··· 87 87 * not just the header. 88 88 */ 89 89 is_identical = (u8)((table_desc->length != table_length || 90 - ACPI_MEMCMP(table_desc->pointer, table, 91 - table_length)) ? FALSE : TRUE); 90 + memcmp(table_desc->pointer, table, table_length)) ? 91 + FALSE : TRUE); 92 92 93 93 /* Release the acquired table */ 94 94 ··· 289 289 if ((new_table_desc.signature.ascii[0] != 0x00) && 290 290 (!ACPI_COMPARE_NAME 291 291 (&new_table_desc.signature, ACPI_SIG_SSDT)) 292 - && (ACPI_STRNCMP(new_table_desc.signature.ascii, "OEM", 3))) 293 - { 292 + && (strncmp(new_table_desc.signature.ascii, "OEM", 3))) { 294 293 ACPI_BIOS_ERROR((AE_INFO, 295 294 "Table has invalid signature [%4.4s] (0x%8.8X), " 296 295 "must be SSDT or OEMx",
+5 -5
drivers/acpi/acpica/tbprint.c
··· 73 73 { 74 74 75 75 while (length && *string) { 76 - if (!ACPI_IS_PRINT(*string)) { 76 + if (!isprint((int)*string)) { 77 77 *string = '?'; 78 78 } 79 79 string++; ··· 100 100 struct acpi_table_header *header) 101 101 { 102 102 103 - ACPI_MEMCPY(out_header, header, sizeof(struct acpi_table_header)); 103 + memcpy(out_header, header, sizeof(struct acpi_table_header)); 104 104 105 105 acpi_tb_fix_string(out_header->signature, ACPI_NAME_SIZE); 106 106 acpi_tb_fix_string(out_header->oem_id, ACPI_OEM_ID_SIZE); ··· 138 138 139 139 /* RSDP has no common fields */ 140 140 141 - ACPI_MEMCPY(local_header.oem_id, 142 - ACPI_CAST_PTR(struct acpi_table_rsdp, 143 - header)->oem_id, ACPI_OEM_ID_SIZE); 141 + memcpy(local_header.oem_id, 142 + ACPI_CAST_PTR(struct acpi_table_rsdp, header)->oem_id, 143 + ACPI_OEM_ID_SIZE); 144 144 acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE); 145 145 146 146 ACPI_INFO((AE_INFO, "RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)",
+25 -12
drivers/acpi/acpica/tbutils.c
··· 68 68 69 69 acpi_status acpi_tb_initialize_facs(void) 70 70 { 71 - acpi_status status; 72 71 73 72 /* If Hardware Reduced flag is set, there is no FACS */ 74 73 ··· 76 77 return (AE_OK); 77 78 } 78 79 79 - status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, 80 - ACPI_CAST_INDIRECT_PTR(struct 81 - acpi_table_header, 82 - &acpi_gbl_FACS)); 83 - return (status); 80 + (void)acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, 81 + ACPI_CAST_INDIRECT_PTR(struct 82 + acpi_table_header, 83 + &acpi_gbl_facs32)); 84 + (void)acpi_get_table_by_index(ACPI_TABLE_INDEX_X_FACS, 85 + ACPI_CAST_INDIRECT_PTR(struct 86 + acpi_table_header, 87 + &acpi_gbl_facs64)); 88 + 89 + if (acpi_gbl_facs64 90 + && (!acpi_gbl_facs32 || !acpi_gbl_use32_bit_facs_addresses)) { 91 + acpi_gbl_FACS = acpi_gbl_facs64; 92 + } else if (acpi_gbl_facs32) { 93 + acpi_gbl_FACS = acpi_gbl_facs32; 94 + } 95 + 96 + /* If there is no FACS, just continue. There was already an error msg */ 97 + 98 + return (AE_OK); 84 99 } 85 100 #endif /* !ACPI_REDUCED_HARDWARE */ 86 101 ··· 114 101 u8 acpi_tb_tables_loaded(void) 115 102 { 116 103 117 - if (acpi_gbl_root_table_list.current_table_count >= 3) { 104 + if (acpi_gbl_root_table_list.current_table_count >= 4) { 118 105 return (TRUE); 119 106 } 120 107 ··· 188 175 return (NULL); 189 176 } 190 177 191 - ACPI_MEMCPY(new_table, table_desc->pointer, table_desc->length); 178 + memcpy(new_table, table_desc->pointer, table_desc->length); 192 179 acpi_tb_uninstall_table(table_desc); 193 180 194 181 acpi_tb_init_table_descriptor(&acpi_gbl_root_table_list. ··· 370 357 table_entry = ACPI_ADD_PTR(u8, table, sizeof(struct acpi_table_header)); 371 358 372 359 /* 373 - * First two entries in the table array are reserved for the DSDT 374 - * and FACS, which are not actually present in the RSDT/XSDT - they 375 - * come from the FADT 360 + * First three entries in the table array are reserved for the DSDT 361 + * and 32bit/64bit FACS, which are not actually present in the 362 + * RSDT/XSDT - they come from the FADT 376 363 */ 377 - acpi_gbl_root_table_list.current_table_count = 2; 364 + acpi_gbl_root_table_list.current_table_count = 3; 378 365 379 366 /* Initialize the root table array from the RSDT/XSDT */ 380 367
+9 -8
drivers/acpi/acpica/tbxface.c
··· 119 119 } else { 120 120 /* Root Table Array has been statically allocated by the host */ 121 121 122 - ACPI_MEMSET(initial_table_array, 0, 123 - (acpi_size) initial_table_count * 124 - sizeof(struct acpi_table_desc)); 122 + memset(initial_table_array, 0, 123 + (acpi_size) initial_table_count * 124 + sizeof(struct acpi_table_desc)); 125 125 126 126 acpi_gbl_root_table_list.tables = initial_table_array; 127 127 acpi_gbl_root_table_list.max_table_count = initial_table_count; ··· 242 242 if (!header) { 243 243 return (AE_NO_MEMORY); 244 244 } 245 - ACPI_MEMCPY(out_table_header, header, 246 - sizeof(struct acpi_table_header)); 245 + 246 + memcpy(out_table_header, header, 247 + sizeof(struct acpi_table_header)); 247 248 acpi_os_unmap_memory(header, 248 249 sizeof(struct 249 250 acpi_table_header)); ··· 252 251 return (AE_NOT_FOUND); 253 252 } 254 253 } else { 255 - ACPI_MEMCPY(out_table_header, 256 - acpi_gbl_root_table_list.tables[i].pointer, 257 - sizeof(struct acpi_table_header)); 254 + memcpy(out_table_header, 255 + acpi_gbl_root_table_list.tables[i].pointer, 256 + sizeof(struct acpi_table_header)); 258 257 } 259 258 return (AE_OK); 260 259 }
+11 -6
drivers/acpi/acpica/tbxfload.c
··· 150 150 * Save the original DSDT header for detection of table corruption 151 151 * and/or replacement of the DSDT from outside the OS. 152 152 */ 153 - ACPI_MEMCPY(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT, 154 - sizeof(struct acpi_table_header)); 153 + memcpy(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT, 154 + sizeof(struct acpi_table_header)); 155 155 156 156 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); 157 157 ··· 166 166 167 167 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); 168 168 for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) { 169 - if ((!ACPI_COMPARE_NAME 169 + if (!acpi_gbl_root_table_list.tables[i].address || 170 + (!ACPI_COMPARE_NAME 170 171 (&(acpi_gbl_root_table_list.tables[i].signature), 171 172 ACPI_SIG_SSDT) 172 173 && 173 174 !ACPI_COMPARE_NAME(& 174 175 (acpi_gbl_root_table_list.tables[i]. 175 - signature), ACPI_SIG_PSDT)) 176 + signature), ACPI_SIG_PSDT) 177 + && 178 + !ACPI_COMPARE_NAME(& 179 + (acpi_gbl_root_table_list.tables[i]. 180 + signature), ACPI_SIG_OSDT)) 176 181 || 177 182 ACPI_FAILURE(acpi_tb_validate_table 178 183 (&acpi_gbl_root_table_list.tables[i]))) { ··· 224 219 ACPI_FUNCTION_TRACE(acpi_install_table); 225 220 226 221 if (physical) { 227 - flags = ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL; 228 - } else { 229 222 flags = ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL; 223 + } else { 224 + flags = ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL; 230 225 } 231 226 232 227 status = acpi_tb_install_standard_table(address, flags,
+3 -3
drivers/acpi/acpica/utalloc.c
··· 73 73 74 74 /* Clear the memory block */ 75 75 76 - ACPI_MEMSET(allocation, 0, size); 76 + memset(allocation, 0, size); 77 77 } 78 78 79 79 return (allocation); ··· 181 181 char buffer[7]; 182 182 183 183 if (acpi_gbl_display_final_mem_stats) { 184 - ACPI_STRCPY(buffer, "MEMORY"); 184 + strcpy(buffer, "MEMORY"); 185 185 (void)acpi_db_display_statistics(buffer); 186 186 } 187 187 #endif ··· 337 337 338 338 /* Have a valid buffer, clear it */ 339 339 340 - ACPI_MEMSET(buffer->pointer, 0, required_length); 340 + memset(buffer->pointer, 0, required_length); 341 341 return (AE_OK); 342 342 }
+2 -2
drivers/acpi/acpica/utbuffer.c
··· 159 159 } 160 160 161 161 buf_char = buffer[(acpi_size) i + j]; 162 - if (ACPI_IS_PRINT(buf_char)) { 162 + if (isprint(buf_char)) { 163 163 acpi_os_printf("%c", buf_char); 164 164 } else { 165 165 acpi_os_printf("."); ··· 319 319 } 320 320 321 321 buf_char = buffer[(acpi_size) i + j]; 322 - if (ACPI_IS_PRINT(buf_char)) { 322 + if (isprint(buf_char)) { 323 323 acpi_ut_file_printf(file, "%c", buf_char); 324 324 } else { 325 325 acpi_ut_file_printf(file, ".");
+3 -3
drivers/acpi/acpica/utcache.c
··· 84 84 85 85 /* Populate the cache object and return it */ 86 86 87 - ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); 87 + memset(cache, 0, sizeof(struct acpi_memory_list)); 88 88 cache->list_name = cache_name; 89 89 cache->object_size = object_size; 90 90 cache->max_depth = max_depth; ··· 212 212 213 213 /* Mark the object as cached */ 214 214 215 - ACPI_MEMSET(object, 0xCA, cache->object_size); 215 + memset(object, 0xCA, cache->object_size); 216 216 ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_CACHED); 217 217 218 218 /* Put the object at the head of the cache list */ ··· 281 281 282 282 /* Clear (zero) the previously used Object */ 283 283 284 - ACPI_MEMSET(object, 0, cache->object_size); 284 + memset(object, 0, cache->object_size); 285 285 } else { 286 286 /* The cache is empty, create a new object */ 287 287
+21 -21
drivers/acpi/acpica/utcopy.c
··· 129 129 130 130 /* Always clear the external object */ 131 131 132 - ACPI_MEMSET(external_object, 0, sizeof(union acpi_object)); 132 + memset(external_object, 0, sizeof(union acpi_object)); 133 133 134 134 /* 135 135 * In general, the external object will be the same type as ··· 149 149 string. 150 150 length + 1); 151 151 152 - ACPI_MEMCPY((void *)data_space, 153 - (void *)internal_object->string.pointer, 154 - (acpi_size) internal_object->string.length + 1); 152 + memcpy((void *)data_space, 153 + (void *)internal_object->string.pointer, 154 + (acpi_size) internal_object->string.length + 1); 155 155 break; 156 156 157 157 case ACPI_TYPE_BUFFER: ··· 162 162 ACPI_ROUND_UP_TO_NATIVE_WORD(internal_object->string. 163 163 length); 164 164 165 - ACPI_MEMCPY((void *)data_space, 166 - (void *)internal_object->buffer.pointer, 167 - internal_object->buffer.length); 165 + memcpy((void *)data_space, 166 + (void *)internal_object->buffer.pointer, 167 + internal_object->buffer.length); 168 168 break; 169 169 170 170 case ACPI_TYPE_INTEGER: ··· 502 502 goto error_exit; 503 503 } 504 504 505 - ACPI_MEMCPY(internal_object->string.pointer, 506 - external_object->string.pointer, 507 - external_object->string.length); 505 + memcpy(internal_object->string.pointer, 506 + external_object->string.pointer, 507 + external_object->string.length); 508 508 509 509 internal_object->string.length = external_object->string.length; 510 510 break; ··· 517 517 goto error_exit; 518 518 } 519 519 520 - ACPI_MEMCPY(internal_object->buffer.pointer, 521 - external_object->buffer.pointer, 522 - external_object->buffer.length); 520 + memcpy(internal_object->buffer.pointer, 521 + external_object->buffer.pointer, 522 + external_object->buffer.length); 523 523 524 524 internal_object->buffer.length = external_object->buffer.length; 525 525 ··· 694 694 copy_size = sizeof(struct acpi_namespace_node); 695 695 } 696 696 697 - ACPI_MEMCPY(ACPI_CAST_PTR(char, dest_desc), 698 - ACPI_CAST_PTR(char, source_desc), copy_size); 697 + memcpy(ACPI_CAST_PTR(char, dest_desc), 698 + ACPI_CAST_PTR(char, source_desc), copy_size); 699 699 700 700 /* Restore the saved fields */ 701 701 ··· 725 725 726 726 /* Copy the actual buffer data */ 727 727 728 - ACPI_MEMCPY(dest_desc->buffer.pointer, 729 - source_desc->buffer.pointer, 730 - source_desc->buffer.length); 728 + memcpy(dest_desc->buffer.pointer, 729 + source_desc->buffer.pointer, 730 + source_desc->buffer.length); 731 731 } 732 732 break; 733 733 ··· 747 747 748 748 /* Copy the actual string data */ 749 749 750 - ACPI_MEMCPY(dest_desc->string.pointer, 751 - source_desc->string.pointer, 752 - (acpi_size) source_desc->string.length + 1); 750 + memcpy(dest_desc->string.pointer, 751 + source_desc->string.pointer, 752 + (acpi_size) source_desc->string.length + 1); 753 753 } 754 754 break; 755 755
+2 -2
drivers/acpi/acpica/utdebug.c
··· 111 111 * RETURN: Updated pointer to the function name 112 112 * 113 113 * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. 114 - * This allows compiler macros such as __func__ to be used with no 115 - * change to the debug output. 114 + * This allows compiler macros such as __func__ to be used 115 + * with no change to the debug output. 116 116 * 117 117 ******************************************************************************/ 118 118
+10 -3
drivers/acpi/acpica/utglobal.c
··· 102 102 {"_SB_", ACPI_TYPE_DEVICE, NULL}, 103 103 {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, 104 104 {"_TZ_", ACPI_TYPE_DEVICE, NULL}, 105 - {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, 105 + /* 106 + * March, 2015: 107 + * The _REV object is in the process of being deprecated, because 108 + * other ACPI implementations permanently return 2. Thus, it 109 + * has little or no value. Return 2 for compatibility with 110 + * other ACPI implementations. 111 + */ 112 + {"_REV", ACPI_TYPE_INTEGER, ACPI_CAST_PTR(char, 2)}, 106 113 {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, 107 - {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, 114 + {"_GL_", ACPI_TYPE_MUTEX, ACPI_CAST_PTR(char, 1)}, 108 115 109 116 #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) 110 - {"_OSI", ACPI_TYPE_METHOD, (char *)1}, 117 + {"_OSI", ACPI_TYPE_METHOD, ACPI_CAST_PTR(char, 1)}, 111 118 #endif 112 119 113 120 /* Table terminator */
+94 -6
drivers/acpi/acpica/utids.c
··· 1 1 /****************************************************************************** 2 2 * 3 - * Module Name: utids - support for device Ids - HID, UID, CID 3 + * Module Name: utids - support for device Ids - HID, UID, CID, SUB, CLS 4 4 * 5 5 *****************************************************************************/ 6 6 ··· 111 111 if (obj_desc->common.type == ACPI_TYPE_INTEGER) { 112 112 acpi_ex_eisa_id_to_string(hid->string, obj_desc->integer.value); 113 113 } else { 114 - ACPI_STRCPY(hid->string, obj_desc->string.pointer); 114 + strcpy(hid->string, obj_desc->string.pointer); 115 115 } 116 116 117 117 hid->length = length; ··· 180 180 181 181 /* Simply copy existing string */ 182 182 183 - ACPI_STRCPY(sub->string, obj_desc->string.pointer); 183 + strcpy(sub->string, obj_desc->string.pointer); 184 184 sub->length = length; 185 185 *return_id = sub; 186 186 ··· 256 256 if (obj_desc->common.type == ACPI_TYPE_INTEGER) { 257 257 acpi_ex_integer_to_string(uid->string, obj_desc->integer.value); 258 258 } else { 259 - ACPI_STRCPY(uid->string, obj_desc->string.pointer); 259 + strcpy(uid->string, obj_desc->string.pointer); 260 260 } 261 261 262 262 uid->length = length; ··· 393 393 394 394 /* Copy the String CID from the returned object */ 395 395 396 - ACPI_STRCPY(next_id_string, 397 - cid_objects[i]->string.pointer); 396 + strcpy(next_id_string, cid_objects[i]->string.pointer); 398 397 length = cid_objects[i]->string.length + 1; 399 398 } 400 399 ··· 411 412 cleanup: 412 413 413 414 /* On exit, we must delete the _CID return object */ 415 + 416 + acpi_ut_remove_reference(obj_desc); 417 + return_ACPI_STATUS(status); 418 + } 419 + 420 + /******************************************************************************* 421 + * 422 + * FUNCTION: acpi_ut_execute_CLS 423 + * 424 + * PARAMETERS: device_node - Node for the device 425 + * return_id - Where the _CLS is returned 426 + * 427 + * RETURN: Status 428 + * 429 + * DESCRIPTION: Executes the _CLS control method that returns PCI-defined 430 + * class code of the device. The _CLS value is always a package 431 + * containing PCI class information as a list of integers. 432 + * The returned string has format "BBSSPP", where: 433 + * BB = Base-class code 434 + * SS = Sub-class code 435 + * PP = Programming Interface code 436 + * 437 + ******************************************************************************/ 438 + 439 + acpi_status 440 + acpi_ut_execute_CLS(struct acpi_namespace_node *device_node, 441 + struct acpi_pnp_device_id **return_id) 442 + { 443 + union acpi_operand_object *obj_desc; 444 + union acpi_operand_object **cls_objects; 445 + u32 count; 446 + struct acpi_pnp_device_id *cls; 447 + u32 length; 448 + acpi_status status; 449 + u8 class_code[3] = { 0, 0, 0 }; 450 + 451 + ACPI_FUNCTION_TRACE(ut_execute_CLS); 452 + 453 + status = acpi_ut_evaluate_object(device_node, METHOD_NAME__CLS, 454 + ACPI_BTYPE_PACKAGE, &obj_desc); 455 + if (ACPI_FAILURE(status)) { 456 + return_ACPI_STATUS(status); 457 + } 458 + 459 + /* Get the size of the String to be returned, includes null terminator */ 460 + 461 + length = ACPI_PCICLS_STRING_SIZE; 462 + cls_objects = obj_desc->package.elements; 463 + count = obj_desc->package.count; 464 + 465 + if (obj_desc->common.type == ACPI_TYPE_PACKAGE) { 466 + if (count > 0 467 + && cls_objects[0]->common.type == ACPI_TYPE_INTEGER) { 468 + class_code[0] = (u8)cls_objects[0]->integer.value; 469 + } 470 + if (count > 1 471 + && cls_objects[1]->common.type == ACPI_TYPE_INTEGER) { 472 + class_code[1] = (u8)cls_objects[1]->integer.value; 473 + } 474 + if (count > 2 475 + && cls_objects[2]->common.type == ACPI_TYPE_INTEGER) { 476 + class_code[2] = (u8)cls_objects[2]->integer.value; 477 + } 478 + } 479 + 480 + /* Allocate a buffer for the CLS */ 481 + 482 + cls = 483 + ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) + 484 + (acpi_size) length); 485 + if (!cls) { 486 + status = AE_NO_MEMORY; 487 + goto cleanup; 488 + } 489 + 490 + /* Area for the string starts after PNP_DEVICE_ID struct */ 491 + 492 + cls->string = 493 + ACPI_ADD_PTR(char, cls, sizeof(struct acpi_pnp_device_id)); 494 + 495 + /* Simply copy existing string */ 496 + 497 + acpi_ex_pci_cls_to_string(cls->string, class_code); 498 + cls->length = length; 499 + *return_id = cls; 500 + 501 + cleanup: 502 + 503 + /* On exit, we must delete the return object */ 414 504 415 505 acpi_ut_remove_reference(obj_desc); 416 506 return_ACPI_STATUS(status);
+5 -4
drivers/acpi/acpica/utmisc.c
··· 66 66 * Check if this is a PCI root bridge. 67 67 * ACPI 3.0+: check for a PCI Express root also. 68 68 */ 69 - if (!(ACPI_STRCMP(id, 70 - PCI_ROOT_HID_STRING)) || 71 - !(ACPI_STRCMP(id, PCI_EXPRESS_ROOT_HID_STRING))) { 69 + if (!(strcmp(id, 70 + PCI_ROOT_HID_STRING)) || 71 + !(strcmp(id, PCI_EXPRESS_ROOT_HID_STRING))) { 72 72 return (TRUE); 73 73 } 74 74 ··· 97 97 98 98 if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) || 99 99 ACPI_COMPARE_NAME(table->signature, ACPI_SIG_PSDT) || 100 - ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) { 100 + ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT) || 101 + ACPI_COMPARE_NAME(table->signature, ACPI_SIG_OSDT)) { 101 102 return (TRUE); 102 103 } 103 104
+4 -5
drivers/acpi/acpica/utosi.c
··· 232 232 return (AE_NO_MEMORY); 233 233 } 234 234 235 - interface_info->name = 236 - ACPI_ALLOCATE_ZEROED(ACPI_STRLEN(interface_name) + 1); 235 + interface_info->name = ACPI_ALLOCATE_ZEROED(strlen(interface_name) + 1); 237 236 if (!interface_info->name) { 238 237 ACPI_FREE(interface_info); 239 238 return (AE_NO_MEMORY); ··· 240 241 241 242 /* Initialize new info and insert at the head of the global list */ 242 243 243 - ACPI_STRCPY(interface_info->name, interface_name); 244 + strcpy(interface_info->name, interface_name); 244 245 interface_info->flags = ACPI_OSI_DYNAMIC; 245 246 interface_info->next = acpi_gbl_supported_interfaces; 246 247 ··· 268 269 269 270 previous_interface = next_interface = acpi_gbl_supported_interfaces; 270 271 while (next_interface) { 271 - if (!ACPI_STRCMP(interface_name, next_interface->name)) { 272 + if (!strcmp(interface_name, next_interface->name)) { 272 273 273 274 /* Found: name is in either the static list or was added at runtime */ 274 275 ··· 372 373 373 374 next_interface = acpi_gbl_supported_interfaces; 374 375 while (next_interface) { 375 - if (!ACPI_STRCMP(interface_name, next_interface->name)) { 376 + if (!strcmp(interface_name, next_interface->name)) { 376 377 return (next_interface); 377 378 } 378 379
+2 -2
drivers/acpi/acpica/utpredef.c
··· 148 148 u32 j; 149 149 150 150 if (!expected_btypes) { 151 - ACPI_STRCPY(buffer, "NONE"); 151 + strcpy(buffer, "NONE"); 152 152 return; 153 153 } 154 154 ··· 161 161 /* If one of the expected types, concatenate the name of this type */ 162 162 163 163 if (expected_btypes & this_rtype) { 164 - ACPI_STRCAT(buffer, &ut_rtype_names[i][j]); 164 + strcat(buffer, &ut_rtype_names[i][j]); 165 165 j = 0; /* Use name separator from now on */ 166 166 } 167 167
+3 -3
drivers/acpi/acpica/utprint.c
··· 180 180 { 181 181 u64 number = 0; 182 182 183 - while (ACPI_IS_DIGIT(*string)) { 183 + while (isdigit((int)*string)) { 184 184 number *= 10; 185 185 number += *(string++) - '0'; 186 186 } ··· 405 405 /* Process width */ 406 406 407 407 width = -1; 408 - if (ACPI_IS_DIGIT(*format)) { 408 + if (isdigit((int)*format)) { 409 409 format = acpi_ut_scan_number(format, &number); 410 410 width = (s32) number; 411 411 } else if (*format == '*') { ··· 422 422 precision = -1; 423 423 if (*format == '.') { 424 424 ++format; 425 - if (ACPI_IS_DIGIT(*format)) { 425 + if (isdigit((int)*format)) { 426 426 format = acpi_ut_scan_number(format, &number); 427 427 precision = (s32) number; 428 428 } else if (*format == '*') {
+16 -17
drivers/acpi/acpica/utstring.c
··· 79 79 /* Walk entire string, lowercasing the letters */ 80 80 81 81 for (string = src_string; *string; string++) { 82 - *string = (char)ACPI_TOLOWER(*string); 82 + *string = (char)tolower((int)*string); 83 83 } 84 84 85 85 return; ··· 145 145 /* Walk entire string, uppercasing the letters */ 146 146 147 147 for (string = src_string; *string; string++) { 148 - *string = (char)ACPI_TOUPPER(*string); 148 + *string = (char)toupper((int)*string); 149 149 } 150 150 151 151 return; ··· 202 202 203 203 /* Skip over any white space in the buffer */ 204 204 205 - while ((*string) && (ACPI_IS_SPACE(*string) || *string == '\t')) { 205 + while ((*string) && (isspace((int)*string) || *string == '\t')) { 206 206 string++; 207 207 } 208 208 ··· 211 211 * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'. 212 212 * We need to determine if it is decimal or hexadecimal. 213 213 */ 214 - if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { 214 + if ((*string == '0') && (tolower((int)*(string + 1)) == 'x')) { 215 215 sign_of0x = 1; 216 216 base = 16; 217 217 ··· 224 224 225 225 /* Any string left? Check that '0x' is not followed by white space. */ 226 226 227 - if (!(*string) || ACPI_IS_SPACE(*string) || *string == '\t') { 227 + if (!(*string) || isspace((int)*string) || *string == '\t') { 228 228 if (to_integer_op) { 229 229 goto error_exit; 230 230 } else { ··· 241 241 /* Main loop: convert the string to a 32- or 64-bit integer */ 242 242 243 243 while (*string) { 244 - if (ACPI_IS_DIGIT(*string)) { 244 + if (isdigit((int)*string)) { 245 245 246 246 /* Convert ASCII 0-9 to Decimal value */ 247 247 ··· 252 252 253 253 term = 1; 254 254 } else { 255 - this_digit = (u8)ACPI_TOUPPER(*string); 256 - if (ACPI_IS_XDIGIT((char)this_digit)) { 255 + this_digit = (u8)toupper((int)*string); 256 + if (isxdigit((int)this_digit)) { 257 257 258 258 /* Convert ASCII Hex char to value */ 259 259 ··· 404 404 405 405 /* Check for printable character or hex escape */ 406 406 407 - if (ACPI_IS_PRINT(string[i])) { 407 + if (isprint((int)string[i])) { 408 408 /* This is a normal character */ 409 409 410 410 acpi_os_printf("%c", (int)string[i]); ··· 609 609 u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source) 610 610 { 611 611 612 - if (ACPI_STRLEN(source) >= dest_size) { 612 + if (strlen(source) >= dest_size) { 613 613 return (TRUE); 614 614 } 615 615 616 - ACPI_STRCPY(dest, source); 616 + strcpy(dest, source); 617 617 return (FALSE); 618 618 } 619 619 620 620 u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source) 621 621 { 622 622 623 - if ((ACPI_STRLEN(dest) + ACPI_STRLEN(source)) >= dest_size) { 623 + if ((strlen(dest) + strlen(source)) >= dest_size) { 624 624 return (TRUE); 625 625 } 626 626 627 - ACPI_STRCAT(dest, source); 627 + strcat(dest, source); 628 628 return (FALSE); 629 629 } 630 630 ··· 635 635 { 636 636 acpi_size actual_transfer_length; 637 637 638 - actual_transfer_length = 639 - ACPI_MIN(max_transfer_length, ACPI_STRLEN(source)); 638 + actual_transfer_length = ACPI_MIN(max_transfer_length, strlen(source)); 640 639 641 - if ((ACPI_STRLEN(dest) + actual_transfer_length) >= dest_size) { 640 + if ((strlen(dest) + actual_transfer_length) >= dest_size) { 642 641 return (TRUE); 643 642 } 644 643 645 - ACPI_STRNCAT(dest, source, max_transfer_length); 644 + strncat(dest, source, max_transfer_length); 646 645 return (FALSE); 647 646 } 648 647 #endif
+4 -4
drivers/acpi/acpica/uttrack.c
··· 100 100 return (AE_NO_MEMORY); 101 101 } 102 102 103 - ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); 103 + memset(cache, 0, sizeof(struct acpi_memory_list)); 104 104 105 105 cache->list_name = list_name; 106 106 cache->object_size = object_size; ··· 402 402 allocation->component = component; 403 403 allocation->line = line; 404 404 405 - ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME); 405 + strncpy(allocation->module, module, ACPI_MAX_MODULE_NAME); 406 406 allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0; 407 407 408 408 if (!element) { ··· 497 497 498 498 /* Mark the segment as deleted */ 499 499 500 - ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size); 500 + memset(&allocation->user_space, 0xEA, allocation->size); 501 501 502 502 status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); 503 503 return (status); ··· 595 595 while (element) { 596 596 if ((element->component & component) && 597 597 ((module == NULL) 598 - || (0 == ACPI_STRCMP(module, element->module)))) { 598 + || (0 == strcmp(module, element->module)))) { 599 599 descriptor = 600 600 ACPI_CAST_PTR(union acpi_descriptor, 601 601 &element->user_space);
+4 -4
drivers/acpi/acpica/utxface.c
··· 234 234 stats->sci_count = acpi_sci_count; 235 235 stats->gpe_count = acpi_gpe_count; 236 236 237 - ACPI_MEMCPY(stats->fixed_event_count, acpi_fixed_event_count, 238 - sizeof(acpi_fixed_event_count)); 237 + memcpy(stats->fixed_event_count, acpi_fixed_event_count, 238 + sizeof(acpi_fixed_event_count)); 239 239 240 240 /* Other counters */ 241 241 ··· 322 322 323 323 /* Parameter validation */ 324 324 325 - if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) { 325 + if (!interface_name || (strlen(interface_name) == 0)) { 326 326 return (AE_BAD_PARAMETER); 327 327 } 328 328 ··· 374 374 375 375 /* Parameter validation */ 376 376 377 - if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) { 377 + if (!interface_name || (strlen(interface_name) == 0)) { 378 378 return (AE_BAD_PARAMETER); 379 379 } 380 380
+6 -4
drivers/acpi/acpica/utxfinit.c
··· 179 179 * Obtain a permanent mapping for the FACS. This is required for the 180 180 * Global Lock and the Firmware Waking Vector 181 181 */ 182 - status = acpi_tb_initialize_facs(); 183 - if (ACPI_FAILURE(status)) { 184 - ACPI_WARNING((AE_INFO, "Could not map the FACS table")); 185 - return_ACPI_STATUS(status); 182 + if (!(flags & ACPI_NO_FACS_INIT)) { 183 + status = acpi_tb_initialize_facs(); 184 + if (ACPI_FAILURE(status)) { 185 + ACPI_WARNING((AE_INFO, "Could not map the FACS table")); 186 + return_ACPI_STATUS(status); 187 + } 186 188 } 187 189 #endif /* !ACPI_REDUCED_HARDWARE */ 188 190
+26
drivers/acpi/blacklist.c
··· 162 162 acpi_osi_setup("!Windows 2012"); 163 163 return 0; 164 164 } 165 + #ifdef CONFIG_ACPI_REV_OVERRIDE_POSSIBLE 166 + static int __init dmi_enable_rev_override(const struct dmi_system_id *d) 167 + { 168 + printk(KERN_NOTICE PREFIX "DMI detected: %s (force ACPI _REV to 5)\n", 169 + d->ident); 170 + acpi_rev_override_setup(NULL); 171 + return 0; 172 + } 173 + #endif 165 174 166 175 static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { 167 176 { ··· 334 325 DMI_MATCH(DMI_PRODUCT_NAME, "1015PX"), 335 326 }, 336 327 }, 328 + 329 + #ifdef CONFIG_ACPI_REV_OVERRIDE_POSSIBLE 330 + /* 331 + * DELL XPS 13 (2015) switches sound between HDA and I2S 332 + * depending on the ACPI _REV callback. If userspace supports 333 + * I2S sufficiently (or if you do not care about sound), you 334 + * can safely disable this quirk. 335 + */ 336 + { 337 + .callback = dmi_enable_rev_override, 338 + .ident = "DELL XPS 13 (2015)", 339 + .matches = { 340 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), 341 + DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9343"), 342 + }, 343 + }, 344 + #endif 337 345 {} 338 346 }; 339 347
+1
drivers/acpi/internal.h
··· 58 58 #else 59 59 static inline void acpi_cmos_rtc_init(void) {} 60 60 #endif 61 + int acpi_rev_override_setup(char *str); 61 62 62 63 extern bool acpi_force_hot_remove; 63 64
+18
drivers/acpi/osl.c
··· 530 530 } 531 531 #endif 532 532 533 + #ifdef CONFIG_ACPI_REV_OVERRIDE_POSSIBLE 534 + static bool acpi_rev_override; 535 + 536 + int __init acpi_rev_override_setup(char *str) 537 + { 538 + acpi_rev_override = true; 539 + return 1; 540 + } 541 + __setup("acpi_rev_override", acpi_rev_override_setup); 542 + #else 543 + #define acpi_rev_override false 544 + #endif 545 + 533 546 #define ACPI_MAX_OVERRIDE_LEN 100 534 547 535 548 static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN]; ··· 559 546 printk(KERN_INFO PREFIX "Overriding _OS definition to '%s'\n", 560 547 acpi_os_name); 561 548 *new_val = acpi_os_name; 549 + } 550 + 551 + if (!memcmp(init_val->name, "_REV", 4) && acpi_rev_override) { 552 + printk(KERN_INFO PREFIX "Overriding _REV return value to 5\n"); 553 + *new_val = (char *)5; 562 554 } 563 555 564 556 return AE_OK;
+1
include/acpi/acnames.h
··· 51 51 #define METHOD_NAME__BBN "_BBN" 52 52 #define METHOD_NAME__CBA "_CBA" 53 53 #define METHOD_NAME__CID "_CID" 54 + #define METHOD_NAME__CLS "_CLS" 54 55 #define METHOD_NAME__CRS "_CRS" 55 56 #define METHOD_NAME__DDN "_DDN" 56 57 #define METHOD_NAME__HID "_HID"
+11 -2
include/acpi/acoutput.h
··· 294 294 295 295 /* DEBUG_PRINT functions */ 296 296 297 - #define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist 298 - #define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist 297 + #ifndef COMPILER_VA_MACRO 298 + 299 + #define ACPI_DEBUG_PRINT(plist) acpi_debug_print plist 300 + #define ACPI_DEBUG_PRINT_RAW(plist) acpi_debug_print_raw plist 301 + 302 + #else 299 303 300 304 /* Helper macros for DEBUG_PRINT */ 301 305 ··· 318 314 #define ACPI_ACTUAL_DEBUG_RAW(level, line, filename, modulename, component, ...) \ 319 315 ACPI_DO_DEBUG_PRINT (acpi_debug_print_raw, level, line, \ 320 316 filename, modulename, component, __VA_ARGS__) 317 + 318 + #define ACPI_DEBUG_PRINT(plist) ACPI_ACTUAL_DEBUG plist 319 + #define ACPI_DEBUG_PRINT_RAW(plist) ACPI_ACTUAL_DEBUG_RAW plist 320 + 321 + #endif 321 322 322 323 /* 323 324 * Function entry tracing
+23 -5
include/acpi/acpixf.h
··· 46 46 47 47 /* Current ACPICA subsystem version in YYYYMMDD format */ 48 48 49 - #define ACPI_CA_VERSION 0x20150515 49 + #define ACPI_CA_VERSION 0x20150619 50 50 51 51 #include <acpi/acconfig.h> 52 52 #include <acpi/actypes.h> ··· 195 195 * address. Although ACPICA adheres to the ACPI specification which 196 196 * requires the use of the corresponding 64-bit address if it is non-zero, 197 197 * some machines have been found to have a corrupted non-zero 64-bit 198 - * address. Default is TRUE, favor the 32-bit addresses. 198 + * address. Default is FALSE, do not favor the 32-bit addresses. 199 199 */ 200 - ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, TRUE); 200 + ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, FALSE); 201 + 202 + /* 203 + * Optionally use 32-bit FACS table addresses. 204 + * It is reported that some platforms fail to resume from system suspending 205 + * if 64-bit FACS table address is selected: 206 + * https://bugzilla.kernel.org/show_bug.cgi?id=74021 207 + * Default is TRUE, favor the 32-bit addresses. 208 + */ 209 + ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_facs_addresses, TRUE); 201 210 202 211 /* 203 212 * Optionally truncate I/O addresses to 16 bits. Provides compatibility ··· 227 218 * This can be useful for debugging ACPI problems on some machines. 228 219 */ 229 220 ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_ssdt_table_install, FALSE); 221 + 222 + /* 223 + * Optionally enable runtime namespace override. 224 + */ 225 + ACPI_INIT_GLOBAL(u8, acpi_gbl_runtime_namespace_override, TRUE); 230 226 231 227 /* 232 228 * We keep track of the latest version of Windows that has been requested by ··· 828 814 ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_leave_sleep_state(u8 sleep_state)) 829 815 830 816 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 831 - acpi_set_firmware_waking_vector(u32 832 - physical_address)) 817 + acpi_set_firmware_waking_vectors 818 + (acpi_physical_address physical_address, 819 + acpi_physical_address physical_address64)) 820 + ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 821 + acpi_set_firmware_waking_vector(u32 822 + physical_address)) 833 823 #if ACPI_MACHINE_WIDTH == 64 834 824 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 835 825 acpi_set_firmware_waking_vector64(u64
+1
include/acpi/actbl.h
··· 65 65 #define ACPI_SIG_DSDT "DSDT" /* Differentiated System Description Table */ 66 66 #define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */ 67 67 #define ACPI_SIG_FACS "FACS" /* Firmware ACPI Control Structure */ 68 + #define ACPI_SIG_OSDT "OSDT" /* Override System Description Table */ 68 69 #define ACPI_SIG_PSDT "PSDT" /* Persistent System Description Table */ 69 70 #define ACPI_SIG_RSDP "RSD PTR " /* Root System Description Pointer */ 70 71 #define ACPI_SIG_RSDT "RSDT" /* Root System Description Table */
+11
include/acpi/actbl1.h
··· 835 835 u8 reserved2[3]; /* reserved - must be zero */ 836 836 }; 837 837 838 + /* Values for Version field above */ 839 + 840 + enum acpi_madt_gic_version { 841 + ACPI_MADT_GIC_VERSION_NONE = 0, 842 + ACPI_MADT_GIC_VERSION_V1 = 1, 843 + ACPI_MADT_GIC_VERSION_V2 = 2, 844 + ACPI_MADT_GIC_VERSION_V3 = 3, 845 + ACPI_MADT_GIC_VERSION_V4 = 4, 846 + ACPI_MADT_GIC_VERSION_RESERVED = 5 /* 5 and greater are reserved */ 847 + }; 848 + 838 849 /* 13: Generic MSI Frame (ACPI 5.1) */ 839 850 840 851 struct acpi_madt_generic_msi_frame {
+74 -8
include/acpi/actbl2.h
··· 51 51 * These tables are not consumed directly by the ACPICA subsystem, but are 52 52 * included here to support device drivers and the AML disassembler. 53 53 * 54 - * The tables in this file are defined by third-party specifications, and are 55 - * not defined directly by the ACPI specification itself. 54 + * Generally, the tables in this file are defined by third-party specifications, 55 + * and are not defined directly by the ACPI specification itself. 56 56 * 57 57 ******************************************************************************/ 58 58 ··· 80 80 #define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ 81 81 #define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ 82 82 #define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ 83 + #define ACPI_SIG_TPM2 "TPM2" /* Trusted Platform Module 2.0 H/W interface table */ 83 84 #define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */ 84 85 #define ACPI_SIG_VRTC "VRTC" /* Virtual Real Time Clock Table */ 85 86 #define ACPI_SIG_WAET "WAET" /* Windows ACPI Emulated devices Table */ ··· 1180 1179 /******************************************************************************* 1181 1180 * 1182 1181 * TCPA - Trusted Computing Platform Alliance table 1183 - * Version 1 1182 + * Version 2 1184 1183 * 1185 - * Conforms to "TCG PC Specific Implementation Specification", 1186 - * Version 1.1, August 18, 2003 1184 + * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", 1185 + * December 19, 2014 1186 + * 1187 + * NOTE: There are two versions of the table with the same signature -- 1188 + * the client version and the server version. 1187 1189 * 1188 1190 ******************************************************************************/ 1189 1191 1190 - struct acpi_table_tcpa { 1192 + struct acpi_table_tcpa_client { 1191 1193 struct acpi_table_header header; /* Common ACPI table header */ 1192 - u16 reserved; 1193 - u32 max_log_length; /* Maximum length for the event log area */ 1194 + u16 platform_class; 1195 + u32 minimum_log_length; /* Minimum length for the event log area */ 1194 1196 u64 log_address; /* Address of the event log area */ 1195 1197 }; 1198 + 1199 + struct acpi_table_tcpa_server { 1200 + struct acpi_table_header header; /* Common ACPI table header */ 1201 + u16 platform_class; 1202 + u16 reserved; 1203 + u64 minimum_log_length; /* Minimum length for the event log area */ 1204 + u64 log_address; /* Address of the event log area */ 1205 + u16 spec_revision; 1206 + u8 device_flags; 1207 + u8 interrupt_flags; 1208 + u8 gpe_number; 1209 + u8 reserved2[3]; 1210 + u32 global_interrupt; 1211 + struct acpi_generic_address address; 1212 + u32 reserved3; 1213 + struct acpi_generic_address config_address; 1214 + u8 group; 1215 + u8 bus; /* PCI Bus/Segment/Function numbers */ 1216 + u8 device; 1217 + u8 function; 1218 + }; 1219 + 1220 + /* Values for device_flags above */ 1221 + 1222 + #define ACPI_TCPA_PCI_DEVICE (1) 1223 + #define ACPI_TCPA_BUS_PNP (1<<1) 1224 + #define ACPI_TCPA_ADDRESS_VALID (1<<2) 1225 + 1226 + /* Values for interrupt_flags above */ 1227 + 1228 + #define ACPI_TCPA_INTERRUPT_MODE (1) 1229 + #define ACPI_TCPA_INTERRUPT_POLARITY (1<<1) 1230 + #define ACPI_TCPA_SCI_VIA_GPE (1<<2) 1231 + #define ACPI_TCPA_GLOBAL_INTERRUPT (1<<3) 1232 + 1233 + /******************************************************************************* 1234 + * 1235 + * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table 1236 + * Version 4 1237 + * 1238 + * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", 1239 + * December 19, 2014 1240 + * 1241 + ******************************************************************************/ 1242 + 1243 + struct acpi_table_tpm2 { 1244 + struct acpi_table_header header; /* Common ACPI table header */ 1245 + u16 platform_class; 1246 + u16 reserved; 1247 + u64 control_address; 1248 + u32 start_method; 1249 + 1250 + /* Platform-specific data follows */ 1251 + }; 1252 + 1253 + /* Values for start_method above */ 1254 + 1255 + #define ACPI_TPM2_NOT_ALLOWED 0 1256 + #define ACPI_TPM2_START_METHOD 2 1257 + #define ACPI_TPM2_MEMORY_MAPPED 6 1258 + #define ACPI_TPM2_COMMAND_BUFFER 7 1259 + #define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD 8 1196 1260 1197 1261 /******************************************************************************* 1198 1262 *
+2 -32
include/acpi/actbl3.h
··· 51 51 * These tables are not consumed directly by the ACPICA subsystem, but are 52 52 * included here to support device drivers and the AML disassembler. 53 53 * 54 - * The tables in this file are fully defined within the ACPI specification. 54 + * In general, the tables in this file are fully defined within the ACPI 55 + * specification. 55 56 * 56 57 ******************************************************************************/ 57 58 ··· 70 69 #define ACPI_SIG_PMTT "PMTT" /* Platform Memory Topology Table */ 71 70 #define ACPI_SIG_RASF "RASF" /* RAS Feature table */ 72 71 #define ACPI_SIG_STAO "STAO" /* Status Override table */ 73 - #define ACPI_SIG_TPM2 "TPM2" /* Trusted Platform Module 2.0 H/W interface table */ 74 72 #define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */ 75 73 #define ACPI_SIG_XENV "XENV" /* Xen Environment table */ 76 74 ··· 718 718 struct acpi_table_stao { 719 719 struct acpi_table_header header; /* Common ACPI table header */ 720 720 u8 ignore_uart; 721 - }; 722 - 723 - /******************************************************************************* 724 - * 725 - * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table 726 - * Version 3 727 - * 728 - * Conforms to "TPM 2.0 Hardware Interface Table (TPM2)" 29 November 2011 729 - * 730 - ******************************************************************************/ 731 - 732 - struct acpi_table_tpm2 { 733 - struct acpi_table_header header; /* Common ACPI table header */ 734 - u32 flags; 735 - u64 control_address; 736 - u32 start_method; 737 - }; 738 - 739 - /* Control area structure (not part of table, pointed to by control_address) */ 740 - 741 - struct acpi_tpm2_control { 742 - u32 reserved; 743 - u32 error; 744 - u32 cancel; 745 - u32 start; 746 - u64 interrupt_control; 747 - u32 command_size; 748 - u64 command_address; 749 - u32 response_size; 750 - u64 response_address; 751 721 }; 752 722 753 723 /*******************************************************************************
+20 -13
include/acpi/actypes.h
··· 542 542 #define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b))) 543 543 #define ACPI_MOVE_NAME(dest,src) (*ACPI_CAST_PTR (u32, (dest)) = *ACPI_CAST_PTR (u32, (src))) 544 544 #else 545 - #define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE)) 546 - #define ACPI_MOVE_NAME(dest,src) (ACPI_STRNCPY (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE)) 545 + #define ACPI_COMPARE_NAME(a,b) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE)) 546 + #define ACPI_MOVE_NAME(dest,src) (strncpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE)) 547 547 #endif 548 548 549 549 /* Support for the special RSDP signature (8 characters) */ 550 550 551 - #define ACPI_VALIDATE_RSDP_SIG(a) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8)) 552 - #define ACPI_MAKE_RSDP_SIG(dest) (ACPI_MEMCPY (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8)) 551 + #define ACPI_VALIDATE_RSDP_SIG(a) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8)) 552 + #define ACPI_MAKE_RSDP_SIG(dest) (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8)) 553 553 554 554 /******************************************************************************* 555 555 * ··· 568 568 #define ACPI_NO_ACPI_ENABLE 0x10 569 569 #define ACPI_NO_DEVICE_INIT 0x20 570 570 #define ACPI_NO_OBJECT_INIT 0x40 571 + #define ACPI_NO_FACS_INIT 0x80 571 572 572 573 /* 573 574 * Initialization state ··· 1141 1140 1142 1141 #define ACPI_UUID_LENGTH 16 1143 1142 1143 + /* Length of 3-byte PCI class code values when converted back to a string */ 1144 + 1145 + #define ACPI_PCICLS_STRING_SIZE 7 /* Includes null terminator */ 1146 + 1144 1147 /* Structures used for device/processor HID, UID, CID, and SUB */ 1145 1148 1146 1149 struct acpi_pnp_device_id { ··· 1167 1162 u32 name; /* ACPI object Name */ 1168 1163 acpi_object_type type; /* ACPI object Type */ 1169 1164 u8 param_count; /* If a method, required parameter count */ 1170 - u8 valid; /* Indicates which optional fields are valid */ 1165 + u16 valid; /* Indicates which optional fields are valid */ 1171 1166 u8 flags; /* Miscellaneous info */ 1172 1167 u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ 1173 1168 u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */ ··· 1176 1171 struct acpi_pnp_device_id hardware_id; /* _HID value */ 1177 1172 struct acpi_pnp_device_id unique_id; /* _UID value */ 1178 1173 struct acpi_pnp_device_id subsystem_id; /* _SUB value */ 1174 + struct acpi_pnp_device_id class_code; /* _CLS value */ 1179 1175 struct acpi_pnp_device_id_list compatible_id_list; /* _CID list <must be last> */ 1180 1176 }; 1181 1177 ··· 1186 1180 1187 1181 /* Flags for Valid field above (acpi_get_object_info) */ 1188 1182 1189 - #define ACPI_VALID_STA 0x01 1190 - #define ACPI_VALID_ADR 0x02 1191 - #define ACPI_VALID_HID 0x04 1192 - #define ACPI_VALID_UID 0x08 1193 - #define ACPI_VALID_SUB 0x10 1194 - #define ACPI_VALID_CID 0x20 1195 - #define ACPI_VALID_SXDS 0x40 1196 - #define ACPI_VALID_SXWS 0x80 1183 + #define ACPI_VALID_STA 0x0001 1184 + #define ACPI_VALID_ADR 0x0002 1185 + #define ACPI_VALID_HID 0x0004 1186 + #define ACPI_VALID_UID 0x0008 1187 + #define ACPI_VALID_SUB 0x0010 1188 + #define ACPI_VALID_CID 0x0020 1189 + #define ACPI_VALID_CLS 0x0040 1190 + #define ACPI_VALID_SXDS 0x0100 1191 + #define ACPI_VALID_SXWS 0x0200 1197 1192 1198 1193 /* Flags for _STA return value (current_status above) */ 1199 1194
-39
include/acpi/platform/acenv.h
··· 346 346 347 347 /* We will be linking to the standard Clib functions */ 348 348 349 - #define ACPI_STRSTR(s1,s2) strstr((s1), (s2)) 350 - #define ACPI_STRCHR(s1,c) strchr((s1), (c)) 351 - #define ACPI_STRLEN(s) (acpi_size) strlen((s)) 352 - #define ACPI_STRCPY(d,s) (void) strcpy((d), (s)) 353 - #define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (acpi_size)(n)) 354 - #define ACPI_STRNCMP(d,s,n) strncmp((d), (s), (acpi_size)(n)) 355 - #define ACPI_STRCMP(d,s) strcmp((d), (s)) 356 - #define ACPI_STRCAT(d,s) (void) strcat((d), (s)) 357 - #define ACPI_STRNCAT(d,s,n) strncat((d), (s), (acpi_size)(n)) 358 - #define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (acpi_size)(n)) 359 - #define ACPI_MEMCMP(s1,s2,n) memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n)) 360 - #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (acpi_size)(n)) 361 - #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (acpi_size)(n)) 362 - 363 - #define ACPI_TOUPPER(i) toupper((int) (i)) 364 - #define ACPI_TOLOWER(i) tolower((int) (i)) 365 - #define ACPI_IS_XDIGIT(i) isxdigit((int) (i)) 366 - #define ACPI_IS_DIGIT(i) isdigit((int) (i)) 367 - #define ACPI_IS_SPACE(i) isspace((int) (i)) 368 - #define ACPI_IS_UPPER(i) isupper((int) (i)) 369 - #define ACPI_IS_PRINT(i) isprint((int) (i)) 370 - #define ACPI_IS_ALPHA(i) isalpha((int) (i)) 371 - 372 349 #else 373 350 374 351 /****************************************************************************** ··· 382 405 #endif /* va_arg */ 383 406 384 407 /* Use the local (ACPICA) definitions of the clib functions */ 385 - 386 - #define ACPI_STRSTR(s1,s2) acpi_ut_strstr ((s1), (s2)) 387 - #define ACPI_STRCHR(s1,c) acpi_ut_strchr ((s1), (c)) 388 - #define ACPI_STRLEN(s) (acpi_size) acpi_ut_strlen ((s)) 389 - #define ACPI_STRCPY(d,s) (void) acpi_ut_strcpy ((d), (s)) 390 - #define ACPI_STRNCPY(d,s,n) (void) acpi_ut_strncpy ((d), (s), (acpi_size)(n)) 391 - #define ACPI_STRNCMP(d,s,n) acpi_ut_strncmp ((d), (s), (acpi_size)(n)) 392 - #define ACPI_STRCMP(d,s) acpi_ut_strcmp ((d), (s)) 393 - #define ACPI_STRCAT(d,s) (void) acpi_ut_strcat ((d), (s)) 394 - #define ACPI_STRNCAT(d,s,n) acpi_ut_strncat ((d), (s), (acpi_size)(n)) 395 - #define ACPI_STRTOUL(d,s,n) acpi_ut_strtoul ((d), (s), (acpi_size)(n)) 396 - #define ACPI_MEMCMP(s1,s2,n) acpi_ut_memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n)) 397 - #define ACPI_MEMCPY(d,s,n) (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n)) 398 - #define ACPI_MEMSET(d,v,n) (void) acpi_ut_memset ((d), (v), (acpi_size)(n)) 399 - #define ACPI_TOUPPER(c) acpi_ut_to_upper ((int) (c)) 400 - #define ACPI_TOLOWER(c) acpi_ut_to_lower ((int) (c)) 401 408 402 409 #endif /* ACPI_USE_SYSTEM_CLIBRARY */ 403 410
+6
include/acpi/platform/acenvex.h
··· 56 56 #if defined(_LINUX) || defined(__linux__) 57 57 #include <acpi/platform/aclinuxex.h> 58 58 59 + #elif defined(_AED_EFI) 60 + #include "acefiex.h" 61 + 62 + #elif defined(_GNU_EFI) 63 + #include "acefiex.h" 64 + 59 65 #elif defined(__DragonFly__) 60 66 #include "acdragonflyex.h" 61 67
+4
include/acpi/platform/acgcc.h
··· 75 75 #undef strchr 76 76 #endif 77 77 78 + /* GCC supports __VA_ARGS__ in macros */ 79 + 80 + #define COMPILER_VA_MACRO 1 81 + 78 82 #endif /* __ACGCC_H__ */
+2 -2
tools/power/acpi/common/getopt.c
··· 127 127 argv[acpi_gbl_optind][0] != '-' || 128 128 argv[acpi_gbl_optind][1] == '\0') { 129 129 return (ACPI_OPT_END); 130 - } else if (ACPI_STRCMP(argv[acpi_gbl_optind], "--") == 0) { 130 + } else if (strcmp(argv[acpi_gbl_optind], "--") == 0) { 131 131 acpi_gbl_optind++; 132 132 return (ACPI_OPT_END); 133 133 } ··· 140 140 /* Make sure that the option is legal */ 141 141 142 142 if (current_char == ':' || 143 - (opts_ptr = ACPI_STRCHR(opts, current_char)) == NULL) { 143 + (opts_ptr = strchr(opts, current_char)) == NULL) { 144 144 ACPI_OPTION_ERROR("Illegal option: -", current_char); 145 145 146 146 if (argv[acpi_gbl_optind][++current_char_ptr] == '\0') {
+12 -5
tools/power/acpi/man/acpidump.8
··· 22 22 .B \-b 23 23 Dump tables to binary files 24 24 .TP 25 - .B \-c 26 - Dump customized tables 27 - .TP 28 25 .B \-h \-? 29 26 This help message 30 27 .TP ··· 45 48 .B \-a <Address> 46 49 Get table via a physical address 47 50 .TP 51 + .B \-c <on|off> 52 + Turning on/off customized table dumping 53 + .TP 48 54 .B \-f <BinaryFile> 49 55 Get table via a binary file 50 56 .TP 51 57 .B \-n <Signature> 52 58 Get table via a name/signature 53 59 .TP 54 - Invocation without parameters dumps all available tables 60 + .B \-x 61 + Do not use but dump XSDT 55 62 .TP 56 - Multiple mixed instances of -a, -f, and -n are supported 63 + .B \-x \-x 64 + Do not use or dump XSDT 65 + .TP 66 + .fi 67 + Invocation without parameters dumps all available tables. 68 + .TP 69 + Multiple mixed instances of -a, -f, and -n are supported. 57 70 58 71 .SH EXAMPLES 59 72
+63 -60
tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
··· 222 222 goto exit; 223 223 } 224 224 225 - ACPI_MEMCPY(local_table, mapped_table, table_length); 225 + memcpy(local_table, mapped_table, table_length); 226 226 227 227 exit: 228 228 osl_unmap_table(mapped_table); ··· 531 531 gbl_rsdp_address = 532 532 rsdp_base + (ACPI_CAST8(mapped_table) - rsdp_address); 533 533 534 - ACPI_MEMCPY(&gbl_rsdp, mapped_table, sizeof(struct acpi_table_rsdp)); 534 + memcpy(&gbl_rsdp, mapped_table, sizeof(struct acpi_table_rsdp)); 535 535 acpi_os_unmap_memory(rsdp_address, rsdp_size); 536 536 537 537 return (AE_OK); ··· 582 582 return (AE_OK); 583 583 } 584 584 585 - /* Get RSDP from memory */ 586 - 587 - status = osl_load_rsdp(); 588 - if (ACPI_FAILURE(status)) { 589 - return (status); 590 - } 591 - 592 - /* Get XSDT from memory */ 593 - 594 - if (gbl_rsdp.revision && !gbl_do_not_dump_xsdt) { 595 - if (gbl_xsdt) { 596 - free(gbl_xsdt); 597 - gbl_xsdt = NULL; 598 - } 599 - 600 - gbl_revision = 2; 601 - status = osl_get_bios_table(ACPI_SIG_XSDT, 0, 602 - ACPI_CAST_PTR(struct 603 - acpi_table_header *, 604 - &gbl_xsdt), &address); 605 - if (ACPI_FAILURE(status)) { 606 - return (status); 607 - } 608 - } 609 - 610 - /* Get RSDT from memory */ 611 - 612 - if (gbl_rsdp.rsdt_physical_address) { 613 - if (gbl_rsdt) { 614 - free(gbl_rsdt); 615 - gbl_rsdt = NULL; 616 - } 617 - 618 - status = osl_get_bios_table(ACPI_SIG_RSDT, 0, 619 - ACPI_CAST_PTR(struct 620 - acpi_table_header *, 621 - &gbl_rsdt), &address); 622 - if (ACPI_FAILURE(status)) { 623 - return (status); 624 - } 625 - } 626 - 627 - /* Get FADT from memory */ 628 - 629 - if (gbl_fadt) { 630 - free(gbl_fadt); 631 - gbl_fadt = NULL; 632 - } 633 - 634 - status = osl_get_bios_table(ACPI_SIG_FADT, 0, 635 - ACPI_CAST_PTR(struct acpi_table_header *, 636 - &gbl_fadt), 637 - &gbl_fadt_address); 638 - if (ACPI_FAILURE(status)) { 639 - return (status); 640 - } 641 - 642 585 if (!gbl_dump_customized_tables) { 586 + 587 + /* Get RSDP from memory */ 588 + 589 + status = osl_load_rsdp(); 590 + if (ACPI_FAILURE(status)) { 591 + return (status); 592 + } 593 + 594 + /* Get XSDT from memory */ 595 + 596 + if (gbl_rsdp.revision && !gbl_do_not_dump_xsdt) { 597 + if (gbl_xsdt) { 598 + free(gbl_xsdt); 599 + gbl_xsdt = NULL; 600 + } 601 + 602 + gbl_revision = 2; 603 + status = osl_get_bios_table(ACPI_SIG_XSDT, 0, 604 + ACPI_CAST_PTR(struct 605 + acpi_table_header 606 + *, &gbl_xsdt), 607 + &address); 608 + if (ACPI_FAILURE(status)) { 609 + return (status); 610 + } 611 + } 612 + 613 + /* Get RSDT from memory */ 614 + 615 + if (gbl_rsdp.rsdt_physical_address) { 616 + if (gbl_rsdt) { 617 + free(gbl_rsdt); 618 + gbl_rsdt = NULL; 619 + } 620 + 621 + status = osl_get_bios_table(ACPI_SIG_RSDT, 0, 622 + ACPI_CAST_PTR(struct 623 + acpi_table_header 624 + *, &gbl_rsdt), 625 + &address); 626 + if (ACPI_FAILURE(status)) { 627 + return (status); 628 + } 629 + } 630 + 631 + /* Get FADT from memory */ 632 + 633 + if (gbl_fadt) { 634 + free(gbl_fadt); 635 + gbl_fadt = NULL; 636 + } 637 + 638 + status = osl_get_bios_table(ACPI_SIG_FADT, 0, 639 + ACPI_CAST_PTR(struct 640 + acpi_table_header *, 641 + &gbl_fadt), 642 + &gbl_fadt_address); 643 + if (ACPI_FAILURE(status)) { 644 + return (status); 645 + } 643 646 644 647 /* Add mandatory tables to global table list first */ 645 648 ··· 964 961 goto exit; 965 962 } 966 963 967 - ACPI_MEMCPY(local_table, mapped_table, table_length); 964 + memcpy(local_table, mapped_table, table_length); 968 965 *address = table_address; 969 966 *table = local_table; 970 967
+1 -1
tools/power/acpi/os_specific/service_layers/osunixmap.c
··· 54 54 #ifndef O_BINARY 55 55 #define O_BINARY 0 56 56 #endif 57 - #ifdef _free_BSD 57 + #if defined(_dragon_fly) || defined(_free_BSD) 58 58 #define MMAP_FLAGS MAP_SHARED 59 59 #else 60 60 #define MMAP_FLAGS MAP_PRIVATE
+1 -1
tools/power/acpi/tools/acpidump/acpidump.h
··· 66 66 EXTERN u8 INIT_GLOBAL(gbl_summary_mode, FALSE); 67 67 EXTERN u8 INIT_GLOBAL(gbl_verbose_mode, FALSE); 68 68 EXTERN u8 INIT_GLOBAL(gbl_binary_mode, FALSE); 69 - EXTERN u8 INIT_GLOBAL(gbl_dump_customized_tables, FALSE); 69 + EXTERN u8 INIT_GLOBAL(gbl_dump_customized_tables, TRUE); 70 70 EXTERN u8 INIT_GLOBAL(gbl_do_not_dump_xsdt, FALSE); 71 71 EXTERN ACPI_FILE INIT_GLOBAL(gbl_output_file, NULL); 72 72 EXTERN char INIT_GLOBAL(*gbl_output_filename, NULL);
+4 -4
tools/power/acpi/tools/acpidump/apdump.c
··· 329 329 acpi_status status; 330 330 int table_status; 331 331 332 - if (ACPI_STRLEN(signature) != ACPI_NAME_SIZE) { 332 + if (strlen(signature) != ACPI_NAME_SIZE) { 333 333 acpi_log_error 334 334 ("Invalid table signature [%s]: must be exactly 4 characters\n", 335 335 signature); ··· 338 338 339 339 /* Table signatures are expected to be uppercase */ 340 340 341 - ACPI_STRCPY(local_signature, signature); 341 + strcpy(local_signature, signature); 342 342 acpi_ut_strupr(local_signature); 343 343 344 344 /* To be friendly, handle tables whose signatures do not match the name */ 345 345 346 346 if (ACPI_COMPARE_NAME(local_signature, "FADT")) { 347 - ACPI_STRCPY(local_signature, ACPI_SIG_FADT); 347 + strcpy(local_signature, ACPI_SIG_FADT); 348 348 } else if (ACPI_COMPARE_NAME(local_signature, "MADT")) { 349 - ACPI_STRCPY(local_signature, ACPI_SIG_MADT); 349 + strcpy(local_signature, ACPI_SIG_MADT); 350 350 } 351 351 352 352 /* Dump all instances of this signature (to handle multiple SSDTs) */
+6 -6
tools/power/acpi/tools/acpidump/apfiles.c
··· 136 136 } else { 137 137 ACPI_MOVE_NAME(filename, table->signature); 138 138 } 139 - filename[0] = (char)ACPI_TOLOWER(filename[0]); 140 - filename[1] = (char)ACPI_TOLOWER(filename[1]); 141 - filename[2] = (char)ACPI_TOLOWER(filename[2]); 142 - filename[3] = (char)ACPI_TOLOWER(filename[3]); 139 + filename[0] = (char)tolower((int)filename[0]); 140 + filename[1] = (char)tolower((int)filename[1]); 141 + filename[2] = (char)tolower((int)filename[2]); 142 + filename[3] = (char)tolower((int)filename[3]); 143 143 filename[ACPI_NAME_SIZE] = 0; 144 144 145 145 /* Handle multiple SSDts - create different filenames for each */ ··· 147 147 if (instance > 0) { 148 148 acpi_ut_snprintf(instance_str, sizeof(instance_str), "%u", 149 149 instance); 150 - ACPI_STRCAT(filename, instance_str); 150 + strcat(filename, instance_str); 151 151 } 152 152 153 - ACPI_STRCAT(filename, ACPI_TABLE_FILE_SUFFIX); 153 + strcat(filename, ACPI_TABLE_FILE_SUFFIX); 154 154 155 155 if (gbl_verbose_mode) { 156 156 acpi_log_error
+12 -3
tools/power/acpi/tools/acpidump/apmain.c
··· 80 80 u32 current_action = 0; 81 81 82 82 #define AP_UTILITY_NAME "ACPI Binary Table Dump Utility" 83 - #define AP_SUPPORTED_OPTIONS "?a:bcf:hn:o:r:svxz" 83 + #define AP_SUPPORTED_OPTIONS "?a:bc:f:hn:o:r:svxz" 84 84 85 85 /****************************************************************************** 86 86 * ··· 96 96 ACPI_USAGE_HEADER("acpidump [options]"); 97 97 98 98 ACPI_OPTION("-b", "Dump tables to binary files"); 99 - ACPI_OPTION("-c", "Dump customized tables"); 100 99 ACPI_OPTION("-h -?", "This help message"); 101 100 ACPI_OPTION("-o <File>", "Redirect output to file"); 102 101 ACPI_OPTION("-r <Address>", "Dump tables from specified RSDP"); ··· 106 107 ACPI_USAGE_TEXT("\nTable Options:\n"); 107 108 108 109 ACPI_OPTION("-a <Address>", "Get table via a physical address"); 110 + ACPI_OPTION("-c <on|off>", "Turning on/off customized table dumping"); 109 111 ACPI_OPTION("-f <BinaryFile>", "Get table via a binary file"); 110 112 ACPI_OPTION("-n <Signature>", "Get table via a name/signature"); 111 113 ACPI_OPTION("-x", "Do not use but dump XSDT"); ··· 181 181 182 182 case 'c': /* Dump customized tables */ 183 183 184 - gbl_dump_customized_tables = TRUE; 184 + if (!strcmp(acpi_gbl_optarg, "on")) { 185 + gbl_dump_customized_tables = TRUE; 186 + } else if (!strcmp(acpi_gbl_optarg, "off")) { 187 + gbl_dump_customized_tables = FALSE; 188 + } else { 189 + acpi_log_error 190 + ("%s: Cannot handle this switch, please use on|off\n", 191 + acpi_gbl_optarg); 192 + return (-1); 193 + } 185 194 continue; 186 195 187 196 case 'h':