From nobody Fri Apr 19 05:54:05 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=1561552771; cv=none; d=zoho.com; s=zohoarc; b=kVxkl7e104MrhuF110fFWoNikHXG+M8tIsRD7nsLa7XAPqaH47cE4H/IOpdTsBUbMipFJQSKepJ14kzvYyu/x8tfP0vpMj8mp2MZAdbNsJqkNdmc+61oI/Qt+MMCUf8ypj5svDNtyYYp/gujFfLEMN4y5DTyILrTkXJK3RBr3oE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561552771; 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=A1yJ6W8Q7Gvtu/XEWzTXH1OK6Xlawmov6B8xyxQKHBus0Vb3xpHIHumXjXxqRBzVsstmEjBMlwa4Ce07PtZvkxgpHCHNfCxVsxiJTsDnMrJf7g3Cu7hZ55+ALapsmIT+1hSczD7s3KMA3VYeITMDvio8Ea+cUPHyA2ydCT0BfrE= 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 1561552771156415.9809096276489; Wed, 26 Jun 2019 05:39:31 -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 BD0FEBA0BC2; Wed, 26 Jun 2019 12:39:25 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by coreboot.org (Postfix) with ESMTP id AAB74BA0BBC for ; Wed, 26 Jun 2019 12:39:16 +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 x5QCY6sD104975; Wed, 26 Jun 2019 12:38:34 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 2t9c9pt2c3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:38:34 +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 x5QCbRwx021575; Wed, 26 Jun 2019 12:38:33 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 2tat7ct4vj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:38:33 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5QCcWAP000685; Wed, 26 Jun 2019 12:38:32 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Jun 2019 05:38:32 -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=piHR5uJZmBldCwFMO6F55QQ6QnFtCBjeyGBAhMOMlejSm3U4GQd0NBxKgalxDFbWUNrV 3AnkysuQIcFwX3GxtsRthAaB5CO4iPdn+LdvDUpKss8eD/9H9cIlX4gx5bAtth83oP5V Xa+7HPyEgLr8qAPgG/Q4AqV0GdrRT47LInHEMpkuVVYCAUq6gqHp1NGh8bOavSZmiFa+ zZd5v1NmzMzbIh1NKRHhHryUW8vJy++r2KOiaY+Ogv2enbLorIik+4LLLYGr5qE+aZ67 MDNnOpG8SkGlncvDvumTAhaM7OI684mFg85y3fs7NUvybtB+WneKvDlP5bL2j598lmAO YQ== 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, 26 Jun 2019 15:38:12 +0300 Message-Id: <20190626123816.8907-2-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190626123816.8907-1-shmuel.eiderman@oracle.com> References: <20190626123816.8907-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260150 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260150 Message-ID-Hash: B3IPD3HH4UPDYJWFE4KX3HXUCNW5GPEW X-Message-ID-Hash: B3IPD3HH4UPDYJWFE4KX3HXUCNW5GPEW 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 v4 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 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 From nobody Fri Apr 19 05:54:05 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=1561552790; cv=none; d=zoho.com; s=zohoarc; b=FfzPSi0VABKfDHuq2JbwCID30V9VrfuL6i5S0qW+6R2lhClGPrSQRSSoDCw7clXYQa+7Uzl1v221ccSFRmkqixq8EuEUUpo+B5pu4Na8MZiAxHdYhHF8wgv2gZuXdXNhWLGkLN5xxyRUghwk2HkV5thfp6YGHp23jzBAc+yQJAc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561552790; 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=FWk3LAu8I6W6nZxMStik6BFB3741rUXV7lGUZQ7Z8xg=; b=K9ShBppBV952ZLOTSxHi8yJLv9z2mTodzDtaIRqUwBR/ljsq/ZUfeNg/MMG9AqL/Y5QtAOuAGgNybKwIrTVI2pqbUfTGjAGBzf1pVfpqHmZq6nuI9gVsStUaXbwdcx0AtIGtOHg+YI8GjYh/q7DYZliC9jhgFjlIGG/YFsLcbFY= 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 1561552790211914.3643247931476; Wed, 26 Jun 2019 05:39:50 -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 BCEE8BA0C09; Wed, 26 Jun 2019 12:39:44 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by coreboot.org (Postfix) with ESMTP id 89957BA0BD9 for ; Wed, 26 Jun 2019 12:39:33 +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 x5QCY7kf187573; Wed, 26 Jun 2019 12:38:37 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2t9brta44n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:38:37 +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 x5QCbTmZ021745; Wed, 26 Jun 2019 12:38:36 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3020.oracle.com with ESMTP id 2tat7ct4w6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:38:36 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5QCcZIS019621; Wed, 26 Jun 2019 12:38:35 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Jun 2019 05:38:35 -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=UW6sWZMVwR6L4QasUuYIjj/mBRcHWV2QZfAt+64nLos=; b=o65pryBIhPsRKbcg+A50iL7ZHv7lWiCkGPhQsjlyStShBB3xDr/AAJsbNz4q5jJ8sv6n RYEnSpiXIuQqTQDzmckF1nFCswqqpoa3KbBJ6cde28VhQwerhuwOfYJf6XndMwBM2uz2 R/VcoEJjBseNMrkqfehpkQeYMlTlhtSK1MWv/ziSaLqc+XxtnhYPvUtZAVYsev2Bt09z l0Kdm0STF7xHFCvn9Ex0LDdJhD8YypCMWVT1XJaJIV9ww0neUfZHdZiGt3c98BAjiOIo VBenagZkbQEd94A/woMkO1ESa9WG5FXvdDp3DdXU9ZIi7tFNtUOuFP9gLIcTcpVaw+xs bw== 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, 26 Jun 2019 15:38:13 +0300 Message-Id: <20190626123816.8907-3-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190626123816.8907-1-shmuel.eiderman@oracle.com> References: <20190626123816.8907-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260150 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260150 Message-ID-Hash: YDVU3WIGOSKZ2RQSMR5UVQNZ66K4IG65 X-Message-ID-Hash: YDVU3WIGOSKZ2RQSMR5UVQNZ66K4IG65 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 v4 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 commits. 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 a2cb167c..70f639f4 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 @@ -141,29 +190,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) @@ -176,28 +202,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 Fri Apr 19 05:54:05 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=1561552796; cv=none; d=zoho.com; s=zohoarc; b=lJ1PnTfCnwfqOHwC6UAD3vuab+f1LtqXcOchjRcH4Wma7wsQtCc8Eb8/gA9XpgROJf4L5KdSlWZUr8loqJO1h1JMLSalGJ0loJzHipnBmdCYpZc4+rpKxNffC1yM0nFxXHPcyGfy+M+Lc5IZk8Fgs8moItXXd0h9T1FC4gTNMHs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561552796; 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=R1HpbQeYUoZXJGvaNlo2K3ovfSgFF9ebmKnxEB/Muu0=; b=V8wtR28SDgC97namQj1leBVTZzam1IURz6FwHglQwsq6TIx8RnzCK6nJG2trU0GOi/79ivczXjlk6qqKu7SZmdbPimMqg0QM/CJegK0FT3VVSp9HQ0XVLkHctMOrM/qIhHz41zE0ZSTkId2XQaUn/WBQA2OoODTYt2gRcy/L4co= 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 1561552796642104.60593217842666; Wed, 26 Jun 2019 05:39: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 DBCCBBA0C16; Wed, 26 Jun 2019 12:39:50 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by coreboot.org (Postfix) with ESMTP id 525A7BA0BD9 for ; Wed, 26 Jun 2019 12:39:35 +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 x5QCYAXj187602; Wed, 26 Jun 2019 12:38:40 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2t9brta44x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:38:40 +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 x5QCbS3s021700; Wed, 26 Jun 2019 12:38:40 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2tat7ct4wp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:38:39 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5QCccf3002703; Wed, 26 Jun 2019 12:38:38 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Jun 2019 05:38:38 -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=unrVc136npZDb5NaLZdO2sOpKQ7GyimxsHu2DkvWsbA=; b=RUE81+suKmwwjtIMKzcp24b6VzI1XH1QDTDrHWbXLU2z16MYpJwkc1fGoUN+GB2luf1h RzB9ZqtzlyyPFIU24J9Vd8sEFrtdjsEKAS4IjoBpugR6cvH2WSG0Hl6uG8Q9CECrZhlD bFS/3NqdDwmkIKZG4PNtYzZzfBakpcIPziBr6aD/zk6UEeivbRFM4swsiO2rK9Dbd2sq 2DcMkaPcORgABL6Y681KgUaNZh+LIjDyupxZ7l6XzqCCmKxMGDdU26t9IWVU0tnt1V3c ccjUqHDc+pxt1v5tXtAvY7UQvoXtiaGVPfcLzLyqBrFEzlunbM/e8RKp7lF2cVUb1bG7 mw== 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, 26 Jun 2019 15:38:14 +0300 Message-Id: <20190626123816.8907-4-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190626123816.8907-1-shmuel.eiderman@oracle.com> References: <20190626123816.8907-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260150 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260150 Message-ID-Hash: RY33DRZZ3UK3UMQ3Q6BY2KUCHRRW4MRK X-Message-ID-Hash: RY33DRZZ3UK3UMQ3Q6BY2KUCHRRW4MRK 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 v4 3/5] boot: Build ata and scsi paths in function 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" Introduce build_scsi_path() and build_ata_path(). We will reuse these functions in the next commit. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- src/boot.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/boot.c b/src/boot.c index 70f639f4..52e1c8e6 100644 --- a/src/boot.c +++ b/src/boot.c @@ -71,6 +71,30 @@ build_pci_path(char *buf, int max, const char *devname, = struct pci_device *pci) return p; } =20 +static char * +build_scsi_path(char *buf, int max, + struct pci_device *pci, int target, int lun) +{ + // Build the string path of a scsi drive - for example: + // /pci@i0cf8/scsi@5/channel@0/disk@1,0 + char *p; + p =3D build_pci_path(buf, max, "*", pci); + p +=3D snprintf(p, buf+max-p, "/*@0/*@%x,%x", target, lun); + return p; +} + +static char * +build_ata_path(char *buf, int max, + struct pci_device *pci, int chanid, int slave) +{ + // Build the string path of an ata drive - for example: + // /pci@i0cf8/ide@1,1/drive@1/disk@0 + char *p; + p =3D build_pci_path(buf, max, "*", pci); + p +=3D snprintf(p, buf+max-p, "/drive@%x/disk@%x", chanid, slave); + return p; +} + =20 /**************************************************************** * Boot device logical geometry @@ -221,10 +245,8 @@ int bootprio_find_scsi_device(struct pci_device *pci, = int target, int lun) 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); + char desc[256]; + build_scsi_path(desc, sizeof(desc), pci, target, lun); return find_prio(desc); } =20 @@ -237,10 +259,8 @@ int bootprio_find_ata_device(struct pci_device *pci, i= nt chanid, int slave) 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); + char desc[256]; + build_ata_path(desc, sizeof(desc), pci, chanid, slave); return find_prio(desc); } =20 --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 19 05:54:05 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=1561552803; cv=none; d=zoho.com; s=zohoarc; b=SsUOQOEjMQNu0N5O6j9RZoL5inYUajm4VlefCbczfBxL+xXrKYtVFydnz11r1tWD/N9GVy7U5nL1CXNkxDPwFhjKEIawjMxwHIDz3fT4RSQxrtdjQ8VEwEFWrwh88yhyAvqQktCdDQRjYFfYGhYCu9yPL511Pi9uksfSw7BtvV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561552803; 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=t9dlBbUIcHMi2eLBIFP+SRCXx7Egw+CyUZ3lGefaZxU=; b=BQRrZZrByLDVuDP+VPFIDIarCiCEWEtgl0nStGWAFOxqh0snaRyogvKSVp3jRObuJtyW8UVwNLfXpiuktRHL1eG0oBd5dB5tUZ0t7JUhw9Z+PfxJkXp+KG9pyRlhSejSBOxa/frb66CVRY7rm+ygplmWAlY9+QxVBiCu5V5Wt3Q= 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 1561552803449527.8134057410906; Wed, 26 Jun 2019 05:40:03 -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 04C2FBA0C00; Wed, 26 Jun 2019 12:39:56 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by coreboot.org (Postfix) with ESMTP id 6AE93BA0BEB for ; Wed, 26 Jun 2019 12:39:35 +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 x5QCY7pi193508; Wed, 26 Jun 2019 12:38:48 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2t9cyqj0hc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:38:48 +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 x5QCclgN164723; Wed, 26 Jun 2019 12:38:47 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2t9p6urjx8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:38:47 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5QCcgLx024043; Wed, 26 Jun 2019 12:38:42 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Jun 2019 05:38:41 -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=PG6+5eBzxS2ZYCiKxYtu/H0lFyJx2xVRNgzQO9/BhSw=; b=KBmC0MtM3ixSd1efL6S3f3iZPorgsoh+ullMr2TozhkO8l30XkfBK6jNkWZX/0LronS/ sZEbAXCtEp+vNom/emX0sUYkO9RT6ijR5dWLMz9sq4pqjYBNuO0qDL8K5ttqaGVSKpmL xLS/Tq/Qv/9QJX6KfBE4/jFNdKs05+pAhtp3g+g8xZUrk4d/GRVhOfgVYFZXdC49MY1p 36ZtKd46pCzE+vO3qhLPO3E3vgrWjmDhhkIYot9i5WkQAtQKM/W4tRWgrNsm/2lWF+LM 9JMexenkN+u6A5+xmfYYUYwmtT/VOnAfeQM4tCUmZN5qmOzqDA6zU0i2GYWzc3Lk29y7 Uw== 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, 26 Jun 2019 15:38:15 +0300 Message-Id: <20190626123816.8907-5-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190626123816.8907-1-shmuel.eiderman@oracle.com> References: <20190626123816.8907-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260150 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260150 Message-ID-Hash: DAJOULWFK24DX4DY3VS6WWOOQNWW3GSG X-Message-ID-Hash: DAJOULWFK24DX4DY3VS6WWOOQNWW3GSG 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 v4 4/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/Kconfig | 7 +++++++ src/boot.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ src/util.h | 6 ++++++ 3 files changed, 82 insertions(+) diff --git a/src/Kconfig b/src/Kconfig index 55a87cb7..6606ce4d 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 HOST_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 52e1c8e6..ea18194d 100644 --- a/src/boot.c +++ b/src/boot.c @@ -129,6 +129,8 @@ parse_u32(char *cur, u32 *n) static void loadBiosGeometry(void) { + if (!CONFIG_HOST_BIOS_GEOMETRY) + return; char *f =3D romfile_loadfile("bios-geometry", NULL); if (!f) return; @@ -168,6 +170,73 @@ loadBiosGeometry(void) } while (f); } =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) +{ + if (!CONFIG_HOST_BIOS_GEOMETRY) + return -1; + 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 (!CONFIG_HOST_BIOS_GEOMETRY) + return -1; + 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]; + build_scsi_path(desc, sizeof(desc), pci, 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 (!CONFIG_HOST_BIOS_GEOMETRY) + return -1; + 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]; + build_ata_path(desc, sizeof(desc), pci, 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 Fri Apr 19 05:54:05 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=1561552782; cv=none; d=zoho.com; s=zohoarc; b=Vj2R7XLaZ4QsYL/OANSBagnzBYHvMz4mlW7NJYD4Bzl3N8WP5bagiYa9U59AFlzG3OnetvMOJfHIXvthSJGz48DKiCSqmm2CajZhF4kukBZq16SN9LT9rWTY6I//6lXT213d0qK0/U7G29Ur9Ygh10fgwnIzQWz3wcCXgTCl9Gc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561552782; 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=V7DsfGFNaUS7C049yPzo47dTZ8Z2axy5Uyr1Lemx+Uk=; b=lr2pJ/SFy3Pq64bImNLmVoy2TpdCXA+f7g6j7sdEIWaALFUiNJYBV3N5ZImrOlL8dV8UtsDqLzygeKHu+ZJ4Vmkz35SX+9BEevRhdz15/63cEmTC7ypXAahEapdjmQ28atdeWiOpqjDLjJxfr6dOBJcLfafW/5MmQ8cR0ScUYhE= 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 1561552782901886.1678630450841; Wed, 26 Jun 2019 05:39:42 -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 BB772BA0BD9; Wed, 26 Jun 2019 12:39:37 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by coreboot.org (Postfix) with ESMTP id C3978BA0BBF for ; Wed, 26 Jun 2019 12:39:22 +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 x5QCYFmU193588; Wed, 26 Jun 2019 12:38:46 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2t9cyqj0h9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:38:46 +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 x5QCbWW7096445; Wed, 26 Jun 2019 12:38:45 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 2t9accp1c4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:38:45 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5QCcjZp019669; Wed, 26 Jun 2019 12:38:45 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Jun 2019 05:38:44 -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=vw4u7P5c3vYSIdE8uZiQYXD8b354wZY9HMPyn34IPx8=; b=4QgfNfeWxnZfV5DcuA5c/ix57x1LYq8Q4Hz6HBIiS0JY08Brgk9J6P9oPokkYy5wRv/u Ma8QSlGCLUeBna1KGqeue3rYdirsDX4XqIqow64IDiAVuc6qWfcTWDjoS3hboIvIRFLg Lz1k0jzUBA9xDASYT92KhYMyxtcyeDLFlJ1OL/mwTGXzINfWU8ku/sOMby5Zb2QnUxUx LyMfL8t7PvxokVqGBbXpbrJky+zP3ICV2B6DwUjkG3l7KgiKgmBCB2XdlNLUnXyi2SET Sim8eNWP14IFreij33CIxFB94iKygiIqPIww6EJCy5d8MIWXCFRJLq++g22OWcRjlpHy Ww== 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, 26 Jun 2019 15:38:16 +0300 Message-Id: <20190626123816.8907-6-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190626123816.8907-1-shmuel.eiderman@oracle.com> References: <20190626123816.8907-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260150 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260150 X-Spam-Level: ** Message-ID-Hash: UUCTPPJ4PTS5CUTCFLOH3YOEXGC6HQ4T X-Message-ID-Hash: UUCTPPJ4PTS5CUTCFLOH3YOEXGC6HQ4T 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 v4 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_HOST". 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 | 18 +++++++++++++++++- 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, 39 insertions(+), 1 deletion(-) diff --git a/src/block.c b/src/block.c index f73ec18c..1f600b85 100644 --- a/src/block.c +++ b/src/block.c @@ -69,9 +69,18 @@ int create_bounce_buf(void) * Disk geometry translation ****************************************************************/ =20 +static int +host_lchs_supplied(struct drive_s *drive) +{ + return (drive->lchs.head <=3D 255 && + drive->lchs.sector > 0 && drive->lchs.sector <=3D 63); +} + static u8 get_translation(struct drive_s *drive) { + if (host_lchs_supplied(drive)) + return TRANSLATION_HOST; u8 type =3D drive->type; if (CONFIG_QEMU && type =3D=3D DTYPE_ATA) { // Emulators pass in the translation info via nvram. @@ -159,6 +168,12 @@ setup_translation(struct drive_s *drive) break; } break; + case TRANSLATION_HOST: + desc =3D "host-supplied"; + cylinders =3D drive->lchs.cylinder; + heads =3D drive->lchs.head; + spt =3D drive->lchs.sector; + break; } // clip to 1024 cylinders in lchs if (cylinders > 1024) @@ -423,7 +438,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_HOST)) { 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..c1b8d734 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_HOST 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