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-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 /*
    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: stable/12/sys/mips/nlm/bus_space_rmi.c 326259 2017-11-27 15:07:26Z pfg $");
   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 
  168 static void
  169 rmi_bus_space_set_region_2(void *t,
  170     bus_space_handle_t bsh,
  171     bus_size_t offset, u_int16_t value,
  172     size_t count);
  173 static void
  174 rmi_bus_space_set_region_4(void *t,
  175     bus_space_handle_t bsh,
  176     bus_size_t offset, u_int32_t value,
  177     size_t count);
  178 
  179 static void
  180 rmi_bus_space_barrier(void *tag __unused, bus_space_handle_t bsh __unused,
  181     bus_size_t offset __unused, bus_size_t len __unused, int flags);
  182 
  183 static void
  184 rmi_bus_space_copy_region_2(void *t,
  185     bus_space_handle_t bsh1,
  186     bus_size_t off1,
  187     bus_space_handle_t bsh2,
  188     bus_size_t off2, size_t count);
  189 
  190 u_int8_t
  191 rmi_bus_space_read_stream_1(void *t, bus_space_handle_t handle,
  192     bus_size_t offset);
  193 
  194 static u_int16_t
  195 rmi_bus_space_read_stream_2(void *t, bus_space_handle_t handle,
  196     bus_size_t offset);
  197 
  198 static u_int32_t
  199 rmi_bus_space_read_stream_4(void *t, bus_space_handle_t handle,
  200     bus_size_t offset);
  201 static void
  202 rmi_bus_space_read_multi_stream_1(void *t,
  203     bus_space_handle_t handle,
  204     bus_size_t offset, u_int8_t *addr,
  205     size_t count);
  206 
  207 static void
  208 rmi_bus_space_read_multi_stream_2(void *t,
  209     bus_space_handle_t handle,
  210     bus_size_t offset, u_int16_t *addr,
  211     size_t count);
  212 
  213 static void
  214 rmi_bus_space_read_multi_stream_4(void *t,
  215     bus_space_handle_t handle,
  216     bus_size_t offset, u_int32_t *addr,
  217     size_t count);
  218 
  219 void
  220 rmi_bus_space_write_stream_1(void *t, bus_space_handle_t bsh,
  221     bus_size_t offset, u_int8_t value);
  222 static void
  223 rmi_bus_space_write_stream_2(void *t, bus_space_handle_t handle,
  224     bus_size_t offset, u_int16_t value);
  225 
  226 static void
  227 rmi_bus_space_write_stream_4(void *t, bus_space_handle_t handle,
  228     bus_size_t offset, u_int32_t value);
  229 
  230 static void
  231 rmi_bus_space_write_multi_stream_1(void *t,
  232     bus_space_handle_t handle,
  233     bus_size_t offset,
  234     const u_int8_t *addr,
  235     size_t count);
  236 static void
  237 rmi_bus_space_write_multi_stream_2(void *t,
  238     bus_space_handle_t handle,
  239     bus_size_t offset,
  240     const u_int16_t *addr,
  241     size_t count);
  242 
  243 static void
  244 rmi_bus_space_write_multi_stream_4(void *t,
  245     bus_space_handle_t handle,
  246     bus_size_t offset,
  247     const u_int32_t *addr,
  248     size_t count);
  249 
  250 #define TODO() printf("XLP bus space: '%s' unimplemented\n", __func__)
  251 
  252 static struct bus_space local_rmi_bus_space = {
  253         /* cookie */
  254         (void *)0,
  255 
  256         /* mapping/unmapping */
  257         rmi_bus_space_map,
  258         rmi_bus_space_unmap,
  259         rmi_bus_space_subregion,
  260 
  261         /* allocation/deallocation */
  262         NULL,
  263         NULL,
  264 
  265         /* barrier */
  266         rmi_bus_space_barrier,
  267 
  268         /* read (single) */
  269         rmi_bus_space_read_1,
  270         rmi_bus_space_read_2,
  271         rmi_bus_space_read_4,
  272         NULL,
  273 
  274         /* read multiple */
  275         rmi_bus_space_read_multi_1,
  276         rmi_bus_space_read_multi_2,
  277         rmi_bus_space_read_multi_4,
  278         NULL,
  279 
  280         /* read region */
  281         rmi_bus_space_read_region_1,
  282         rmi_bus_space_read_region_2,
  283         rmi_bus_space_read_region_4,
  284         NULL,
  285 
  286         /* write (single) */
  287         rmi_bus_space_write_1,
  288         rmi_bus_space_write_2,
  289         rmi_bus_space_write_4,
  290         NULL,
  291 
  292         /* write multiple */
  293         rmi_bus_space_write_multi_1,
  294         rmi_bus_space_write_multi_2,
  295         rmi_bus_space_write_multi_4,
  296         NULL,
  297 
  298         /* write region */
  299         NULL,
  300         rmi_bus_space_write_region_2,
  301         rmi_bus_space_write_region_4,
  302         NULL,
  303 
  304         /* set multiple */
  305         NULL,
  306         NULL,
  307         NULL,
  308         NULL,
  309 
  310         /* set region */
  311         NULL,
  312         rmi_bus_space_set_region_2,
  313         rmi_bus_space_set_region_4,
  314         NULL,
  315 
  316         /* copy */
  317         NULL,
  318         rmi_bus_space_copy_region_2,
  319         NULL,
  320         NULL,
  321 
  322         /* read (single) stream */
  323         rmi_bus_space_read_stream_1,
  324         rmi_bus_space_read_stream_2,
  325         rmi_bus_space_read_stream_4,
  326         NULL,
  327 
  328         /* read multiple stream */
  329         rmi_bus_space_read_multi_stream_1,
  330         rmi_bus_space_read_multi_stream_2,
  331         rmi_bus_space_read_multi_stream_4,
  332         NULL,
  333 
  334         /* read region stream */
  335         rmi_bus_space_read_region_1,
  336         rmi_bus_space_read_region_2,
  337         rmi_bus_space_read_region_4,
  338         NULL,
  339 
  340         /* write (single) stream */
  341         rmi_bus_space_write_stream_1,
  342         rmi_bus_space_write_stream_2,
  343         rmi_bus_space_write_stream_4,
  344         NULL,
  345 
  346         /* write multiple stream */
  347         rmi_bus_space_write_multi_stream_1,
  348         rmi_bus_space_write_multi_stream_2,
  349         rmi_bus_space_write_multi_stream_4,
  350         NULL,
  351 
  352         /* write region stream */
  353         NULL,
  354         rmi_bus_space_write_region_2,
  355         rmi_bus_space_write_region_4,
  356         NULL,
  357 };
  358 
  359 /* generic bus_space tag */
  360 bus_space_tag_t rmi_bus_space = &local_rmi_bus_space;
  361 
  362 /*
  363  * Map a region of device bus space into CPU virtual address space.
  364  */
  365 static int
  366 rmi_bus_space_map(void *t __unused, bus_addr_t addr,
  367     bus_size_t size __unused, int flags __unused,
  368     bus_space_handle_t *bshp)
  369 {
  370 
  371         *bshp = MIPS_PHYS_TO_DIRECT_UNCACHED(addr);
  372         return (0);
  373 }
  374 
  375 /*
  376  * Unmap a region of device bus space.
  377  */
  378 static void
  379 rmi_bus_space_unmap(void *t __unused, bus_space_handle_t bsh __unused,
  380     bus_size_t size __unused)
  381 {
  382 }
  383 
  384 /*
  385  * Get a new handle for a subregion of an already-mapped area of bus space.
  386  */
  387 
  388 static int
  389 rmi_bus_space_subregion(void *t __unused, bus_space_handle_t bsh,
  390     bus_size_t offset, bus_size_t size __unused,
  391     bus_space_handle_t *nbshp)
  392 {
  393         *nbshp = bsh + offset;
  394         return (0);
  395 }
  396 
  397 /*
  398  * Read a 1, 2, 4, or 8 byte quantity from bus space
  399  * described by tag/handle/offset.
  400  */
  401 
  402 static u_int8_t
  403 rmi_bus_space_read_1(void *tag, bus_space_handle_t handle,
  404     bus_size_t offset)
  405 {
  406         return (u_int8_t) (*(volatile u_int8_t *)(handle + offset));
  407 }
  408 
  409 static u_int16_t
  410 rmi_bus_space_read_2(void *tag, bus_space_handle_t handle,
  411     bus_size_t offset)
  412 {
  413         return (u_int16_t)(*(volatile u_int16_t *)(handle + offset));
  414 }
  415 
  416 static u_int32_t
  417 rmi_bus_space_read_4(void *tag, bus_space_handle_t handle,
  418     bus_size_t offset)
  419 {
  420         return (*(volatile u_int32_t *)(handle + offset));
  421 }
  422 
  423 
  424 /*
  425  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
  426  * described by tag/handle/offset and copy into buffer provided.
  427  */
  428 static void
  429 rmi_bus_space_read_multi_1(void *tag, bus_space_handle_t handle,
  430     bus_size_t offset, u_int8_t *addr, size_t count)
  431 {
  432         TODO();
  433 }
  434 
  435 static void
  436 rmi_bus_space_read_multi_2(void *tag, bus_space_handle_t handle,
  437     bus_size_t offset, u_int16_t *addr, size_t count)
  438 {
  439         TODO();
  440 }
  441 
  442 static void
  443 rmi_bus_space_read_multi_4(void *tag, bus_space_handle_t handle,
  444     bus_size_t offset, u_int32_t *addr, size_t count)
  445 {
  446         TODO();
  447 }
  448 
  449 /*
  450  * Write the 1, 2, 4, or 8 byte value `value' to bus space
  451  * described by tag/handle/offset.
  452  */
  453 
  454 static void
  455 rmi_bus_space_write_1(void *tag, bus_space_handle_t handle,
  456     bus_size_t offset, u_int8_t value)
  457 {
  458         *(volatile u_int8_t *)(handle + offset) =  value;
  459 }
  460 
  461 static void
  462 rmi_bus_space_write_2(void *tag, bus_space_handle_t handle,
  463     bus_size_t offset, u_int16_t value)
  464 {
  465         *(volatile u_int16_t *)(handle + offset) = value;
  466 }
  467 
  468 static void
  469 rmi_bus_space_write_4(void *tag, bus_space_handle_t handle,
  470     bus_size_t offset, u_int32_t value)
  471 {
  472         *(volatile u_int32_t *)(handle + offset) = value;
  473 }
  474 
  475 
  476 /*
  477  * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
  478  * provided to bus space described by tag/handle/offset.
  479  */
  480 
  481 
  482 static void
  483 rmi_bus_space_write_multi_1(void *tag, bus_space_handle_t handle,
  484     bus_size_t offset, const u_int8_t *addr, size_t count)
  485 {
  486         TODO();
  487 }
  488 
  489 static void
  490 rmi_bus_space_write_multi_2(void *tag, bus_space_handle_t handle,
  491     bus_size_t offset, const u_int16_t *addr, size_t count)
  492 {
  493         TODO();
  494 }
  495 
  496 static void
  497 rmi_bus_space_write_multi_4(void *tag, bus_space_handle_t handle,
  498     bus_size_t offset, const u_int32_t *addr, size_t count)
  499 {
  500         TODO();
  501 }
  502 
  503 /*
  504  * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
  505  * by tag/handle starting at `offset'.
  506  */
  507 
  508 static void
  509 rmi_bus_space_set_region_2(void *t, bus_space_handle_t bsh,
  510     bus_size_t offset, u_int16_t value, size_t count)
  511 {
  512         bus_addr_t addr = bsh + offset;
  513 
  514         for (; count != 0; count--, addr += 2)
  515                 (*(volatile u_int32_t *)(addr)) = value;
  516 }
  517 
  518 static void
  519 rmi_bus_space_set_region_4(void *t, bus_space_handle_t bsh,
  520     bus_size_t offset, u_int32_t value, size_t count)
  521 {
  522         bus_addr_t addr = bsh + offset;
  523 
  524         for (; count != 0; count--, addr += 4)
  525                 (*(volatile u_int32_t *)(addr)) = value;
  526 }
  527 
  528 
  529 /*
  530  * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
  531  * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
  532  */
  533 static void
  534 rmi_bus_space_copy_region_2(void *t, bus_space_handle_t bsh1,
  535     bus_size_t off1, bus_space_handle_t bsh2,
  536     bus_size_t off2, size_t count)
  537 {
  538         printf("bus_space_copy_region_2 - unimplemented\n");
  539 }
  540 
  541 /*
  542  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
  543  * described by tag/handle/offset and copy into buffer provided.
  544  */
  545 
  546 u_int8_t
  547 rmi_bus_space_read_stream_1(void *t, bus_space_handle_t handle,
  548     bus_size_t offset)
  549 {
  550 
  551         return *((volatile u_int8_t *)(handle + offset));
  552 }
  553 
  554 
  555 static u_int16_t
  556 rmi_bus_space_read_stream_2(void *t, bus_space_handle_t handle,
  557     bus_size_t offset)
  558 {
  559         return *(volatile u_int16_t *)(handle + offset);
  560 }
  561 
  562 
  563 static u_int32_t
  564 rmi_bus_space_read_stream_4(void *t, bus_space_handle_t handle,
  565     bus_size_t offset)
  566 {
  567         return (*(volatile u_int32_t *)(handle + offset));
  568 }
  569 
  570 
  571 static void
  572 rmi_bus_space_read_multi_stream_1(void *tag, bus_space_handle_t handle,
  573     bus_size_t offset, u_int8_t *addr, size_t count)
  574 {
  575         TODO();
  576 }
  577 
  578 static void
  579 rmi_bus_space_read_multi_stream_2(void *tag, bus_space_handle_t handle,
  580     bus_size_t offset, u_int16_t *addr, size_t count)
  581 {
  582         TODO();
  583 }
  584 
  585 static void
  586 rmi_bus_space_read_multi_stream_4(void *tag, bus_space_handle_t handle,
  587     bus_size_t offset, u_int32_t *addr, size_t count)
  588 {
  589         TODO();
  590 }
  591 
  592 
  593 /*
  594  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
  595  * described by tag/handle and starting at `offset' and copy into
  596  * buffer provided.
  597  */
  598 void
  599 rmi_bus_space_read_region_1(void *t, bus_space_handle_t bsh,
  600     bus_size_t offset, u_int8_t *addr, size_t count)
  601 {
  602         TODO();
  603 }
  604 
  605 void
  606 rmi_bus_space_read_region_2(void *t, bus_space_handle_t bsh,
  607     bus_size_t offset, u_int16_t *addr, size_t count)
  608 {
  609         TODO();
  610 }
  611 
  612 void
  613 rmi_bus_space_read_region_4(void *t, bus_space_handle_t bsh,
  614     bus_size_t offset, u_int32_t *addr, size_t count)
  615 {
  616         bus_addr_t baddr = bsh + offset;
  617 
  618         while (count--) {
  619                 *addr++ = (*(volatile u_int32_t *)(baddr));
  620                 baddr += 4;
  621         }
  622 }
  623 
  624 void
  625 rmi_bus_space_write_stream_1(void *t, bus_space_handle_t handle,
  626     bus_size_t offset, u_int8_t value)
  627 {
  628         TODO();
  629 }
  630 
  631 
  632 static void
  633 rmi_bus_space_write_stream_2(void *t, bus_space_handle_t handle,
  634     bus_size_t offset, u_int16_t value)
  635 {
  636         TODO();
  637 }
  638 
  639 
  640 static void
  641 rmi_bus_space_write_stream_4(void *t, bus_space_handle_t handle,
  642     bus_size_t offset, u_int32_t value)
  643 {
  644         TODO();
  645 }
  646 
  647 
  648 static void
  649 rmi_bus_space_write_multi_stream_1(void *tag, bus_space_handle_t handle,
  650     bus_size_t offset, const u_int8_t *addr, size_t count)
  651 {
  652         TODO();
  653 }
  654 
  655 static void
  656 rmi_bus_space_write_multi_stream_2(void *tag, bus_space_handle_t handle,
  657     bus_size_t offset, const u_int16_t *addr, size_t count)
  658 {
  659         TODO();
  660 }
  661 
  662 static void
  663 rmi_bus_space_write_multi_stream_4(void *tag, bus_space_handle_t handle,
  664     bus_size_t offset, const u_int32_t *addr, size_t count)
  665 {
  666         TODO();
  667 }
  668 
  669 void
  670 rmi_bus_space_write_region_2(void *t,
  671     bus_space_handle_t bsh,
  672     bus_size_t offset,
  673     const u_int16_t *addr,
  674     size_t count)
  675 {
  676         TODO();
  677 }
  678 
  679 void
  680 rmi_bus_space_write_region_4(void *t, bus_space_handle_t bsh,
  681     bus_size_t offset, const u_int32_t *addr, size_t count)
  682 {
  683         TODO();
  684 }
  685 
  686 static void
  687 rmi_bus_space_barrier(void *tag __unused, bus_space_handle_t bsh __unused,
  688     bus_size_t offset __unused, bus_size_t len __unused, int flags)
  689 {
  690 }
  691 
  692 /*
  693  * need a special bus space for this, because the Netlogic SoC
  694  * UART allows only 32 bit access to its registers
  695  */
  696 
  697 static u_int8_t
  698 rmi_uart_bus_space_read_1(void *tag, bus_space_handle_t handle,
  699     bus_size_t offset)
  700 {
  701         return (u_int8_t)(*(volatile u_int32_t *)(handle + offset));
  702 }
  703 
  704 static void
  705 rmi_uart_bus_space_write_1(void *tag, bus_space_handle_t handle,
  706     bus_size_t offset, u_int8_t value)
  707 {
  708         *(volatile u_int32_t *)(handle + offset) =  value;
  709 }
  710 
  711 static struct bus_space local_rmi_uart_bus_space = {
  712         /* cookie */
  713         (void *)0,
  714 
  715         /* mapping/unmapping */
  716         rmi_bus_space_map,
  717         rmi_bus_space_unmap,
  718         rmi_bus_space_subregion,
  719 
  720         /* allocation/deallocation */
  721         NULL,
  722         NULL,
  723 
  724         /* barrier */
  725         rmi_bus_space_barrier,
  726 
  727         /* read (single) */
  728         rmi_uart_bus_space_read_1, NULL, NULL, NULL,
  729 
  730         /* read multiple */
  731         NULL, NULL, NULL, NULL,
  732 
  733         /* read region */
  734         NULL, NULL, NULL, NULL,
  735 
  736         /* write (single) */
  737         rmi_uart_bus_space_write_1, NULL, NULL, NULL,
  738 
  739         /* write multiple */
  740         NULL, NULL, NULL, NULL,
  741 
  742         /* write region */
  743         NULL, NULL, NULL, NULL,
  744 
  745         /* set multiple */
  746         NULL, NULL, NULL, NULL,
  747 
  748         /* set region */
  749         NULL, NULL, NULL, NULL,
  750 
  751         /* copy */
  752         NULL, NULL, NULL, NULL,
  753 
  754         /* read (single) stream */
  755         NULL, NULL, NULL, NULL,
  756 
  757         /* read multiple stream */
  758         NULL, NULL, NULL, NULL,
  759 
  760         /* read region stream */
  761         NULL, NULL, NULL, NULL,
  762 
  763         /* write (single) stream */
  764         NULL, NULL, NULL, NULL,
  765 
  766         /* write multiple stream */
  767         NULL, NULL, NULL, NULL,
  768 
  769         /* write region stream */
  770         NULL, NULL, NULL, NULL,
  771 };
  772 
  773 /* generic bus_space tag */
  774 bus_space_tag_t rmi_uart_bus_space = &local_rmi_uart_bus_space;

Cache object: 51dde60fe961c59f004eb36a94026cef


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