1bdf86d0eSRuss Weight // SPDX-License-Identifier: GPL-2.0 2bdf86d0eSRuss Weight /* 3bdf86d0eSRuss Weight * Intel MAX10 Board Management Controller Secure Update Driver 4bdf86d0eSRuss Weight * 5bdf86d0eSRuss Weight * Copyright (C) 2019-2022 Intel Corporation. All rights reserved. 6bdf86d0eSRuss Weight * 7bdf86d0eSRuss Weight */ 8bdf86d0eSRuss Weight #include <linux/bitfield.h> 9bdf86d0eSRuss Weight #include <linux/device.h> 10bdf86d0eSRuss Weight #include <linux/firmware.h> 11bdf86d0eSRuss Weight #include <linux/mfd/intel-m10-bmc.h> 12bdf86d0eSRuss Weight #include <linux/mod_devicetable.h> 13bdf86d0eSRuss Weight #include <linux/module.h> 14bdf86d0eSRuss Weight #include <linux/platform_device.h> 15bdf86d0eSRuss Weight #include <linux/slab.h> 16bdf86d0eSRuss Weight 17*001a734aSIlpo Järvinen struct m10bmc_sec; 18*001a734aSIlpo Järvinen 19*001a734aSIlpo Järvinen struct m10bmc_sec_ops { 20*001a734aSIlpo Järvinen int (*rsu_status)(struct m10bmc_sec *sec); 21*001a734aSIlpo Järvinen }; 22*001a734aSIlpo Järvinen 23bdf86d0eSRuss Weight struct m10bmc_sec { 24bdf86d0eSRuss Weight struct device *dev; 25bdf86d0eSRuss Weight struct intel_m10bmc *m10bmc; 265cd339b3SRuss Weight struct fw_upload *fwl; 275cd339b3SRuss Weight char *fw_name; 285cd339b3SRuss Weight u32 fw_name_id; 295cd339b3SRuss Weight bool cancel_request; 30*001a734aSIlpo Järvinen const struct m10bmc_sec_ops *ops; 31bdf86d0eSRuss Weight }; 32bdf86d0eSRuss Weight 335cd339b3SRuss Weight static DEFINE_XARRAY_ALLOC(fw_upload_xa); 345cd339b3SRuss Weight 35bdf86d0eSRuss Weight /* Root Entry Hash (REH) support */ 36bdf86d0eSRuss Weight #define REH_SHA256_SIZE 32 37bdf86d0eSRuss Weight #define REH_SHA384_SIZE 48 38bdf86d0eSRuss Weight #define REH_MAGIC GENMASK(15, 0) 39bdf86d0eSRuss Weight #define REH_SHA_NUM_BYTES GENMASK(31, 16) 40bdf86d0eSRuss Weight 413e10c805SIlpo Järvinen static int m10bmc_sec_write(struct m10bmc_sec *sec, const u8 *buf, u32 offset, u32 size) 423e10c805SIlpo Järvinen { 433e10c805SIlpo Järvinen struct intel_m10bmc *m10bmc = sec->m10bmc; 443e10c805SIlpo Järvinen unsigned int stride = regmap_get_reg_stride(m10bmc->regmap); 453e10c805SIlpo Järvinen u32 write_count = size / stride; 463e10c805SIlpo Järvinen u32 leftover_offset = write_count * stride; 473e10c805SIlpo Järvinen u32 leftover_size = size - leftover_offset; 483e10c805SIlpo Järvinen u32 leftover_tmp = 0; 493e10c805SIlpo Järvinen int ret; 503e10c805SIlpo Järvinen 513e10c805SIlpo Järvinen if (WARN_ON_ONCE(stride > sizeof(leftover_tmp))) 523e10c805SIlpo Järvinen return -EINVAL; 533e10c805SIlpo Järvinen 543e10c805SIlpo Järvinen ret = regmap_bulk_write(m10bmc->regmap, M10BMC_STAGING_BASE + offset, 553e10c805SIlpo Järvinen buf + offset, write_count); 563e10c805SIlpo Järvinen if (ret) 573e10c805SIlpo Järvinen return ret; 583e10c805SIlpo Järvinen 593e10c805SIlpo Järvinen /* If size is not aligned to stride, handle the remainder bytes with regmap_write() */ 603e10c805SIlpo Järvinen if (leftover_size) { 613e10c805SIlpo Järvinen memcpy(&leftover_tmp, buf + leftover_offset, leftover_size); 623e10c805SIlpo Järvinen ret = regmap_write(m10bmc->regmap, M10BMC_STAGING_BASE + offset + leftover_offset, 633e10c805SIlpo Järvinen leftover_tmp); 643e10c805SIlpo Järvinen if (ret) 653e10c805SIlpo Järvinen return ret; 663e10c805SIlpo Järvinen } 673e10c805SIlpo Järvinen 683e10c805SIlpo Järvinen return 0; 693e10c805SIlpo Järvinen } 703e10c805SIlpo Järvinen 713e10c805SIlpo Järvinen static int m10bmc_sec_read(struct m10bmc_sec *sec, u8 *buf, u32 addr, u32 size) 723e10c805SIlpo Järvinen { 733e10c805SIlpo Järvinen struct intel_m10bmc *m10bmc = sec->m10bmc; 743e10c805SIlpo Järvinen unsigned int stride = regmap_get_reg_stride(m10bmc->regmap); 753e10c805SIlpo Järvinen u32 read_count = size / stride; 763e10c805SIlpo Järvinen u32 leftover_offset = read_count * stride; 773e10c805SIlpo Järvinen u32 leftover_size = size - leftover_offset; 783e10c805SIlpo Järvinen u32 leftover_tmp; 793e10c805SIlpo Järvinen int ret; 803e10c805SIlpo Järvinen 813e10c805SIlpo Järvinen if (WARN_ON_ONCE(stride > sizeof(leftover_tmp))) 823e10c805SIlpo Järvinen return -EINVAL; 833e10c805SIlpo Järvinen 843e10c805SIlpo Järvinen ret = regmap_bulk_read(m10bmc->regmap, addr, buf, read_count); 853e10c805SIlpo Järvinen if (ret) 863e10c805SIlpo Järvinen return ret; 873e10c805SIlpo Järvinen 883e10c805SIlpo Järvinen /* If size is not aligned to stride, handle the remainder bytes with regmap_read() */ 893e10c805SIlpo Järvinen if (leftover_size) { 903e10c805SIlpo Järvinen ret = regmap_read(m10bmc->regmap, addr + leftover_offset, &leftover_tmp); 913e10c805SIlpo Järvinen if (ret) 923e10c805SIlpo Järvinen return ret; 933e10c805SIlpo Järvinen memcpy(buf + leftover_offset, &leftover_tmp, leftover_size); 943e10c805SIlpo Järvinen } 953e10c805SIlpo Järvinen 963e10c805SIlpo Järvinen return 0; 973e10c805SIlpo Järvinen } 983e10c805SIlpo Järvinen 993e10c805SIlpo Järvinen 100bdf86d0eSRuss Weight static ssize_t 101bdf86d0eSRuss Weight show_root_entry_hash(struct device *dev, u32 exp_magic, 102bdf86d0eSRuss Weight u32 prog_addr, u32 reh_addr, char *buf) 103bdf86d0eSRuss Weight { 104bdf86d0eSRuss Weight struct m10bmc_sec *sec = dev_get_drvdata(dev); 105bdf86d0eSRuss Weight int sha_num_bytes, i, ret, cnt = 0; 106bdf86d0eSRuss Weight u8 hash[REH_SHA384_SIZE]; 107bdf86d0eSRuss Weight u32 magic; 108bdf86d0eSRuss Weight 1093e10c805SIlpo Järvinen ret = m10bmc_sec_read(sec, (u8 *)&magic, prog_addr, sizeof(magic)); 110bdf86d0eSRuss Weight if (ret) 111bdf86d0eSRuss Weight return ret; 112bdf86d0eSRuss Weight 113bdf86d0eSRuss Weight if (FIELD_GET(REH_MAGIC, magic) != exp_magic) 114bdf86d0eSRuss Weight return sysfs_emit(buf, "hash not programmed\n"); 115bdf86d0eSRuss Weight 116bdf86d0eSRuss Weight sha_num_bytes = FIELD_GET(REH_SHA_NUM_BYTES, magic) / 8; 1173e10c805SIlpo Järvinen if (sha_num_bytes != REH_SHA256_SIZE && 1183e10c805SIlpo Järvinen sha_num_bytes != REH_SHA384_SIZE) { 119bdf86d0eSRuss Weight dev_err(sec->dev, "%s bad sha num bytes %d\n", __func__, 120bdf86d0eSRuss Weight sha_num_bytes); 121bdf86d0eSRuss Weight return -EINVAL; 122bdf86d0eSRuss Weight } 123bdf86d0eSRuss Weight 1243e10c805SIlpo Järvinen ret = m10bmc_sec_read(sec, hash, reh_addr, sha_num_bytes); 125bdf86d0eSRuss Weight if (ret) { 1263e10c805SIlpo Järvinen dev_err(dev, "failed to read root entry hash\n"); 127bdf86d0eSRuss Weight return ret; 128bdf86d0eSRuss Weight } 129bdf86d0eSRuss Weight 130bdf86d0eSRuss Weight for (i = 0; i < sha_num_bytes; i++) 131bdf86d0eSRuss Weight cnt += sprintf(buf + cnt, "%02x", hash[i]); 132bdf86d0eSRuss Weight cnt += sprintf(buf + cnt, "\n"); 133bdf86d0eSRuss Weight 134bdf86d0eSRuss Weight return cnt; 135bdf86d0eSRuss Weight } 136bdf86d0eSRuss Weight 1376052a005SIlpo Järvinen #define DEVICE_ATTR_SEC_REH_RO(_name) \ 138bdf86d0eSRuss Weight static ssize_t _name##_root_entry_hash_show(struct device *dev, \ 139bdf86d0eSRuss Weight struct device_attribute *attr, \ 140bdf86d0eSRuss Weight char *buf) \ 1416052a005SIlpo Järvinen { \ 1426052a005SIlpo Järvinen struct m10bmc_sec *sec = dev_get_drvdata(dev); \ 1436052a005SIlpo Järvinen const struct m10bmc_csr_map *csr_map = sec->m10bmc->info->csr_map; \ 1446052a005SIlpo Järvinen \ 1456052a005SIlpo Järvinen return show_root_entry_hash(dev, csr_map->_name##_magic, \ 1466052a005SIlpo Järvinen csr_map->_name##_prog_addr, \ 1476052a005SIlpo Järvinen csr_map->_name##_reh_addr, \ 1486052a005SIlpo Järvinen buf); \ 1496052a005SIlpo Järvinen } \ 150bdf86d0eSRuss Weight static DEVICE_ATTR_RO(_name##_root_entry_hash) 151bdf86d0eSRuss Weight 1526052a005SIlpo Järvinen DEVICE_ATTR_SEC_REH_RO(bmc); 1536052a005SIlpo Järvinen DEVICE_ATTR_SEC_REH_RO(sr); 1546052a005SIlpo Järvinen DEVICE_ATTR_SEC_REH_RO(pr); 155bdf86d0eSRuss Weight 1567f03d84aSRuss Weight #define CSK_BIT_LEN 128U 1577f03d84aSRuss Weight #define CSK_32ARRAY_SIZE DIV_ROUND_UP(CSK_BIT_LEN, 32) 1587f03d84aSRuss Weight 1597f03d84aSRuss Weight static ssize_t 1607f03d84aSRuss Weight show_canceled_csk(struct device *dev, u32 addr, char *buf) 1617f03d84aSRuss Weight { 1623e10c805SIlpo Järvinen unsigned int i, size = CSK_32ARRAY_SIZE * sizeof(u32); 1637f03d84aSRuss Weight struct m10bmc_sec *sec = dev_get_drvdata(dev); 1647f03d84aSRuss Weight DECLARE_BITMAP(csk_map, CSK_BIT_LEN); 1657f03d84aSRuss Weight __le32 csk_le32[CSK_32ARRAY_SIZE]; 1667f03d84aSRuss Weight u32 csk32[CSK_32ARRAY_SIZE]; 1677f03d84aSRuss Weight int ret; 1687f03d84aSRuss Weight 1693e10c805SIlpo Järvinen ret = m10bmc_sec_read(sec, (u8 *)&csk_le32, addr, size); 1707f03d84aSRuss Weight if (ret) { 1713e10c805SIlpo Järvinen dev_err(sec->dev, "failed to read CSK vector\n"); 1727f03d84aSRuss Weight return ret; 1737f03d84aSRuss Weight } 1747f03d84aSRuss Weight 1757f03d84aSRuss Weight for (i = 0; i < CSK_32ARRAY_SIZE; i++) 1767f03d84aSRuss Weight csk32[i] = le32_to_cpu(((csk_le32[i]))); 1777f03d84aSRuss Weight 1787f03d84aSRuss Weight bitmap_from_arr32(csk_map, csk32, CSK_BIT_LEN); 1797f03d84aSRuss Weight bitmap_complement(csk_map, csk_map, CSK_BIT_LEN); 1807f03d84aSRuss Weight return bitmap_print_to_pagebuf(1, buf, csk_map, CSK_BIT_LEN); 1817f03d84aSRuss Weight } 1827f03d84aSRuss Weight 1836052a005SIlpo Järvinen #define DEVICE_ATTR_SEC_CSK_RO(_name) \ 1847f03d84aSRuss Weight static ssize_t _name##_canceled_csks_show(struct device *dev, \ 1857f03d84aSRuss Weight struct device_attribute *attr, \ 1867f03d84aSRuss Weight char *buf) \ 1876052a005SIlpo Järvinen { \ 1886052a005SIlpo Järvinen struct m10bmc_sec *sec = dev_get_drvdata(dev); \ 1896052a005SIlpo Järvinen const struct m10bmc_csr_map *csr_map = sec->m10bmc->info->csr_map; \ 1906052a005SIlpo Järvinen \ 1916052a005SIlpo Järvinen return show_canceled_csk(dev, \ 1926052a005SIlpo Järvinen csr_map->_name##_prog_addr + CSK_VEC_OFFSET, \ 1936052a005SIlpo Järvinen buf); \ 1946052a005SIlpo Järvinen } \ 1957f03d84aSRuss Weight static DEVICE_ATTR_RO(_name##_canceled_csks) 1967f03d84aSRuss Weight 1977f03d84aSRuss Weight #define CSK_VEC_OFFSET 0x34 1987f03d84aSRuss Weight 1996052a005SIlpo Järvinen DEVICE_ATTR_SEC_CSK_RO(bmc); 2006052a005SIlpo Järvinen DEVICE_ATTR_SEC_CSK_RO(sr); 2016052a005SIlpo Järvinen DEVICE_ATTR_SEC_CSK_RO(pr); 2027f03d84aSRuss Weight 203154afa5cSRuss Weight #define FLASH_COUNT_SIZE 4096 /* count stored as inverted bit vector */ 204154afa5cSRuss Weight 205154afa5cSRuss Weight static ssize_t flash_count_show(struct device *dev, 206154afa5cSRuss Weight struct device_attribute *attr, char *buf) 207154afa5cSRuss Weight { 208154afa5cSRuss Weight struct m10bmc_sec *sec = dev_get_drvdata(dev); 2096052a005SIlpo Järvinen const struct m10bmc_csr_map *csr_map = sec->m10bmc->info->csr_map; 2103e10c805SIlpo Järvinen unsigned int num_bits; 211154afa5cSRuss Weight u8 *flash_buf; 212154afa5cSRuss Weight int cnt, ret; 213154afa5cSRuss Weight 214154afa5cSRuss Weight num_bits = FLASH_COUNT_SIZE * 8; 215154afa5cSRuss Weight 216468c9d92SRuss Weight flash_buf = kmalloc(FLASH_COUNT_SIZE, GFP_KERNEL); 217468c9d92SRuss Weight if (!flash_buf) 218468c9d92SRuss Weight return -ENOMEM; 219468c9d92SRuss Weight 2203e10c805SIlpo Järvinen ret = m10bmc_sec_read(sec, flash_buf, csr_map->rsu_update_counter, 2213e10c805SIlpo Järvinen FLASH_COUNT_SIZE); 222154afa5cSRuss Weight if (ret) { 2233e10c805SIlpo Järvinen dev_err(sec->dev, "failed to read flash count\n"); 224154afa5cSRuss Weight goto exit_free; 225154afa5cSRuss Weight } 226154afa5cSRuss Weight cnt = num_bits - bitmap_weight((unsigned long *)flash_buf, num_bits); 227154afa5cSRuss Weight 228154afa5cSRuss Weight exit_free: 229154afa5cSRuss Weight kfree(flash_buf); 230154afa5cSRuss Weight 231154afa5cSRuss Weight return ret ? : sysfs_emit(buf, "%u\n", cnt); 232154afa5cSRuss Weight } 233154afa5cSRuss Weight static DEVICE_ATTR_RO(flash_count); 234154afa5cSRuss Weight 235bdf86d0eSRuss Weight static struct attribute *m10bmc_security_attrs[] = { 236154afa5cSRuss Weight &dev_attr_flash_count.attr, 237bdf86d0eSRuss Weight &dev_attr_bmc_root_entry_hash.attr, 238bdf86d0eSRuss Weight &dev_attr_sr_root_entry_hash.attr, 239bdf86d0eSRuss Weight &dev_attr_pr_root_entry_hash.attr, 2407f03d84aSRuss Weight &dev_attr_sr_canceled_csks.attr, 2417f03d84aSRuss Weight &dev_attr_pr_canceled_csks.attr, 2427f03d84aSRuss Weight &dev_attr_bmc_canceled_csks.attr, 243bdf86d0eSRuss Weight NULL, 244bdf86d0eSRuss Weight }; 245bdf86d0eSRuss Weight 246bdf86d0eSRuss Weight static struct attribute_group m10bmc_security_attr_group = { 247bdf86d0eSRuss Weight .name = "security", 248bdf86d0eSRuss Weight .attrs = m10bmc_security_attrs, 249bdf86d0eSRuss Weight }; 250bdf86d0eSRuss Weight 251bdf86d0eSRuss Weight static const struct attribute_group *m10bmc_sec_attr_groups[] = { 252bdf86d0eSRuss Weight &m10bmc_security_attr_group, 253bdf86d0eSRuss Weight NULL, 254bdf86d0eSRuss Weight }; 255bdf86d0eSRuss Weight 2565cd339b3SRuss Weight static void log_error_regs(struct m10bmc_sec *sec, u32 doorbell) 2575cd339b3SRuss Weight { 2586052a005SIlpo Järvinen const struct m10bmc_csr_map *csr_map = sec->m10bmc->info->csr_map; 2595cd339b3SRuss Weight u32 auth_result; 2605cd339b3SRuss Weight 261*001a734aSIlpo Järvinen dev_err(sec->dev, "Doorbell: 0x%08x\n", doorbell); 2625cd339b3SRuss Weight 2636052a005SIlpo Järvinen if (!m10bmc_sys_read(sec->m10bmc, csr_map->auth_result, &auth_result)) 2645cd339b3SRuss Weight dev_err(sec->dev, "RSU auth result: 0x%08x\n", auth_result); 2655cd339b3SRuss Weight } 2665cd339b3SRuss Weight 267*001a734aSIlpo Järvinen static int m10bmc_sec_n3000_rsu_status(struct m10bmc_sec *sec) 268*001a734aSIlpo Järvinen { 269*001a734aSIlpo Järvinen const struct m10bmc_csr_map *csr_map = sec->m10bmc->info->csr_map; 270*001a734aSIlpo Järvinen u32 doorbell; 271*001a734aSIlpo Järvinen int ret; 272*001a734aSIlpo Järvinen 273*001a734aSIlpo Järvinen ret = m10bmc_sys_read(sec->m10bmc, csr_map->doorbell, &doorbell); 274*001a734aSIlpo Järvinen if (ret) 275*001a734aSIlpo Järvinen return ret; 276*001a734aSIlpo Järvinen 277*001a734aSIlpo Järvinen return FIELD_GET(DRBL_RSU_STATUS, doorbell); 278*001a734aSIlpo Järvinen } 279*001a734aSIlpo Järvinen 280da04fa8cSIlpo Järvinen static bool rsu_status_ok(u32 status) 281da04fa8cSIlpo Järvinen { 282da04fa8cSIlpo Järvinen return (status == RSU_STAT_NORMAL || 283da04fa8cSIlpo Järvinen status == RSU_STAT_NIOS_OK || 284da04fa8cSIlpo Järvinen status == RSU_STAT_USER_OK || 285da04fa8cSIlpo Järvinen status == RSU_STAT_FACTORY_OK); 286da04fa8cSIlpo Järvinen } 287da04fa8cSIlpo Järvinen 288da04fa8cSIlpo Järvinen static bool rsu_progress_done(u32 progress) 289da04fa8cSIlpo Järvinen { 290da04fa8cSIlpo Järvinen return (progress == RSU_PROG_IDLE || 291da04fa8cSIlpo Järvinen progress == RSU_PROG_RSU_DONE); 292da04fa8cSIlpo Järvinen } 293da04fa8cSIlpo Järvinen 294da04fa8cSIlpo Järvinen static bool rsu_progress_busy(u32 progress) 295da04fa8cSIlpo Järvinen { 296da04fa8cSIlpo Järvinen return (progress == RSU_PROG_AUTHENTICATING || 297da04fa8cSIlpo Järvinen progress == RSU_PROG_COPYING || 298da04fa8cSIlpo Järvinen progress == RSU_PROG_UPDATE_CANCEL || 299da04fa8cSIlpo Järvinen progress == RSU_PROG_PROGRAM_KEY_HASH); 300da04fa8cSIlpo Järvinen } 301da04fa8cSIlpo Järvinen 302*001a734aSIlpo Järvinen static int m10bmc_sec_progress_status(struct m10bmc_sec *sec, u32 *doorbell_reg, 303*001a734aSIlpo Järvinen u32 *progress, u32 *status) 304*001a734aSIlpo Järvinen { 305*001a734aSIlpo Järvinen const struct m10bmc_csr_map *csr_map = sec->m10bmc->info->csr_map; 306*001a734aSIlpo Järvinen int ret; 307*001a734aSIlpo Järvinen 308*001a734aSIlpo Järvinen ret = m10bmc_sys_read(sec->m10bmc, csr_map->doorbell, doorbell_reg); 309*001a734aSIlpo Järvinen if (ret) 310*001a734aSIlpo Järvinen return ret; 311*001a734aSIlpo Järvinen 312*001a734aSIlpo Järvinen ret = sec->ops->rsu_status(sec); 313*001a734aSIlpo Järvinen if (ret < 0) 314*001a734aSIlpo Järvinen return ret; 315*001a734aSIlpo Järvinen 316*001a734aSIlpo Järvinen *status = ret; 317*001a734aSIlpo Järvinen *progress = rsu_prog(*doorbell_reg); 318*001a734aSIlpo Järvinen 319*001a734aSIlpo Järvinen return 0; 320*001a734aSIlpo Järvinen } 321*001a734aSIlpo Järvinen 3225cd339b3SRuss Weight static enum fw_upload_err rsu_check_idle(struct m10bmc_sec *sec) 3235cd339b3SRuss Weight { 3246052a005SIlpo Järvinen const struct m10bmc_csr_map *csr_map = sec->m10bmc->info->csr_map; 3255cd339b3SRuss Weight u32 doorbell; 3265cd339b3SRuss Weight int ret; 3275cd339b3SRuss Weight 3286052a005SIlpo Järvinen ret = m10bmc_sys_read(sec->m10bmc, csr_map->doorbell, &doorbell); 3295cd339b3SRuss Weight if (ret) 3305cd339b3SRuss Weight return FW_UPLOAD_ERR_RW_ERROR; 3315cd339b3SRuss Weight 332da04fa8cSIlpo Järvinen if (!rsu_progress_done(rsu_prog(doorbell))) { 3335cd339b3SRuss Weight log_error_regs(sec, doorbell); 3345cd339b3SRuss Weight return FW_UPLOAD_ERR_BUSY; 3355cd339b3SRuss Weight } 3365cd339b3SRuss Weight 3375cd339b3SRuss Weight return FW_UPLOAD_ERR_NONE; 3385cd339b3SRuss Weight } 3395cd339b3SRuss Weight 340*001a734aSIlpo Järvinen static inline bool rsu_start_done(u32 doorbell_reg, u32 progress, u32 status) 3415cd339b3SRuss Weight { 342*001a734aSIlpo Järvinen if (doorbell_reg & DRBL_RSU_REQUEST) 3435cd339b3SRuss Weight return false; 3445cd339b3SRuss Weight 3455cd339b3SRuss Weight if (status == RSU_STAT_ERASE_FAIL || status == RSU_STAT_WEAROUT) 3465cd339b3SRuss Weight return true; 3475cd339b3SRuss Weight 348da04fa8cSIlpo Järvinen if (!rsu_progress_done(progress)) 3495cd339b3SRuss Weight return true; 3505cd339b3SRuss Weight 3515cd339b3SRuss Weight return false; 3525cd339b3SRuss Weight } 3535cd339b3SRuss Weight 3545cd339b3SRuss Weight static enum fw_upload_err rsu_update_init(struct m10bmc_sec *sec) 3555cd339b3SRuss Weight { 3566052a005SIlpo Järvinen const struct m10bmc_csr_map *csr_map = sec->m10bmc->info->csr_map; 357*001a734aSIlpo Järvinen u32 doorbell_reg, progress, status; 358*001a734aSIlpo Järvinen int ret, err; 3595cd339b3SRuss Weight 3605cd339b3SRuss Weight ret = regmap_update_bits(sec->m10bmc->regmap, 3616052a005SIlpo Järvinen csr_map->base + csr_map->doorbell, 3625cd339b3SRuss Weight DRBL_RSU_REQUEST | DRBL_HOST_STATUS, 3635cd339b3SRuss Weight DRBL_RSU_REQUEST | 3645cd339b3SRuss Weight FIELD_PREP(DRBL_HOST_STATUS, 3655cd339b3SRuss Weight HOST_STATUS_IDLE)); 3665cd339b3SRuss Weight if (ret) 3675cd339b3SRuss Weight return FW_UPLOAD_ERR_RW_ERROR; 3685cd339b3SRuss Weight 369*001a734aSIlpo Järvinen ret = read_poll_timeout(m10bmc_sec_progress_status, err, 370*001a734aSIlpo Järvinen err < 0 || rsu_start_done(doorbell_reg, progress, status), 3715cd339b3SRuss Weight NIOS_HANDSHAKE_INTERVAL_US, 372*001a734aSIlpo Järvinen NIOS_HANDSHAKE_TIMEOUT_US, 373*001a734aSIlpo Järvinen false, 374*001a734aSIlpo Järvinen sec, &doorbell_reg, &progress, &status); 3755cd339b3SRuss Weight 3765cd339b3SRuss Weight if (ret == -ETIMEDOUT) { 377*001a734aSIlpo Järvinen log_error_regs(sec, doorbell_reg); 3785cd339b3SRuss Weight return FW_UPLOAD_ERR_TIMEOUT; 379*001a734aSIlpo Järvinen } else if (err) { 3805cd339b3SRuss Weight return FW_UPLOAD_ERR_RW_ERROR; 3815cd339b3SRuss Weight } 3825cd339b3SRuss Weight 3835cd339b3SRuss Weight if (status == RSU_STAT_WEAROUT) { 3845cd339b3SRuss Weight dev_warn(sec->dev, "Excessive flash update count detected\n"); 3855cd339b3SRuss Weight return FW_UPLOAD_ERR_WEAROUT; 3865cd339b3SRuss Weight } else if (status == RSU_STAT_ERASE_FAIL) { 387*001a734aSIlpo Järvinen log_error_regs(sec, doorbell_reg); 3885cd339b3SRuss Weight return FW_UPLOAD_ERR_HW_ERROR; 3895cd339b3SRuss Weight } 3905cd339b3SRuss Weight 3915cd339b3SRuss Weight return FW_UPLOAD_ERR_NONE; 3925cd339b3SRuss Weight } 3935cd339b3SRuss Weight 3945cd339b3SRuss Weight static enum fw_upload_err rsu_prog_ready(struct m10bmc_sec *sec) 3955cd339b3SRuss Weight { 3966052a005SIlpo Järvinen const struct m10bmc_csr_map *csr_map = sec->m10bmc->info->csr_map; 3975cd339b3SRuss Weight unsigned long poll_timeout; 3985cd339b3SRuss Weight u32 doorbell, progress; 3995cd339b3SRuss Weight int ret; 4005cd339b3SRuss Weight 4016052a005SIlpo Järvinen ret = m10bmc_sys_read(sec->m10bmc, csr_map->doorbell, &doorbell); 4025cd339b3SRuss Weight if (ret) 4035cd339b3SRuss Weight return FW_UPLOAD_ERR_RW_ERROR; 4045cd339b3SRuss Weight 4055cd339b3SRuss Weight poll_timeout = jiffies + msecs_to_jiffies(RSU_PREP_TIMEOUT_MS); 4065cd339b3SRuss Weight while (rsu_prog(doorbell) == RSU_PROG_PREPARE) { 4075cd339b3SRuss Weight msleep(RSU_PREP_INTERVAL_MS); 4085cd339b3SRuss Weight if (time_after(jiffies, poll_timeout)) 4095cd339b3SRuss Weight break; 4105cd339b3SRuss Weight 4116052a005SIlpo Järvinen ret = m10bmc_sys_read(sec->m10bmc, csr_map->doorbell, &doorbell); 4125cd339b3SRuss Weight if (ret) 4135cd339b3SRuss Weight return FW_UPLOAD_ERR_RW_ERROR; 4145cd339b3SRuss Weight } 4155cd339b3SRuss Weight 4165cd339b3SRuss Weight progress = rsu_prog(doorbell); 4175cd339b3SRuss Weight if (progress == RSU_PROG_PREPARE) { 4185cd339b3SRuss Weight log_error_regs(sec, doorbell); 4195cd339b3SRuss Weight return FW_UPLOAD_ERR_TIMEOUT; 4205cd339b3SRuss Weight } else if (progress != RSU_PROG_READY) { 4215cd339b3SRuss Weight log_error_regs(sec, doorbell); 4225cd339b3SRuss Weight return FW_UPLOAD_ERR_HW_ERROR; 4235cd339b3SRuss Weight } 4245cd339b3SRuss Weight 4255cd339b3SRuss Weight return FW_UPLOAD_ERR_NONE; 4265cd339b3SRuss Weight } 4275cd339b3SRuss Weight 4285cd339b3SRuss Weight static enum fw_upload_err rsu_send_data(struct m10bmc_sec *sec) 4295cd339b3SRuss Weight { 4306052a005SIlpo Järvinen const struct m10bmc_csr_map *csr_map = sec->m10bmc->info->csr_map; 431*001a734aSIlpo Järvinen u32 doorbell_reg, status; 4325cd339b3SRuss Weight int ret; 4335cd339b3SRuss Weight 4345cd339b3SRuss Weight ret = regmap_update_bits(sec->m10bmc->regmap, 4356052a005SIlpo Järvinen csr_map->base + csr_map->doorbell, 4365cd339b3SRuss Weight DRBL_HOST_STATUS, 4375cd339b3SRuss Weight FIELD_PREP(DRBL_HOST_STATUS, 4385cd339b3SRuss Weight HOST_STATUS_WRITE_DONE)); 4395cd339b3SRuss Weight if (ret) 4405cd339b3SRuss Weight return FW_UPLOAD_ERR_RW_ERROR; 4415cd339b3SRuss Weight 4425cd339b3SRuss Weight ret = regmap_read_poll_timeout(sec->m10bmc->regmap, 4436052a005SIlpo Järvinen csr_map->base + csr_map->doorbell, 444*001a734aSIlpo Järvinen doorbell_reg, 445*001a734aSIlpo Järvinen rsu_prog(doorbell_reg) != RSU_PROG_READY, 4465cd339b3SRuss Weight NIOS_HANDSHAKE_INTERVAL_US, 4475cd339b3SRuss Weight NIOS_HANDSHAKE_TIMEOUT_US); 4485cd339b3SRuss Weight 4495cd339b3SRuss Weight if (ret == -ETIMEDOUT) { 450*001a734aSIlpo Järvinen log_error_regs(sec, doorbell_reg); 4515cd339b3SRuss Weight return FW_UPLOAD_ERR_TIMEOUT; 4525cd339b3SRuss Weight } else if (ret) { 4535cd339b3SRuss Weight return FW_UPLOAD_ERR_RW_ERROR; 4545cd339b3SRuss Weight } 4555cd339b3SRuss Weight 456*001a734aSIlpo Järvinen ret = sec->ops->rsu_status(sec); 457*001a734aSIlpo Järvinen if (ret < 0) 458*001a734aSIlpo Järvinen return ret; 459*001a734aSIlpo Järvinen status = ret; 460*001a734aSIlpo Järvinen 461*001a734aSIlpo Järvinen if (!rsu_status_ok(status)) { 462*001a734aSIlpo Järvinen log_error_regs(sec, doorbell_reg); 4635cd339b3SRuss Weight return FW_UPLOAD_ERR_HW_ERROR; 4645cd339b3SRuss Weight } 4655cd339b3SRuss Weight 4665cd339b3SRuss Weight return FW_UPLOAD_ERR_NONE; 4675cd339b3SRuss Weight } 4685cd339b3SRuss Weight 469*001a734aSIlpo Järvinen static int rsu_check_complete(struct m10bmc_sec *sec, u32 *doorbell_reg) 4705cd339b3SRuss Weight { 471*001a734aSIlpo Järvinen u32 progress, status; 4726052a005SIlpo Järvinen 473*001a734aSIlpo Järvinen if (m10bmc_sec_progress_status(sec, doorbell_reg, &progress, &status)) 4745cd339b3SRuss Weight return -EIO; 4755cd339b3SRuss Weight 476*001a734aSIlpo Järvinen if (!rsu_status_ok(status)) 4775cd339b3SRuss Weight return -EINVAL; 4785cd339b3SRuss Weight 479*001a734aSIlpo Järvinen if (rsu_progress_done(progress)) 4805cd339b3SRuss Weight return 0; 481da04fa8cSIlpo Järvinen 482*001a734aSIlpo Järvinen if (rsu_progress_busy(progress)) 4835cd339b3SRuss Weight return -EAGAIN; 484da04fa8cSIlpo Järvinen 4855cd339b3SRuss Weight return -EINVAL; 4865cd339b3SRuss Weight } 4875cd339b3SRuss Weight 4885cd339b3SRuss Weight static enum fw_upload_err rsu_cancel(struct m10bmc_sec *sec) 4895cd339b3SRuss Weight { 4906052a005SIlpo Järvinen const struct m10bmc_csr_map *csr_map = sec->m10bmc->info->csr_map; 4915cd339b3SRuss Weight u32 doorbell; 4925cd339b3SRuss Weight int ret; 4935cd339b3SRuss Weight 4946052a005SIlpo Järvinen ret = m10bmc_sys_read(sec->m10bmc, csr_map->doorbell, &doorbell); 4955cd339b3SRuss Weight if (ret) 4965cd339b3SRuss Weight return FW_UPLOAD_ERR_RW_ERROR; 4975cd339b3SRuss Weight 4985cd339b3SRuss Weight if (rsu_prog(doorbell) != RSU_PROG_READY) 4995cd339b3SRuss Weight return FW_UPLOAD_ERR_BUSY; 5005cd339b3SRuss Weight 5015cd339b3SRuss Weight ret = regmap_update_bits(sec->m10bmc->regmap, 5026052a005SIlpo Järvinen csr_map->base + csr_map->doorbell, 5035cd339b3SRuss Weight DRBL_HOST_STATUS, 5045cd339b3SRuss Weight FIELD_PREP(DRBL_HOST_STATUS, 5055cd339b3SRuss Weight HOST_STATUS_ABORT_RSU)); 5065cd339b3SRuss Weight if (ret) 5075cd339b3SRuss Weight return FW_UPLOAD_ERR_RW_ERROR; 5085cd339b3SRuss Weight 5095cd339b3SRuss Weight return FW_UPLOAD_ERR_CANCELED; 5105cd339b3SRuss Weight } 5115cd339b3SRuss Weight 5125cd339b3SRuss Weight static enum fw_upload_err m10bmc_sec_prepare(struct fw_upload *fwl, 5135cd339b3SRuss Weight const u8 *data, u32 size) 5145cd339b3SRuss Weight { 5155cd339b3SRuss Weight struct m10bmc_sec *sec = fwl->dd_handle; 5165cd339b3SRuss Weight u32 ret; 5175cd339b3SRuss Weight 5185cd339b3SRuss Weight sec->cancel_request = false; 5195cd339b3SRuss Weight 5205cd339b3SRuss Weight if (!size || size > M10BMC_STAGING_SIZE) 5215cd339b3SRuss Weight return FW_UPLOAD_ERR_INVALID_SIZE; 5225cd339b3SRuss Weight 5235cd339b3SRuss Weight ret = rsu_check_idle(sec); 5245cd339b3SRuss Weight if (ret != FW_UPLOAD_ERR_NONE) 5255cd339b3SRuss Weight return ret; 5265cd339b3SRuss Weight 5275cd339b3SRuss Weight ret = rsu_update_init(sec); 5285cd339b3SRuss Weight if (ret != FW_UPLOAD_ERR_NONE) 5295cd339b3SRuss Weight return ret; 5305cd339b3SRuss Weight 5315cd339b3SRuss Weight ret = rsu_prog_ready(sec); 5325cd339b3SRuss Weight if (ret != FW_UPLOAD_ERR_NONE) 5335cd339b3SRuss Weight return ret; 5345cd339b3SRuss Weight 5355cd339b3SRuss Weight if (sec->cancel_request) 5365cd339b3SRuss Weight return rsu_cancel(sec); 5375cd339b3SRuss Weight 5385cd339b3SRuss Weight return FW_UPLOAD_ERR_NONE; 5395cd339b3SRuss Weight } 5405cd339b3SRuss Weight 5415cd339b3SRuss Weight #define WRITE_BLOCK_SIZE 0x4000 /* Default write-block size is 0x4000 bytes */ 5425cd339b3SRuss Weight 5433e10c805SIlpo Järvinen static enum fw_upload_err m10bmc_sec_fw_write(struct fw_upload *fwl, const u8 *data, 5445cd339b3SRuss Weight u32 offset, u32 size, u32 *written) 5455cd339b3SRuss Weight { 5465cd339b3SRuss Weight struct m10bmc_sec *sec = fwl->dd_handle; 5476052a005SIlpo Järvinen const struct m10bmc_csr_map *csr_map = sec->m10bmc->info->csr_map; 5483e10c805SIlpo Järvinen struct intel_m10bmc *m10bmc = sec->m10bmc; 5493e10c805SIlpo Järvinen u32 blk_size, doorbell; 5505cd339b3SRuss Weight int ret; 5515cd339b3SRuss Weight 5525cd339b3SRuss Weight if (sec->cancel_request) 5535cd339b3SRuss Weight return rsu_cancel(sec); 5545cd339b3SRuss Weight 5553e10c805SIlpo Järvinen ret = m10bmc_sys_read(m10bmc, csr_map->doorbell, &doorbell); 5565cd339b3SRuss Weight if (ret) { 5575cd339b3SRuss Weight return FW_UPLOAD_ERR_RW_ERROR; 5585cd339b3SRuss Weight } else if (rsu_prog(doorbell) != RSU_PROG_READY) { 5595cd339b3SRuss Weight log_error_regs(sec, doorbell); 5605cd339b3SRuss Weight return FW_UPLOAD_ERR_HW_ERROR; 5615cd339b3SRuss Weight } 5625cd339b3SRuss Weight 5633e10c805SIlpo Järvinen WARN_ON_ONCE(WRITE_BLOCK_SIZE % regmap_get_reg_stride(m10bmc->regmap)); 5645cd339b3SRuss Weight blk_size = min_t(u32, WRITE_BLOCK_SIZE, size); 5653e10c805SIlpo Järvinen ret = m10bmc_sec_write(sec, data, offset, blk_size); 5665cd339b3SRuss Weight if (ret) 5675cd339b3SRuss Weight return FW_UPLOAD_ERR_RW_ERROR; 5685cd339b3SRuss Weight 5695cd339b3SRuss Weight *written = blk_size; 5705cd339b3SRuss Weight return FW_UPLOAD_ERR_NONE; 5715cd339b3SRuss Weight } 5725cd339b3SRuss Weight 5735cd339b3SRuss Weight static enum fw_upload_err m10bmc_sec_poll_complete(struct fw_upload *fwl) 5745cd339b3SRuss Weight { 5755cd339b3SRuss Weight struct m10bmc_sec *sec = fwl->dd_handle; 5765cd339b3SRuss Weight unsigned long poll_timeout; 5775cd339b3SRuss Weight u32 doorbell, result; 5785cd339b3SRuss Weight int ret; 5795cd339b3SRuss Weight 5805cd339b3SRuss Weight if (sec->cancel_request) 5815cd339b3SRuss Weight return rsu_cancel(sec); 5825cd339b3SRuss Weight 5835cd339b3SRuss Weight result = rsu_send_data(sec); 5845cd339b3SRuss Weight if (result != FW_UPLOAD_ERR_NONE) 5855cd339b3SRuss Weight return result; 5865cd339b3SRuss Weight 5875cd339b3SRuss Weight poll_timeout = jiffies + msecs_to_jiffies(RSU_COMPLETE_TIMEOUT_MS); 5885cd339b3SRuss Weight do { 5895cd339b3SRuss Weight msleep(RSU_COMPLETE_INTERVAL_MS); 5905cd339b3SRuss Weight ret = rsu_check_complete(sec, &doorbell); 5915cd339b3SRuss Weight } while (ret == -EAGAIN && !time_after(jiffies, poll_timeout)); 5925cd339b3SRuss Weight 5935cd339b3SRuss Weight if (ret == -EAGAIN) { 5945cd339b3SRuss Weight log_error_regs(sec, doorbell); 5955cd339b3SRuss Weight return FW_UPLOAD_ERR_TIMEOUT; 5965cd339b3SRuss Weight } else if (ret == -EIO) { 5975cd339b3SRuss Weight return FW_UPLOAD_ERR_RW_ERROR; 5985cd339b3SRuss Weight } else if (ret) { 5995cd339b3SRuss Weight log_error_regs(sec, doorbell); 6005cd339b3SRuss Weight return FW_UPLOAD_ERR_HW_ERROR; 6015cd339b3SRuss Weight } 6025cd339b3SRuss Weight 6035cd339b3SRuss Weight return FW_UPLOAD_ERR_NONE; 6045cd339b3SRuss Weight } 6055cd339b3SRuss Weight 6065cd339b3SRuss Weight /* 6075cd339b3SRuss Weight * m10bmc_sec_cancel() may be called asynchronously with an on-going update. 6085cd339b3SRuss Weight * All other functions are called sequentially in a single thread. To avoid 6095cd339b3SRuss Weight * contention on register accesses, m10bmc_sec_cancel() must only update 6105cd339b3SRuss Weight * the cancel_request flag. Other functions will check this flag and handle 6115cd339b3SRuss Weight * the cancel request synchronously. 6125cd339b3SRuss Weight */ 6135cd339b3SRuss Weight static void m10bmc_sec_cancel(struct fw_upload *fwl) 6145cd339b3SRuss Weight { 6155cd339b3SRuss Weight struct m10bmc_sec *sec = fwl->dd_handle; 6165cd339b3SRuss Weight 6175cd339b3SRuss Weight sec->cancel_request = true; 6185cd339b3SRuss Weight } 6195cd339b3SRuss Weight 6205cd339b3SRuss Weight static void m10bmc_sec_cleanup(struct fw_upload *fwl) 6215cd339b3SRuss Weight { 6225cd339b3SRuss Weight struct m10bmc_sec *sec = fwl->dd_handle; 6235cd339b3SRuss Weight 6245cd339b3SRuss Weight (void)rsu_cancel(sec); 6255cd339b3SRuss Weight } 6265cd339b3SRuss Weight 6275cd339b3SRuss Weight static const struct fw_upload_ops m10bmc_ops = { 6285cd339b3SRuss Weight .prepare = m10bmc_sec_prepare, 6293e10c805SIlpo Järvinen .write = m10bmc_sec_fw_write, 6305cd339b3SRuss Weight .poll_complete = m10bmc_sec_poll_complete, 6315cd339b3SRuss Weight .cancel = m10bmc_sec_cancel, 6325cd339b3SRuss Weight .cleanup = m10bmc_sec_cleanup, 6335cd339b3SRuss Weight }; 6345cd339b3SRuss Weight 635*001a734aSIlpo Järvinen static const struct m10bmc_sec_ops m10sec_n3000_ops = { 636*001a734aSIlpo Järvinen .rsu_status = m10bmc_sec_n3000_rsu_status, 637*001a734aSIlpo Järvinen }; 638*001a734aSIlpo Järvinen 639bdf86d0eSRuss Weight #define SEC_UPDATE_LEN_MAX 32 640bdf86d0eSRuss Weight static int m10bmc_sec_probe(struct platform_device *pdev) 641bdf86d0eSRuss Weight { 6425cd339b3SRuss Weight char buf[SEC_UPDATE_LEN_MAX]; 643bdf86d0eSRuss Weight struct m10bmc_sec *sec; 6445cd339b3SRuss Weight struct fw_upload *fwl; 6455cd339b3SRuss Weight unsigned int len; 6465cd339b3SRuss Weight int ret; 647bdf86d0eSRuss Weight 648bdf86d0eSRuss Weight sec = devm_kzalloc(&pdev->dev, sizeof(*sec), GFP_KERNEL); 649bdf86d0eSRuss Weight if (!sec) 650bdf86d0eSRuss Weight return -ENOMEM; 651bdf86d0eSRuss Weight 652bdf86d0eSRuss Weight sec->dev = &pdev->dev; 653bdf86d0eSRuss Weight sec->m10bmc = dev_get_drvdata(pdev->dev.parent); 654*001a734aSIlpo Järvinen sec->ops = (struct m10bmc_sec_ops *)platform_get_device_id(pdev)->driver_data; 655bdf86d0eSRuss Weight dev_set_drvdata(&pdev->dev, sec); 656bdf86d0eSRuss Weight 6575cd339b3SRuss Weight ret = xa_alloc(&fw_upload_xa, &sec->fw_name_id, sec, 6585cd339b3SRuss Weight xa_limit_32b, GFP_KERNEL); 6595cd339b3SRuss Weight if (ret) 6605cd339b3SRuss Weight return ret; 6615cd339b3SRuss Weight 6625cd339b3SRuss Weight len = scnprintf(buf, SEC_UPDATE_LEN_MAX, "secure-update%d", 6635cd339b3SRuss Weight sec->fw_name_id); 6645cd339b3SRuss Weight sec->fw_name = kmemdup_nul(buf, len, GFP_KERNEL); 6655cd339b3SRuss Weight if (!sec->fw_name) 6665cd339b3SRuss Weight return -ENOMEM; 6675cd339b3SRuss Weight 6685cd339b3SRuss Weight fwl = firmware_upload_register(THIS_MODULE, sec->dev, sec->fw_name, 6695cd339b3SRuss Weight &m10bmc_ops, sec); 6705cd339b3SRuss Weight if (IS_ERR(fwl)) { 6715cd339b3SRuss Weight dev_err(sec->dev, "Firmware Upload driver failed to start\n"); 6725cd339b3SRuss Weight kfree(sec->fw_name); 6735cd339b3SRuss Weight xa_erase(&fw_upload_xa, sec->fw_name_id); 6745cd339b3SRuss Weight return PTR_ERR(fwl); 6755cd339b3SRuss Weight } 6765cd339b3SRuss Weight 6775cd339b3SRuss Weight sec->fwl = fwl; 6785cd339b3SRuss Weight return 0; 6795cd339b3SRuss Weight } 6805cd339b3SRuss Weight 6815cd339b3SRuss Weight static int m10bmc_sec_remove(struct platform_device *pdev) 6825cd339b3SRuss Weight { 6835cd339b3SRuss Weight struct m10bmc_sec *sec = dev_get_drvdata(&pdev->dev); 6845cd339b3SRuss Weight 6855cd339b3SRuss Weight firmware_upload_unregister(sec->fwl); 6865cd339b3SRuss Weight kfree(sec->fw_name); 6875cd339b3SRuss Weight xa_erase(&fw_upload_xa, sec->fw_name_id); 6885cd339b3SRuss Weight 689bdf86d0eSRuss Weight return 0; 690bdf86d0eSRuss Weight } 691bdf86d0eSRuss Weight 692bdf86d0eSRuss Weight static const struct platform_device_id intel_m10bmc_sec_ids[] = { 693bdf86d0eSRuss Weight { 694bdf86d0eSRuss Weight .name = "n3000bmc-sec-update", 695*001a734aSIlpo Järvinen .driver_data = (kernel_ulong_t)&m10sec_n3000_ops, 696bdf86d0eSRuss Weight }, 697562d0bf2SRuss Weight { 698562d0bf2SRuss Weight .name = "d5005bmc-sec-update", 699*001a734aSIlpo Järvinen .driver_data = (kernel_ulong_t)&m10sec_n3000_ops, 700562d0bf2SRuss Weight }, 701bdf86d0eSRuss Weight { } 702bdf86d0eSRuss Weight }; 703bdf86d0eSRuss Weight MODULE_DEVICE_TABLE(platform, intel_m10bmc_sec_ids); 704bdf86d0eSRuss Weight 705bdf86d0eSRuss Weight static struct platform_driver intel_m10bmc_sec_driver = { 706bdf86d0eSRuss Weight .probe = m10bmc_sec_probe, 7075cd339b3SRuss Weight .remove = m10bmc_sec_remove, 708bdf86d0eSRuss Weight .driver = { 709bdf86d0eSRuss Weight .name = "intel-m10bmc-sec-update", 710bdf86d0eSRuss Weight .dev_groups = m10bmc_sec_attr_groups, 711bdf86d0eSRuss Weight }, 712bdf86d0eSRuss Weight .id_table = intel_m10bmc_sec_ids, 713bdf86d0eSRuss Weight }; 714bdf86d0eSRuss Weight module_platform_driver(intel_m10bmc_sec_driver); 715bdf86d0eSRuss Weight 716bdf86d0eSRuss Weight MODULE_AUTHOR("Intel Corporation"); 717bdf86d0eSRuss Weight MODULE_DESCRIPTION("Intel MAX10 BMC Secure Update"); 718bdf86d0eSRuss Weight MODULE_LICENSE("GPL"); 719