From nobody Thu Apr 25 19:41:30 2024 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 From nobody Thu Apr 25 19:41:30 2024 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=1560783983; cv=none; d=zoho.com; s=zohoarc; b=K94JnlgL0M0kaoq5Kq/5DJMXU/ab91knsI/GmSbiqo2rExjnGYkpfQRN1VtIX3ycdULJY3RYRnAu4n76yCgW9UmBxKsV3pOwbUQghprtPmhf5zruThXW5R5/mBNVQt6Gn/v9r5fuhzVs/tJzCohuAsTPV/qpAqLru8JY4hwOJYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560783983; 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=9ZgNkEJkInkvp6+X7P8UKhvINr1jSzvpMwx7DilOM/Q=; b=jXp7smuQCciXMvOs1d+Avd8eXo28+/SCj97JcM3LshaJ050awLeCHZJCPa5azGxdqRjy1+gHqOrlTSYBYpSMy0XWIIke6ZfVZZApMnAUTk6D4n1RD0tl6lEDcQTuKeG0uWINT71LY6WoWzwTSLWtWfkxhc7ibBhJ6YBlePVp27k= 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 15607839834078.604782433221203; Mon, 17 Jun 2019 08:06:23 -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 54A88BA3AE5; Mon, 17 Jun 2019 15:06:19 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by coreboot.org (Postfix) with ESMTP id 31FDDBA3AD8 for ; Mon, 17 Jun 2019 15:05:58 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5HF3n4P194596; Mon, 17 Jun 2019 15:04:51 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2t4r3tf5wv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jun 2019 15:04:50 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5HF4OBW057663; Mon, 17 Jun 2019 15:04:50 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2t5mgbd5vv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jun 2019 15:04:49 +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 x5HF4nwp022303; Mon, 17 Jun 2019 15:04:49 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:49 -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=9eBfBHXMqkKaaT/COYD7EQTS6Y2vHmPdziB2LuFlQyg=; b=ZvVUQr+gELqwPnaphER11fpfKIkEX4Rvu4MhKIKMVEHN7oZ/8XbR5I5RQeOP/VlZ0hgk uE+wae3k44Fl/JtqT22Xhl1Q18A13E8KahD1Y0XSbIvuSFJ7kyJ4LU/YtCIFoxAWJdaP fimKdhcq6iFnCMo0ZqwDeDBjK+poG+u9O0taAGgwbIDAw88DwFrtX4vFCknoQPu/UjsZ u9X46NSugxBtasDFm7HfD0uL9lu8vQLP0VXb+m+3iDsFEadYbZEW6GW7racw890Y91GK XiUOoenvE14MDAM3D4q1J0rB2+gGouoz9pNY1zrOQsx+hfkHLBcbP12J2r1D3VISEnar 2w== 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:16 +0300 Message-Id: <20190617150419.4953-3-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=0 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=0 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: 362OR2YTRXTBFKM5QMZJ7MXG2TCTASMD X-Message-ID-Hash: 362OR2YTRXTBFKM5QMZJ7MXG2TCTASMD 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 2/5] boot: Reorder functions in boot.c 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" Currently glob_prefix() and build_pci_path() are under the "Boot priority ordering" section. Move them to a new "Helper search functions" section since we will reuse them in the next commit. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- src/boot.c | 94 ++++++++++++++++++++++++++++++++--------------------------= ---- 1 file changed, 49 insertions(+), 45 deletions(-) diff --git a/src/boot.c b/src/boot.c index b4382041..78d2c530 100644 --- a/src/boot.c +++ b/src/boot.c @@ -22,6 +22,55 @@ #include "util.h" // irqtimer_calc #include "tcgbios.h" // tpm_* =20 +/**************************************************************** + * Helper search functions + ****************************************************************/ + +// See if 'str' starts with 'glob' - if glob contains an '*' character +// it will match any number of characters in str that aren't a '/' or +// the next glob character. +static char * +glob_prefix(const char *glob, const char *str) +{ + for (;;) { + if (!*glob && (!*str || *str =3D=3D '/')) + return (char*)str; + if (*glob =3D=3D '*') { + if (!*str || *str =3D=3D '/' || *str =3D=3D glob[1]) + glob++; + else + str++; + continue; + } + if (*glob !=3D *str) + return NULL; + glob++; + str++; + } +} + +#define FW_PCI_DOMAIN "/pci@i0cf8" + +static char * +build_pci_path(char *buf, int max, const char *devname, struct pci_device = *pci) +{ + // Build the string path of a bdf - for example: /pci@i0cf8/isa@1,2 + char *p =3D buf; + if (pci->parent) { + p =3D build_pci_path(p, max, "pci-bridge", pci->parent); + } else { + p +=3D snprintf(p, buf+max-p, "%s", FW_PCI_DOMAIN); + if (pci->rootbus) + p +=3D snprintf(p, buf+max-p, ",%x", pci->rootbus); + } + + int dev =3D pci_bdf_to_dev(pci->bdf), fn =3D pci_bdf_to_fn(pci->bdf); + p +=3D snprintf(p, buf+max-p, "/%s@%x", devname, dev); + if (fn) + p +=3D snprintf(p, buf+max-p, ",%x", fn); + return p; +} + =20 /**************************************************************** * Boot device logical geometry @@ -146,29 +195,6 @@ loadBootOrder(void) } while (f); } =20 -// See if 'str' starts with 'glob' - if glob contains an '*' character -// it will match any number of characters in str that aren't a '/' or -// the next glob character. -static char * -glob_prefix(const char *glob, const char *str) -{ - for (;;) { - if (!*glob && (!*str || *str =3D=3D '/')) - return (char*)str; - if (*glob =3D=3D '*') { - if (!*str || *str =3D=3D '/' || *str =3D=3D glob[1]) - glob++; - else - str++; - continue; - } - if (*glob !=3D *str) - return NULL; - glob++; - str++; - } -} - // Search the bootorder list for the given glob pattern. static int find_prio(const char *glob) @@ -181,28 +207,6 @@ find_prio(const char *glob) return -1; } =20 -#define FW_PCI_DOMAIN "/pci@i0cf8" - -static char * -build_pci_path(char *buf, int max, const char *devname, struct pci_device = *pci) -{ - // Build the string path of a bdf - for example: /pci@i0cf8/isa@1,2 - char *p =3D buf; - if (pci->parent) { - p =3D build_pci_path(p, max, "pci-bridge", pci->parent); - } else { - p +=3D snprintf(p, buf+max-p, "%s", FW_PCI_DOMAIN); - if (pci->rootbus) - p +=3D snprintf(p, buf+max-p, ",%x", pci->rootbus); - } - - int dev =3D pci_bdf_to_dev(pci->bdf), fn =3D pci_bdf_to_fn(pci->bdf); - p +=3D snprintf(p, buf+max-p, "/%s@%x", devname, dev); - if (fn) - p +=3D snprintf(p, buf+max-p, ",%x", fn); - return p; -} - int bootprio_find_pci_device(struct pci_device *pci) { if (CONFIG_CSM) --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Thu Apr 25 19:41:30 2024 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=1560783956; cv=none; d=zoho.com; s=zohoarc; b=MdBW+KeZHRvct5Av2yIBbLqDN4DhKlpNW1UWRtVFpO711xLwSRIqdqL8NigkjY5tDcGDbnKuVdiCvH03omOLqi8oyvl7Z1y+rsziVPUZnUqXsqoJ3KP6tZmOkKFw1B0rDq+0+7r/VSPrFa8AoMKcZPy/mW6jvnpHnWOX9WnvaBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560783956; 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=Kn3aA+pOAus27OmhguKaQacM2xq5+V2Z5lHFiyflddY=; b=a8ac2mW+ZZ+fWd5WoQTkiKjDb4pGDXQ43AmOhK8xWZ8k4N/x+27d+f9AyzcRC7jpESFlX2AGGiPGxcrmo6pDH9kNKBBqvTGc456e7ml81X+KKtq6YZChL3ed8gko/gzyIp/Izic5pf6Rgy4TtGRg5HiD4kYVNY2PEyyZBkUCIh0= 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 1560783956137913.7112341856407; Mon, 17 Jun 2019 08:05:56 -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 5DA7FBA3AD0; Mon, 17 Jun 2019 15:05:51 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by coreboot.org (Postfix) with ESMTP id DD05DBA3AC8 for ; Mon, 17 Jun 2019 15:05:38 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5HF3q3r194628; Mon, 17 Jun 2019 15:04:54 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2t4r3tf5x6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jun 2019 15:04:53 +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 x5HF3RSM191625; Mon, 17 Jun 2019 15:04:53 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 2t5cpdgape-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jun 2019 15:04:53 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5HF4qT9017448; Mon, 17 Jun 2019 15:04:52 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:52 -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=rAPFvo3TNh5U/Xbn1sV4X1q87mCQdqTAha1Iln3MVZE=; b=5KtH9wECidH54QUP7zq6X3ZtnKRr4LaD4b1XVCeJMMFZn9yXywLqrwZiN0SCfIJa4Cy8 hEZJq/lctZ/AVmI8o+oCWKfQYKWJMPfRkBjD5V4IescXc14E5xd/fKPlAwqlcR4DfPH1 fbHP3dwGQrBDt0MIgiACxsr3Q5LaZJZWZN6dINmy3GpHuqevaa2L7km0kYNXU5rL1+kq 4Ew90px/hAC5uQ3CpVMIbjM6oulHeZKlJfUboe/CqpA8qsC8RsqOyZui988gOuXEypGN eeVAq5hcSBB8z8bYxHbg3ewYDCtQG3eBOFr9+nN1KX86I3uOzF9iOm5pC19dxjgh8cRM 6w== 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:17 +0300 Message-Id: <20190617150419.4953-4-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=0 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=0 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 X-Spam-Level: *** Message-ID-Hash: NDGT357N265YVTHTHWW4LLRNXZB237YA X-Message-ID-Hash: NDGT357N265YVTHTHWW4LLRNXZB237YA 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 3/5] geometry: Add boot_lchs_find_*() utility functions 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" Adding the following utility functions: * boot_lchs_find_pci_device * boot_lchs_find_scsi_device * boot_lchs_find_ata_device These will be used to apply LCHS values received through fw_cfg. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- src/boot.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ src/util.h | 6 ++++++ 2 files changed, 69 insertions(+) diff --git a/src/boot.c b/src/boot.c index 78d2c530..8162cb74 100644 --- a/src/boot.c +++ b/src/boot.c @@ -149,6 +149,69 @@ loadBiosGeometry(void) } } =20 +// Search the bios-geometry list for the given glob pattern. +static BootDeviceLCHS * +boot_lchs_find(const char *glob) +{ + dprintf(1, "Searching bios-geometry for: %s\n", glob); + int i; + for (i =3D 0; i < BiosGeometryCount; i++) + if (glob_prefix(glob, BiosGeometry[i].name)) + return &BiosGeometry[i]; + return NULL; +} + +int boot_lchs_find_pci_device(struct pci_device *pci, struct chs_s *chs) +{ + char desc[256]; + build_pci_path(desc, sizeof(desc), "*", pci); + BootDeviceLCHS *b =3D boot_lchs_find(desc); + if (!b) + return -1; + chs->cylinder =3D (u16)b->lcyls; + chs->head =3D (u16)b->lheads; + chs->sector =3D (u16)b->lsecs; + return 0; +} + +int boot_lchs_find_scsi_device(struct pci_device *pci, int target, int lun, + struct chs_s *chs) +{ + if (!pci) + // support only pci machine for now + return -1; + // Find scsi drive - for example: /pci@i0cf8/scsi@5/channel@0/disk@1,0 + char desc[256], *p; + p =3D build_pci_path(desc, sizeof(desc), "*", pci); + snprintf(p, desc+sizeof(desc)-p, "/*@0/*@%x,%x", target, lun); + BootDeviceLCHS *b =3D boot_lchs_find(desc); + if (!b) + return -1; + chs->cylinder =3D (u16)b->lcyls; + chs->head =3D (u16)b->lheads; + chs->sector =3D (u16)b->lsecs; + return 0; +} + +int boot_lchs_find_ata_device(struct pci_device *pci, int chanid, int slav= e, + struct chs_s *chs) +{ + if (!pci) + // support only pci machine for now + return -1; + // Find ata drive - for example: /pci@i0cf8/ide@1,1/drive@1/disk@0 + char desc[256], *p; + p =3D build_pci_path(desc, sizeof(desc), "*", pci); + snprintf(p, desc+sizeof(desc)-p, "/drive@%x/disk@%x", chanid, slave); + BootDeviceLCHS *b =3D boot_lchs_find(desc); + if (!b) + return -1; + chs->cylinder =3D (u16)b->lcyls; + chs->head =3D (u16)b->lheads; + chs->sector =3D (u16)b->lsecs; + return 0; +} + =20 /**************************************************************** * Boot priority ordering diff --git a/src/util.h b/src/util.h index e2afc80c..b173fa88 100644 --- a/src/util.h +++ b/src/util.h @@ -38,6 +38,12 @@ struct usbdevice_s; int bootprio_find_usb(struct usbdevice_s *usbdev, int lun); int get_keystroke_full(int msec); int get_keystroke(int msec); +struct chs_s; +int boot_lchs_find_pci_device(struct pci_device *pci, struct chs_s *chs); +int boot_lchs_find_scsi_device(struct pci_device *pci, int target, int lun, + struct chs_s *chs); +int boot_lchs_find_ata_device(struct pci_device *pci, int chanid, int slav= e, + struct chs_s *chs); =20 // bootsplash.c void enable_vga_console(void); --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Thu Apr 25 19:41:30 2024 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=1560783962; cv=none; d=zoho.com; s=zohoarc; b=auqGHdOMbB6043KjnMVUgdkQj+It2vSMqno9JLsFO4vCt1fstfB3S8Yy/zETQNiDyqdbDAErnTPcZM2uGr+SMWWwIA6q314zqeeFmqaceXEerktd5aJm8eMnLwhtAitjySWOOy/0gBax2c69Ls4le+Tl9NxsiN7SwjO3qczOLVs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560783962; 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=qbaloC2OS6BOvkPoVXxZds5E9En6PzPpiplAIaJ+irE=; b=nZi2HVtWpdbpx0JyRTuw3P+da9NWp9TTknIJxWLl/pqkpTGXiDdfcP5mDndUiDt6A6Ku2L526gm+FPw7x0i/kCVNx+ydu/cezG0a5dP2e8ZsgAsnIh1Xaoj3aRPa5/j0KfoIajDdtReBBGsSVpBqEIFN8Jq0Tex8HPtp2GkG55Q= 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 1560783962950333.90568633427586; Mon, 17 Jun 2019 08:06:02 -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 0F1B9BA3AD7; Mon, 17 Jun 2019 15:05:58 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by coreboot.org (Postfix) with ESMTP id 9235ABA3AC8 for ; Mon, 17 Jun 2019 15:05:45 +0000 (UTC) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5HF3j5g008673; Mon, 17 Jun 2019 15:04:57 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2t4saq72h8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jun 2019 15:04:57 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5HF3XBl061731; Mon, 17 Jun 2019 15:04:56 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 2t59gd97n1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jun 2019 15:04:56 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5HF4tPN017481; Mon, 17 Jun 2019 15:04:55 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:55 -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=AHpQmog86BPC1eT3XUEskufqXnj+rJVeOHWbUO5moAo=; b=qVv9tEoBCpwUpl6FG6q1H8qGHeQuflgIU4O/bQ9k/jDg67IFU/56Z/WI7yyrRUNg2evh 46P93dr+drs2Ner8gPFzW77tUzBjEX1LVMhEu9RKMzVSvKE12X24JKCTAk7AE2R8UKos hIA6fiHrrXYfr2Rc5BqSgq/288ElWHWVlRxD8aZclpw92TZeQxLobVkLjJIlkXBAADsb +2O/wsOv41JpuE7lfPGDaBGwV1zCQ8tG6QI72in5R7Eb8V1X29r36wTp/0EAFv0W9Ysp mCzmCv4X+CmVwKU1vm/QnX+Fu/NiHNYvldmmiE9z6njwLi3dfpFmm9qJZZeivMD28DXV jA== 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:18 +0300 Message-Id: <20190617150419.4953-5-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=0 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=0 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: G7E6R5HD7RR4TF2ZR4POX6AMB2W5XM4S X-Message-ID-Hash: G7E6R5HD7RR4TF2ZR4POX6AMB2W5XM4S 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 4/5] config: Add toggle for bootdevice information 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" Add the "BIOS_GEOMETRY" toggle to remove boot device information received through fw_cfg. We will use this toggle in QEMU to reduce the size of the 128k SeaBIOS rom, which is only used in old compat versions, where this boot device information does not exist. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- src/Kconfig | 7 +++++++ src/boot.c | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/src/Kconfig b/src/Kconfig index 55a87cb7..0b4c1c0d 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -72,6 +72,13 @@ endchoice help Support controlling of the boot order via the fw_cfg/CBFS "bootorder" file. + config BIOS_GEOMETRY + depends on BOOT + bool "Boot device bios geometry override" + default y + help + Support overriding bios (logical) geometry of boot devices via= the + fw_cfg/CBFS "bios-geometry" file. =20 config COREBOOT_FLASH depends on COREBOOT diff --git a/src/boot.c b/src/boot.c index 8162cb74..695bc189 100644 --- a/src/boot.c +++ b/src/boot.c @@ -95,6 +95,8 @@ static int BiosGeometryCount; static void loadBiosGeometry(void) { + if (!CONFIG_BIOS_GEOMETRY) + return; BiosGeometryCount =3D 0; int fsize; char *f =3D romfile_loadfile("bios-geometry", &fsize); @@ -163,6 +165,8 @@ boot_lchs_find(const char *glob) =20 int boot_lchs_find_pci_device(struct pci_device *pci, struct chs_s *chs) { + if (!CONFIG_BIOS_GEOMETRY) + return -1; char desc[256]; build_pci_path(desc, sizeof(desc), "*", pci); BootDeviceLCHS *b =3D boot_lchs_find(desc); @@ -177,6 +181,8 @@ int boot_lchs_find_pci_device(struct pci_device *pci, s= truct chs_s *chs) int boot_lchs_find_scsi_device(struct pci_device *pci, int target, int lun, struct chs_s *chs) { + if (!CONFIG_BIOS_GEOMETRY) + return -1; if (!pci) // support only pci machine for now return -1; @@ -196,6 +202,8 @@ int boot_lchs_find_scsi_device(struct pci_device *pci, = int target, int lun, int boot_lchs_find_ata_device(struct pci_device *pci, int chanid, int slav= e, struct chs_s *chs) { + if (!CONFIG_BIOS_GEOMETRY) + return -1; if (!pci) // support only pci machine for now return -1; --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Thu Apr 25 19:41:30 2024 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=1560783970; cv=none; d=zoho.com; s=zohoarc; b=Hdgt2lMFito8P6iceAcs+np934TRwB0uD3IKYkfdpP1psLM7kkfQVhmIHcV1YJwZMKllhf1VQ+o/u6tq7d5bK5mzFOVshsYfdFXXwDghEc+g6ZluTOqtQL4o/kumVGsRtHUDzBOXXd/OkOKOhmosaV5gkbFlbg8UyJeeJ9dM1TY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560783970; 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=wF9EQRCM+TxJJr6v3XAlOguDL3JAYwuWlk2KQmFJZIo=; b=KGbryhXUxx6vihUZ/WSCNcAi/hL8DDDBTfuYShqdCyi42KJkJq5u2Tbc1e2FSSM/l8tkSA591aAF+gF60yiaA8GRUY7s4fOKsDTntqeCZmejU1JKpIe+2UnL5dahqutlDoddSdlCC0+7LRbbOuhpFGaQR9V8x86HEydXzmZYR3o= 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 1560783970386173.01640474508883; Mon, 17 Jun 2019 08:06:10 -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 F2AA8BA3ADB; Mon, 17 Jun 2019 15:06:04 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by coreboot.org (Postfix) with ESMTP id E2866BA3ACD for ; Mon, 17 Jun 2019 15:05:43 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5HF3x6A194676; Mon, 17 Jun 2019 15:04:59 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2t4r3tf5xt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jun 2019 15:04:59 +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 x5HF3Z4j192210; Mon, 17 Jun 2019 15:04:59 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 2t5cpdgasm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jun 2019 15:04:58 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5HF4w9C017506; Mon, 17 Jun 2019 15:04:58 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:58 -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=sjPeSH85H7YwPjSGcoXeELaYEDE4MR8f1zSgfJn1kfA=; b=cTBR+NxlxSIBDlJ8ADW/XET0Y8IVKDAWzRL564EmJg/m2c3bl+bg2RAT8Dqi2HCDpW33 srUGgP58SywbibXaY4djHS2/nYNU1TxbLU0dSpGGuiDLeyxfBHDXaK1HBTqk6IgpkmFI IP16J7qn8/C6vKNYfIh53GCmYvT4qeAJnm+4evMTHo4bPaBJWPzKRJXFGpIcLUS9jmGL B9KokdSeBaawzSf72/NUgRJTE5k8HC59IVWHpynvFqBDCgy+ZImif1GgKpKyb1xjMiDH DDEKvSa1xriFJrwSdgKbxQC9U0sv93SMCTHlAucVFPO8uYz/bADoo3zhZhsYr649kTWX fA== 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:19 +0300 Message-Id: <20190617150419.4953-6-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: XUKGOKL5HXONV5ZPM2SQ3WHZQEF425QF X-Message-ID-Hash: XUKGOKL5HXONV5ZPM2SQ3WHZQEF425QF 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 5/5] geometry: Apply LCHS values for boot devices 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" Boot devices which use overriden LCHS values are: * ata * ahci * scsi * esp * lsi * megasas * mpt * pvscsi * virtio * virtio-blk We use these values in get_translation() and setup_translation() by introducing a new translation type: "TRANSLATION_MACHINE". We treat this translation as TRANSLATION_NONE in fill_ata_edd(), although this does not really matter since now the translation between physical and logical geometry does not exist. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- src/block.c | 21 ++++++++++++++++++++- src/block.h | 1 + src/hw/ahci.c | 1 + src/hw/ata.c | 8 ++++++++ src/hw/esp-scsi.c | 2 ++ src/hw/lsi-scsi.c | 2 ++ src/hw/megasas.c | 1 + src/hw/mpt-scsi.c | 2 ++ src/hw/pvscsi.c | 1 + src/hw/virtio-blk.c | 2 ++ src/hw/virtio-scsi.c | 2 ++ 11 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/block.c b/src/block.c index f73ec18c..ca23a83a 100644 --- a/src/block.c +++ b/src/block.c @@ -69,9 +69,17 @@ int create_bounce_buf(void) * Disk geometry translation ****************************************************************/ =20 +static int +overriden_lchs_supplied(struct drive_s *drive) +{ + return drive->lchs.cylinder || drive->lchs.head || drive->lchs.sector; +} + static u8 get_translation(struct drive_s *drive) { + if (overriden_lchs_supplied(drive)) + return TRANSLATION_MACHINE; u8 type =3D drive->type; if (CONFIG_QEMU && type =3D=3D DTYPE_ATA) { // Emulators pass in the translation info via nvram. @@ -159,6 +167,16 @@ setup_translation(struct drive_s *drive) break; } break; + case TRANSLATION_MACHINE: + desc =3D "overriden"; + cylinders =3D drive->lchs.cylinder; + heads =3D drive->lchs.head; + if (heads > 255) + heads =3D 255; + spt =3D drive->lchs.sector; + if (spt > 63) + spt =3D 63; + break; } // clip to 1024 cylinders in lchs if (cylinders > 1024) @@ -423,7 +441,8 @@ fill_ata_edd(struct segoff_s edd, struct drive_s *drive= _gf) u16 options =3D 0; if (GET_GLOBALFLAT(drive_gf->type) =3D=3D DTYPE_ATA) { u8 translation =3D GET_GLOBALFLAT(drive_gf->translation); - if (translation !=3D TRANSLATION_NONE) { + if ((translation !=3D TRANSLATION_NONE) && + (translation !=3D TRANSLATION_MACHINE)) { options |=3D 1<<3; // CHS translation if (translation =3D=3D TRANSLATION_LBA) options |=3D 1<<9; diff --git a/src/block.h b/src/block.h index f64e8807..12f27eee 100644 --- a/src/block.h +++ b/src/block.h @@ -90,6 +90,7 @@ struct drive_s { #define TRANSLATION_LBA 1 #define TRANSLATION_LARGE 2 #define TRANSLATION_RECHS 3 +#define TRANSLATION_MACHINE 4 =20 #define EXTTYPE_FLOPPY 0 #define EXTTYPE_HD 1 diff --git a/src/hw/ahci.c b/src/hw/ahci.c index 1746e7a1..97a072a1 100644 --- a/src/hw/ahci.c +++ b/src/hw/ahci.c @@ -593,6 +593,7 @@ static int ahci_port_setup(struct ahci_port_s *port) , ata_extract_version(buffer)); port->prio =3D bootprio_find_ata_device(ctrl->pci_tmp, pnr, 0); } + boot_lchs_find_ata_device(ctrl->pci_tmp, pnr, 0, &(port->drive.lchs)); return 0; } =20 diff --git a/src/hw/ata.c b/src/hw/ata.c index b6e073cf..f788ce71 100644 --- a/src/hw/ata.c +++ b/src/hw/ata.c @@ -755,6 +755,10 @@ init_drive_atapi(struct atadrive_s *dummy, u16 *buffer) int prio =3D bootprio_find_ata_device(adrive->chan_gf->pci_tmp, adrive->chan_gf->chanid, adrive->slave); + boot_lchs_find_ata_device(adrive->chan_gf->pci_tmp, + adrive->chan_gf->chanid, + adrive->slave, + &(adrive->drive.lchs)); boot_add_cd(&adrive->drive, desc, prio); } =20 @@ -805,6 +809,10 @@ init_drive_ata(struct atadrive_s *dummy, u16 *buffer) int prio =3D bootprio_find_ata_device(adrive->chan_gf->pci_tmp, adrive->chan_gf->chanid, adrive->slave); + boot_lchs_find_ata_device(adrive->chan_gf->pci_tmp, + adrive->chan_gf->chanid, + adrive->slave, + &(adrive->drive.lchs)); // Register with bcv system. boot_add_hd(&adrive->drive, desc, prio); =20 diff --git a/src/hw/esp-scsi.c b/src/hw/esp-scsi.c index ffd86d0f..cc25f227 100644 --- a/src/hw/esp-scsi.c +++ b/src/hw/esp-scsi.c @@ -181,6 +181,8 @@ esp_scsi_add_lun(u32 lun, struct drive_s *tmpl_drv) =20 char *name =3D znprintf(MAXDESCSIZE, "esp %pP %d:%d", llun->pci, llun->target, llun->lun); + boot_lchs_find_scsi_device(llun->pci, llun->target, llun->lun, + &(llun->drive.lchs)); int prio =3D bootprio_find_scsi_device(llun->pci, llun->target, llun->= lun); int ret =3D scsi_drive_setup(&llun->drive, name, prio); free(name); diff --git a/src/hw/lsi-scsi.c b/src/hw/lsi-scsi.c index d5fc3e45..cbaa2acd 100644 --- a/src/hw/lsi-scsi.c +++ b/src/hw/lsi-scsi.c @@ -158,6 +158,8 @@ lsi_scsi_add_lun(u32 lun, struct drive_s *tmpl_drv) lsi_scsi_init_lun(llun, tmpl_llun->pci, tmpl_llun->iobase, tmpl_llun->target, lun); =20 + boot_lchs_find_scsi_device(llun->pci, llun->target, llun->lun, + &(llun->drive.lchs)); char *name =3D znprintf(MAXDESCSIZE, "lsi %pP %d:%d", llun->pci, llun->target, llun->lun); int prio =3D bootprio_find_scsi_device(llun->pci, llun->target, llun->= lun); diff --git a/src/hw/megasas.c b/src/hw/megasas.c index d2675804..87b8beec 100644 --- a/src/hw/megasas.c +++ b/src/hw/megasas.c @@ -225,6 +225,7 @@ megasas_add_lun(struct pci_device *pci, u32 iobase, u8 = target, u8 lun) free(mlun); return -1; } + boot_lchs_find_scsi_device(pci, target, lun, &(mlun->drive.lchs)); name =3D znprintf(MAXDESCSIZE, "MegaRAID SAS (PCI %pP) LD %d:%d" , pci, target, lun); prio =3D bootprio_find_scsi_device(pci, target, lun); diff --git a/src/hw/mpt-scsi.c b/src/hw/mpt-scsi.c index 1faede6a..570b2126 100644 --- a/src/hw/mpt-scsi.c +++ b/src/hw/mpt-scsi.c @@ -221,6 +221,8 @@ mpt_scsi_add_lun(u32 lun, struct drive_s *tmpl_drv) mpt_scsi_init_lun(llun, tmpl_llun->pci, tmpl_llun->iobase, tmpl_llun->target, lun); =20 + boot_lchs_find_scsi_device(llun->pci, llun->target, llun->lun, + &(llun->drive.lchs)); char *name =3D znprintf(MAXDESCSIZE, "mpt %pP %d:%d", llun->pci, llun->target, llun->lun); int prio =3D bootprio_find_scsi_device(llun->pci, llun->target, llun->= lun); diff --git a/src/hw/pvscsi.c b/src/hw/pvscsi.c index 9d7d68d8..3e5171ad 100644 --- a/src/hw/pvscsi.c +++ b/src/hw/pvscsi.c @@ -273,6 +273,7 @@ pvscsi_add_lun(struct pci_device *pci, void *iobase, plun->iobase =3D iobase; plun->ring_dsc =3D ring_dsc; =20 + boot_lchs_find_scsi_device(pci, target, lun, &(plun->drive.lchs)); char *name =3D znprintf(MAXDESCSIZE, "pvscsi %pP %d:%d", pci, target, = lun); int prio =3D bootprio_find_scsi_device(pci, target, lun); int ret =3D scsi_drive_setup(&plun->drive, name, prio); diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c index 88d7e54a..3e615b26 100644 --- a/src/hw/virtio-blk.c +++ b/src/hw/virtio-blk.c @@ -183,6 +183,8 @@ init_virtio_blk(void *data) =20 status |=3D VIRTIO_CONFIG_S_DRIVER_OK; vp_set_status(&vdrive->vp, status); + + boot_lchs_find_pci_device(pci, &vdrive->drive.lchs); return; =20 fail: diff --git a/src/hw/virtio-scsi.c b/src/hw/virtio-scsi.c index a87cad88..e1e2f5d4 100644 --- a/src/hw/virtio-scsi.c +++ b/src/hw/virtio-scsi.c @@ -121,6 +121,8 @@ virtio_scsi_add_lun(u32 lun, struct drive_s *tmpl_drv) virtio_scsi_init_lun(vlun, tmpl_vlun->pci, tmpl_vlun->vp, tmpl_vlun->v= q, tmpl_vlun->target, lun); =20 + boot_lchs_find_scsi_device(vlun->pci, vlun->target, vlun->lun, + &(vlun->drive.lchs)); int prio =3D bootprio_find_scsi_device(vlun->pci, vlun->target, vlun->= lun); int ret =3D scsi_drive_setup(&vlun->drive, "virtio-scsi", prio); if (ret) --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org