From mboxrd@z Thu Jan 1 00:00:00 1970 From: elena.ufimtseva@oracle.com Subject: [PATCH v10 3/5] pci: add wrapper for parse_pci Date: Mon, 13 Jul 2015 14:18:00 -0400 Message-ID: <1436811482-16113-4-git-send-email-elena.ufimtseva@oracle.com> References: <1436811482-16113-1-git-send-email-elena.ufimtseva@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1436811482-16113-1-git-send-email-elena.ufimtseva@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Elena Ufimtseva , kevin.tian@intel.com, tim@xen.org, jbeulich@suse.com, yang.z.zhang@intel.com, boris.ostrovsky@oracle.com List-Id: xen-devel@lists.xenproject.org From: Elena Ufimtseva For sbdf's parsing in RMRR command line add __parse_pci with additional parameter def_seg. __parse_pci 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 Acked-by: Jan Beulich --- xen/drivers/pci/pci.c | 11 +++++++++++ xen/include/xen/pci.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/xen/drivers/pci/pci.c b/xen/drivers/pci/pci.c index ca07ed0..788a356 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_t def_seg; + + return __parse_pci(s, seg_p, bus_p, dev_p, func_p, &def_seg); +} + +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_t *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 = 0; 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 = 1; } if ( func_p ) { diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h index 3908146..36e8cd3 100644 --- a/xen/include/xen/pci.h +++ b/xen/include/xen/pci.h @@ -148,6 +148,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(const char *, unsigned int *seg, unsigned int *bus, + unsigned int *dev, unsigned int *func, bool_t *def_seg); + bool_t pcie_aer_get_firmware_first(const struct pci_dev *); -- 2.1.3