diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2015-01-12 21:31:07 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2015-01-12 21:31:07 +0000 |
commit | 8fbd33e17c834152922241af197880550a9c8ccc (patch) | |
tree | 77f550f2f9e031b433395f6ba2431f25349b1f59 /sys/arch/sparc/dev | |
parent | fac61600b0c9eb399c57296359628367827bac16 (diff) |
Fix two 19 years old (since day one) bug in bad144 sector reassignment logic:
- when entering bad144 mode, correctly compute the actual C/H/S values for the
logical block number.
- when leaving bad144 mode and resuming normal I/O operation, when computing
back the C/H/S values for the next logical block number, compute the
sector number correctly.
Diffstat (limited to 'sys/arch/sparc/dev')
-rw-r--r-- | sys/arch/sparc/dev/xd.c | 8 | ||||
-rw-r--r-- | sys/arch/sparc/dev/xy.c | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/sys/arch/sparc/dev/xd.c b/sys/arch/sparc/dev/xd.c index b62fe3afe4d..4f52ccdc865 100644 --- a/sys/arch/sparc/dev/xd.c +++ b/sys/arch/sparc/dev/xd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xd.c,v 1.62 2014/07/11 16:35:40 jsg Exp $ */ +/* $OpenBSD: xd.c,v 1.63 2015/01/12 21:31:06 miod Exp $ */ /* $NetBSD: xd.c,v 1.37 1997/07/29 09:58:16 fair Exp $ */ /* @@ -1879,7 +1879,7 @@ xdc_remove_iorq(xdcsc) iopb->headno = (iorq->blockno / iorq->xd->nhead) % iorq->xd->nhead; - iopb->sectno = iorq->blockno % XDFM_BPS; + iopb->sectno = iorq->blockno % iorq->xd->nsect; iopb->daddr = (u_long) iorq->dbuf - DVMA_BASE; XDC_HWAIT(xdcsc, rqno); xdc_start(xdcsc, 1); /* resubmit */ @@ -2003,8 +2003,8 @@ xdc_error(xdcsc, iorq, iopb, rqno, comm) /* second to last acyl */ i = iorq->xd->sectpercyl - 1 - i; /* follow bad144 * standard */ - iopb->headno = i / iorq->xd->nhead; - iopb->sectno = i % iorq->xd->nhead; + iopb->headno = i % iorq->xd->nhead; + iopb->sectno = i / iorq->xd->nhead; XDC_HWAIT(xdcsc, rqno); xdc_start(xdcsc, 1); /* resubmit */ return (XD_ERR_AOK); /* recovered! */ diff --git a/sys/arch/sparc/dev/xy.c b/sys/arch/sparc/dev/xy.c index 30e78981975..23a91269da3 100644 --- a/sys/arch/sparc/dev/xy.c +++ b/sys/arch/sparc/dev/xy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xy.c,v 1.59 2014/07/11 16:35:40 jsg Exp $ */ +/* $OpenBSD: xy.c,v 1.60 2015/01/12 21:31:06 miod Exp $ */ /* $NetBSD: xy.c,v 1.26 1997/07/19 21:43:56 pk Exp $ */ /* @@ -1750,11 +1750,11 @@ xyc_remove_iorq(xycsc) iopb->head = (iorq->blockno / iorq->xy->nhead) % iorq->xy->nhead; - iopb->sect = iorq->blockno % XYFM_BPS; + iopb->sect = iorq->blockno % iorq->xy->nsect; addr = (u_long) iorq->dbuf - DVMA_BASE; iopb->dataa = (addr & 0xffff); iopb->datar = ((addr & 0xff0000) >> 16); - /* will resubit at end */ + /* will resubmit at end */ continue; } } @@ -1871,8 +1871,8 @@ xyc_error(xycsc, iorq, iopb, comm) /* second to last acyl */ i = iorq->xy->sectpercyl - 1 - i; /* follow bad144 * standard */ - iopb->head = i / iorq->xy->nhead; - iopb->sect = i % iorq->xy->nhead; + iopb->head = i % iorq->xy->nhead; + iopb->sect = i / iorq->xy->nhead; /* will resubmit when we come out of remove_iorq */ return (XY_ERR_AOK); /* recovered! */ } |