* [PATCH] make use of on-chip coherent memory in NCR Q720 driver
@ 2004-07-01 2:55 James Bottomley
0 siblings, 0 replies; only message in thread
From: James Bottomley @ 2004-07-01 2:55 UTC (permalink / raw)
To: Linux Kernel; +Cc: Ian Molton, tony, jamey.hicks, joshua, david-b, Russell King
This is actually a use for the implementation. The Q720 card has 2MB
on-chip memory designed for scripts and cdb allocation. declaring it
using the API allows the ncr53c8xx driver to make use of it
transparently. This board is actually provides the root disc of one of
my voyagers, so I've verified that it actually all works.
James
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/06/30 21:44:24-05:00 jejb@mulgrave.(none)
# Convert NCR_Q720 to use dma_declare_coherent_memory
#
# This board makes an ideal example for using the API
# since it consists of 4 SCSI I/O processors and a
# 0.5-2MB block of memory on a single MCA card.
#
# drivers/scsi/NCR_Q720.c
# 2004/06/30 21:44:03-05:00 jejb@mulgrave.(none) +18 -3
# Convert NCR_Q720 to use dma_declare_coherent_memory
#
diff -Nru a/drivers/scsi/NCR_Q720.c b/drivers/scsi/NCR_Q720.c
--- a/drivers/scsi/NCR_Q720.c 2004-06-30 21:54:45 -05:00
+++ b/drivers/scsi/NCR_Q720.c 2004-06-30 21:54:46 -05:00
@@ -216,7 +216,21 @@
goto out_free;
}
- mem_base = (__u32)ioremap(base_addr, mem_size);
+ if (dma_declare_coherent_memory(dev, base_addr, base_addr,
+ mem_size, DMA_MEMORY_MAP)
+ != DMA_MEMORY_MAP) {
+ printk(KERN_ERR "NCR_Q720: DMA declare memory failed\n");
+ goto out_release_region;
+ }
+
+ /* The first 1k of the memory buffer is a memory map of the registers
+ */
+ mem_base = (__u32)dma_mark_declared_memory_occupied(dev, base_addr,
+ 1024);
+ if (IS_ERR((void *)mem_base)) {
+ printk("NCR_Q720 failed to reserve memory mapped region\n");
+ goto out_release;
+ }
/* now also enable accesses in asr 2 */
asr2 = inb(io_base + 0x0a);
@@ -296,7 +310,8 @@
return 0;
out_release:
- iounmap((void *)mem_base);
+ dma_release_declared_memory(dev);
+ out_release_region:
release_mem_region(base_addr, mem_size);
out_free:
kfree(p);
@@ -321,7 +336,7 @@
if(p->hosts[i])
NCR_Q720_remove_one(p->hosts[i]);
- iounmap((void *)p->mem_base);
+ dma_release_declared_memory(dev);
release_mem_region(p->phys_mem_base, p->mem_size);
free_irq(p->irq, p);
kfree(p);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-07-01 2:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-01 2:55 [PATCH] make use of on-chip coherent memory in NCR Q720 driver James Bottomley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®