From kevin at tyndur.org Sat Jun 18 16:38:42 2011 From: kevin at tyndur.org (Kevin Wolf) Date: Sat, 18 Jun 2011 16:38:42 +0200 Subject: [cdi-devel] [PATCH 0/2] Fixes for ata Message-ID: <1308407924-19461-1-git-send-email-kevin@tyndur.org> This series (forward ported from tyndur) should help with the ata driver on real hardware. Antoine Kaufmann (2): ata: Align DMA buffers to 64k ata: Retry on error ata/ata.c | 6 ++++++ ata/device.c | 2 +- 2 files changed, 7 insertions(+), 1 deletions(-) From kevin at tyndur.org Sat Jun 18 16:38:43 2011 From: kevin at tyndur.org (Kevin Wolf) Date: Sat, 18 Jun 2011 16:38:43 +0200 Subject: [cdi-devel] [PATCH 1/2] ata: Align DMA buffers to 64k In-Reply-To: <1308407924-19461-1-git-send-email-kevin@tyndur.org> References: <1308407924-19461-1-git-send-email-kevin@tyndur.org> Message-ID: <1308407924-19461-2-git-send-email-kevin@tyndur.org> From: Antoine Kaufmann ! ata: The busmaster DMA buffer must be aligned to 64k for DMA to work on real hardware, too Signed-off-by: Antoine Kaufmann Signed-off-by: Kevin Wolf --- ata/device.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ata/device.c b/ata/device.c index 6e33d52..9afa102 100644 --- a/ata/device.c +++ b/ata/device.c @@ -274,7 +274,7 @@ void ata_init_controller(struct ata_controller* controller) controller->prdt_phys = buf->paddr.items[0].start; buf = cdi_mem_alloc(ATA_DMA_MAXSIZE, - CDI_MEM_PHYS_CONTIGUOUS | CDI_MEM_DMA_4G); + CDI_MEM_PHYS_CONTIGUOUS | CDI_MEM_DMA_4G | 16); controller->dma_buf_virt = buf->vaddr; controller->dma_buf_phys = buf->paddr.items[0].start; -- 1.6.0.2 From kevin at tyndur.org Sat Jun 18 16:38:44 2011 From: kevin at tyndur.org (Kevin Wolf) Date: Sat, 18 Jun 2011 16:38:44 +0200 Subject: [cdi-devel] [PATCH 2/2] ata: Retry on error In-Reply-To: <1308407924-19461-1-git-send-email-kevin@tyndur.org> References: <1308407924-19461-1-git-send-email-kevin@tyndur.org> Message-ID: <1308407924-19461-3-git-send-email-kevin@tyndur.org> From: Antoine Kaufmann ! ata: Retrying after read/write errors helps to make the code work a bit more reliably on real hardware Signed-off-by: Antoine Kaufmann Signed-off-by: Kevin Wolf --- ata/ata.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/ata/ata.c b/ata/ata.c index a2ab78f..262440a 100644 --- a/ata/ata.c +++ b/ata/ata.c @@ -121,6 +121,7 @@ static int ata_drv_rw_sectors(struct ata_device* dev, int direction, void* current_buffer = buffer; uint64_t lba = start; int max_count; + int again = 2; // Anzahl der Sektoren die noch uebrig sind size_t count_left = count; @@ -192,6 +193,10 @@ static int ata_drv_rw_sectors(struct ata_device* dev, int direction, // Request ausfuehren if (!ata_request(&request)) { + if (again) { + again--; + continue; + } result = 0; break; } @@ -200,6 +205,7 @@ static int ata_drv_rw_sectors(struct ata_device* dev, int direction, current_buffer += current_count * ATA_SECTOR_SIZE; count_left -= current_count; lba += current_count; + again = 2; } return result; -- 1.6.0.2