From nobody Fri Mar 29 08:01:07 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=1560332296; cv=none; d=zoho.com; s=zohoarc; b=ZJhM2avTFFk9gcYgDtyfHVaoxOZA3tNhpQTT3SYq1cXIDzwkgnX1QS5Sra5t/LtTosTgYRyCL6fQyAl/9KcAWm86VFslYp7m/nRk2HsqfHGavUGdOlkPoamLbwdSXXc3FrBSTvpn9fmWSeRKhsRzwMfPkOu1TGGyakX+iYolZxw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560332296; 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=kT/dxkiURIPH4buGo7tRyrnWw8zYzq19ZK9MMI+9MTw=; b=PudlkryOo53SFut3bPk4mf3ezY+UAGRN57LijBB/hVFXpKv5uskK/MgfqlTp6ppF7+FOjfq0Ly0HBPD5Ey7rqUqzCAJEYac3I4QxyZYryY6wakgkcIqVihwwq7koFtENwOHO+c2vVCWUtzhgAUaac4jEMzo8hfJ8AgU/EHDGjkM= 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 1560332296405937.2725188840037; Wed, 12 Jun 2019 02:38: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 8A3B612E2ECB; Wed, 12 Jun 2019 09:38:11 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by coreboot.org (Postfix) with ESMTP id DDB5912E2EC2 for ; Wed, 12 Jun 2019 09:37:53 +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 x5C9YERk193659; Wed, 12 Jun 2019 09:37:23 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2t05nqt7dm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 09:37:23 +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 x5C9atrD052470; Wed, 12 Jun 2019 09:37:22 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 2t04hyu8pm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 09:37:22 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5C9bMWp015059; Wed, 12 Jun 2019 09:37:22 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 12 Jun 2019 02:37:21 -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=OYAdHOPURsCre48CEcT538KIau1WSKYRwQ/T56tPA7k=; b=mYQigMsayh+pnLDPk1kRPQ/1ppCia19uZ+lgfpkCALOAQnPWUUT+xui0DQ0Jq/aQ0pKr r1kRIgpvoGcgDgN3tunA+3cwWwL7cWd9sU9wTi2mSNPPgc9zv7QscqeZRa9RNfCCBN/j eSxkJoEe9ke4BnfFVxppM8rezSuElPG1St9ZSc09dqMklpyx13wC5FmHJ/TUkHeI7PiW KlLhwdFsDIRv3nOiXlalUljzibq58f2yfR+M5iK47rkOJ0m4Xl42fCaCg36w+fFp6xbw UDh5s8AcrKR89z2MdFnDUV0RetPwh6e+AoVn/YX15BZ+epnY2exVLY5D/63TBO7bCmlh tw== From: Sam Eiderman To: seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net, kwolf@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com Date: Wed, 12 Jun 2019 12:37:00 +0300 Message-Id: <20190612093704.47175-2-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190612093704.47175-1-shmuel.eiderman@oracle.com> References: <20190612093704.47175-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 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-1906120066 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 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-1906120066 Message-ID-Hash: KEEZGU27UKD6NALEICFQYYMADMOXMNWE X-Message-ID-Hash: KEEZGU27UKD6NALEICFQYYMADMOXMNWE X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: arbel.moshe@oracle.com, karl.heubaum@oracle.com X-Mailman-Version: 3.2.2 Precedence: list Subject: [SeaBIOS] [PATCH 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 boot device information from fw_cfg. Boot device information will contain logical geometry (LCHS) values, but it is implemented in a manner which allows extension. 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. As mentioned, this interface may be easily extended to support more information per hdd. Boot device information is serialized in the following way: * struct_size (u32) * device path (sz string) * device information (struct_size) ... * device path (sz string) * device information (struct_size) 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 | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 87 insertions(+) diff --git a/src/boot.c b/src/boot.c index 5acf94fe..461de86e 100644 --- a/src/boot.c +++ b/src/boot.c @@ -24,6 +24,92 @@ =20 =20 /**************************************************************** + * Boot device parameters + ****************************************************************/ + +typedef struct BootDeviceSerialized { + u32 lcyls; + u32 lheads; + u32 lsecs; +} PACKED BootDeviceSerialized; + +typedef struct BootDevice { + char *name; + u32 lcyls; + u32 lheads; + u32 lsecs; +} BootDevice; + +static BootDevice *BootDevices VARVERIFY32INIT; +static int BootDeviceCount; + +static void +loadBootDevices(void) +{ + BootDeviceCount =3D 0; + int fsize; + char *f =3D romfile_loadfile("bootdevices", &fsize); + if (!f) + return; + + if (fsize < sizeof(u32)) + return; + + u32 struct_size =3D *((u32 *)f); + if (struct_size < sizeof(BootDeviceSerialized)) + return; + + fsize -=3D sizeof(u32); + f +=3D sizeof(u32); + + 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; + BootDeviceCount++; + } else + break; + } + + BootDevices =3D malloc_tmphigh(BootDeviceCount * sizeof(BootDevice)); + if (!BootDevices) { + warn_noalloc(); + free(f); + BootDeviceCount =3D 0; + return; + } + + dprintf(1, "boot devices:\n"); + + BootDeviceSerialized *blk; + BootDevice *d; + + for (i =3D 0; i < BootDeviceCount; i++) { + d =3D &BootDevices[i]; + d->name =3D f; + f +=3D strlen(f) + 1; + + blk =3D (BootDeviceSerialized *)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 +374,7 @@ boot_init(void) BootRetryTime =3D romfile_loadint("etc/boot-fail-wait", 60*1000); =20 loadBootOrder(); + loadBootDevices(); } =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 Mar 29 08:01:07 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=1560332302; cv=none; d=zoho.com; s=zohoarc; b=ORjrq9hUCG6tOeX9UhPcC5bbpmPfl3dJw3t2IPQxkEolmHZ/S9MUsmyO1REGLX+WQ4As5t8qhYpWCycI6MG2pM/M7dLIsQfW0T8ABDlvbN1dwrVlT+ZUUpDxs53j62BUzs4+qqRk84rIdvhhy8oA1TtCyp07+yF/N6z4l/SCfXo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560332302; 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=yjRzv6F5ImIqBNlHUkHhXp0TCemyaCM7XDtWbGvz30g=; b=MCYKk6nBANL6Ttjuz8/KNbUG4x8jwwqz/oT4udyWAjEmnAxUbiNCXXvYWkrO2WQyMWSBjMGxsS27psOe/xwReJSs0F4/lUVlysk3mH5Rq7mo50NZl1jFeFaOjThKrRncpsjypXrbp6/gW5eJm8cehzUFG06eSXkULpkQ+FS8k8E= 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 1560332302670332.8527710432452; Wed, 12 Jun 2019 02:38:22 -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 7733412E2ECC; Wed, 12 Jun 2019 09:38:17 +0000 (UTC) Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by coreboot.org (Postfix) with ESMTP id A927C12E2EC2 for ; Wed, 12 Jun 2019 09:37:59 +0000 (UTC) Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5C9XtlG007562; Wed, 12 Jun 2019 09:37:27 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 2t02hete9e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 09:37:27 +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 x5C9aoEn182421; Wed, 12 Jun 2019 09:37:26 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2t1jphx822-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 09:37:26 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5C9bOI1032744; Wed, 12 Jun 2019 09:37:25 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 12 Jun 2019 02:37:24 -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=UA7mwvtSikQgVV4swgmKCE2zvmRnIQn3jL7svTBBQE0=; b=4N1G8Fl68lkJWne3Zdde2Sfg0r8QCGQfWgur9vTmZyUAQTQZZaUObuT1+YFCn+tDdJwr MXPnWlE+ai+pe9EPOCL0a4FBX0xTN8Uf/nu0Vr4hmgKl+XaZ+Ea/piNziDCE05P9orS3 8E0ea0kucN6RrzohXCN5l6PCPLgD2h5w82KkMTyo1pygeJqlmVWlRYHEdYD9OsitYn12 1luRG1+GghRZrRN/vgIhMmNkt4Bf9LlfBbVnZW2ergr8U0A3PBlIXjpL9p9E6TxJsCqk D9de6KW03RDdcjYdxj3893Yludxu005JRcp2cR2FMfE99SmJvK/YWW0hNXG4J4WeC5vI uQ== From: Sam Eiderman To: seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net, kwolf@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com Date: Wed, 12 Jun 2019 12:37:01 +0300 Message-Id: <20190612093704.47175-3-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190612093704.47175-1-shmuel.eiderman@oracle.com> References: <20190612093704.47175-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 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-1906120066 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 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-1906120066 Message-ID-Hash: Q5H6Y3PCSIJRI3RC7AF5NTN2JIQEQKHQ X-Message-ID-Hash: Q5H6Y3PCSIJRI3RC7AF5NTN2JIQEQKHQ X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: arbel.moshe@oracle.com, karl.heubaum@oracle.com X-Mailman-Version: 3.2.2 Precedence: list Subject: [SeaBIOS] [PATCH 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 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" 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 461de86e..b3d49304 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 parameters @@ -154,29 +203,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) @@ -189,28 +215,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 Mar 29 08:01:07 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=1560332279; cv=none; d=zoho.com; s=zohoarc; b=VKBQF0icpZy8+DwbwiwluRyEHqAckWyqfyGroKDAgbarnq5wxZ0AxNacvUe/58h1yPDZte3N+rfhdeJIsd3GkjEYMX4s/BI/hRzEWgyfDCH20LqV+UkOdpRvVTNlEZxzCYmpKteB8dJWcbvICCLYXZbxl7yadJUkhSF1GRXb7KM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560332279; 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=CV/oXTY4YsalYpdB9Ai3MQK0pr4v86KIFnmOAiKR3tY=; b=ZWKDRZHTlIjfPwUNHqQjhVb9Jty/teTP+wn05XhtO4w0qOb7GsZAOH5rNm2cA/vU3WRVdPfNhXCog4j+JQ5RT16f+76XisVtA78zSPilg0qP4OrtqAf9ieR2p0apHtl18mKE23sh6lVeWfU3+kDZDpXPH6M10ePCkP57yeM1VTA= 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 1560332278998521.765330212421; Wed, 12 Jun 2019 02:37:58 -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 5948112E2EC4; Wed, 12 Jun 2019 09:37:54 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by coreboot.org (Postfix) with ESMTP id CAA5912E2EAA for ; Wed, 12 Jun 2019 09:37:41 +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 x5C9XjJc193216; Wed, 12 Jun 2019 09:37:29 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 2t05nqt7dv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 09:37:29 +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 x5C9aonq182430; Wed, 12 Jun 2019 09:37:28 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 2t1jphx833-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 09:37:28 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5C9bRuD017025; Wed, 12 Jun 2019 09:37:27 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 12 Jun 2019 02:37:27 -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=fwuS4OY+SX6hwpdwhnLGw0ixH/rHtEfLdA7s9goGmmM=; b=kmQl6Tquu3o+Ej3uDdF/booJ3rNHwJaxt53ejzihHW+t9TB268XzCuldLt5TBKvN/r9O wF7pLWczvkZYl4x4qtjCU9I9EUG/p2hRGeCuG9/NLwmTCeJKk3cL+ppEnJPBTkgOvPj+ 4Hop3CF+Mj53SR091qNyNJNDU3mEm68Sg96umHAsMUgRLLUKAANdJ2bIoJy416KauhyT 2WztdnE4b32qThZBEnZhRLE4fuA5GVU3HX7yYR+ajezg+2m+eooUFhN12CuctlZTF+ZU NTyKkc/7H0RH/YyX6v+gDXxyJsDkoGAJEch4A8jgcKwDpHxMEtGClbgTTFzPx5bFyJng Zw== From: Sam Eiderman To: seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net, kwolf@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com Date: Wed, 12 Jun 2019 12:37:02 +0300 Message-Id: <20190612093704.47175-4-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190612093704.47175-1-shmuel.eiderman@oracle.com> References: <20190612093704.47175-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 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-1906120066 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 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-1906120066 Message-ID-Hash: QICFCG6KGNC2X5CT67WAN6W5UCC6UJRI X-Message-ID-Hash: QICFCG6KGNC2X5CT67WAN6W5UCC6UJRI X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: arbel.moshe@oracle.com, karl.heubaum@oracle.com X-Mailman-Version: 3.2.2 Precedence: list Subject: [SeaBIOS] [PATCH 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 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" 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 | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ src/util.h | 6 +++++ 2 files changed, 88 insertions(+) diff --git a/src/boot.c b/src/boot.c index b3d49304..9248fab9 100644 --- a/src/boot.c +++ b/src/boot.c @@ -157,6 +157,88 @@ loadBootDevices(void) } } =20 +// Search the bootdevices list for the given glob pattern. +static BootDevice * +bootdevice_find(const char *glob) +{ + dprintf(1, "Searching bootdevices for: %s\n", glob); + int i; + for (i =3D 0; i < BootDeviceCount; i++) + if (glob_prefix(glob, BootDevices[i].name)) + return &BootDevices[i]; + return NULL; +} + +static BootDevice * +bootdevice_find_pci_device(struct pci_device *pci) +{ + // Find pci device - for example: /pci@i0cf8/ethernet@5 + char desc[256]; + build_pci_path(desc, sizeof(desc), "*", pci); + return bootdevice_find(desc); +} + +static BootDevice * +bootdevice_find_scsi_device(struct pci_device *pci, int target, int lun) +{ + if (!pci) + // support only pci machine for now + return NULL; + // 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); + return bootdevice_find(desc); +} + +static BootDevice * +bootdevice_find_ata_device(struct pci_device *pci, int chanid, int slave) +{ + if (!pci) + // support only pci machine for now + return NULL; + // 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); + return bootdevice_find(desc); +} + +int boot_lchs_find_pci_device(struct pci_device *pci, struct chs_s *chs) +{ + BootDevice *b =3D bootdevice_find_pci_device(pci); + 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) +{ + BootDevice *b =3D bootdevice_find_scsi_device(pci, target, lun); + 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) +{ + BootDevice *b =3D bootdevice_find_ata_device(pci, chanid, slave); + 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 Mar 29 08:01:07 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=1560332287; cv=none; d=zoho.com; s=zohoarc; b=F2nAuLbU7JgrjrujunIC/O6zAY6WyUkMOumaQxobF4OfVvAfAl/AY4PUhFgx4M7kpqHFEbrsR5FhRYu/+yiz5i4oVVfiv2JpzOidZEY3QnVyZvkIQC8fYnYSDF2fDBvhVD15ovOH/cqu8VhDN8u52jzWv+k5KaLOjPYpiHjw+Vc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560332287; 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=PeDI+cxLSoFV3uNX48NZiKtH1R+M/nB0XN0Ac8LqOT0=; b=LAWOm2/3xDoJZl7V3O6AjKIo/svcy44cEtkI2pfBDBdsEOgJjovL7RyYz6TZt7vlhIPUSBgvrWVsrISs0WELRuQwY0Wm+NuNoOAEPhf1a5zMdtz4c5rrL3yLoyf+oMB2JLBFzE7CSTMeGj+pXT79TM4HO+oYOc+LpcltLjoHu/o= 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 1560332287714758.7581226624934; Wed, 12 Jun 2019 02:38:07 -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 1203112E2EC8; Wed, 12 Jun 2019 09:38:03 +0000 (UTC) Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by coreboot.org (Postfix) with ESMTP id 9C19E12E2EC6 for ; Wed, 12 Jun 2019 09:37:54 +0000 (UTC) Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5C9XnxA007494; Wed, 12 Jun 2019 09:37:31 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 2t02hetea0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 09:37:31 +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 x5C9atrE052470; Wed, 12 Jun 2019 09:37:31 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2t04hyu8rj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 09:37:30 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5C9bU55000342; Wed, 12 Jun 2019 09:37:30 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 12 Jun 2019 02:37:30 -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=BlGgCWhzoEcmkpG4cDlZVUBAAZPEFbNi+NpVkxuRpWw=; b=iFKojhJDNpC1LhBqf+w5M2aR77M23QiVPA3BPv2em4IZbSGxbHaH0RaE2IPdIDTt3WE4 fIq/SFYFzh+bVvinao6qm8jWiMBFx8aq7+tS+hkr2519kU2k6LAqAsayfaPWb2FM5mne 5oZohacCSPwdD69aeFNaGQ7A7WIemj+W8CcotDMG1yWLKYC1sB/brKgkNc7DXgrICXhM /KJuTV7mm7HrBJc++6Fs3qaWLiaVQ7DX6yiWHoziM41JFWnWB5rD1xgK2uVwBZ5xNraH 5oHhZXHgcbBJ6MfhwJLSMa34pa2th6HRIEcE6iHDd+gjx422U8VY2M0hUIfnY77MFgKQ Mg== From: Sam Eiderman To: seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net, kwolf@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com Date: Wed, 12 Jun 2019 12:37:03 +0300 Message-Id: <20190612093704.47175-5-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190612093704.47175-1-shmuel.eiderman@oracle.com> References: <20190612093704.47175-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 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-1906120066 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 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-1906120066 Message-ID-Hash: UNNCWN3C7YYICRQ544I3BJUJAFIQTFT7 X-Message-ID-Hash: UNNCWN3C7YYICRQ544I3BJUJAFIQTFT7 X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: arbel.moshe@oracle.com, karl.heubaum@oracle.com X-Mailman-Version: 3.2.2 Precedence: list Subject: [SeaBIOS] [PATCH 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 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" Add the "BOOTDEVICES" 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 | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/src/Kconfig b/src/Kconfig index 55a87cb7..b3645b33 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 BOOTDEVICES + depends on BOOT + bool "Boot device information" + default y + help + Support boot device information via the fw_cfg/CBFS + "bootdevices" file. =20 config COREBOOT_FLASH depends on COREBOOT diff --git a/src/boot.c b/src/boot.c index 9248fab9..e89b9238 100644 --- a/src/boot.c +++ b/src/boot.c @@ -95,6 +95,9 @@ static int BootDeviceCount; static void loadBootDevices(void) { + if (!CONFIG_BOOTDEVICES) + return; + BootDeviceCount =3D 0; int fsize; char *f =3D romfile_loadfile("bootdevices", &fsize); @@ -172,6 +175,8 @@ bootdevice_find(const char *glob) static BootDevice * bootdevice_find_pci_device(struct pci_device *pci) { + if (!CONFIG_BOOTDEVICES) + return NULL; // Find pci device - for example: /pci@i0cf8/ethernet@5 char desc[256]; build_pci_path(desc, sizeof(desc), "*", pci); @@ -181,6 +186,8 @@ bootdevice_find_pci_device(struct pci_device *pci) static BootDevice * bootdevice_find_scsi_device(struct pci_device *pci, int target, int lun) { + if (!CONFIG_BOOTDEVICES) + return NULL; if (!pci) // support only pci machine for now return NULL; @@ -194,6 +201,8 @@ bootdevice_find_scsi_device(struct pci_device *pci, int= target, int lun) static BootDevice * bootdevice_find_ata_device(struct pci_device *pci, int chanid, int slave) { + if (!CONFIG_BOOTDEVICES) + return NULL; if (!pci) // support only pci machine for now return NULL; --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Mar 29 08:01:07 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=1560332315; cv=none; d=zoho.com; s=zohoarc; b=iAIaLB8Sj7//6d3MZbgWjmUt6QHADo9Hyk+ZAryfYVYwz5fpUe44WwX7vNmp0/aPiI52FAV5GF5okKl5T9OelBPzo9ufS6tKh5+DgB9iBxmbKOXjNkEijRLIq+zSubTGrPnw43tvRVcacCt/pgcJI8slJEKyQhfRtlb/XtU/BZE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560332315; 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=WvKRQRZW97gjAf2+Ito+JJHK1OG3B0oJCdyXRRwZB12Wcc/DALi0+4oOPAS2luX4Pv9eDNT+jGmsyaJAl34ZXgF+wJJGrLi8L2YUln2hGinqegDZ53S56fpGLgKh8f6Oa0iSnMd2Nc4ypyS2Et8zjD+JNG2zxsm8aZGWSN6npTM= 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 1560332315876487.8297797069647; Wed, 12 Jun 2019 02:38:35 -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 957AC12E2EDE; Wed, 12 Jun 2019 09:38:29 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by coreboot.org (Postfix) with ESMTP id 1145612E2ED2 for ; Wed, 12 Jun 2019 09:38:07 +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 x5C9XdGC193173; Wed, 12 Jun 2019 09:37:34 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2t05nqt7e6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 09:37:34 +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 x5C9bI3B053056; Wed, 12 Jun 2019 09:37:33 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 2t04hyu8sb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 09:37:33 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5C9bXOx015136; Wed, 12 Jun 2019 09:37:33 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 12 Jun 2019 02:37: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=sjPeSH85H7YwPjSGcoXeELaYEDE4MR8f1zSgfJn1kfA=; b=uVYrwdMdEoZJleKjpCm42YJJJA0xXg95/6TiL9IF8qCZy1wfi3BOvUtrKkEAQmHulgI6 D2o9J3J+La9NrbR7ecQapaTLfDq0HaZaNziFmKWmLt9MQQxyUo6TEW4B6o4haMc3eCbG fUfJBcAHW6LT5scVmjnOnIeT0tANY7GPfVow/LlmYz5aZlt9wSb9IAa90HFcPdaGi7ig fyY5graM3U+5OHe8MxrUE74LBB0vgrYiJjRRNt8t1UT6r5GytQ4ppZvMN9VjkMFWbbx5 tHSv2Aort8HtAStEM0qNidVeORJsxnd52AD26CmJYljU15K5giwh121jKw1NaOh4L0F+ 5A== From: Sam Eiderman To: seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net, kwolf@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com Date: Wed, 12 Jun 2019 12:37:04 +0300 Message-Id: <20190612093704.47175-6-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190612093704.47175-1-shmuel.eiderman@oracle.com> References: <20190612093704.47175-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 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-1906120066 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 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-1906120066 X-Spam-Level: ** Message-ID-Hash: RSEZO7C7DAVUO66NHIH6TKAVLAVOYBI5 X-Message-ID-Hash: RSEZO7C7DAVUO66NHIH6TKAVLAVOYBI5 X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: arbel.moshe@oracle.com, karl.heubaum@oracle.com X-Mailman-Version: 3.2.2 Precedence: list Subject: [SeaBIOS] [PATCH 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