From 1d8cde5beb2ec5178ea08b131a97ed948d291a78 Mon Sep 17 00:00:00 2001 From: aurel32 Date: Sat, 29 Mar 2008 12:15:35 +0000 Subject: [PATCH] IDE: Improve DMA transfers by increasing the buffer size (Ian Jackson) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4132 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/ide.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/hw/ide.c b/hw/ide.c index 25f5b9f8e8..623abd80f8 100644 --- a/hw/ide.c +++ b/hw/ide.c @@ -202,6 +202,12 @@ /* set to 1 set disable mult support */ #define MAX_MULT_SECTORS 16 +#define IDE_DMA_BUF_SECTORS 256 + +#if (IDE_DMA_BUF_SECTORS < MAX_MULT_SECTORS) +#error "IDE_DMA_BUF_SECTORS must be bigger or equal to MAX_MULT_SECTORS" +#endif + /* ATAPI defines */ #define ATAPI_PACKET_SIZE 12 @@ -899,8 +905,8 @@ static void ide_read_dma_cb(void *opaque, int ret) /* launch next transfer */ n = s->nsector; - if (n > MAX_MULT_SECTORS) - n = MAX_MULT_SECTORS; + if (n > IDE_DMA_BUF_SECTORS) + n = IDE_DMA_BUF_SECTORS; s->io_buffer_index = 0; s->io_buffer_size = n * 512; #ifdef DEBUG_AIO @@ -998,8 +1004,8 @@ static void ide_write_dma_cb(void *opaque, int ret) /* launch next transfer */ n = s->nsector; - if (n > MAX_MULT_SECTORS) - n = MAX_MULT_SECTORS; + if (n > IDE_DMA_BUF_SECTORS) + n = IDE_DMA_BUF_SECTORS; s->io_buffer_index = 0; s->io_buffer_size = n * 512; @@ -1293,8 +1299,8 @@ static void ide_atapi_cmd_read_dma_cb(void *opaque, int ret) data_offset = 16; } else { n = s->packet_transfer_size >> 11; - if (n > (MAX_MULT_SECTORS / 4)) - n = (MAX_MULT_SECTORS / 4); + if (n > (IDE_DMA_BUF_SECTORS / 4)) + n = (IDE_DMA_BUF_SECTORS / 4); s->io_buffer_size = n * 2048; data_offset = 0; } @@ -2524,7 +2530,7 @@ static void ide_init2(IDEState *ide_state, for(i = 0; i < 2; i++) { s = ide_state + i; - s->io_buffer = qemu_memalign(512, MAX_MULT_SECTORS*512 + 4); + s->io_buffer = qemu_memalign(512, IDE_DMA_BUF_SECTORS*512 + 4); if (i == 0) s->bs = hd0; else