Skip to content

Commit

Permalink
Merge "ACPICA: Add CXL 3.0 structures..." into for-6.2/cxl-xor
Browse files Browse the repository at this point in the history
Pick up:

f350c68 ("ACPICA: Add CXL 3.0 structures (CXIMS & RDPAS) to the CEDT table")

...to build the new XOR interleave math support for the CXL Fixed Memory
Window Structures.
  • Loading branch information
Dan Williams committed Dec 3, 2022
2 parents f0c4d9f + f350c68 commit 7db0aa8
Show file tree
Hide file tree
Showing 14 changed files with 279 additions and 22 deletions.
11 changes: 11 additions & 0 deletions drivers/acpi/acpica/evevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ static acpi_status acpi_ev_fixed_event_initialize(void)
status =
acpi_write_bit_register(acpi_gbl_fixed_event_info
[i].enable_register_id,
(i ==
ACPI_EVENT_PCIE_WAKE) ?
ACPI_ENABLE_EVENT :
ACPI_DISABLE_EVENT);
if (ACPI_FAILURE(status)) {
return (status);
Expand Down Expand Up @@ -185,6 +188,11 @@ u32 acpi_ev_fixed_event_detect(void)
return (int_status);
}

if (fixed_enable & ACPI_BITMASK_PCIEXP_WAKE_DISABLE)
fixed_enable &= ~ACPI_BITMASK_PCIEXP_WAKE_DISABLE;
else
fixed_enable |= ACPI_BITMASK_PCIEXP_WAKE_DISABLE;

ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
"Fixed Event Block: Enable %08X Status %08X\n",
fixed_enable, fixed_status));
Expand Down Expand Up @@ -250,6 +258,9 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event)
if (!acpi_gbl_fixed_event_handlers[event].handler) {
(void)acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
enable_register_id,
(event ==
ACPI_EVENT_PCIE_WAKE) ?
ACPI_ENABLE_EVENT :
ACPI_DISABLE_EVENT);

ACPI_ERROR((AE_INFO,
Expand Down
9 changes: 9 additions & 0 deletions drivers/acpi/acpica/evregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
ctx->subspace_id = (u8)region_obj->region.address;
}

if (region_obj->region.space_id ==
ACPI_ADR_SPACE_FIXED_HARDWARE) {
struct acpi_ffh_info *ctx =
handler_desc->address_space.context;

ctx->length = region_obj->region.length;
ctx->offset = region_obj->region.address;
}

/*
* We must exit the interpreter because the region setup will
* potentially execute control methods (for example, the _REG method
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/acpica/exconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
target));
}
if (target->common.type != ACPI_TYPE_INTEGER) {
ACPI_EXCEPTION((AE_INFO, AE_TYPE,
"Type not integer: %X\n", target->common.type));
ACPI_ERROR((AE_INFO, "Type not integer: %X",
target->common.type));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}

Expand Down
8 changes: 6 additions & 2 deletions drivers/acpi/acpica/exfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
|| obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_IPMI
|| obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_PLATFORM_RT)) {
ACPI_ADR_SPACE_PLATFORM_RT
|| obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_FIXED_HARDWARE)) {

/* SMBus, GSBus, IPMI serial */

Expand Down Expand Up @@ -305,7 +307,9 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
|| obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_IPMI
|| obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_PLATFORM_RT)) {
ACPI_ADR_SPACE_PLATFORM_RT
|| obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_FIXED_HARDWARE)) {

/* SMBus, GSBus, IPMI serial */

Expand Down
6 changes: 6 additions & 0 deletions drivers/acpi/acpica/exserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,12 @@ acpi_ex_write_serial_bus(union acpi_operand_object *source_desc,
function = ACPI_WRITE;
break;

case ACPI_ADR_SPACE_FIXED_HARDWARE:

buffer_length = ACPI_FFH_INPUT_BUFFER_SIZE;
function = ACPI_WRITE;
break;

default:
return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID);
}
Expand Down
14 changes: 14 additions & 0 deletions drivers/acpi/acpica/hwsleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,20 @@ acpi_status acpi_hw_legacy_wake(u8 sleep_state)
[ACPI_EVENT_SLEEP_BUTTON].
status_register_id, ACPI_CLEAR_STATUS);

/* Enable pcie wake event if support */
if ((acpi_gbl_FADT.flags & ACPI_FADT_PCI_EXPRESS_WAKE)) {
(void)
acpi_write_bit_register(acpi_gbl_fixed_event_info
[ACPI_EVENT_PCIE_WAKE].
enable_register_id,
ACPI_DISABLE_EVENT);
(void)
acpi_write_bit_register(acpi_gbl_fixed_event_info
[ACPI_EVENT_PCIE_WAKE].
status_register_id,
ACPI_CLEAR_STATUS);
}

acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, ACPI_SST_WORKING);
return_ACPI_STATUS(status);
}
Expand Down
28 changes: 20 additions & 8 deletions drivers/acpi/acpica/tbxfroot.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ acpi_find_root_pointer(acpi_physical_address *table_address)
u8 *table_ptr;
u8 *mem_rover;
u32 physical_address;
u32 ebda_window_size;

ACPI_FUNCTION_TRACE(acpi_find_root_pointer);

Expand All @@ -139,26 +140,37 @@ acpi_find_root_pointer(acpi_physical_address *table_address)

/* EBDA present? */

if (physical_address > 0x400) {
/*
* Check that the EBDA pointer from memory is sane and does not point
* above valid low memory
*/
if (physical_address > 0x400 && physical_address < 0xA0000) {
/*
* Calculate the scan window size
* The EBDA is not guaranteed to be larger than a ki_b and in case
* that it is smaller, the scanning function would leave the low
* memory and continue to the VGA range.
*/
ebda_window_size = ACPI_MIN(ACPI_EBDA_WINDOW_SIZE,
0xA0000 - physical_address);

/*
* 1b) Search EBDA paragraphs (EBDA is required to be a
* minimum of 1K length)
* 1b) Search EBDA paragraphs
*/
table_ptr = acpi_os_map_memory((acpi_physical_address)
physical_address,
ACPI_EBDA_WINDOW_SIZE);
ebda_window_size);
if (!table_ptr) {
ACPI_ERROR((AE_INFO,
"Could not map memory at 0x%8.8X for length %u",
physical_address, ACPI_EBDA_WINDOW_SIZE));
physical_address, ebda_window_size));

return_ACPI_STATUS(AE_NO_MEMORY);
}

mem_rover =
acpi_tb_scan_memory_for_rsdp(table_ptr,
ACPI_EBDA_WINDOW_SIZE);
acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE);
acpi_tb_scan_memory_for_rsdp(table_ptr, ebda_window_size);
acpi_os_unmap_memory(table_ptr, ebda_window_size);

if (mem_rover) {

Expand Down
4 changes: 4 additions & 0 deletions drivers/acpi/acpica/utglobal.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] =
ACPI_BITREG_RT_CLOCK_ENABLE,
ACPI_BITMASK_RT_CLOCK_STATUS,
ACPI_BITMASK_RT_CLOCK_ENABLE},
/* ACPI_EVENT_PCIE_WAKE */ {ACPI_BITREG_PCIEXP_WAKE_STATUS,
ACPI_BITREG_PCIEXP_WAKE_DISABLE,
ACPI_BITMASK_PCIEXP_WAKE_STATUS,
ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
};
#endif /* !ACPI_REDUCED_HARDWARE */

Expand Down
10 changes: 5 additions & 5 deletions drivers/acpi/acpica/utstring.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void acpi_ut_repair_name(char *name)
return;
}

ACPI_COPY_NAMESEG(&original_name, name);
ACPI_COPY_NAMESEG(&original_name, &name[0]);

/* Check each character in the name */

Expand All @@ -156,10 +156,10 @@ void acpi_ut_repair_name(char *name)

/*
* Replace a bad character with something printable, yet technically
* still invalid. This prevents any collisions with existing "good"
* "odd". This prevents any collisions with existing "good"
* names in the namespace.
*/
name[i] = '*';
name[i] = '_';
found_bad_char = TRUE;
}

Expand All @@ -169,8 +169,8 @@ void acpi_ut_repair_name(char *name)

if (!acpi_gbl_enable_interpreter_slack) {
ACPI_WARNING((AE_INFO,
"Invalid character(s) in name (0x%.8X), repaired: [%4.4s]",
original_name, name));
"Invalid character(s) in name (0x%.8X) %p, repaired: [%4.4s]",
original_name, name, &name[0]));
} else {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Invalid character(s) in name (0x%.8X), repaired: [%4.4s]",
Expand Down
2 changes: 2 additions & 0 deletions include/acpi/acconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@

#define ACPI_PRM_INPUT_BUFFER_SIZE 26

#define ACPI_FFH_INPUT_BUFFER_SIZE 256

/* _sx_d and _sx_w control methods */

#define ACPI_NUM_sx_d_METHODS 4
Expand Down
35 changes: 34 additions & 1 deletion include/acpi/actbl1.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ struct acpi_cedt_header {
enum acpi_cedt_type {
ACPI_CEDT_TYPE_CHBS = 0,
ACPI_CEDT_TYPE_CFMWS = 1,
ACPI_CEDT_TYPE_RESERVED = 2,
ACPI_CEDT_TYPE_CXIMS = 2,
ACPI_CEDT_TYPE_RDPAS = 3,
ACPI_CEDT_TYPE_RESERVED = 4,
};

/* Values for version field above */
Expand Down Expand Up @@ -380,6 +382,7 @@ struct acpi_cedt_cfmws_target_element {
/* Values for Interleave Arithmetic field above */

#define ACPI_CEDT_CFMWS_ARITHMETIC_MODULO (0)
#define ACPI_CEDT_CFMWS_ARITHMETIC_XOR (1)

/* Values for Restrictions field above */

Expand All @@ -389,6 +392,36 @@ struct acpi_cedt_cfmws_target_element {
#define ACPI_CEDT_CFMWS_RESTRICT_PMEM (1<<3)
#define ACPI_CEDT_CFMWS_RESTRICT_FIXED (1<<4)

/* 2: CXL XOR Interleave Math Structure */

struct acpi_cedt_cxims {
struct acpi_cedt_header header;
u16 reserved1;
u8 hbig;
u8 nr_xormaps;
u64 xormap_list[];
};

/* 3: CXL RCEC Downstream Port Association Structure */

struct acpi_cedt_rdpas {
struct acpi_cedt_header header;
u8 reserved1;
u16 length;
u16 segment;
u16 bdf;
u8 protocol;
u64 address;
};

/* Masks for bdf field above */
#define ACPI_CEDT_RDPAS_BUS_MASK 0xff00
#define ACPI_CEDT_RDPAS_DEVICE_MASK 0x00f8
#define ACPI_CEDT_RDPAS_FUNCTION_MASK 0x0007

#define ACPI_CEDT_RDPAS_PROTOCOL_IO (0)
#define ACPI_CEDT_RDPAS_PROTOCOL_CACHEMEM (1)

/*******************************************************************************
*
* CPEP - Corrected Platform Error Polling table (ACPI 4.0)
Expand Down
Loading

0 comments on commit 7db0aa8

Please sign in to comment.