class PCICapability:
- def __init__(self, id, start, len, flags):
+ def __init__(self, id, start, len, flags, content):
self.id = id
self.start = start
self.len = len
self.flags = flags
+ self.content = content
self.comments = []
def __eq__(self, other):
# unknown/unhandled cap, mark its existence
len = 2
flags = PCICapability.RD
- caps.append(PCICapability(id, cap, len, flags))
+ f.seek(cap + 2)
+ content = f.read(len - 2)
+ caps.append(PCICapability(id, cap, len, flags, content))
return caps
self.caps = caps
self.caps_start = 0
self.num_caps = len(caps)
+ self.num_msi_vectors = 0
+ self.msi_64bits = 0
+ for c in caps:
+ if c.id in (0x05, 0x11):
+ msg_ctrl = struct.unpack('<H', c.content[:2])[0]
+ if c.id == 0x05: # MSI
+ self.num_msi_vectors = 1 << ((msg_ctrl >> 1) & 0x7)
+ self.msi_64bits = (msg_ctrl >> 7) & 1
def __str__(self):
return 'PCIDevice: %02x:%02x.%x' % (self.bus, self.dev, self.fn)
.bdf = ${hex(d.bdf())},
.caps_start = ${d.caps_start},
.num_caps = ${d.num_caps},
+ .num_msi_vectors = ${d.num_msi_vectors},
+ .msi_64bits = ${d.msi_64bits},
},
% endfor
},