Lines Matching refs:utrd
173 static void get_utrd(utp_utrd_t *utrd) in get_utrd() argument
179 assert(utrd != NULL); in get_utrd()
184 memset((void *)utrd, 0, sizeof(utp_utrd_t)); in get_utrd()
189 utrd->header = base; in get_utrd()
190 utrd->task_tag = slot + 1; in get_utrd()
192 utrd->upiu = ALIGN_CDB(utrd->header + sizeof(utrd_header_t)); in get_utrd()
193 utrd->resp_upiu = ALIGN_8(utrd->upiu + sizeof(cmd_upiu_t)); in get_utrd()
194 utrd->size_upiu = utrd->resp_upiu - utrd->upiu; in get_utrd()
195 utrd->size_resp_upiu = ALIGN_8(sizeof(resp_upiu_t)); in get_utrd()
196 utrd->prdt = utrd->resp_upiu + utrd->size_resp_upiu; in get_utrd()
198 hd = (utrd_header_t *)utrd->header; in get_utrd()
199 hd->ucdba = utrd->upiu & UINT32_MAX; in get_utrd()
200 hd->ucdbau = (utrd->upiu >> 32) & UINT32_MAX; in get_utrd()
202 hd->rul = utrd->size_resp_upiu >> 2; in get_utrd()
203 hd->ruo = utrd->size_upiu >> 2; in get_utrd()
210 static int ufs_prepare_cmd(utp_utrd_t *utrd, uint8_t op, uint8_t lun, in ufs_prepare_cmd() argument
222 utrd->header & UINT32_MAX); in ufs_prepare_cmd()
224 (utrd->upiu >> 32) & UINT32_MAX); in ufs_prepare_cmd()
226 hd = (utrd_header_t *)utrd->header; in ufs_prepare_cmd()
227 upiu = (cmd_upiu_t *)utrd->upiu; in ufs_prepare_cmd()
234 upiu->task_tag = utrd->task_tag; in ufs_prepare_cmd()
285 prdt = (prdt_t *)utrd->prdt; in ufs_prepare_cmd()
303 utrd->size_prdt = ALIGN_8(prdt_size); in ufs_prepare_cmd()
304 hd->prdtl = utrd->size_prdt >> 2; in ufs_prepare_cmd()
305 hd->prdto = (utrd->size_upiu + utrd->size_resp_upiu) >> 2; in ufs_prepare_cmd()
308 flush_dcache_range((uintptr_t)utrd, sizeof(utp_utrd_t)); in ufs_prepare_cmd()
309 flush_dcache_range((uintptr_t)utrd->header, UFS_DESC_SIZE); in ufs_prepare_cmd()
313 static int ufs_prepare_query(utp_utrd_t *utrd, uint8_t op, uint8_t idn, in ufs_prepare_query() argument
321 hd = (utrd_header_t *)utrd->header; in ufs_prepare_query()
322 query_upiu = (query_upiu_t *)utrd->upiu; in ufs_prepare_query()
325 utrd->header & UINT32_MAX); in ufs_prepare_query()
327 (utrd->header >> 32) & UINT32_MAX); in ufs_prepare_query()
335 query_upiu->task_tag = utrd->task_tag; in ufs_prepare_query()
348 memcpy((void *)(utrd->upiu + sizeof(query_upiu_t)), in ufs_prepare_query()
367 flush_dcache_range((uintptr_t)utrd, sizeof(utp_utrd_t)); in ufs_prepare_query()
368 flush_dcache_range((uintptr_t)utrd->header, UFS_DESC_SIZE); in ufs_prepare_query()
372 static void ufs_prepare_nop_out(utp_utrd_t *utrd) in ufs_prepare_nop_out() argument
378 utrd->header & UINT32_MAX); in ufs_prepare_nop_out()
380 (utrd->header >> 32) & UINT32_MAX); in ufs_prepare_nop_out()
382 hd = (utrd_header_t *)utrd->header; in ufs_prepare_nop_out()
383 nop_out = (nop_out_upiu_t *)utrd->upiu; in ufs_prepare_nop_out()
390 nop_out->task_tag = utrd->task_tag; in ufs_prepare_nop_out()
391 flush_dcache_range((uintptr_t)utrd, sizeof(utp_utrd_t)); in ufs_prepare_nop_out()
392 flush_dcache_range((uintptr_t)utrd->header, UFS_DESC_SIZE); in ufs_prepare_nop_out()
416 static int ufs_check_resp(utp_utrd_t *utrd, int trans_type) in ufs_check_resp() argument
423 hd = (utrd_header_t *)utrd->header; in ufs_check_resp()
424 resp = (resp_upiu_t *)utrd->resp_upiu; in ufs_check_resp()
426 inv_dcache_range((uintptr_t)utrd, sizeof(utp_utrd_t)); in ufs_check_resp()
432 slot = utrd->task_tag - 1; in ufs_check_resp()
444 static void dump_upiu(utp_utrd_t *utrd) in dump_upiu() argument
449 hd = (utrd_header_t *)utrd->header; in dump_upiu()
451 (unsigned int)(uintptr_t)utrd, hd->ruo, hd->rul, hd->ocs, in dump_upiu()
455 (uintptr_t)utrd->header + i, in dump_upiu()
456 *(unsigned int *)((uintptr_t)utrd->header + i)); in dump_upiu()
461 utrd->upiu + i, in dump_upiu()
462 *(unsigned int *)(utrd->upiu + i)); in dump_upiu()
466 utrd->resp_upiu + i, in dump_upiu()
467 *(unsigned int *)(utrd->resp_upiu + i)); in dump_upiu()
471 utrd->prdt + i, in dump_upiu()
472 *(unsigned int *)(utrd->prdt + i)); in dump_upiu()
479 utp_utrd_t utrd; in ufs_verify_init() local
482 get_utrd(&utrd); in ufs_verify_init()
483 ufs_prepare_nop_out(&utrd); in ufs_verify_init()
484 ufs_send_request(utrd.task_tag); in ufs_verify_init()
485 result = ufs_check_resp(&utrd, NOP_IN_UPIU); in ufs_verify_init()
492 utp_utrd_t utrd; in ufs_verify_ready() local
495 get_utrd(&utrd); in ufs_verify_ready()
496 ufs_prepare_cmd(&utrd, CDBCMD_TEST_UNIT_READY, 0, 0, 0, 0); in ufs_verify_ready()
497 ufs_send_request(utrd.task_tag); in ufs_verify_ready()
498 result = ufs_check_resp(&utrd, RESPONSE_UPIU); in ufs_verify_ready()
506 utp_utrd_t utrd; in ufs_query() local
522 get_utrd(&utrd); in ufs_query()
523 ufs_prepare_query(&utrd, op, idn, index, sel, buf, size); in ufs_query()
524 ufs_send_request(utrd.task_tag); in ufs_query()
525 result = ufs_check_resp(&utrd, QUERY_RESPONSE_UPIU); in ufs_query()
527 resp = (query_resp_upiu_t *)utrd.resp_upiu; in ufs_query()
529 dump_upiu(&utrd); in ufs_query()
540 (void *)(utrd.resp_upiu + sizeof(query_resp_upiu_t)), in ufs_query()
596 utp_utrd_t utrd; in ufs_read_capacity() local
616 get_utrd(&utrd); in ufs_read_capacity()
617 ufs_prepare_cmd(&utrd, CDBCMD_READ_CAPACITY_10, lun, 0, in ufs_read_capacity()
619 ufs_send_request(utrd.task_tag); in ufs_read_capacity()
620 result = ufs_check_resp(&utrd, RESPONSE_UPIU); in ufs_read_capacity()
623 dump_upiu(&utrd); in ufs_read_capacity()
625 resp = (resp_upiu_t *)utrd.resp_upiu; in ufs_read_capacity()
647 utp_utrd_t utrd; in ufs_read_blocks() local
656 get_utrd(&utrd); in ufs_read_blocks()
657 ufs_prepare_cmd(&utrd, CDBCMD_READ_10, lun, lba, buf, size); in ufs_read_blocks()
658 ufs_send_request(utrd.task_tag); in ufs_read_blocks()
659 result = ufs_check_resp(&utrd, RESPONSE_UPIU); in ufs_read_blocks()
662 dump_upiu(&utrd); in ufs_read_blocks()
664 resp = (resp_upiu_t *)utrd.resp_upiu; in ufs_read_blocks()
671 utp_utrd_t utrd; in ufs_write_blocks() local
680 get_utrd(&utrd); in ufs_write_blocks()
681 ufs_prepare_cmd(&utrd, CDBCMD_WRITE_10, lun, lba, buf, size); in ufs_write_blocks()
682 ufs_send_request(utrd.task_tag); in ufs_write_blocks()
683 result = ufs_check_resp(&utrd, RESPONSE_UPIU); in ufs_write_blocks()
686 dump_upiu(&utrd); in ufs_write_blocks()
688 resp = (resp_upiu_t *)utrd.resp_upiu; in ufs_write_blocks()