summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2017-02-22 13:31:00 +0200
committerDan McDonald <danmcd@omniti.com>2017-02-27 08:33:10 -0500
commit2e52d653fff46539bd331c34c8027343cafa1ee0 (patch)
tree000a6e8f7b26d857744ca4175aa24d5cbb345d3b
parentbde4412094f34e2e3709f5b142e28975ef437670 (diff)
downloadillumos-joyent-2e52d653fff46539bd331c34c8027343cafa1ee0.tar.gz
7906 loader: biosdisk should report IO error from INT13
Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Marcel Telka <marcel@telka.sk> Approved by: Dan McDonald <danmcd@omniti.com>
-rw-r--r--usr/src/boot/sys/boot/i386/libi386/biosdisk.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c
index 925e262705..78997fb5cf 100644
--- a/usr/src/boot/sys/boot/i386/libi386/biosdisk.c
+++ b/usr/src/boot/sys/boot/i386/libi386/biosdisk.c
@@ -448,8 +448,8 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
char *buf, size_t *rsize)
{
struct disk_devdesc *dev = (struct disk_devdesc *)devdata;
- off_t disk_blocks;
- int blks;
+ uint64_t disk_blocks;
+ int blks, rc;
#ifdef BD_SUPPORT_FRAGS /* XXX: sector size */
char fragbuf[BIOSDISK_SECSIZE];
size_t fragsize;
@@ -506,8 +506,8 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
case F_READ:
DEBUG("read %d from %lld to %p", blks, dblk, buf);
- if (blks && bd_read(dev, dblk, blks, buf)) {
- DEBUG("read error");
+ if (blks && (rc = bd_read(dev, dblk, blks, buf))) {
+ printf("read %d from %lld to %p, error: 0x%x", blks, dblk, buf, rc);
return (EIO);
}
#ifdef BD_SUPPORT_FRAGS /* XXX: sector size */
@@ -566,7 +566,9 @@ bd_edd_io(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest,
v86.ds = VTOPSEG(&packet);
v86.esi = VTOPOFF(&packet);
v86int();
- return (V86_CY(v86.efl));
+ if (V86_CY(v86.efl))
+ return (v86.eax >> 8);
+ return (0);
}
static int
@@ -600,7 +602,9 @@ bd_chs_io(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest,
v86.es = VTOPSEG(dest);
v86.ebx = VTOPOFF(dest);
v86int();
- return (V86_CY(v86.efl));
+ if (V86_CY(v86.efl))
+ return (v86.eax >> 8);
+ return (0);
}
static int
@@ -690,7 +694,7 @@ bd_io(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest,
DEBUG("Read %d sector(s) from %lld to %p (0x%x) %s", x,
dblk, p, VTOP(p), result ? "failed" : "ok");
if (result) {
- return(-1);
+ return(result);
}
if (!dowrite && bbuf != NULL)
bcopy(bbuf, p, x * BD(dev).bd_sectorsize);