Lines Matching refs:flash

3039 bfa_flash_cb(struct bfa_flash *flash)  in bfa_flash_cb()  argument
3041 flash->op_busy = 0; in bfa_flash_cb()
3042 if (flash->cbfn) in bfa_flash_cb()
3043 flash->cbfn(flash->cbarg, flash->status); in bfa_flash_cb()
3049 struct bfa_flash *flash = cbarg; in bfa_flash_notify() local
3054 if (flash->op_busy) { in bfa_flash_notify()
3055 flash->status = BFA_STATUS_IOC_FAILURE; in bfa_flash_notify()
3056 flash->cbfn(flash->cbarg, flash->status); in bfa_flash_notify()
3057 flash->op_busy = 0; in bfa_flash_notify()
3069 bfa_flash_write_send(struct bfa_flash *flash) in bfa_flash_write_send() argument
3072 (struct bfi_flash_write_req *) flash->mb.msg; in bfa_flash_write_send()
3075 msg->type = be32_to_cpu(flash->type); in bfa_flash_write_send()
3076 msg->instance = flash->instance; in bfa_flash_write_send()
3077 msg->offset = be32_to_cpu(flash->addr_off + flash->offset); in bfa_flash_write_send()
3078 len = (flash->residue < BFA_FLASH_DMA_BUF_SZ) ? in bfa_flash_write_send()
3079 flash->residue : BFA_FLASH_DMA_BUF_SZ; in bfa_flash_write_send()
3083 msg->last = (len == flash->residue) ? 1 : 0; in bfa_flash_write_send()
3086 bfa_ioc_portid(flash->ioc)); in bfa_flash_write_send()
3087 bfa_alen_set(&msg->alen, len, flash->dbuf_pa); in bfa_flash_write_send()
3088 memcpy(flash->dbuf_kva, flash->ubuf + flash->offset, len); in bfa_flash_write_send()
3089 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_flash_write_send()
3091 flash->residue -= len; in bfa_flash_write_send()
3092 flash->offset += len; in bfa_flash_write_send()
3103 struct bfa_flash *flash = cbarg; in bfa_flash_read_send() local
3105 (struct bfi_flash_read_req *) flash->mb.msg; in bfa_flash_read_send()
3108 msg->type = be32_to_cpu(flash->type); in bfa_flash_read_send()
3109 msg->instance = flash->instance; in bfa_flash_read_send()
3110 msg->offset = be32_to_cpu(flash->addr_off + flash->offset); in bfa_flash_read_send()
3111 len = (flash->residue < BFA_FLASH_DMA_BUF_SZ) ? in bfa_flash_read_send()
3112 flash->residue : BFA_FLASH_DMA_BUF_SZ; in bfa_flash_read_send()
3115 bfa_ioc_portid(flash->ioc)); in bfa_flash_read_send()
3116 bfa_alen_set(&msg->alen, len, flash->dbuf_pa); in bfa_flash_read_send()
3117 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_flash_read_send()
3129 struct bfa_flash *flash = flasharg; in bfa_flash_intr() local
3142 if (!flash->op_busy && msg->mh.msg_id != BFI_FLASH_I2H_EVENT) in bfa_flash_intr()
3152 attr = (struct bfa_flash_attr *) flash->ubuf; in bfa_flash_intr()
3153 f = (struct bfa_flash_attr *) flash->dbuf_kva; in bfa_flash_intr()
3171 flash->status = status; in bfa_flash_intr()
3172 bfa_flash_cb(flash); in bfa_flash_intr()
3176 if (status != BFA_STATUS_OK || flash->residue == 0) { in bfa_flash_intr()
3177 flash->status = status; in bfa_flash_intr()
3178 bfa_flash_cb(flash); in bfa_flash_intr()
3180 bfa_flash_write_send(flash); in bfa_flash_intr()
3185 flash->status = status; in bfa_flash_intr()
3186 bfa_flash_cb(flash); in bfa_flash_intr()
3189 memcpy(flash->ubuf + flash->offset, in bfa_flash_intr()
3190 flash->dbuf_kva, len); in bfa_flash_intr()
3191 flash->residue -= len; in bfa_flash_intr()
3192 flash->offset += len; in bfa_flash_intr()
3193 if (flash->residue == 0) { in bfa_flash_intr()
3194 flash->status = status; in bfa_flash_intr()
3195 bfa_flash_cb(flash); in bfa_flash_intr()
3197 bfa_flash_read_send(flash); in bfa_flash_intr()
3225 bfa_nw_flash_attach(struct bfa_flash *flash, struct bfa_ioc *ioc, void *dev) in bfa_nw_flash_attach() argument
3227 flash->ioc = ioc; in bfa_nw_flash_attach()
3228 flash->cbfn = NULL; in bfa_nw_flash_attach()
3229 flash->cbarg = NULL; in bfa_nw_flash_attach()
3230 flash->op_busy = 0; in bfa_nw_flash_attach()
3232 bfa_nw_ioc_mbox_regisr(flash->ioc, BFI_MC_FLASH, bfa_flash_intr, flash); in bfa_nw_flash_attach()
3233 bfa_ioc_notify_init(&flash->ioc_notify, bfa_flash_notify, flash); in bfa_nw_flash_attach()
3234 list_add_tail(&flash->ioc_notify.qe, &flash->ioc->notify_q); in bfa_nw_flash_attach()
3245 bfa_nw_flash_memclaim(struct bfa_flash *flash, u8 *dm_kva, u64 dm_pa) in bfa_nw_flash_memclaim() argument
3247 flash->dbuf_kva = dm_kva; in bfa_nw_flash_memclaim()
3248 flash->dbuf_pa = dm_pa; in bfa_nw_flash_memclaim()
3249 memset(flash->dbuf_kva, 0, BFA_FLASH_DMA_BUF_SZ); in bfa_nw_flash_memclaim()
3265 bfa_nw_flash_get_attr(struct bfa_flash *flash, struct bfa_flash_attr *attr, in bfa_nw_flash_get_attr() argument
3269 (struct bfi_flash_query_req *) flash->mb.msg; in bfa_nw_flash_get_attr()
3271 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_get_attr()
3274 if (flash->op_busy) in bfa_nw_flash_get_attr()
3277 flash->op_busy = 1; in bfa_nw_flash_get_attr()
3278 flash->cbfn = cbfn; in bfa_nw_flash_get_attr()
3279 flash->cbarg = cbarg; in bfa_nw_flash_get_attr()
3280 flash->ubuf = (u8 *) attr; in bfa_nw_flash_get_attr()
3283 bfa_ioc_portid(flash->ioc)); in bfa_nw_flash_get_attr()
3284 bfa_alen_set(&msg->alen, sizeof(struct bfa_flash_attr), flash->dbuf_pa); in bfa_nw_flash_get_attr()
3285 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_nw_flash_get_attr()
3305 bfa_nw_flash_update_part(struct bfa_flash *flash, u32 type, u8 instance, in bfa_nw_flash_update_part() argument
3309 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_update_part()
3321 if (flash->op_busy) in bfa_nw_flash_update_part()
3324 flash->op_busy = 1; in bfa_nw_flash_update_part()
3325 flash->cbfn = cbfn; in bfa_nw_flash_update_part()
3326 flash->cbarg = cbarg; in bfa_nw_flash_update_part()
3327 flash->type = type; in bfa_nw_flash_update_part()
3328 flash->instance = instance; in bfa_nw_flash_update_part()
3329 flash->residue = len; in bfa_nw_flash_update_part()
3330 flash->offset = 0; in bfa_nw_flash_update_part()
3331 flash->addr_off = offset; in bfa_nw_flash_update_part()
3332 flash->ubuf = buf; in bfa_nw_flash_update_part()
3334 bfa_flash_write_send(flash); in bfa_nw_flash_update_part()
3354 bfa_nw_flash_read_part(struct bfa_flash *flash, u32 type, u8 instance, in bfa_nw_flash_read_part() argument
3358 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_read_part()
3367 if (flash->op_busy) in bfa_nw_flash_read_part()
3370 flash->op_busy = 1; in bfa_nw_flash_read_part()
3371 flash->cbfn = cbfn; in bfa_nw_flash_read_part()
3372 flash->cbarg = cbarg; in bfa_nw_flash_read_part()
3373 flash->type = type; in bfa_nw_flash_read_part()
3374 flash->instance = instance; in bfa_nw_flash_read_part()
3375 flash->residue = len; in bfa_nw_flash_read_part()
3376 flash->offset = 0; in bfa_nw_flash_read_part()
3377 flash->addr_off = offset; in bfa_nw_flash_read_part()
3378 flash->ubuf = buf; in bfa_nw_flash_read_part()
3380 bfa_flash_read_send(flash); in bfa_nw_flash_read_part()