Lines Matching refs:flash
3035 bfa_flash_cb(struct bfa_flash *flash) in bfa_flash_cb() argument
3037 flash->op_busy = 0; in bfa_flash_cb()
3038 if (flash->cbfn) in bfa_flash_cb()
3039 flash->cbfn(flash->cbarg, flash->status); in bfa_flash_cb()
3045 struct bfa_flash *flash = cbarg; in bfa_flash_notify() local
3050 if (flash->op_busy) { in bfa_flash_notify()
3051 flash->status = BFA_STATUS_IOC_FAILURE; in bfa_flash_notify()
3052 flash->cbfn(flash->cbarg, flash->status); in bfa_flash_notify()
3053 flash->op_busy = 0; in bfa_flash_notify()
3065 bfa_flash_write_send(struct bfa_flash *flash) in bfa_flash_write_send() argument
3068 (struct bfi_flash_write_req *) flash->mb.msg; in bfa_flash_write_send()
3071 msg->type = be32_to_cpu(flash->type); in bfa_flash_write_send()
3072 msg->instance = flash->instance; in bfa_flash_write_send()
3073 msg->offset = be32_to_cpu(flash->addr_off + flash->offset); in bfa_flash_write_send()
3074 len = (flash->residue < BFA_FLASH_DMA_BUF_SZ) ? in bfa_flash_write_send()
3075 flash->residue : BFA_FLASH_DMA_BUF_SZ; in bfa_flash_write_send()
3079 msg->last = (len == flash->residue) ? 1 : 0; in bfa_flash_write_send()
3082 bfa_ioc_portid(flash->ioc)); in bfa_flash_write_send()
3083 bfa_alen_set(&msg->alen, len, flash->dbuf_pa); in bfa_flash_write_send()
3084 memcpy(flash->dbuf_kva, flash->ubuf + flash->offset, len); in bfa_flash_write_send()
3085 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_flash_write_send()
3087 flash->residue -= len; in bfa_flash_write_send()
3088 flash->offset += len; in bfa_flash_write_send()
3099 struct bfa_flash *flash = cbarg; in bfa_flash_read_send() local
3101 (struct bfi_flash_read_req *) flash->mb.msg; in bfa_flash_read_send()
3104 msg->type = be32_to_cpu(flash->type); in bfa_flash_read_send()
3105 msg->instance = flash->instance; in bfa_flash_read_send()
3106 msg->offset = be32_to_cpu(flash->addr_off + flash->offset); in bfa_flash_read_send()
3107 len = (flash->residue < BFA_FLASH_DMA_BUF_SZ) ? in bfa_flash_read_send()
3108 flash->residue : BFA_FLASH_DMA_BUF_SZ; in bfa_flash_read_send()
3111 bfa_ioc_portid(flash->ioc)); in bfa_flash_read_send()
3112 bfa_alen_set(&msg->alen, len, flash->dbuf_pa); in bfa_flash_read_send()
3113 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_flash_read_send()
3125 struct bfa_flash *flash = flasharg; in bfa_flash_intr() local
3138 if (!flash->op_busy && msg->mh.msg_id != BFI_FLASH_I2H_EVENT) in bfa_flash_intr()
3148 attr = (struct bfa_flash_attr *) flash->ubuf; in bfa_flash_intr()
3149 f = (struct bfa_flash_attr *) flash->dbuf_kva; in bfa_flash_intr()
3167 flash->status = status; in bfa_flash_intr()
3168 bfa_flash_cb(flash); in bfa_flash_intr()
3172 if (status != BFA_STATUS_OK || flash->residue == 0) { in bfa_flash_intr()
3173 flash->status = status; in bfa_flash_intr()
3174 bfa_flash_cb(flash); in bfa_flash_intr()
3176 bfa_flash_write_send(flash); in bfa_flash_intr()
3181 flash->status = status; in bfa_flash_intr()
3182 bfa_flash_cb(flash); in bfa_flash_intr()
3185 memcpy(flash->ubuf + flash->offset, in bfa_flash_intr()
3186 flash->dbuf_kva, len); in bfa_flash_intr()
3187 flash->residue -= len; in bfa_flash_intr()
3188 flash->offset += len; in bfa_flash_intr()
3189 if (flash->residue == 0) { in bfa_flash_intr()
3190 flash->status = status; in bfa_flash_intr()
3191 bfa_flash_cb(flash); in bfa_flash_intr()
3193 bfa_flash_read_send(flash); in bfa_flash_intr()
3221 bfa_nw_flash_attach(struct bfa_flash *flash, struct bfa_ioc *ioc, void *dev) in bfa_nw_flash_attach() argument
3223 flash->ioc = ioc; in bfa_nw_flash_attach()
3224 flash->cbfn = NULL; in bfa_nw_flash_attach()
3225 flash->cbarg = NULL; in bfa_nw_flash_attach()
3226 flash->op_busy = 0; in bfa_nw_flash_attach()
3228 bfa_nw_ioc_mbox_regisr(flash->ioc, BFI_MC_FLASH, bfa_flash_intr, flash); in bfa_nw_flash_attach()
3229 bfa_ioc_notify_init(&flash->ioc_notify, bfa_flash_notify, flash); in bfa_nw_flash_attach()
3230 list_add_tail(&flash->ioc_notify.qe, &flash->ioc->notify_q); in bfa_nw_flash_attach()
3241 bfa_nw_flash_memclaim(struct bfa_flash *flash, u8 *dm_kva, u64 dm_pa) in bfa_nw_flash_memclaim() argument
3243 flash->dbuf_kva = dm_kva; in bfa_nw_flash_memclaim()
3244 flash->dbuf_pa = dm_pa; in bfa_nw_flash_memclaim()
3245 memset(flash->dbuf_kva, 0, BFA_FLASH_DMA_BUF_SZ); in bfa_nw_flash_memclaim()
3261 bfa_nw_flash_get_attr(struct bfa_flash *flash, struct bfa_flash_attr *attr, in bfa_nw_flash_get_attr() argument
3265 (struct bfi_flash_query_req *) flash->mb.msg; in bfa_nw_flash_get_attr()
3267 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_get_attr()
3270 if (flash->op_busy) in bfa_nw_flash_get_attr()
3273 flash->op_busy = 1; in bfa_nw_flash_get_attr()
3274 flash->cbfn = cbfn; in bfa_nw_flash_get_attr()
3275 flash->cbarg = cbarg; in bfa_nw_flash_get_attr()
3276 flash->ubuf = (u8 *) attr; in bfa_nw_flash_get_attr()
3279 bfa_ioc_portid(flash->ioc)); in bfa_nw_flash_get_attr()
3280 bfa_alen_set(&msg->alen, sizeof(struct bfa_flash_attr), flash->dbuf_pa); in bfa_nw_flash_get_attr()
3281 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_nw_flash_get_attr()
3301 bfa_nw_flash_update_part(struct bfa_flash *flash, u32 type, u8 instance, in bfa_nw_flash_update_part() argument
3305 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_update_part()
3317 if (flash->op_busy) in bfa_nw_flash_update_part()
3320 flash->op_busy = 1; in bfa_nw_flash_update_part()
3321 flash->cbfn = cbfn; in bfa_nw_flash_update_part()
3322 flash->cbarg = cbarg; in bfa_nw_flash_update_part()
3323 flash->type = type; in bfa_nw_flash_update_part()
3324 flash->instance = instance; in bfa_nw_flash_update_part()
3325 flash->residue = len; in bfa_nw_flash_update_part()
3326 flash->offset = 0; in bfa_nw_flash_update_part()
3327 flash->addr_off = offset; in bfa_nw_flash_update_part()
3328 flash->ubuf = buf; in bfa_nw_flash_update_part()
3330 bfa_flash_write_send(flash); in bfa_nw_flash_update_part()
3350 bfa_nw_flash_read_part(struct bfa_flash *flash, u32 type, u8 instance, in bfa_nw_flash_read_part() argument
3354 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_read_part()
3363 if (flash->op_busy) in bfa_nw_flash_read_part()
3366 flash->op_busy = 1; in bfa_nw_flash_read_part()
3367 flash->cbfn = cbfn; in bfa_nw_flash_read_part()
3368 flash->cbarg = cbarg; in bfa_nw_flash_read_part()
3369 flash->type = type; in bfa_nw_flash_read_part()
3370 flash->instance = instance; in bfa_nw_flash_read_part()
3371 flash->residue = len; in bfa_nw_flash_read_part()
3372 flash->offset = 0; in bfa_nw_flash_read_part()
3373 flash->addr_off = offset; in bfa_nw_flash_read_part()
3374 flash->ubuf = buf; in bfa_nw_flash_read_part()
3376 bfa_flash_read_send(flash); in bfa_nw_flash_read_part()