Wed Jan 23 16:51:15 2013 UTC ()
support BUS_SPACE_MAP_PREFETCHABLE in bcm2835_bs_mmap()


(macallan)
diff -r1.3 -r1.4 src/sys/arch/arm/broadcom/bcm2835_space.c

cvs diff -r1.3 -r1.4 src/sys/arch/arm/broadcom/Attic/bcm2835_space.c (expand / switch to unified diff)

--- src/sys/arch/arm/broadcom/Attic/bcm2835_space.c 2013/01/13 06:10:25 1.3
+++ src/sys/arch/arm/broadcom/Attic/bcm2835_space.c 2013/01/23 16:51:14 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bcm2835_space.c,v 1.3 2013/01/13 06:10:25 skrll Exp $ */ 1/* $NetBSD: bcm2835_space.c,v 1.4 2013/01/23 16:51:14 macallan Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2012 The NetBSD Foundation, Inc. 4 * Copyright (c) 2012 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Nick Hudson 8 * by Nick Hudson
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: bcm2835_space.c,v 1.3 2013/01/13 06:10:25 skrll Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: bcm2835_space.c,v 1.4 2013/01/23 16:51:14 macallan Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38 38
39#include <uvm/uvm_extern.h> 39#include <uvm/uvm_extern.h>
40 40
41#include <sys/bus.h> 41#include <sys/bus.h>
42 42
43/* Prototypes for all the bus_space structure functions */ 43/* Prototypes for all the bus_space structure functions */
44bs_protos(bcm2835); 44bs_protos(bcm2835);
45bs_protos(bcm2835_a4x); 45bs_protos(bcm2835_a4x);
46bs_protos(generic); 46bs_protos(generic);
47bs_protos(generic_armv4); 47bs_protos(generic_armv4);
@@ -360,28 +360,32 @@ bcm2835_bs_barrier(void *t, bus_space_ha @@ -360,28 +360,32 @@ bcm2835_bs_barrier(void *t, bus_space_ha
360 360
361} 361}
362 362
363void * 363void *
364bcm2835_bs_vaddr(void *t, bus_space_handle_t bsh) 364bcm2835_bs_vaddr(void *t, bus_space_handle_t bsh)
365{ 365{
366 366
367 return (void *)bsh; 367 return (void *)bsh;
368} 368}
369 369
370paddr_t 370paddr_t
371bcm2835_bs_mmap(void *t, bus_addr_t paddr, off_t offset, int prot, int flags) 371bcm2835_bs_mmap(void *t, bus_addr_t paddr, off_t offset, int prot, int flags)
372{ 372{
 373 paddr_t bus_flags = 0;
373 374
374 return (arm_btop((paddr + offset))); 375 if (flags & BUS_SPACE_MAP_PREFETCHABLE)
 376 bus_flags |= ARM32_MMAP_WRITECOMBINE;
 377
 378 return (arm_btop(paddr + offset) | bus_flags);
375} 379}
376 380
377int 381int
378bcm2835_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend, 382bcm2835_bs_alloc(void *t, bus_addr_t rstart, bus_addr_t rend,
379 bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags, 383 bus_size_t size, bus_size_t alignment, bus_size_t boundary, int flags,
380 bus_addr_t *bpap, bus_space_handle_t *bshp) 384 bus_addr_t *bpap, bus_space_handle_t *bshp)
381{ 385{
382 386
383 panic("%s(): not implemented\n", __func__); 387 panic("%s(): not implemented\n", __func__);
384} 388}
385 389
386void 390void
387bcm2835_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size) 391bcm2835_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size)