Skip to content

Commit 13f4eb6

Browse files
committed
Merge branch 'acpica'
Merge ACPICA updates for 6.12-rc1: - Check return value in acpi_db_convert_to_package() (Pei Xiao). - Detect FACS and allow setting the waking vector on reduced-hardware ACPI platforms (Jiaqing Zhao). - Allow ACPICA to represent semaphores as integers (Adrien Destugues). - Complete CXL 3.0 CXIMS structures support in ACPICA (Zhang Rui). - Make ACPICA support SPCR version 4 and add RISC-V SBI Subtype to DBG2 (Sia Jee Heng). - Implement the Dword_PCC Resource Descriptor Macro in ACPICA (Jose Marinho). - Correct the typo in struct acpi_mpam_msc_node member (Punit Agrawal). - Implement ACPI_WARNING_ONCE() and ACPI_ERROR_ONCE() and use them to prevent a Stall() violation warning from being printed every time this takes place (Vasily Khoruzhick). - Allow PCC Data Type in MCTP resource (Adam Young). - Fix memory leaks on acpi_ps_get_next_namepath() and acpi_ps_get_next_field() failures (Armin Wolf). - Add support for supressing leading zeros in hex strings when converting them to integers and update integer-to-hex-string conversions in ACPICA (Armin Wolf). - Add support for Windows 11 22H2 _OSI string (Armin Wolf). - Avoid warning for Dump Functions in ACPICA (Adam Lackorzynski). - Add extended linear address mode to HMAT MSCIS in ACPICA (Dave Jiang). - Handle empty connection_node in iasl (Aleksandrs Vinarskis). - Allow for more flexibility in _DSM args (Saket Dumbre). - Setup for ACPICA release 20240827 (Saket Dumbre). * acpica: (23 commits) ACPICA: Setup for ACPICA release 20240827 ACPICA: Allow for more flexibility in _DSM args ACPICA: iasl: handle empty connection_node ACPICA: HMAT: Add extended linear address mode to MSCIS ACPICA: Avoid warning for Dump Functions ACPICA: Add support for Windows 11 22H2 _OSI string ACPICA: Update integer-to-hex-string conversions ACPICA: Add support for supressing leading zeros in hex strings ACPICA: Allow for supressing leading zeros when using acpi_ex_convert_to_ascii() ACPICA: Fix memory leak if acpi_ps_get_next_field() fails ACPICA: Fix memory leak if acpi_ps_get_next_namepath() fails ACPICA: Allow PCC Data Type in MCTP resource. ACPICA: executer/exsystem: Don't nag user about every Stall() violating the spec ACPICA: Implement ACPI_WARNING_ONCE and ACPI_ERROR_ONCE ACPICA: MPAM: Correct the typo in struct acpi_mpam_msc_node member ACPICA: Implement the Dword_PCC Resource Descriptor Macro ACPICA: Headers: Add RISC-V SBI Subtype to DBG2 ACPICA: SPCR: Update the SPCR table to version 4 ACPICA: Complete CXL 3.0 CXIMS structures ACPICA: haiku: Fix invalid value used for semaphores ...
2 parents 6924e9b + 9af32b4 commit 13f4eb6

24 files changed

+174
-57
lines changed

drivers/acpi/acpica/acglobal.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ ACPI_INIT_GLOBAL(u32, acpi_gbl_dsdt_index, ACPI_INVALID_TABLE_INDEX);
2929
ACPI_INIT_GLOBAL(u32, acpi_gbl_facs_index, ACPI_INVALID_TABLE_INDEX);
3030
ACPI_INIT_GLOBAL(u32, acpi_gbl_xfacs_index, ACPI_INVALID_TABLE_INDEX);
3131
ACPI_INIT_GLOBAL(u32, acpi_gbl_fadt_index, ACPI_INVALID_TABLE_INDEX);
32-
33-
#if (!ACPI_REDUCED_HARDWARE)
34-
ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS);
35-
36-
#endif /* !ACPI_REDUCED_HARDWARE */
32+
ACPI_INIT_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS, NULL);
3733

3834
/* These addresses are calculated from the FADT Event Block addresses */
3935

drivers/acpi/acpica/aclocal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,8 @@ struct acpi_port_info {
10901090
#define ACPI_ADDRESS_TYPE_IO_RANGE 1
10911091
#define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2
10921092

1093+
#define ACPI_ADDRESS_TYPE_PCC_NUMBER 0xA
1094+
10931095
/* Resource descriptor types and masks */
10941096

10951097
#define ACPI_RESOURCE_NAME_LARGE 0x80

drivers/acpi/acpica/acpredef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
450450

451451
{{"_DSM",
452452
METHOD_4ARGS(ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER,
453-
ACPI_TYPE_PACKAGE),
453+
ACPI_TYPE_ANY) | ARG_COUNT_IS_MINIMUM,
454454
METHOD_RETURNS(ACPI_RTYPE_ALL)}}, /* Must return a value, but it can be of any type */
455455

456456
{{"_DSS", METHOD_1ARGS(ACPI_TYPE_INTEGER),

drivers/acpi/acpica/dbconvert.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object)
174174
elements =
175175
ACPI_ALLOCATE_ZEROED(DB_DEFAULT_PKG_ELEMENTS *
176176
sizeof(union acpi_object));
177+
if (!elements)
178+
return (AE_NO_MEMORY);
177179

178180
this = string;
179181
for (i = 0; i < (DB_DEFAULT_PKG_ELEMENTS - 1); i++) {

drivers/acpi/acpica/exconvrt.c

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ ACPI_MODULE_NAME("exconvrt")
1717

1818
/* Local prototypes */
1919
static u32
20-
acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 max_length);
20+
acpi_ex_convert_to_ascii(u64 integer,
21+
u16 base, u8 *string, u8 max_length, u8 leading_zeros);
2122

2223
/*******************************************************************************
2324
*
@@ -249,6 +250,7 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
249250
* base - ACPI_STRING_DECIMAL or ACPI_STRING_HEX
250251
* string - Where the string is returned
251252
* data_width - Size of data item to be converted, in bytes
253+
* leading_zeros - Allow leading zeros
252254
*
253255
* RETURN: Actual string length
254256
*
@@ -257,7 +259,8 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
257259
******************************************************************************/
258260

259261
static u32
260-
acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 data_width)
262+
acpi_ex_convert_to_ascii(u64 integer,
263+
u16 base, u8 *string, u8 data_width, u8 leading_zeros)
261264
{
262265
u64 digit;
263266
u32 i;
@@ -266,7 +269,8 @@ acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 data_width)
266269
u32 hex_length;
267270
u32 decimal_length;
268271
u32 remainder;
269-
u8 supress_zeros;
272+
u8 supress_zeros = !leading_zeros;
273+
u8 hex_char;
270274

271275
ACPI_FUNCTION_ENTRY();
272276

@@ -293,7 +297,6 @@ acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 data_width)
293297
break;
294298
}
295299

296-
supress_zeros = TRUE; /* No leading zeros */
297300
remainder = 0;
298301

299302
for (i = decimal_length; i > 0; i--) {
@@ -328,8 +331,17 @@ acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 data_width)
328331

329332
/* Get one hex digit, most significant digits first */
330333

331-
string[k] = (u8)
334+
hex_char = (u8)
332335
acpi_ut_hex_to_ascii_char(integer, ACPI_MUL_4(j));
336+
337+
/* Supress leading zeros until the first non-zero character */
338+
339+
if (hex_char == ACPI_ASCII_ZERO && supress_zeros) {
340+
continue;
341+
}
342+
343+
supress_zeros = FALSE;
344+
string[k] = hex_char;
333345
k++;
334346
}
335347
break;
@@ -379,6 +391,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
379391
u32 string_length = 0;
380392
u16 base = 16;
381393
u8 separator = ',';
394+
u8 leading_zeros;
382395

383396
ACPI_FUNCTION_TRACE_PTR(ex_convert_to_string, obj_desc);
384397

@@ -400,14 +413,26 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
400413
* Make room for the maximum decimal number size
401414
*/
402415
string_length = ACPI_MAX_DECIMAL_DIGITS;
416+
leading_zeros = FALSE;
403417
base = 10;
404418
break;
405419

420+
case ACPI_EXPLICIT_CONVERT_HEX:
421+
/*
422+
* From to_hex_string.
423+
*
424+
* Supress leading zeros and append "0x"
425+
*/
426+
string_length =
427+
ACPI_MUL_2(acpi_gbl_integer_byte_width) + 2;
428+
leading_zeros = FALSE;
429+
break;
406430
default:
407431

408432
/* Two hex string characters for each integer byte */
409433

410434
string_length = ACPI_MUL_2(acpi_gbl_integer_byte_width);
435+
leading_zeros = TRUE;
411436
break;
412437
}
413438

@@ -422,17 +447,32 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
422447
}
423448

424449
new_buf = return_desc->buffer.pointer;
450+
if (type == ACPI_EXPLICIT_CONVERT_HEX) {
451+
452+
/* Append "0x" prefix for explicit hex conversion */
453+
454+
*new_buf++ = '0';
455+
*new_buf++ = 'x';
456+
}
425457

426458
/* Convert integer to string */
427459

428460
string_length =
429461
acpi_ex_convert_to_ascii(obj_desc->integer.value, base,
430462
new_buf,
431-
acpi_gbl_integer_byte_width);
463+
acpi_gbl_integer_byte_width,
464+
leading_zeros);
432465

433466
/* Null terminate at the correct place */
434467

435468
return_desc->string.length = string_length;
469+
if (type == ACPI_EXPLICIT_CONVERT_HEX) {
470+
471+
/* Take "0x" prefix into account */
472+
473+
return_desc->string.length += 2;
474+
}
475+
436476
new_buf[string_length] = 0;
437477
break;
438478

@@ -448,6 +488,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
448488
* From ACPI: "If the input is a buffer, it is converted to a
449489
* a string of decimal values separated by commas."
450490
*/
491+
leading_zeros = FALSE;
451492
base = 10;
452493

453494
/*
@@ -475,6 +516,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
475516
*
476517
* Each hex number is prefixed with 0x (11/2018)
477518
*/
519+
leading_zeros = TRUE;
478520
separator = ' ';
479521
string_length = (obj_desc->buffer.length * 5);
480522
break;
@@ -488,6 +530,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
488530
*
489531
* Each hex number is prefixed with 0x (11/2018)
490532
*/
533+
leading_zeros = TRUE;
491534
separator = ',';
492535
string_length = (obj_desc->buffer.length * 5);
493536
break;
@@ -528,7 +571,8 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
528571

529572
new_buf += acpi_ex_convert_to_ascii((u64) obj_desc->
530573
buffer.pointer[i],
531-
base, new_buf, 1);
574+
base, new_buf, 1,
575+
leading_zeros);
532576

533577
/* Each digit is separated by either a comma or space */
534578

drivers/acpi/acpica/exprep.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,9 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
437437

438438
if (info->connection_node) {
439439
second_desc = info->connection_node->object;
440+
if (second_desc == NULL) {
441+
break;
442+
}
440443
if (!(second_desc->common.flags & AOPOBJ_DATA_VALID)) {
441444
status =
442445
acpi_ds_get_buffer_arguments(second_desc);

drivers/acpi/acpica/exsystem.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,15 @@ acpi_status acpi_ex_system_do_stall(u32 how_long_us)
133133
* (ACPI specifies 100 usec as max, but this gives some slack in
134134
* order to support existing BIOSs)
135135
*/
136-
ACPI_ERROR((AE_INFO,
137-
"Time parameter is too large (%u)", how_long_us));
136+
ACPI_ERROR_ONCE((AE_INFO,
137+
"Time parameter is too large (%u)",
138+
how_long_us));
138139
status = AE_AML_OPERAND_VALUE;
139140
} else {
140141
if (how_long_us > 100) {
141-
ACPI_WARNING((AE_INFO,
142-
"Time parameter %u us > 100 us violating ACPI spec, please fix the firmware.",
143-
how_long_us));
142+
ACPI_WARNING_ONCE((AE_INFO,
143+
"Time parameter %u us > 100 us violating ACPI spec, please fix the firmware.",
144+
how_long_us));
144145
}
145146
acpi_os_stall(how_long_us);
146147
}

drivers/acpi/acpica/hwxfsleep.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,11 @@
1616
ACPI_MODULE_NAME("hwxfsleep")
1717

1818
/* Local prototypes */
19-
#if (!ACPI_REDUCED_HARDWARE)
2019
static acpi_status
2120
acpi_hw_set_firmware_waking_vector(struct acpi_table_facs *facs,
2221
acpi_physical_address physical_address,
2322
acpi_physical_address physical_address64);
24-
#endif
25-
26-
/*
27-
* These functions are removed for the ACPI_REDUCED_HARDWARE case:
28-
* acpi_set_firmware_waking_vector
29-
* acpi_enter_sleep_state_s4bios
30-
*/
3123

32-
#if (!ACPI_REDUCED_HARDWARE)
3324
/*******************************************************************************
3425
*
3526
* FUNCTION: acpi_hw_set_firmware_waking_vector
@@ -115,6 +106,12 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
115106

116107
ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector)
117108

109+
/*
110+
* These functions are removed for the ACPI_REDUCED_HARDWARE case:
111+
* acpi_enter_sleep_state_s4bios
112+
*/
113+
114+
#if (!ACPI_REDUCED_HARDWARE)
118115
/*******************************************************************************
119116
*
120117
* FUNCTION: acpi_enter_sleep_state_s4bios

drivers/acpi/acpica/psargs.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state);
2525
static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
2626
*parser_state);
2727

28+
static void acpi_ps_free_field_list(union acpi_parse_object *start);
29+
2830
/*******************************************************************************
2931
*
3032
* FUNCTION: acpi_ps_get_next_package_length
@@ -683,6 +685,39 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
683685
return_PTR(field);
684686
}
685687

688+
/*******************************************************************************
689+
*
690+
* FUNCTION: acpi_ps_free_field_list
691+
*
692+
* PARAMETERS: start - First Op in field list
693+
*
694+
* RETURN: None.
695+
*
696+
* DESCRIPTION: Free all Op objects inside a field list.
697+
*
698+
******************************************************************************/
699+
700+
static void acpi_ps_free_field_list(union acpi_parse_object *start)
701+
{
702+
union acpi_parse_object *cur = start;
703+
union acpi_parse_object *next;
704+
union acpi_parse_object *arg;
705+
706+
while (cur) {
707+
next = cur->common.next;
708+
709+
/* AML_INT_CONNECTION_OP can have a single argument */
710+
711+
arg = acpi_ps_get_arg(cur, 0);
712+
if (arg) {
713+
acpi_ps_free_op(arg);
714+
}
715+
716+
acpi_ps_free_op(cur);
717+
cur = next;
718+
}
719+
}
720+
686721
/*******************************************************************************
687722
*
688723
* FUNCTION: acpi_ps_get_next_arg
@@ -751,6 +786,10 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
751786
while (parser_state->aml < parser_state->pkg_end) {
752787
field = acpi_ps_get_next_field(parser_state);
753788
if (!field) {
789+
if (arg) {
790+
acpi_ps_free_field_list(arg);
791+
}
792+
754793
return_ACPI_STATUS(AE_NO_MEMORY);
755794
}
756795

@@ -820,6 +859,10 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
820859
acpi_ps_get_next_namepath(walk_state, parser_state,
821860
arg,
822861
ACPI_NOT_METHOD_CALL);
862+
if (ACPI_FAILURE(status)) {
863+
acpi_ps_free_op(arg);
864+
return_ACPI_STATUS(status);
865+
}
823866
} else {
824867
/* Single complex argument, nothing returned */
825868

@@ -854,6 +897,10 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
854897
acpi_ps_get_next_namepath(walk_state, parser_state,
855898
arg,
856899
ACPI_POSSIBLE_METHOD_CALL);
900+
if (ACPI_FAILURE(status)) {
901+
acpi_ps_free_op(arg);
902+
return_ACPI_STATUS(status);
903+
}
857904

858905
if (arg->common.aml_opcode == AML_INT_METHODCALL_OP) {
859906

drivers/acpi/acpica/rsaddr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ acpi_rs_get_address_common(struct acpi_resource *resource,
282282

283283
/* Validate the Resource Type */
284284

285-
if ((address.resource_type > 2) && (address.resource_type < 0xC0)) {
285+
if ((address.resource_type > 2) &&
286+
(address.resource_type < 0xC0) && (address.resource_type != 0x0A)) {
286287
return (FALSE);
287288
}
288289

0 commit comments

Comments
 (0)