mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
xend: Fix the detection of the upmost bridge in the python function find_parent().
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
This commit is contained in:
1 parent
e07665a216
commit
de07008fdd
1 file changed
+6
-7
@@ -400,12 +400,8 @@ class PciDevice:
|
||||
lst = target.split('/')
|
||||
parent = lst[len(lst)-2]
|
||||
if parent[0:3] == 'pci':
|
||||
parent = parent[3:]
|
||||
lst = parent.split(':')
|
||||
dom = int(lst[0], 16)
|
||||
bus = int(lst[1], 16)
|
||||
dev = 0
|
||||
func = 0
|
||||
# We have reached the upmost one.
|
||||
return None
|
||||
else:
|
||||
lst = parent.split(':')
|
||||
dom = int(lst[0], 16)
|
||||
@@ -424,7 +420,10 @@ class PciDevice:
|
||||
(dom, b, d, f) = self.find_parent()
|
||||
dev = dev_parent = PciDevice(dom, b, d, f)
|
||||
while dev_parent.dev_type != DEV_TYPE_PCIe_BRIDGE:
|
||||
(dom, b, d, f) = dev_parent.find_parent()
|
||||
parent = dev_parent.find_parent()
|
||||
if parent is None:
|
||||
break
|
||||
(dom, b, d, f) = parent
|
||||
dev = dev_parent
|
||||
dev_parent = PciDevice(dom, b, d, f)
|
||||
return dev
|
||||
|
||||