Messages in this thread Patch in this message | | | Date | Sat, 18 Mar 2000 20:22:23 +0100 (CET) | From | Gérard Roudier <> | Subject | Re: 2.3.00p1/2.3.49: more problems concerning devfs & generic scsi |
| |
On Sat, 18 Mar 2000, Alan Cox wrote:
> Please try this. The sym driver seems to be making some assumptions that > arent quite safe with the current scsi code > > > --- drivers/scsi/sym53c8xx.c~ Mon Mar 13 13:00:28 2000 > +++ drivers/scsi/sym53c8xx.c Sat Mar 18 02:48:31 2000 > @@ -1167,7 +1167,7 @@ > dma_addr_t mapping; > int dma_dir = scsi_to_pci_dma_dir(cmd->sc_data_direction); > > - if (cmd->request_bufflen == 0) > + if (cmd->request_bufflen == 0 || dma_dir == PCI_DMA_NONE) > return 0; > > mapping = pci_map_single(pdev, cmd->request_buffer, > @@ -1183,7 +1183,7 @@ > int use_sg; > int dma_dir = scsi_to_pci_dma_dir(cmd->sc_data_direction); > > - if (cmd->use_sg == 0) > + if (cmd->use_sg == 0 || dma_dir==PCI_DMA_NONE) > return 0; > > use_sg = pci_map_sg(pdev, cmd->buffer, cmd->use_sg, dma_dir); >
You seem to suggest that low-level drivers should just discard data buffers if direction is supplied as NONE. Note that it is not pre-scsi-data-direction compatible (driver assumed direction was unknown).
I will prepare patches for both ncr and sym. Here is, for now, the patch for sym53c8xx.c (+ a minor clean-up):
--- linux/drivers/scsi/sym53c8xx.c.0318 Sat Mar 18 19:39:31 2000 +++ linux/drivers/scsi/sym53c8xx.c Sat Mar 18 19:47:51 2000 @@ -6303,7 +6303,6 @@ lcb_p lp = ncr_lp(np, tp, cmd->lun); ccb_p cp; - int segments; u_char idmsg, *msgptr; u_int msglen; int direction; @@ -6452,11 +6451,17 @@ **---------------------------------------------------- */ - cp->segments = segments = np->scatter (np, cp, cp->cmd); - - if (segments < 0) { - ncr_free_ccb(np, cp); - return(DID_ERROR); + direction = scsi_data_direction(cmd); + if (direction != SCSI_DATA_NONE) { + cp->segments = np->scatter (np, cp, cp->cmd); + if (cp->segments < 0) { + ncr_free_ccb(np, cp); + return(DID_ERROR); + } + } + else { + cp->data_len = 0; + cp->segments = 0; } /*---------------------------------------------------- @@ -6467,8 +6472,6 @@ */ if (!cp->data_len) direction = SCSI_DATA_NONE; - else - direction = scsi_data_direction(cmd); /* ** If data direction is UNKNOWN, speculate DATA_READ @@ -6480,7 +6483,7 @@ case SCSI_DATA_UNKNOWN: case SCSI_DATA_WRITE: goalp = NCB_SCRIPT_PHYS (np, data_out2) + 8; - lastp = goalp - 8 - (segments * (SCR_SG_SIZE*4)); + lastp = goalp - 8 - (cp->segments * (SCR_SG_SIZE*4)); if (direction != SCSI_DATA_UNKNOWN) break; cp->phys.header.wgoalp = cpu_to_scr(goalp); @@ -6489,7 +6492,7 @@ case SCSI_DATA_READ: cp->host_flags |= HF_DATA_IN; goalp = NCB_SCRIPT_PHYS (np, data_in2) + 8; - lastp = goalp - 8 - (segments * (SCR_SG_SIZE*4)); + lastp = goalp - 8 - (cp->segments * (SCR_SG_SIZE*4)); break; default: case SCSI_DATA_NONE:
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |