--- Net2/arch/i386/stand/fd.c 2018/04/24 18:04:01 1.1 +++ Net2/arch/i386/stand/fd.c 2018/04/24 18:05:12 1.1.1.2 @@ -40,8 +40,7 @@ /* standalone fd driver */ /****************************************************************************/ #include "param.h" -#include "dkbad.h" -#include "i386/isa/disk.h" +#include "disklabel.h" #include "i386/isa/fdreg.h" #include "i386/isa/isa.h" #include "saio.h" @@ -53,6 +52,8 @@ #define FDBLK 512 #define NUMTYPES 4 +extern struct disklabel disklabel; + struct fd_type { int sectrac; /* sectors per track */ int secsize; /* size code for sectors */ @@ -108,9 +109,9 @@ printf("fdstrat "); */ iosize = io->i_cc / FDBLK; blknum = (unsigned long) io->i_bn * DEV_BSIZE / FDBLK; - nblocks = fd_types[fd_type].size; + nblocks = disklabel.d_secperunit; if ((blknum + iosize > nblocks) || blknum < 0) { -#ifndef SMALL +#ifdef SMALL printf("bn = %d; sectors = %d; type = %d; fssize = %d ", blknum, iosize, fd_type, nblocks); printf("fdstrategy - I/O out of filesystem boundaries\n"); @@ -120,6 +121,7 @@ printf("fdstrat "); address = io->i_ma; while (iosize > 0) { +/*printf("iosize %d ", iosize);*/ if (fdio(func, unit, blknum, address)) return(-1); iosize--; @@ -137,13 +139,11 @@ char *address; int i,j,cyl,sectrac,sec,head,numretry; struct fd_type *ft; +/*printf("fdio ");*/ ft = &fd_types[fd_type]; -#ifdef FDDEBUG -printf("fdio "); -#endif - sectrac = ft->sectrac; - cyl = blknum / (2 * sectrac); + sectrac = disklabel.d_nsectors; + cyl = blknum / disklabel.d_secpercyl; numretry = NUMRETRY; if (func == F_WRITE) bcopy(address,bounce,FDBLK); @@ -160,7 +160,7 @@ retry: if (!(i&0x20) || (cyl != j)) { numretry--; if (numretry) goto retry; -#ifndef SMALL +#ifdef SMALL printf("Seek error %d, req = %d, at = %d\n",i,cyl,j); printf("unit %d, type %d, sectrac %d, blknum %d\n", unit,fd_type,sectrac,blknum); @@ -170,7 +170,7 @@ retry: /* set up transfer */ fd_dma(func == F_READ, bounce, FDBLK); - sec = blknum % (sectrac * 2); + sec = blknum % disklabel.d_secpercyl; head = sec / sectrac; sec = sec % sectrac + 1; #ifdef FDDEBUG @@ -195,12 +195,12 @@ retry: } if (fd_status[0]&0xF8) { numretry--; - if (numretry) goto retry; -#ifndef SMALL +#ifdef SMALL printf("FD err %lx %lx %lx %lx %lx %lx %lx\n", fd_status[0], fd_status[1], fd_status[2], fd_status[3], fd_status[4], fd_status[5], fd_status[6] ); #endif + if (numretry) goto retry; return -1; } if (func == F_READ) bcopy(bounce,address,FDBLK);