ia64/xen-unstable

changeset 18609:a9be7b357b0b

xend: Fix the detection of the upmost bridge in the python function find_parent().

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Oct 10 10:03:28 2008 +0100 (2008-10-10)
parents 3c0862d49df7
children c89fd1e9c49c
files tools/python/xen/util/pci.py
line diff
     1.1 --- a/tools/python/xen/util/pci.py	Fri Oct 10 10:01:10 2008 +0100
     1.2 +++ b/tools/python/xen/util/pci.py	Fri Oct 10 10:03:28 2008 +0100
     1.3 @@ -400,12 +400,8 @@ class PciDevice:
     1.4              lst = target.split('/')
     1.5              parent = lst[len(lst)-2]
     1.6              if parent[0:3] == 'pci':
     1.7 -                parent = parent[3:]
     1.8 -                lst = parent.split(':')
     1.9 -                dom = int(lst[0], 16)
    1.10 -                bus = int(lst[1], 16)
    1.11 -                dev = 0
    1.12 -                func = 0
    1.13 +                # We have reached the upmost one.
    1.14 +                return None
    1.15              else:
    1.16                  lst = parent.split(':')
    1.17                  dom = int(lst[0], 16)
    1.18 @@ -424,7 +420,10 @@ class PciDevice:
    1.19          (dom, b, d, f) = self.find_parent()
    1.20          dev = dev_parent = PciDevice(dom, b, d, f)
    1.21          while dev_parent.dev_type != DEV_TYPE_PCIe_BRIDGE:
    1.22 -            (dom, b, d, f) = dev_parent.find_parent()
    1.23 +            parent = dev_parent.find_parent()
    1.24 +            if parent is None:
    1.25 +                break
    1.26 +            (dom, b, d, f) = parent
    1.27              dev = dev_parent
    1.28              dev_parent = PciDevice(dom, b, d, f)
    1.29          return dev