Date: Thu, 16 Mar 2017 21:34:14 +0000 (UTC) From: Toomas Soome <tsoome@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315427 - head/sys/boot/i386/libi386 Message-ID: <201703162134.v2GLYEZ6055359@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tsoome Date: Thu Mar 16 21:34:14 2017 New Revision: 315427 URL: https://svnweb.freebsd.org/changeset/base/315427 Log: loader: biosdisk should report IO error from INT13 We should be more verbose about read errors from biosdisk, except filter out the floppy controller errors, which apparently are resulting from read attempt from device without the media present. Reviewed by: allanjude Approved by: allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D10032 Modified: head/sys/boot/i386/libi386/biosdisk.c Modified: head/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- head/sys/boot/i386/libi386/biosdisk.c Thu Mar 16 21:32:05 2017 (r315426) +++ head/sys/boot/i386/libi386/biosdisk.c Thu Mar 16 21:34:14 2017 (r315427) @@ -559,7 +559,7 @@ bd_realstrategy(void *devdata, int rw, d { struct disk_devdesc *dev = (struct disk_devdesc *)devdata; uint64_t disk_blocks; - int blks; + int blks, rc; #ifdef BD_SUPPORT_FRAGS /* XXX: sector size */ char fragbuf[BIOSDISK_SECSIZE]; size_t fragsize; @@ -616,8 +616,12 @@ bd_realstrategy(void *devdata, int rw, d 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))) { + /* Filter out floppy controller errors */ + if (BD(dev).bd_flags != BD_FLOPPY || rc != 0x20) { + printf("read %d from %lld to %p, error: 0x%x", blks, dblk, + buf, rc); + } return (EIO); } #ifdef BD_SUPPORT_FRAGS /* XXX: sector size */ @@ -676,7 +680,9 @@ bd_edd_io(struct disk_devdesc *dev, dadd 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 @@ -710,7 +716,9 @@ bd_chs_io(struct disk_devdesc *dev, dadd 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 @@ -797,7 +805,7 @@ bd_io(struct disk_devdesc *dev, daddr_t 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 (!write && bbuf != NULL) bcopy(bbuf, p, x * BD(dev).bd_sectorsize);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703162134.v2GLYEZ6055359>