From patchwork Wed Jun 19 09:23:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Eiderman X-Patchwork-Id: 11003739 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF40414B6 for ; Wed, 19 Jun 2019 09:26:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D02002888D for ; Wed, 19 Jun 2019 09:26:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C427028B5F; Wed, 19 Jun 2019 09:26:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 525C028B25 for ; Wed, 19 Jun 2019 09:26:17 +0000 (UTC) Received: from localhost ([::1]:36106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdWrA-0002IM-Ab for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Jun 2019 05:26:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35272) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdWpE-0000FI-TF for qemu-devel@nongnu.org; Wed, 19 Jun 2019 05:24:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdWpD-0002Xm-El for qemu-devel@nongnu.org; Wed, 19 Jun 2019 05:24:16 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:36288) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdWpA-0002S6-PT; Wed, 19 Jun 2019 05:24:13 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5J9O9OA078119; Wed, 19 Jun 2019 09:24:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=XYssG+J/294GjGfqMpD5KUXLrc6cguktTtRRpAjXxbY=; b=y9Ik4do3tfeJEdpTvORrk7TpPmT8/LZgIF3u6owYv4l8dJRJvh8x94HfGAdvBxesM/hY wPHWOCERy2ILfHET0G99Rr26UEmVf02CxdwMM7MuYnGLL4jPs9kaEuR9WMrZDqCOd0iR ig4m99gZ3wLBB23HXRO2IDCJn7ilUJB4lIK4LC/WGlnuJmXRsi0Kzo9rGtVIK6RzlVZ/ OFIVQ4mc+Yb8GnpmG/pHAX1eeqIdsC1+ExyGVD5PBq5bENKTYg/eclPtKB2y2b+SxmGe s7dt9ec7oQEmYR1hIorRgNlO/AL2Oh5Y6++uIj/Kbwsbgo3S+qXeiEjsbgY0dn+OPC/2 4w== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 2t7809a81d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2019 09:24:09 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5J9NDfo114792; Wed, 19 Jun 2019 09:24:09 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 2t77yn7rt7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2019 09:24:09 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5J9O8OU008584; Wed, 19 Jun 2019 09:24:08 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Jun 2019 02:24:07 -0700 From: Sam Eiderman To: kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Wed, 19 Jun 2019 12:23:49 +0300 Message-Id: <20190619092352.23583-2-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190619092352.23583-1-shmuel.eiderman@oracle.com> References: <20190619092352.23583-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9292 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906190077 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9292 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906190077 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 141.146.126.78 Subject: [Qemu-devel] [SeaBIOS] [PATCH v3 1/4] geometry: Read LCHS from fw_cfg X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liran.alon@oracle.com, shmuel.eiderman@oracle.com, karl.heubaum@oracle.com, arbel.moshe@oracle.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 @@ /**************************************************************** + * 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 = 0; + if (cur) { + while ('0' <= *cur && *cur <= '9') { + m = 10 * m + (*cur - '0'); + cur++; + } + if (*cur != '\0') + cur++; + } + *n = m; + return cur; +} + +static void +loadBiosGeometry(void) +{ + char *f = romfile_loadfile("bios-geometry", NULL); + if (!f) + return; + + int i = 0; + BiosGeometryCount = 1; + while (f[i]) { + if (f[i] == '\n') + BiosGeometryCount++; + i++; + } + BiosGeometry = malloc_tmphigh(BiosGeometryCount * sizeof(BootDeviceLCHS)); + if (!BiosGeometry) { + warn_noalloc(); + free(f); + BiosGeometryCount = 0; + return; + } + + dprintf(1, "bios geometry:\n"); + i = 0; + do { + BootDeviceLCHS *d = &BiosGeometry[i]; + d->name = f; + f = strchr(f, '\n'); + if (f) + *(f++) = '\0'; + char *chs_values = strchr(d->name, ' '); + if (chs_values) + *(chs_values++) = '\0'; + chs_values = parse_u32(chs_values, &d->lcyls); + chs_values = parse_u32(chs_values, &d->lheads); + chs_values = 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 ****************************************************************/ @@ -288,6 +361,7 @@ boot_init(void) BootRetryTime = romfile_loadint("etc/boot-fail-wait", 60*1000); loadBootOrder(); + loadBiosGeometry(); } From patchwork Wed Jun 19 09:23:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Eiderman X-Patchwork-Id: 11003743 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5B65514B6 for ; Wed, 19 Jun 2019 09:26:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BDCB2888D for ; Wed, 19 Jun 2019 09:26:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FC5828B63; Wed, 19 Jun 2019 09:26:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C3A1528B5F for ; Wed, 19 Jun 2019 09:26:25 +0000 (UTC) Received: from localhost ([::1]:36110 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdWrJ-0002XC-47 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Jun 2019 05:26:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35289) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdWpG-0000GL-5j for qemu-devel@nongnu.org; Wed, 19 Jun 2019 05:24:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdWpE-0002Ze-Ul for qemu-devel@nongnu.org; Wed, 19 Jun 2019 05:24:18 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:33206) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdWpC-0002Uf-2M; Wed, 19 Jun 2019 05:24:14 -0400 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 x5J9OCh3177697; Wed, 19 Jun 2019 09:24:12 GMT 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=oQR4xmjeWzbZhcXNjv3T066XNj13Gh9vtd86d476e9c=; b=RZj5w+ewlTDavhf2pni6SvJQS1y7QTsdx4UsUyY7Th9n7uIPUs0I1ORb91liyFVVem3g ifGfT+Stx8epyduls5jSCuXle47IDuGRbTvctS901ImDk3D5DSjebbp4f2dDP2oBt/RD Mv385y4cQQg2er96QNHZ/uu/Fiv0x15ppeMeWEfGt644GDPVqXkelNt1/d3mjSRx7p2v KPWP3GYDCUk3omNf33Ik07gdd/BFOV+m0xBO6ZKRXhxq1Dh2HZUuFX1wAUebxsCJ8nYN GNtFvpWlYprNSazr7vxThpqaUMZtbdqhpIjzZ86OnGJFETCt/r5se9cS/srsbtvY6n5R XA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2t7809a8xb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2019 09:24:12 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5J9NbxL182104; Wed, 19 Jun 2019 09:24:12 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 2t77ymyr9r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2019 09:24:11 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5J9OALs001961; Wed, 19 Jun 2019 09:24:10 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Jun 2019 02:24:10 -0700 From: Sam Eiderman To: kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Wed, 19 Jun 2019 12:23:50 +0300 Message-Id: <20190619092352.23583-3-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190619092352.23583-1-shmuel.eiderman@oracle.com> References: <20190619092352.23583-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9292 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=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-1906190077 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9292 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=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-1906190077 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.85 Subject: [Qemu-devel] [SeaBIOS] [PATCH v3 2/4] boot: Reorder functions in boot.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liran.alon@oracle.com, shmuel.eiderman@oracle.com, karl.heubaum@oracle.com, arbel.moshe@oracle.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 a2cb167c..70f639f4 100644 --- a/src/boot.c +++ b/src/boot.c @@ -22,6 +22,55 @@ #include "util.h" // irqtimer_calc #include "tcgbios.h" // tpm_* +/**************************************************************** + * 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 == '/')) + return (char*)str; + if (*glob == '*') { + if (!*str || *str == '/' || *str == glob[1]) + glob++; + else + str++; + continue; + } + if (*glob != *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 = buf; + if (pci->parent) { + p = build_pci_path(p, max, "pci-bridge", pci->parent); + } else { + p += snprintf(p, buf+max-p, "%s", FW_PCI_DOMAIN); + if (pci->rootbus) + p += snprintf(p, buf+max-p, ",%x", pci->rootbus); + } + + int dev = pci_bdf_to_dev(pci->bdf), fn = pci_bdf_to_fn(pci->bdf); + p += snprintf(p, buf+max-p, "/%s@%x", devname, dev); + if (fn) + p += snprintf(p, buf+max-p, ",%x", fn); + return p; +} + /**************************************************************** * Boot device logical geometry @@ -141,29 +190,6 @@ loadBootOrder(void) } while (f); } -// 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 == '/')) - return (char*)str; - if (*glob == '*') { - if (!*str || *str == '/' || *str == glob[1]) - glob++; - else - str++; - continue; - } - if (*glob != *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; } -#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 = buf; - if (pci->parent) { - p = build_pci_path(p, max, "pci-bridge", pci->parent); - } else { - p += snprintf(p, buf+max-p, "%s", FW_PCI_DOMAIN); - if (pci->rootbus) - p += snprintf(p, buf+max-p, ",%x", pci->rootbus); - } - - int dev = pci_bdf_to_dev(pci->bdf), fn = pci_bdf_to_fn(pci->bdf); - p += snprintf(p, buf+max-p, "/%s@%x", devname, dev); - if (fn) - p += snprintf(p, buf+max-p, ",%x", fn); - return p; -} - int bootprio_find_pci_device(struct pci_device *pci) { if (CONFIG_CSM) From patchwork Wed Jun 19 09:23:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Eiderman X-Patchwork-Id: 11003741 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 279C6112C for ; Wed, 19 Jun 2019 09:26:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16C2E28B30 for ; Wed, 19 Jun 2019 09:26:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A4F328B25; Wed, 19 Jun 2019 09:26:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8165E28B63 for ; Wed, 19 Jun 2019 09:26:19 +0000 (UTC) Received: from localhost ([::1]:36108 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdWrC-0002Mi-OA for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Jun 2019 05:26:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35324) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdWpL-0000Iv-Ht for qemu-devel@nongnu.org; Wed, 19 Jun 2019 05:24:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdWpI-0002dw-M9 for qemu-devel@nongnu.org; Wed, 19 Jun 2019 05:24:23 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:33252) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdWpE-0002YQ-LE; Wed, 19 Jun 2019 05:24:16 -0400 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 x5J9O95d177653; Wed, 19 Jun 2019 09:24:14 GMT 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=wvpnkC7GQxdexKRwJnYoH+7QRuTfTDL3YzlS5ObIQe0=; b=Y7Q0L2ZQgOJ00oeQADy+vkiwoFMjkv3UoC7M6Fg553DSvaeOsTLaNNRf/AV0yFsyiRY/ rN3qj3NY0Fdu1sqMZER2cpn4TxwNUt15H6MC1AbIeMh6EJUVF971U8J9ahY7jjQF091m fUlnNa7OUaCPtdZFIUorsj1jx3C8WidCeQhoDXO39j4xbmiKAZebKd90q9pOzBxWv4J6 /jATz8+5QBDjmSbH4/CxaYn1qAqIcBvXqmv4xpklkq3pnbgOny6zIAzMW9ICWcByInT4 zWI5e5WaFzfdTTzQvbOVxv3kfS8i3fu5eb0gaEPERp2pS2476vkHr3jywSU6VxpWVtus Xw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2t7809a8xk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2019 09:24:14 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5J9NbXv182190; Wed, 19 Jun 2019 09:24:14 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2t77ymyrbd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2019 09:24:14 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5J9ODcg023988; Wed, 19 Jun 2019 09:24:13 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Jun 2019 02:24:13 -0700 From: Sam Eiderman To: kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Wed, 19 Jun 2019 12:23:51 +0300 Message-Id: <20190619092352.23583-4-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190619092352.23583-1-shmuel.eiderman@oracle.com> References: <20190619092352.23583-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9292 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=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-1906190077 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9292 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=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-1906190077 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.85 Subject: [Qemu-devel] [SeaBIOS] [PATCH v3 3/4] geometry: Add boot_lchs_find_*() utility functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liran.alon@oracle.com, shmuel.eiderman@oracle.com, karl.heubaum@oracle.com, arbel.moshe@oracle.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/util.h | 6 ++++++ 3 files changed, 84 insertions(+) diff --git a/src/Kconfig b/src/Kconfig index 55a87cb7..0b4c1c0d 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -72,6 +72,13 @@ endchoice help Support controlling of the boot order via the fw_cfg/CBFS "bootorder" file. + config BIOS_GEOMETRY + depends on BOOT + bool "Boot device bios geometry override" + default y + help + Support overriding bios (logical) geometry of boot devices via the + fw_cfg/CBFS "bios-geometry" file. config COREBOOT_FLASH depends on COREBOOT diff --git a/src/boot.c b/src/boot.c index 70f639f4..308d9559 100644 --- a/src/boot.c +++ b/src/boot.c @@ -105,6 +105,8 @@ parse_u32(char *cur, u32 *n) static void loadBiosGeometry(void) { + if (!CONFIG_BIOS_GEOMETRY) + return; char *f = romfile_loadfile("bios-geometry", NULL); if (!f) return; @@ -144,6 +146,75 @@ loadBiosGeometry(void) } while (f); } +// 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 = 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_BIOS_GEOMETRY) + return -1; + char desc[256]; + build_pci_path(desc, sizeof(desc), "*", pci); + BootDeviceLCHS *b = boot_lchs_find(desc); + if (!b) + return -1; + chs->cylinder = (u16)b->lcyls; + chs->head = (u16)b->lheads; + chs->sector = (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_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], *p; + p = build_pci_path(desc, sizeof(desc), "*", pci); + snprintf(p, desc+sizeof(desc)-p, "/*@0/*@%x,%x", target, lun); + BootDeviceLCHS *b = boot_lchs_find(desc); + if (!b) + return -1; + chs->cylinder = (u16)b->lcyls; + chs->head = (u16)b->lheads; + chs->sector = (u16)b->lsecs; + return 0; +} + +int boot_lchs_find_ata_device(struct pci_device *pci, int chanid, int slave, + struct chs_s *chs) +{ + if (!CONFIG_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], *p; + p = build_pci_path(desc, sizeof(desc), "*", pci); + snprintf(p, desc+sizeof(desc)-p, "/drive@%x/disk@%x", chanid, slave); + BootDeviceLCHS *b = boot_lchs_find(desc); + if (!b) + return -1; + chs->cylinder = (u16)b->lcyls; + chs->head = (u16)b->lheads; + chs->sector = (u16)b->lsecs; + return 0; +} + /**************************************************************** * 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 slave, + struct chs_s *chs); // bootsplash.c void enable_vga_console(void); From patchwork Wed Jun 19 09:23:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Eiderman X-Patchwork-Id: 11003749 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 27F49924 for ; Wed, 19 Jun 2019 09:32:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17A2E28BB1 for ; Wed, 19 Jun 2019 09:32:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B45428BBB; Wed, 19 Jun 2019 09:32:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 53ABB28BB9 for ; Wed, 19 Jun 2019 09:32:15 +0000 (UTC) Received: from localhost ([::1]:36180 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdWww-0006L6-7x for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Jun 2019 05:32:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35334) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdWpN-0000Ll-J5 for qemu-devel@nongnu.org; Wed, 19 Jun 2019 05:24:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdWpK-0002fh-PF for qemu-devel@nongnu.org; Wed, 19 Jun 2019 05:24:24 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:33290) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdWpH-0002bF-3w; Wed, 19 Jun 2019 05:24:19 -0400 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 x5J9OGRJ177740; Wed, 19 Jun 2019 09:24:17 GMT 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=tGNYojg/9cxQAz8fsaaGTRdazTtVL4X86lnQVx/VsG6vfVO+kjt+HNPnk9vVLaLz1rib ZYmbLGdwEo9TVEz9jwzX1UfXdupVUeU9ynujJtkTJs6TxALXTlL8vfortF/2GgtsI+C3 2US6hRpG/yztK1PjlUHksZ5aBvLeu+8CNsAfukumPQf3dRw4dDo6XgkENmcMd334Ek1n OJWVUNY5LecoAweix4y4Vo/oUo5xz/Tfa9f2krOFJpEno7uwBnncgT68eO1JQBpZkDnQ ivD7013Y5tsqCzLVUlvIChmNNqZx5WG28oOLdrV6MnKQCRXSp2ipCAlHLBMt+oCr3SYL Xw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 2t7809a8xv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2019 09:24:17 +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 x5J9NAqH044644; Wed, 19 Jun 2019 09:24:16 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 2t77ymyrc7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2019 09:24:16 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5J9OFla002368; Wed, 19 Jun 2019 09:24:16 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Jun 2019 02:24:15 -0700 From: Sam Eiderman To: kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Wed, 19 Jun 2019 12:23:52 +0300 Message-Id: <20190619092352.23583-5-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190619092352.23583-1-shmuel.eiderman@oracle.com> References: <20190619092352.23583-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9292 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906190077 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9292 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906190077 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.85 Subject: [Qemu-devel] [SeaBIOS] [PATCH v3 4/4] geometry: Apply LCHS values for boot devices X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liran.alon@oracle.com, shmuel.eiderman@oracle.com, karl.heubaum@oracle.com, arbel.moshe@oracle.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 ****************************************************************/ +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 = drive->type; if (CONFIG_QEMU && type == 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 = "overriden"; + cylinders = drive->lchs.cylinder; + heads = drive->lchs.head; + if (heads > 255) + heads = 255; + spt = drive->lchs.sector; + if (spt > 63) + spt = 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 = 0; if (GET_GLOBALFLAT(drive_gf->type) == DTYPE_ATA) { u8 translation = GET_GLOBALFLAT(drive_gf->translation); - if (translation != TRANSLATION_NONE) { + if ((translation != TRANSLATION_NONE) && + (translation != TRANSLATION_MACHINE)) { options |= 1<<3; // CHS translation if (translation == TRANSLATION_LBA) options |= 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 #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 = bootprio_find_ata_device(ctrl->pci_tmp, pnr, 0); } + boot_lchs_find_ata_device(ctrl->pci_tmp, pnr, 0, &(port->drive.lchs)); return 0; } 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 = 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); } @@ -805,6 +809,10 @@ init_drive_ata(struct atadrive_s *dummy, u16 *buffer) int prio = 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); 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) char *name = 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 = bootprio_find_scsi_device(llun->pci, llun->target, llun->lun); int ret = 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); + boot_lchs_find_scsi_device(llun->pci, llun->target, llun->lun, + &(llun->drive.lchs)); char *name = znprintf(MAXDESCSIZE, "lsi %pP %d:%d", llun->pci, llun->target, llun->lun); int prio = 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 = znprintf(MAXDESCSIZE, "MegaRAID SAS (PCI %pP) LD %d:%d" , pci, target, lun); prio = 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); + boot_lchs_find_scsi_device(llun->pci, llun->target, llun->lun, + &(llun->drive.lchs)); char *name = znprintf(MAXDESCSIZE, "mpt %pP %d:%d", llun->pci, llun->target, llun->lun); int prio = 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 = iobase; plun->ring_dsc = ring_dsc; + boot_lchs_find_scsi_device(pci, target, lun, &(plun->drive.lchs)); char *name = znprintf(MAXDESCSIZE, "pvscsi %pP %d:%d", pci, target, lun); int prio = bootprio_find_scsi_device(pci, target, lun); int ret = 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) status |= VIRTIO_CONFIG_S_DRIVER_OK; vp_set_status(&vdrive->vp, status); + + boot_lchs_find_pci_device(pci, &vdrive->drive.lchs); return; 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->vq, tmpl_vlun->target, lun); + boot_lchs_find_scsi_device(vlun->pci, vlun->target, vlun->lun, + &(vlun->drive.lchs)); int prio = bootprio_find_scsi_device(vlun->pci, vlun->target, vlun->lun); int ret = scsi_drive_setup(&vlun->drive, "virtio-scsi", prio); if (ret)