12#ifndef ZEPHYR_INCLUDE_DRIVERS_EDAC_H_
13#define ZEPHYR_INCLUDE_DRIVERS_EDAC_H_
41typedef void (*edac_notify_callback_f)(
const struct device *dev,
void *
data);
48__subsystem
struct edac_driver_api {
50 int (*inject_set_param1)(
const struct device *dev,
uint64_t value);
51 int (*inject_get_param1)(
const struct device *dev,
uint64_t *value);
52 int (*inject_set_param2)(
const struct device *dev,
uint64_t value);
53 int (*inject_get_param2)(
const struct device *dev,
uint64_t *value);
54 int (*inject_set_error_type)(
const struct device *dev,
uint32_t value);
55 int (*inject_get_error_type)(
const struct device *dev,
uint32_t *value);
56 int (*inject_error_trigger)(
const struct device *dev);
59 int (*ecc_error_log_get)(
const struct device *dev,
uint64_t *value);
60 int (*ecc_error_log_clear)(
const struct device *dev);
61 int (*parity_error_log_get)(
const struct device *dev,
uint64_t *value);
62 int (*parity_error_log_clear)(
const struct device *dev);
65 int (*errors_cor_get)(
const struct device *dev);
66 int (*errors_uc_get)(
const struct device *dev);
69 int (*notify_cb_set)(
const struct device *dev,
70 edac_notify_callback_f cb);
98 const struct edac_driver_api *api =
99 (
const struct edac_driver_api *)dev->
api;
101 if (api->inject_set_param1 == NULL) {
105 return api->inject_set_param1(dev, value);
122 const struct edac_driver_api *api =
123 (
const struct edac_driver_api *)dev->
api;
125 if (api->inject_get_param1 == NULL) {
129 return api->inject_get_param1(dev, value);
147 const struct edac_driver_api *api =
148 (
const struct edac_driver_api *)dev->
api;
150 if (api->inject_set_param2 == NULL) {
154 return api->inject_set_param2(dev, value);
169 const struct edac_driver_api *api =
170 (
const struct edac_driver_api *)dev->
api;
172 if (api->inject_get_param2 == NULL) {
176 return api->inject_get_param2(dev, value);
193 const struct edac_driver_api *api =
194 (
const struct edac_driver_api *)dev->
api;
196 if (api->inject_set_error_type == NULL) {
200 return api->inject_set_error_type(dev, error_type);
217 const struct edac_driver_api *api =
218 (
const struct edac_driver_api *)dev->
api;
220 if (api->inject_get_error_type == NULL) {
224 return api->inject_get_error_type(dev, error_type);
239 const struct edac_driver_api *api =
240 (
const struct edac_driver_api *)dev->
api;
242 if (api->inject_error_trigger == NULL) {
246 return api->inject_error_trigger(dev);
272 const struct edac_driver_api *api =
273 (
const struct edac_driver_api *)dev->
api;
275 if (api->ecc_error_log_get == NULL) {
279 return api->ecc_error_log_get(dev, value);
294 const struct edac_driver_api *api =
295 (
const struct edac_driver_api *)dev->
api;
297 if (api->ecc_error_log_clear == NULL) {
301 return api->ecc_error_log_clear(dev);
318 const struct edac_driver_api *api =
319 (
const struct edac_driver_api *)dev->
api;
321 if (api->parity_error_log_get == NULL) {
325 return api->parity_error_log_get(dev, value);
340 const struct edac_driver_api *api =
341 (
const struct edac_driver_api *)dev->
api;
343 if (api->parity_error_log_clear == NULL) {
347 return api->parity_error_log_clear(dev);
360 const struct edac_driver_api *api =
361 (
const struct edac_driver_api *)dev->
api;
363 if (api->errors_cor_get == NULL) {
367 return api->errors_cor_get(dev);
380 const struct edac_driver_api *api =
381 (
const struct edac_driver_api *)dev->
api;
383 if (api->errors_uc_get == NULL) {
387 return api->errors_uc_get(dev);
402 edac_notify_callback_f cb)
404 const struct edac_driver_api *api = (
const struct edac_driver_api *)dev->
api;
406 if (api->notify_cb_set == NULL) {
410 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:190
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:401
static int edac_inject_get_param2(const struct device *dev, uint64_t *value)
Get injection parameter param2.
Definition: edac.h:166
edac_error_type
EDAC error type.
Definition: edac.h:28
static int edac_ecc_error_log_get(const struct device *dev, uint64_t *value)
Get ECC Error Log.
Definition: edac.h:269
static int edac_inject_get_param1(const struct device *dev, uint64_t *value)
Get injection parameter param1.
Definition: edac.h:119
static int edac_inject_set_param2(const struct device *dev, uint64_t value)
Set injection parameter param2.
Definition: edac.h:144
static int edac_parity_error_log_get(const struct device *dev, uint64_t *value)
Get Parity Error Log.
Definition: edac.h:315
static int edac_ecc_error_log_clear(const struct device *dev)
Clear ECC Error Log.
Definition: edac.h:292
static int edac_parity_error_log_clear(const struct device *dev)
Clear Parity Error Log.
Definition: edac.h:338
static int edac_inject_set_param1(const struct device *dev, uint64_t value)
Set injection parameter param1.
Definition: edac.h:95
static int edac_errors_cor_get(const struct device *dev)
Get number of correctable errors.
Definition: edac.h:358
static int edac_errors_uc_get(const struct device *dev)
Get number of uncorrectable errors.
Definition: edac.h:378
static int edac_inject_error_trigger(const struct device *dev)
Set injection control.
Definition: edac.h:237
static int edac_inject_get_error_type(const struct device *dev, uint32_t *error_type)
Get error type value.
Definition: edac.h:214
@ EDAC_ERROR_TYPE_DRAM_UC
Uncorrectable error type.
Definition: edac.h:32
@ EDAC_ERROR_TYPE_DRAM_COR
Correctable error type.
Definition: edac.h:30
#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:83
__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:387
void * data
Address of the device instance private data.
Definition: device.h:397
const void * api
Address of the API structure exposed by the device instance.
Definition: device.h:393