12#ifndef ZEPHYR_INCLUDE_DRIVERS_EDAC_H_
13#define ZEPHYR_INCLUDE_DRIVERS_EDAC_H_
43typedef void (*edac_notify_callback_f)(
const struct device *dev,
void *
data);
50__subsystem
struct edac_driver_api {
52 int (*inject_set_param1)(
const struct device *dev,
uint64_t value);
53 int (*inject_get_param1)(
const struct device *dev,
uint64_t *value);
54 int (*inject_set_param2)(
const struct device *dev,
uint64_t value);
55 int (*inject_get_param2)(
const struct device *dev,
uint64_t *value);
56 int (*inject_set_error_type)(
const struct device *dev,
uint32_t value);
57 int (*inject_get_error_type)(
const struct device *dev,
uint32_t *value);
58 int (*inject_error_trigger)(
const struct device *dev);
61 int (*ecc_error_log_get)(
const struct device *dev,
uint64_t *value);
62 int (*ecc_error_log_clear)(
const struct device *dev);
63 int (*parity_error_log_get)(
const struct device *dev,
uint64_t *value);
64 int (*parity_error_log_clear)(
const struct device *dev);
67 int (*errors_cor_get)(
const struct device *dev);
68 int (*errors_uc_get)(
const struct device *dev);
71 int (*notify_cb_set)(
const struct device *dev,
72 edac_notify_callback_f cb);
100 const struct edac_driver_api *api =
101 (
const struct edac_driver_api *)dev->
api;
103 if (api->inject_set_param1 == NULL) {
107 return api->inject_set_param1(dev, value);
124 const struct edac_driver_api *api =
125 (
const struct edac_driver_api *)dev->
api;
127 if (api->inject_get_param1 == NULL) {
131 return api->inject_get_param1(dev, value);
149 const struct edac_driver_api *api =
150 (
const struct edac_driver_api *)dev->
api;
152 if (api->inject_set_param2 == NULL) {
156 return api->inject_set_param2(dev, value);
171 const struct edac_driver_api *api =
172 (
const struct edac_driver_api *)dev->
api;
174 if (api->inject_get_param2 == NULL) {
178 return api->inject_get_param2(dev, value);
195 const struct edac_driver_api *api =
196 (
const struct edac_driver_api *)dev->
api;
198 if (api->inject_set_error_type == NULL) {
202 return api->inject_set_error_type(dev, error_type);
219 const struct edac_driver_api *api =
220 (
const struct edac_driver_api *)dev->
api;
222 if (api->inject_get_error_type == NULL) {
226 return api->inject_get_error_type(dev, error_type);
241 const struct edac_driver_api *api =
242 (
const struct edac_driver_api *)dev->
api;
244 if (api->inject_error_trigger == NULL) {
248 return api->inject_error_trigger(dev);
274 const struct edac_driver_api *api =
275 (
const struct edac_driver_api *)dev->
api;
277 if (api->ecc_error_log_get == NULL) {
281 return api->ecc_error_log_get(dev, value);
296 const struct edac_driver_api *api =
297 (
const struct edac_driver_api *)dev->
api;
299 if (api->ecc_error_log_clear == NULL) {
303 return api->ecc_error_log_clear(dev);
320 const struct edac_driver_api *api =
321 (
const struct edac_driver_api *)dev->
api;
323 if (api->parity_error_log_get == NULL) {
327 return api->parity_error_log_get(dev, value);
342 const struct edac_driver_api *api =
343 (
const struct edac_driver_api *)dev->
api;
345 if (api->parity_error_log_clear == NULL) {
349 return api->parity_error_log_clear(dev);
362 const struct edac_driver_api *api =
363 (
const struct edac_driver_api *)dev->
api;
365 if (api->errors_cor_get == NULL) {
369 return api->errors_cor_get(dev);
382 const struct edac_driver_api *api =
383 (
const struct edac_driver_api *)dev->
api;
385 if (api->errors_uc_get == NULL) {
389 return api->errors_uc_get(dev);
404 edac_notify_callback_f cb)
406 const struct edac_driver_api *api = (
const struct edac_driver_api *)dev->
api;
408 if (api->notify_cb_set == NULL) {
412 return api->notify_cb_set(dev, cb);
static int edac_inject_set_error_type(const struct device *dev, uint32_t error_type)
Set error type value.
Definition: edac.h:192
static int edac_notify_callback_set(const struct device *dev, edac_notify_callback_f cb)
Register callback function for memory error exception.
Definition: edac.h:403
static int edac_inject_get_param2(const struct device *dev, uint64_t *value)
Get injection parameter param2.
Definition: edac.h:168
edac_error_type
EDAC error type.
Definition: edac.h:30
static int edac_ecc_error_log_get(const struct device *dev, uint64_t *value)
Get ECC Error Log.
Definition: edac.h:271
static int edac_inject_get_param1(const struct device *dev, uint64_t *value)
Get injection parameter param1.
Definition: edac.h:121
static int edac_inject_set_param2(const struct device *dev, uint64_t value)
Set injection parameter param2.
Definition: edac.h:146
static int edac_parity_error_log_get(const struct device *dev, uint64_t *value)
Get Parity Error Log.
Definition: edac.h:317
static int edac_ecc_error_log_clear(const struct device *dev)
Clear ECC Error Log.
Definition: edac.h:294
static int edac_parity_error_log_clear(const struct device *dev)
Clear Parity Error Log.
Definition: edac.h:340
static int edac_inject_set_param1(const struct device *dev, uint64_t value)
Set injection parameter param1.
Definition: edac.h:97
static int edac_errors_cor_get(const struct device *dev)
Get number of correctable errors.
Definition: edac.h:360
static int edac_errors_uc_get(const struct device *dev)
Get number of uncorrectable errors.
Definition: edac.h:380
static int edac_inject_error_trigger(const struct device *dev)
Set injection control.
Definition: edac.h:239
static int edac_inject_get_error_type(const struct device *dev, uint32_t *error_type)
Get error type value.
Definition: edac.h:216
@ EDAC_ERROR_TYPE_DRAM_UC
Uncorrectable error type.
Definition: edac.h:34
@ EDAC_ERROR_TYPE_DRAM_COR
Correctable error type.
Definition: edac.h:32
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
#define ENOSYS
Function not implemented.
Definition: errno.h:82
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT64_TYPE__ uint64_t
Definition: stdint.h:91
Runtime device structure (in ROM) per driver instance.
Definition: device.h:403
void * data
Address of the device instance private data.
Definition: device.h:413
const void * api
Address of the API structure exposed by the device instance.
Definition: device.h:409