From nobody Fri Apr 26 05:08: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