Lines Matching refs:flash

3054 bfa_flash_cb(struct bfa_flash *flash)  in bfa_flash_cb()  argument
3056 flash->op_busy = 0; in bfa_flash_cb()
3057 if (flash->cbfn) in bfa_flash_cb()
3058 flash->cbfn(flash->cbarg, flash->status); in bfa_flash_cb()
3064 struct bfa_flash *flash = cbarg; in bfa_flash_notify() local
3069 if (flash->op_busy) { in bfa_flash_notify()
3070 flash->status = BFA_STATUS_IOC_FAILURE; in bfa_flash_notify()
3071 flash->cbfn(flash->cbarg, flash->status); in bfa_flash_notify()
3072 flash->op_busy = 0; in bfa_flash_notify()
3084 bfa_flash_write_send(struct bfa_flash *flash) in bfa_flash_write_send() argument
3087 (struct bfi_flash_write_req *) flash->mb.msg; in bfa_flash_write_send()
3090 msg->type = be32_to_cpu(flash->type); in bfa_flash_write_send()
3091 msg->instance = flash->instance; in bfa_flash_write_send()
3092 msg->offset = be32_to_cpu(flash->addr_off + flash->offset); in bfa_flash_write_send()
3093 len = (flash->residue < BFA_FLASH_DMA_BUF_SZ) ? in bfa_flash_write_send()
3094 flash->residue : BFA_FLASH_DMA_BUF_SZ; in bfa_flash_write_send()
3098 msg->last = (len == flash->residue) ? 1 : 0; in bfa_flash_write_send()
3101 bfa_ioc_portid(flash->ioc)); in bfa_flash_write_send()
3102 bfa_alen_set(&msg->alen, len, flash->dbuf_pa); in bfa_flash_write_send()
3103 memcpy(flash->dbuf_kva, flash->ubuf + flash->offset, len); in bfa_flash_write_send()
3104 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_flash_write_send()
3106 flash->residue -= len; in bfa_flash_write_send()
3107 flash->offset += len; in bfa_flash_write_send()
3118 struct bfa_flash *flash = cbarg; in bfa_flash_read_send() local
3120 (struct bfi_flash_read_req *) flash->mb.msg; in bfa_flash_read_send()
3123 msg->type = be32_to_cpu(flash->type); in bfa_flash_read_send()
3124 msg->instance = flash->instance; in bfa_flash_read_send()
3125 msg->offset = be32_to_cpu(flash->addr_off + flash->offset); in bfa_flash_read_send()
3126 len = (flash->residue < BFA_FLASH_DMA_BUF_SZ) ? in bfa_flash_read_send()
3127 flash->residue : BFA_FLASH_DMA_BUF_SZ; in bfa_flash_read_send()
3130 bfa_ioc_portid(flash->ioc)); in bfa_flash_read_send()
3131 bfa_alen_set(&msg->alen, len, flash->dbuf_pa); in bfa_flash_read_send()
3132 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_flash_read_send()
3144 struct bfa_flash *flash = flasharg; in bfa_flash_intr() local
3157 if (!flash->op_busy && msg->mh.msg_id != BFI_FLASH_I2H_EVENT) in bfa_flash_intr()
3167 attr = (struct bfa_flash_attr *) flash->ubuf; in bfa_flash_intr()
3168 f = (struct bfa_flash_attr *) flash->dbuf_kva; in bfa_flash_intr()
3186 flash->status = status; in bfa_flash_intr()
3187 bfa_flash_cb(flash); in bfa_flash_intr()
3191 if (status != BFA_STATUS_OK || flash->residue == 0) { in bfa_flash_intr()
3192 flash->status = status; in bfa_flash_intr()
3193 bfa_flash_cb(flash); in bfa_flash_intr()
3195 bfa_flash_write_send(flash); in bfa_flash_intr()
3200 flash->status = status; in bfa_flash_intr()
3201 bfa_flash_cb(flash); in bfa_flash_intr()
3204 memcpy(flash->ubuf + flash->offset, in bfa_flash_intr()
3205 flash->dbuf_kva, len); in bfa_flash_intr()
3206 flash->residue -= len; in bfa_flash_intr()
3207 flash->offset += len; in bfa_flash_intr()
3208 if (flash->residue == 0) { in bfa_flash_intr()
3209 flash->status = status; in bfa_flash_intr()
3210 bfa_flash_cb(flash); in bfa_flash_intr()
3212 bfa_flash_read_send(flash); in bfa_flash_intr()
3240 bfa_nw_flash_attach(struct bfa_flash *flash, struct bfa_ioc *ioc, void *dev) in bfa_nw_flash_attach() argument
3242 flash->ioc = ioc; in bfa_nw_flash_attach()
3243 flash->cbfn = NULL; in bfa_nw_flash_attach()
3244 flash->cbarg = NULL; in bfa_nw_flash_attach()
3245 flash->op_busy = 0; in bfa_nw_flash_attach()
3247 bfa_nw_ioc_mbox_regisr(flash->ioc, BFI_MC_FLASH, bfa_flash_intr, flash); in bfa_nw_flash_attach()
3248 bfa_q_qe_init(&flash->ioc_notify); in bfa_nw_flash_attach()
3249 bfa_ioc_notify_init(&flash->ioc_notify, bfa_flash_notify, flash); in bfa_nw_flash_attach()
3250 list_add_tail(&flash->ioc_notify.qe, &flash->ioc->notify_q); in bfa_nw_flash_attach()
3261 bfa_nw_flash_memclaim(struct bfa_flash *flash, u8 *dm_kva, u64 dm_pa) in bfa_nw_flash_memclaim() argument
3263 flash->dbuf_kva = dm_kva; in bfa_nw_flash_memclaim()
3264 flash->dbuf_pa = dm_pa; in bfa_nw_flash_memclaim()
3265 memset(flash->dbuf_kva, 0, BFA_FLASH_DMA_BUF_SZ); in bfa_nw_flash_memclaim()
3281 bfa_nw_flash_get_attr(struct bfa_flash *flash, struct bfa_flash_attr *attr, in bfa_nw_flash_get_attr() argument
3285 (struct bfi_flash_query_req *) flash->mb.msg; in bfa_nw_flash_get_attr()
3287 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_get_attr()
3290 if (flash->op_busy) in bfa_nw_flash_get_attr()
3293 flash->op_busy = 1; in bfa_nw_flash_get_attr()
3294 flash->cbfn = cbfn; in bfa_nw_flash_get_attr()
3295 flash->cbarg = cbarg; in bfa_nw_flash_get_attr()
3296 flash->ubuf = (u8 *) attr; in bfa_nw_flash_get_attr()
3299 bfa_ioc_portid(flash->ioc)); in bfa_nw_flash_get_attr()
3300 bfa_alen_set(&msg->alen, sizeof(struct bfa_flash_attr), flash->dbuf_pa); in bfa_nw_flash_get_attr()
3301 bfa_nw_ioc_mbox_queue(flash->ioc, &flash->mb, NULL, NULL); in bfa_nw_flash_get_attr()
3321 bfa_nw_flash_update_part(struct bfa_flash *flash, u32 type, u8 instance, in bfa_nw_flash_update_part() argument
3325 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_update_part()
3337 if (flash->op_busy) in bfa_nw_flash_update_part()
3340 flash->op_busy = 1; in bfa_nw_flash_update_part()
3341 flash->cbfn = cbfn; in bfa_nw_flash_update_part()
3342 flash->cbarg = cbarg; in bfa_nw_flash_update_part()
3343 flash->type = type; in bfa_nw_flash_update_part()
3344 flash->instance = instance; in bfa_nw_flash_update_part()
3345 flash->residue = len; in bfa_nw_flash_update_part()
3346 flash->offset = 0; in bfa_nw_flash_update_part()
3347 flash->addr_off = offset; in bfa_nw_flash_update_part()
3348 flash->ubuf = buf; in bfa_nw_flash_update_part()
3350 bfa_flash_write_send(flash); in bfa_nw_flash_update_part()
3370 bfa_nw_flash_read_part(struct bfa_flash *flash, u32 type, u8 instance, in bfa_nw_flash_read_part() argument
3374 if (!bfa_nw_ioc_is_operational(flash->ioc)) in bfa_nw_flash_read_part()
3383 if (flash->op_busy) in bfa_nw_flash_read_part()
3386 flash->op_busy = 1; in bfa_nw_flash_read_part()
3387 flash->cbfn = cbfn; in bfa_nw_flash_read_part()
3388 flash->cbarg = cbarg; in bfa_nw_flash_read_part()
3389 flash->type = type; in bfa_nw_flash_read_part()
3390 flash->instance = instance; in bfa_nw_flash_read_part()
3391 flash->residue = len; in bfa_nw_flash_read_part()
3392 flash->offset = 0; in bfa_nw_flash_read_part()
3393 flash->addr_off = offset; in bfa_nw_flash_read_part()
3394 flash->ubuf = buf; in bfa_nw_flash_read_part()
3396 bfa_flash_read_send(flash); in bfa_nw_flash_read_part()