Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/dreamcast New bus_space and bus_dma framework, base...
details: https://anonhg.NetBSD.org/src/rev/de531350c886
branches: trunk
changeset: 503106:de531350c886
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed Jan 31 18:37:11 2001 +0000
description:
New bus_space and bus_dma framework, based on the Alpha implemetation.
diffstat:
sys/arch/dreamcast/dreamcast/machdep.c | 248 +-------------
sys/arch/dreamcast/include/bus.h | 587 ++++++++++++++++++++++++++++++++-
2 files changed, 591 insertions(+), 244 deletions(-)
diffs (truncated from 871 to 300 lines):
diff -r d40d62dde286 -r de531350c886 sys/arch/dreamcast/dreamcast/machdep.c
--- a/sys/arch/dreamcast/dreamcast/machdep.c Wed Jan 31 18:33:24 2001 +0000
+++ b/sys/arch/dreamcast/dreamcast/machdep.c Wed Jan 31 18:37:11 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.1 2000/12/11 18:19:13 marcus Exp $ */
+/* $NetBSD: machdep.c,v 1.2 2001/01/31 18:37:11 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -105,6 +105,11 @@
#include <sys/kgdb.h>
#endif
+#ifdef DDB
+#include <machine/db_machdep.h>
+#include <ddb/db_extern.h>
+#endif
+
#include <dev/cons.h>
#include <uvm/uvm_extern.h>
@@ -775,7 +780,7 @@
cninit();
#ifdef DDB
- ddb_init();
+ ddb_init(0, NULL, NULL); /* XXX XXX XXX */
#endif
}
@@ -790,245 +795,6 @@
;
}
-int
-bus_space_map (t, addr, size, flags, bshp)
- bus_space_tag_t t;
- bus_addr_t addr;
- bus_size_t size;
- int flags;
- bus_space_handle_t *bshp;
-{
-
- *bshp = (bus_space_handle_t)addr;
-
- return 0;
-}
-
-int
-sh_memio_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;
-{
-
- *nbshp = bsh + offset;
- return (0);
-}
-
-int
-sh_memio_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;
-{
- *bshp = *bpap = rstart;
-
- return (0);
-}
-
-void
-sh_memio_free(t, bsh, size)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t size;
-{
-
-}
-
-void
-sh_memio_unmap(t, bsh, size)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t size;
-{
- return;
-}
-
-#ifdef SH4_PCMCIA
-
-int
-shpcmcia_memio_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;
-{
- int error;
- struct extent *ex;
- bus_space_tag_t pt = t & ~SH3_BUS_SPACE_PCMCIA_8BIT;
-
- if (pt != SH3_BUS_SPACE_PCMCIA_IO &&
- pt != SH3_BUS_SPACE_PCMCIA_MEM &&
- pt != SH3_BUS_SPACE_PCMCIA_ATT) {
- *bshp = (bus_space_handle_t)bpa;
-
- return 0;
- }
-
- ex = iomem_ex;
-
-#if 0
- /*
- * Before we go any further, let's make sure that this
- * region is available.
- */
- error = extent_alloc_region(ex, bpa, size,
- EX_NOWAIT | EX_MALLOCOK );
- if (error){
- printf("sh3_pcmcia_memio_map:extent_alloc_region error\n");
- return (error);
- }
-#endif
-
- /*
- * For memory space, map the bus physical address to
- * a kernel virtual address.
- */
- error = shpcmcia_mem_add_mapping(bpa, size, (int)t, bshp );
-#if 0
- if (error) {
- if (extent_free(ex, bpa, size, EX_NOWAIT | EX_MALLOCOK )) {
- printf("sh3_pcmcia_memio_map: pa 0x%lx, size 0x%lx\n",
- bpa, size);
- printf("sh3_pcmcia_memio_map: can't free region\n");
- }
- }
-#endif
-
- return (error);
-}
-
-int
-shpcmcia_mem_add_mapping(bpa, size, type, bshp)
- bus_addr_t bpa;
- bus_size_t size;
- int type;
- bus_space_handle_t *bshp;
-{
- u_long pa, endpa;
- vaddr_t va;
- pt_entry_t *pte;
- unsigned int m = 0;
- int io_type = type & ~SH3_BUS_SPACE_PCMCIA_8BIT;
-
- pa = sh3_trunc_page(bpa);
- endpa = sh3_round_page(bpa + size);
-
-#ifdef DIAGNOSTIC
- if (endpa <= pa)
- panic("sh3_pcmcia_mem_add_mapping: overflow");
-#endif
-
- va = uvm_km_valloc(kernel_map, endpa - pa);
- if (va == 0){
- printf("shpcmcia_add_mapping: nomem \n");
- return (ENOMEM);
- }
-
- *bshp = (bus_space_handle_t)(va + (bpa & PGOFSET));
-
- if( io_type == SH3_BUS_SPACE_PCMCIA_IO ){
- m = PG_PCMCIA_IO;
- }
- else if( io_type == SH3_BUS_SPACE_PCMCIA_MEM ){
- m = PG_PCMCIA_MEM;
- }
- else if( io_type == SH3_BUS_SPACE_PCMCIA_ATT ){
- m = PG_PCMCIA_ATT;
- }
-
- if( type & SH3_BUS_SPACE_PCMCIA_8BIT ){
- m |= PG_PCMCIA_8;
- }
-
- for (; pa < endpa; pa += NBPG, va += NBPG) {
- pmap_enter(pmap_kernel(), va, pa,
- VM_PROT_READ | VM_PROT_WRITE, TRUE, 0);
-
- pte = kvtopte(va);
- *pte &= ~PG_N;
- *pte |= m;
- pmap_update_pg(va);
- }
-
- return 0;
-}
-
-void
-shpcmcia_memio_unmap(t, bsh, size)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t size;
-{
- struct extent *ex;
- u_long va, endva;
- bus_addr_t bpa;
- bus_space_tag_t pt = t & ~SH3_BUS_SPACE_PCMCIA_8BIT;
-
- if (pt != SH3_BUS_SPACE_PCMCIA_IO &&
- pt != SH3_BUS_SPACE_PCMCIA_MEM &&
- pt != SH3_BUS_SPACE_PCMCIA_ATT) {
- return ;
- }
-
- ex = iomem_ex;
-
- va = sh3_trunc_page(bsh);
- endva = sh3_round_page(bsh + size);
-
-#ifdef DIAGNOSTIC
- if (endva <= va)
- panic("sh3_pcmcia_memio_unmap: overflow");
-#endif
-
- bpa = pmap_extract(pmap_kernel(), va) + (bsh & PGOFSET);
-
- /*
- * Free the kernel virtual mapping.
- */
- uvm_km_free(kernel_map, va, endva - va);
-
-#if 0
- if (extent_free(ex, bpa, size,
- EX_NOWAIT | EX_MALLOCOK)) {
- printf("sh3_pcmcia_memio_unmap: %s 0x%lx, size 0x%lx\n",
- "pa", bpa, size);
- printf("sh3_pcmcia_memio_unmap: can't free region\n");
- }
-#endif
-}
-
-void
-shpcmcia_memio_free(t, bsh, size)
- bus_space_tag_t t;
- bus_space_handle_t bsh;
- bus_size_t size;
-{
-
- /* sh3_pcmcia_memio_unmap() does all that we need to do. */
- shpcmcia_memio_unmap(t, bsh, size);
-}
-
-int
-shpcmcia_memio_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;
-{
-
- *nbshp = bsh + offset;
- return (0);
-}
-
-#endif /* SH4_PCMCIA */
-
#if !defined(DONT_INIT_BSC)
/*
* InitializeBsc
diff -r d40d62dde286 -r de531350c886 sys/arch/dreamcast/include/bus.h
--- a/sys/arch/dreamcast/include/bus.h Wed Jan 31 18:33:24 2001 +0000
+++ b/sys/arch/dreamcast/include/bus.h Wed Jan 31 18:37:11 2001 +0000
@@ -1,7 +1,588 @@
-/* $NetBSD: bus.h,v 1.1 2000/12/11 18:19:14 marcus Exp $ */
+/* $NetBSD: bus.h,v 1.2 2001/01/31 18:37:11 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 1997, 1998, 2000, 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
Home |
Main Index |
Thread Index |
Old Index