Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Switch sparc and sparc64 to new-style <sys/bus.h>.



details:   https://anonhg.NetBSD.org/src/rev/2319d63fb2db
branches:  trunk
changeset: 767390:2319d63fb2db
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Sun Jul 17 23:29:10 2011 +0000

description:
Switch sparc and sparc64 to new-style <sys/bus.h>.

diffstat:

 sys/arch/sparc/include/bus.h         |  1744 ----------------------------------
 sys/arch/sparc/include/types.h       |     4 +-
 sys/arch/sparc/sparc/machdep.c       |   892 +++++++++++++++++-
 sys/arch/sparc64/include/bus.h       |  1594 -------------------------------
 sys/arch/sparc64/include/bus_defs.h  |     8 +-
 sys/arch/sparc64/include/bus_funcs.h |     8 +-
 sys/arch/sparc64/sparc64/machdep.c   |   634 ++++++++++++-
 7 files changed, 1530 insertions(+), 3354 deletions(-)

diffs (truncated from 4998 to 300 lines):

diff -r 744dec9c3c61 -r 2319d63fb2db sys/arch/sparc/include/bus.h
--- a/sys/arch/sparc/include/bus.h      Sun Jul 17 23:27:02 2011 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,1744 +0,0 @@
-/*     $NetBSD: bus.h,v 1.56 2009/05/26 03:30:25 macallan Exp $        */
-
-/*-
- * Copyright (c) 1996, 1997, 1998, 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1996 Charles M. Hannum.  All rights reserved.
- * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
- *
- * 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
- *    must display the following acknowledgement:
- *      This product includes software developed by Christopher G. Demetriou
- *     for the NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _SPARC_BUS_H_
-#define _SPARC_BUS_H_
-
-#define        SPARC_BUS_SPACE 0
-
-/*
- * Bus address and size types
- */
-typedef        u_long          bus_space_handle_t;
-typedef uint64_t       bus_addr_t;
-typedef u_long         bus_size_t;
-
-/* bus_addr_t is extended to 64-bits and has the iospace encoded in it */
-#define        BUS_ADDR_IOSPACE(x)     ((x)>>32)
-#define        BUS_ADDR_PADDR(x)       ((x)&0xffffffff)
-#define        BUS_ADDR(io, pa)        \
-       ((((uint64_t)(uint32_t)(io))<<32) | (uint32_t)(pa))
-
-#define __BUS_SPACE_HAS_STREAM_METHODS 1
-
-/*
- * Access methods for bus resources and address space.
- */
-typedef struct sparc_bus_space_tag     *bus_space_tag_t;
-
-struct sparc_bus_space_tag {
-       void            *cookie;
-       bus_space_tag_t parent;
-
-       /*
-        * Windows onto the parent bus that this tag maps.  If ranges
-        * is non-NULL, the address will be translated, and recursively
-        * mapped via the parent tag.
-        */
-       struct openprom_range *ranges;
-       int nranges;
-
-       int     (*sparc_bus_map)(
-                               bus_space_tag_t,
-                               bus_addr_t,
-                               bus_size_t,
-                               int,                    /*flags*/
-                               vaddr_t,                /*preferred vaddr*/
-                               bus_space_handle_t *);
-       int     (*sparc_bus_unmap)(
-                               bus_space_tag_t,
-                               bus_space_handle_t,
-                               bus_size_t);
-       int     (*sparc_bus_subregion)(
-                               bus_space_tag_t,
-                               bus_space_handle_t,
-                               bus_size_t,             /*offset*/
-                               bus_size_t,             /*size*/
-                               bus_space_handle_t *);
-
-       void    (*sparc_bus_barrier)(
-                               bus_space_tag_t,
-                               bus_space_handle_t,
-                               bus_size_t,             /*offset*/
-                               bus_size_t,             /*size*/
-                               int);                   /*flags*/
-
-       paddr_t (*sparc_bus_mmap)(
-                               bus_space_tag_t,
-                               bus_addr_t,
-                               off_t,
-                               int,                    /*prot*/
-                               int);                   /*flags*/
-
-       void    *(*sparc_intr_establish)(
-                               bus_space_tag_t,
-                               int,                    /*bus-specific intr*/
-                               int,                    /*device class level,
-                                                         see machine/intr.h*/
-                               int (*)(void *),        /*handler*/
-                               void *,                 /*handler arg*/
-                               void (*)(void));        /*optional fast vector*/
-
-       uint8_t (*sparc_read_1)(
-                               bus_space_tag_t space,
-                               bus_space_handle_t handle,
-                               bus_size_t offset);
-
-       uint16_t (*sparc_read_2)(
-                               bus_space_tag_t space,
-                               bus_space_handle_t handle,
-                               bus_size_t offset);
-
-       uint32_t (*sparc_read_4)(
-                               bus_space_tag_t space,
-                               bus_space_handle_t handle,
-                               bus_size_t offset);
-
-       uint64_t (*sparc_read_8)(
-                               bus_space_tag_t space,
-                               bus_space_handle_t handle,
-                               bus_size_t offset);
-
-       void    (*sparc_write_1)(
-                               bus_space_tag_t space,
-                               bus_space_handle_t handle,
-                               bus_size_t offset,
-                               uint8_t value);
-
-       void    (*sparc_write_2)(
-                               bus_space_tag_t space,
-                               bus_space_handle_t handle,
-                               bus_size_t offset,
-                               uint16_t value);
-
-       void    (*sparc_write_4)(
-                               bus_space_tag_t space,
-                               bus_space_handle_t handle,
-                               bus_size_t offset,
-                               uint32_t value);
-
-       void    (*sparc_write_8)(
-                               bus_space_tag_t space,
-                               bus_space_handle_t handle,
-                               bus_size_t offset,
-                               uint64_t value);
-};
-
-bus_space_tag_t bus_space_tag_alloc(bus_space_tag_t, void *);
-int            bus_space_translate_address_generic(struct openprom_range *,
-                                                   int, bus_addr_t *);
-
-/*
- * Bus space function prototypes.
- * In bus_space_map2(), supply a special virtual address only if you
- * get it from ../sparc/vaddrs.h.
- */
-static int     bus_space_map(
-                               bus_space_tag_t,
-                               bus_addr_t,
-                               bus_size_t,
-                               int,                    /*flags*/
-                               bus_space_handle_t *);
-static int     bus_space_map2(
-                               bus_space_tag_t,
-                               bus_addr_t,
-                               bus_size_t,
-                               int,                    /*flags*/
-                               vaddr_t,                /*preferred vaddr*/
-                               bus_space_handle_t *);
-static int     bus_space_unmap(
-                               bus_space_tag_t,
-                               bus_space_handle_t,
-                               bus_size_t);
-static int     bus_space_subregion(
-                               bus_space_tag_t,
-                               bus_space_handle_t,
-                               bus_size_t,
-                               bus_size_t,
-                               bus_space_handle_t *);
-static void    bus_space_barrier(
-                               bus_space_tag_t,
-                               bus_space_handle_t,
-                               bus_size_t,
-                               bus_size_t,
-                               int);
-static paddr_t bus_space_mmap(
-                               bus_space_tag_t,
-                               bus_addr_t,             /**/
-                               off_t,
-                               int,                    /*prot*/
-                               int);                   /*flags*/
-static void    *bus_intr_establish(
-                               bus_space_tag_t,
-                               int,                    /*bus-specific intr*/
-                               int,                    /*device class level,
-                                                         see machine/intr.h*/
-                               int (*)(void *),        /*handler*/
-                               void *);                /*handler arg*/
-static void    *bus_intr_establish2(
-                               bus_space_tag_t,
-                               int,                    /*bus-specific intr*/
-                               int,                    /*device class level,
-                                                         see machine/intr.h*/
-                               int (*)(void *),        /*handler*/
-                               void *,                 /*handler arg*/
-                               void (*)(void));        /*optional fast vector*/
-
-
-
-static __inline int
-bus_space_map(t, a, s, f, hp)
-       bus_space_tag_t t;
-       bus_addr_t      a;
-       bus_size_t      s;
-       int             f;
-       bus_space_handle_t *hp;
-{
-       return (*t->sparc_bus_map)(t, a, s, f, (vaddr_t)0, hp);
-}
-
-static __inline int
-bus_space_map2(t, a, s, f, v, hp)
-       bus_space_tag_t t;
-       bus_addr_t      a;
-       bus_size_t      s;
-       int             f;
-       vaddr_t         v;
-       bus_space_handle_t *hp;
-{
-       return (*t->sparc_bus_map)(t, a, s, f, v, hp);
-}
-
-static __inline int
-bus_space_unmap(t, h, s)
-       bus_space_tag_t t;
-       bus_space_handle_t h;
-       bus_size_t      s;
-{
-       return (*t->sparc_bus_unmap)(t, h, s);
-}
-
-static __inline int
-bus_space_subregion(t, h, o, s, hp)
-       bus_space_tag_t t;
-       bus_space_handle_t h;
-       bus_size_t      o;
-       bus_size_t      s;
-       bus_space_handle_t *hp;
-{
-       return (*t->sparc_bus_subregion)(t, h, o, s, hp);
-}
-
-static __inline paddr_t
-bus_space_mmap(t, a, o, p, f)
-       bus_space_tag_t t;
-       bus_addr_t      a;
-       off_t           o;



Home | Main Index | Thread Index | Old Index