提交 bccfd9e9 编写于 作者: M Michal Simek

scsi: Move pccb buffer initalization directly to scsi_detect_dev

pccb is pointer to temporary buffer which is used only for sending
command. Make it local as is done in scsi_read/scsi_write.
Signed-off-by: NMichal Simek <michal.simek@xilinx.com>
Reviewed-by: NSimon Glass <sjg@chromium.org>
上级 4dbee176
...@@ -480,10 +480,11 @@ static void scsi_init_dev_desc(struct blk_desc *dev_desc, int devnum) ...@@ -480,10 +480,11 @@ static void scsi_init_dev_desc(struct blk_desc *dev_desc, int devnum)
#endif #endif
} }
/** /**
* scsi_detect_dev - Detect scsi device * scsi_detect_dev - Detect scsi device
* *
* @pccb: pointer to temporary SCSI command block * @target: target id
* @dev_desc: block device description * @dev_desc: block device description
* *
* 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
...@@ -491,12 +492,14 @@ static void scsi_init_dev_desc(struct blk_desc *dev_desc, int devnum) ...@@ -491,12 +492,14 @@ static void scsi_init_dev_desc(struct blk_desc *dev_desc, int devnum)
* *
* 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) static int scsi_detect_dev(int target, 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;
ccb *pccb = (ccb *)&tempccb;
pccb->target = target;
pccb->lun = dev_desc->lun; pccb->lun = dev_desc->lun;
pccb->pdata = (unsigned char *)&tempbuff; pccb->pdata = (unsigned char *)&tempbuff;
pccb->datalen = 512; pccb->datalen = 512;
...@@ -561,7 +564,6 @@ void scsi_scan(int mode) ...@@ -561,7 +564,6 @@ void scsi_scan(int mode)
{ {
unsigned char i, lun; unsigned char i, lun;
int ret; int ret;
ccb *pccb = (ccb *)&tempccb;
if (mode == 1) if (mode == 1)
printf("scanning bus for devices...\n"); printf("scanning bus for devices...\n");
...@@ -570,11 +572,9 @@ void scsi_scan(int mode) ...@@ -570,11 +572,9 @@ void scsi_scan(int mode)
scsi_max_devs = 0; scsi_max_devs = 0;
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;
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; scsi_dev_desc[scsi_max_devs].lun = lun;
ret = scsi_detect_dev(pccb, ret = scsi_detect_dev(i, &scsi_dev_desc[scsi_max_devs]);
&scsi_dev_desc[scsi_max_devs]);
if (ret) if (ret)
continue; continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册