> term% cat /dev/sdE0/ctl
> inquiry ST3300831AS
> config 0C5A capabilities 2F00 dma 00550020 dmactl 00000000 rwm 16
> rwmctl 0 lba48always off
> geometry 586072368 512 16383 16 63
> part data 0 586072368
> part plan9 63 293025600
> part plan9.1 293041665 586067265
> term% dd -if /dev/sdE0/plan9 -of /dev/sdE0/plan9.1 -bs 8192 -iseek 16777211
> read: i/o error

i think i see the problem.  we're off by one bit.

in your case, i calculate h = 0xf.  but since the head shares bits
with the device, there just isn't enough room for a head > 7.  i think you
can fix this problem by

(a) setting lba48always on
        ; echo llba48always on>/dev/sd??/ctl
if this doesn't work, then i'm wrong.

(b) (the proper fix). apply this change to sdata

/n/sources/plan9//sys/src/9/pc/sdata.c:1344,1350 - sdata.c:1344,1350
  };
  
  static int
- atageniostart(Drive* drive, vlong lba)
+ atageniostart(Drive* drive, uvlong lba)
  {
        Ctlr *ctlr;
        uchar cmd;
/n/sources/plan9//sys/src/9/pc/sdata.c:1351,1357 - sdata.c:1351,1357
        int as, c, cmdport, ctlport, h, len, s, use48;
  
        use48 = 0;
-       if((drive->flags&Lba48always) || (lba>>28) || drive->count > 256){
+       if((drive->flags&Lba48always) || (lba>>27) || drive->count > 256){
                if(!(drive->flags & Lba48))
                        return -1;
                use48 = 1;
/n/sources/plan9//sys/src/9/pc/sdata.c:1359,1365 - sdata.c:1359,1365
        }
        else if(drive->dev & Lba){
                c = (lba>>8) & 0xFFFF;
-               h = (lba>>24) & 0x0F;
+               h = (lba>>24) & 7;      /* tautology */
                s = lba & 0xFF;
        }

there's also a problem with disk > 2GB.  but that's not your problem.

- erik


Reply via email to