]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/arm/arm.h
Clean up header guards that don't match their file name
[mirror_qemu.git] / include / hw / arm / arm.h
CommitLineData
87ecb68b
PB
1/*
2 * Misc ARM declarations
3 *
4 * Copyright (c) 2006 CodeSourcery.
5 * Written by Paul Brook
6 *
8e31bf38 7 * This code is licensed under the LGPL.
87ecb68b
PB
8 *
9 */
10
121d0712
MA
11#ifndef HW_ARM_H
12#define HW_ARM_H
87ecb68b 13
022c62cb 14#include "exec/memory.h"
16fd6461 15#include "target-arm/cpu-qom.h"
5202ef94 16#include "hw/irq.h"
ac9d32e3 17#include "qemu/notify.h"
7d6f78cf 18
9776f636
PC
19typedef enum {
20 ARM_ENDIANNESS_UNKNOWN = 0,
21 ARM_ENDIANNESS_LE,
22 ARM_ENDIANNESS_BE8,
23 ARM_ENDIANNESS_BE32,
24} arm_endianness;
25
87ecb68b 26/* armv7m.c */
20c59c38 27DeviceState *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq,
87ecb68b
PB
28 const char *kernel_filename, const char *cpu_model);
29
ac9d32e3
EA
30/*
31 * struct used as a parameter of the arm_load_kernel machine init
32 * done notifier
33 */
34typedef struct {
35 Notifier notifier; /* actual notifier */
36 ARMCPU *cpu; /* handle to the first cpu object */
37} ArmLoadKernelNotifier;
38
87ecb68b 39/* arm_boot.c */
f93eb9ff 40struct arm_boot_info {
de841dea 41 uint64_t ram_size;
f93eb9ff
AZ
42 const char *kernel_filename;
43 const char *kernel_cmdline;
44 const char *initrd_filename;
412beee6 45 const char *dtb_filename;
a8170e5e 46 hwaddr loader_start;
9d5ba9bf
ML
47 /* multicore boards that use the default secondary core boot functions
48 * need to put the address of the secondary boot code, the boot reg,
49 * and the GIC address in the next 3 values, respectively. boards that
50 * have their own boot functions can use these values as they want.
51 */
a8170e5e
AK
52 hwaddr smp_loader_start;
53 hwaddr smp_bootreg_addr;
54 hwaddr gic_cpu_if_addr;
f93eb9ff
AZ
55 int nb_cpus;
56 int board_id;
c8e829b7
GB
57 /* ARM machines that support the ARM Security Extensions use this field to
58 * control whether Linux is booted as secure(true) or non-secure(false).
59 */
60 bool secure_boot;
462a8bc6 61 int (*atag_board)(const struct arm_boot_info *info, void *p);
9d5ba9bf
ML
62 /* multicore boards that use the default secondary core boot functions
63 * can ignore these two function calls. If the default functions won't
64 * work, then write_secondary_boot() should write a suitable blob of
9b574c29 65 * code mimicking the secondary CPU startup process used by the board's
9d5ba9bf 66 * boot loader/boot ROM code, and secondary_cpu_reset_hook() should
9b574c29 67 * perform any necessary CPU reset handling and set the PC for the
9d5ba9bf
ML
68 * secondary CPUs to point at this boot blob.
69 */
9543b0cd 70 void (*write_secondary_boot)(ARMCPU *cpu,
9d5ba9bf 71 const struct arm_boot_info *info);
5d309320 72 void (*secondary_cpu_reset_hook)(ARMCPU *cpu,
9d5ba9bf 73 const struct arm_boot_info *info);
0fb79851
JR
74 /* if a board is able to create a dtb without a dtb file then it
75 * sets get_dtb. This will only be used if no dtb file is provided
76 * by the user. On success, sets *size to the length of the created
77 * dtb, and returns a pointer to it. (The caller must free this memory
78 * with g_free() when it has finished with it.) On failure, returns NULL.
79 */
80 void *(*get_dtb)(const struct arm_boot_info *info, int *size);
3b1cceb8
PM
81 /* if a board needs to be able to modify a device tree provided by
82 * the user it should implement this hook.
83 */
84 void (*modify_dtb)(const struct arm_boot_info *info, void *fdt);
ac9d32e3
EA
85 /* machine init done notifier executing arm_load_dtb */
86 ArmLoadKernelNotifier load_kernel_notifier;
f2d74978
PB
87 /* Used internally by arm_boot.c */
88 int is_linux;
fc53b7d4 89 hwaddr initrd_start;
a8170e5e
AK
90 hwaddr initrd_size;
91 hwaddr entry;
07abe45c
LE
92
93 /* Boot firmware has been loaded, typically at address 0, with -bios or
94 * -pflash. It also implies that fw_cfg_find() will succeed.
95 */
96 bool firmware_loaded;
10b8ec73
PC
97
98 /* Address at which board specific loader/setup code exists. If enabled,
99 * this code-blob will run before anything else. It must return to the
100 * caller via the link register. There is no stack set up. Enabled by
101 * defining write_board_setup, which is responsible for loading the blob
102 * to the specified address.
103 */
104 hwaddr board_setup_addr;
105 void (*write_board_setup)(ARMCPU *cpu,
106 const struct arm_boot_info *info);
baf6b681
PC
107
108 /* If set, the board specific loader/setup blob will be run from secure
109 * mode, regardless of secure_boot. The blob becomes responsible for
110 * changing to non-secure state if implementing a non-secure boot
111 */
112 bool secure_board_setup;
9776f636
PC
113
114 arm_endianness endianness;
f93eb9ff 115};
ac9d32e3
EA
116
117/**
118 * arm_load_kernel - Loads memory with everything needed to boot
119 *
120 * @cpu: handle to the first CPU object
121 * @info: handle to the boot info struct
122 * Registers a machine init done notifier that copies to memory
123 * everything needed to boot, depending on machine and user options:
124 * kernel image, boot loaders, initrd, dtb. Also registers the CPU
125 * reset handler.
126 *
127 * In case the machine file supports the platform bus device and its
128 * dynamically instantiable sysbus devices, this function must be called
129 * before sysbus-fdt arm_register_platform_bus_fdt_creator. Indeed the
130 * machine init done notifiers are called in registration reverse order.
131 */
3aaa8dfa 132void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info);
87ecb68b 133
716536a9
AB
134/* Write a secure board setup routine with a dummy handler for SMCs */
135void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu,
136 const struct arm_boot_info *info,
137 hwaddr mvbar_addr);
138
79383c9c
BS
139/* Multiplication factor to convert from system clock ticks to qemu timer
140 ticks. */
7ee930d0 141extern int system_clock_scale;
87ecb68b 142
121d0712 143#endif /* HW_ARM_H */