1/**
2 * \file
3 * \brief Read the configuration base register (CBAR)
4 */
5
6/*
7 * Copyright (c) 2016 ETH Zurich.
8 * All rights reserved.
9 *
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
13 */
14
15#include <cp15.h>
16#include <kernel.h>
17#include <arch/arm/platform.h>
18
19extern uint32_t periphbase;
20
21/* For all sensible implementations of ARMv7-A platforms, you can find the
22 * base of the private peripheral region by reading the cp15 CBAR register. On
23 * GEM5, it needs to be supplied, as CBAR isn't implemented. */
24lpaddr_t platform_get_private_region(void) {
25    if(periphbase == 0) return cp15_read_cbar();
26    else                return periphbase;
27}
28