Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 223
b: refs/heads/master
c: be7db05
h: refs/heads/master
i:
  221: 2d7105f
  219: 34a2fd0
  215: eb4f26d
  207: e4d0fec
  191: 07f108b
v: v3
  • Loading branch information
unknown authored and James Bottomley committed Apr 18, 2005
1 parent e75f697 commit 57b7ebc
Show file tree
Hide file tree
Showing 17 changed files with 78 additions and 143 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 80e2ca3dcb1043420ac4b06de8eed3d6fedaddda
refs/heads/master: be7db055dd7261522557046370f49160728e3847
12 changes: 3 additions & 9 deletions trunk/Documentation/DMA-mapping.txt
Original file line number Diff line number Diff line change
Expand Up @@ -443,15 +443,9 @@ Only streaming mappings specify a direction, consistent mappings
implicitly have a direction attribute setting of
PCI_DMA_BIDIRECTIONAL.

The SCSI subsystem provides mechanisms for you to easily obtain
the direction to use, in the SCSI command:

scsi_to_pci_dma_dir(SCSI_DIRECTION)

Where SCSI_DIRECTION is obtained from the 'sc_data_direction'
member of the SCSI command your driver is working on. The
mentioned interface above returns a value suitable for passing
into the streaming DMA mapping interfaces below.
The SCSI subsystem tells you the direction to use in the
'sc_data_direction' member of the SCSI command your driver is
working on.

For Networking drivers, it's a rather simple affair. For transmit
packets, map/unmap them with the PCI_DMA_TODEVICE direction
Expand Down
44 changes: 0 additions & 44 deletions trunk/Documentation/scsi/scsi_mid_low_api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,6 @@ Summary:
scsi_remove_host - detach and remove all SCSI devices owned by host
scsi_report_bus_reset - report scsi _bus_ reset observed
scsi_set_device - place device reference in host structure
scsi_to_pci_dma_dir - convert SCSI subsystem direction flag to PCI
scsi_to_sbus_dma_dir - convert SCSI subsystem direction flag to SBUS
scsi_track_queue_full - track successive QUEUE_FULL events
scsi_unblock_requests - allow further commands to be queued to given host
scsi_unregister - [calls scsi_host_put()]
Expand Down Expand Up @@ -756,48 +754,6 @@ void scsi_report_bus_reset(struct Scsi_Host * shost, int channel)
void scsi_set_device(struct Scsi_Host * shost, struct device * dev)


/**
* scsi_to_pci_dma_dir - convert SCSI subsystem direction flag to PCI
* @scsi_data_direction: SCSI subsystem direction flag
*
* Returns DMA_TO_DEVICE given SCSI_DATA_WRITE,
* DMA_FROM_DEVICE given SCSI_DATA_READ
* DMA_BIDIRECTIONAL given SCSI_DATA_UNKNOWN
* else returns DMA_NONE
*
* Might block: no
*
* Notes: The SCSI subsystem now uses the same values for these
* constants as the PCI subsystem so this function is a nop.
* The recommendation is not to use this conversion function anymore
* (in the 2.6 kernel series) as it is not needed.
*
* Defined in: drivers/scsi/scsi.h .
**/
int scsi_to_pci_dma_dir(unsigned char scsi_data_direction)


/**
* scsi_to_sbus_dma_dir - convert SCSI subsystem direction flag to SBUS
* @scsi_data_direction: SCSI subsystem direction flag
*
* Returns DMA_TO_DEVICE given SCSI_DATA_WRITE,
* FROM_DEVICE given SCSI_DATA_READ
* DMA_BIDIRECTIONAL given SCSI_DATA_UNKNOWN
* else returns DMA_NONE
*
* Notes: The SCSI subsystem now uses the same values for these
* constants as the SBUS subsystem so this function is a nop.
* The recommendation is not to use this conversion function anymore
* (in the 2.6 kernel series) as it is not needed.
*
* Might block: no
*
* Defined in: drivers/scsi/scsi.h .
**/
int scsi_to_sbus_dma_dir(unsigned char scsi_data_direction)


/**
* scsi_track_queue_full - track successive QUEUE_FULL events on given
* device to determine if and when there is a need
Expand Down
18 changes: 9 additions & 9 deletions trunk/drivers/scsi/aic7xxx/aic79xx_osm.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ ahd_linux_unmap_scb(struct ahd_softc *ahd, struct scb *scb)
int direction;

cmd = scb->io_ctx;
direction = scsi_to_pci_dma_dir(cmd->sc_data_direction);
direction = cmd->sc_data_direction;
ahd_sync_sglist(ahd, scb, BUS_DMASYNC_POSTWRITE);
if (cmd->use_sg != 0) {
struct scatterlist *sg;
Expand Down Expand Up @@ -3338,7 +3338,7 @@ ahd_linux_dv_inq(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
}

ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
cmd->sc_data_direction = SCSI_DATA_READ;
cmd->sc_data_direction = DMA_FROM_DEVICE;
cmd->cmd_len = 6;
cmd->cmnd[0] = INQUIRY;
cmd->cmnd[4] = request_length;
Expand All @@ -3363,7 +3363,7 @@ ahd_linux_dv_tur(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
#endif
/* Do a TUR to clear out any non-fatal transitional state */
ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
cmd->sc_data_direction = SCSI_DATA_NONE;
cmd->sc_data_direction = DMA_NONE;
cmd->cmd_len = 6;
cmd->cmnd[0] = TEST_UNIT_READY;
}
Expand All @@ -3385,7 +3385,7 @@ ahd_linux_dv_rebd(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
free(targ->dv_buffer, M_DEVBUF);
targ->dv_buffer = malloc(AHD_REBD_LEN, M_DEVBUF, M_WAITOK);
ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
cmd->sc_data_direction = SCSI_DATA_READ;
cmd->sc_data_direction = DMA_FROM_DEVICE;
cmd->cmd_len = 10;
cmd->cmnd[0] = READ_BUFFER;
cmd->cmnd[1] = 0x0b;
Expand All @@ -3407,7 +3407,7 @@ ahd_linux_dv_web(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
}
#endif
ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
cmd->sc_data_direction = SCSI_DATA_WRITE;
cmd->sc_data_direction = DMA_TO_DEVICE;
cmd->cmd_len = 10;
cmd->cmnd[0] = WRITE_BUFFER;
cmd->cmnd[1] = 0x0a;
Expand All @@ -3429,7 +3429,7 @@ ahd_linux_dv_reb(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
}
#endif
ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
cmd->sc_data_direction = SCSI_DATA_READ;
cmd->sc_data_direction = DMA_FROM_DEVICE;
cmd->cmd_len = 10;
cmd->cmnd[0] = READ_BUFFER;
cmd->cmnd[1] = 0x0a;
Expand All @@ -3455,7 +3455,7 @@ ahd_linux_dv_su(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
}
#endif
ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
cmd->sc_data_direction = SCSI_DATA_NONE;
cmd->sc_data_direction = DMA_NONE;
cmd->cmd_len = 6;
cmd->cmnd[0] = START_STOP_UNIT;
cmd->cmnd[4] = le | SSS_START;
Expand Down Expand Up @@ -4018,7 +4018,7 @@ ahd_linux_run_device_queue(struct ahd_softc *ahd, struct ahd_linux_device *dev)
int dir;

cur_seg = (struct scatterlist *)cmd->request_buffer;
dir = scsi_to_pci_dma_dir(cmd->sc_data_direction);
dir = cmd->sc_data_direction;
nseg = pci_map_sg(ahd->dev_softc, cur_seg,
cmd->use_sg, dir);
scb->platform_data->xfer_len = 0;
Expand All @@ -4038,7 +4038,7 @@ ahd_linux_run_device_queue(struct ahd_softc *ahd, struct ahd_linux_device *dev)
int dir;

sg = scb->sg_list;
dir = scsi_to_pci_dma_dir(cmd->sc_data_direction);
dir = cmd->sc_data_direction;
addr = pci_map_single(ahd->dev_softc,
cmd->request_buffer,
cmd->request_bufflen, dir);
Expand Down
20 changes: 10 additions & 10 deletions trunk/drivers/scsi/aic7xxx/aic7xxx_osm.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,12 +693,12 @@ ahc_linux_unmap_scb(struct ahc_softc *ahc, struct scb *scb)

sg = (struct scatterlist *)cmd->request_buffer;
pci_unmap_sg(ahc->dev_softc, sg, cmd->use_sg,
scsi_to_pci_dma_dir(cmd->sc_data_direction));
cmd->sc_data_direction);
} else if (cmd->request_bufflen != 0) {
pci_unmap_single(ahc->dev_softc,
scb->platform_data->buf_busaddr,
cmd->request_bufflen,
scsi_to_pci_dma_dir(cmd->sc_data_direction));
cmd->sc_data_direction);
}
}

Expand Down Expand Up @@ -3007,7 +3007,7 @@ ahc_linux_dv_inq(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
}

ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
cmd->sc_data_direction = SCSI_DATA_READ;
cmd->sc_data_direction = DMA_FROM_DEVICE;
cmd->cmd_len = 6;
cmd->cmnd[0] = INQUIRY;
cmd->cmnd[4] = request_length;
Expand All @@ -3032,7 +3032,7 @@ ahc_linux_dv_tur(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
#endif
/* Do a TUR to clear out any non-fatal transitional state */
ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
cmd->sc_data_direction = SCSI_DATA_NONE;
cmd->sc_data_direction = DMA_NONE;
cmd->cmd_len = 6;
cmd->cmnd[0] = TEST_UNIT_READY;
}
Expand All @@ -3054,7 +3054,7 @@ ahc_linux_dv_rebd(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
free(targ->dv_buffer, M_DEVBUF);
targ->dv_buffer = malloc(AHC_REBD_LEN, M_DEVBUF, M_WAITOK);
ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
cmd->sc_data_direction = SCSI_DATA_READ;
cmd->sc_data_direction = DMA_FROM_DEVICE;
cmd->cmd_len = 10;
cmd->cmnd[0] = READ_BUFFER;
cmd->cmnd[1] = 0x0b;
Expand All @@ -3076,7 +3076,7 @@ ahc_linux_dv_web(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
}
#endif
ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
cmd->sc_data_direction = SCSI_DATA_WRITE;
cmd->sc_data_direction = DMA_TO_DEVICE;
cmd->cmd_len = 10;
cmd->cmnd[0] = WRITE_BUFFER;
cmd->cmnd[1] = 0x0a;
Expand All @@ -3098,7 +3098,7 @@ ahc_linux_dv_reb(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
}
#endif
ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
cmd->sc_data_direction = SCSI_DATA_READ;
cmd->sc_data_direction = DMA_FROM_DEVICE;
cmd->cmd_len = 10;
cmd->cmnd[0] = READ_BUFFER;
cmd->cmnd[1] = 0x0a;
Expand All @@ -3124,7 +3124,7 @@ ahc_linux_dv_su(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
}
#endif
ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
cmd->sc_data_direction = SCSI_DATA_NONE;
cmd->sc_data_direction = DMA_NONE;
cmd->cmd_len = 6;
cmd->cmnd[0] = START_STOP_UNIT;
cmd->cmnd[4] = le | SSS_START;
Expand Down Expand Up @@ -3659,7 +3659,7 @@ ahc_linux_run_device_queue(struct ahc_softc *ahc, struct ahc_linux_device *dev)

cur_seg = (struct scatterlist *)cmd->request_buffer;
nseg = pci_map_sg(ahc->dev_softc, cur_seg, cmd->use_sg,
scsi_to_pci_dma_dir(cmd->sc_data_direction));
cmd->sc_data_direction);
end_seg = cur_seg + nseg;
/* Copy the segments into the SG list. */
sg = scb->sg_list;
Expand Down Expand Up @@ -3703,7 +3703,7 @@ ahc_linux_run_device_queue(struct ahc_softc *ahc, struct ahc_linux_device *dev)
addr = pci_map_single(ahc->dev_softc,
cmd->request_buffer,
cmd->request_bufflen,
scsi_to_pci_dma_dir(cmd->sc_data_direction));
cmd->sc_data_direction);
scb->platform_data->buf_busaddr = addr;
scb->sg_count = ahc_linux_map_seg(ahc, scb,
sg, addr,
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/scsi/aic7xxx/cam.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ typedef enum {
} ac_code;

typedef enum {
CAM_DIR_IN = SCSI_DATA_READ,
CAM_DIR_OUT = SCSI_DATA_WRITE,
CAM_DIR_NONE = SCSI_DATA_NONE
CAM_DIR_IN = DMA_FROM_DEVICE,
CAM_DIR_OUT = DMA_TO_DEVICE,
CAM_DIR_NONE = DMA_NONE,
} ccb_flags;

#endif /* _AIC7XXX_CAM_H */
8 changes: 4 additions & 4 deletions trunk/drivers/scsi/aic7xxx_old.c
Original file line number Diff line number Diff line change
Expand Up @@ -2700,12 +2700,12 @@ aic7xxx_done(struct aic7xxx_host *p, struct aic7xxx_scb *scb)
struct scatterlist *sg;

sg = (struct scatterlist *)cmd->request_buffer;
pci_unmap_sg(p->pdev, sg, cmd->use_sg, scsi_to_pci_dma_dir(cmd->sc_data_direction));
pci_unmap_sg(p->pdev, sg, cmd->use_sg, cmd->sc_data_direction);
}
else if (cmd->request_bufflen)
pci_unmap_single(p->pdev, aic7xxx_mapping(cmd),
cmd->request_bufflen,
scsi_to_pci_dma_dir(cmd->sc_data_direction));
cmd->sc_data_direction);
if (scb->flags & SCB_SENSE)
{
pci_unmap_single(p->pdev,
Expand Down Expand Up @@ -10228,7 +10228,7 @@ aic7xxx_buildscb(struct aic7xxx_host *p, Scsi_Cmnd *cmd,

sg = (struct scatterlist *)cmd->request_buffer;
scb->sg_length = 0;
use_sg = pci_map_sg(p->pdev, sg, cmd->use_sg, scsi_to_pci_dma_dir(cmd->sc_data_direction));
use_sg = pci_map_sg(p->pdev, sg, cmd->use_sg, cmd->sc_data_direction);
/*
* Copy the segments into the SG array. NOTE!!! - We used to
* have the first entry both in the data_pointer area and the first
Expand Down Expand Up @@ -10256,7 +10256,7 @@ aic7xxx_buildscb(struct aic7xxx_host *p, Scsi_Cmnd *cmd,
{
unsigned int address = pci_map_single(p->pdev, cmd->request_buffer,
cmd->request_bufflen,
scsi_to_pci_dma_dir(cmd->sc_data_direction));
cmd->sc_data_direction);
aic7xxx_mapping(cmd) = address;
scb->sg_list[0].address = cpu_to_le32(address);
scb->sg_list[0].length = cpu_to_le32(cmd->request_bufflen);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/scsi/arm/fas216.c
Original file line number Diff line number Diff line change
Expand Up @@ -2117,7 +2117,7 @@ fas216_std_done(FAS216_Info *info, Scsi_Cmnd *SCpnt, unsigned int result)
SCpnt->SCp.Message = 0;
SCpnt->SCp.Status = 0;
SCpnt->request_bufflen = sizeof(SCpnt->sense_buffer);
SCpnt->sc_data_direction = SCSI_DATA_READ;
SCpnt->sc_data_direction = DMA_FROM_DEVICE;
SCpnt->use_sg = 0;
SCpnt->tag = 0;
SCpnt->host_scribble = (void *)fas216_rq_sns_done;
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/scsi/cpqfcTSinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,12 +642,12 @@ int cpqfcTS_ioctl( struct scsi_device *ScsiDev, int Cmnd, void *arg)
return( -EFAULT);
}
}
ScsiPassThruReq->sr_data_direction = SCSI_DATA_WRITE;
ScsiPassThruReq->sr_data_direction = DMA_TO_DEVICE;
} else if (vendor_cmd->rw_flag == VENDOR_READ_OPCODE) {
ScsiPassThruReq->sr_data_direction = SCSI_DATA_READ;
ScsiPassThruReq->sr_data_direction = DMA_FROM_DEVICE;
} else
// maybe this means a bug in the user app
ScsiPassThruReq->sr_data_direction = SCSI_DATA_NONE;
ScsiPassThruReq->sr_data_direction = DMA_BIDIRECTIONAL;

ScsiPassThruReq->sr_cmd_len = 0; // set correctly by scsi_do_req()
ScsiPassThruReq->sr_sense_buffer[0] = 0;
Expand Down
16 changes: 8 additions & 8 deletions trunk/drivers/scsi/cpqfcTSworker.c
Original file line number Diff line number Diff line change
Expand Up @@ -5129,7 +5129,7 @@ cpqfc_undo_SEST_mappings(struct pci_dev *pcidev,
for (i=*sgPages_head; i != NULL ;i = next)
{
pci_unmap_single(pcidev, i->busaddr, i->maplen,
scsi_to_pci_dma_dir(PCI_DMA_TODEVICE));
PCI_DMA_TODEVICE);
i->busaddr = (dma_addr_t) NULL;
i->maplen = 0L;
next = i->next;
Expand Down Expand Up @@ -5195,7 +5195,7 @@ static ULONG build_SEST_sgList(
contigaddr = ulBuff = pci_map_single(pcidev,
Cmnd->request_buffer,
Cmnd->request_bufflen,
scsi_to_pci_dma_dir(Cmnd->sc_data_direction));
Cmnd->sc_data_direction);
// printk("ms %p ", ulBuff);
}
else {
Expand Down Expand Up @@ -5224,7 +5224,7 @@ static ULONG build_SEST_sgList(
unsigned long btg;
contigaddr = pci_map_single(pcidev, Cmnd->request_buffer,
Cmnd->request_bufflen,
scsi_to_pci_dma_dir(Cmnd->sc_data_direction));
Cmnd->sc_data_direction);

// printk("contigaddr = %p, len = %d\n",
// (void *) contigaddr, bytes_to_go);
Expand All @@ -5247,7 +5247,7 @@ static ULONG build_SEST_sgList(

sgl = (struct scatterlist*)Cmnd->request_buffer;
sg_count = pci_map_sg(pcidev, sgl, Cmnd->use_sg,
scsi_to_pci_dma_dir(Cmnd->sc_data_direction));
Cmnd->sc_data_direction);
if( sg_count <= 3 ) {

// we need to be careful here that no individual mapping
Expand Down Expand Up @@ -5400,7 +5400,7 @@ static ULONG build_SEST_sgList(

cpqfc_undo_SEST_mappings(pcidev, contigaddr,
Cmnd->request_bufflen,
scsi_to_pci_dma_dir(Cmnd->sc_data_direction),
Cmnd->sc_data_direction,
sgl, Cmnd->use_sg, sgPages_head, AllocatedPages+1);

// FIXME: testing shows that if we get here,
Expand Down Expand Up @@ -5946,7 +5946,7 @@ cpqfc_pci_unmap_extended_sg(struct pci_dev *pcidev,
// for each extended scatter gather region needing unmapping...
for (i=fcChip->SEST->sgPages[x_ID] ; i != NULL ; i = i->next)
pci_unmap_single(pcidev, i->busaddr, i->maplen,
scsi_to_pci_dma_dir(PCI_DMA_TODEVICE));
PCI_DMA_TODEVICE);
}

// Called also from cpqfcTScontrol.o, so can't be static
Expand All @@ -5960,14 +5960,14 @@ cpqfc_pci_unmap(struct pci_dev *pcidev,
if (cmd->use_sg) { // Used scatter gather list for data buffer?
cpqfc_pci_unmap_extended_sg(pcidev, fcChip, x_ID);
pci_unmap_sg(pcidev, cmd->buffer, cmd->use_sg,
scsi_to_pci_dma_dir(cmd->sc_data_direction));
cmd->sc_data_direction);
// printk("umsg %d\n", cmd->use_sg);
}
else if (cmd->request_bufflen) {
// printk("ums %p ", fcChip->SEST->u[ x_ID ].IWE.GAddr1);
pci_unmap_single(pcidev, fcChip->SEST->u[ x_ID ].IWE.GAddr1,
cmd->request_bufflen,
scsi_to_pci_dma_dir(cmd->sc_data_direction));
cmd->sc_data_direction);
}
}

Expand Down
Loading

0 comments on commit 57b7ebc

Please sign in to comment.