From owner-svn-src-stable@freebsd.org Thu Apr 5 00:41:34 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21EC0F83F92; Thu, 5 Apr 2018 00:41:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BA6577CCD1; Thu, 5 Apr 2018 00:41:33 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B54B51B434; Thu, 5 Apr 2018 00:41:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w350fX9C009885; Thu, 5 Apr 2018 00:41:33 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w350fXF1009884; Thu, 5 Apr 2018 00:41:33 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804050041.w350fXF1009884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 5 Apr 2018 00:41:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r332056 - stable/11/stand/i386/libi386 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/stand/i386/libi386 X-SVN-Commit-Revision: 332056 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2018 00:41:34 -0000 Author: kevans Date: Thu Apr 5 00:41:33 2018 New Revision: 332056 URL: https://svnweb.freebsd.org/changeset/base/332056 Log: MFC r331718: stand: Add workaround for HP BIOS issues hrs@ and kuriyama@ have found that on some HP BIOS, a system will fail to boot immediately after installation with the claim that it can't work out which disk they are booting from. They tracked it down to a buffer overrun, and found that it could be alleviated by doing a dummy read before-hand. Modified: stable/11/stand/i386/libi386/biosdisk.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/i386/libi386/biosdisk.c ============================================================================== --- stable/11/stand/i386/libi386/biosdisk.c Thu Apr 5 00:32:01 2018 (r332055) +++ stable/11/stand/i386/libi386/biosdisk.c Thu Apr 5 00:41:33 2018 (r332056) @@ -122,6 +122,8 @@ static int nbdinfo = 0; #define BD(dev) (bdinfo[(dev)->d_unit]) +static void bd_io_workaround(struct disk_devdesc *dev); + static int bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest); static int bd_write(struct disk_devdesc *dev, daddr_t dblk, int blks, @@ -726,6 +728,15 @@ bd_chs_io(struct disk_devdesc *dev, daddr_t dblk, int return (0); } +static void +bd_io_workaround(struct disk_devdesc *dev) +{ + uint8_t buf[8 * 1024]; + + bd_edd_io(dev, 0xffffffff, 1, (caddr_t)buf, 0); +} + + static int bd_io(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest, int write) { @@ -738,6 +749,17 @@ bd_io(struct disk_devdesc *dev, daddr_t dblk, int blks resid = blks; p = dest; + + /* + * Workaround for a problem with some HP ProLiant BIOS failing to work out + * the boot disk after installation. hrs and kuriyama discovered this + * problem with an HP ProLiant DL320e Gen 8 with a 3TB HDD, and discovered + * that an int13h call seems to cause a buffer overrun in the bios. The + * problem is alleviated by doing an extra read before the buggy read. It + * is not immediately known whether other models are similarly affected. + */ + if (dblk >= 0x100000000) + bd_io_workaround(dev); /* Decide whether we have to bounce */ if (VTOP(dest) >> 20 != 0 || (BD(dev).bd_unit < 0x80 &&