Lines Matching refs:flash
3028 bfa_flash_cb(struct bfa_flash *flash) in bfa_flash_cb() argument
3030 flash->op_busy = 0; in bfa_flash_cb()
3031 if (flash->cbfn) in bfa_flash_cb()
3032 flash->cbfn(flash->cbarg, flash->status); in bfa_flash_cb()
3038 struct bfa_flash *flash = cbarg; in bfa_flash_notify() local
3043 if (flash->op_busy) { in bfa_flash_notify()
3044 flash->status = BFA_STATUS_IOC_FAILURE; in bfa_flash_notify()
3045 flash->cbfn(flash->cbarg, flash->status); in bfa_flash_notify()
3046 flash->op_busy = 0; in bfa_flash_notify()
3058 bfa_flash_write_send(struct bfa_flash *flash) in bfa_flash_write_send() argument
3061 (struct bfi_flash_write_req *) flash->mb.msg; in bfa_flash_write_send()
3064 msg->type = be32_to_cpu(flash->type); in bfa_flash_write_send()
3065 msg->instance = flash->instance; in bfa_flash_write_send()
3066 msg->offset = be32_to_cpu(flash->addr_off + flash->offset); in bfa_flash_write_send()
3067 len = (flash->residue < BFA_FLASH_DMA_BUF_SZ) ? in bfa_flash_write_send()
3068 flash->residue : BFA_FLASH_DMA_BUF_SZ; in bfa_flash_write_send()
3072 msg->last = (len == flash->residue) ? 1 : 0; in bfa_flash_write_send()
3075 bfa_ioc_portid(flash->ioc)); in bfa_flash_write_send()
3076 bfa_alen_set(&msg->alen, len, flash->dbuf_pa); in bfa_flash_write_send()
3077 memcpy(flash->dbuf_kva, flash->ubuf + flash->offset, len); in bfa_flash_write_send()
3078 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_flash_write_send()
3080 flash->residue -= len; in bfa_flash_write_send()
3081 flash->offset += len; in bfa_flash_write_send()
3092 struct bfa_flash *flash = cbarg; in bfa_flash_read_send() local
3094 (struct bfi_flash_read_req *) flash->mb.msg; in bfa_flash_read_send()
3097 msg->type = be32_to_cpu(flash->type); in bfa_flash_read_send()
3098 msg->instance = flash->instance; in bfa_flash_read_send()
3099 msg->offset = be32_to_cpu(flash->addr_off + flash->offset); in bfa_flash_read_send()
3100 len = (flash->residue < BFA_FLASH_DMA_BUF_SZ) ? in bfa_flash_read_send()
3101 flash->residue : BFA_FLASH_DMA_BUF_SZ; in bfa_flash_read_send()
3104 bfa_ioc_portid(flash->ioc)); in bfa_flash_read_send()
3105 bfa_alen_set(&msg->alen, len, flash->dbuf_pa); in bfa_flash_read_send()
3106 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_flash_read_send()
3118 struct bfa_flash *flash = flasharg; in bfa_flash_intr() local
3131 if (!flash->op_busy && msg->mh.msg_id != BFI_FLASH_I2H_EVENT) in bfa_flash_intr()
3141 attr = (struct bfa_flash_attr *) flash->ubuf; in bfa_flash_intr()
3142 f = (struct bfa_flash_attr *) flash->dbuf_kva; in bfa_flash_intr()
3160 flash->status = status; in bfa_flash_intr()
3161 bfa_flash_cb(flash); in bfa_flash_intr()
3165 if (status != BFA_STATUS_OK || flash->residue == 0) { in bfa_flash_intr()
3166 flash->status = status; in bfa_flash_intr()
3167 bfa_flash_cb(flash); in bfa_flash_intr()
3169 bfa_flash_write_send(flash); in bfa_flash_intr()
3174 flash->status = status; in bfa_flash_intr()
3175 bfa_flash_cb(flash); in bfa_flash_intr()
3178 memcpy(flash->ubuf + flash->offset, in bfa_flash_intr()
3179 flash->dbuf_kva, len); in bfa_flash_intr()
3180 flash->residue -= len; in bfa_flash_intr()
3181 flash->offset += len; in bfa_flash_intr()
3182 if (flash->residue == 0) { in bfa_flash_intr()
3183 flash->status = status; in bfa_flash_intr()
3184 bfa_flash_cb(flash); in bfa_flash_intr()
3186 bfa_flash_read_send(flash); in bfa_flash_intr()
3214 bfa_nw_flash_attach(struct bfa_flash *flash, struct bfa_ioc *ioc, void *dev) in bfa_nw_flash_attach() argument
3216 flash->ioc = ioc; in bfa_nw_flash_attach()
3217 flash->cbfn = NULL; in bfa_nw_flash_attach()
3218 flash->cbarg = NULL; in bfa_nw_flash_attach()
3219 flash->op_busy = 0; in bfa_nw_flash_attach()
3221 bfa_nw_ioc_mbox_regisr(flash->ioc, BFI_MC_FLASH, bfa_flash_intr, flash); in bfa_nw_flash_attach()
3222 bfa_ioc_notify_init(&flash->ioc_notify, bfa_flash_notify, flash); in bfa_nw_flash_attach()
3223 list_add_tail(&flash->ioc_notify.qe, &flash->ioc->notify_q); in bfa_nw_flash_attach()
3234 bfa_nw_flash_memclaim(struct bfa_flash *flash, u8 *dm_kva, u64 dm_pa) in bfa_nw_flash_memclaim() argument
3236 flash->dbuf_kva = dm_kva; in bfa_nw_flash_memclaim()
3237 flash->dbuf_pa = dm_pa; in bfa_nw_flash_memclaim()
3238 memset(flash->dbuf_kva, 0, BFA_FLASH_DMA_BUF_SZ); in bfa_nw_flash_memclaim()
3254 bfa_nw_flash_get_attr(struct bfa_flash *flash, struct bfa_flash_attr *attr, in bfa_nw_flash_get_attr() argument
3258 (struct bfi_flash_query_req *) flash->mb.msg; in bfa_nw_flash_get_attr()
3260 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_get_attr()
3263 if (flash->op_busy) in bfa_nw_flash_get_attr()
3266 flash->op_busy = 1; in bfa_nw_flash_get_attr()
3267 flash->cbfn = cbfn; in bfa_nw_flash_get_attr()
3268 flash->cbarg = cbarg; in bfa_nw_flash_get_attr()
3269 flash->ubuf = (u8 *) attr; in bfa_nw_flash_get_attr()
3272 bfa_ioc_portid(flash->ioc)); in bfa_nw_flash_get_attr()
3273 bfa_alen_set(&msg->alen, sizeof(struct bfa_flash_attr), flash->dbuf_pa); in bfa_nw_flash_get_attr()
3274 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_nw_flash_get_attr()
3294 bfa_nw_flash_update_part(struct bfa_flash *flash, u32 type, u8 instance, in bfa_nw_flash_update_part() argument
3298 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_update_part()
3310 if (flash->op_busy) in bfa_nw_flash_update_part()
3313 flash->op_busy = 1; in bfa_nw_flash_update_part()
3314 flash->cbfn = cbfn; in bfa_nw_flash_update_part()
3315 flash->cbarg = cbarg; in bfa_nw_flash_update_part()
3316 flash->type = type; in bfa_nw_flash_update_part()
3317 flash->instance = instance; in bfa_nw_flash_update_part()
3318 flash->residue = len; in bfa_nw_flash_update_part()
3319 flash->offset = 0; in bfa_nw_flash_update_part()
3320 flash->addr_off = offset; in bfa_nw_flash_update_part()
3321 flash->ubuf = buf; in bfa_nw_flash_update_part()
3323 bfa_flash_write_send(flash); in bfa_nw_flash_update_part()
3343 bfa_nw_flash_read_part(struct bfa_flash *flash, u32 type, u8 instance, in bfa_nw_flash_read_part() argument
3347 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_read_part()
3356 if (flash->op_busy) in bfa_nw_flash_read_part()
3359 flash->op_busy = 1; in bfa_nw_flash_read_part()
3360 flash->cbfn = cbfn; in bfa_nw_flash_read_part()
3361 flash->cbarg = cbarg; in bfa_nw_flash_read_part()
3362 flash->type = type; in bfa_nw_flash_read_part()
3363 flash->instance = instance; in bfa_nw_flash_read_part()
3364 flash->residue = len; in bfa_nw_flash_read_part()
3365 flash->offset = 0; in bfa_nw_flash_read_part()
3366 flash->addr_off = offset; in bfa_nw_flash_read_part()
3367 flash->ubuf = buf; in bfa_nw_flash_read_part()
3369 bfa_flash_read_send(flash); in bfa_nw_flash_read_part()