Commit 22863a70 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Torvalds

[PATCH] M68k update (part 37)

SCSI scatterlist updates for m68k
  - Fix printk() format
  - Update for page/offset in scatterlist
parent 3b168e68
......@@ -1144,8 +1144,8 @@ ncr53c7xx_init (Scsi_Host_Template *tpnt, int board, int chip,
return -1;
}
printk("scsi-ncr53c7xx : %s at memory 0x%x, io 0x%x, irq %d",
chip_str, (unsigned) base, io_port, irq);
printk("scsi-ncr53c7xx : %s at memory 0x%lx, io 0x%x, irq %d",
chip_str, base, io_port, irq);
if (dma == DMA_NONE)
printk("\n");
else
......@@ -3459,9 +3459,10 @@ create_cmd (Scsi_Cmnd *cmd) {
for (i = 0; cmd->use_sg ? (i < cmd->use_sg) : !i; cmd_datain += 4,
cmd_dataout += 4, ++i) {
u32 vbuf = cmd->use_sg ?
(u32)(((struct scatterlist *)cmd->buffer)[i].address) :
(u32)(cmd->request_buffer);
u32 vbuf = cmd->use_sg
? (u32)page_address(((struct scatterlist *)cmd->buffer)[i].page)+
((struct scatterlist *)cmd->buffer)[i].offset
: (u32)(cmd->request_buffer);
u32 bbuf = virt_to_bus((void *)vbuf);
u32 count = cmd->use_sg ?
((struct scatterlist *)cmd->buffer)[i].length :
......@@ -5428,16 +5429,16 @@ insn_to_offset (Scsi_Cmnd *cmd, u32 *insn) {
if ((buffers = cmd->use_sg)) {
for (offset = 0,
segment = (struct scatterlist *) cmd->buffer;
buffers && !((found = ((ptr >= segment->address) &&
(ptr < (segment->address + segment->length)))));
buffers && !((found = ((ptr >= (char *)page_address(segment->page)+segment->offset) &&
(ptr < ((char *)page_address(segment->page)+segment->offset+segment->length)))));
--buffers, offset += segment->length, ++segment)
#if 0
printk("scsi%d: comparing 0x%p to 0x%p\n",
cmd->host->host_no, saved, segment->address);
cmd->host->host_no, saved, page_address(segment->page+segment->offset);
#else
;
#endif
offset += ptr - segment->address;
offset += ptr - ((char *)page_address(segment->page)+segment->offset);
} else {
found = 1;
offset = ptr - (char *) (cmd->request_buffer);
......
......@@ -337,7 +337,8 @@ static __inline__ void initialize_SCp(Scsi_Cmnd * cmd)
if (cmd->use_sg) {
cmd->SCp.buffer = (struct scatterlist *) cmd->buffer;
cmd->SCp.buffers_residual = cmd->use_sg - 1;
cmd->SCp.ptr = (char *) cmd->SCp.buffer->address;
cmd->SCp.ptr = page_address(cmd->SCp.buffer->page)+
cmd->SCp.buffer->offset;
cmd->SCp.this_residual = cmd->SCp.buffer->length;
} else {
cmd->SCp.buffer = NULL;
......@@ -2308,7 +2309,8 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
++cmd->SCp.buffer;
--cmd->SCp.buffers_residual;
cmd->SCp.this_residual = cmd->SCp.buffer->length;
cmd->SCp.ptr = cmd->SCp.buffer->address;
cmd->SCp.ptr = page_address(cmd->SCp.buffer->page)+
cmd->SCp.buffer->offset;
dprintk(NDEBUG_INFORMATION, ("scsi%d : %d bytes and %d buffers left\n", instance->host_no, cmd->SCp.this_residual, cmd->SCp.buffers_residual));
}
/*
......
......@@ -474,8 +474,8 @@ static void merge_contiguous_buffers( Scsi_Cmnd *cmd )
for (endaddr = virt_to_phys(cmd->SCp.ptr + cmd->SCp.this_residual - 1) + 1;
cmd->SCp.buffers_residual &&
virt_to_phys(cmd->SCp.buffer[1].address) == endaddr; ) {
virt_to_phys(page_address(cmd->SCp.buffer[1].page)+
cmd->SCp.buffer[1].offset) == endaddr; ) {
MER_PRINTK("VTOP(%p) == %08lx -> merging\n",
cmd->SCp.buffer[1].address, endaddr);
#if (NDEBUG & NDEBUG_MERGING)
......@@ -512,7 +512,8 @@ static __inline__ void initialize_SCp(Scsi_Cmnd *cmd)
if (cmd->use_sg) {
cmd->SCp.buffer = (struct scatterlist *) cmd->buffer;
cmd->SCp.buffers_residual = cmd->use_sg - 1;
cmd->SCp.ptr = (char *) cmd->SCp.buffer->address;
cmd->SCp.ptr = (char *)page_address(cmd->SCp.buffer->page)+
cmd->SCp.buffer->offset;
cmd->SCp.this_residual = cmd->SCp.buffer->length;
/* ++roman: Try to merge some scatter-buffers if they are at
* contiguous physical addresses.
......@@ -2060,7 +2061,8 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
++cmd->SCp.buffer;
--cmd->SCp.buffers_residual;
cmd->SCp.this_residual = cmd->SCp.buffer->length;
cmd->SCp.ptr = cmd->SCp.buffer->address;
cmd->SCp.ptr = page_address(cmd->SCp.buffer->page)+
cmd->SCp.buffer->offset;
/* ++roman: Try to merge some scatter-buffers if
* they are at contiguous physical addresses.
*/
......
......@@ -554,8 +554,8 @@ void dma_mmu_get_scsi_one(struct NCR_ESP *esp, Scsi_Cmnd *sp)
void dma_mmu_get_scsi_sgl(struct NCR_ESP *esp, Scsi_Cmnd *sp)
{
sp->SCp.ptr =
sp->SCp.buffer->address;
sp->SCp.ptr = page_address(sp->SCp.buffer->page)+
sp->SCp.buffer->offset;
}
void dma_mmu_release_scsi_one(struct NCR_ESP *esp, Scsi_Cmnd *sp)
......@@ -568,7 +568,8 @@ void dma_mmu_release_scsi_sgl(struct NCR_ESP *esp, Scsi_Cmnd *sp)
void dma_advance_sg(Scsi_Cmnd *sp)
{
sp->SCp.ptr = sp->SCp.buffer->address;
sp->SCp.ptr = page_address(sp->SCp.buffer->page)+
sp->SCp.buffer->offset;
}
......
......@@ -2,17 +2,15 @@
#define _M68K_SCATTERLIST_H
struct scatterlist {
/* These two are only valid if ADDRESS member of this
* struct is NULL.
*/
struct page *page;
unsigned int offset;
unsigned int length;
unsigned long dvma_address;
};
struct mmu_sglist {
char *addr;
char *__dont_touch;
unsigned int len;
unsigned long dvma_addr;
__u32 dvma_address; /* A place to hang host-specific addresses at. */
};
/* This is bogus and should go away. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment