sdide: packet io byte count.
instead of setting the packet io byte count to some bullshit value, use the dlen from the scsi request. limit transfer byte count to 32k for atapi.
This commit is contained in:
parent
4a4c8218ee
commit
1c090cd04f
1 changed files with 9 additions and 15 deletions
|
@ -1066,7 +1066,7 @@ static int
|
|||
atapktio0(Drive *drive, SDreq *r)
|
||||
{
|
||||
uchar *cmd;
|
||||
int as, cmdport, ctlport, len, rv;
|
||||
int as, cmdport, ctlport, rv;
|
||||
Ctlr *ctlr;
|
||||
|
||||
rv = SDok;
|
||||
|
@ -1074,6 +1074,8 @@ atapktio0(Drive *drive, SDreq *r)
|
|||
drive->command = Cpkt;
|
||||
memmove(drive->pktcmd, cmd, r->clen);
|
||||
memset(drive->pktcmd+r->clen, 0, drive->pkt-r->clen);
|
||||
if(drive->dlen > 0x8000)
|
||||
drive->dlen = 0x8000;
|
||||
drive->limit = drive->data+drive->dlen;
|
||||
|
||||
ctlr = drive->ctlr;
|
||||
|
@ -1086,21 +1088,15 @@ atapktio0(Drive *drive, SDreq *r)
|
|||
return SDnostatus;
|
||||
|
||||
ilock(ctlr);
|
||||
if(drive->dlen && drive->dmactl && !atadmasetup(drive, drive->dlen)){
|
||||
if(drive->dlen && drive->dmactl && !atadmasetup(drive, drive->dlen))
|
||||
drive->pktdma = Dma;
|
||||
len = 0; /* bytecount should be 0 for dma */
|
||||
}else{
|
||||
else
|
||||
drive->pktdma = 0;
|
||||
if(drive->secsize)
|
||||
len = 16*drive->secsize;
|
||||
else
|
||||
len = 0x8000;
|
||||
}
|
||||
outb(cmdport+Features, drive->pktdma);
|
||||
outb(cmdport+Count, 0);
|
||||
outb(cmdport+Sector, 0);
|
||||
outb(cmdport+Bytelo, len);
|
||||
outb(cmdport+Bytehi, len>>8);
|
||||
outb(cmdport+Bytelo, drive->dlen);
|
||||
outb(cmdport+Bytehi, drive->dlen>>8);
|
||||
outb(cmdport+Dh, drive->dev);
|
||||
ctlr->done = 0;
|
||||
ctlr->curdrive = drive;
|
||||
|
@ -1374,10 +1370,8 @@ atario(SDreq* r)
|
|||
SDunit *unit;
|
||||
|
||||
unit = r->unit;
|
||||
if((ctlr = unit->dev->ctlr) == nil || ctlr->drive[unit->subno] == nil){
|
||||
r->status = SDtimeout;
|
||||
return SDtimeout;
|
||||
}
|
||||
if((ctlr = unit->dev->ctlr) == nil || ctlr->drive[unit->subno] == nil)
|
||||
return r->status = SDtimeout;
|
||||
drive = ctlr->drive[unit->subno];
|
||||
qlock(drive);
|
||||
for(;;){
|
||||
|
|
Loading…
Reference in a new issue