Lines Matching refs:cmd

56 static int dma_setup (Scsi_Cmnd *cmd, int dir_in)  in dma_setup()  argument
59 unsigned long addr = virt_to_bus(cmd->SCp.ptr); in dma_setup()
64 if (addr & HDATA(cmd->host)->dma_xfer_mask || in dma_setup()
65 (!dir_in && mm_end_of_chunk (addr, cmd->SCp.this_residual))) in dma_setup()
67 HDATA(cmd->host)->dma_bounce_len = (cmd->SCp.this_residual + 511) in dma_setup()
71 HDATA(cmd->host)->dma_bounce_buffer = in dma_setup()
72 scsi_malloc (HDATA(cmd->host)->dma_bounce_len); in dma_setup()
73 HDATA(cmd->host)->dma_buffer_pool = BUF_SCSI_ALLOCED; in dma_setup()
76 if ( scsi_alloc_out_of_range || !HDATA(cmd->host)->dma_bounce_buffer) { in dma_setup()
77 HDATA(cmd->host)->dma_bounce_buffer = in dma_setup()
78 amiga_chip_alloc(HDATA(cmd->host)->dma_bounce_len, in dma_setup()
81 if(!HDATA(cmd->host)->dma_bounce_buffer) in dma_setup()
83 HDATA(cmd->host)->dma_bounce_len = 0; in dma_setup()
87 HDATA(cmd->host)->dma_buffer_pool = BUF_CHIP_ALLOCED; in dma_setup()
91 addr = virt_to_bus(HDATA(cmd->host)->dma_bounce_buffer); in dma_setup()
93 if (addr & HDATA(cmd->host)->dma_xfer_mask) { in dma_setup()
95 if( HDATA(cmd->host)->dma_buffer_pool == BUF_SCSI_ALLOCED) { in dma_setup()
96 scsi_free (HDATA(cmd->host)->dma_bounce_buffer, in dma_setup()
97 HDATA(cmd->host)->dma_bounce_len); in dma_setup()
100 amiga_chip_free (HDATA(cmd->host)->dma_bounce_buffer); in dma_setup()
103 HDATA(cmd->host)->dma_bounce_buffer = in dma_setup()
104 amiga_chip_alloc(HDATA(cmd->host)->dma_bounce_len, in dma_setup()
107 if(!HDATA(cmd->host)->dma_bounce_buffer) in dma_setup()
109 HDATA(cmd->host)->dma_bounce_len = 0; in dma_setup()
113 addr = virt_to_bus(HDATA(cmd->host)->dma_bounce_buffer); in dma_setup()
114 HDATA(cmd->host)->dma_buffer_pool = BUF_CHIP_ALLOCED; in dma_setup()
119 memcpy (HDATA(cmd->host)->dma_bounce_buffer, in dma_setup()
120 cmd->SCp.ptr, cmd->SCp.this_residual); in dma_setup()
128 HDATA(cmd->host)->dma_dir = dir_in; in dma_setup()
129 DMA(cmd->host)->CNTR = cntr; in dma_setup()
132 DMA(cmd->host)->ACR = addr; in dma_setup()
136 cache_clear (addr, cmd->SCp.this_residual); in dma_setup()
139 cache_push (addr, cmd->SCp.this_residual); in dma_setup()
141 if ((bank_mask = (~HDATA(cmd->host)->dma_xfer_mask >> 18) & 0x01c0)) in dma_setup()
142 DMA(cmd->host)->BANK = bank_mask & (addr >> 18); in dma_setup()
145 DMA(cmd->host)->ST_DMA = 1; in dma_setup()