X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fsh%2Fkernel%2Fcpu%2Fsh4%2Fsq.c;h=8ab1855ff936206b814fde2cec22093c80cb4c0c;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=7a0eb521ee7f55581c4ebedd432156625f3129a7;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c index 7a0eb521e..8ab1855ff 100644 --- a/arch/sh/kernel/cpu/sh4/sq.c +++ b/arch/sh/kernel/cpu/sh4/sq.c @@ -32,13 +32,10 @@ #include static LIST_HEAD(sq_mapping_list); -static spinlock_t sq_mapping_lock = SPIN_LOCK_UNLOCKED; - -extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, unsigned long start, unsigned long end); +static DEFINE_SPINLOCK(sq_mapping_lock); /** * sq_flush - Flush (prefetch) the store queue cache - * * @addr: the store queue address to flush * * Executes a prefetch instruction on the specified store queue cache, @@ -51,7 +48,6 @@ inline void sq_flush(void *addr) /** * sq_flush_range - Flush (prefetch) a specific SQ range - * * @start: the store queue address to start flushing from * @len: the length to flush * @@ -101,7 +97,7 @@ static unsigned long __sq_get_next_addr(void) { if (!list_empty(&sq_mapping_list)) { struct list_head *pos, *tmp; - + /* * Read one off the list head, as it will have the highest * mapped allocation. Set the next one up right above it. @@ -128,11 +124,10 @@ static unsigned long __sq_get_next_addr(void) /** * __sq_remap - Perform a translation from the SQ to a phys addr + * @map: sq mapping containing phys and store queue addresses. * - * @phys: Physical address to map store queues too. - * @virt: Associated store queue address. - * - * Maps the store queue address @virt to the physical address @phys. + * Maps the store queue address specified in the mapping to the physical + * address specified in the mapping. */ static struct sq_mapping *__sq_remap(struct sq_mapping *map) { @@ -212,7 +207,6 @@ static struct sq_mapping *__sq_remap(struct sq_mapping *map) /** * sq_remap - Map a physical address through the Store Queues - * * @phys: Physical address of mapping. * @size: Length of mapping. * @name: User invoking mapping. @@ -256,7 +250,6 @@ struct sq_mapping *sq_remap(unsigned long phys, unsigned int size, const char *n /** * sq_unmap - Unmap a Store Queue allocation - * * @map: Pre-allocated Store Queue mapping. * * Unmaps the store queue allocation @map that was previously created by @@ -274,7 +267,6 @@ void sq_unmap(struct sq_mapping *map) /** * sq_clear - Clear a store queue range - * * @addr: Address to start clearing from. * @len: Length to clear. * @@ -284,7 +276,7 @@ void sq_unmap(struct sq_mapping *map) void sq_clear(unsigned long addr, unsigned int len) { int i; - + /* Clear out both queues linearly */ for (i = 0; i < 8; i++) { ctrl_outl(0, addr + i + 0); @@ -296,7 +288,6 @@ void sq_clear(unsigned long addr, unsigned int len) /** * sq_vma_unmap - Unmap a VMA range - * * @area: VMA containing range. * @addr: Start of range. * @len: Length of range. @@ -316,25 +307,24 @@ static void sq_vma_unmap(struct vm_area_struct *area, entry = list_entry(pos, typeof(*entry), list); if (entry->sq_addr == addr) { - /* + /* * We could probably get away without doing the tlb flush * here, as generic code should take care of most of this * when unmapping the rest of the VMA range for us. Leave * it in for added sanity for the time being.. */ __flush_tlb_page(get_asid(), entry->sq_addr & PAGE_MASK); - + list_del(&entry->list); kfree(entry); return; - } + } } } /** * sq_vma_sync - Sync a VMA range - * * @area: VMA containing range. * @start: Start of range. * @len: Length of range. @@ -361,7 +351,6 @@ static struct vm_operations_struct sq_vma_ops = { /** * sq_mmap - mmap() for /dev/cpu/sq - * * @file: unused. * @vma: VMA to remap. * @@ -375,7 +364,7 @@ static int sq_mmap(struct file *file, struct vm_area_struct *vma) unsigned long size = vma->vm_end - vma->vm_start; struct sq_mapping *map; - /* + /* * We're not interested in any arbitrary virtual address that has * been stuck in the VMA, as we already know what addresses we * want. Save off the size, and reposition the VMA to begin at @@ -393,7 +382,7 @@ static int sq_mmap(struct file *file, struct vm_area_struct *vma) if (io_remap_page_range(vma, map->sq_addr, map->addr, size, vma->vm_page_prot)) return -EAGAIN; - + vma->vm_ops = &sq_vma_ops; return 0; @@ -408,7 +397,7 @@ static int sq_mapping_read_proc(char *buf, char **start, off_t off, list_for_each_prev(pos, &sq_mapping_list) { struct sq_mapping *entry; - + entry = list_entry(pos, typeof(*entry), list); p += sprintf(p, "%08lx-%08lx [%08lx]: %s\n", entry->sq_addr,