aboutsummaryrefslogtreecommitdiff
path: root/src/soc/amd/common/block/include/amdblocks/espi.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/amd/common/block/include/amdblocks/espi.h')
-rw-r--r--src/soc/amd/common/block/include/amdblocks/espi.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/soc/amd/common/block/include/amdblocks/espi.h b/src/soc/amd/common/block/include/amdblocks/espi.h
index 82410e58d3..53cc5f9f3f 100644
--- a/src/soc/amd/common/block/include/amdblocks/espi.h
+++ b/src/soc/amd/common/block/include/amdblocks/espi.h
@@ -4,6 +4,9 @@
#ifndef __AMDBLOCKS_ESPI_H__
#define __AMDBLOCKS_ESPI_H__
+#include <stdint.h>
+#include <stddef.h>
+
/* eSPI MMIO base lives at an offset of 0x10000 from the address in SPI BAR. */
#define ESPI_OFFSET_FROM_BAR 0x10000
@@ -24,4 +27,32 @@
#define ESPI_GENERIC_MMIO_WIN_COUNT 4
#define ESPI_GENERIC_MMIO_MAX_WIN_SIZE 0x10000
+struct espi_config {
+ /* Bitmap for standard IO decodes. Use ESPI_DECODE_IO_* above. */
+ uint32_t std_io_decode_bitmap;
+
+ struct {
+ uint16_t base;
+ size_t size;
+ } generic_io_range[ESPI_GENERIC_IO_WIN_COUNT];
+};
+
+/*
+ * Open I/O window using the provided base and size.
+ * Return value: 0 = success, -1 = error.
+ */
+int espi_open_io_window(uint16_t base, size_t size);
+
+/*
+ * Open MMIO window using the provided base and size.
+ * Return value: 0 = success, -1 = error.
+ */
+int espi_open_mmio_window(uint32_t base, size_t size);
+
+/*
+ * Configure generic and standard I/O decode windows using the espi_config structure settings
+ * provided by mainboard in device tree.
+ */
+void espi_configure_decodes(void);
+
#endif /* __AMDBLOCKS_ESPI_H__ */