summaryrefslogtreecommitdiff
path: root/bootwrapper/bootwrapper.h
blob: 7d4449308e932d26736f12986724ba94b2c0ec03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
 * Copyright (c) 2011, ARM Limited. All rights reserved.
 *       
 * Redistribution and use in source and binary forms, with
 * or without modification, are permitted provided that the
 * following conditions are met:
 *     
 * Redistributions of source code must retain the above
 * copyright notice, this list of conditions and the 
 * following disclaimer.
 *
 * Redistributions in binary form must reproduce the
 * above copyright notice, this list of conditions and 
 * the following disclaimer in the documentation 
 * and/or other materials provided with the distribution.
 *      
 * Neither the name of ARM nor the names of its
 * contributors may be used to endorse or promote products
 * derived from this software without specific prior written
 * permission.                        
 */ 

#ifndef __BOOTWRAPPER_H__
#define __BOOTWRAPPER_H__

/* A stack of 128 words per cpu */
#define STACK_SIZE     128
#define NUM_CPUS       4
#define NUM_CLUSTERS   4
#define TRUE           1
#define FALSE          0
#define PLATFORM_MASK          0x0FFFFFFF

/* Permissions for architected timers/counters */
#define PL1PCTEN   (1 << 0)
#define PL1PCEN    (1 << 1)
#define PL0PCTEN   (1 << 0)
#define PL0VCTEN   (1 << 1)
#define PL0VTEN    (1 << 8)
#define PL0PTEN    (1 << 9)
#define CP15_TIMER_FREQ 12000000

#define VERSATILE_EXPRESS       2272
#define UART0_BASE              0X1C090000
#define VE_SYS_BASE             0X1C010000
#define CCI_BASE                0x2C090000
#define SECURE_ACCESS_REG       0x8
#define FLAGS_SET               0x30
#define FLAGS_CLR               0x34

#define VE_KFSCB_BASE        0x10020000 /* Kingfisher System Configuration Block */
#define KFS_ID_OFFSET        0xFFC      /* Kingfisher System Platform ID register offset (KFS_ID) */
#define KFS_ID_ARCH_MASK     0x000F0000 /* Mask for extracting KFS architecture */
#define KFS_ID_ARCH_SHIFT    16         /* Shift for extracting KFS architecture */
#define KFS_CFG_R            0x30       /* Kingfisher System static configuration read register  */
#define ACTIVE_CLUSTER_MASK  0x3        /* Returns the value that was driven on the CFG_ACTIVECLUSTER configuration inputs at the last system power-on reset. */
#define KFS_CFG_R_OFFSET     0x30       /* Kingfisher System Static Configuration Read register  */
#define ACTIVE_CLUSTER_MASK  0x3        /* Returns the value that was driven on the CFG_ACTIVECLUSTER configuration input */

#define CLUSTER_CPU_COUNT(x)     (((read32(VE_KFSCB_BASE + KFS_CFG_R) >> 16) >> (x << 2)) & 0xf)
#define write32(addr, val) (*(volatile unsigned int *)(addr) = (val))
#define read32(addr) (*(volatile unsigned int *)(addr))

extern void config_uart(void);
extern void drain_uart_fifo(void);
extern void start(void);

#endif                          /* __BOOTWRAPPER_H__ */