Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mac68k/mac68k Enhance readability through consisten...
details: https://anonhg.NetBSD.org/src/rev/0da26b7fd62a
branches: trunk
changeset: 499293:0da26b7fd62a
user: scottr <scottr%NetBSD.org@localhost>
date: Thu Nov 16 07:04:12 2000 +0000
description:
Enhance readability through consistent function parameter names and KNF.
There are no functional changes.
diffstat:
sys/arch/mac68k/mac68k/bus_space.c | 830 ++++++++++++++++++------------------
1 files changed, 404 insertions(+), 426 deletions(-)
diffs (truncated from 1542 to 300 lines):
diff -r 45b24716446e -r 0da26b7fd62a sys/arch/mac68k/mac68k/bus_space.c
--- a/sys/arch/mac68k/mac68k/bus_space.c Thu Nov 16 05:34:03 2000 +0000
+++ b/sys/arch/mac68k/mac68k/bus_space.c Thu Nov 16 07:04:12 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_space.c,v 1.12 2000/07/31 22:40:28 briggs Exp $ */
+/* $NetBSD: bus_space.c,v 1.13 2000/11/16 07:04:12 scottr Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -50,20 +50,96 @@
#include <uvm/uvm_extern.h>
-int bus_mem_add_mapping __P((bus_addr_t, bus_size_t,
- int, bus_space_handle_t *));
+int bus_mem_add_mapping __P((bus_addr_t bpa, bus_size_t size, int flags,
+ bus_space_handle_t *hp));
extern struct extent *iomem_ex;
extern int iomem_malloc_safe;
label_t *nofault;
int
-bus_space_map(t, bpa, size, flags, bshp)
- bus_space_tag_t t;
- bus_addr_t bpa;
- bus_size_t size;
- int flags;
- bus_space_handle_t *bshp;
+bus_mem_add_mapping(bus_addr_t bpa, bus_size_t size, int flags,
+ bus_space_handle_t *hp)
+{
+ u_long pa, endpa;
+ vaddr_t va;
+ pt_entry_t *pte;
+
+ pa = m68k_trunc_page(bpa);
+ endpa = m68k_round_page((bpa + size) - 1);
+
+#ifdef DIAGNOSTIC
+ if (endpa <= pa)
+ panic("bus_mem_add_mapping: overflow");
+#endif
+
+ va = uvm_km_valloc(kernel_map, endpa - pa);
+ if (va == 0)
+ return (ENOMEM);
+
+ hp->base = (u_long)(va + m68k_page_offset(bpa));
+ hp->swapped = 0;
+ hp->stride = 1;
+ hp->bsr1 = mac68k_bsr1;
+ hp->bsr2 = mac68k_bsr2;
+ hp->bsr4 = mac68k_bsr4;
+ hp->bsrs1 = mac68k_bsr1;
+ hp->bsrs2 = mac68k_bsr2;
+ hp->bsrs4 = mac68k_bsr4;
+ hp->bsrm1 = mac68k_bsrm1;
+ hp->bsrm2 = mac68k_bsrm2;
+ hp->bsrm4 = mac68k_bsrm4;
+ hp->bsrms1 = mac68k_bsrm1;
+ hp->bsrms2 = mac68k_bsrm2;
+ hp->bsrms4 = mac68k_bsrm4;
+ hp->bsrr1 = mac68k_bsrr1;
+ hp->bsrr2 = mac68k_bsrr2;
+ hp->bsrr4 = mac68k_bsrr4;
+ hp->bsrrs1 = mac68k_bsrr1;
+ hp->bsrrs2 = mac68k_bsrr2;
+ hp->bsrrs4 = mac68k_bsrr4;
+ hp->bsw1 = mac68k_bsw1;
+ hp->bsw2 = mac68k_bsw2;
+ hp->bsw4 = mac68k_bsw4;
+ hp->bsws1 = mac68k_bsw1;
+ hp->bsws2 = mac68k_bsw2;
+ hp->bsws4 = mac68k_bsw4;
+ hp->bswm1 = mac68k_bswm1;
+ hp->bswm2 = mac68k_bswm2;
+ hp->bswm4 = mac68k_bswm4;
+ hp->bswms1 = mac68k_bswm1;
+ hp->bswms2 = mac68k_bswm2;
+ hp->bswms4 = mac68k_bswm4;
+ hp->bswr1 = mac68k_bswr1;
+ hp->bswr2 = mac68k_bswr2;
+ hp->bswr4 = mac68k_bswr4;
+ hp->bswrs1 = mac68k_bswr1;
+ hp->bswrs2 = mac68k_bswr2;
+ hp->bswrs4 = mac68k_bswr4;
+ hp->bssm1 = mac68k_bssm1;
+ hp->bssm2 = mac68k_bssm2;
+ hp->bssm4 = mac68k_bssm4;
+ hp->bssr1 = mac68k_bssr1;
+ hp->bssr2 = mac68k_bssr2;
+ hp->bssr4 = mac68k_bssr4;
+
+ for (; pa < endpa; pa += NBPG, va += NBPG) {
+ pmap_enter(pmap_kernel(), va, pa,
+ VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED);
+ pte = kvtopte(va);
+ if ((flags & BUS_SPACE_MAP_CACHEABLE))
+ *pte &= ~PG_CI;
+ else
+ *pte |= PG_CI;
+ pmap_update();
+ }
+
+ return 0;
+}
+
+int
+bus_space_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags,
+ bus_space_handle_t *hp)
{
paddr_t pa, endpa;
int error;
@@ -85,7 +161,7 @@
panic("bus_space_map: overflow");
#endif
- error = bus_mem_add_mapping(bpa, size, flags, bshp);
+ error = bus_mem_add_mapping(bpa, size, flags, hp);
if (error) {
if (extent_free(iomem_ex, bpa, size, EX_NOWAIT |
(iomem_malloc_safe ? EX_MALLOCOK : 0))) {
@@ -99,13 +175,10 @@
}
int
-bus_space_alloc(t, rstart, rend, size, alignment, boundary, flags, bpap, bshp)
- bus_space_tag_t t;
- bus_addr_t rstart, rend;
- bus_size_t size, alignment, boundary;
- int flags;
- bus_addr_t *bpap;
- bus_space_handle_t *bshp;
+bus_space_alloc(bus_space_tag_t t,
+ bus_addr_t rstart, bus_addr_t rend, bus_size_t size,
+ bus_size_t alignment, bus_size_t boundary, int flags,
+ bus_addr_t *bpap, bus_space_handle_t *hp)
{
u_long bpa;
int error;
@@ -131,7 +204,7 @@
* For memory space, map the bus physical address to
* a kernel virtual address.
*/
- error = bus_mem_add_mapping(bpa, size, flags, bshp);
+ error = bus_mem_add_mapping(bpa, size, flags, hp);
if (error) {
if (extent_free(iomem_ex, bpa, size, EX_NOWAIT |
(iomem_malloc_safe ? EX_MALLOCOK : 0))) {
@@ -146,100 +219,14 @@
return (error);
}
-int
-bus_mem_add_mapping(bpa, size, flags, bshp)
- bus_addr_t bpa;
- bus_size_t size;
- int flags;
- bus_space_handle_t *bshp;
-{
- u_long pa, endpa;
- vaddr_t va;
- pt_entry_t *pte;
-
- pa = m68k_trunc_page(bpa);
- endpa = m68k_round_page((bpa + size) - 1);
-
-#ifdef DIAGNOSTIC
- if (endpa <= pa)
- panic("bus_mem_add_mapping: overflow");
-#endif
-
- va = uvm_km_valloc(kernel_map, endpa - pa);
- if (va == 0)
- return (ENOMEM);
-
- bshp->base = (u_long)(va + m68k_page_offset(bpa));
- bshp->swapped = 0;
- bshp->stride = 1;
- bshp->bsr1 = mac68k_bsr1;
- bshp->bsr2 = mac68k_bsr2;
- bshp->bsr4 = mac68k_bsr4;
- bshp->bsrs1 = mac68k_bsr1;
- bshp->bsrs2 = mac68k_bsr2;
- bshp->bsrs4 = mac68k_bsr4;
- bshp->bsrm1 = mac68k_bsrm1;
- bshp->bsrm2 = mac68k_bsrm2;
- bshp->bsrm4 = mac68k_bsrm4;
- bshp->bsrms1 = mac68k_bsrm1;
- bshp->bsrms2 = mac68k_bsrm2;
- bshp->bsrms4 = mac68k_bsrm4;
- bshp->bsrr1 = mac68k_bsrr1;
- bshp->bsrr2 = mac68k_bsrr2;
- bshp->bsrr4 = mac68k_bsrr4;
- bshp->bsrrs1 = mac68k_bsrr1;
- bshp->bsrrs2 = mac68k_bsrr2;
- bshp->bsrrs4 = mac68k_bsrr4;
- bshp->bsw1 = mac68k_bsw1;
- bshp->bsw2 = mac68k_bsw2;
- bshp->bsw4 = mac68k_bsw4;
- bshp->bsws1 = mac68k_bsw1;
- bshp->bsws2 = mac68k_bsw2;
- bshp->bsws4 = mac68k_bsw4;
- bshp->bswm1 = mac68k_bswm1;
- bshp->bswm2 = mac68k_bswm2;
- bshp->bswm4 = mac68k_bswm4;
- bshp->bswms1 = mac68k_bswm1;
- bshp->bswms2 = mac68k_bswm2;
- bshp->bswms4 = mac68k_bswm4;
- bshp->bswr1 = mac68k_bswr1;
- bshp->bswr2 = mac68k_bswr2;
- bshp->bswr4 = mac68k_bswr4;
- bshp->bswrs1 = mac68k_bswr1;
- bshp->bswrs2 = mac68k_bswr2;
- bshp->bswrs4 = mac68k_bswr4;
- bshp->bssm1 = mac68k_bssm1;
- bshp->bssm2 = mac68k_bssm2;
- bshp->bssm4 = mac68k_bssm4;
- bshp->bssr1 = mac68k_bssr1;
- bshp->bssr2 = mac68k_bssr2;
- bshp->bssr4 = mac68k_bssr4;
-
- for (; pa < endpa; pa += NBPG, va += NBPG) {
- pmap_enter(pmap_kernel(), va, pa,
- VM_PROT_READ | VM_PROT_WRITE, PMAP_WIRED);
- pte = kvtopte(va);
- if ((flags & BUS_SPACE_MAP_CACHEABLE))
- *pte &= ~PG_CI;
- else
- *pte |= PG_CI;
- pmap_update();
- }
-
- return 0;
-}
-
void
-bus_space_unmap(t, bsh, size)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t size;
+bus_space_unmap(bus_space_tag_t t, bus_space_handle_t h, bus_size_t size)
{
vaddr_t va, endva;
bus_addr_t bpa;
- va = m68k_trunc_page(bsh.base);
- endva = m68k_round_page((bsh.base + size) - 1);
+ va = m68k_trunc_page(h.base);
+ endva = m68k_round_page((h.base + size) - 1);
#ifdef DIAGNOSTIC
if (endva <= va)
@@ -247,7 +234,7 @@
#endif
(void) pmap_extract(pmap_kernel(), va, &bpa);
- bpa += m68k_page_offset(bsh.base);
+ bpa += m68k_page_offset(h.base);
/*
* Free the kernel virtual mapping.
@@ -263,34 +250,25 @@
}
void
-bus_space_free(t, bsh, size)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t size;
+bus_space_free(bus_space_tag_t t, bus_space_handle_t h, bus_size_t size)
{
/* bus_space_unmap() does all that we need to do. */
- bus_space_unmap(t, bsh, size);
+ bus_space_unmap(t, h, size);
}
int
-bus_space_subregion(t, bsh, offset, size, nbshp)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t offset, size;
- bus_space_handle_t *nbshp;
+bus_space_subregion(bus_space_tag_t t, bus_space_handle_t h, bus_size_t offset,
+ bus_size_t size, bus_space_handle_t *nhp)
{
- *nbshp = bsh;
- nbshp->base += offset;
+ *nhp = h;
+ nhp->base += offset;
return (0);
}
int
-mac68k_bus_space_probe(t, bsh, offset, sz)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t offset;
Home |
Main Index |
Thread Index |
Old Index