sgiwd93.c (53555fb7bceb14f5fdb9358290daf64d0ea0f56a) | sgiwd93.c (dbb2da557a6a87c88bbb4b1fef037091b57f701b) |
---|---|
1/* 2 * This file is subject to the terms and conditions of the GNU General Public 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * Copyright (C) 1996 David S. Miller (davem@davemloft.net) 7 * Copyright (C) 1999 Andrew R. Baker (andrewb@uab.edu) 8 * Copyright (C) 2001 Florian Lohoff (flo@rfc822.org) --- 55 unchanged lines hidden (view full) --- 64 spin_unlock_irqrestore(host->host_lock, flags); 65 66 return IRQ_HANDLED; 67} 68 69static inline 70void fill_hpc_entries(struct ip22_hostdata *hd, struct scsi_cmnd *cmd, int din) 71{ | 1/* 2 * This file is subject to the terms and conditions of the GNU General Public 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * Copyright (C) 1996 David S. Miller (davem@davemloft.net) 7 * Copyright (C) 1999 Andrew R. Baker (andrewb@uab.edu) 8 * Copyright (C) 2001 Florian Lohoff (flo@rfc822.org) --- 55 unchanged lines hidden (view full) --- 64 spin_unlock_irqrestore(host->host_lock, flags); 65 66 return IRQ_HANDLED; 67} 68 69static inline 70void fill_hpc_entries(struct ip22_hostdata *hd, struct scsi_cmnd *cmd, int din) 71{ |
72 unsigned long len = cmd->SCp.this_residual; 73 void *addr = cmd->SCp.ptr; | 72 struct scsi_pointer *scsi_pointer = WD33C93_scsi_pointer(cmd); 73 unsigned long len = scsi_pointer->this_residual; 74 void *addr = scsi_pointer->ptr; |
74 dma_addr_t physaddr; 75 unsigned long count; 76 struct hpc_chunk *hcp; 77 78 physaddr = dma_map_single(hd->dev, addr, len, DMA_DIR(din)); | 75 dma_addr_t physaddr; 76 unsigned long count; 77 struct hpc_chunk *hcp; 78 79 physaddr = dma_map_single(hd->dev, addr, len, DMA_DIR(din)); |
79 cmd->SCp.dma_handle = physaddr; | 80 scsi_pointer->dma_handle = physaddr; |
80 hcp = hd->cpu; 81 82 while (len) { 83 /* 84 * even cntinfo could be up to 16383, without 85 * magic only 8192 works correctly 86 */ 87 count = len > 8192 ? 8192 : len; --- 13 unchanged lines hidden (view full) --- 101 hcp->desc.cntinfo = HPCDMA_EOX; 102 dma_sync_single_for_device(hd->dev, hd->dma, 103 (unsigned long)(hcp + 1) - (unsigned long)hd->cpu, 104 DMA_TO_DEVICE); 105} 106 107static int dma_setup(struct scsi_cmnd *cmd, int datainp) 108{ | 81 hcp = hd->cpu; 82 83 while (len) { 84 /* 85 * even cntinfo could be up to 16383, without 86 * magic only 8192 works correctly 87 */ 88 count = len > 8192 ? 8192 : len; --- 13 unchanged lines hidden (view full) --- 102 hcp->desc.cntinfo = HPCDMA_EOX; 103 dma_sync_single_for_device(hd->dev, hd->dma, 104 (unsigned long)(hcp + 1) - (unsigned long)hd->cpu, 105 DMA_TO_DEVICE); 106} 107 108static int dma_setup(struct scsi_cmnd *cmd, int datainp) 109{ |
110 struct scsi_pointer *scsi_pointer = WD33C93_scsi_pointer(cmd); |
|
109 struct ip22_hostdata *hdata = host_to_hostdata(cmd->device->host); 110 struct hpc3_scsiregs *hregs = 111 (struct hpc3_scsiregs *) cmd->device->host->base; 112 113 pr_debug("dma_setup: datainp<%d> hcp<%p> ", datainp, hdata->cpu); 114 115 hdata->wh.dma_dir = datainp; 116 117 /* 118 * wd33c93 shouldn't pass us bogus dma_setups, but it does:-( The 119 * other wd33c93 drivers deal with it the same way (which isn't that 120 * obvious). IMHO a better fix would be, not to do these dma setups 121 * in the first place. 122 */ | 111 struct ip22_hostdata *hdata = host_to_hostdata(cmd->device->host); 112 struct hpc3_scsiregs *hregs = 113 (struct hpc3_scsiregs *) cmd->device->host->base; 114 115 pr_debug("dma_setup: datainp<%d> hcp<%p> ", datainp, hdata->cpu); 116 117 hdata->wh.dma_dir = datainp; 118 119 /* 120 * wd33c93 shouldn't pass us bogus dma_setups, but it does:-( The 121 * other wd33c93 drivers deal with it the same way (which isn't that 122 * obvious). IMHO a better fix would be, not to do these dma setups 123 * in the first place. 124 */ |
123 if (cmd->SCp.ptr == NULL || cmd->SCp.this_residual == 0) | 125 if (scsi_pointer->ptr == NULL || scsi_pointer->this_residual == 0) |
124 return 1; 125 126 fill_hpc_entries(hdata, cmd, datainp); 127 128 pr_debug(" HPCGO\n"); 129 130 /* Start up the HPC. */ 131 hregs->ndptr = hdata->dma; 132 if (datainp) 133 hregs->ctrl = HPC3_SCTRL_ACTIVE; 134 else 135 hregs->ctrl = HPC3_SCTRL_ACTIVE | HPC3_SCTRL_DIR; 136 137 return 0; 138} 139 140static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, 141 int status) 142{ | 126 return 1; 127 128 fill_hpc_entries(hdata, cmd, datainp); 129 130 pr_debug(" HPCGO\n"); 131 132 /* Start up the HPC. */ 133 hregs->ndptr = hdata->dma; 134 if (datainp) 135 hregs->ctrl = HPC3_SCTRL_ACTIVE; 136 else 137 hregs->ctrl = HPC3_SCTRL_ACTIVE | HPC3_SCTRL_DIR; 138 139 return 0; 140} 141 142static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, 143 int status) 144{ |
145 struct scsi_pointer *scsi_pointer = WD33C93_scsi_pointer(SCpnt); |
|
143 struct ip22_hostdata *hdata = host_to_hostdata(instance); 144 struct hpc3_scsiregs *hregs; 145 146 if (!SCpnt) 147 return; 148 | 146 struct ip22_hostdata *hdata = host_to_hostdata(instance); 147 struct hpc3_scsiregs *hregs; 148 149 if (!SCpnt) 150 return; 151 |
149 if (SCpnt->SCp.ptr == NULL || SCpnt->SCp.this_residual == 0) | 152 if (scsi_pointer->ptr == NULL || scsi_pointer->this_residual == 0) |
150 return; 151 152 hregs = (struct hpc3_scsiregs *) SCpnt->device->host->base; 153 154 pr_debug("dma_stop: status<%d> ", status); 155 156 /* First stop the HPC and flush it's FIFO. */ 157 if (hdata->wh.dma_dir) { 158 hregs->ctrl |= HPC3_SCTRL_FLUSH; 159 while (hregs->ctrl & HPC3_SCTRL_ACTIVE) 160 barrier(); 161 } 162 hregs->ctrl = 0; | 153 return; 154 155 hregs = (struct hpc3_scsiregs *) SCpnt->device->host->base; 156 157 pr_debug("dma_stop: status<%d> ", status); 158 159 /* First stop the HPC and flush it's FIFO. */ 160 if (hdata->wh.dma_dir) { 161 hregs->ctrl |= HPC3_SCTRL_FLUSH; 162 while (hregs->ctrl & HPC3_SCTRL_ACTIVE) 163 barrier(); 164 } 165 hregs->ctrl = 0; |
163 dma_unmap_single(hdata->dev, SCpnt->SCp.dma_handle, 164 SCpnt->SCp.this_residual, | 166 dma_unmap_single(hdata->dev, scsi_pointer->dma_handle, 167 scsi_pointer->this_residual, |
165 DMA_DIR(hdata->wh.dma_dir)); 166 167 pr_debug("\n"); 168} 169 170void sgiwd93_reset(unsigned long base) 171{ 172 struct hpc3_scsiregs *hregs = (struct hpc3_scsiregs *) base; --- 35 unchanged lines hidden (view full) --- 208 .queuecommand = wd33c93_queuecommand, 209 .eh_abort_handler = wd33c93_abort, 210 .eh_host_reset_handler = wd33c93_host_reset, 211 .can_queue = 16, 212 .this_id = 7, 213 .sg_tablesize = SG_ALL, 214 .cmd_per_lun = 8, 215 .dma_boundary = PAGE_SIZE - 1, | 168 DMA_DIR(hdata->wh.dma_dir)); 169 170 pr_debug("\n"); 171} 172 173void sgiwd93_reset(unsigned long base) 174{ 175 struct hpc3_scsiregs *hregs = (struct hpc3_scsiregs *) base; --- 35 unchanged lines hidden (view full) --- 211 .queuecommand = wd33c93_queuecommand, 212 .eh_abort_handler = wd33c93_abort, 213 .eh_host_reset_handler = wd33c93_host_reset, 214 .can_queue = 16, 215 .this_id = 7, 216 .sg_tablesize = SG_ALL, 217 .cmd_per_lun = 8, 218 .dma_boundary = PAGE_SIZE - 1, |
219 .cmd_size = sizeof(struct scsi_pointer), |
|
216}; 217 218static int sgiwd93_probe(struct platform_device *pdev) 219{ 220 struct sgiwd93_platform_data *pd = pdev->dev.platform_data; 221 unsigned char *wdregs = pd->wdregs; 222 struct hpc3_scsiregs *hregs = pd->hregs; 223 struct ip22_hostdata *hdata; --- 105 unchanged lines hidden --- | 220}; 221 222static int sgiwd93_probe(struct platform_device *pdev) 223{ 224 struct sgiwd93_platform_data *pd = pdev->dev.platform_data; 225 unsigned char *wdregs = pd->wdregs; 226 struct hpc3_scsiregs *hregs = pd->hregs; 227 struct ip22_hostdata *hdata; --- 105 unchanged lines hidden --- |