From 482368b1a8e45430672c58c9a42e7d2004367126 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Thu, 24 Feb 2000 00:12:35 +0000 Subject: Merge with 2.3.47. Guys, this is buggy as shit. You've been warned. --- drivers/scsi/esp.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'drivers/scsi/esp.c') diff --git a/drivers/scsi/esp.c b/drivers/scsi/esp.c index 61ce25c36..fccfb59c8 100644 --- a/drivers/scsi/esp.c +++ b/drivers/scsi/esp.c @@ -1,4 +1,4 @@ -/* $Id: esp.c,v 1.90 2000/01/28 13:42:56 jj Exp $ +/* $Id: esp.c,v 1.92 2000/02/18 13:49:58 davem Exp $ * esp.c: EnhancedScsiProcessor Sun SCSI driver code. * * Copyright (C) 1995, 1998 David S. Miller (davem@caip.rutgers.edu) @@ -1412,14 +1412,20 @@ static void esp_get_dmabufs(struct esp *esp, Scsi_Cmnd *sp) sp->SCp.this_residual = sp->request_bufflen; sp->SCp.buffer = (struct scatterlist *) sp->request_buffer; sp->SCp.buffers_residual = 0; - sp->SCp.have_data_in = sbus_map_single(esp->sdev, sp->SCp.buffer, - sp->SCp.this_residual); - sp->SCp.ptr = (char *) ((unsigned long)sp->SCp.have_data_in); + if (sp->request_bufflen) { + sp->SCp.have_data_in = sbus_map_single(esp->sdev, sp->SCp.buffer, + sp->SCp.this_residual, + scsi_to_sbus_dma_dir(sp->sc_data_direction)); + sp->SCp.ptr = (char *) ((unsigned long)sp->SCp.have_data_in); + } else { + sp->SCp.ptr = NULL; + } } else { sp->SCp.buffer = (struct scatterlist *) sp->buffer; sp->SCp.buffers_residual = sbus_map_sg(esp->sdev, sp->SCp.buffer, - sp->use_sg); + sp->use_sg, + scsi_to_sbus_dma_dir(sp->sc_data_direction)); sp->SCp.this_residual = sg_dma_len(sp->SCp.buffer); sp->SCp.ptr = (char *) ((unsigned long)sg_dma_address(sp->SCp.buffer)); } @@ -1427,12 +1433,14 @@ static void esp_get_dmabufs(struct esp *esp, Scsi_Cmnd *sp) static void esp_release_dmabufs(struct esp *esp, Scsi_Cmnd *sp) { - if (sp->use_sg == 0) { + if (sp->use_sg) { + sbus_unmap_sg(esp->sdev, sp->buffer, sp->use_sg, + scsi_to_sbus_dma_dir(sp->sc_data_direction)); + } else if (sp->request_bufflen) { sbus_unmap_single(esp->sdev, sp->SCp.have_data_in, - sp->request_bufflen); - } else { - sbus_unmap_sg(esp->sdev, sp->buffer, sp->use_sg); + sp->request_bufflen, + scsi_to_sbus_dma_dir(sp->sc_data_direction)); } } -- cgit v1.2.3