aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavem <davem>2002-01-15 07:08:21 +0000
committerdavem <davem>2002-01-15 07:08:21 +0000
commitb812f5e02faa4c3ef7074ace4b2dc4df5781a636 (patch)
tree8e2e86f8857a6a0c08c42c09577e5ca286687230
parent437022d24342abc11b0e57a81b56626a3e6b9bc4 (diff)
downloadnetdev-vger-cvs-b812f5e02faa4c3ef7074ace4b2dc4df5781a636.tar.gz
Revert bogus local changes.
-rw-r--r--drivers/scsi/u14-34f.c86
1 files changed, 77 insertions, 9 deletions
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index 328598332..2f7f1cab8 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -550,8 +550,7 @@ static unsigned long io_port[] = {
#define H2DEV(x) cpu_to_le32(x)
#define DEV2H(x) le32_to_cpu(x)
-#define V2DEV(addr) ((addr) ? H2DEV(isa_virt_to_bus((void *)addr)) : 0)
-#define DEV2V(addr) ((addr) ? DEV2H(isa_bus_to_virt((unsigned long)addr)) : 0)
+#define V2DEV(addr) ((addr) ? H2DEV(virt_to_bus((void *)addr)) : 0)
static void do_interrupt_handler(int, void *, struct pt_regs *);
static void flush_dev(Scsi_Device *, unsigned long, unsigned int, unsigned int);
@@ -977,26 +976,95 @@ int u14_34f_detect(Scsi_Host_Template *tpnt) {
return j;
}
-static inline void build_sg_list(struct mscp *cpp, Scsi_Cmnd *SCpnt) {
- unsigned int k, data_len = 0;
+static inline void map_dma(unsigned int i, unsigned int j) {
+ unsigned int data_len = 0;
+ unsigned int k, count, pci_dir;
struct scatterlist *sgpnt;
+ struct mscp *cpp;
+ Scsi_Cmnd *SCpnt;
+
+ cpp = &HD(j)->cp[i]; SCpnt = cpp->SCpnt;
+ pci_dir = scsi_to_pci_dma_dir(SCpnt->sc_data_direction);
+
+ if (SCpnt->sense_buffer)
+ cpp->sense_addr = H2DEV(pci_map_single(HD(j)->pdev, SCpnt->sense_buffer,
+ sizeof SCpnt->sense_buffer, PCI_DMA_FROMDEVICE));
+
+ cpp->sense_len = sizeof SCpnt->sense_buffer;
+
+ if (!SCpnt->use_sg) {
+
+ if (!SCpnt->request_bufflen)
+ cpp->data_address = V2DEV(SCpnt->request_buffer);
+
+ else if (SCpnt->request_buffer)
+ cpp->data_address = H2DEV(pci_map_single(HD(j)->pdev,
+ SCpnt->request_buffer, SCpnt->request_bufflen, pci_dir));
+
+ cpp->data_len = H2DEV(SCpnt->request_bufflen);
+ return;
+ }
sgpnt = (struct scatterlist *) SCpnt->request_buffer;
+ count = pci_map_sg(HD(j)->pdev, sgpnt, SCpnt->use_sg, pci_dir);
- for (k = 0; k < SCpnt->use_sg; k++) {
- cpp->sglist[k].address = V2DEV(page_address(sgpnt[k].page)) + sgpnt[k].offset;
- cpp->sglist[k].num_bytes = H2DEV(sgpnt[k].length);
+ for (k = 0; k < count; k++) {
+ cpp->sglist[k].address = H2DEV(sg_dma_address(&sgpnt[k]));
+ cpp->sglist[k].num_bytes = H2DEV(sg_dma_len(&sgpnt[k]));
data_len += sgpnt[k].length;
}
+ cpp->sg = TRUE;
cpp->use_sg = SCpnt->use_sg;
cpp->data_address = V2DEV(cpp->sglist);
cpp->data_len = H2DEV(data_len);
}
-static inline int do_qcomm(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) {
- unsigned int i, j, k;
+static void unmap_dma(unsigned int i, unsigned int j) {
+ unsigned int pci_dir;
struct mscp *cpp;
+ Scsi_Cmnd *SCpnt;
+
+ cpp = &HD(j)->cp[i]; SCpnt = cpp->SCpnt;
+ pci_dir = scsi_to_pci_dma_dir(SCpnt->sc_data_direction);
+
+ if (DEV2H(cpp->sense_addr))
+ pci_unmap_single(HD(j)->pdev, DEV2H(cpp->sense_addr),
+ DEV2H(cpp->sense_len), PCI_DMA_FROMDEVICE);
+
+ if (SCpnt->use_sg)
+ pci_unmap_sg(HD(j)->pdev, SCpnt->request_buffer, SCpnt->use_sg, pci_dir);
+
+ else if (DEV2H(cpp->data_address) && DEV2H(cpp->data_len))
+ pci_unmap_single(HD(j)->pdev, DEV2H(cpp->data_address),
+ DEV2H(cpp->data_len), pci_dir);
+
+}
+
+static void sync_dma(unsigned int i, unsigned int j) {
+ unsigned int pci_dir;
+ struct mscp *cpp;
+ Scsi_Cmnd *SCpnt;
+
+ cpp = &HD(j)->cp[i]; SCpnt = cpp->SCpnt;
+ pci_dir = scsi_to_pci_dma_dir(SCpnt->sc_data_direction);
+
+ if (DEV2H(cpp->sense_addr))
+ pci_dma_sync_single(HD(j)->pdev, DEV2H(cpp->sense_addr),
+ DEV2H(cpp->sense_len), PCI_DMA_FROMDEVICE);
+
+ if (SCpnt->use_sg)
+ pci_dma_sync_sg(HD(j)->pdev, SCpnt->request_buffer,
+ SCpnt->use_sg, pci_dir);
+
+ else if (DEV2H(cpp->data_address) && DEV2H(cpp->data_len))
+ pci_dma_sync_single(HD(j)->pdev, DEV2H(cpp->data_address),
+ DEV2H(cpp->data_len), pci_dir);
+
+}
+
+static inline void scsi_to_dev_dir(unsigned int i, unsigned int j) {
+ unsigned int k;
static const unsigned char data_out_cmds[] = {
0x0a, 0x2a, 0x15, 0x55, 0x04, 0x07, 0x18, 0x1d, 0x24, 0x2e,