linux/drivers/misc/smpro-errmon.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Ampere Computing SoC's SMpro Error Monitoring Driver
 *
 * Copyright (c) 2022, Ampere Computing LLC
 *
 */

#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>

/* GPI RAS Error Registers */
#define GPI_RAS_ERR

/* Core and L2C Error Registers */
#define CORE_CE_ERR_CNT
#define CORE_CE_ERR_LEN
#define CORE_CE_ERR_DATA
#define CORE_UE_ERR_CNT
#define CORE_UE_ERR_LEN
#define CORE_UE_ERR_DATA

/* Memory Error Registers */
#define MEM_CE_ERR_CNT
#define MEM_CE_ERR_LEN
#define MEM_CE_ERR_DATA
#define MEM_UE_ERR_CNT
#define MEM_UE_ERR_LEN
#define MEM_UE_ERR_DATA

/* RAS Error/Warning Registers */
#define ERR_SMPRO_TYPE
#define ERR_PMPRO_TYPE
#define ERR_SMPRO_INFO_LO
#define ERR_SMPRO_INFO_HI
#define ERR_SMPRO_DATA_LO
#define ERR_SMPRO_DATA_HI
#define WARN_SMPRO_INFO_LO
#define WARN_SMPRO_INFO_HI
#define ERR_PMPRO_INFO_LO
#define ERR_PMPRO_INFO_HI
#define ERR_PMPRO_DATA_LO
#define ERR_PMPRO_DATA_HI
#define WARN_PMPRO_INFO_LO
#define WARN_PMPRO_INFO_HI

/* Boot Stage Register */
#define BOOTSTAGE
#define DIMM_SYNDROME_SEL
#define DIMM_SYNDROME_ERR
#define DIMM_SYNDROME_STAGE

/* PCIE Error Registers */
#define PCIE_CE_ERR_CNT
#define PCIE_CE_ERR_LEN
#define PCIE_CE_ERR_DATA
#define PCIE_UE_ERR_CNT
#define PCIE_UE_ERR_LEN
#define PCIE_UE_ERR_DATA

/* Other Error Registers */
#define OTHER_CE_ERR_CNT
#define OTHER_CE_ERR_LEN
#define OTHER_CE_ERR_DATA
#define OTHER_UE_ERR_CNT
#define OTHER_UE_ERR_LEN
#define OTHER_UE_ERR_DATA

/* Event Data Registers */
#define VRD_WARN_FAULT_EVENT_DATA
#define VRD_HOT_EVENT_DATA
#define DIMM_HOT_EVENT_DATA
#define DIMM_2X_REFRESH_EVENT_DATA

#define MAX_READ_BLOCK_LENGTH

#define RAS_SMPRO_ERR
#define RAS_PMPRO_ERR

enum RAS_48BYTES_ERR_TYPES {};

struct smpro_error_hdr {};

/*
 * Included Address of registers to get Count, Length of data and Data
 * of the 48 bytes error data
 */
static struct smpro_error_hdr smpro_error_table[] =;

/*
 * List of SCP registers which are used to get
 * one type of RAS Internal errors.
 */
struct smpro_int_error_hdr {};

static struct smpro_int_error_hdr list_smpro_int_error_hdr[] =;

struct smpro_errmon {};

enum EVENT_TYPES {};

/* Included Address of event source and data registers */
static u8 smpro_event_table[NUM_EVENTS_TYPE] =;

static ssize_t smpro_event_data_read(struct device *dev,
				     struct device_attribute *da, char *buf,
				     int channel)
{}

static ssize_t smpro_overflow_data_read(struct device *dev, struct device_attribute *da,
					char *buf, int channel)
{}

static ssize_t smpro_error_data_read(struct device *dev, struct device_attribute *da,
				     char *buf, int channel)
{}

/*
 * Output format:
 * <4-byte hex value of error info><4-byte hex value of error extensive data>
 * Where:
 *   + error info : The error information
 *   + error data : Extensive data (32 bits)
 * Reference to section 5.10 RAS Internal Error Register Definition in
 * Altra SOC BMC Interface specification
 */
static ssize_t smpro_internal_err_read(struct device *dev, struct device_attribute *da,
				       char *buf, int channel)
{}

/*
 * Output format:
 * <4-byte hex value of warining info>
 * Reference to section 5.10 RAS Internal Error Register Definition in
 * Altra SOC BMC Interface specification
 */
static ssize_t smpro_internal_warn_read(struct device *dev, struct device_attribute *da,
					char *buf, int channel)
{}

#define ERROR_OVERFLOW_RO(_error, _index)

ERROR_OVERFLOW_RO();
ERROR_OVERFLOW_RO();
ERROR_OVERFLOW_RO();
ERROR_OVERFLOW_RO();
ERROR_OVERFLOW_RO();
ERROR_OVERFLOW_RO();
ERROR_OVERFLOW_RO();
ERROR_OVERFLOW_RO();

#define ERROR_RO(_error, _index)

ERROR_RO();
ERROR_RO();
ERROR_RO();
ERROR_RO();
ERROR_RO();
ERROR_RO();
ERROR_RO();
ERROR_RO();

static ssize_t error_smpro_show(struct device *dev, struct device_attribute *da, char *buf)
{}
static DEVICE_ATTR_RO(error_smpro);

static ssize_t error_pmpro_show(struct device *dev, struct device_attribute *da, char *buf)
{}
static DEVICE_ATTR_RO(error_pmpro);

static ssize_t warn_smpro_show(struct device *dev, struct device_attribute *da, char *buf)
{}
static DEVICE_ATTR_RO(warn_smpro);

static ssize_t warn_pmpro_show(struct device *dev, struct device_attribute *da, char *buf)
{}
static DEVICE_ATTR_RO(warn_pmpro);

#define EVENT_RO(_event, _index)

EVENT_RO();
EVENT_RO();
EVENT_RO();
EVENT_RO();

static ssize_t smpro_dimm_syndrome_read(struct device *dev, struct device_attribute *da,
					char *buf, unsigned int slot)
{}

#define EVENT_DIMM_SYNDROME(_slot)

EVENT_DIMM_SYNDROME();
EVENT_DIMM_SYNDROME();
EVENT_DIMM_SYNDROME();
EVENT_DIMM_SYNDROME();
EVENT_DIMM_SYNDROME();
EVENT_DIMM_SYNDROME();
EVENT_DIMM_SYNDROME();
EVENT_DIMM_SYNDROME();
EVENT_DIMM_SYNDROME();
EVENT_DIMM_SYNDROME();
EVENT_DIMM_SYNDROME();
EVENT_DIMM_SYNDROME();
EVENT_DIMM_SYNDROME();
EVENT_DIMM_SYNDROME();
EVENT_DIMM_SYNDROME();
EVENT_DIMM_SYNDROME();

static struct attribute *smpro_errmon_attrs[] =;

ATTRIBUTE_GROUPS();

static int smpro_errmon_probe(struct platform_device *pdev)
{}

static struct platform_driver smpro_errmon_driver =;

module_platform_driver();

MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();