Skip to content

Commit 888bc86

Browse files
committed
Merge branch 'acpica'
Merge ACPICA changes, including bug fixes and cleanups as well as support for some recently defined data structures, for 6.2-rc1: - Make acpi_ex_load_op() match upstream implementation (Rafael Wysocki). - Add support for loong_arch-specific APICs in MADT (Huacai Chen). - Add support for fixed PCIe wake event (Huacai Chen). - Add EBDA pointer sanity checks (Vit Kabele). - Avoid accessing VGA memory when EBDA < 1KiB (Vit Kabele). - Add CCEL table support to both compiler/disassembler (Kuppuswamy Sathyanarayanan). - Add a couple of new UUIDs to the known UUID list (Bob Moore). - Add support for FFH Opregion special context data (Sudeep Holla). - Improve warning message for "invalid ACPI name" (Bob Moore). - Add support for CXL 3.0 structures (CXIMS & RDPAS) in the CEDT table (Alison Schofield). - Prepare IORT support for revision E.e (Robin Murphy). - Finish support for the CDAT table (Bob Moore). - Fix error code path in acpi_ds_call_control_method() (Rafael Wysocki). - Fix use-after-free in acpi_ut_copy_ipackage_to_ipackage() (Li Zetao). - Update the version of the ACPICA code in the kernel (Bob Moore). * acpica: ACPICA: Fix use-after-free in acpi_ut_copy_ipackage_to_ipackage() ACPICA: Fix error code path in acpi_ds_call_control_method() ACPICA: Update version to 20221020 ACPICA: Add utcksum.o to the acpidump Makefile Revert "LoongArch: Provisionally add ACPICA data structures" ACPICA: Finish support for the CDAT table ACPICA: IORT: Update for revision E.e ACPICA: Add CXL 3.0 structures (CXIMS & RDPAS) to the CEDT table ACPICA: Improve warning message for "invalid ACPI name" ACPICA: Add support for FFH Opregion special context data ACPICA: Add a couple of new UUIDs to the known UUID list ACPICA: iASL: Add CCEL table to both compiler/disassembler ACPICA: Do not touch VGA memory when EBDA < 1ki_b ACPICA: Check that EBDA pointer is in valid memory ACPICA: Events: Support fixed PCIe wake event ACPICA: MADT: Add loong_arch-specific APICs support ACPICA: Make acpi_ex_load_op() match upstream
2 parents 5733622 + 470188b commit 888bc86

File tree

29 files changed

+602
-263
lines changed

29 files changed

+602
-263
lines changed

arch/loongarch/include/asm/acpi.h

Lines changed: 0 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -31,148 +31,6 @@ static inline bool acpi_has_cpu_in_madt(void)
3131

3232
extern struct list_head acpi_wakeup_device_list;
3333

34-
/*
35-
* Temporary definitions until the core ACPICA code gets updated (see
36-
37-
* follow-ups for the "rationale").
38-
*
39-
* Once the "legal reasons" are cleared and that the code is merged,
40-
* this can be dropped entierely.
41-
*/
42-
#if (ACPI_CA_VERSION == 0x20220331 && !defined(LOONGARCH_ACPICA_EXT))
43-
44-
#define LOONGARCH_ACPICA_EXT 1
45-
46-
#define ACPI_MADT_TYPE_CORE_PIC 17
47-
#define ACPI_MADT_TYPE_LIO_PIC 18
48-
#define ACPI_MADT_TYPE_HT_PIC 19
49-
#define ACPI_MADT_TYPE_EIO_PIC 20
50-
#define ACPI_MADT_TYPE_MSI_PIC 21
51-
#define ACPI_MADT_TYPE_BIO_PIC 22
52-
#define ACPI_MADT_TYPE_LPC_PIC 23
53-
54-
/* Values for Version field above */
55-
56-
enum acpi_madt_core_pic_version {
57-
ACPI_MADT_CORE_PIC_VERSION_NONE = 0,
58-
ACPI_MADT_CORE_PIC_VERSION_V1 = 1,
59-
ACPI_MADT_CORE_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
60-
};
61-
62-
enum acpi_madt_lio_pic_version {
63-
ACPI_MADT_LIO_PIC_VERSION_NONE = 0,
64-
ACPI_MADT_LIO_PIC_VERSION_V1 = 1,
65-
ACPI_MADT_LIO_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
66-
};
67-
68-
enum acpi_madt_eio_pic_version {
69-
ACPI_MADT_EIO_PIC_VERSION_NONE = 0,
70-
ACPI_MADT_EIO_PIC_VERSION_V1 = 1,
71-
ACPI_MADT_EIO_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
72-
};
73-
74-
enum acpi_madt_ht_pic_version {
75-
ACPI_MADT_HT_PIC_VERSION_NONE = 0,
76-
ACPI_MADT_HT_PIC_VERSION_V1 = 1,
77-
ACPI_MADT_HT_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
78-
};
79-
80-
enum acpi_madt_bio_pic_version {
81-
ACPI_MADT_BIO_PIC_VERSION_NONE = 0,
82-
ACPI_MADT_BIO_PIC_VERSION_V1 = 1,
83-
ACPI_MADT_BIO_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
84-
};
85-
86-
enum acpi_madt_msi_pic_version {
87-
ACPI_MADT_MSI_PIC_VERSION_NONE = 0,
88-
ACPI_MADT_MSI_PIC_VERSION_V1 = 1,
89-
ACPI_MADT_MSI_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
90-
};
91-
92-
enum acpi_madt_lpc_pic_version {
93-
ACPI_MADT_LPC_PIC_VERSION_NONE = 0,
94-
ACPI_MADT_LPC_PIC_VERSION_V1 = 1,
95-
ACPI_MADT_LPC_PIC_VERSION_RESERVED = 2 /* 2 and greater are reserved */
96-
};
97-
98-
#pragma pack(1)
99-
100-
/* Core Interrupt Controller */
101-
102-
struct acpi_madt_core_pic {
103-
struct acpi_subtable_header header;
104-
u8 version;
105-
u32 processor_id;
106-
u32 core_id;
107-
u32 flags;
108-
};
109-
110-
/* Legacy I/O Interrupt Controller */
111-
112-
struct acpi_madt_lio_pic {
113-
struct acpi_subtable_header header;
114-
u8 version;
115-
u64 address;
116-
u16 size;
117-
u8 cascade[2];
118-
u32 cascade_map[2];
119-
};
120-
121-
/* Extend I/O Interrupt Controller */
122-
123-
struct acpi_madt_eio_pic {
124-
struct acpi_subtable_header header;
125-
u8 version;
126-
u8 cascade;
127-
u8 node;
128-
u64 node_map;
129-
};
130-
131-
/* HT Interrupt Controller */
132-
133-
struct acpi_madt_ht_pic {
134-
struct acpi_subtable_header header;
135-
u8 version;
136-
u64 address;
137-
u16 size;
138-
u8 cascade[8];
139-
};
140-
141-
/* Bridge I/O Interrupt Controller */
142-
143-
struct acpi_madt_bio_pic {
144-
struct acpi_subtable_header header;
145-
u8 version;
146-
u64 address;
147-
u16 size;
148-
u16 id;
149-
u16 gsi_base;
150-
};
151-
152-
/* MSI Interrupt Controller */
153-
154-
struct acpi_madt_msi_pic {
155-
struct acpi_subtable_header header;
156-
u8 version;
157-
u64 msg_address;
158-
u32 start;
159-
u32 count;
160-
};
161-
162-
/* LPC Interrupt Controller */
163-
164-
struct acpi_madt_lpc_pic {
165-
struct acpi_subtable_header header;
166-
u8 version;
167-
u64 address;
168-
u16 size;
169-
u8 cascade;
170-
};
171-
172-
#pragma pack()
173-
174-
#endif
175-
17634
#endif /* !CONFIG_ACPI */
17735

17836
#define ACPI_TABLE_UPGRADE_MAX_PHYS ARCH_LOW_ADDRESS_LIMIT

drivers/acpi/acpica/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ acpi-y += \
155155
utalloc.o \
156156
utascii.o \
157157
utbuffer.o \
158+
utcksum.o \
158159
utcopy.o \
159160
utexcep.o \
160161
utdebug.o \

drivers/acpi/acpica/acglobal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ ACPI_GLOBAL(struct acpi_table_list, acpi_gbl_root_table_list);
2424

2525
ACPI_GLOBAL(struct acpi_table_header *, acpi_gbl_DSDT);
2626
ACPI_GLOBAL(struct acpi_table_header, acpi_gbl_original_dsdt_header);
27+
ACPI_INIT_GLOBAL(char *, acpi_gbl_CDAT, NULL);
2728
ACPI_INIT_GLOBAL(u32, acpi_gbl_dsdt_index, ACPI_INVALID_TABLE_INDEX);
2829
ACPI_INIT_GLOBAL(u32, acpi_gbl_facs_index, ACPI_INVALID_TABLE_INDEX);
2930
ACPI_INIT_GLOBAL(u32, acpi_gbl_xfacs_index, ACPI_INVALID_TABLE_INDEX);

drivers/acpi/acpica/actables.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,6 @@ void
124124
acpi_tb_print_table_header(acpi_physical_address address,
125125
struct acpi_table_header *header);
126126

127-
u8 acpi_tb_checksum(u8 *buffer, u32 length);
128-
129-
acpi_status
130-
acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length);
131-
132127
void acpi_tb_check_dsdt_header(void);
133128

134129
struct acpi_table_header *acpi_tb_copy_dsdt(u32 table_index);

drivers/acpi/acpica/acutils.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,19 @@ u8 acpi_ut_valid_name_char(char character, u32 position);
158158

159159
void acpi_ut_check_and_repair_ascii(u8 *name, char *repaired_name, u32 count);
160160

161+
/*
162+
* utcksum - Checksum utilities
163+
*/
164+
u8 acpi_ut_generate_checksum(void *table, u32 length, u8 original_checksum);
165+
166+
u8 acpi_ut_checksum(u8 *buffer, u32 length);
167+
168+
acpi_status
169+
acpi_ut_verify_cdat_checksum(struct acpi_table_cdat *cdat_table, u32 length);
170+
171+
acpi_status
172+
acpi_ut_verify_checksum(struct acpi_table_header *table, u32 length);
173+
161174
/*
162175
* utnonansi - Non-ANSI C library functions
163176
*/

drivers/acpi/acpica/dsmethod.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
517517
info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
518518
if (!info) {
519519
status = AE_NO_MEMORY;
520-
goto cleanup;
520+
goto pop_walk_state;
521521
}
522522

523523
info->parameters = &this_walk_state->operands[0];
@@ -529,7 +529,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
529529

530530
ACPI_FREE(info);
531531
if (ACPI_FAILURE(status)) {
532-
goto cleanup;
532+
goto pop_walk_state;
533533
}
534534

535535
next_walk_state->method_nesting_depth =
@@ -575,6 +575,12 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
575575

576576
return_ACPI_STATUS(status);
577577

578+
pop_walk_state:
579+
580+
/* On error, pop the walk state to be deleted from thread */
581+
582+
acpi_ds_pop_walk_state(thread);
583+
578584
cleanup:
579585

580586
/* On error, we must terminate the method properly */

drivers/acpi/acpica/evevent.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ static acpi_status acpi_ev_fixed_event_initialize(void)
142142
status =
143143
acpi_write_bit_register(acpi_gbl_fixed_event_info
144144
[i].enable_register_id,
145+
(i ==
146+
ACPI_EVENT_PCIE_WAKE) ?
147+
ACPI_ENABLE_EVENT :
145148
ACPI_DISABLE_EVENT);
146149
if (ACPI_FAILURE(status)) {
147150
return (status);
@@ -185,6 +188,11 @@ u32 acpi_ev_fixed_event_detect(void)
185188
return (int_status);
186189
}
187190

191+
if (fixed_enable & ACPI_BITMASK_PCIEXP_WAKE_DISABLE)
192+
fixed_enable &= ~ACPI_BITMASK_PCIEXP_WAKE_DISABLE;
193+
else
194+
fixed_enable |= ACPI_BITMASK_PCIEXP_WAKE_DISABLE;
195+
188196
ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
189197
"Fixed Event Block: Enable %08X Status %08X\n",
190198
fixed_enable, fixed_status));
@@ -250,6 +258,9 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event)
250258
if (!acpi_gbl_fixed_event_handlers[event].handler) {
251259
(void)acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
252260
enable_register_id,
261+
(event ==
262+
ACPI_EVENT_PCIE_WAKE) ?
263+
ACPI_ENABLE_EVENT :
253264
ACPI_DISABLE_EVENT);
254265

255266
ACPI_ERROR((AE_INFO,

drivers/acpi/acpica/evregion.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,15 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
172172
ctx->subspace_id = (u8)region_obj->region.address;
173173
}
174174

175+
if (region_obj->region.space_id ==
176+
ACPI_ADR_SPACE_FIXED_HARDWARE) {
177+
struct acpi_ffh_info *ctx =
178+
handler_desc->address_space.context;
179+
180+
ctx->length = region_obj->region.length;
181+
ctx->offset = region_obj->region.address;
182+
}
183+
175184
/*
176185
* We must exit the interpreter because the region setup will
177186
* potentially execute control methods (for example, the _REG method

drivers/acpi/acpica/exconfig.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
295295
target));
296296
}
297297
if (target->common.type != ACPI_TYPE_INTEGER) {
298-
ACPI_EXCEPTION((AE_INFO, AE_TYPE,
299-
"Type not integer: %X\n", target->common.type));
298+
ACPI_ERROR((AE_INFO, "Type not integer: %X",
299+
target->common.type));
300300
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
301301
}
302302

drivers/acpi/acpica/exfield.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
141141
|| obj_desc->field.region_obj->region.space_id ==
142142
ACPI_ADR_SPACE_IPMI
143143
|| obj_desc->field.region_obj->region.space_id ==
144-
ACPI_ADR_SPACE_PLATFORM_RT)) {
144+
ACPI_ADR_SPACE_PLATFORM_RT
145+
|| obj_desc->field.region_obj->region.space_id ==
146+
ACPI_ADR_SPACE_FIXED_HARDWARE)) {
145147

146148
/* SMBus, GSBus, IPMI serial */
147149

@@ -305,7 +307,9 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
305307
|| obj_desc->field.region_obj->region.space_id ==
306308
ACPI_ADR_SPACE_IPMI
307309
|| obj_desc->field.region_obj->region.space_id ==
308-
ACPI_ADR_SPACE_PLATFORM_RT)) {
310+
ACPI_ADR_SPACE_PLATFORM_RT
311+
|| obj_desc->field.region_obj->region.space_id ==
312+
ACPI_ADR_SPACE_FIXED_HARDWARE)) {
309313

310314
/* SMBus, GSBus, IPMI serial */
311315

0 commit comments

Comments
 (0)