1/*
2 * ARM CPU Capabilities
3 */
4
5#ifndef _ARM_CPU_CAPABILITIES_H_
6#define _ARM_CPU_CAPABILITIES_H_
7
8#ifndef	__ASSEMBLER__
9#include <stdint.h>
10#endif /* __ASSEMBLER__ */
11
12#define _COMM_PAGE32_AREA_LENGTH    ( 1 * 4096 )    /* reserved length of entire comm area */
13#define _COMM_PAGE32_BASE_ADDRESS    ( 0x40000000 ) /* base address of allocated memory */
14#define _COMM_PAGE32_START_ADDRESS    ( _COMM_PAGE32_BASE_ADDRESS ) /* address traditional commpage code starts on */
15#define _COMM_PAGE32_AREA_USED        ( 1 * 4096 )  /* this is the amt actually allocated */
16#define _COMM_PAGE32_SIGS_OFFSET        0x8000  /* offset to routine signatures */
17
18#define _COMM_PAGE64_AREA_LENGTH    ( 1 * 4096 )
19#ifdef __ASSEMBLER__
20#define _COMM_PAGE64_BASE_ADDRESS    ( _COMM_PAGE32_BASE_ADDRESS )  /* base address of allocated memory */
21#else                           /* __ASSEMBLER__ */
22#define _COMM_PAGE64_BASE_ADDRESS    ( _COMM_PAGE32_BASE_ADDRESS )  /* base address of allocated memory */
23#endif                          /* __ASSEMBLER__ */
24#define _COMM_PAGE64_START_ADDRESS    ( _COMM_PAGE32_BASE_ADDRESS ) /* address traditional commpage code starts on */
25#define _COMM_PAGE64_AREA_USED        ( 1 * 4096 )  /* this is the amt actually populated */
26
27#define _COMM_PAGE32_OBJC_SIZE        0ULL
28#define _COMM_PAGE32_OBJC_BASE        0ULL
29#define _COMM_PAGE64_OBJC_SIZE        0ULL
30#define _COMM_PAGE64_OBJC_BASE        0ULL
31
32#define _COMM_PAGE_TEXT_START       (_COMM_PAGE_START_ADDRESS+0x1000)
33#define _COMM_PAGE32_TEXT_START     (_COMM_PAGE32_BASE_ADDRESS+0x1000)  /* start of text section */
34#define _COMM_PAGE64_TEXT_START     (_COMM_PAGE64_BASE_ADDRESS+0x1000)
35#define _COMM_PAGE_TEXT_AREA_USED   ( 1 * 4096 )
36#define _COMM_PAGE_TEXT_AREA_LENGTH ( 1 * 4096 )
37
38#define _COMM_PAGE_AREA_LENGTH      _COMM_PAGE32_AREA_LENGTH
39#define _COMM_PAGE_BASE_ADDRESS     _COMM_PAGE32_BASE_ADDRESS
40#define _COMM_PAGE_START_ADDRESS    _COMM_PAGE32_START_ADDRESS
41#define _COMM_PAGE_AREA_USED        _COMM_PAGE32_AREA_USED
42#define _COMM_PAGE_SIGS_OFFSET      _COMM_PAGE32_SIGS_OFFSET
43
44/*
45 * COMMPAGE Definitions
46 */
47#define _COMM_PAGE_CPUFAMILY 			0x40000080		/* Set to CPUFAMILY_ARM_13 for CortexA8 */
48#define _COMM_PAGE_TIMEOFDAY_DATA		0x40000040
49#define _COMM_PAGE_MEMORY_SIZE			0x40000038
50#define _COMM_PAGE_NCPUS                        0x40000022
51#define _COMM_PAGE_CPU_CAPABILITIES		0x40000020
52#define _COMM_PAGE_MYSTERY_VALUE		0x4000001E		/* This is a uint16_t with value of 3. */
53
54/*
55 * CPU definitions.
56 */
57#define kUP 		0x8000
58#define kHasEvent	0x1000
59
60#ifndef	__ASSEMBLER__
61/*
62 * Guessed from http://opensource.apple.com/source/Libc/Libc-825.24/arm/sys/arm_commpage_gettimeofday.c.
63 *
64 * Thanks Apple! <3
65 */
66typedef struct __commpage_timeofday_data_t {
67    uint64_t TimeBase;
68    uint32_t TimeStamp_usec;
69    uint32_t TimeStamp_sec;
70    uint32_t TimeBaseTicks_per_sec;
71    uint64_t TimeBase_magic;
72    uint32_t TimeBase_add;
73    uint32_t TimeBase_shift;
74} commpage_timeofday_data_t;
75#endif
76
77#endif
78