Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions drivers/espi/Kconfig.it8xxx2
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,20 @@ config ESPI_IT8XXX2_PORT_81_CYCLE
This allows EC to accept 2 bytes of port 80 data written from the Host.
(e.g. using iotools: iotools io_write16 0x80 0x1234)

config ESPI_IT8XXX2_H2RAM_SHARED
bool "Shared access to h2ram_pool"
help
Enabling this option exposes the eSPI driver h2ram_pool as a
global symbol (non-static), allowing other modules to reuse
this memory space.
The configurations CONFIG_ESPI_PERIPHERAL_HOST_CMD_PARAM_PORT_NUM and
CONFIG_ESPI_PERIPHERAL_ACPI_SHM_REGION_PORT_NUM have a gap in RAM space.
By enabling CONFIG_ESPI_IT8XXX2_H2RAM_SHARED, this unused gap can be
reused by other modules to reduce overall RAM usage.

NOTE: A build-time assertion must ensure that the shared region size
does not exceed the available space defined by
CONFIG_ESPI_PERIPHERAL_HOST_CMD_PARAM_PORT_NUM and
CONFIG_ESPI_PERIPHERAL_ACPI_SHM_REGION_PORT_NUM.

endif #ESPI_IT8XXX2
10 changes: 8 additions & 2 deletions drivers/espi/espi_it8xxx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,8 +948,14 @@ static const struct ec2i_t pmc2_settings[] = {
#endif
#endif

static uint8_t h2ram_pool[MAX(H2RAM_ACPI_SHM_MAX, H2RAM_EC_HOST_CMD_MAX)]
__attribute__((section(".h2ram_pool")));
#ifdef CONFIG_ESPI_IT8XXX2_H2RAM_SHARED
#define H2RAM_STORAGE
#else
#define H2RAM_STORAGE static
#endif

H2RAM_STORAGE uint8_t h2ram_pool[MAX(H2RAM_ACPI_SHM_MAX, H2RAM_EC_HOST_CMD_MAX)]
__attribute__((section(".h2ram_pool")));

#define H2RAM_WINDOW_SIZE(ram_size) ((find_msb_set((ram_size) / 16) - 1) & 0x7)

Expand Down