Lines Matching full:flash
2606 * Flash module specific
2610 * FLASH DMA buffer should be big enough to hold both MFG block and
2619 bfa_flash_cb(struct bfa_flash *flash) in bfa_flash_cb() argument
2621 flash->op_busy = 0; in bfa_flash_cb()
2622 if (flash->cbfn) in bfa_flash_cb()
2623 flash->cbfn(flash->cbarg, flash->status); in bfa_flash_cb()
2629 struct bfa_flash *flash = cbarg; in bfa_flash_notify() local
2634 if (flash->op_busy) { in bfa_flash_notify()
2635 flash->status = BFA_STATUS_IOC_FAILURE; in bfa_flash_notify()
2636 flash->cbfn(flash->cbarg, flash->status); in bfa_flash_notify()
2637 flash->op_busy = 0; in bfa_flash_notify()
2646 * Send flash write request.
2651 bfa_flash_write_send(struct bfa_flash *flash) in bfa_flash_write_send() argument
2654 (struct bfi_flash_write_req *) flash->mb.msg; in bfa_flash_write_send()
2657 msg->type = be32_to_cpu(flash->type); in bfa_flash_write_send()
2658 msg->instance = flash->instance; in bfa_flash_write_send()
2659 msg->offset = be32_to_cpu(flash->addr_off + flash->offset); in bfa_flash_write_send()
2660 len = (flash->residue < BFA_FLASH_DMA_BUF_SZ) ? in bfa_flash_write_send()
2661 flash->residue : BFA_FLASH_DMA_BUF_SZ; in bfa_flash_write_send()
2665 msg->last = (len == flash->residue) ? 1 : 0; in bfa_flash_write_send()
2668 bfa_ioc_portid(flash->ioc)); in bfa_flash_write_send()
2669 bfa_alen_set(&msg->alen, len, flash->dbuf_pa); in bfa_flash_write_send()
2670 memcpy(flash->dbuf_kva, flash->ubuf + flash->offset, len); in bfa_flash_write_send()
2671 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_flash_write_send()
2673 flash->residue -= len; in bfa_flash_write_send()
2674 flash->offset += len; in bfa_flash_write_send()
2678 * Send flash read request.
2685 struct bfa_flash *flash = cbarg; in bfa_flash_read_send() local
2687 (struct bfi_flash_read_req *) flash->mb.msg; in bfa_flash_read_send()
2690 msg->type = be32_to_cpu(flash->type); in bfa_flash_read_send()
2691 msg->instance = flash->instance; in bfa_flash_read_send()
2692 msg->offset = be32_to_cpu(flash->addr_off + flash->offset); in bfa_flash_read_send()
2693 len = (flash->residue < BFA_FLASH_DMA_BUF_SZ) ? in bfa_flash_read_send()
2694 flash->residue : BFA_FLASH_DMA_BUF_SZ; in bfa_flash_read_send()
2697 bfa_ioc_portid(flash->ioc)); in bfa_flash_read_send()
2698 bfa_alen_set(&msg->alen, len, flash->dbuf_pa); in bfa_flash_read_send()
2699 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_flash_read_send()
2703 * Process flash response messages upon receiving interrupts.
2705 * @param[in] flasharg - flash structure
2711 struct bfa_flash *flash = flasharg; in bfa_flash_intr() local
2724 if (!flash->op_busy && msg->mh.msg_id != BFI_FLASH_I2H_EVENT) in bfa_flash_intr()
2734 attr = (struct bfa_flash_attr *) flash->ubuf; in bfa_flash_intr()
2735 f = (struct bfa_flash_attr *) flash->dbuf_kva; in bfa_flash_intr()
2753 flash->status = status; in bfa_flash_intr()
2754 bfa_flash_cb(flash); in bfa_flash_intr()
2758 if (status != BFA_STATUS_OK || flash->residue == 0) { in bfa_flash_intr()
2759 flash->status = status; in bfa_flash_intr()
2760 bfa_flash_cb(flash); in bfa_flash_intr()
2762 bfa_flash_write_send(flash); in bfa_flash_intr()
2767 flash->status = status; in bfa_flash_intr()
2768 bfa_flash_cb(flash); in bfa_flash_intr()
2771 memcpy(flash->ubuf + flash->offset, in bfa_flash_intr()
2772 flash->dbuf_kva, len); in bfa_flash_intr()
2773 flash->residue -= len; in bfa_flash_intr()
2774 flash->offset += len; in bfa_flash_intr()
2775 if (flash->residue == 0) { in bfa_flash_intr()
2776 flash->status = status; in bfa_flash_intr()
2777 bfa_flash_cb(flash); in bfa_flash_intr()
2779 bfa_flash_read_send(flash); in bfa_flash_intr()
2791 * Flash memory info API.
2800 * Flash attach API.
2802 * @param[in] flash - flash structure
2807 bfa_nw_flash_attach(struct bfa_flash *flash, struct bfa_ioc *ioc, void *dev) in bfa_nw_flash_attach() argument
2809 flash->ioc = ioc; in bfa_nw_flash_attach()
2810 flash->cbfn = NULL; in bfa_nw_flash_attach()
2811 flash->cbarg = NULL; in bfa_nw_flash_attach()
2812 flash->op_busy = 0; in bfa_nw_flash_attach()
2814 bfa_nw_ioc_mbox_regisr(flash->ioc, BFI_MC_FLASH, bfa_flash_intr, flash); in bfa_nw_flash_attach()
2815 bfa_q_qe_init(&flash->ioc_notify); in bfa_nw_flash_attach()
2816 bfa_ioc_notify_init(&flash->ioc_notify, bfa_flash_notify, flash); in bfa_nw_flash_attach()
2817 list_add_tail(&flash->ioc_notify.qe, &flash->ioc->notify_q); in bfa_nw_flash_attach()
2821 * Claim memory for flash
2823 * @param[in] flash - flash structure
2828 bfa_nw_flash_memclaim(struct bfa_flash *flash, u8 *dm_kva, u64 dm_pa) in bfa_nw_flash_memclaim() argument
2830 flash->dbuf_kva = dm_kva; in bfa_nw_flash_memclaim()
2831 flash->dbuf_pa = dm_pa; in bfa_nw_flash_memclaim()
2832 memset(flash->dbuf_kva, 0, BFA_FLASH_DMA_BUF_SZ); in bfa_nw_flash_memclaim()
2838 * Get flash attribute.
2840 * @param[in] flash - flash structure
2841 * @param[in] attr - flash attribute structure
2848 bfa_nw_flash_get_attr(struct bfa_flash *flash, struct bfa_flash_attr *attr, in bfa_nw_flash_get_attr() argument
2852 (struct bfi_flash_query_req *) flash->mb.msg; in bfa_nw_flash_get_attr()
2854 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_get_attr()
2857 if (flash->op_busy) in bfa_nw_flash_get_attr()
2860 flash->op_busy = 1; in bfa_nw_flash_get_attr()
2861 flash->cbfn = cbfn; in bfa_nw_flash_get_attr()
2862 flash->cbarg = cbarg; in bfa_nw_flash_get_attr()
2863 flash->ubuf = (u8 *) attr; in bfa_nw_flash_get_attr()
2866 bfa_ioc_portid(flash->ioc)); in bfa_nw_flash_get_attr()
2867 bfa_alen_set(&msg->alen, sizeof(struct bfa_flash_attr), flash->dbuf_pa); in bfa_nw_flash_get_attr()
2868 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_nw_flash_get_attr()
2874 * Update flash partition.
2876 * @param[in] flash - flash structure
2877 * @param[in] type - flash partition type
2878 * @param[in] instance - flash partition instance
2888 bfa_nw_flash_update_part(struct bfa_flash *flash, u32 type, u8 instance, in bfa_nw_flash_update_part() argument
2892 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_update_part()
2904 if (flash->op_busy) in bfa_nw_flash_update_part()
2907 flash->op_busy = 1; in bfa_nw_flash_update_part()
2908 flash->cbfn = cbfn; in bfa_nw_flash_update_part()
2909 flash->cbarg = cbarg; in bfa_nw_flash_update_part()
2910 flash->type = type; in bfa_nw_flash_update_part()
2911 flash->instance = instance; in bfa_nw_flash_update_part()
2912 flash->residue = len; in bfa_nw_flash_update_part()
2913 flash->offset = 0; in bfa_nw_flash_update_part()
2914 flash->addr_off = offset; in bfa_nw_flash_update_part()
2915 flash->ubuf = buf; in bfa_nw_flash_update_part()
2917 bfa_flash_write_send(flash); in bfa_nw_flash_update_part()
2923 * Read flash partition.
2925 * @param[in] flash - flash structure
2926 * @param[in] type - flash partition type
2927 * @param[in] instance - flash partition instance
2937 bfa_nw_flash_read_part(struct bfa_flash *flash, u32 type, u8 instance, in bfa_nw_flash_read_part() argument
2941 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_read_part()
2950 if (flash->op_busy) in bfa_nw_flash_read_part()
2953 flash->op_busy = 1; in bfa_nw_flash_read_part()
2954 flash->cbfn = cbfn; in bfa_nw_flash_read_part()
2955 flash->cbarg = cbarg; in bfa_nw_flash_read_part()
2956 flash->type = type; in bfa_nw_flash_read_part()
2957 flash->instance = instance; in bfa_nw_flash_read_part()
2958 flash->residue = len; in bfa_nw_flash_read_part()
2959 flash->offset = 0; in bfa_nw_flash_read_part()
2960 flash->addr_off = offset; in bfa_nw_flash_read_part()
2961 flash->ubuf = buf; in bfa_nw_flash_read_part()
2963 bfa_flash_read_send(flash); in bfa_nw_flash_read_part()