Zephyr API 3.6.99
Loading...
Searching...
No Matches
espi.h File Reference

Public APIs for eSPI driver. More...

#include <errno.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/types.h>
#include <zephyr/device.h>
#include <zephyr/sys/slist.h>
#include <zephyr/syscalls/espi.h>

Go to the source code of this file.

Data Structures

struct  espi_evt_data_kbc
 Bit field definition of evt_data in struct espi_event for KBC. More...
 
struct  espi_evt_data_acpi
 Bit field definition of evt_data in struct espi_event for ACPI. More...
 
struct  espi_event
 eSPI event More...
 
struct  espi_cfg
 eSPI bus configuration parameters More...
 
struct  espi_request_packet
 eSPI peripheral request packet format More...
 
struct  espi_oob_packet
 eSPI out-of-band transaction packet format More...
 
struct  espi_flash_packet
 eSPI flash transactions packet format More...
 

Macros

#define ESPI_VWIRE_SIGNAL_OCB_0   ESPI_VWIRE_SIGNAL_TARGET_GPIO_0
 
#define ESPI_VWIRE_SIGNAL_OCB_1   ESPI_VWIRE_SIGNAL_TARGET_GPIO_1
 
#define ESPI_VWIRE_SIGNAL_OCB_2   ESPI_VWIRE_SIGNAL_TARGET_GPIO_2
 
#define ESPI_VWIRE_SIGNAL_OCB_3   ESPI_VWIRE_SIGNAL_TARGET_GPIO_3
 
#define HOST_KBC_EVT_IBF   BIT(0)
 
#define HOST_KBC_EVT_OBE   BIT(1)
 

Typedefs

typedef void(* espi_callback_handler_t) (const struct device *dev, struct espi_callback *cb, struct espi_event espi_evt)
 Define the application callback handler function signature.
 

Enumerations

enum  espi_io_mode { ESPI_IO_MODE_SINGLE_LINE = BIT(0) , ESPI_IO_MODE_DUAL_LINES = BIT(1) , ESPI_IO_MODE_QUAD_LINES = BIT(2) }
 eSPI I/O mode capabilities More...
 
enum  espi_channel { ESPI_CHANNEL_PERIPHERAL = BIT(0) , ESPI_CHANNEL_VWIRE = BIT(1) , ESPI_CHANNEL_OOB = BIT(2) , ESPI_CHANNEL_FLASH = BIT(3) }
 eSPI channel. More...
 
enum  espi_bus_event {
  ESPI_BUS_RESET = BIT(0) , ESPI_BUS_EVENT_CHANNEL_READY = BIT(1) , ESPI_BUS_EVENT_VWIRE_RECEIVED = BIT(2) , ESPI_BUS_EVENT_OOB_RECEIVED = BIT(3) ,
  ESPI_BUS_PERIPHERAL_NOTIFICATION = BIT(4) , ESPI_BUS_TAF_NOTIFICATION = BIT(5)
}
 eSPI bus event. More...
 
enum  espi_pc_event { ESPI_PC_EVT_BUS_CHANNEL_READY = BIT(0) , ESPI_PC_EVT_BUS_MASTER_ENABLE = BIT(1) }
 eSPI peripheral channel events. More...
 
enum  espi_virtual_peripheral {
  ESPI_PERIPHERAL_UART , ESPI_PERIPHERAL_8042_KBC , ESPI_PERIPHERAL_HOST_IO , ESPI_PERIPHERAL_DEBUG_PORT80 ,
  ESPI_PERIPHERAL_HOST_IO_PVT
}
 eSPI peripheral notification type. More...
 
enum  espi_cycle_type {
  ESPI_CYCLE_MEMORY_READ32 , ESPI_CYCLE_MEMORY_READ64 , ESPI_CYCLE_MEMORY_WRITE32 , ESPI_CYCLE_MEMORY_WRITE64 ,
  ESPI_CYCLE_MESSAGE_NODATA , ESPI_CYCLE_MESSAGE_DATA , ESPI_CYCLE_OK_COMPLETION_NODATA , ESPI_CYCLE_OKCOMPLETION_DATA ,
  ESPI_CYCLE_NOK_COMPLETION_NODATA
}
 eSPI cycle types supported over eSPI peripheral channel More...
 
enum  espi_vwire_signal {
  ESPI_VWIRE_SIGNAL_SLP_S3 , ESPI_VWIRE_SIGNAL_SLP_S4 , ESPI_VWIRE_SIGNAL_SLP_S5 , ESPI_VWIRE_SIGNAL_OOB_RST_WARN ,
  ESPI_VWIRE_SIGNAL_PLTRST , ESPI_VWIRE_SIGNAL_SUS_STAT , ESPI_VWIRE_SIGNAL_NMIOUT , ESPI_VWIRE_SIGNAL_SMIOUT ,
  ESPI_VWIRE_SIGNAL_HOST_RST_WARN , ESPI_VWIRE_SIGNAL_SLP_A , ESPI_VWIRE_SIGNAL_SUS_PWRDN_ACK , ESPI_VWIRE_SIGNAL_SUS_WARN ,
  ESPI_VWIRE_SIGNAL_SLP_WLAN , ESPI_VWIRE_SIGNAL_SLP_LAN , ESPI_VWIRE_SIGNAL_HOST_C10 , ESPI_VWIRE_SIGNAL_DNX_WARN ,
  ESPI_VWIRE_SIGNAL_PME , ESPI_VWIRE_SIGNAL_WAKE , ESPI_VWIRE_SIGNAL_OOB_RST_ACK , ESPI_VWIRE_SIGNAL_TARGET_BOOT_STS ,
  ESPI_VWIRE_SIGNAL_ERR_NON_FATAL , ESPI_VWIRE_SIGNAL_ERR_FATAL , ESPI_VWIRE_SIGNAL_TARGET_BOOT_DONE , ESPI_VWIRE_SIGNAL_HOST_RST_ACK ,
  ESPI_VWIRE_SIGNAL_RST_CPU_INIT , ESPI_VWIRE_SIGNAL_SMI , ESPI_VWIRE_SIGNAL_SCI , ESPI_VWIRE_SIGNAL_DNX_ACK ,
  ESPI_VWIRE_SIGNAL_SUS_ACK , ESPI_VWIRE_SIGNAL_TARGET_GPIO_0 , ESPI_VWIRE_SIGNAL_TARGET_GPIO_1 , ESPI_VWIRE_SIGNAL_TARGET_GPIO_2 ,
  ESPI_VWIRE_SIGNAL_TARGET_GPIO_3 , ESPI_VWIRE_SIGNAL_TARGET_GPIO_4 , ESPI_VWIRE_SIGNAL_TARGET_GPIO_5 , ESPI_VWIRE_SIGNAL_TARGET_GPIO_6 ,
  ESPI_VWIRE_SIGNAL_TARGET_GPIO_7 , ESPI_VWIRE_SIGNAL_TARGET_GPIO_8 , ESPI_VWIRE_SIGNAL_TARGET_GPIO_9 , ESPI_VWIRE_SIGNAL_TARGET_GPIO_10 ,
  ESPI_VWIRE_SIGNAL_TARGET_GPIO_11 , ESPI_VWIRE_SIGNAL_COUNT
}
 eSPI system platform signals that can be send or receive through virtual wire channel More...
 
enum  lpc_peripheral_opcode {
  E8042_OBF_HAS_CHAR = 0x50 , E8042_IBF_HAS_CHAR , E8042_WRITE_KB_CHAR , E8042_WRITE_MB_CHAR ,
  E8042_RESUME_IRQ , E8042_PAUSE_IRQ , E8042_CLEAR_OBF , E8042_READ_KB_STS ,
  E8042_SET_FLAG , E8042_CLEAR_FLAG , EACPI_OBF_HAS_CHAR = EACPI_START_OPCODE , EACPI_IBF_HAS_CHAR ,
  EACPI_WRITE_CHAR , EACPI_READ_STS , EACPI_WRITE_STS
}
 

Functions

int espi_config (const struct device *dev, struct espi_cfg *cfg)
 Configure operation of a eSPI controller.
 
bool espi_get_channel_status (const struct device *dev, enum espi_channel ch)
 Query to see if it a channel is ready.
 
int espi_read_request (const struct device *dev, struct espi_request_packet *req)
 Sends memory, I/O or message read request over eSPI.
 
int espi_write_request (const struct device *dev, struct espi_request_packet *req)
 Sends memory, I/O or message write request over eSPI.
 
int espi_read_lpc_request (const struct device *dev, enum lpc_peripheral_opcode op, uint32_t *data)
 Reads SOC data from a LPC peripheral with information updated over eSPI.
 
int espi_write_lpc_request (const struct device *dev, enum lpc_peripheral_opcode op, uint32_t *data)
 Writes data to a LPC peripheral which generates an eSPI transaction.
 
int espi_send_vwire (const struct device *dev, enum espi_vwire_signal signal, uint8_t level)
 Sends system/platform signal as a virtual wire packet.
 
int espi_receive_vwire (const struct device *dev, enum espi_vwire_signal signal, uint8_t *level)
 Retrieves level status for a signal encapsulated in a virtual wire.
 
int espi_send_oob (const struct device *dev, struct espi_oob_packet *pckt)
 Sends SMBus transaction (out-of-band) packet over eSPI bus.
 
int espi_receive_oob (const struct device *dev, struct espi_oob_packet *pckt)
 Receives SMBus transaction (out-of-band) packet from eSPI bus.
 
int espi_read_flash (const struct device *dev, struct espi_flash_packet *pckt)
 Sends a read request packet for shared flash.
 
int espi_write_flash (const struct device *dev, struct espi_flash_packet *pckt)
 Sends a write request packet for shared flash.
 
int espi_flash_erase (const struct device *dev, struct espi_flash_packet *pckt)
 Sends a write request packet for shared flash.
 
static void espi_init_callback (struct espi_callback *callback, espi_callback_handler_t handler, enum espi_bus_event evt_type)
 Callback model.
 
static int espi_add_callback (const struct device *dev, struct espi_callback *callback)
 Add an application callback.
 
static int espi_remove_callback (const struct device *dev, struct espi_callback *callback)
 Remove an application callback.
 

Detailed Description

Public APIs for eSPI driver.