nodedev: Parse PCI iommuGroup

This commit is contained in:
Cole Robinson 2013-10-10 09:41:49 -04:00
parent 2301f19e4b
commit 6673123185
3 changed files with 13 additions and 0 deletions

View File

@ -217,6 +217,11 @@ class TestNodeDev(unittest.TestCase):
devfile = "pcidev.xml"
self._testNode2DeviceCompare(nodename, devfile)
def testPCIParse(self):
nodename = "pci_1180_476"
obj = self._nodeDevFromName(nodename)
self.assertEqual(obj.iommu_group, 3)
def testNodeDevFail(self):
nodename = "usb_device_1d6b_1_0000_00_1d_1_if0"
devfile = ""

View File

@ -1678,6 +1678,9 @@ ba</description>
<function>50</function>
<product id='0x0476'>RL5c476 II</product>
<vendor id='0x1180'>Ricoh Co Ltd</vendor>
<iommuGroup number='3'>
<address domain='0x0000' bus='0x15' slot='0x00' function='0x4'/>
</iommuGroup>
</capability>
</device>
@ -1692,6 +1695,9 @@ ba</description>
<function>4</function>
<product id='0x0592'>R5C592 Memory Stick Bus Host Adapter</product>
<vendor id='0x1180'>Ricoh Co Ltd</vendor>
<iommuGroup number='3'>
<address domain='0x0001' bus='0x15' slot='0x0A' function='0x4'/>
</iommuGroup>
</capability>
</device>

View File

@ -171,6 +171,8 @@ class PCIDevice(NodeDevice):
vendor_name = XMLProperty("./capability/vendor")
vendor_id = XMLProperty("./capability/vendor/@id")
iommu_group = XMLProperty("./capability/iommuGroup/@number", is_int=True)
def pretty_name(self, child_dev=None):
devstr = "%.2X:%.2X:%X" % (int(self.bus),
int(self.slot),