The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/mips/include/bus.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: bus.h,v 1.11 2003/07/28 17:35:54 thorpej Exp $ */
    2 
    3 /*-
    4  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
    9  * NASA Ames Research Center.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice, this list of conditions and the following disclaimer.
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  * 3. All advertising materials mentioning features or use of this software
   20  *    must display the following acknowledgement:
   21  *      This product includes software developed by the NetBSD
   22  *      Foundation, Inc. and its contributors.
   23  * 4. Neither the name of The NetBSD Foundation nor the names of its
   24  *    contributors may be used to endorse or promote products derived
   25  *    from this software without specific prior written permission.
   26  *
   27  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   28  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   29  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   30  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   31  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   34  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   35  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   37  * POSSIBILITY OF SUCH DAMAGE.
   38  */
   39 
   40 /*-
   41  * Copyright (c) 1996 Charles M. Hannum.  All rights reserved.
   42  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
   43  *
   44  * Redistribution and use in source and binary forms, with or without
   45  * modification, are permitted provided that the following conditions
   46  * are met:
   47  * 1. Redistributions of source code must retain the above copyright
   48  *    notice, this list of conditions and the following disclaimer.
   49  * 2. Redistributions in binary form must reproduce the above copyright
   50  *    notice, this list of conditions and the following disclaimer in the
   51  *    documentation and/or other materials provided with the distribution.
   52  * 3. All advertising materials mentioning features or use of this software
   53  *    must display the following acknowledgement:
   54  *      This product includes software developed by Christopher G. Demetriou
   55  *      for the NetBSD Project.
   56  * 4. The name of the author may not be used to endorse or promote products
   57  *    derived from this software without specific prior written permission
   58  *
   59  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   60  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   61  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   62  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   63  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   64  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   65  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   66  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   67  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   68  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   69  *
   70  * $FreeBSD: stable/8/sys/mips/include/bus.h 215938 2010-11-27 12:26:40Z jchandra $
   71  */
   72 
   73 #ifndef _MACHINE_BUS_H_
   74 #define _MACHINE_BUS_H_
   75 
   76 #include <machine/_bus.h>
   77 
   78 struct bus_space {
   79         /* cookie */
   80         void            *bs_cookie;
   81 
   82         /* mapping/unmapping */
   83         int             (*bs_map) (void *, bus_addr_t, bus_size_t,
   84                             int, bus_space_handle_t *);
   85         void            (*bs_unmap) (void *, bus_space_handle_t, bus_size_t);
   86         int             (*bs_subregion) (void *, bus_space_handle_t,
   87                             bus_size_t, bus_size_t, bus_space_handle_t *);
   88 
   89         /* allocation/deallocation */
   90         int             (*bs_alloc) (void *, bus_addr_t, bus_addr_t,
   91                             bus_size_t, bus_size_t, bus_size_t, int,
   92                             bus_addr_t *, bus_space_handle_t *);
   93         void            (*bs_free) (void *, bus_space_handle_t,
   94                             bus_size_t);
   95 
   96         /* get kernel virtual address */
   97         /* barrier */
   98         void            (*bs_barrier) (void *, bus_space_handle_t,
   99                             bus_size_t, bus_size_t, int);
  100 
  101         /* read (single) */
  102         u_int8_t        (*bs_r_1) (void *, bus_space_handle_t, bus_size_t);
  103         u_int16_t       (*bs_r_2) (void *, bus_space_handle_t, bus_size_t);
  104         u_int32_t       (*bs_r_4) (void *, bus_space_handle_t, bus_size_t);
  105         u_int64_t       (*bs_r_8) (void *, bus_space_handle_t, bus_size_t);
  106 
  107         /* read multiple */
  108         void            (*bs_rm_1) (void *, bus_space_handle_t, bus_size_t,
  109             u_int8_t *, bus_size_t);
  110         void            (*bs_rm_2) (void *, bus_space_handle_t, bus_size_t,
  111             u_int16_t *, bus_size_t);
  112         void            (*bs_rm_4) (void *, bus_space_handle_t,
  113                             bus_size_t, u_int32_t *, bus_size_t);
  114         void            (*bs_rm_8) (void *, bus_space_handle_t,
  115                             bus_size_t, u_int64_t *, bus_size_t);
  116                                         
  117         /* read region */
  118         void            (*bs_rr_1) (void *, bus_space_handle_t,
  119                             bus_size_t, u_int8_t *, bus_size_t);
  120         void            (*bs_rr_2) (void *, bus_space_handle_t,
  121                             bus_size_t, u_int16_t *, bus_size_t);
  122         void            (*bs_rr_4) (void *, bus_space_handle_t,
  123                             bus_size_t, u_int32_t *, bus_size_t);
  124         void            (*bs_rr_8) (void *, bus_space_handle_t,
  125                             bus_size_t, u_int64_t *, bus_size_t);
  126                                         
  127         /* write (single) */
  128         void            (*bs_w_1) (void *, bus_space_handle_t,
  129                             bus_size_t, u_int8_t);
  130         void            (*bs_w_2) (void *, bus_space_handle_t,
  131                             bus_size_t, u_int16_t);
  132         void            (*bs_w_4) (void *, bus_space_handle_t,
  133                             bus_size_t, u_int32_t);
  134         void            (*bs_w_8) (void *, bus_space_handle_t,
  135                             bus_size_t, u_int64_t);
  136 
  137         /* write multiple */
  138         void            (*bs_wm_1) (void *, bus_space_handle_t,
  139                             bus_size_t, const u_int8_t *, bus_size_t);
  140         void            (*bs_wm_2) (void *, bus_space_handle_t,
  141                             bus_size_t, const u_int16_t *, bus_size_t);
  142         void            (*bs_wm_4) (void *, bus_space_handle_t,
  143                             bus_size_t, const u_int32_t *, bus_size_t);
  144         void            (*bs_wm_8) (void *, bus_space_handle_t,
  145                             bus_size_t, const u_int64_t *, bus_size_t);
  146                                         
  147         /* write region */
  148         void            (*bs_wr_1) (void *, bus_space_handle_t,
  149                             bus_size_t, const u_int8_t *, bus_size_t);
  150         void            (*bs_wr_2) (void *, bus_space_handle_t,
  151                             bus_size_t, const u_int16_t *, bus_size_t);
  152         void            (*bs_wr_4) (void *, bus_space_handle_t,
  153                             bus_size_t, const u_int32_t *, bus_size_t);
  154         void            (*bs_wr_8) (void *, bus_space_handle_t,
  155                             bus_size_t, const u_int64_t *, bus_size_t);
  156 
  157         /* set multiple */
  158         void            (*bs_sm_1) (void *, bus_space_handle_t,
  159                             bus_size_t, u_int8_t, bus_size_t);
  160         void            (*bs_sm_2) (void *, bus_space_handle_t,
  161                             bus_size_t, u_int16_t, bus_size_t);
  162         void            (*bs_sm_4) (void *, bus_space_handle_t,
  163                             bus_size_t, u_int32_t, bus_size_t);
  164         void            (*bs_sm_8) (void *, bus_space_handle_t,
  165                             bus_size_t, u_int64_t, bus_size_t);
  166 
  167         /* set region */
  168         void            (*bs_sr_1) (void *, bus_space_handle_t,
  169                             bus_size_t, u_int8_t, bus_size_t);
  170         void            (*bs_sr_2) (void *, bus_space_handle_t,
  171                             bus_size_t, u_int16_t, bus_size_t);
  172         void            (*bs_sr_4) (void *, bus_space_handle_t,
  173                             bus_size_t, u_int32_t, bus_size_t);
  174         void            (*bs_sr_8) (void *, bus_space_handle_t,
  175                             bus_size_t, u_int64_t, bus_size_t);
  176 
  177         /* copy */
  178         void            (*bs_c_1) (void *, bus_space_handle_t, bus_size_t,
  179                             bus_space_handle_t, bus_size_t, bus_size_t);
  180         void            (*bs_c_2) (void *, bus_space_handle_t, bus_size_t,
  181                             bus_space_handle_t, bus_size_t, bus_size_t);
  182         void            (*bs_c_4) (void *, bus_space_handle_t, bus_size_t,
  183                             bus_space_handle_t, bus_size_t, bus_size_t);
  184         void            (*bs_c_8) (void *, bus_space_handle_t, bus_size_t,
  185                             bus_space_handle_t, bus_size_t, bus_size_t);
  186 
  187         /* read stream (single) */
  188         u_int8_t        (*bs_r_1_s) (void *, bus_space_handle_t, bus_size_t);
  189         u_int16_t       (*bs_r_2_s) (void *, bus_space_handle_t, bus_size_t);
  190         u_int32_t       (*bs_r_4_s) (void *, bus_space_handle_t, bus_size_t);
  191         u_int64_t       (*bs_r_8_s) (void *, bus_space_handle_t, bus_size_t);
  192 
  193         /* read multiple stream */
  194         void            (*bs_rm_1_s) (void *, bus_space_handle_t, bus_size_t,
  195             u_int8_t *, bus_size_t);
  196         void            (*bs_rm_2_s) (void *, bus_space_handle_t, bus_size_t,
  197             u_int16_t *, bus_size_t);
  198         void            (*bs_rm_4_s) (void *, bus_space_handle_t,
  199                             bus_size_t, u_int32_t *, bus_size_t);
  200         void            (*bs_rm_8_s) (void *, bus_space_handle_t,
  201                             bus_size_t, u_int64_t *, bus_size_t);
  202                                         
  203         /* read region stream */
  204         void            (*bs_rr_1_s) (void *, bus_space_handle_t,
  205                             bus_size_t, u_int8_t *, bus_size_t);
  206         void            (*bs_rr_2_s) (void *, bus_space_handle_t,
  207                             bus_size_t, u_int16_t *, bus_size_t);
  208         void            (*bs_rr_4_s) (void *, bus_space_handle_t,
  209                             bus_size_t, u_int32_t *, bus_size_t);
  210         void            (*bs_rr_8_s) (void *, bus_space_handle_t,
  211                             bus_size_t, u_int64_t *, bus_size_t);
  212                                         
  213         /* write stream (single) */
  214         void            (*bs_w_1_s) (void *, bus_space_handle_t,
  215                             bus_size_t, u_int8_t);
  216         void            (*bs_w_2_s) (void *, bus_space_handle_t,
  217                             bus_size_t, u_int16_t);
  218         void            (*bs_w_4_s) (void *, bus_space_handle_t,
  219                             bus_size_t, u_int32_t);
  220         void            (*bs_w_8_s) (void *, bus_space_handle_t,
  221                             bus_size_t, u_int64_t);
  222 
  223         /* write multiple stream */
  224         void            (*bs_wm_1_s) (void *, bus_space_handle_t,
  225                             bus_size_t, const u_int8_t *, bus_size_t);
  226         void            (*bs_wm_2_s) (void *, bus_space_handle_t,
  227                             bus_size_t, const u_int16_t *, bus_size_t);
  228         void            (*bs_wm_4_s) (void *, bus_space_handle_t,
  229                             bus_size_t, const u_int32_t *, bus_size_t);
  230         void            (*bs_wm_8_s) (void *, bus_space_handle_t,
  231                             bus_size_t, const u_int64_t *, bus_size_t);
  232                                         
  233         /* write region stream */
  234         void            (*bs_wr_1_s) (void *, bus_space_handle_t,
  235                             bus_size_t, const u_int8_t *, bus_size_t);
  236         void            (*bs_wr_2_s) (void *, bus_space_handle_t,
  237                             bus_size_t, const u_int16_t *, bus_size_t);
  238         void            (*bs_wr_4_s) (void *, bus_space_handle_t,
  239                             bus_size_t, const u_int32_t *, bus_size_t);
  240         void            (*bs_wr_8_s) (void *, bus_space_handle_t,
  241                             bus_size_t, const u_int64_t *, bus_size_t);
  242 };
  243 
  244 
  245 /*
  246  * Utility macros; INTERNAL USE ONLY.
  247  */
  248 #define __bs_c(a,b)             __CONCAT(a,b)
  249 #define __bs_opname(op,size)    __bs_c(__bs_c(__bs_c(bs_,op),_),size)
  250 
  251 #define __bs_rs(sz, t, h, o)                                            \
  252         (*(t)->__bs_opname(r,sz))((t)->bs_cookie, h, o)
  253 #define __bs_ws(sz, t, h, o, v)                                         \
  254         (*(t)->__bs_opname(w,sz))((t)->bs_cookie, h, o, v)
  255 #define __bs_nonsingle(type, sz, t, h, o, a, c)                         \
  256         (*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, a, c)
  257 #define __bs_set(type, sz, t, h, o, v, c)                               \
  258         (*(t)->__bs_opname(type,sz))((t)->bs_cookie, h, o, v, c)
  259 #define __bs_copy(sz, t, h1, o1, h2, o2, cnt)                           \
  260         (*(t)->__bs_opname(c,sz))((t)->bs_cookie, h1, o1, h2, o2, cnt)
  261 
  262 #define __bs_opname_s(op,size)  __bs_c(__bs_c(__bs_c(__bs_c(bs_,op),_),size),_s)
  263 #define __bs_rs_s(sz, t, h, o)                                          \
  264         (*(t)->__bs_opname_s(r,sz))((t)->bs_cookie, h, o)
  265 #define __bs_ws_s(sz, t, h, o, v)                                       \
  266         (*(t)->__bs_opname_s(w,sz))((t)->bs_cookie, h, o, v)
  267 #define __bs_nonsingle_s(type, sz, t, h, o, a, c)                       \
  268         (*(t)->__bs_opname_s(type,sz))((t)->bs_cookie, h, o, a, c)
  269 
  270 
  271 /*
  272  * Mapping and unmapping operations.
  273  */
  274 #define bus_space_map(t, a, s, c, hp)                                   \
  275         (*(t)->bs_map)((t)->bs_cookie, (a), (s), (c), (hp))
  276 #define bus_space_unmap(t, h, s)                                        \
  277         (*(t)->bs_unmap)((t)->bs_cookie, (h), (s))
  278 #define bus_space_subregion(t, h, o, s, hp)                             \
  279         (*(t)->bs_subregion)((t)->bs_cookie, (h), (o), (s), (hp))
  280 
  281 
  282 /*
  283  * Allocation and deallocation operations.
  284  */
  285 #define bus_space_alloc(t, rs, re, s, a, b, c, ap, hp)                  \
  286         (*(t)->bs_alloc)((t)->bs_cookie, (rs), (re), (s), (a), (b),     \
  287             (c), (ap), (hp))
  288 #define bus_space_free(t, h, s)                                         \
  289         (*(t)->bs_free)((t)->bs_cookie, (h), (s))
  290 
  291 /*
  292  * Bus barrier operations.
  293  */
  294 #define bus_space_barrier(t, h, o, l, f)                                \
  295         (*(t)->bs_barrier)((t)->bs_cookie, (h), (o), (l), (f))
  296 
  297 #define BUS_SPACE_BARRIER_READ  0x01
  298 #define BUS_SPACE_BARRIER_WRITE 0x02
  299 
  300 /*
  301  * Bus read (single) operations.
  302  */
  303 #define bus_space_read_1(t, h, o)       __bs_rs(1,(t),(h),(o))
  304 #define bus_space_read_2(t, h, o)       __bs_rs(2,(t),(h),(o))
  305 #define bus_space_read_4(t, h, o)       __bs_rs(4,(t),(h),(o))
  306 #define bus_space_read_8(t, h, o)       __bs_rs(8,(t),(h),(o))
  307 
  308 #define bus_space_read_stream_1(t, h, o)        __bs_rs_s(1,(t), (h), (o))
  309 #define bus_space_read_stream_2(t, h, o)        __bs_rs_s(2,(t), (h), (o))
  310 #define bus_space_read_stream_4(t, h, o)        __bs_rs_s(4,(t), (h), (o))
  311 #define bus_space_read_stream_8(t, h, o)        __bs_rs_s(8,8,(t),(h),(o))
  312 
  313 /*
  314  * Bus read multiple operations.
  315  */
  316 #define bus_space_read_multi_1(t, h, o, a, c)                           \
  317         __bs_nonsingle(rm,1,(t),(h),(o),(a),(c))
  318 #define bus_space_read_multi_2(t, h, o, a, c)                           \
  319         __bs_nonsingle(rm,2,(t),(h),(o),(a),(c))
  320 #define bus_space_read_multi_4(t, h, o, a, c)                           \
  321         __bs_nonsingle(rm,4,(t),(h),(o),(a),(c))
  322 #define bus_space_read_multi_8(t, h, o, a, c)                           \
  323         __bs_nonsingle(rm,8,(t),(h),(o),(a),(c))
  324 
  325 #define bus_space_read_multi_stream_1(t, h, o, a, c)                    \
  326         __bs_nonsingle_s(rm,1,(t),(h),(o),(a),(c))
  327 #define bus_space_read_multi_stream_2(t, h, o, a, c)                    \
  328         __bs_nonsingle_s(rm,2,(t),(h),(o),(a),(c))
  329 #define bus_space_read_multi_stream_4(t, h, o, a, c)                    \
  330         __bs_nonsingle_s(rm,4,(t),(h),(o),(a),(c))
  331 #define bus_space_read_multi_stream_8(t, h, o, a, c)                    \
  332         __bs_nonsingle_s(rm,8,(t),(h),(o),(a),(c))
  333 
  334 
  335 /*
  336  * Bus read region operations.
  337  */
  338 #define bus_space_read_region_1(t, h, o, a, c)                          \
  339         __bs_nonsingle(rr,1,(t),(h),(o),(a),(c))
  340 #define bus_space_read_region_2(t, h, o, a, c)                          \
  341         __bs_nonsingle(rr,2,(t),(h),(o),(a),(c))
  342 #define bus_space_read_region_4(t, h, o, a, c)                          \
  343         __bs_nonsingle(rr,4,(t),(h),(o),(a),(c))
  344 #define bus_space_read_region_8(t, h, o, a, c)                          \
  345         __bs_nonsingle(rr,8,(t),(h),(o),(a),(c))
  346 
  347 #define bus_space_read_region_stream_1(t, h, o, a, c)                   \
  348         __bs_nonsingle_s(rr,1,(t),(h),(o),(a),(c))
  349 #define bus_space_read_region_stream_2(t, h, o, a, c)                   \
  350         __bs_nonsingle_s(rr,2,(t),(h),(o),(a),(c))
  351 #define bus_space_read_region_stream_4(t, h, o, a, c)                   \
  352         __bs_nonsingle_s(rr,4,(t),(h),(o),(a),(c))
  353 #define bus_space_read_region_stream_8(t, h, o, a, c)                   \
  354         __bs_nonsingle_s(rr,8,(t),(h),(o),(a),(c))
  355 
  356 
  357 /*
  358  * Bus write (single) operations.
  359  */
  360 #define bus_space_write_1(t, h, o, v)   __bs_ws(1,(t),(h),(o),(v))
  361 #define bus_space_write_2(t, h, o, v)   __bs_ws(2,(t),(h),(o),(v))
  362 #define bus_space_write_4(t, h, o, v)   __bs_ws(4,(t),(h),(o),(v))
  363 #define bus_space_write_8(t, h, o, v)   __bs_ws(8,(t),(h),(o),(v))
  364 
  365 #define bus_space_write_stream_1(t, h, o, v)    __bs_ws_s(1,(t),(h),(o),(v))
  366 #define bus_space_write_stream_2(t, h, o, v)    __bs_ws_s(2,(t),(h),(o),(v))
  367 #define bus_space_write_stream_4(t, h, o, v)    __bs_ws_s(4,(t),(h),(o),(v))
  368 #define bus_space_write_stream_8(t, h, o, v)    __bs_ws_s(8,(t),(h),(o),(v))
  369 
  370 
  371 /*
  372  * Bus write multiple operations.
  373  */
  374 #define bus_space_write_multi_1(t, h, o, a, c)                          \
  375         __bs_nonsingle(wm,1,(t),(h),(o),(a),(c))
  376 #define bus_space_write_multi_2(t, h, o, a, c)                          \
  377         __bs_nonsingle(wm,2,(t),(h),(o),(a),(c))
  378 #define bus_space_write_multi_4(t, h, o, a, c)                          \
  379         __bs_nonsingle(wm,4,(t),(h),(o),(a),(c))
  380 #define bus_space_write_multi_8(t, h, o, a, c)                          \
  381         __bs_nonsingle(wm,8,(t),(h),(o),(a),(c))
  382 
  383 #define bus_space_write_multi_stream_1(t, h, o, a, c)                   \
  384         __bs_nonsingle_s(wm,1,(t),(h),(o),(a),(c))
  385 #define bus_space_write_multi_stream_2(t, h, o, a, c)                   \
  386         __bs_nonsingle_s(wm,2,(t),(h),(o),(a),(c))
  387 #define bus_space_write_multi_stream_4(t, h, o, a, c)                   \
  388         __bs_nonsingle_s(wm,4,(t),(h),(o),(a),(c))
  389 #define bus_space_write_multi_stream_8(t, h, o, a, c)                   \
  390         __bs_nonsingle_s(wm,8,(t),(h),(o),(a),(c))
  391 
  392 
  393 /*
  394  * Bus write region operations.
  395  */
  396 #define bus_space_write_region_1(t, h, o, a, c)                         \
  397         __bs_nonsingle(wr,1,(t),(h),(o),(a),(c))
  398 #define bus_space_write_region_2(t, h, o, a, c)                         \
  399         __bs_nonsingle(wr,2,(t),(h),(o),(a),(c))
  400 #define bus_space_write_region_4(t, h, o, a, c)                         \
  401         __bs_nonsingle(wr,4,(t),(h),(o),(a),(c))
  402 #define bus_space_write_region_8(t, h, o, a, c)                         \
  403         __bs_nonsingle(wr,8,(t),(h),(o),(a),(c))
  404 
  405 #define bus_space_write_region_stream_1(t, h, o, a, c)                  \
  406         __bs_nonsingle_s(wr,1,(t),(h),(o),(a),(c))
  407 #define bus_space_write_region_stream_2(t, h, o, a, c)                  \
  408         __bs_nonsingle_s(wr,2,(t),(h),(o),(a),(c))
  409 #define bus_space_write_region_stream_4(t, h, o, a, c)                  \
  410         __bs_nonsingle_s(wr,4,(t),(h),(o),(a),(c))
  411 #define bus_space_write_region_stream_8(t, h, o, a, c)                  \
  412         __bs_nonsingle_s(wr,8,(t),(h),(o),(a),(c))
  413 
  414 
  415 /*
  416  * Set multiple operations.
  417  */
  418 #define bus_space_set_multi_1(t, h, o, v, c)                            \
  419         __bs_set(sm,1,(t),(h),(o),(v),(c))
  420 #define bus_space_set_multi_2(t, h, o, v, c)                            \
  421         __bs_set(sm,2,(t),(h),(o),(v),(c))
  422 #define bus_space_set_multi_4(t, h, o, v, c)                            \
  423         __bs_set(sm,4,(t),(h),(o),(v),(c))
  424 #define bus_space_set_multi_8(t, h, o, v, c)                            \
  425         __bs_set(sm,8,(t),(h),(o),(v),(c))
  426 
  427 
  428 /*
  429  * Set region operations.
  430  */
  431 #define bus_space_set_region_1(t, h, o, v, c)                           \
  432         __bs_set(sr,1,(t),(h),(o),(v),(c))
  433 #define bus_space_set_region_2(t, h, o, v, c)                           \
  434         __bs_set(sr,2,(t),(h),(o),(v),(c))
  435 #define bus_space_set_region_4(t, h, o, v, c)                           \
  436         __bs_set(sr,4,(t),(h),(o),(v),(c))
  437 #define bus_space_set_region_8(t, h, o, v, c)                           \
  438         __bs_set(sr,8,(t),(h),(o),(v),(c))
  439 
  440 
  441 /*
  442  * Copy operations.
  443  */
  444 #define bus_space_copy_region_1(t, h1, o1, h2, o2, c)                           \
  445         __bs_copy(1, t, h1, o1, h2, o2, c)
  446 #define bus_space_copy_region_2(t, h1, o1, h2, o2, c)                           \
  447         __bs_copy(2, t, h1, o1, h2, o2, c)
  448 #define bus_space_copy_region_4(t, h1, o1, h2, o2, c)                           \
  449         __bs_copy(4, t, h1, o1, h2, o2, c)
  450 #define bus_space_copy_region_8(t, h1, o1, h2, o2, c)                           \
  451         __bs_copy(8, t, h1, o1, h2, o2, c)
  452 
  453 /*
  454  * Macros to provide prototypes for all the functions used in the
  455  * bus_space structure
  456  */
  457 
  458 #define bs_map_proto(f)                                                 \
  459 int     __bs_c(f,_bs_map) (void *t, bus_addr_t addr,            \
  460             bus_size_t size, int cacheable, bus_space_handle_t *bshp);
  461 
  462 #define bs_unmap_proto(f)                                               \
  463 void    __bs_c(f,_bs_unmap) (void *t, bus_space_handle_t bsh,           \
  464             bus_size_t size);
  465 
  466 #define bs_subregion_proto(f)                                           \
  467 int     __bs_c(f,_bs_subregion) (void *t, bus_space_handle_t bsh,       \
  468             bus_size_t offset, bus_size_t size,                         \
  469             bus_space_handle_t *nbshp);
  470 
  471 #define bs_alloc_proto(f)                                               \
  472 int     __bs_c(f,_bs_alloc) (void *t, bus_addr_t rstart,                \
  473             bus_addr_t rend, bus_size_t size, bus_size_t align,         \
  474             bus_size_t boundary, int cacheable, bus_addr_t *addrp,      \
  475             bus_space_handle_t *bshp);
  476 
  477 #define bs_free_proto(f)                                                \
  478 void    __bs_c(f,_bs_free) (void *t, bus_space_handle_t bsh,    \
  479             bus_size_t size);
  480 
  481 #define bs_barrier_proto(f)                                             \
  482 void    __bs_c(f,_bs_barrier) (void *t, bus_space_handle_t bsh, \
  483             bus_size_t offset, bus_size_t len, int flags);
  484 
  485 #define bs_r_1_proto(f)                                                 \
  486 u_int8_t        __bs_c(f,_bs_r_1) (void *t, bus_space_handle_t bsh,     \
  487                     bus_size_t offset);
  488 
  489 #define bs_r_2_proto(f)                                                 \
  490 u_int16_t       __bs_c(f,_bs_r_2) (void *t, bus_space_handle_t bsh,     \
  491                     bus_size_t offset);
  492 
  493 #define bs_r_4_proto(f)                                                 \
  494 u_int32_t       __bs_c(f,_bs_r_4) (void *t, bus_space_handle_t bsh,     \
  495                     bus_size_t offset);
  496 
  497 #define bs_r_8_proto(f)                                                 \
  498 u_int64_t       __bs_c(f,_bs_r_8) (void *t, bus_space_handle_t bsh,     \
  499                     bus_size_t offset);
  500 
  501 #define bs_r_1_s_proto(f)                                               \
  502 u_int8_t        __bs_c(f,_bs_r_1_s) (void *t, bus_space_handle_t bsh,   \
  503                     bus_size_t offset);
  504 
  505 #define bs_r_2_s_proto(f)                                               \
  506 u_int16_t       __bs_c(f,_bs_r_2_s) (void *t, bus_space_handle_t bsh,   \
  507                     bus_size_t offset);
  508 
  509 #define bs_r_4_s_proto(f)                                               \
  510 u_int32_t       __bs_c(f,_bs_r_4_s) (void *t, bus_space_handle_t bsh,   \
  511                     bus_size_t offset);
  512 
  513 #define bs_w_1_proto(f)                                                 \
  514 void    __bs_c(f,_bs_w_1) (void *t, bus_space_handle_t bsh,             \
  515             bus_size_t offset, u_int8_t value);
  516 
  517 #define bs_w_2_proto(f)                                                 \
  518 void    __bs_c(f,_bs_w_2) (void *t, bus_space_handle_t bsh,             \
  519             bus_size_t offset, u_int16_t value);
  520 
  521 #define bs_w_4_proto(f)                                                 \
  522 void    __bs_c(f,_bs_w_4) (void *t, bus_space_handle_t bsh,             \
  523             bus_size_t offset, u_int32_t value);
  524 
  525 #define bs_w_8_proto(f)                                                 \
  526 void    __bs_c(f,_bs_w_8) (void *t, bus_space_handle_t bsh,             \
  527             bus_size_t offset, u_int64_t value);
  528 
  529 #define bs_w_1_s_proto(f)                                               \
  530 void    __bs_c(f,_bs_w_1_s) (void *t, bus_space_handle_t bsh,           \
  531             bus_size_t offset, u_int8_t value);
  532 
  533 #define bs_w_2_s_proto(f)                                               \
  534 void    __bs_c(f,_bs_w_2_s) (void *t, bus_space_handle_t bsh,           \
  535             bus_size_t offset, u_int16_t value);
  536 
  537 #define bs_w_4_s_proto(f)                                               \
  538 void    __bs_c(f,_bs_w_4_s) (void *t, bus_space_handle_t bsh,           \
  539             bus_size_t offset, u_int32_t value);
  540 
  541 #define bs_rm_1_proto(f)                                                \
  542 void    __bs_c(f,_bs_rm_1) (void *t, bus_space_handle_t bsh,    \
  543             bus_size_t offset, u_int8_t *addr, bus_size_t count);
  544 
  545 #define bs_rm_2_proto(f)                                                \
  546 void    __bs_c(f,_bs_rm_2) (void *t, bus_space_handle_t bsh,    \
  547             bus_size_t offset, u_int16_t *addr, bus_size_t count);
  548 
  549 #define bs_rm_4_proto(f)                                                \
  550 void    __bs_c(f,_bs_rm_4) (void *t, bus_space_handle_t bsh,    \
  551             bus_size_t offset, u_int32_t *addr, bus_size_t count);              
  552 
  553 #define bs_rm_8_proto(f)                                                \
  554 void    __bs_c(f,_bs_rm_8) (void *t, bus_space_handle_t bsh,    \
  555             bus_size_t offset, u_int64_t *addr, bus_size_t count);
  556 
  557 #define bs_wm_1_proto(f)                                                \
  558 void    __bs_c(f,_bs_wm_1) (void *t, bus_space_handle_t bsh,    \
  559             bus_size_t offset, const u_int8_t *addr, bus_size_t count);
  560 
  561 #define bs_wm_2_proto(f)                                                \
  562 void    __bs_c(f,_bs_wm_2) (void *t, bus_space_handle_t bsh,    \
  563             bus_size_t offset, const u_int16_t *addr, bus_size_t count);
  564 
  565 #define bs_wm_4_proto(f)                                                \
  566 void    __bs_c(f,_bs_wm_4) (void *t, bus_space_handle_t bsh,    \
  567             bus_size_t offset, const u_int32_t *addr, bus_size_t count);
  568 
  569 #define bs_wm_8_proto(f)                                                \
  570 void    __bs_c(f,_bs_wm_8) (void *t, bus_space_handle_t bsh,    \
  571             bus_size_t offset, const u_int64_t *addr, bus_size_t count);
  572 
  573 #define bs_rr_1_proto(f)                                                \
  574 void    __bs_c(f, _bs_rr_1) (void *t, bus_space_handle_t bsh,   \
  575             bus_size_t offset, u_int8_t *addr, bus_size_t count);
  576 
  577 #define bs_rr_2_proto(f)                                                \
  578 void    __bs_c(f, _bs_rr_2) (void *t, bus_space_handle_t bsh,   \
  579             bus_size_t offset, u_int16_t *addr, bus_size_t count);
  580 
  581 #define bs_rr_4_proto(f)                                                \
  582 void    __bs_c(f, _bs_rr_4) (void *t, bus_space_handle_t bsh,   \
  583             bus_size_t offset, u_int32_t *addr, bus_size_t count);
  584 
  585 #define bs_rr_8_proto(f)                                                \
  586 void    __bs_c(f, _bs_rr_8) (void *t, bus_space_handle_t bsh,   \
  587             bus_size_t offset, u_int64_t *addr, bus_size_t count);
  588 
  589 #define bs_wr_1_proto(f)                                                \
  590 void    __bs_c(f, _bs_wr_1) (void *t, bus_space_handle_t bsh,   \
  591             bus_size_t offset, const u_int8_t *addr, bus_size_t count);
  592 
  593 #define bs_wr_2_proto(f)                                                \
  594 void    __bs_c(f, _bs_wr_2) (void *t, bus_space_handle_t bsh,   \
  595             bus_size_t offset, const u_int16_t *addr, bus_size_t count);
  596 
  597 #define bs_wr_4_proto(f)                                                \
  598 void    __bs_c(f, _bs_wr_4) (void *t, bus_space_handle_t bsh,   \
  599             bus_size_t offset, const u_int32_t *addr, bus_size_t count);
  600 
  601 #define bs_wr_8_proto(f)                                                \
  602 void    __bs_c(f, _bs_wr_8) (void *t, bus_space_handle_t bsh,   \
  603             bus_size_t offset, const u_int64_t *addr, bus_size_t count);
  604 
  605 #define bs_sm_1_proto(f)                                                \
  606 void    __bs_c(f,_bs_sm_1) (void *t, bus_space_handle_t bsh,    \
  607             bus_size_t offset, u_int8_t value, bus_size_t count);
  608 
  609 #define bs_sm_2_proto(f)                                                \
  610 void    __bs_c(f,_bs_sm_2) (void *t, bus_space_handle_t bsh,    \
  611             bus_size_t offset, u_int16_t value, bus_size_t count);
  612 
  613 #define bs_sm_4_proto(f)                                                \
  614 void    __bs_c(f,_bs_sm_4) (void *t, bus_space_handle_t bsh,    \
  615             bus_size_t offset, u_int32_t value, bus_size_t count);
  616 
  617 #define bs_sm_8_proto(f)                                                \
  618 void    __bs_c(f,_bs_sm_8) (void *t, bus_space_handle_t bsh,    \
  619             bus_size_t offset, u_int64_t value, bus_size_t count);
  620 
  621 #define bs_sr_1_proto(f)                                                \
  622 void    __bs_c(f,_bs_sr_1) (void *t, bus_space_handle_t bsh,    \
  623             bus_size_t offset, u_int8_t value, bus_size_t count);
  624 
  625 #define bs_sr_2_proto(f)                                                \
  626 void    __bs_c(f,_bs_sr_2) (void *t, bus_space_handle_t bsh,    \
  627             bus_size_t offset, u_int16_t value, bus_size_t count);
  628 
  629 #define bs_sr_4_proto(f)                                                \
  630 void    __bs_c(f,_bs_sr_4) (void *t, bus_space_handle_t bsh,    \
  631             bus_size_t offset, u_int32_t value, bus_size_t count);
  632 
  633 #define bs_sr_8_proto(f)                                                \
  634 void    __bs_c(f,_bs_sr_8) (void *t, bus_space_handle_t bsh,    \
  635             bus_size_t offset, u_int64_t value, bus_size_t count);
  636 
  637 #define bs_c_1_proto(f)                                                 \
  638 void    __bs_c(f,_bs_c_1) (void *t, bus_space_handle_t bsh1,    \
  639             bus_size_t offset1, bus_space_handle_t bsh2,                \
  640             bus_size_t offset2, bus_size_t count);
  641 
  642 #define bs_c_2_proto(f)                                                 \
  643 void    __bs_c(f,_bs_c_2) (void *t, bus_space_handle_t bsh1,    \
  644             bus_size_t offset1, bus_space_handle_t bsh2,                \
  645             bus_size_t offset2, bus_size_t count);
  646 
  647 #define bs_c_4_proto(f)                                                 \
  648 void    __bs_c(f,_bs_c_4) (void *t, bus_space_handle_t bsh1,    \
  649             bus_size_t offset1, bus_space_handle_t bsh2,                \
  650             bus_size_t offset2, bus_size_t count);
  651 
  652 #define bs_c_8_proto(f)                                                 \
  653 void    __bs_c(f,_bs_c_8) (void *t, bus_space_handle_t bsh1,    \
  654             bus_size_t offset1, bus_space_handle_t bsh2,                \
  655             bus_size_t offset2, bus_size_t count);
  656 
  657 #define DECLARE_BUS_SPACE_PROTOTYPES(f)         \
  658         bs_map_proto(f);                        \
  659         bs_unmap_proto(f);                      \
  660         bs_subregion_proto(f);                  \
  661         bs_alloc_proto(f);                      \
  662         bs_free_proto(f);                       \
  663         bs_barrier_proto(f);                    \
  664         bs_r_1_proto(f);                        \
  665         bs_r_2_proto(f);                        \
  666         bs_r_4_proto(f);                        \
  667         bs_r_8_proto(f);                        \
  668         bs_r_1_s_proto(f);                      \
  669         bs_r_2_s_proto(f);                      \
  670         bs_r_4_s_proto(f);                      \
  671         bs_w_1_proto(f);                        \
  672         bs_w_2_proto(f);                        \
  673         bs_w_4_proto(f);                        \
  674         bs_w_8_proto(f);                        \
  675         bs_w_1_s_proto(f);                      \
  676         bs_w_2_s_proto(f);                      \
  677         bs_w_4_s_proto(f);                      \
  678         bs_rm_1_proto(f);                       \
  679         bs_rm_2_proto(f);                       \
  680         bs_rm_4_proto(f);                       \
  681         bs_rm_8_proto(f);                       \
  682         bs_wm_1_proto(f);                       \
  683         bs_wm_2_proto(f);                       \
  684         bs_wm_4_proto(f);                       \
  685         bs_wm_8_proto(f);                       \
  686         bs_rr_1_proto(f);                       \
  687         bs_rr_2_proto(f);                       \
  688         bs_rr_4_proto(f);                       \
  689         bs_rr_8_proto(f);                       \
  690         bs_wr_1_proto(f);                       \
  691         bs_wr_2_proto(f);                       \
  692         bs_wr_4_proto(f);                       \
  693         bs_wr_8_proto(f);                       \
  694         bs_sm_1_proto(f);                       \
  695         bs_sm_2_proto(f);                       \
  696         bs_sm_4_proto(f);                       \
  697         bs_sm_8_proto(f);                       \
  698         bs_sr_1_proto(f);                       \
  699         bs_sr_2_proto(f);                       \
  700         bs_sr_4_proto(f);                       \
  701         bs_sr_8_proto(f);                       \
  702         bs_c_1_proto(f);                        \
  703         bs_c_2_proto(f);                        \
  704         bs_c_4_proto(f);                        \
  705         bs_c_8_proto(f);
  706 
  707 #define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t)
  708 
  709 #define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF
  710 #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF
  711 #define BUS_SPACE_MAXADDR       0xFFFFFFFF
  712 #define BUS_SPACE_MAXSIZE_24BIT 0xFFFFFF
  713 #define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF
  714 #define BUS_SPACE_MAXSIZE       0xFFFFFFFF
  715 
  716 #define BUS_SPACE_UNRESTRICTED  (~0)
  717 
  718 /* 
  719  * declare generic bus space, it suits all needs in 
  720  */
  721 DECLARE_BUS_SPACE_PROTOTYPES(generic);
  722 extern bus_space_tag_t mips_bus_space_generic;
  723 /* Special bus space for RMI processors */
  724 #ifdef CPU_RMI
  725 extern bus_space_tag_t rmi_bus_space;
  726 extern bus_space_tag_t rmi_pci_bus_space;
  727 #endif
  728 
  729 #include <machine/bus_dma.h>
  730 
  731 #endif /* _MACHINE_BUS_H_ */

Cache object: f8c20350852218491b44771cf298e1e8


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.