From owner-svn-src-head@FreeBSD.ORG Tue Jul 15 00:27:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A6823FED; Tue, 15 Jul 2014 00:27:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 93F302413; Tue, 15 Jul 2014 00:27:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6F0R8P5092214; Tue, 15 Jul 2014 00:27:08 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6F0R83v092213; Tue, 15 Jul 2014 00:27:08 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201407150027.s6F0R83v092213@svn.freebsd.org> From: Peter Grehan Date: Tue, 15 Jul 2014 00:27:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r268639 - head/usr.sbin/bhyve 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.18 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: Tue, 15 Jul 2014 00:27:08 -0000 Author: grehan Date: Tue Jul 15 00:27:08 2014 New Revision: 268639 URL: http://svnweb.freebsd.org/changeset/base/268639 Log: Use the blockif CHS routine to create fake CHS values, and then populate them in the identity page. This fixes a divide-by-zero error at probe time with NetBSD. MFC after: 1 week. Modified: head/usr.sbin/bhyve/pci_ahci.c Modified: head/usr.sbin/bhyve/pci_ahci.c ============================================================================== --- head/usr.sbin/bhyve/pci_ahci.c Tue Jul 15 00:25:54 2014 (r268638) +++ head/usr.sbin/bhyve/pci_ahci.c Tue Jul 15 00:27:08 2014 (r268639) @@ -598,10 +598,16 @@ handle_identify(struct ahci_port *p, int } else { uint16_t buf[256]; uint64_t sectors; + uint16_t cyl; + uint8_t sech, heads; sectors = blockif_size(p->bctx) / blockif_sectsz(p->bctx); + blockif_chs(p->bctx, &cyl, &heads, &sech); memset(buf, 0, sizeof(buf)); buf[0] = 0x0040; + buf[1] = cyl; + buf[3] = heads; + buf[6] = sech; /* TODO emulate different serial? */ ata_string((uint8_t *)(buf+10), "123456", 20); ata_string((uint8_t *)(buf+23), "001", 8);