Shared memory arbitration | Cypress Semiconductor
Support & Community
Shared memory arbitration
- How do you prevent collisions in the PCI-DP?
- Is there on-chip arbitration?
- What happens if both the local bus and the PCI bus try to access the same memory location at the same time?
The PCI-DP does not have anything to monitor what shared memory locations either the PCI or local side are accessing. In other words, there is no built-in arbitration logic. However, it is possible to take advantage of the architecture of this device to prevent collisions.
Whenever the PCI bus accesses a specific memory location, it will prefetch a block of memory on 64 byte boundaries. When the PCI side is accessing this memory block, a local bus transaction that occurs exactly at the same time to any location within that block will corrupt data if either side is doing a write transaction (because writes are destructive). This is a common danger with shared memory devices on a single address. The reason for it extending to adjacent memory locations is the fact that the PCI side prefetches a block of memory. The odds are that within a block of memory the PCI side accesses the same location as the local side is rare but it can occur.
The way to handle this is to segment the memory to ensure that the PCI or local bus sides never access the same 64 byte block of memory. A driver can be written to use the I2O message mailbox to perform token arbitration. i.e. Either side can write a message to the other side which indicates which block of memory it has to access and then writes another message releasing that memory reservation.