1/*
2 * Copyright 2013, winocm. <winocm@icloud.com>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 *   Redistributions of source code must retain the above copyright notice, this
9 *   list of conditions and the following disclaimer.
10 *
11 *   Redistributions in binary form must reproduce the above copyright notice, this
12 *   list of conditions and the following disclaimer in the documentation and/or
13 *   other materials provided with the distribution.
14 *
15 *   If you are going to use this software in any form that does not involve
16 *   releasing the source to this project or improving it, let me know beforehand.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29/*
30 * Other prototypes for the ARM platform.
31 */
32
33#ifndef _ARM_MISC_PROTOS_H_
34#define _ARM_MISC_PROTOS_H_
35
36#include <mach/mach_types.h>
37#include <pexpert/pexpert.h>
38#include <machine/machine_routines.h>
39#include <mach/vm_param.h>
40#include <kern/processor.h>
41#include <arm/cpuid.h>
42
43typedef struct _abort_information_context {
44    uint32_t r[13];
45    uint32_t sp;
46    uint32_t lr;
47    uint32_t pc;
48    uint32_t cpsr;
49    uint32_t fsr;
50    uint32_t far;
51} abort_information_context_t;
52
53extern processor_t cpu_processor_alloc(boolean_t is_boot_cpu);
54extern void cpu_init(void);
55extern void cpu_bootstrap(void);
56
57extern void draw_panic_dialog(void);
58
59#ifndef __LP64__
60extern void arm_set_threadpid_user_readonly(uint32_t * address);
61extern void arm_set_threadpid_priv_readwrite(uint32_t * address);
62#else
63extern void arm_set_threadpid_user_readonly(uint64_t * address);
64extern void arm_set_threadpid_priv_readwrite(uint64_t * address);
65#endif
66
67extern int arm_usimple_lock(usimple_lock_t l);
68
69void panic_arm_backtrace(void *_frame, int nframes, const char *msg,
70                         boolean_t regdump, arm_saved_state_t * regs);
71
72void arm_vm_init(uint32_t mem_limit, boot_args * args);
73
74void sleh_abort(void *context, int reason);
75
76void cache_initialize(void);
77
78void get_cachetype_cp15();
79void identify_arm_cpu(void);
80
81#endif
82