#include <linux/bitfield.h>
#include <linux/device.h>
#include <linux/firmware.h>
#include <linux/mfd/intel-m10-bmc.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
struct m10bmc_sec;
struct m10bmc_sec_ops { … };
struct m10bmc_sec { … };
static DEFINE_XARRAY_ALLOC(fw_upload_xa);
#define REH_SHA256_SIZE …
#define REH_SHA384_SIZE …
#define REH_MAGIC …
#define REH_SHA_NUM_BYTES …
static int m10bmc_sec_write(struct m10bmc_sec *sec, const u8 *buf, u32 offset, u32 size)
{ … }
static int m10bmc_sec_read(struct m10bmc_sec *sec, u8 *buf, u32 addr, u32 size)
{ … }
static ssize_t
show_root_entry_hash(struct device *dev, u32 exp_magic,
u32 prog_addr, u32 reh_addr, char *buf)
{ … }
#define DEVICE_ATTR_SEC_REH_RO(_name) …
DEVICE_ATTR_SEC_REH_RO(…);
DEVICE_ATTR_SEC_REH_RO(…);
DEVICE_ATTR_SEC_REH_RO(…);
#define CSK_BIT_LEN …
#define CSK_32ARRAY_SIZE …
static ssize_t
show_canceled_csk(struct device *dev, u32 addr, char *buf)
{ … }
#define DEVICE_ATTR_SEC_CSK_RO(_name) …
#define CSK_VEC_OFFSET …
DEVICE_ATTR_SEC_CSK_RO(…);
DEVICE_ATTR_SEC_CSK_RO(…);
DEVICE_ATTR_SEC_CSK_RO(…);
#define FLASH_COUNT_SIZE …
static ssize_t flash_count_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(flash_count);
static struct attribute *m10bmc_security_attrs[] = …;
static struct attribute_group m10bmc_security_attr_group = …;
static const struct attribute_group *m10bmc_sec_attr_groups[] = …;
static void log_error_regs(struct m10bmc_sec *sec, u32 doorbell)
{ … }
static int m10bmc_sec_n3000_rsu_status(struct m10bmc_sec *sec)
{ … }
static int m10bmc_sec_n6000_rsu_status(struct m10bmc_sec *sec)
{ … }
static bool rsu_status_ok(u32 status)
{ … }
static bool rsu_progress_done(u32 progress)
{ … }
static bool rsu_progress_busy(u32 progress)
{ … }
static int m10bmc_sec_progress_status(struct m10bmc_sec *sec, u32 *doorbell_reg,
u32 *progress, u32 *status)
{ … }
static enum fw_upload_err rsu_check_idle(struct m10bmc_sec *sec)
{ … }
static inline bool rsu_start_done(u32 doorbell_reg, u32 progress, u32 status)
{ … }
static enum fw_upload_err rsu_update_init(struct m10bmc_sec *sec)
{ … }
static enum fw_upload_err rsu_prog_ready(struct m10bmc_sec *sec)
{ … }
static enum fw_upload_err rsu_send_data(struct m10bmc_sec *sec)
{ … }
static int rsu_check_complete(struct m10bmc_sec *sec, u32 *doorbell_reg)
{ … }
static enum fw_upload_err rsu_cancel(struct m10bmc_sec *sec)
{ … }
static enum fw_upload_err m10bmc_sec_prepare(struct fw_upload *fwl,
const u8 *data, u32 size)
{ … }
#define WRITE_BLOCK_SIZE …
static enum fw_upload_err m10bmc_sec_fw_write(struct fw_upload *fwl, const u8 *data,
u32 offset, u32 size, u32 *written)
{ … }
static enum fw_upload_err m10bmc_sec_poll_complete(struct fw_upload *fwl)
{ … }
static void m10bmc_sec_cancel(struct fw_upload *fwl)
{ … }
static void m10bmc_sec_cleanup(struct fw_upload *fwl)
{ … }
static const struct fw_upload_ops m10bmc_ops = …;
static const struct m10bmc_sec_ops m10sec_n3000_ops = …;
static const struct m10bmc_sec_ops m10sec_n6000_ops = …;
#define SEC_UPDATE_LEN_MAX …
static int m10bmc_sec_probe(struct platform_device *pdev)
{ … }
static void m10bmc_sec_remove(struct platform_device *pdev)
{ … }
static const struct platform_device_id intel_m10bmc_sec_ids[] = …;
MODULE_DEVICE_TABLE(platform, intel_m10bmc_sec_ids);
static struct platform_driver intel_m10bmc_sec_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_IMPORT_NS(…);