From nobody Tue Nov 11 03:16:12 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=1560783977; cv=none; d=zoho.com; s=zohoarc; b=RrgTOZ3x1UuA8YH+lCgujRqjcRBVPSdHNPPwQh/jM6jWV6ebW69OW2QmNPl3S4o0hBLMl4MF5uM4WPVDWU2CO9um95GKbS9AxJBIoaneMezrkzPk0xzCPYWNK3EAAORZgbkGaK7ulUrpMBZCFoo/V+Nl3itmuurDM+o4cCWsA4g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560783977; 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=+8+OpQ12f9byiDVunGirTdMG/zx9V0ovfjmc2w1zeY4=; b=PaNrMkEJ1r1vWXTSswW9UNAIzPqNgaBd4ZmGbCEbfebGLEenE/fWTLxXHTXreu5P8f4cYk2toE/c0wzovFogSedRxzW1FD1TjTxTTdjFf0dHjuM5W2HZYfVxMIMe0+X4S23ZoNUjybYBKl1tLb9D5lIQEjYv9atHP+fDS5juCHk= 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 15607839769681020.4029435756095; Mon, 17 Jun 2019 08:06:16 -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 9810FBA3AD9; Mon, 17 Jun 2019 15:06:11 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by coreboot.org (Postfix) with ESMTP id D853EBA3AC8 for ; Mon, 17 Jun 2019 15:05:53 +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 x5HF45Fn111760; Mon, 17 Jun 2019 15:04:49 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 2t4rmny3h8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jun 2019 15:04:48 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5HF3Xso121917; Mon, 17 Jun 2019 15:04:48 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2t5h5t6aqt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jun 2019 15:04:48 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5HF4kQi022266; Mon, 17 Jun 2019 15:04:46 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 17 Jun 2019 08:04:46 -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=yc3jLPPS6khxTDdaK2Cccm/Exx2cYQyZMLHqmbcxjTU=; b=EVwK40y65rF9wZWMzxz16GkADI6AuiwxGr7j24spDF/kKmzMxGxDemkEPRMILVnMYKv7 kZ1A8a+DRugvrowVdAdvxlJrbndL5o9jOJB7HsG4XfjeUEidW5v2xyDxjHBhaAOq2w3F uNnntMkhJzQaHz36tj9f2hh0S5bVZQ9qCO5LxptueS0L186o+q//NCqDsFScnSinlzCY H2w4lC59scP81dQzyQ0dWp+3RwB2dLPPE9vyM08ESoFU+3yHIsCom4dDm7/nrgsG3AOh WLqOb15ifR9bqewfaJM0cr4cFsP7cAD0acJm25qrZGjTp61ymoGdlDBIj8VKnnUmO4t2 vg== 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: Mon, 17 Jun 2019 18:04:15 +0300 Message-Id: <20190617150419.4953-2-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190617150419.4953-1-shmuel.eiderman@oracle.com> References: <20190617150419.4953-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9291 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-1906170136 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9291 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-1906170136 Message-ID-Hash: YAJQI52POX7XRTH27MJNLYF3VVRTGHFR X-Message-ID-Hash: YAJQI52POX7XRTH27MJNLYF3VVRTGHFR 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 v2 1/5] 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 Authentication-Results: coreboot.org X-Spamd-Bar: / 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 (sz string) * device lchs ... * device path (sz string) * device lchs 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 | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 79 insertions(+) diff --git a/src/boot.c b/src/boot.c index 5acf94fe..b4382041 100644 --- a/src/boot.c +++ b/src/boot.c @@ -24,6 +24,84 @@ =20 =20 /**************************************************************** + * Boot device logical geometry + ****************************************************************/ + +typedef struct BootDeviceLCHSSerialized { + u32 lcyls; + u32 lheads; + u32 lsecs; +} PACKED BootDeviceLCHSSerialized; + +typedef struct BootDeviceLCHS { + char *name; + u32 lcyls; + u32 lheads; + u32 lsecs; +} BootDeviceLCHS; + +static BootDeviceLCHS *BiosGeometry VARVERIFY32INIT; +static int BiosGeometryCount; + +static void +loadBiosGeometry(void) +{ + BiosGeometryCount =3D 0; + int fsize; + char *f =3D romfile_loadfile("bios-geometry", &fsize); + if (!f) + return; + + u32 struct_size =3D sizeof(BootDeviceLCHSSerialized); + + int i; + int str_found =3D 0; + + for (i =3D 0; i < fsize; i++) { + if (f[i] !=3D '\0') + str_found =3D 1; + else if (f[i] =3D=3D '\0' && str_found) { + str_found =3D 0; + i++; + if (i + struct_size > fsize) + break; + i +=3D struct_size - 1; + BiosGeometryCount++; + } else + break; + } + + BiosGeometry =3D malloc_tmphigh(BiosGeometryCount * sizeof(BootDeviceL= CHS)); + if (!BiosGeometry) { + warn_noalloc(); + free(f); + BiosGeometryCount =3D 0; + return; + } + + dprintf(1, "bios geometry:\n"); + + BootDeviceLCHSSerialized *blk; + BootDeviceLCHS *d; + + for (i =3D 0; i < BiosGeometryCount; i++) { + d =3D &BiosGeometry[i]; + d->name =3D f; + f +=3D strlen(f) + 1; + + blk =3D (BootDeviceLCHSSerialized *)f; + d->lcyls =3D blk->lcyls; + d->lheads =3D blk->lheads; + d->lsecs =3D blk->lsecs; + f +=3D struct_size; + + dprintf(1, "%s: (%u, %u, %u)\n", + d->name, d->lcyls, d->lheads, d->lsecs); + } +} + + +/**************************************************************** * Boot priority ordering ****************************************************************/ =20 @@ -288,6 +366,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