mirror of
https://github.com/corundum/corundum.git
synced 2025-02-06 08:38:23 +08:00
Don't reimplement mem_write for MSI and MSI-X
This commit is contained in:
parent
15fdbfeba7
commit
325df5152f
26
tb/pcie.py
26
tb/pcie.py
@ -1327,7 +1327,7 @@ class MSICapability(object):
|
|||||||
# Mask bits
|
# Mask bits
|
||||||
self.msi_mask_bits = byte_mask_update(self.msi_mask_bits, mask, data) & 0xffffffff
|
self.msi_mask_bits = byte_mask_update(self.msi_mask_bits, mask, data) & 0xffffffff
|
||||||
|
|
||||||
def issue_msi_interrupt(self, number=0, attr=0):
|
def issue_msi_interrupt(self, number=0, attr=0, tc=0):
|
||||||
if not self.msi_enable:
|
if not self.msi_enable:
|
||||||
print("MSI disabled")
|
print("MSI disabled")
|
||||||
return
|
return
|
||||||
@ -1335,16 +1335,8 @@ class MSICapability(object):
|
|||||||
print("MSI message number out of range")
|
print("MSI message number out of range")
|
||||||
return
|
return
|
||||||
|
|
||||||
tlp = TLP()
|
data = self.msi_message_data & ~(2**self.msi_multiple_message_enable-1) | number
|
||||||
tlp.fmt_type = TLP_MEM_WRITE
|
yield self.mem_write(self.msi_message_address, struct.pack('<L', data), attr=attr, tc=tc)
|
||||||
tlp.requester_id = self.get_id()
|
|
||||||
tlp.attr = attr
|
|
||||||
addr = self.msi_message_address
|
|
||||||
if addr > 0xffffffff:
|
|
||||||
tlp.fmt_type = TLP_MEM_WRITE_64
|
|
||||||
tlp.data = [self.msi_message_data & ~(2**self.msi_multiple_message_enable-1) | number]
|
|
||||||
tlp.set_be(addr, 4)
|
|
||||||
yield self.send(tlp)
|
|
||||||
|
|
||||||
|
|
||||||
class MSIXCapability(object):
|
class MSIXCapability(object):
|
||||||
@ -1398,20 +1390,12 @@ class MSIXCapability(object):
|
|||||||
if mask & 0x8: self.msix_function_mask = (data & 1 << 30 != 0)
|
if mask & 0x8: self.msix_function_mask = (data & 1 << 30 != 0)
|
||||||
if mask & 0x8: self.msix_enable = (data & 1 << 31 != 0)
|
if mask & 0x8: self.msix_enable = (data & 1 << 31 != 0)
|
||||||
|
|
||||||
def issue_msix_interrupt(self, addr, data, attr=0):
|
def issue_msix_interrupt(self, addr, data, attr=0, tc=0):
|
||||||
if not self.msix_enable:
|
if not self.msix_enable:
|
||||||
print("MSI-X disabled")
|
print("MSI-X disabled")
|
||||||
return
|
return
|
||||||
|
|
||||||
tlp = TLP()
|
yield self.mem_write(addr, struct.pack('<L', data), attr=attr, tc=tc)
|
||||||
tlp.fmt_type = TLP_MEM_WRITE
|
|
||||||
tlp.requester_id = self.get_id()
|
|
||||||
tlp.attr = attr
|
|
||||||
if addr > 0xffffffff:
|
|
||||||
tlp.fmt_type = TLP_MEM_WRITE_64
|
|
||||||
tlp.data = [data]
|
|
||||||
tlp.set_be(addr, 4)
|
|
||||||
yield self.send(tlp)
|
|
||||||
|
|
||||||
|
|
||||||
class Function(PMCapability, PCIECapability):
|
class Function(PMCapability, PCIECapability):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user