From patchwork Mon Jan 23 18:20:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venu Busireddy X-Patchwork-Id: 9533317 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6442160434 for ; Mon, 23 Jan 2017 18:23:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5464128365 for ; Mon, 23 Jan 2017 18:23:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48E7028442; Mon, 23 Jan 2017 18:23:40 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B326F28365 for ; Mon, 23 Jan 2017 18:23:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cVjFO-0007Hn-UY; Mon, 23 Jan 2017 18:21:42 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cVjFO-0007HZ-3N for xen-devel@lists.xen.org; Mon, 23 Jan 2017 18:21:42 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id A9/77-22326-5B946885; Mon, 23 Jan 2017 18:21:41 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRWlGSWpSXmKPExsXSO6nOVXeLZ1u EwaLP5hZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8a06TfYC6YIV/x5w97AuJuvi5GLQ0igg0ni 66z/zBDOF0aJRSvvskE4Gxgl1j26C5XpZJS4+289excjJwebgIHE0cM9rCC2iICZxNS2fSwgR cwCh5klpl3+ywySEBawkJjXeJURxGYRUJVYc/I8G4jNK+AhcWbSChYQW0JATuLmuU6geg4OTg FPiWktiiBhIaCS7UvOMEGUGEv0zepjmcDIt4CRYRWjenFqUVlqka65XlJRZnpGSW5iZo6uoYG ZXm5qcXFiempOYlKxXnJ+7iZGYKAwAMEOxpmX/Q8xSnIwKYny3ohviRDiS8pPqcxILM6ILyrN SS0+xCjDwaEkwfvLoy1CSLAoNT21Ii0zBxiyMGkJDh4lEV4rkDRvcUFibnFmOkTqFKOilDjvV pCEAEgiozQPrg0WJ5cYZaWEeRmBDhHiKUgtys0sQZV/xSjOwagkzMsOjDohnsy8Erjpr4AWMw EtlpVoBllckoiQkmpgLD7/+N7cWY5yYismLLowLcZp2clFPV+msi09LvDUcHF8LmdkkAqXT9a jTc7bwsNrs/61awrrMhn5H+u/prbhQXHk0dBfPanH+Zu2BP/+vu2smXeDoabgWqnlu97K1Qsm LHhaU3DtfrVkW0bd3RNJpRkrV/zgOjbjhNnLacULNtzZaxDb/vRQvBJLcUaioRZzUXEiAKwnV vaOAgAA X-Env-Sender: venu.busireddy@oracle.com X-Msg-Ref: server-9.tower-27.messagelabs.com!1485195699!83427202!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 47850 invoked from network); 23 Jan 2017 18:21:40 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-9.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 23 Jan 2017 18:21:40 -0000 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v0NILTpK022365 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 23 Jan 2017 18:21:30 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.13.8/8.14.4) with ESMTP id v0NILSGZ011950 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 23 Jan 2017 18:21:29 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v0NILRc0014209; Mon, 23 Jan 2017 18:21:27 GMT Received: from lenovo.localdomain (/24.55.20.143) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 23 Jan 2017 10:21:27 -0800 From: Venu Busireddy To: venu.busireddy@oracle.com, xen-devel@lists.xen.org Date: Mon, 23 Jan 2017 12:20:38 -0600 Message-Id: <1485195639-1996-3-git-send-email-venu.busireddy@oracle.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1485195639-1996-1-git-send-email-venu.busireddy@oracle.com> References: <1485195639-1996-1-git-send-email-venu.busireddy@oracle.com> X-Source-IP: aserv0021.oracle.com [141.146.126.233] Cc: Elena Ufimtseva , Kevin Tian , Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Jan Beulich Subject: [Xen-devel] [PATCH v14 2/3] pci: add wrapper for parse_pci. X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP For sbdf's parsing in RMRR command line, add parse_pci_seg with additional parameter def_seg. parse_pci_seg will help to identify if segment was found in string being parsed or default segment was used. Make a wrapper parse_pci so the rest of the callers are not affected. Signed-off-by: Elena Ufimtseva Signed-off-by: Venu Busireddy Acked-by: Kevin Tian --- xen/drivers/pci/pci.c | 11 +++++++++++ xen/include/xen/pci.h | 3 +++ 2 files changed, 14 insertions(+) Changes in v14: - No new changes. Included this patch file for the sake of completeness. diff --git a/xen/drivers/pci/pci.c b/xen/drivers/pci/pci.c index ca07ed0..13d3309 100644 --- a/xen/drivers/pci/pci.c +++ b/xen/drivers/pci/pci.c @@ -119,11 +119,21 @@ const char *__init parse_pci(const char *s, unsigned int *seg_p, unsigned int *bus_p, unsigned int *dev_p, unsigned int *func_p) { + bool def_seg; + + return parse_pci_seg(s, seg_p, bus_p, dev_p, func_p, &def_seg); +} + +const char *__init parse_pci_seg(const char *s, unsigned int *seg_p, + unsigned int *bus_p, unsigned int *dev_p, + unsigned int *func_p, bool *def_seg) +{ unsigned long seg = simple_strtoul(s, &s, 16), bus, dev, func; if ( *s != ':' ) return NULL; bus = simple_strtoul(s + 1, &s, 16); + *def_seg = false; if ( *s == ':' ) dev = simple_strtoul(s + 1, &s, 16); else @@ -131,6 +141,7 @@ const char *__init parse_pci(const char *s, unsigned int *seg_p, dev = bus; bus = seg; seg = 0; + *def_seg = true; } if ( func_p ) { diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h index 0872401..59b6e8a 100644 --- a/xen/include/xen/pci.h +++ b/xen/include/xen/pci.h @@ -159,6 +159,9 @@ int pci_find_ext_capability(int seg, int bus, int devfn, int cap); int pci_find_next_ext_capability(int seg, int bus, int devfn, int pos, int cap); const char *parse_pci(const char *, unsigned int *seg, unsigned int *bus, unsigned int *dev, unsigned int *func); +const char *parse_pci_seg(const char *, unsigned int *seg, unsigned int *bus, + unsigned int *dev, unsigned int *func, bool *def_seg); + bool_t pcie_aer_get_firmware_first(const struct pci_dev *);