mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-02 10:43:57 +08:00
aha1542: Merge aha1542_host_reset and aha1542_bus_reset
aha1542_host_reset and aha1542_bus_reset are almost same, merge them into aha1542_reset Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
This commit is contained in:
parent
dfd7c991f3
commit
8537cba8b6
@ -1070,7 +1070,7 @@ static int aha1542_dev_reset(Scsi_Cmnd * SCpnt)
|
|||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int aha1542_bus_reset(Scsi_Cmnd * SCpnt)
|
static int aha1542_reset(Scsi_Cmnd *SCpnt, u8 reset_cmd)
|
||||||
{
|
{
|
||||||
struct aha1542_hostdata *aha1542 = shost_priv(SCpnt->device->host);
|
struct aha1542_hostdata *aha1542 = shost_priv(SCpnt->device->host);
|
||||||
int i;
|
int i;
|
||||||
@ -1081,71 +1081,7 @@ static int aha1542_bus_reset(Scsi_Cmnd * SCpnt)
|
|||||||
* we do this? Try this first, and we can add that later
|
* we do this? Try this first, and we can add that later
|
||||||
* if it turns out to be useful.
|
* if it turns out to be useful.
|
||||||
*/
|
*/
|
||||||
outb(SCRST, CONTROL(SCpnt->device->host->io_port));
|
outb(reset_cmd, CONTROL(SCpnt->device->host->io_port));
|
||||||
|
|
||||||
/*
|
|
||||||
* Wait for the thing to settle down a bit. Unfortunately
|
|
||||||
* this is going to basically lock up the machine while we
|
|
||||||
* wait for this to complete. To be 100% correct, we need to
|
|
||||||
* check for timeout, and if we are doing something like this
|
|
||||||
* we are pretty desperate anyways.
|
|
||||||
*/
|
|
||||||
ssleep(4);
|
|
||||||
|
|
||||||
spin_lock_irq(SCpnt->device->host->host_lock);
|
|
||||||
|
|
||||||
if (!wait_mask(STATUS(SCpnt->device->host->io_port),
|
|
||||||
STATMASK, INIT | IDLE, STST | DIAGF | INVDCMD | DF | CDF, 0)) {
|
|
||||||
spin_unlock_irq(SCpnt->device->host->host_lock);
|
|
||||||
return FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Now try to pick up the pieces. For all pending commands,
|
|
||||||
* free any internal data structures, and basically clear things
|
|
||||||
* out. We do not try and restart any commands or anything -
|
|
||||||
* the strategy handler takes care of that crap.
|
|
||||||
*/
|
|
||||||
printk(KERN_WARNING "Sent BUS RESET to scsi host %d\n", SCpnt->device->host->host_no);
|
|
||||||
|
|
||||||
for (i = 0; i < AHA1542_MAILBOXES; i++) {
|
|
||||||
if (aha1542->SCint[i] != NULL) {
|
|
||||||
Scsi_Cmnd *SCtmp;
|
|
||||||
SCtmp = aha1542->SCint[i];
|
|
||||||
|
|
||||||
|
|
||||||
if (SCtmp->device->soft_reset) {
|
|
||||||
/*
|
|
||||||
* If this device implements the soft reset option,
|
|
||||||
* then it is still holding onto the command, and
|
|
||||||
* may yet complete it. In this case, we don't
|
|
||||||
* flush the data.
|
|
||||||
*/
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
kfree(SCtmp->host_scribble);
|
|
||||||
SCtmp->host_scribble = NULL;
|
|
||||||
aha1542->SCint[i] = NULL;
|
|
||||||
aha1542->mb[i].status = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
spin_unlock_irq(SCpnt->device->host->host_lock);
|
|
||||||
return SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int aha1542_host_reset(Scsi_Cmnd * SCpnt)
|
|
||||||
{
|
|
||||||
struct aha1542_hostdata *aha1542 = shost_priv(SCpnt->device->host);
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This does a scsi reset for all devices on the bus.
|
|
||||||
* In principle, we could also reset the 1542 - should
|
|
||||||
* we do this? Try this first, and we can add that later
|
|
||||||
* if it turns out to be useful.
|
|
||||||
*/
|
|
||||||
outb(HRST | SCRST, CONTROL(SCpnt->device->host->io_port));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wait for the thing to settle down a bit. Unfortunately
|
* Wait for the thing to settle down a bit. Unfortunately
|
||||||
@ -1164,10 +1100,10 @@ static int aha1542_host_reset(Scsi_Cmnd * SCpnt)
|
|||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* We need to do this too before the 1542 can interact with
|
* We need to do this too before the 1542 can interact with
|
||||||
* us again.
|
* us again after host reset.
|
||||||
*/
|
*/
|
||||||
|
if (reset_cmd & HRST)
|
||||||
setup_mailboxes(SCpnt->device->host->io_port, SCpnt->device->host);
|
setup_mailboxes(SCpnt->device->host->io_port, SCpnt->device->host);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now try to pick up the pieces. For all pending commands,
|
* Now try to pick up the pieces. For all pending commands,
|
||||||
* free any internal data structures, and basically clear things
|
* free any internal data structures, and basically clear things
|
||||||
@ -1201,6 +1137,16 @@ static int aha1542_host_reset(Scsi_Cmnd * SCpnt)
|
|||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int aha1542_bus_reset(Scsi_Cmnd *SCpnt)
|
||||||
|
{
|
||||||
|
return aha1542_reset(SCpnt, SCRST);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int aha1542_host_reset(Scsi_Cmnd *SCpnt)
|
||||||
|
{
|
||||||
|
return aha1542_reset(SCpnt, HRST | SCRST);
|
||||||
|
}
|
||||||
|
|
||||||
static int aha1542_biosparam(struct scsi_device *sdev,
|
static int aha1542_biosparam(struct scsi_device *sdev,
|
||||||
struct block_device *bdev, sector_t capacity, int *ip)
|
struct block_device *bdev, sector_t capacity, int *ip)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user