summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-12-26 17:58:15 +0100
committercinap_lenrek <cinap_lenrek@gmx.de>2012-12-26 17:58:15 +0100
commit1c090cd04f94593378511df63e5c2a1710abc770 (patch)
tree04035d9836d78289ef56d6d7be559e41b17aac5c
parent4a4c8218eed10132c7e37a603575ee7d2a7e6a9f (diff)
downloadplan9front-1c090cd04f94593378511df63e5c2a1710abc770.tar.xz
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.
-rw-r--r--sys/src/9/pc/sdide.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/sys/src/9/pc/sdide.c b/sys/src/9/pc/sdide.c
index 071431aae..3d94cd77f 100644
--- a/sys/src/9/pc/sdide.c
+++ b/sys/src/9/pc/sdide.c
@@ -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(;;){