Lines Matching refs:sec

38 	struct m10bmc_sec *sec = dev_get_drvdata(dev);  in show_root_entry_hash()  local
44 stride = regmap_get_reg_stride(sec->m10bmc->regmap); in show_root_entry_hash()
45 ret = m10bmc_raw_read(sec->m10bmc, prog_addr, &magic); in show_root_entry_hash()
56 dev_err(sec->dev, "%s bad sha num bytes %d\n", __func__, in show_root_entry_hash()
61 ret = regmap_bulk_read(sec->m10bmc->regmap, reh_addr, in show_root_entry_hash()
94 struct m10bmc_sec *sec = dev_get_drvdata(dev); in show_canceled_csk() local
100 stride = regmap_get_reg_stride(sec->m10bmc->regmap); in show_canceled_csk()
102 dev_err(sec->dev, in show_canceled_csk()
109 ret = regmap_bulk_read(sec->m10bmc->regmap, addr, csk_le32, in show_canceled_csk()
112 dev_err(sec->dev, "failed to read CSK vector: %x cnt %x: %d\n", in show_canceled_csk()
143 struct m10bmc_sec *sec = dev_get_drvdata(dev); in flash_count_show() local
148 stride = regmap_get_reg_stride(sec->m10bmc->regmap); in flash_count_show()
152 dev_err(sec->dev, in flash_count_show()
163 ret = regmap_bulk_read(sec->m10bmc->regmap, STAGING_FLASH_COUNT, in flash_count_show()
166 dev_err(sec->dev, in flash_count_show()
201 static void log_error_regs(struct m10bmc_sec *sec, u32 doorbell) in log_error_regs() argument
205 dev_err(sec->dev, "RSU error status: 0x%08x\n", doorbell); in log_error_regs()
207 if (!m10bmc_sys_read(sec->m10bmc, M10BMC_AUTH_RESULT, &auth_result)) in log_error_regs()
208 dev_err(sec->dev, "RSU auth result: 0x%08x\n", auth_result); in log_error_regs()
211 static enum fw_upload_err rsu_check_idle(struct m10bmc_sec *sec) in rsu_check_idle() argument
216 ret = m10bmc_sys_read(sec->m10bmc, M10BMC_DOORBELL, &doorbell); in rsu_check_idle()
222 log_error_regs(sec, doorbell); in rsu_check_idle()
247 static enum fw_upload_err rsu_update_init(struct m10bmc_sec *sec) in rsu_update_init() argument
252 ret = regmap_update_bits(sec->m10bmc->regmap, in rsu_update_init()
261 ret = regmap_read_poll_timeout(sec->m10bmc->regmap, in rsu_update_init()
269 log_error_regs(sec, doorbell); in rsu_update_init()
277 dev_warn(sec->dev, "Excessive flash update count detected\n"); in rsu_update_init()
280 log_error_regs(sec, doorbell); in rsu_update_init()
287 static enum fw_upload_err rsu_prog_ready(struct m10bmc_sec *sec) in rsu_prog_ready() argument
293 ret = m10bmc_sys_read(sec->m10bmc, M10BMC_DOORBELL, &doorbell); in rsu_prog_ready()
303 ret = m10bmc_sys_read(sec->m10bmc, M10BMC_DOORBELL, &doorbell); in rsu_prog_ready()
310 log_error_regs(sec, doorbell); in rsu_prog_ready()
313 log_error_regs(sec, doorbell); in rsu_prog_ready()
320 static enum fw_upload_err rsu_send_data(struct m10bmc_sec *sec) in rsu_send_data() argument
325 ret = regmap_update_bits(sec->m10bmc->regmap, in rsu_send_data()
333 ret = regmap_read_poll_timeout(sec->m10bmc->regmap, in rsu_send_data()
341 log_error_regs(sec, doorbell); in rsu_send_data()
354 log_error_regs(sec, doorbell); in rsu_send_data()
361 static int rsu_check_complete(struct m10bmc_sec *sec, u32 *doorbell) in rsu_check_complete() argument
363 if (m10bmc_sys_read(sec->m10bmc, M10BMC_DOORBELL, doorbell)) in rsu_check_complete()
390 static enum fw_upload_err rsu_cancel(struct m10bmc_sec *sec) in rsu_cancel() argument
395 ret = m10bmc_sys_read(sec->m10bmc, M10BMC_DOORBELL, &doorbell); in rsu_cancel()
402 ret = regmap_update_bits(sec->m10bmc->regmap, in rsu_cancel()
416 struct m10bmc_sec *sec = fwl->dd_handle; in m10bmc_sec_prepare() local
419 sec->cancel_request = false; in m10bmc_sec_prepare()
424 ret = rsu_check_idle(sec); in m10bmc_sec_prepare()
428 ret = rsu_update_init(sec); in m10bmc_sec_prepare()
432 ret = rsu_prog_ready(sec); in m10bmc_sec_prepare()
436 if (sec->cancel_request) in m10bmc_sec_prepare()
437 return rsu_cancel(sec); in m10bmc_sec_prepare()
447 struct m10bmc_sec *sec = fwl->dd_handle; in m10bmc_sec_write() local
452 stride = regmap_get_reg_stride(sec->m10bmc->regmap); in m10bmc_sec_write()
453 if (sec->cancel_request) in m10bmc_sec_write()
454 return rsu_cancel(sec); in m10bmc_sec_write()
456 ret = m10bmc_sys_read(sec->m10bmc, M10BMC_DOORBELL, &doorbell); in m10bmc_sec_write()
460 log_error_regs(sec, doorbell); in m10bmc_sec_write()
466 ret = regmap_bulk_write(sec->m10bmc->regmap, in m10bmc_sec_write()
480 ret = regmap_write(sec->m10bmc->regmap, in m10bmc_sec_write()
492 struct m10bmc_sec *sec = fwl->dd_handle; in m10bmc_sec_poll_complete() local
497 if (sec->cancel_request) in m10bmc_sec_poll_complete()
498 return rsu_cancel(sec); in m10bmc_sec_poll_complete()
500 result = rsu_send_data(sec); in m10bmc_sec_poll_complete()
507 ret = rsu_check_complete(sec, &doorbell); in m10bmc_sec_poll_complete()
511 log_error_regs(sec, doorbell); in m10bmc_sec_poll_complete()
516 log_error_regs(sec, doorbell); in m10bmc_sec_poll_complete()
532 struct m10bmc_sec *sec = fwl->dd_handle; in m10bmc_sec_cancel() local
534 sec->cancel_request = true; in m10bmc_sec_cancel()
539 struct m10bmc_sec *sec = fwl->dd_handle; in m10bmc_sec_cleanup() local
541 (void)rsu_cancel(sec); in m10bmc_sec_cleanup()
556 struct m10bmc_sec *sec; in m10bmc_sec_probe() local
561 sec = devm_kzalloc(&pdev->dev, sizeof(*sec), GFP_KERNEL); in m10bmc_sec_probe()
562 if (!sec) in m10bmc_sec_probe()
565 sec->dev = &pdev->dev; in m10bmc_sec_probe()
566 sec->m10bmc = dev_get_drvdata(pdev->dev.parent); in m10bmc_sec_probe()
567 dev_set_drvdata(&pdev->dev, sec); in m10bmc_sec_probe()
569 ret = xa_alloc(&fw_upload_xa, &sec->fw_name_id, sec, in m10bmc_sec_probe()
575 sec->fw_name_id); in m10bmc_sec_probe()
576 sec->fw_name = kmemdup_nul(buf, len, GFP_KERNEL); in m10bmc_sec_probe()
577 if (!sec->fw_name) in m10bmc_sec_probe()
580 fwl = firmware_upload_register(THIS_MODULE, sec->dev, sec->fw_name, in m10bmc_sec_probe()
581 &m10bmc_ops, sec); in m10bmc_sec_probe()
583 dev_err(sec->dev, "Firmware Upload driver failed to start\n"); in m10bmc_sec_probe()
584 kfree(sec->fw_name); in m10bmc_sec_probe()
585 xa_erase(&fw_upload_xa, sec->fw_name_id); in m10bmc_sec_probe()
589 sec->fwl = fwl; in m10bmc_sec_probe()
595 struct m10bmc_sec *sec = dev_get_drvdata(&pdev->dev); in m10bmc_sec_remove() local
597 firmware_upload_unregister(sec->fwl); in m10bmc_sec_remove()
598 kfree(sec->fw_name); in m10bmc_sec_remove()
599 xa_erase(&fw_upload_xa, sec->fw_name_id); in m10bmc_sec_remove()