summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2016-11-18 15:52:51 +0100
committerMichal Simek <michal.simek@xilinx.com>2016-12-02 14:37:21 +0100
commit4dbee176f80e98f4925c7e67e7bb42f896f8798e (patch)
tree81982178c7c4c7c0aa2d7da49e64e5de4643331c /common
parent570712f4bcc40df9a24f5e90d66d63f37959b13a (diff)
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>
Diffstat (limited to 'common')
-rw-r--r--common/scsi.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/common/scsi.c b/common/scsi.c
index 89926e7a68a..e8f102a8a4b 100644
--- a/common/scsi.c
+++ b/common/scsi.c
@@ -485,20 +485,19 @@ static void scsi_init_dev_desc(struct blk_desc *dev_desc, int devnum)
*
* @pccb: pointer to temporary SCSI command block
* @dev_desc: block device description
- * @lun: Logical unit number
*
* 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
*/
-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;
lbaint_t capacity;
unsigned long blksz;
- pccb->lun = lun;
+ pccb->lun = dev_desc->lun;
pccb->pdata = (unsigned char *)&tempbuff;
pccb->datalen = 512;
scsi_setup_inquiry(pccb);
@@ -573,9 +572,9 @@ void scsi_scan(int mode)
for (i = 0; i < CONFIG_SYS_SCSI_MAX_SCSI_ID; i++) {
pccb->target = i;
for (lun = 0; lun < CONFIG_SYS_SCSI_MAX_LUN; lun++) {
+ scsi_dev_desc[scsi_max_devs].lun = lun;
ret = scsi_detect_dev(pccb,
- &scsi_dev_desc[scsi_max_devs],
- lun);
+ &scsi_dev_desc[scsi_max_devs]);
if (ret)
continue;