diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-02-18 00:24:27 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-02-18 00:24:27 +0000 |
commit | b9558d5f86c471a125abf1fb3a3882fb053b1f8c (patch) | |
tree | 707b53ec64e740a7da87d5f36485e3cd9b1c794e /arch/sparc/kernel/ioport.c | |
parent | b3ac367c7a3e6047abe74817db27e34e759f279f (diff) |
Merge with Linux 2.3.41.
Diffstat (limited to 'arch/sparc/kernel/ioport.c')
-rw-r--r-- | arch/sparc/kernel/ioport.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index e2b6b1ae4..c0ffb2675 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c @@ -1,4 +1,4 @@ -/* $Id: ioport.c,v 1.28 1999/12/27 06:08:28 anton Exp $ +/* $Id: ioport.c,v 1.29 2000/01/22 07:35:25 zaitcev Exp $ * ioport.c: Simple io mapping allocator. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -203,6 +203,7 @@ static void *_sparc_alloc_io(unsigned int busno, unsigned long phys, tlen = strlen(name); tack = kmalloc(sizeof (struct resource) + tlen + 1, GFP_KERNEL); if (tack == NULL) return NULL; + memset(tack, 0, sizeof(struct resource)); res = (struct resource *) tack; tack += sizeof (struct resource); } @@ -285,8 +286,10 @@ void sbus_set_sbus64(struct sbus_dev *sdev, int x) { * Allocate a chunk of memory suitable for DMA. * Typically devices use them for control blocks. * CPU may access them without any explicit flushing. + * + * XXX Some clever people know that sdev is not used and supply NULL. Watch. */ -void *sbus_alloc_consistant(struct sbus_dev *sdev, long len, u32 *dma_addrp) +void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp) { unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK; unsigned long va; @@ -310,26 +313,27 @@ void *sbus_alloc_consistant(struct sbus_dev *sdev, long len, u32 *dma_addrp) /* * printk here may be flooding... Consider removal XXX. */ - printk("sbus_alloc_consistant: no %ld pages\n", len_total>>PAGE_SHIFT); + printk("sbus_alloc_consistent: no %ld pages\n", len_total>>PAGE_SHIFT); return NULL; } if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) { free_pages(va, order); - printk("sbus_alloc_consistant: no core\n"); + printk("sbus_alloc_consistent: no core\n"); return NULL; } + memset((char*)res, 0, sizeof(struct resource)); if (allocate_resource(&sparc_dvma, res, len_total, sparc_dvma.start, sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) { - printk("sbus_alloc_consistant: cannot occupy 0x%lx", len); + printk("sbus_alloc_consistent: cannot occupy 0x%lx", len_total); free_pages(va, order); kfree(res); return NULL; } *dma_addrp = res->start; - mmu_map_dma_area(va, res->start, len); + mmu_map_dma_area(va, res->start, len_total); /* * "Official" or "natural" address of pages we got is va. @@ -342,7 +346,7 @@ void *sbus_alloc_consistant(struct sbus_dev *sdev, long len, u32 *dma_addrp) return (void *)res->start; } -void sbus_free_consistant(struct sbus_dev *sdev, long n, void *p, u32 ba) +void sbus_free_consistent(struct sbus_dev *sdev, long n, void *p, u32 ba) { struct resource *res; unsigned long pgp; @@ -350,18 +354,18 @@ void sbus_free_consistant(struct sbus_dev *sdev, long n, void *p, u32 ba) if ((res = sparc_find_resource_bystart(&sparc_dvma, (unsigned long)p)) == NULL) { - printk("sbus_free_consistant: cannot free %p\n", p); + printk("sbus_free_consistent: cannot free %p\n", p); return; } if (((unsigned long)p & (PAGE_MASK-1)) != 0) { - printk("sbus_free_consistant: unaligned va %p\n", p); + printk("sbus_free_consistent: unaligned va %p\n", p); return; } n = (n + PAGE_SIZE-1) & PAGE_MASK; if ((res->end-res->start)+1 != n) { - printk("sbus_free_consistant: region 0x%lx asked 0x%lx\n", + printk("sbus_free_consistent: region 0x%lx asked 0x%lx\n", (long)((res->end-res->start)+1), n); return; } @@ -386,7 +390,7 @@ void sbus_free_consistant(struct sbus_dev *sdev, long n, void *p, u32 ba) */ u32 sbus_map_single(struct sbus_dev *sdev, void *va, long len) { -#if 0 /* This is the version that abuses consistant space */ +#if 0 /* This is the version that abuses consistent space */ unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK; struct resource *res; @@ -403,6 +407,7 @@ u32 sbus_map_single(struct sbus_dev *sdev, void *va, long len) printk("sbus_map_single: no core\n"); return 0; } + memset((char*)res, 0, sizeof(struct resource)); res->name = va; if (allocate_resource(&sparc_dvma, res, len_total, @@ -433,7 +438,7 @@ u32 sbus_map_single(struct sbus_dev *sdev, void *va, long len) void sbus_unmap_single(struct sbus_dev *sdev, u32 ba, long n) { -#if 0 /* This is the version that abuses consistant space */ +#if 0 /* This is the version that abuses consistent space */ struct resource *res; unsigned long va; |