2007-11-17 18:14:51 +01:00
|
|
|
/*
|
|
|
|
* Misc ARM declarations
|
|
|
|
*
|
|
|
|
* Copyright (c) 2006 CodeSourcery.
|
|
|
|
* Written by Paul Brook
|
|
|
|
*
|
2011-06-26 04:21:35 +02:00
|
|
|
* This code is licensed under the LGPL.
|
2007-11-17 18:14:51 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ARM_MISC_H
|
|
|
|
#define ARM_MISC_H 1
|
|
|
|
|
2012-12-17 18:19:49 +01:00
|
|
|
#include "exec/memory.h"
|
2012-10-16 03:57:21 +02:00
|
|
|
#include "hw/irq.h"
|
2015-06-02 13:29:12 +02:00
|
|
|
#include "qemu/notify.h"
|
2015-07-03 16:18:24 +02:00
|
|
|
#include "cpu.h"
|
2011-07-25 13:27:01 +02:00
|
|
|
|
2007-11-17 18:14:51 +01:00
|
|
|
/* armv7m.c */
|
2015-11-03 14:49:41 +01:00
|
|
|
DeviceState *armv7m_init(MemoryRegion *system_memory, int mem_size, int num_irq,
|
2007-11-17 18:14:51 +01:00
|
|
|
const char *kernel_filename, const char *cpu_model);
|
|
|
|
|
2015-06-02 13:29:12 +02:00
|
|
|
/*
|
|
|
|
* struct used as a parameter of the arm_load_kernel machine init
|
|
|
|
* done notifier
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
Notifier notifier; /* actual notifier */
|
|
|
|
ARMCPU *cpu; /* handle to the first cpu object */
|
|
|
|
} ArmLoadKernelNotifier;
|
|
|
|
|
2007-11-17 18:14:51 +01:00
|
|
|
/* arm_boot.c */
|
2008-04-14 22:27:51 +02:00
|
|
|
struct arm_boot_info {
|
2012-07-20 14:34:49 +02:00
|
|
|
uint64_t ram_size;
|
2008-04-14 22:27:51 +02:00
|
|
|
const char *kernel_filename;
|
|
|
|
const char *kernel_cmdline;
|
|
|
|
const char *initrd_filename;
|
2012-03-02 12:56:38 +01:00
|
|
|
const char *dtb_filename;
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr loader_start;
|
2012-01-26 12:43:48 +01:00
|
|
|
/* multicore boards that use the default secondary core boot functions
|
|
|
|
* need to put the address of the secondary boot code, the boot reg,
|
|
|
|
* and the GIC address in the next 3 values, respectively. boards that
|
|
|
|
* have their own boot functions can use these values as they want.
|
|
|
|
*/
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr smp_loader_start;
|
|
|
|
hwaddr smp_bootreg_addr;
|
|
|
|
hwaddr gic_cpu_if_addr;
|
2008-04-14 22:27:51 +02:00
|
|
|
int nb_cpus;
|
|
|
|
int board_id;
|
2014-12-16 00:09:47 +01:00
|
|
|
/* ARM machines that support the ARM Security Extensions use this field to
|
|
|
|
* control whether Linux is booted as secure(true) or non-secure(false).
|
|
|
|
*/
|
|
|
|
bool secure_boot;
|
2011-06-23 17:53:48 +02:00
|
|
|
int (*atag_board)(const struct arm_boot_info *info, void *p);
|
2012-01-26 12:43:48 +01:00
|
|
|
/* multicore boards that use the default secondary core boot functions
|
|
|
|
* can ignore these two function calls. If the default functions won't
|
|
|
|
* work, then write_secondary_boot() should write a suitable blob of
|
2012-05-28 06:11:49 +02:00
|
|
|
* code mimicking the secondary CPU startup process used by the board's
|
2012-01-26 12:43:48 +01:00
|
|
|
* boot loader/boot ROM code, and secondary_cpu_reset_hook() should
|
2012-05-28 06:11:49 +02:00
|
|
|
* perform any necessary CPU reset handling and set the PC for the
|
2012-01-26 12:43:48 +01:00
|
|
|
* secondary CPUs to point at this boot blob.
|
|
|
|
*/
|
2012-05-14 00:08:10 +02:00
|
|
|
void (*write_secondary_boot)(ARMCPU *cpu,
|
2012-01-26 12:43:48 +01:00
|
|
|
const struct arm_boot_info *info);
|
2012-05-14 01:05:40 +02:00
|
|
|
void (*secondary_cpu_reset_hook)(ARMCPU *cpu,
|
2012-01-26 12:43:48 +01:00
|
|
|
const struct arm_boot_info *info);
|
2013-11-22 18:17:10 +01:00
|
|
|
/* if a board is able to create a dtb without a dtb file then it
|
|
|
|
* sets get_dtb. This will only be used if no dtb file is provided
|
|
|
|
* by the user. On success, sets *size to the length of the created
|
|
|
|
* dtb, and returns a pointer to it. (The caller must free this memory
|
|
|
|
* with g_free() when it has finished with it.) On failure, returns NULL.
|
|
|
|
*/
|
|
|
|
void *(*get_dtb)(const struct arm_boot_info *info, int *size);
|
2013-07-16 14:25:10 +02:00
|
|
|
/* if a board needs to be able to modify a device tree provided by
|
|
|
|
* the user it should implement this hook.
|
|
|
|
*/
|
|
|
|
void (*modify_dtb)(const struct arm_boot_info *info, void *fdt);
|
2015-06-02 13:29:12 +02:00
|
|
|
/* machine init done notifier executing arm_load_dtb */
|
|
|
|
ArmLoadKernelNotifier load_kernel_notifier;
|
2009-11-11 19:07:53 +01:00
|
|
|
/* Used internally by arm_boot.c */
|
|
|
|
int is_linux;
|
2012-10-26 17:29:38 +02:00
|
|
|
hwaddr initrd_start;
|
2012-10-23 12:30:10 +02:00
|
|
|
hwaddr initrd_size;
|
|
|
|
hwaddr entry;
|
hw/arm: pass pristine kernel image to guest firmware over fw_cfg
Introduce the new boolean field "arm_boot_info.firmware_loaded". When this
field is set, it means that the portion of guest DRAM that the VCPU
normally starts to execute, or the pflash chip that the VCPU normally
starts to execute, has been populated by board-specific code with
full-fledged guest firmware code, before the board calls
arm_load_kernel().
Simultaneously, "arm_boot_info.firmware_loaded" guarantees that the board
code has set up the global firmware config instance, for arm_load_kernel()
to find with fw_cfg_find().
Guest kernel (-kernel) and guest firmware (-bios, -pflash) has always been
possible to specify independently on the command line. The following cases
should be considered:
nr -bios -pflash -kernel description
unit#0
-- ------- ------- ------- -------------------------------------------
1 present present absent Board code rejects this case, -bios and
present present present -pflash unit#0 are exclusive. Left intact
by this patch.
2 absent absent present Traditional kernel loading, with qemu's
minimal board firmware. Left intact by this
patch.
3 absent present absent Preexistent case for booting guest firmware
present absent absent loaded with -bios or -pflash. Left intact
by this patch.
4 absent absent absent Preexistent case for not loading any
firmware or kernel up-front. Left intact by
this patch.
5 present absent present New case introduced by this patch: kernel
absent present present image is passed to externally loaded
firmware in unmodified form, using fw_cfg.
An easy way to see that this patch doesn't interfere with existing cases
is to realize that "info->firmware_loaded" is constant zero at this point.
Which makes the "outer" condition unchanged, and the "inner" condition
(with the fw_cfg-related code) dead.
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1419250305-31062-11-git-send-email-pbonzini@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-12-22 13:11:44 +01:00
|
|
|
|
|
|
|
/* Boot firmware has been loaded, typically at address 0, with -bios or
|
|
|
|
* -pflash. It also implies that fw_cfg_find() will succeed.
|
|
|
|
*/
|
|
|
|
bool firmware_loaded;
|
2015-11-03 14:49:41 +01:00
|
|
|
|
|
|
|
/* Address at which board specific loader/setup code exists. If enabled,
|
|
|
|
* this code-blob will run before anything else. It must return to the
|
|
|
|
* caller via the link register. There is no stack set up. Enabled by
|
|
|
|
* defining write_board_setup, which is responsible for loading the blob
|
|
|
|
* to the specified address.
|
|
|
|
*/
|
|
|
|
hwaddr board_setup_addr;
|
|
|
|
void (*write_board_setup)(ARMCPU *cpu,
|
|
|
|
const struct arm_boot_info *info);
|
2008-04-14 22:27:51 +02:00
|
|
|
};
|
2015-06-02 13:29:12 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* arm_load_kernel - Loads memory with everything needed to boot
|
|
|
|
*
|
|
|
|
* @cpu: handle to the first CPU object
|
|
|
|
* @info: handle to the boot info struct
|
|
|
|
* Registers a machine init done notifier that copies to memory
|
|
|
|
* everything needed to boot, depending on machine and user options:
|
|
|
|
* kernel image, boot loaders, initrd, dtb. Also registers the CPU
|
|
|
|
* reset handler.
|
|
|
|
*
|
|
|
|
* In case the machine file supports the platform bus device and its
|
|
|
|
* dynamically instantiable sysbus devices, this function must be called
|
|
|
|
* before sysbus-fdt arm_register_platform_bus_fdt_creator. Indeed the
|
|
|
|
* machine init done notifiers are called in registration reverse order.
|
|
|
|
*/
|
2012-05-14 02:39:57 +02:00
|
|
|
void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info);
|
2007-11-17 18:14:51 +01:00
|
|
|
|
2008-08-30 11:51:20 +02:00
|
|
|
/* Multiplication factor to convert from system clock ticks to qemu timer
|
|
|
|
ticks. */
|
2008-09-17 21:04:14 +02:00
|
|
|
extern int system_clock_scale;
|
2007-11-17 18:14:51 +01:00
|
|
|
|
|
|
|
#endif /* !ARM_MISC_H */
|