scsi: Take lun from device block description
Prepare LUN(Logical unit number) directly in block description structure and reuse it. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
570712f4bc
commit
4dbee176f8
|
@ -485,20 +485,19 @@ static void scsi_init_dev_desc(struct blk_desc *dev_desc, int devnum)
|
||||||
*
|
*
|
||||||
* @pccb: pointer to temporary SCSI command block
|
* @pccb: pointer to temporary SCSI command block
|
||||||
* @dev_desc: block device description
|
* @dev_desc: block device description
|
||||||
* @lun: Logical unit number
|
|
||||||
*
|
*
|
||||||
* The scsi_detect_dev detects and fills a dev_desc structure when the device is
|
* The scsi_detect_dev detects and fills a dev_desc structure when the device is
|
||||||
* detected.
|
* detected. The LUN number is taken from the struct blk_desc *dev_desc.
|
||||||
*
|
*
|
||||||
* Return: 0 on success, error value otherwise
|
* Return: 0 on success, error value otherwise
|
||||||
*/
|
*/
|
||||||
static int scsi_detect_dev(ccb *pccb, struct blk_desc *dev_desc, int lun)
|
static int scsi_detect_dev(ccb *pccb, struct blk_desc *dev_desc)
|
||||||
{
|
{
|
||||||
unsigned char perq, modi;
|
unsigned char perq, modi;
|
||||||
lbaint_t capacity;
|
lbaint_t capacity;
|
||||||
unsigned long blksz;
|
unsigned long blksz;
|
||||||
|
|
||||||
pccb->lun = lun;
|
pccb->lun = dev_desc->lun;
|
||||||
pccb->pdata = (unsigned char *)&tempbuff;
|
pccb->pdata = (unsigned char *)&tempbuff;
|
||||||
pccb->datalen = 512;
|
pccb->datalen = 512;
|
||||||
scsi_setup_inquiry(pccb);
|
scsi_setup_inquiry(pccb);
|
||||||
|
@ -573,9 +572,9 @@ void scsi_scan(int mode)
|
||||||
for (i = 0; i < CONFIG_SYS_SCSI_MAX_SCSI_ID; i++) {
|
for (i = 0; i < CONFIG_SYS_SCSI_MAX_SCSI_ID; i++) {
|
||||||
pccb->target = i;
|
pccb->target = i;
|
||||||
for (lun = 0; lun < CONFIG_SYS_SCSI_MAX_LUN; lun++) {
|
for (lun = 0; lun < CONFIG_SYS_SCSI_MAX_LUN; lun++) {
|
||||||
|
scsi_dev_desc[scsi_max_devs].lun = lun;
|
||||||
ret = scsi_detect_dev(pccb,
|
ret = scsi_detect_dev(pccb,
|
||||||
&scsi_dev_desc[scsi_max_devs],
|
&scsi_dev_desc[scsi_max_devs]);
|
||||||
lun);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue