sdide: make ataidentify wait longer if theres no floating bus
This commit is contained in:
parent
1d96a8256e
commit
e294bcae53
1 changed files with 16 additions and 3 deletions
|
@ -549,7 +549,7 @@ atadmamode(SDunit *unit, Drive* drive)
|
||||||
static int
|
static int
|
||||||
ataidentify(Ctlr*, int cmdport, int ctlport, int dev, int pkt, void* info)
|
ataidentify(Ctlr*, int cmdport, int ctlport, int dev, int pkt, void* info)
|
||||||
{
|
{
|
||||||
int as, command, drdy;
|
int as, command, drdy, rlo, rhi;
|
||||||
|
|
||||||
if(pkt){
|
if(pkt){
|
||||||
command = Cidpkt;
|
command = Cidpkt;
|
||||||
|
@ -561,8 +561,21 @@ ataidentify(Ctlr*, int cmdport, int ctlport, int dev, int pkt, void* info)
|
||||||
}
|
}
|
||||||
dev &= ~Lba;
|
dev &= ~Lba;
|
||||||
as = ataready(cmdport, ctlport, dev, Bsy|Drq, drdy, 103*1000);
|
as = ataready(cmdport, ctlport, dev, Bsy|Drq, drdy, 103*1000);
|
||||||
if(as < 0)
|
if(as < 0){
|
||||||
return as;
|
/* try to detect floating bus */
|
||||||
|
outb(cmdport+Cyllo, 0xAA);
|
||||||
|
outb(cmdport+Cylhi, 0x55);
|
||||||
|
outb(cmdport+Sector, 0xFF);
|
||||||
|
rlo = inb(cmdport+Cyllo);
|
||||||
|
rhi = inb(cmdport+Cylhi);
|
||||||
|
if(rlo != 0xAA && (rlo == 0xFF || rhi != 0x55))
|
||||||
|
return as;
|
||||||
|
|
||||||
|
/* theres a device, try waiting some more */
|
||||||
|
as = ataready(cmdport, ctlport, dev, Bsy|Drq, drdy, 6*1000*1000);
|
||||||
|
if(as < 0)
|
||||||
|
return as;
|
||||||
|
}
|
||||||
outb(cmdport+Command, command);
|
outb(cmdport+Command, command);
|
||||||
microdelay(1);
|
microdelay(1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue