loader: fix potential memory leak
[qemu.git] / target-arm / arm-powerctl.h
blob98ee04989ba77aff2840424e6f09e0472b1c0401
1 /*
2 * QEMU support -- ARM Power Control specific functions.
4 * Copyright (c) 2016 Jean-Christophe Dubois
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
9 */
11 #ifndef QEMU_ARM_POWERCTL_H
12 #define QEMU_ARM_POWERCTL_H
14 #include "kvm-consts.h"
16 #define QEMU_ARM_POWERCTL_RET_SUCCESS QEMU_PSCI_RET_SUCCESS
17 #define QEMU_ARM_POWERCTL_INVALID_PARAM QEMU_PSCI_RET_INVALID_PARAMS
18 #define QEMU_ARM_POWERCTL_ALREADY_ON QEMU_PSCI_RET_ALREADY_ON
19 #define QEMU_ARM_POWERCTL_IS_OFF QEMU_PSCI_RET_DENIED
22 * arm_get_cpu_by_id:
23 * @cpuid: the id of the CPU we want to retrieve the state
25 * Retrieve a CPUState object from its CPU ID provided in @cpuid.
27 * Returns: a pointer to the CPUState structure of the requested CPU.
29 CPUState *arm_get_cpu_by_id(uint64_t cpuid);
32 * arm_set_cpu_on:
33 * @cpuid: the id of the CPU we want to start/wake up.
34 * @entry: the address the CPU shall start from.
35 * @context_id: the value to put in r0/x0.
36 * @target_el: The desired exception level.
37 * @target_aa64: 1 if the requested mode is AArch64. 0 otherwise.
39 * Start the cpu designated by @cpuid in @target_el exception level. The mode
40 * shall be AArch64 if @target_aa64 is set to 1. Otherwise the mode is
41 * AArch32. The CPU shall start at @entry with @context_id in r0/x0.
43 * Returns: QEMU_ARM_POWERCTL_RET_SUCCESS on success.
44 * QEMU_ARM_POWERCTL_INVALID_PARAM if bad parameters are provided.
45 * QEMU_ARM_POWERCTL_ALREADY_ON if the CPU was already started.
47 int arm_set_cpu_on(uint64_t cpuid, uint64_t entry, uint64_t context_id,
48 uint32_t target_el, bool target_aa64);
51 * arm_set_cpu_off:
52 * @cpuid: the id of the CPU we want to stop/shut down.
54 * Stop the cpu designated by @cpuid.
56 * Returns: QEMU_ARM_POWERCTL_RET_SUCCESS on success.
57 * QEMU_ARM_POWERCTL_INVALID_PARAM if bad parameters are provided.
58 * QEMU_ARM_POWERCTL_IS_OFF if CPU is already off
61 int arm_set_cpu_off(uint64_t cpuid);
64 * arm_reset_cpu:
65 * @cpuid: the id of the CPU we want to reset.
67 * Reset the cpu designated by @cpuid.
69 * Returns: QEMU_ARM_POWERCTL_RET_SUCCESS on success.
70 * QEMU_ARM_POWERCTL_INVALID_PARAM if bad parameters are provided.
71 * QEMU_ARM_POWERCTL_IS_OFF if CPU is off
73 int arm_reset_cpu(uint64_t cpuid);
75 #endif