12#ifndef ZEPHYR_INCLUDE_ESPI_SAF_H_
13#define ZEPHYR_INCLUDE_ESPI_SAF_H_
115struct espi_saf_hw_cfg;
116struct espi_saf_flash_cfg;
161 const struct espi_saf_protection *pr);
204 struct espi_callback *callback,
284static inline int z_impl_espi_saf_config(
const struct device *dev,
306 const struct espi_saf_protection *pr);
308static inline int z_impl_espi_saf_set_protection_regions(
310 const struct espi_saf_protection *pr)
312 return DEVICE_API_GET(espi_saf, dev)->set_protection_regions(dev, pr);
329static inline int z_impl_espi_saf_activate(
const struct device *dev)
346static inline bool z_impl_espi_saf_get_channel_status(
368static inline int z_impl_espi_saf_flash_read(
const struct device *dev,
396static inline int z_impl_espi_saf_flash_write(
const struct device *dev,
424static inline int z_impl_espi_saf_flash_erase(
const struct device *dev,
452static inline int z_impl_espi_saf_flash_unsuccess(
const struct device *dev,
538 __ASSERT(callback,
"Callback pointer should not be NULL");
539 __ASSERT(handler,
"Callback handler pointer should not be NULL");
541 callback->handler = handler;
542 callback->evt_type = evt_type;
558 struct espi_callback *callback)
586 struct espi_callback *callback)
604#include <zephyr/syscalls/espi_saf.h>
#define DEVICE_API_GET(_class, _dev)
Expands to the pointer of a device's API for a given class.
Definition device.h:1449
espi_bus_event
eSPI bus event.
Definition espi.h:121
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.
Definition espi.h:603
int(* espi_saf_api_activate)(const struct device *dev)
Callback API to activate the SAF block.
Definition espi_saf.h:167
int(* espi_saf_api_manage_callback)(const struct device *dev, struct espi_callback *callback, bool set)
Callback API to manage (add or remove) application callbacks.
Definition espi_saf.h:203
int(* espi_saf_api_flash_write)(const struct device *dev, struct espi_saf_packet *pckt)
Callback API to send a write request for slave attached flash.
Definition espi_saf.h:185
int(* espi_saf_api_flash_erase)(const struct device *dev, struct espi_saf_packet *pckt)
Callback API to send an erase request for slave attached flash.
Definition espi_saf.h:191
int(* espi_saf_api_config)(const struct device *dev, const struct espi_saf_cfg *cfg)
Callback API to configure the eSPI SAF controller.
Definition espi_saf.h:152
int(* espi_saf_api_flash_read)(const struct device *dev, struct espi_saf_packet *pckt)
Callback API to send a read request for slave attached flash.
Definition espi_saf.h:179
bool(* espi_saf_api_get_channel_status)(const struct device *dev)
Callback API to query if SAF is ready.
Definition espi_saf.h:173
int(* espi_saf_api_flash_unsuccess)(const struct device *dev, struct espi_saf_packet *pckt)
Callback API to respond unsuccessful completion for slave attached flash.
Definition espi_saf.h:197
int(* espi_saf_api_set_protection_regions)(const struct device *dev, const struct espi_saf_protection *pr)
Callback API to set one or more SAF protection regions.
Definition espi_saf.h:159
int espi_saf_flash_read(const struct device *dev, struct espi_saf_packet *pckt)
Sends a read request packet for slave attached flash.
int espi_saf_flash_write(const struct device *dev, struct espi_saf_packet *pckt)
Sends a write request packet for slave attached flash.
int espi_saf_flash_erase(const struct device *dev, struct espi_saf_packet *pckt)
Sends an erase request packet for slave attached flash.
int espi_saf_set_protection_regions(const struct device *dev, const struct espi_saf_protection *pr)
Set one or more SAF protection regions.
static void espi_saf_init_callback(struct espi_callback *callback, espi_callback_handler_t handler, enum espi_bus_event evt_type)
Callback model.
Definition espi_saf.h:534
int espi_saf_config(const struct device *dev, const struct espi_saf_cfg *cfg)
Configure operation of an eSPI controller.
espi_taf_event
eSPI TAF notification type.
Definition espi_saf.h:104
int espi_saf_flash_unsuccess(const struct device *dev, struct espi_saf_packet *pckt)
Response unsuccessful completion for slave attached flash.
bool espi_saf_get_channel_status(const struct device *dev)
Query to see if SAF is ready.
int espi_saf_activate(const struct device *dev)
Activate SAF block.
static int espi_saf_add_callback(const struct device *dev, struct espi_callback *callback)
Add an application callback.
Definition espi_saf.h:557
static int espi_saf_remove_callback(const struct device *dev, struct espi_callback *callback)
Remove an application callback.
Definition espi_saf.h:585
@ ESPI_TAF_EVENT_HOST_REQUEST
TAF flash access request was from the Host eSPI controller.
Definition espi_saf.h:108
@ ESPI_TAF_EVENT_NO_REQUEST
TAF generic event.
Definition espi_saf.h:106
@ ESPI_TAF_EVENT_EC0_REQUEST
TAF flash access request was from EC firmware portal 0.
Definition espi_saf.h:110
@ ESPI_TAF_EVENT_MAX_REQUEST
maximum request
Definition espi_saf.h:112
#define ENOTSUP
Unsupported value.
Definition errno.h:115
#define bool
Definition stdbool.h:13
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition device.h:513
eSPI SAF configuration parameters
Definition espi_saf.h:122
struct espi_saf_hw_cfg hwcfg
Definition espi_saf.h:124
struct espi_saf_flash_cfg * flash_cfgs
Definition espi_saf.h:125
uint8_t nflash_devices
Definition espi_saf.h:123
<span class="mlabel">Driver Operations</span> eSPI SAF driver operations
Definition espi_saf.h:210
espi_saf_api_get_channel_status get_channel_status
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition espi_saf.h:218
espi_saf_api_activate activate
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition espi_saf.h:216
espi_saf_api_flash_read flash_read
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition espi_saf.h:220
espi_saf_api_set_protection_regions set_protection_regions
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition espi_saf.h:214
espi_saf_api_config config
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition espi_saf.h:212
espi_saf_api_flash_write flash_write
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition espi_saf.h:222
espi_saf_api_flash_erase flash_erase
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition espi_saf.h:224
espi_saf_api_flash_unsuccess flash_unsuccess
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition espi_saf.h:226
espi_saf_api_manage_callback manage_callback
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition espi_saf.h:228
eSPI SAF transaction packet format
Definition espi_saf.h:131
uint8_t * buf
Definition espi_saf.h:133
uint32_t flash_addr
Definition espi_saf.h:132
uint32_t len
Definition espi_saf.h:134