Lines Matching refs:pccb

51 static void scsi_print_error(struct scsi_cmd *pccb)  in scsi_print_error()  argument
57 void scsi_setup_read16(struct scsi_cmd *pccb, lbaint_t start, in scsi_setup_read16() argument
60 pccb->cmd[0] = SCSI_READ16; in scsi_setup_read16()
61 pccb->cmd[1] = pccb->lun << 5; in scsi_setup_read16()
62 pccb->cmd[2] = (unsigned char)(start >> 56) & 0xff; in scsi_setup_read16()
63 pccb->cmd[3] = (unsigned char)(start >> 48) & 0xff; in scsi_setup_read16()
64 pccb->cmd[4] = (unsigned char)(start >> 40) & 0xff; in scsi_setup_read16()
65 pccb->cmd[5] = (unsigned char)(start >> 32) & 0xff; in scsi_setup_read16()
66 pccb->cmd[6] = (unsigned char)(start >> 24) & 0xff; in scsi_setup_read16()
67 pccb->cmd[7] = (unsigned char)(start >> 16) & 0xff; in scsi_setup_read16()
68 pccb->cmd[8] = (unsigned char)(start >> 8) & 0xff; in scsi_setup_read16()
69 pccb->cmd[9] = (unsigned char)start & 0xff; in scsi_setup_read16()
70 pccb->cmd[10] = 0; in scsi_setup_read16()
71 pccb->cmd[11] = (unsigned char)(blocks >> 24) & 0xff; in scsi_setup_read16()
72 pccb->cmd[12] = (unsigned char)(blocks >> 16) & 0xff; in scsi_setup_read16()
73 pccb->cmd[13] = (unsigned char)(blocks >> 8) & 0xff; in scsi_setup_read16()
74 pccb->cmd[14] = (unsigned char)blocks & 0xff; in scsi_setup_read16()
75 pccb->cmd[15] = 0; in scsi_setup_read16()
76 pccb->cmdlen = 16; in scsi_setup_read16()
77 pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ in scsi_setup_read16()
79 pccb->cmd[0], pccb->cmd[1], in scsi_setup_read16()
80 pccb->cmd[2], pccb->cmd[3], pccb->cmd[4], pccb->cmd[5], in scsi_setup_read16()
81 pccb->cmd[6], pccb->cmd[7], pccb->cmd[8], pccb->cmd[9], in scsi_setup_read16()
82 pccb->cmd[11], pccb->cmd[12], pccb->cmd[13], pccb->cmd[14]); in scsi_setup_read16()
86 static void scsi_setup_read_ext(struct scsi_cmd *pccb, lbaint_t start, in scsi_setup_read_ext() argument
89 pccb->cmd[0] = SCSI_READ10; in scsi_setup_read_ext()
90 pccb->cmd[1] = pccb->lun << 5; in scsi_setup_read_ext()
91 pccb->cmd[2] = (unsigned char)(start >> 24) & 0xff; in scsi_setup_read_ext()
92 pccb->cmd[3] = (unsigned char)(start >> 16) & 0xff; in scsi_setup_read_ext()
93 pccb->cmd[4] = (unsigned char)(start >> 8) & 0xff; in scsi_setup_read_ext()
94 pccb->cmd[5] = (unsigned char)start & 0xff; in scsi_setup_read_ext()
95 pccb->cmd[6] = 0; in scsi_setup_read_ext()
96 pccb->cmd[7] = (unsigned char)(blocks >> 8) & 0xff; in scsi_setup_read_ext()
97 pccb->cmd[8] = (unsigned char)blocks & 0xff; in scsi_setup_read_ext()
98 pccb->cmd[6] = 0; in scsi_setup_read_ext()
99 pccb->cmdlen = 10; in scsi_setup_read_ext()
100 pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ in scsi_setup_read_ext()
102 pccb->cmd[0], pccb->cmd[1], in scsi_setup_read_ext()
103 pccb->cmd[2], pccb->cmd[3], pccb->cmd[4], pccb->cmd[5], in scsi_setup_read_ext()
104 pccb->cmd[7], pccb->cmd[8]); in scsi_setup_read_ext()
107 static void scsi_setup_write_ext(struct scsi_cmd *pccb, lbaint_t start, in scsi_setup_write_ext() argument
110 pccb->cmd[0] = SCSI_WRITE10; in scsi_setup_write_ext()
111 pccb->cmd[1] = pccb->lun << 5; in scsi_setup_write_ext()
112 pccb->cmd[2] = (unsigned char)(start >> 24) & 0xff; in scsi_setup_write_ext()
113 pccb->cmd[3] = (unsigned char)(start >> 16) & 0xff; in scsi_setup_write_ext()
114 pccb->cmd[4] = (unsigned char)(start >> 8) & 0xff; in scsi_setup_write_ext()
115 pccb->cmd[5] = (unsigned char)start & 0xff; in scsi_setup_write_ext()
116 pccb->cmd[6] = 0; in scsi_setup_write_ext()
117 pccb->cmd[7] = ((unsigned char)(blocks >> 8)) & 0xff; in scsi_setup_write_ext()
118 pccb->cmd[8] = (unsigned char)blocks & 0xff; in scsi_setup_write_ext()
119 pccb->cmd[9] = 0; in scsi_setup_write_ext()
120 pccb->cmdlen = 10; in scsi_setup_write_ext()
121 pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ in scsi_setup_write_ext()
124 pccb->cmd[0], pccb->cmd[1], in scsi_setup_write_ext()
125 pccb->cmd[2], pccb->cmd[3], pccb->cmd[4], pccb->cmd[5], in scsi_setup_write_ext()
126 pccb->cmd[7], pccb->cmd[8]); in scsi_setup_write_ext()
129 static void scsi_setup_inquiry(struct scsi_cmd *pccb) in scsi_setup_inquiry() argument
131 pccb->cmd[0] = SCSI_INQUIRY; in scsi_setup_inquiry()
132 pccb->cmd[1] = pccb->lun << 5; in scsi_setup_inquiry()
133 pccb->cmd[2] = 0; in scsi_setup_inquiry()
134 pccb->cmd[3] = 0; in scsi_setup_inquiry()
135 if (pccb->datalen > 255) in scsi_setup_inquiry()
136 pccb->cmd[4] = 255; in scsi_setup_inquiry()
138 pccb->cmd[4] = (unsigned char)pccb->datalen; in scsi_setup_inquiry()
139 pccb->cmd[5] = 0; in scsi_setup_inquiry()
140 pccb->cmdlen = 6; in scsi_setup_inquiry()
141 pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ in scsi_setup_inquiry()
161 struct scsi_cmd *pccb = (struct scsi_cmd *)&tempccb; in scsi_read() local
164 pccb->target = block_dev->target; in scsi_read()
165 pccb->lun = block_dev->lun; in scsi_read()
173 pccb->pdata = (unsigned char *)buf_addr; in scsi_read()
178 pccb->datalen = block_dev->blksz * blocks; in scsi_read()
179 scsi_setup_read16(pccb, start, blocks); in scsi_read()
185 pccb->datalen = block_dev->blksz * in scsi_read()
188 scsi_setup_read_ext(pccb, start, smallblks); in scsi_read()
192 pccb->datalen = block_dev->blksz * blks; in scsi_read()
194 scsi_setup_read_ext(pccb, start, smallblks); in scsi_read()
201 if (scsi_exec(bdev, pccb)) { in scsi_read()
202 scsi_print_error(pccb); in scsi_read()
206 buf_addr += pccb->datalen; in scsi_read()
237 struct scsi_cmd *pccb = (struct scsi_cmd *)&tempccb; in scsi_write() local
240 pccb->target = block_dev->target; in scsi_write()
241 pccb->lun = block_dev->lun; in scsi_write()
248 pccb->pdata = (unsigned char *)buf_addr; in scsi_write()
250 pccb->datalen = (block_dev->blksz * in scsi_write()
253 scsi_setup_write_ext(pccb, start, smallblks); in scsi_write()
257 pccb->datalen = block_dev->blksz * blks; in scsi_write()
259 scsi_setup_write_ext(pccb, start, smallblks); in scsi_write()
265 if (scsi_exec(bdev, pccb)) { in scsi_write()
266 scsi_print_error(pccb); in scsi_write()
270 buf_addr += pccb->datalen; in scsi_write()
360 static int scsi_read_capacity(struct udevice *dev, struct scsi_cmd *pccb, in scsi_read_capacity() argument
365 memset(pccb->cmd, '\0', sizeof(pccb->cmd)); in scsi_read_capacity()
366 pccb->cmd[0] = SCSI_RD_CAPAC10; in scsi_read_capacity()
367 pccb->cmd[1] = pccb->lun << 5; in scsi_read_capacity()
368 pccb->cmdlen = 10; in scsi_read_capacity()
369 pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ in scsi_read_capacity()
371 pccb->datalen = 8; in scsi_read_capacity()
372 if (scsi_exec(dev, pccb)) in scsi_read_capacity()
375 *capacity = ((lbaint_t)pccb->pdata[0] << 24) | in scsi_read_capacity()
376 ((lbaint_t)pccb->pdata[1] << 16) | in scsi_read_capacity()
377 ((lbaint_t)pccb->pdata[2] << 8) | in scsi_read_capacity()
378 ((lbaint_t)pccb->pdata[3]); in scsi_read_capacity()
382 *blksz = ((unsigned long)pccb->pdata[4] << 24) | in scsi_read_capacity()
383 ((unsigned long)pccb->pdata[5] << 16) | in scsi_read_capacity()
384 ((unsigned long)pccb->pdata[6] << 8) | in scsi_read_capacity()
385 ((unsigned long)pccb->pdata[7]); in scsi_read_capacity()
390 memset(pccb->cmd, '\0', sizeof(pccb->cmd)); in scsi_read_capacity()
391 pccb->cmd[0] = SCSI_RD_CAPAC16; in scsi_read_capacity()
392 pccb->cmd[1] = 0x10; in scsi_read_capacity()
393 pccb->cmdlen = 16; in scsi_read_capacity()
394 pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ in scsi_read_capacity()
396 pccb->datalen = 16; in scsi_read_capacity()
397 if (scsi_exec(dev, pccb)) in scsi_read_capacity()
400 *capacity = ((uint64_t)pccb->pdata[0] << 56) | in scsi_read_capacity()
401 ((uint64_t)pccb->pdata[1] << 48) | in scsi_read_capacity()
402 ((uint64_t)pccb->pdata[2] << 40) | in scsi_read_capacity()
403 ((uint64_t)pccb->pdata[3] << 32) | in scsi_read_capacity()
404 ((uint64_t)pccb->pdata[4] << 24) | in scsi_read_capacity()
405 ((uint64_t)pccb->pdata[5] << 16) | in scsi_read_capacity()
406 ((uint64_t)pccb->pdata[6] << 8) | in scsi_read_capacity()
407 ((uint64_t)pccb->pdata[7]); in scsi_read_capacity()
409 *blksz = ((uint64_t)pccb->pdata[8] << 56) | in scsi_read_capacity()
410 ((uint64_t)pccb->pdata[9] << 48) | in scsi_read_capacity()
411 ((uint64_t)pccb->pdata[10] << 40) | in scsi_read_capacity()
412 ((uint64_t)pccb->pdata[11] << 32) | in scsi_read_capacity()
413 ((uint64_t)pccb->pdata[12] << 24) | in scsi_read_capacity()
414 ((uint64_t)pccb->pdata[13] << 16) | in scsi_read_capacity()
415 ((uint64_t)pccb->pdata[14] << 8) | in scsi_read_capacity()
416 ((uint64_t)pccb->pdata[15]); in scsi_read_capacity()
425 static void scsi_setup_test_unit_ready(struct scsi_cmd *pccb) in scsi_setup_test_unit_ready() argument
427 pccb->cmd[0] = SCSI_TST_U_RDY; in scsi_setup_test_unit_ready()
428 pccb->cmd[1] = pccb->lun << 5; in scsi_setup_test_unit_ready()
429 pccb->cmd[2] = 0; in scsi_setup_test_unit_ready()
430 pccb->cmd[3] = 0; in scsi_setup_test_unit_ready()
431 pccb->cmd[4] = 0; in scsi_setup_test_unit_ready()
432 pccb->cmd[5] = 0; in scsi_setup_test_unit_ready()
433 pccb->cmdlen = 6; in scsi_setup_test_unit_ready()
434 pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ in scsi_setup_test_unit_ready()
496 struct scsi_cmd *pccb = (struct scsi_cmd *)&tempccb; in scsi_detect_dev() local
498 pccb->target = target; in scsi_detect_dev()
499 pccb->lun = lun; in scsi_detect_dev()
500 pccb->pdata = (unsigned char *)&tempbuff; in scsi_detect_dev()
501 pccb->datalen = 512; in scsi_detect_dev()
502 scsi_setup_inquiry(pccb); in scsi_detect_dev()
503 if (scsi_exec(dev, pccb)) { in scsi_detect_dev()
504 if (pccb->contr_stat == SCSI_SEL_TIME_OUT) { in scsi_detect_dev()
510 pccb->target); in scsi_detect_dev()
513 scsi_print_error(pccb); in scsi_detect_dev()
529 dev_desc->target = pccb->target; in scsi_detect_dev()
530 dev_desc->lun = pccb->lun; in scsi_detect_dev()
532 pccb->datalen = 0; in scsi_detect_dev()
533 scsi_setup_test_unit_ready(pccb); in scsi_detect_dev()
534 if (scsi_exec(dev, pccb)) { in scsi_detect_dev()
539 scsi_print_error(pccb); in scsi_detect_dev()
542 if (scsi_read_capacity(dev, pccb, &capacity, &blksz)) { in scsi_detect_dev()
543 scsi_print_error(pccb); in scsi_detect_dev()