From nobody Tue Nov 11 05:12:59 2025 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1560936295; cv=none; d=zoho.com; s=zohoarc; b=cYK50Qo2WnEYfXJJJB/O2I6eIdu1dHeS2/pA28qfPiJSzzL8VSuqU1vuYQEYyX+DNPRpElqw1jrsx2Qlo9uXZW1tO3ZbFCALtbLO3aO0p5bJCLIm9w8bLy+uT7hAJxsH4vRwyW8G5SEPC7hK4oG7Rkk2usoZf9dajkVbbPOILnw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560936295; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=2FUB3mtIzc8EFz3xgMqq82pXMKBRDAXsoE51n+eD+ME=; b=fpQTmnoEcmDjPN2XLkTXUOv7mUsVCrRkzHXdzk3oygJC1wvYFImJkAosW3kY/+PLAmmOt0j6iySZ6rviaJq2tCc1TPBgpQ7OlaFQWMHE9hezJ2PipG6C+unP0NoPqjFbUJ/XCTOy5x0HbnxsxoCfm+LIHBQ/mNYXza2JZ+MxGFc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1560936295947166.66750588446644; Wed, 19 Jun 2019 02:24:55 -0700 (PDT) Received: from [192.168.203.99] (mailu_mailman-core_1.mailu_default [192.168.203.99]) by coreboot.org (Postfix) with ESMTP id 5A651BA3AD8; Wed, 19 Jun 2019 09:24:49 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by coreboot.org (Postfix) with ESMTP id C772EBA3AD1 for ; Wed, 19 Jun 2019 09:24:40 +0000 (UTC) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5J9O9OA078119; Wed, 19 Jun 2019 09:24:09 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 2t7809a81d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2019 09:24:09 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5J9NDfo114792; Wed, 19 Jun 2019 09:24:09 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 2t77yn7rt7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2019 09:24:09 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5J9O8OU008584; Wed, 19 Jun 2019 09:24:08 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Jun 2019 02:24:07 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=XYssG+J/294GjGfqMpD5KUXLrc6cguktTtRRpAjXxbY=; b=y9Ik4do3tfeJEdpTvORrk7TpPmT8/LZgIF3u6owYv4l8dJRJvh8x94HfGAdvBxesM/hY wPHWOCERy2ILfHET0G99Rr26UEmVf02CxdwMM7MuYnGLL4jPs9kaEuR9WMrZDqCOd0iR ig4m99gZ3wLBB23HXRO2IDCJn7ilUJB4lIK4LC/WGlnuJmXRsi0Kzo9rGtVIK6RzlVZ/ OFIVQ4mc+Yb8GnpmG/pHAX1eeqIdsC1+ExyGVD5PBq5bENKTYg/eclPtKB2y2b+SxmGe s7dt9ec7oQEmYR1hIorRgNlO/AL2Oh5Y6++uIj/Kbwsbgo3S+qXeiEjsbgY0dn+OPC/2 4w== From: Sam Eiderman To: kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Wed, 19 Jun 2019 12:23:49 +0300 Message-Id: <20190619092352.23583-2-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190619092352.23583-1-shmuel.eiderman@oracle.com> References: <20190619092352.23583-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9292 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906190077 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9292 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906190077 Message-ID-Hash: VRGPFQFXUKE6MSKAPV67VZ2I6R2HEG4O X-Message-ID-Hash: VRGPFQFXUKE6MSKAPV67VZ2I6R2HEG4O X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: karl.heubaum@oracle.com, arbel.moshe@oracle.com X-Mailman-Version: 3.2.2 Precedence: list Subject: [SeaBIOS] [PATCH v3 1/4] geometry: Read LCHS from fw_cfg List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: ++++ X-Spam-Level: **** Authentication-Results: coreboot.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Read bios geometry for boot devices from fw_cfg. By receiving LCHS values directly from QEMU through fw_cfg we will be able to support logical geometries which can not be inferred by SeaBIOS itself. (For instance: A 8GB virtio-blk hard drive which was originally created as an IDE and must report LCHS of */32/63 for its operating system to function will always break under SeaBIOS since a LARGE/LBA translation will be used, causing the number of reported logical heads to be > 32.) The only LCHS paravirtual interface available at the moment is for IDE disks (rtc_read() in get_translation()) and it's limited to a maximum of 4 disks (this code existed in SeaBIOS's translation function before SCSI and VirtIO were even introduced). This is why we create a new interface which allows passing LCHS information per hdd. Boot device information is serialized in the following way: * device_path lcyls lheads lsecs\n ... * device_path lcyls lheads lsecs\0 Device path is a null terminated string in the "Open Firmware" device path format, the same path as used in bootorder. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- src/boot.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 74 insertions(+) diff --git a/src/boot.c b/src/boot.c index 5acf94fe..a2cb167c 100644 --- a/src/boot.c +++ b/src/boot.c @@ -24,6 +24,79 @@ =20 =20 /**************************************************************** + * Boot device logical geometry + ****************************************************************/ + +typedef struct BootDeviceLCHS { + char *name; + u32 lcyls; + u32 lheads; + u32 lsecs; +} BootDeviceLCHS; + +static BootDeviceLCHS *BiosGeometry VARVERIFY32INIT; +static int BiosGeometryCount; + +static char * +parse_u32(char *cur, u32 *n) +{ + u32 m =3D 0; + if (cur) { + while ('0' <=3D *cur && *cur <=3D '9') { + m =3D 10 * m + (*cur - '0'); + cur++; + } + if (*cur !=3D '\0') + cur++; + } + *n =3D m; + return cur; +} + +static void +loadBiosGeometry(void) +{ + char *f =3D romfile_loadfile("bios-geometry", NULL); + if (!f) + return; + + int i =3D 0; + BiosGeometryCount =3D 1; + while (f[i]) { + if (f[i] =3D=3D '\n') + BiosGeometryCount++; + i++; + } + BiosGeometry =3D malloc_tmphigh(BiosGeometryCount * sizeof(BootDeviceL= CHS)); + if (!BiosGeometry) { + warn_noalloc(); + free(f); + BiosGeometryCount =3D 0; + return; + } + + dprintf(1, "bios geometry:\n"); + i =3D 0; + do { + BootDeviceLCHS *d =3D &BiosGeometry[i]; + d->name =3D f; + f =3D strchr(f, '\n'); + if (f) + *(f++) =3D '\0'; + char *chs_values =3D strchr(d->name, ' '); + if (chs_values) + *(chs_values++) =3D '\0'; + chs_values =3D parse_u32(chs_values, &d->lcyls); + chs_values =3D parse_u32(chs_values, &d->lheads); + chs_values =3D parse_u32(chs_values, &d->lsecs); + dprintf(1, "%s: (%u, %u, %u)\n", + d->name, d->lcyls, d->lheads, d->lsecs); + i++; + } while (f); +} + + +/**************************************************************** * Boot priority ordering ****************************************************************/ =20 @@ -288,6 +361,7 @@ boot_init(void) BootRetryTime =3D romfile_loadint("etc/boot-fail-wait", 60*1000); =20 loadBootOrder(); + loadBiosGeometry(); } =20 =20 --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org