Merged from sys/isa/fd.c revision 1.180.

This commit is contained in:
KATO Takenori 2000-03-28 15:09:13 +00:00
parent ab067f0297
commit a729b39d7c
2 changed files with 24 additions and 14 deletions

View File

@ -1970,7 +1970,7 @@ static int fdcpio(fdc_p fdc, long flags, caddr_t addr, u_int count)
static int
fdstate(fdc_p fdc)
{
int read, format, head, i, sec = 0, sectrac, st0, cyl, st3;
int read, format, head, i, sec = 0, sectrac, st0, cyl, st3, idf;
unsigned blknum = 0, b_cylinder = 0;
fdu_t fdu = fdc->fdu;
fd_p fd;
@ -2007,6 +2007,10 @@ fdstate(fdc_p fdc)
if (fdc->fd && (fd != fdc->fd))
device_printf(fd->dev, "confused fd pointers\n");
read = bp->b_iocmd == BIO_READ;
if (read)
idf = ISADMA_READ;
else
idf = ISADMA_WRITE;
format = bp->b_flags & B_FORMAT;
if (format) {
finfo = (struct fd_formb *)bp->b_data;
@ -2201,7 +2205,7 @@ fdstate(fdc_p fdc)
if (fdu != nrdu) {
#endif /* EPSON_NRDISK */
if (!(fdc->flags & FDC_NODMA))
isa_dmastart(bp->b_flags, bp->b_data+fd->skip,
isa_dmastart(idf, bp->b_data+fd->skip,
format ? bp->b_bcount : fdblk, fdc->dmachan);
sectrac = fd->ft->sectrac;
sec = blknum % (sectrac * fd->ft->heads);
@ -2216,7 +2220,7 @@ fdstate(fdc_p fdc)
{
/* stuck controller? */
if (!(fdc->flags & FDC_NODMA))
isa_dmadone(bp->b_flags,
isa_dmadone(idf,
bp->b_data + fd->skip,
format ? bp->b_bcount : fdblk,
fdc->dmachan);
@ -2273,7 +2277,7 @@ fdstate(fdc_p fdc)
finfo->fd_formb_fillbyte, 0)) {
/* controller fell over */
if (!(fdc->flags & FDC_NODMA))
isa_dmadone(bp->b_flags,
isa_dmadone(idf,
bp->b_data + fd->skip,
format ? bp->b_bcount : fdblk,
fdc->dmachan);
@ -2310,7 +2314,7 @@ fdstate(fdc_p fdc)
0)) {
/* the beast is sleeping again */
if (!(fdc->flags & FDC_NODMA))
isa_dmadone(bp->b_flags,
isa_dmadone(idf,
bp->b_data + fd->skip,
format ? bp->b_bcount : fdblk,
fdc->dmachan);
@ -2384,7 +2388,7 @@ fdstate(fdc_p fdc)
if (fd_read_status(fdc, fd->fdsu)) {
if (!(fdc->flags & FDC_NODMA))
isa_dmadone(bp->b_flags, bp->b_data + fd->skip,
isa_dmadone(idf, bp->b_data + fd->skip,
format ? bp->b_bcount : fdblk,
fdc->dmachan);
if (fdc->retry < 6)
@ -2401,7 +2405,7 @@ fdstate(fdc_p fdc)
if (fdu != nrdu) {
#endif /* EPSON_NRDISK */
if (!(fdc->flags & FDC_NODMA))
isa_dmadone(bp->b_flags, bp->b_data + fd->skip,
isa_dmadone(idf, bp->b_data + fd->skip,
format ? bp->b_bcount : fdblk, fdc->dmachan);
#ifdef EPSON_NRDISK
}
@ -2654,6 +2658,7 @@ fdformat(dev, finfo, p)
BUF_LOCKINIT(bp);
BUF_LOCK(bp, LK_EXCLUSIVE);
bp->b_flags = B_PHYS | B_FORMAT;
bp->b_iocmd = BIO_WRITE;
/*
* calculate a fake blkno, so fdstrategy() would initiate a

View File

@ -1970,7 +1970,7 @@ static int fdcpio(fdc_p fdc, long flags, caddr_t addr, u_int count)
static int
fdstate(fdc_p fdc)
{
int read, format, head, i, sec = 0, sectrac, st0, cyl, st3;
int read, format, head, i, sec = 0, sectrac, st0, cyl, st3, idf;
unsigned blknum = 0, b_cylinder = 0;
fdu_t fdu = fdc->fdu;
fd_p fd;
@ -2007,6 +2007,10 @@ fdstate(fdc_p fdc)
if (fdc->fd && (fd != fdc->fd))
device_printf(fd->dev, "confused fd pointers\n");
read = bp->b_iocmd == BIO_READ;
if (read)
idf = ISADMA_READ;
else
idf = ISADMA_WRITE;
format = bp->b_flags & B_FORMAT;
if (format) {
finfo = (struct fd_formb *)bp->b_data;
@ -2201,7 +2205,7 @@ fdstate(fdc_p fdc)
if (fdu != nrdu) {
#endif /* EPSON_NRDISK */
if (!(fdc->flags & FDC_NODMA))
isa_dmastart(bp->b_flags, bp->b_data+fd->skip,
isa_dmastart(idf, bp->b_data+fd->skip,
format ? bp->b_bcount : fdblk, fdc->dmachan);
sectrac = fd->ft->sectrac;
sec = blknum % (sectrac * fd->ft->heads);
@ -2216,7 +2220,7 @@ fdstate(fdc_p fdc)
{
/* stuck controller? */
if (!(fdc->flags & FDC_NODMA))
isa_dmadone(bp->b_flags,
isa_dmadone(idf,
bp->b_data + fd->skip,
format ? bp->b_bcount : fdblk,
fdc->dmachan);
@ -2273,7 +2277,7 @@ fdstate(fdc_p fdc)
finfo->fd_formb_fillbyte, 0)) {
/* controller fell over */
if (!(fdc->flags & FDC_NODMA))
isa_dmadone(bp->b_flags,
isa_dmadone(idf,
bp->b_data + fd->skip,
format ? bp->b_bcount : fdblk,
fdc->dmachan);
@ -2310,7 +2314,7 @@ fdstate(fdc_p fdc)
0)) {
/* the beast is sleeping again */
if (!(fdc->flags & FDC_NODMA))
isa_dmadone(bp->b_flags,
isa_dmadone(idf,
bp->b_data + fd->skip,
format ? bp->b_bcount : fdblk,
fdc->dmachan);
@ -2384,7 +2388,7 @@ fdstate(fdc_p fdc)
if (fd_read_status(fdc, fd->fdsu)) {
if (!(fdc->flags & FDC_NODMA))
isa_dmadone(bp->b_flags, bp->b_data + fd->skip,
isa_dmadone(idf, bp->b_data + fd->skip,
format ? bp->b_bcount : fdblk,
fdc->dmachan);
if (fdc->retry < 6)
@ -2401,7 +2405,7 @@ fdstate(fdc_p fdc)
if (fdu != nrdu) {
#endif /* EPSON_NRDISK */
if (!(fdc->flags & FDC_NODMA))
isa_dmadone(bp->b_flags, bp->b_data + fd->skip,
isa_dmadone(idf, bp->b_data + fd->skip,
format ? bp->b_bcount : fdblk, fdc->dmachan);
#ifdef EPSON_NRDISK
}
@ -2654,6 +2658,7 @@ fdformat(dev, finfo, p)
BUF_LOCKINIT(bp);
BUF_LOCK(bp, LK_EXCLUSIVE);
bp->b_flags = B_PHYS | B_FORMAT;
bp->b_iocmd = BIO_WRITE;
/*
* calculate a fake blkno, so fdstrategy() would initiate a