bcm2835_vcbus.h revision 239922
1239922Sgonzo/*-
2239922Sgonzo * Copyright (c) 2012 Oleksandr Tymoshenko <gonzo@freebsd.org>
3239922Sgonzo * All rights reserved.
4239922Sgonzo *
5239922Sgonzo * Redistribution and use in source and binary forms, with or without
6239922Sgonzo * modification, are permitted provided that the following conditions
7239922Sgonzo * are met:
8239922Sgonzo * 1. Redistributions of source code must retain the above copyright
9239922Sgonzo *    notice, this list of conditions and the following disclaimer.
10239922Sgonzo * 2. Redistributions in binary form must reproduce the above copyright
11239922Sgonzo *    notice, this list of conditions and the following disclaimer in the
12239922Sgonzo *    documentation and/or other materials provided with the distribution.
13239922Sgonzo *
14239922Sgonzo * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15239922Sgonzo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16239922Sgonzo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17239922Sgonzo * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18239922Sgonzo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19239922Sgonzo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20239922Sgonzo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21239922Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22239922Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23239922Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24239922Sgonzo * SUCH DAMAGE.
25239922Sgonzo *
26239922Sgonzo * $FreeBSD: head/sys/arm/broadcom/bcm2835/bcm2835_vcbus.h 239922 2012-08-30 20:59:37Z gonzo $
27239922Sgonzo */
28239922Sgonzo
29239922Sgonzo/*
30239922Sgonzo * Defines for converting physical address to VideoCore bus address and back
31239922Sgonzo */
32239922Sgonzo
33239922Sgonzo#ifndef _BCM2835_VCBUS_H_
34239922Sgonzo#define _BCM2835_VCBUS_H_
35239922Sgonzo
36239922Sgonzo#define	BCM2835_VCBUS_SDRAM_CACHED	0x40000000
37239922Sgonzo#define	BCM2835_VCBUS_SDRAM_UNCACHED	0xC0000000
38239922Sgonzo
39239922Sgonzo/*
40239922Sgonzo * Convert physical address to VC bus address. Should be used
41239922Sgonzo * when submitting address over mailbox interface
42239922Sgonzo */
43239922Sgonzo#define	PHYS_TO_VCBUS(pa)	((pa) + BCM2835_VCBUS_SDRAM_CACHED)
44239922Sgonzo
45239922Sgonzo/*
46239922Sgonzo * Convert address from VC bus space to physical. Should be used
47239922Sgonzo * when address is returned by VC over mailbox interface. e.g.
48239922Sgonzo * framebuffer base
49239922Sgonzo */
50239922Sgonzo#define	VCBUS_TO_PHYS(vca)	((vca) - BCM2835_VCBUS_SDRAM_CACHED)
51239922Sgonzo
52239922Sgonzo#endif /* _BCM2835_VCBUS_H_ */
53