From d353fb72f59cd0e1f67baf773e74719cda761a89 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 19 May 2011 10:58:19 +0200 Subject: ide: add TRIM support Add support for TRIM sub function of the data set management command, and wire it up to the qemu discard infrastructure. Signed-off-by: Christoph Hellwig Signed-off-by: Kevin Wolf --- hw/ide/pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'hw/ide/pci.c') diff --git a/hw/ide/pci.c b/hw/ide/pci.c index 80c5794..c940375 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -200,8 +200,13 @@ static void bmdma_restart_bh(void *opaque) is_read = !!(bus->error_status & BM_STATUS_RETRY_READ); if (bus->error_status & BM_STATUS_DMA_RETRY) { - bus->error_status &= ~(BM_STATUS_DMA_RETRY | BM_STATUS_RETRY_READ); - bmdma_restart_dma(bm, is_read ? IDE_DMA_READ : IDE_DMA_WRITE); + if (bus->error_status & BM_STATUS_RETRY_TRIM) { + bus->error_status &= ~BM_STATUS_RETRY_TRIM; + bmdma_restart_dma(bm, IDE_DMA_TRIM); + } else { + bus->error_status &= ~(BM_STATUS_DMA_RETRY | BM_STATUS_RETRY_READ); + bmdma_restart_dma(bm, is_read ? IDE_DMA_READ : IDE_DMA_WRITE); + } } else if (bus->error_status & BM_STATUS_PIO_RETRY) { bus->error_status &= ~(BM_STATUS_PIO_RETRY | BM_STATUS_RETRY_READ); if (is_read) { -- cgit v1.1