2 * Misc ARM declarations
4 * Copyright (c) 2006 CodeSourcery.
5 * Written by Paul Brook
7 * This code is licensed under the LGPL.
14 #include "exec/memory.h"
15 #include "target/arm/cpu-qom.h"
17 #include "qemu/notify.h"
20 ARM_ENDIANNESS_UNKNOWN
= 0,
27 DeviceState
*armv7m_init(MemoryRegion
*system_memory
, int mem_size
, int num_irq
,
28 const char *kernel_filename
, const char *cpu_model
);
32 * @kernel_filename: file to load
33 * @mem_size: mem_size: maximum image size to load
35 * Load the guest image for an ARMv7M system. This must be called by
36 * any ARMv7M board, either directly or via armv7m_init(). (This is
37 * necessary to ensure that the CPU resets correctly on system reset,
38 * as well as for kernel loading.)
40 void armv7m_load_kernel(ARMCPU
*cpu
, const char *kernel_filename
, int mem_size
);
43 * struct used as a parameter of the arm_load_kernel machine init
47 Notifier notifier
; /* actual notifier */
48 ARMCPU
*cpu
; /* handle to the first cpu object */
49 } ArmLoadKernelNotifier
;
52 struct arm_boot_info
{
54 const char *kernel_filename
;
55 const char *kernel_cmdline
;
56 const char *initrd_filename
;
57 const char *dtb_filename
;
59 /* multicore boards that use the default secondary core boot functions
60 * need to put the address of the secondary boot code, the boot reg,
61 * and the GIC address in the next 3 values, respectively. boards that
62 * have their own boot functions can use these values as they want.
64 hwaddr smp_loader_start
;
65 hwaddr smp_bootreg_addr
;
66 hwaddr gic_cpu_if_addr
;
69 /* ARM machines that support the ARM Security Extensions use this field to
70 * control whether Linux is booted as secure(true) or non-secure(false).
73 int (*atag_board
)(const struct arm_boot_info
*info
, void *p
);
74 /* multicore boards that use the default secondary core boot functions
75 * can ignore these two function calls. If the default functions won't
76 * work, then write_secondary_boot() should write a suitable blob of
77 * code mimicking the secondary CPU startup process used by the board's
78 * boot loader/boot ROM code, and secondary_cpu_reset_hook() should
79 * perform any necessary CPU reset handling and set the PC for the
80 * secondary CPUs to point at this boot blob.
82 void (*write_secondary_boot
)(ARMCPU
*cpu
,
83 const struct arm_boot_info
*info
);
84 void (*secondary_cpu_reset_hook
)(ARMCPU
*cpu
,
85 const struct arm_boot_info
*info
);
86 /* if a board is able to create a dtb without a dtb file then it
87 * sets get_dtb. This will only be used if no dtb file is provided
88 * by the user. On success, sets *size to the length of the created
89 * dtb, and returns a pointer to it. (The caller must free this memory
90 * with g_free() when it has finished with it.) On failure, returns NULL.
92 void *(*get_dtb
)(const struct arm_boot_info
*info
, int *size
);
93 /* if a board needs to be able to modify a device tree provided by
94 * the user it should implement this hook.
96 void (*modify_dtb
)(const struct arm_boot_info
*info
, void *fdt
);
97 /* machine init done notifier executing arm_load_dtb */
98 ArmLoadKernelNotifier load_kernel_notifier
;
99 /* Used internally by arm_boot.c */
105 /* Boot firmware has been loaded, typically at address 0, with -bios or
106 * -pflash. It also implies that fw_cfg_find() will succeed.
108 bool firmware_loaded
;
110 /* Address at which board specific loader/setup code exists. If enabled,
111 * this code-blob will run before anything else. It must return to the
112 * caller via the link register. There is no stack set up. Enabled by
113 * defining write_board_setup, which is responsible for loading the blob
114 * to the specified address.
116 hwaddr board_setup_addr
;
117 void (*write_board_setup
)(ARMCPU
*cpu
,
118 const struct arm_boot_info
*info
);
120 /* If set, the board specific loader/setup blob will be run from secure
121 * mode, regardless of secure_boot. The blob becomes responsible for
122 * changing to non-secure state if implementing a non-secure boot
124 bool secure_board_setup
;
126 arm_endianness endianness
;
130 * arm_load_kernel - Loads memory with everything needed to boot
132 * @cpu: handle to the first CPU object
133 * @info: handle to the boot info struct
134 * Registers a machine init done notifier that copies to memory
135 * everything needed to boot, depending on machine and user options:
136 * kernel image, boot loaders, initrd, dtb. Also registers the CPU
139 * In case the machine file supports the platform bus device and its
140 * dynamically instantiable sysbus devices, this function must be called
141 * before sysbus-fdt arm_register_platform_bus_fdt_creator. Indeed the
142 * machine init done notifiers are called in registration reverse order.
144 void arm_load_kernel(ARMCPU
*cpu
, struct arm_boot_info
*info
);
146 /* Write a secure board setup routine with a dummy handler for SMCs */
147 void arm_write_secure_board_setup_dummy_smc(ARMCPU
*cpu
,
148 const struct arm_boot_info
*info
,
151 /* Multiplication factor to convert from system clock ticks to qemu timer
153 extern int system_clock_scale
;
155 #endif /* HW_ARM_H */