Files
linux-nv-oot/include/linux/tegra-epl.h
Rahul Bedarkar 6f854558c1 drivers/platform/tegra: Add tegra-epl driver
Add tegra-epl driver. It is used to report software detected errors via
HSP mailbox or MISC-EC registers to safety service module running on
the Functional Safety Island (FSI)

Bug 3583609

Change-Id: I5bd3e4bd261d00a353743b01c83ed8df6f00e90a
Signed-off-by: Rahul Bedarkar <rabedarkar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2710277
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-05-13 14:56:18 -07:00

84 lines
2.9 KiB
C

/* SPDX-License-Identifier: GPL-2.0
*
* Copyright (c) 2021-2022, NVIDIA CORPORATION, All rights reserved.
*/
#ifndef _TEGRA_EPL_H_
#define _TEGRA_EPL_H_
#include <uapi/linux/tegra-epl.h>
/**
* @brief Error report frame
*/
struct epl_error_report_frame {
/* Error code indicates error reported by corresponding reporter_id */
uint32_t error_code;
/* Extra information for SEH to understand error */
uint32_t error_attribute;
/* LSB 32-bit TSC counter when error is detected */
uint32_t timestamp;
/* Indicates source of error */
uint16_t reporter_id;
};
/**
* @brief API to check if SW error can be reported via Misc EC
* by reading and checking Misc EC error status register value.
*
* @param[in] dev pointer to the device structure for the kernel driver
* from where API is called.
* @param[in] err_number Generic SW error number for which status needs to
* enquired - [0 to 4].
* @param[out] status out param updated by API as follows:
* true - SW error can be reported
* false - SW error can not be reported because previous error
* is still active. Client needs to retry later.
*
* @returns
* 0 (success)
* -EINVAL (On invalid arguments)
* -ENODEV (On device driver not loaded or Misc EC not configured)
* -EACCESS (On client not allowed to report error via given Misc EC)
* -EAGAIN (On Misc EC busy, client should retry)
*/
int epl_get_misc_ec_err_status(struct device *dev, uint8_t err_number, bool *status);
/**
* @brief API to report SW error to FSI using Misc Generic SW error lines connected to
* the Misc error collator.
*
* @param[in] dev pointer to the device structure for the kernel driver
* from where API is called.
* @param[in] err_number Generic SW error number through which error
* needs to be reported.
* @param[in] sw_error_code Client Defined Error Code, which will be
* forwarded to the application on FSI.
*
* @returns
* 0 (success)
* -EINVAL (On invalid arguments)
* -ENODEV (On device driver not loaded or Misc EC not configured)
* -EACCESS (On client not allowed to report error via given Misc EC)
* -EAGAIN (On Misc EC busy, client should retry)
*/
int epl_report_misc_ec_error(struct device *dev, uint8_t err_number, uint32_t sw_error_code);
/**
* @brief API to report SW error via TOP2 HSP
*
* @param[in] error_report Error frame to be reported
*
* @return
* 0 (Success)
* -ENODEV (On device driver not loaded or not configured)
* -ETIME (On timeout)
*/
int epl_report_error(struct epl_error_report_frame error_report);
#endif /* _TEGRA_EPL_H_ */