diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2011-11-16 10:23:10 +0100 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2011-11-17 16:16:34 +0100 |
commit | be23efbc91f47a6a34fbe24f167ee29fdf58f541 (patch) | |
tree | e24f7a9d2ff1c53da0671726c04602d6d5b013b1 | |
parent | 4c08c2600936efeedb1a33436876ba82a11218e7 (diff) |
vmwlegacy: Fix device fifo communication
This fixes two issues with the device fifo communication:
1) Idle the fifo before initializing it. If the fifo is already up and
processing data due to an uncleanly shut down server, and init could
otherwise confuse the device.
2) Mark fifo memory volatile when writing to it and make sure commands
are written before telling the device they are available.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
-rw-r--r-- | src/vmware.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/vmware.c b/src/vmware.c index 55bde22..fa01dca 100644 --- a/src/vmware.c +++ b/src/vmware.c @@ -299,7 +299,7 @@ vmwareWriteReg(VMWAREPtr pVMWARE, int index, CARD32 value) void vmwareWriteWordToFIFO(VMWAREPtr pVMWARE, CARD32 value) { - CARD32* vmwareFIFO = pVMWARE->vmwareFIFO; + volatile CARD32* vmwareFIFO = pVMWARE->vmwareFIFO; /* Need to sync? */ if ((vmwareFIFO[SVGA_FIFO_NEXT_CMD] + sizeof(CARD32) == vmwareFIFO[SVGA_FIFO_STOP]) @@ -310,6 +310,9 @@ vmwareWriteWordToFIFO(VMWAREPtr pVMWARE, CARD32 value) } vmwareFIFO[vmwareFIFO[SVGA_FIFO_NEXT_CMD] / sizeof(CARD32)] = value; + + write_mem_barrier(); + if(vmwareFIFO[SVGA_FIFO_NEXT_CMD] == vmwareFIFO[SVGA_FIFO_MAX] - sizeof(CARD32)) { vmwareFIFO[SVGA_FIFO_NEXT_CMD] = vmwareFIFO[SVGA_FIFO_MIN]; @@ -1342,7 +1345,7 @@ VMWAREInitFIFO(ScrnInfoPtr pScrn) int err; void *mmioVirtBase; #endif - CARD32* vmwareFIFO; + volatile CARD32* vmwareFIFO; Bool extendedFifo; int min; @@ -1373,6 +1376,9 @@ VMWAREInitFIFO(ScrnInfoPtr pScrn) extendedFifo = pVMWARE->vmwareCapability & SVGA_CAP_EXTENDED_FIFO; min = extendedFifo ? vmwareReadReg(pVMWARE, SVGA_REG_MEM_REGS) : 4; + vmwareWaitForFB(pVMWARE); + vmwareWriteReg(pVMWARE, SVGA_REG_CONFIG_DONE, 0); + vmwareFIFO[SVGA_FIFO_MIN] = min * sizeof(CARD32); vmwareFIFO[SVGA_FIFO_MAX] = pVMWARE->mmioSize; vmwareFIFO[SVGA_FIFO_NEXT_CMD] = min * sizeof(CARD32); |