From nobody Fri Dec 19 18:44:20 2025 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1561552796; cv=none; d=zoho.com; s=zohoarc; b=lJ1PnTfCnwfqOHwC6UAD3vuab+f1LtqXcOchjRcH4Wma7wsQtCc8Eb8/gA9XpgROJf4L5KdSlWZUr8loqJO1h1JMLSalGJ0loJzHipnBmdCYpZc4+rpKxNffC1yM0nFxXHPcyGfy+M+Lc5IZk8Fgs8moItXXd0h9T1FC4gTNMHs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561552796; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=R1HpbQeYUoZXJGvaNlo2K3ovfSgFF9ebmKnxEB/Muu0=; b=V8wtR28SDgC97namQj1leBVTZzam1IURz6FwHglQwsq6TIx8RnzCK6nJG2trU0GOi/79ivczXjlk6qqKu7SZmdbPimMqg0QM/CJegK0FT3VVSp9HQ0XVLkHctMOrM/qIhHz41zE0ZSTkId2XQaUn/WBQA2OoODTYt2gRcy/L4co= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1561552796642104.60593217842666; Wed, 26 Jun 2019 05:39:56 -0700 (PDT) Received: from [192.168.203.99] (mailu_mailman-core_1.mailu_default [192.168.203.99]) by coreboot.org (Postfix) with ESMTP id DBCCBBA0C16; Wed, 26 Jun 2019 12:39:50 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by coreboot.org (Postfix) with ESMTP id 525A7BA0BD9 for ; Wed, 26 Jun 2019 12:39:35 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5QCYAXj187602; Wed, 26 Jun 2019 12:38:40 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2t9brta44x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:38:40 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5QCbS3s021700; Wed, 26 Jun 2019 12:38:40 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2tat7ct4wp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:38:39 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5QCccf3002703; Wed, 26 Jun 2019 12:38:38 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Jun 2019 05:38:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=unrVc136npZDb5NaLZdO2sOpKQ7GyimxsHu2DkvWsbA=; b=RUE81+suKmwwjtIMKzcp24b6VzI1XH1QDTDrHWbXLU2z16MYpJwkc1fGoUN+GB2luf1h RzB9ZqtzlyyPFIU24J9Vd8sEFrtdjsEKAS4IjoBpugR6cvH2WSG0Hl6uG8Q9CECrZhlD bFS/3NqdDwmkIKZG4PNtYzZzfBakpcIPziBr6aD/zk6UEeivbRFM4swsiO2rK9Dbd2sq 2DcMkaPcORgABL6Y681KgUaNZh+LIjDyupxZ7l6XzqCCmKxMGDdU26t9IWVU0tnt1V3c ccjUqHDc+pxt1v5tXtAvY7UQvoXtiaGVPfcLzLyqBrFEzlunbM/e8RKp7lF2cVUb1bG7 mw== From: Sam Eiderman To: kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Wed, 26 Jun 2019 15:38:14 +0300 Message-Id: <20190626123816.8907-4-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190626123816.8907-1-shmuel.eiderman@oracle.com> References: <20190626123816.8907-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906260150 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906260150 Message-ID-Hash: RY33DRZZ3UK3UMQ3Q6BY2KUCHRRW4MRK X-Message-ID-Hash: RY33DRZZ3UK3UMQ3Q6BY2KUCHRRW4MRK X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: karl.heubaum@oracle.com, arbel.moshe@oracle.com X-Mailman-Version: 3.2.2 Precedence: list Subject: [SeaBIOS] [PATCH v4 3/5] boot: Build ata and scsi paths in function List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org X-Spamd-Bar: / X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Introduce build_scsi_path() and build_ata_path(). We will reuse these functions in the next commit. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- src/boot.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/boot.c b/src/boot.c index 70f639f4..52e1c8e6 100644 --- a/src/boot.c +++ b/src/boot.c @@ -71,6 +71,30 @@ build_pci_path(char *buf, int max, const char *devname, = struct pci_device *pci) return p; } =20 +static char * +build_scsi_path(char *buf, int max, + struct pci_device *pci, int target, int lun) +{ + // Build the string path of a scsi drive - for example: + // /pci@i0cf8/scsi@5/channel@0/disk@1,0 + char *p; + p =3D build_pci_path(buf, max, "*", pci); + p +=3D snprintf(p, buf+max-p, "/*@0/*@%x,%x", target, lun); + return p; +} + +static char * +build_ata_path(char *buf, int max, + struct pci_device *pci, int chanid, int slave) +{ + // Build the string path of an ata drive - for example: + // /pci@i0cf8/ide@1,1/drive@1/disk@0 + char *p; + p =3D build_pci_path(buf, max, "*", pci); + p +=3D snprintf(p, buf+max-p, "/drive@%x/disk@%x", chanid, slave); + return p; +} + =20 /**************************************************************** * Boot device logical geometry @@ -221,10 +245,8 @@ int bootprio_find_scsi_device(struct pci_device *pci, = int target, int lun) if (!pci) // support only pci machine for now return -1; - // Find scsi drive - for example: /pci@i0cf8/scsi@5/channel@0/disk@1,0 - char desc[256], *p; - p =3D build_pci_path(desc, sizeof(desc), "*", pci); - snprintf(p, desc+sizeof(desc)-p, "/*@0/*@%x,%x", target, lun); + char desc[256]; + build_scsi_path(desc, sizeof(desc), pci, target, lun); return find_prio(desc); } =20 @@ -237,10 +259,8 @@ int bootprio_find_ata_device(struct pci_device *pci, i= nt chanid, int slave) if (!pci) // support only pci machine for now return -1; - // Find ata drive - for example: /pci@i0cf8/ide@1,1/drive@1/disk@0 - char desc[256], *p; - p =3D build_pci_path(desc, sizeof(desc), "*", pci); - snprintf(p, desc+sizeof(desc)-p, "/drive@%x/disk@%x", chanid, slave); + char desc[256]; + build_ata_path(desc, sizeof(desc), pci, chanid, slave); return find_prio(desc); } =20 --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org