From owner-svn-src-head@freebsd.org Thu Mar 16 21:34:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C20EAD0F0ED; Thu, 16 Mar 2017 21:34:15 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 794FC111A; Thu, 16 Mar 2017 21:34:15 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2GLYEqj055360; Thu, 16 Mar 2017 21:34:14 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2GLYEZ6055359; Thu, 16 Mar 2017 21:34:14 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201703162134.v2GLYEZ6055359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 16 Mar 2017 21:34:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315427 - head/sys/boot/i386/libi386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Mar 2017 21:34:15 -0000 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);