Lines Matching defs:flash

2619 bfa_flash_cb(struct bfa_flash *flash)
2621 flash->op_busy = 0;
2622 if (flash->cbfn)
2623 flash->cbfn(flash->cbarg, flash->status);
2629 struct bfa_flash *flash = cbarg;
2634 if (flash->op_busy) {
2635 flash->status = BFA_STATUS_IOC_FAILURE;
2636 flash->cbfn(flash->cbarg, flash->status);
2637 flash->op_busy = 0;
2646 * Send flash write request.
2651 bfa_flash_write_send(struct bfa_flash *flash)
2654 (struct bfi_flash_write_req *) flash->mb.msg;
2657 msg->type = be32_to_cpu(flash->type);
2658 msg->instance = flash->instance;
2659 msg->offset = be32_to_cpu(flash->addr_off + flash->offset);
2660 len = (flash->residue < BFA_FLASH_DMA_BUF_SZ) ?
2661 flash->residue : BFA_FLASH_DMA_BUF_SZ;
2665 msg->last = (len == flash->residue) ? 1 : 0;
2668 bfa_ioc_portid(flash->ioc));
2669 bfa_alen_set(&msg->alen, len, flash->dbuf_pa);
2670 memcpy(flash->dbuf_kva, flash->ubuf + flash->offset, len);
2671 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL);
2673 flash->residue -= len;
2674 flash->offset += len;
2678 * Send flash read request.
2685 struct bfa_flash *flash = cbarg;
2687 (struct bfi_flash_read_req *) flash->mb.msg;
2690 msg->type = be32_to_cpu(flash->type);
2691 msg->instance = flash->instance;
2692 msg->offset = be32_to_cpu(flash->addr_off + flash->offset);
2693 len = (flash->residue < BFA_FLASH_DMA_BUF_SZ) ?
2694 flash->residue : BFA_FLASH_DMA_BUF_SZ;
2697 bfa_ioc_portid(flash->ioc));
2698 bfa_alen_set(&msg->alen, len, flash->dbuf_pa);
2699 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL);
2703 * Process flash response messages upon receiving interrupts.
2705 * @param[in] flasharg - flash structure
2711 struct bfa_flash *flash = flasharg;
2724 if (!flash->op_busy && msg->mh.msg_id != BFI_FLASH_I2H_EVENT)
2734 attr = (struct bfa_flash_attr *) flash->ubuf;
2735 f = (struct bfa_flash_attr *) flash->dbuf_kva;
2753 flash->status = status;
2754 bfa_flash_cb(flash);
2758 if (status != BFA_STATUS_OK || flash->residue == 0) {
2759 flash->status = status;
2760 bfa_flash_cb(flash);
2762 bfa_flash_write_send(flash);
2767 flash->status = status;
2768 bfa_flash_cb(flash);
2771 memcpy(flash->ubuf + flash->offset,
2772 flash->dbuf_kva, len);
2773 flash->residue -= len;
2774 flash->offset += len;
2775 if (flash->residue == 0) {
2776 flash->status = status;
2777 bfa_flash_cb(flash);
2779 bfa_flash_read_send(flash);
2802 * @param[in] flash - flash structure
2807 bfa_nw_flash_attach(struct bfa_flash *flash, struct bfa_ioc *ioc, void *dev)
2809 flash->ioc = ioc;
2810 flash->cbfn = NULL;
2811 flash->cbarg = NULL;
2812 flash->op_busy = 0;
2814 bfa_nw_ioc_mbox_regisr(flash->ioc, BFI_MC_FLASH, bfa_flash_intr, flash);
2815 bfa_q_qe_init(&flash->ioc_notify);
2816 bfa_ioc_notify_init(&flash->ioc_notify, bfa_flash_notify, flash);
2817 list_add_tail(&flash->ioc_notify.qe, &flash->ioc->notify_q);
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)
2830 flash->dbuf_kva = dm_kva;
2831 flash->dbuf_pa = dm_pa;
2832 memset(flash->dbuf_kva, 0, BFA_FLASH_DMA_BUF_SZ);
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,
2852 (struct bfi_flash_query_req *) flash->mb.msg;
2854 if (!bfa_nw_ioc_is_operational(flash->ioc))
2857 if (flash->op_busy)
2860 flash->op_busy = 1;
2861 flash->cbfn = cbfn;
2862 flash->cbarg = cbarg;
2863 flash->ubuf = (u8 *) attr;
2866 bfa_ioc_portid(flash->ioc));
2867 bfa_alen_set(&msg->alen, sizeof(struct bfa_flash_attr), flash->dbuf_pa);
2868 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL);
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,
2892 if (!bfa_nw_ioc_is_operational(flash->ioc))
2904 if (flash->op_busy)
2907 flash->op_busy = 1;
2908 flash->cbfn = cbfn;
2909 flash->cbarg = cbarg;
2910 flash->type = type;
2911 flash->instance = instance;
2912 flash->residue = len;
2913 flash->offset = 0;
2914 flash->addr_off = offset;
2915 flash->ubuf = buf;
2917 bfa_flash_write_send(flash);
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,
2941 if (!bfa_nw_ioc_is_operational(flash->ioc))
2950 if (flash->op_busy)
2953 flash->op_busy = 1;
2954 flash->cbfn = cbfn;
2955 flash->cbarg = cbarg;
2956 flash->type = type;
2957 flash->instance = instance;
2958 flash->residue = len;
2959 flash->offset = 0;
2960 flash->addr_off = offset;
2961 flash->ubuf = buf;
2963 bfa_flash_read_send(flash);