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/nlm/bus_space_rmi.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
    3  *
    4  * Copyright 2003-2011 Netlogic Microsystems (Netlogic). All rights
    5  * reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions are
    9  * met:
   10  *
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in
   15  *    the documentation and/or other materials provided with the
   16  *    distribution.
   17  *
   18  * THIS SOFTWARE IS PROVIDED BY Netlogic Microsystems ``AS IS'' AND
   19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   21  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE
   22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
   28  * THE POSSIBILITY OF SUCH DAMAGE.
   29  *
   30  * NETLOGIC_BSD */
   31 
   32 #include <sys/cdefs.h>
   33 __FBSDID("$FreeBSD$");
   34 
   35 #include <sys/param.h>
   36 #include <sys/systm.h>
   37 #include <sys/bus.h>
   38 #include <sys/kernel.h>
   39 #include <sys/endian.h>
   40 #include <sys/malloc.h>
   41 #include <sys/ktr.h>
   42 
   43 #include <vm/vm.h>
   44 #include <vm/pmap.h>
   45 #include <vm/vm_kern.h>
   46 #include <vm/vm_extern.h>
   47 
   48 #include <machine/bus.h>
   49 #include <machine/cache.h>
   50 
   51 static int
   52 rmi_bus_space_map(void *t, bus_addr_t addr,
   53     bus_size_t size, int flags,
   54     bus_space_handle_t *bshp);
   55 
   56 static void
   57 rmi_bus_space_unmap(void *t, bus_space_handle_t bsh,
   58     bus_size_t size);
   59 
   60 static int
   61 rmi_bus_space_subregion(void *t,
   62     bus_space_handle_t bsh,
   63     bus_size_t offset, bus_size_t size,
   64     bus_space_handle_t *nbshp);
   65 
   66 static u_int8_t
   67 rmi_bus_space_read_1(void *t,
   68     bus_space_handle_t handle,
   69     bus_size_t offset);
   70 
   71 static u_int16_t
   72 rmi_bus_space_read_2(void *t,
   73     bus_space_handle_t handle,
   74     bus_size_t offset);
   75 
   76 static u_int32_t
   77 rmi_bus_space_read_4(void *t,
   78     bus_space_handle_t handle,
   79     bus_size_t offset);
   80 
   81 static void
   82 rmi_bus_space_read_multi_1(void *t,
   83     bus_space_handle_t handle,
   84     bus_size_t offset, u_int8_t *addr,
   85     size_t count);
   86 
   87 static void
   88 rmi_bus_space_read_multi_2(void *t,
   89     bus_space_handle_t handle,
   90     bus_size_t offset, u_int16_t *addr,
   91     size_t count);
   92 
   93 static void
   94 rmi_bus_space_read_multi_4(void *t,
   95     bus_space_handle_t handle,
   96     bus_size_t offset, u_int32_t *addr,
   97     size_t count);
   98 
   99 static void
  100 rmi_bus_space_read_region_1(void *t,
  101     bus_space_handle_t bsh,
  102     bus_size_t offset, u_int8_t *addr,
  103     size_t count);
  104 
  105 static void
  106 rmi_bus_space_read_region_2(void *t,
  107     bus_space_handle_t bsh,
  108     bus_size_t offset, u_int16_t *addr,
  109     size_t count);
  110 
  111 static void
  112 rmi_bus_space_read_region_4(void *t,
  113     bus_space_handle_t bsh,
  114     bus_size_t offset, u_int32_t *addr,
  115     size_t count);
  116 
  117 static void
  118 rmi_bus_space_write_1(void *t,
  119     bus_space_handle_t handle,
  120     bus_size_t offset, u_int8_t value);
  121 
  122 static void
  123 rmi_bus_space_write_2(void *t,
  124     bus_space_handle_t handle,
  125     bus_size_t offset, u_int16_t value);
  126 
  127 static void
  128 rmi_bus_space_write_4(void *t,
  129     bus_space_handle_t handle,
  130     bus_size_t offset, u_int32_t value);
  131 
  132 static void
  133 rmi_bus_space_write_multi_1(void *t,
  134     bus_space_handle_t handle,
  135     bus_size_t offset,
  136     const u_int8_t *addr,
  137     size_t count);
  138 
  139 static void
  140 rmi_bus_space_write_multi_2(void *t,
  141     bus_space_handle_t handle,
  142     bus_size_t offset,
  143     const u_int16_t *addr,
  144     size_t count);
  145 
  146 static void
  147 rmi_bus_space_write_multi_4(void *t,
  148     bus_space_handle_t handle,
  149     bus_size_t offset,
  150     const u_int32_t *addr,
  151     size_t count);
  152 
  153 static void
  154 rmi_bus_space_write_region_2(void *t,
  155     bus_space_handle_t bsh,
  156     bus_size_t offset,
  157     const u_int16_t *addr,
  158     size_t count);
  159 
  160 static void
  161 rmi_bus_space_write_region_4(void *t,
  162     bus_space_handle_t bsh,
  163     bus_size_t offset,
  164     const u_int32_t *addr,
  165     size_t count);
  166 
  167 static void
  168 rmi_bus_space_set_region_2(void *t,
  169     bus_space_handle_t bsh,
  170     bus_size_t offset, u_int16_t value,
  171     size_t count);
  172 static void
  173 rmi_bus_space_set_region_4(void *t,
  174     bus_space_handle_t bsh,
  175     bus_size_t offset, u_int32_t value,
  176     size_t count);
  177 
  178 static void
  179 rmi_bus_space_barrier(void *tag __unused, bus_space_handle_t bsh __unused,
  180     bus_size_t offset __unused, bus_size_t len __unused, int flags);
  181 
  182 static void
  183 rmi_bus_space_copy_region_2(void *t,
  184     bus_space_handle_t bsh1,
  185     bus_size_t off1,
  186     bus_space_handle_t bsh2,
  187     bus_size_t off2, size_t count);
  188 
  189 u_int8_t
  190 rmi_bus_space_read_stream_1(void *t, bus_space_handle_t handle,
  191     bus_size_t offset);
  192 
  193 static u_int16_t
  194 rmi_bus_space_read_stream_2(void *t, bus_space_handle_t handle,
  195     bus_size_t offset);
  196 
  197 static u_int32_t
  198 rmi_bus_space_read_stream_4(void *t, bus_space_handle_t handle,
  199     bus_size_t offset);
  200 static void
  201 rmi_bus_space_read_multi_stream_1(void *t,
  202     bus_space_handle_t handle,
  203     bus_size_t offset, u_int8_t *addr,
  204     size_t count);
  205 
  206 static void
  207 rmi_bus_space_read_multi_stream_2(void *t,
  208     bus_space_handle_t handle,
  209     bus_size_t offset, u_int16_t *addr,
  210     size_t count);
  211 
  212 static void
  213 rmi_bus_space_read_multi_stream_4(void *t,
  214     bus_space_handle_t handle,
  215     bus_size_t offset, u_int32_t *addr,
  216     size_t count);
  217 
  218 void
  219 rmi_bus_space_write_stream_1(void *t, bus_space_handle_t bsh,
  220     bus_size_t offset, u_int8_t value);
  221 static void
  222 rmi_bus_space_write_stream_2(void *t, bus_space_handle_t handle,
  223     bus_size_t offset, u_int16_t value);
  224 
  225 static void
  226 rmi_bus_space_write_stream_4(void *t, bus_space_handle_t handle,
  227     bus_size_t offset, u_int32_t value);
  228 
  229 static void
  230 rmi_bus_space_write_multi_stream_1(void *t,
  231     bus_space_handle_t handle,
  232     bus_size_t offset,
  233     const u_int8_t *addr,
  234     size_t count);
  235 static void
  236 rmi_bus_space_write_multi_stream_2(void *t,
  237     bus_space_handle_t handle,
  238     bus_size_t offset,
  239     const u_int16_t *addr,
  240     size_t count);
  241 
  242 static void
  243 rmi_bus_space_write_multi_stream_4(void *t,
  244     bus_space_handle_t handle,
  245     bus_size_t offset,
  246     const u_int32_t *addr,
  247     size_t count);
  248 
  249 #define TODO() printf("XLP bus space: '%s' unimplemented\n", __func__)
  250 
  251 static struct bus_space local_rmi_bus_space = {
  252         /* cookie */
  253         (void *)0,
  254 
  255         /* mapping/unmapping */
  256         rmi_bus_space_map,
  257         rmi_bus_space_unmap,
  258         rmi_bus_space_subregion,
  259 
  260         /* allocation/deallocation */
  261         NULL,
  262         NULL,
  263 
  264         /* barrier */
  265         rmi_bus_space_barrier,
  266 
  267         /* read (single) */
  268         rmi_bus_space_read_1,
  269         rmi_bus_space_read_2,
  270         rmi_bus_space_read_4,
  271         NULL,
  272 
  273         /* read multiple */
  274         rmi_bus_space_read_multi_1,
  275         rmi_bus_space_read_multi_2,
  276         rmi_bus_space_read_multi_4,
  277         NULL,
  278 
  279         /* read region */
  280         rmi_bus_space_read_region_1,
  281         rmi_bus_space_read_region_2,
  282         rmi_bus_space_read_region_4,
  283         NULL,
  284 
  285         /* write (single) */
  286         rmi_bus_space_write_1,
  287         rmi_bus_space_write_2,
  288         rmi_bus_space_write_4,
  289         NULL,
  290 
  291         /* write multiple */
  292         rmi_bus_space_write_multi_1,
  293         rmi_bus_space_write_multi_2,
  294         rmi_bus_space_write_multi_4,
  295         NULL,
  296 
  297         /* write region */
  298         NULL,
  299         rmi_bus_space_write_region_2,
  300         rmi_bus_space_write_region_4,
  301         NULL,
  302 
  303         /* set multiple */
  304         NULL,
  305         NULL,
  306         NULL,
  307         NULL,
  308 
  309         /* set region */
  310         NULL,
  311         rmi_bus_space_set_region_2,
  312         rmi_bus_space_set_region_4,
  313         NULL,
  314 
  315         /* copy */
  316         NULL,
  317         rmi_bus_space_copy_region_2,
  318         NULL,
  319         NULL,
  320 
  321         /* read (single) stream */
  322         rmi_bus_space_read_stream_1,
  323         rmi_bus_space_read_stream_2,
  324         rmi_bus_space_read_stream_4,
  325         NULL,
  326 
  327         /* read multiple stream */
  328         rmi_bus_space_read_multi_stream_1,
  329         rmi_bus_space_read_multi_stream_2,
  330         rmi_bus_space_read_multi_stream_4,
  331         NULL,
  332 
  333         /* read region stream */
  334         rmi_bus_space_read_region_1,
  335         rmi_bus_space_read_region_2,
  336         rmi_bus_space_read_region_4,
  337         NULL,
  338 
  339         /* write (single) stream */
  340         rmi_bus_space_write_stream_1,
  341         rmi_bus_space_write_stream_2,
  342         rmi_bus_space_write_stream_4,
  343         NULL,
  344 
  345         /* write multiple stream */
  346         rmi_bus_space_write_multi_stream_1,
  347         rmi_bus_space_write_multi_stream_2,
  348         rmi_bus_space_write_multi_stream_4,
  349         NULL,
  350 
  351         /* write region stream */
  352         NULL,
  353         rmi_bus_space_write_region_2,
  354         rmi_bus_space_write_region_4,
  355         NULL,
  356 };
  357 
  358 /* generic bus_space tag */
  359 bus_space_tag_t rmi_bus_space = &local_rmi_bus_space;
  360 
  361 /*
  362  * Map a region of device bus space into CPU virtual address space.
  363  */
  364 static int
  365 rmi_bus_space_map(void *t __unused, bus_addr_t addr,
  366     bus_size_t size __unused, int flags __unused,
  367     bus_space_handle_t *bshp)
  368 {
  369 
  370         *bshp = MIPS_PHYS_TO_DIRECT_UNCACHED(addr);
  371         return (0);
  372 }
  373 
  374 /*
  375  * Unmap a region of device bus space.
  376  */
  377 static void
  378 rmi_bus_space_unmap(void *t __unused, bus_space_handle_t bsh __unused,
  379     bus_size_t size __unused)
  380 {
  381 }
  382 
  383 /*
  384  * Get a new handle for a subregion of an already-mapped area of bus space.
  385  */
  386 
  387 static int
  388 rmi_bus_space_subregion(void *t __unused, bus_space_handle_t bsh,
  389     bus_size_t offset, bus_size_t size __unused,
  390     bus_space_handle_t *nbshp)
  391 {
  392         *nbshp = bsh + offset;
  393         return (0);
  394 }
  395 
  396 /*
  397  * Read a 1, 2, 4, or 8 byte quantity from bus space
  398  * described by tag/handle/offset.
  399  */
  400 
  401 static u_int8_t
  402 rmi_bus_space_read_1(void *tag, bus_space_handle_t handle,
  403     bus_size_t offset)
  404 {
  405         return (u_int8_t) (*(volatile u_int8_t *)(handle + offset));
  406 }
  407 
  408 static u_int16_t
  409 rmi_bus_space_read_2(void *tag, bus_space_handle_t handle,
  410     bus_size_t offset)
  411 {
  412         return (u_int16_t)(*(volatile u_int16_t *)(handle + offset));
  413 }
  414 
  415 static u_int32_t
  416 rmi_bus_space_read_4(void *tag, bus_space_handle_t handle,
  417     bus_size_t offset)
  418 {
  419         return (*(volatile u_int32_t *)(handle + offset));
  420 }
  421 
  422 /*
  423  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
  424  * described by tag/handle/offset and copy into buffer provided.
  425  */
  426 static void
  427 rmi_bus_space_read_multi_1(void *tag, bus_space_handle_t handle,
  428     bus_size_t offset, u_int8_t *addr, size_t count)
  429 {
  430         TODO();
  431 }
  432 
  433 static void
  434 rmi_bus_space_read_multi_2(void *tag, bus_space_handle_t handle,
  435     bus_size_t offset, u_int16_t *addr, size_t count)
  436 {
  437         TODO();
  438 }
  439 
  440 static void
  441 rmi_bus_space_read_multi_4(void *tag, bus_space_handle_t handle,
  442     bus_size_t offset, u_int32_t *addr, size_t count)
  443 {
  444         TODO();
  445 }
  446 
  447 /*
  448  * Write the 1, 2, 4, or 8 byte value `value' to bus space
  449  * described by tag/handle/offset.
  450  */
  451 
  452 static void
  453 rmi_bus_space_write_1(void *tag, bus_space_handle_t handle,
  454     bus_size_t offset, u_int8_t value)
  455 {
  456         *(volatile u_int8_t *)(handle + offset) =  value;
  457 }
  458 
  459 static void
  460 rmi_bus_space_write_2(void *tag, bus_space_handle_t handle,
  461     bus_size_t offset, u_int16_t value)
  462 {
  463         *(volatile u_int16_t *)(handle + offset) = value;
  464 }
  465 
  466 static void
  467 rmi_bus_space_write_4(void *tag, bus_space_handle_t handle,
  468     bus_size_t offset, u_int32_t value)
  469 {
  470         *(volatile u_int32_t *)(handle + offset) = value;
  471 }
  472 
  473 /*
  474  * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
  475  * provided to bus space described by tag/handle/offset.
  476  */
  477 
  478 static void
  479 rmi_bus_space_write_multi_1(void *tag, bus_space_handle_t handle,
  480     bus_size_t offset, const u_int8_t *addr, size_t count)
  481 {
  482         TODO();
  483 }
  484 
  485 static void
  486 rmi_bus_space_write_multi_2(void *tag, bus_space_handle_t handle,
  487     bus_size_t offset, const u_int16_t *addr, size_t count)
  488 {
  489         TODO();
  490 }
  491 
  492 static void
  493 rmi_bus_space_write_multi_4(void *tag, bus_space_handle_t handle,
  494     bus_size_t offset, const u_int32_t *addr, size_t count)
  495 {
  496         TODO();
  497 }
  498 
  499 /*
  500  * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
  501  * by tag/handle starting at `offset'.
  502  */
  503 
  504 static void
  505 rmi_bus_space_set_region_2(void *t, bus_space_handle_t bsh,
  506     bus_size_t offset, u_int16_t value, size_t count)
  507 {
  508         bus_addr_t addr = bsh + offset;
  509 
  510         for (; count != 0; count--, addr += 2)
  511                 (*(volatile u_int32_t *)(addr)) = value;
  512 }
  513 
  514 static void
  515 rmi_bus_space_set_region_4(void *t, bus_space_handle_t bsh,
  516     bus_size_t offset, u_int32_t value, size_t count)
  517 {
  518         bus_addr_t addr = bsh + offset;
  519 
  520         for (; count != 0; count--, addr += 4)
  521                 (*(volatile u_int32_t *)(addr)) = value;
  522 }
  523 
  524 /*
  525  * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
  526  * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
  527  */
  528 static void
  529 rmi_bus_space_copy_region_2(void *t, bus_space_handle_t bsh1,
  530     bus_size_t off1, bus_space_handle_t bsh2,
  531     bus_size_t off2, size_t count)
  532 {
  533         printf("bus_space_copy_region_2 - unimplemented\n");
  534 }
  535 
  536 /*
  537  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
  538  * described by tag/handle/offset and copy into buffer provided.
  539  */
  540 
  541 u_int8_t
  542 rmi_bus_space_read_stream_1(void *t, bus_space_handle_t handle,
  543     bus_size_t offset)
  544 {
  545 
  546         return *((volatile u_int8_t *)(handle + offset));
  547 }
  548 
  549 static u_int16_t
  550 rmi_bus_space_read_stream_2(void *t, bus_space_handle_t handle,
  551     bus_size_t offset)
  552 {
  553         return *(volatile u_int16_t *)(handle + offset);
  554 }
  555 
  556 static u_int32_t
  557 rmi_bus_space_read_stream_4(void *t, bus_space_handle_t handle,
  558     bus_size_t offset)
  559 {
  560         return (*(volatile u_int32_t *)(handle + offset));
  561 }
  562 
  563 static void
  564 rmi_bus_space_read_multi_stream_1(void *tag, bus_space_handle_t handle,
  565     bus_size_t offset, u_int8_t *addr, size_t count)
  566 {
  567         TODO();
  568 }
  569 
  570 static void
  571 rmi_bus_space_read_multi_stream_2(void *tag, bus_space_handle_t handle,
  572     bus_size_t offset, u_int16_t *addr, size_t count)
  573 {
  574         TODO();
  575 }
  576 
  577 static void
  578 rmi_bus_space_read_multi_stream_4(void *tag, bus_space_handle_t handle,
  579     bus_size_t offset, u_int32_t *addr, size_t count)
  580 {
  581         TODO();
  582 }
  583 
  584 /*
  585  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
  586  * described by tag/handle and starting at `offset' and copy into
  587  * buffer provided.
  588  */
  589 void
  590 rmi_bus_space_read_region_1(void *t, bus_space_handle_t bsh,
  591     bus_size_t offset, u_int8_t *addr, size_t count)
  592 {
  593         TODO();
  594 }
  595 
  596 void
  597 rmi_bus_space_read_region_2(void *t, bus_space_handle_t bsh,
  598     bus_size_t offset, u_int16_t *addr, size_t count)
  599 {
  600         TODO();
  601 }
  602 
  603 void
  604 rmi_bus_space_read_region_4(void *t, bus_space_handle_t bsh,
  605     bus_size_t offset, u_int32_t *addr, size_t count)
  606 {
  607         bus_addr_t baddr = bsh + offset;
  608 
  609         while (count--) {
  610                 *addr++ = (*(volatile u_int32_t *)(baddr));
  611                 baddr += 4;
  612         }
  613 }
  614 
  615 void
  616 rmi_bus_space_write_stream_1(void *t, bus_space_handle_t handle,
  617     bus_size_t offset, u_int8_t value)
  618 {
  619         TODO();
  620 }
  621 
  622 static void
  623 rmi_bus_space_write_stream_2(void *t, bus_space_handle_t handle,
  624     bus_size_t offset, u_int16_t value)
  625 {
  626         TODO();
  627 }
  628 
  629 static void
  630 rmi_bus_space_write_stream_4(void *t, bus_space_handle_t handle,
  631     bus_size_t offset, u_int32_t value)
  632 {
  633         TODO();
  634 }
  635 
  636 static void
  637 rmi_bus_space_write_multi_stream_1(void *tag, bus_space_handle_t handle,
  638     bus_size_t offset, const u_int8_t *addr, size_t count)
  639 {
  640         TODO();
  641 }
  642 
  643 static void
  644 rmi_bus_space_write_multi_stream_2(void *tag, bus_space_handle_t handle,
  645     bus_size_t offset, const u_int16_t *addr, size_t count)
  646 {
  647         TODO();
  648 }
  649 
  650 static void
  651 rmi_bus_space_write_multi_stream_4(void *tag, bus_space_handle_t handle,
  652     bus_size_t offset, const u_int32_t *addr, size_t count)
  653 {
  654         TODO();
  655 }
  656 
  657 void
  658 rmi_bus_space_write_region_2(void *t,
  659     bus_space_handle_t bsh,
  660     bus_size_t offset,
  661     const u_int16_t *addr,
  662     size_t count)
  663 {
  664         TODO();
  665 }
  666 
  667 void
  668 rmi_bus_space_write_region_4(void *t, bus_space_handle_t bsh,
  669     bus_size_t offset, const u_int32_t *addr, size_t count)
  670 {
  671         TODO();
  672 }
  673 
  674 static void
  675 rmi_bus_space_barrier(void *tag __unused, bus_space_handle_t bsh __unused,
  676     bus_size_t offset __unused, bus_size_t len __unused, int flags)
  677 {
  678 }
  679 
  680 /*
  681  * need a special bus space for this, because the Netlogic SoC
  682  * UART allows only 32 bit access to its registers
  683  */
  684 
  685 static u_int8_t
  686 rmi_uart_bus_space_read_1(void *tag, bus_space_handle_t handle,
  687     bus_size_t offset)
  688 {
  689         return (u_int8_t)(*(volatile u_int32_t *)(handle + offset));
  690 }
  691 
  692 static void
  693 rmi_uart_bus_space_write_1(void *tag, bus_space_handle_t handle,
  694     bus_size_t offset, u_int8_t value)
  695 {
  696         *(volatile u_int32_t *)(handle + offset) =  value;
  697 }
  698 
  699 static struct bus_space local_rmi_uart_bus_space = {
  700         /* cookie */
  701         (void *)0,
  702 
  703         /* mapping/unmapping */
  704         rmi_bus_space_map,
  705         rmi_bus_space_unmap,
  706         rmi_bus_space_subregion,
  707 
  708         /* allocation/deallocation */
  709         NULL,
  710         NULL,
  711 
  712         /* barrier */
  713         rmi_bus_space_barrier,
  714 
  715         /* read (single) */
  716         rmi_uart_bus_space_read_1, NULL, NULL, NULL,
  717 
  718         /* read multiple */
  719         NULL, NULL, NULL, NULL,
  720 
  721         /* read region */
  722         NULL, NULL, NULL, NULL,
  723 
  724         /* write (single) */
  725         rmi_uart_bus_space_write_1, NULL, NULL, NULL,
  726 
  727         /* write multiple */
  728         NULL, NULL, NULL, NULL,
  729 
  730         /* write region */
  731         NULL, NULL, NULL, NULL,
  732 
  733         /* set multiple */
  734         NULL, NULL, NULL, NULL,
  735 
  736         /* set region */
  737         NULL, NULL, NULL, NULL,
  738 
  739         /* copy */
  740         NULL, NULL, NULL, NULL,
  741 
  742         /* read (single) stream */
  743         NULL, NULL, NULL, NULL,
  744 
  745         /* read multiple stream */
  746         NULL, NULL, NULL, NULL,
  747 
  748         /* read region stream */
  749         NULL, NULL, NULL, NULL,
  750 
  751         /* write (single) stream */
  752         NULL, NULL, NULL, NULL,
  753 
  754         /* write multiple stream */
  755         NULL, NULL, NULL, NULL,
  756 
  757         /* write region stream */
  758         NULL, NULL, NULL, NULL,
  759 };
  760 
  761 /* generic bus_space tag */
  762 bus_space_tag_t rmi_uart_bus_space = &local_rmi_uart_bus_space;

Cache object: 8172167369b1f43f80a5b452a6711f9e


[ 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.