hw/timer/sse-timer: Model the SSE Subsystem System Timer
[qemu/ar7.git] / target / arm / arm-powerctl.h
blob37c8a04f0a9c14fcc58daade7bcad65402f6139a
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
20 #define QEMU_ARM_POWERCTL_ON_PENDING QEMU_PSCI_RET_ON_PENDING
23 * arm_get_cpu_by_id:
24 * @cpuid: the id of the CPU we want to retrieve the state
26 * Retrieve a CPUState object from its CPU ID provided in @cpuid.
28 * Returns: a pointer to the CPUState structure of the requested CPU.
30 CPUState *arm_get_cpu_by_id(uint64_t cpuid);
33 * arm_set_cpu_on:
34 * @cpuid: the id of the CPU we want to start/wake up.
35 * @entry: the address the CPU shall start from.
36 * @context_id: the value to put in r0/x0.
37 * @target_el: The desired exception level.
38 * @target_aa64: 1 if the requested mode is AArch64. 0 otherwise.
40 * Start the cpu designated by @cpuid in @target_el exception level. The mode
41 * shall be AArch64 if @target_aa64 is set to 1. Otherwise the mode is
42 * AArch32. The CPU shall start at @entry with @context_id in r0/x0.
44 * Returns: QEMU_ARM_POWERCTL_RET_SUCCESS on success.
45 * QEMU_ARM_POWERCTL_INVALID_PARAM if bad parameters are provided.
46 * QEMU_ARM_POWERCTL_ALREADY_ON if the CPU was already started.
47 * QEMU_ARM_POWERCTL_ON_PENDING if the CPU is still powering up
49 int arm_set_cpu_on(uint64_t cpuid, uint64_t entry, uint64_t context_id,
50 uint32_t target_el, bool target_aa64);
53 * arm_set_cpu_off:
54 * @cpuid: the id of the CPU we want to stop/shut down.
56 * Stop the cpu designated by @cpuid.
58 * Returns: QEMU_ARM_POWERCTL_RET_SUCCESS on success.
59 * QEMU_ARM_POWERCTL_INVALID_PARAM if bad parameters are provided.
60 * QEMU_ARM_POWERCTL_IS_OFF if CPU is already off
63 int arm_set_cpu_off(uint64_t cpuid);
66 * arm_reset_cpu:
67 * @cpuid: the id of the CPU we want to reset.
69 * Reset the cpu designated by @cpuid.
71 * Returns: QEMU_ARM_POWERCTL_RET_SUCCESS on success.
72 * QEMU_ARM_POWERCTL_INVALID_PARAM if bad parameters are provided.
73 * QEMU_ARM_POWERCTL_IS_OFF if CPU is off
75 int arm_reset_cpu(uint64_t cpuid);
78 * arm_set_cpu_on_and_reset:
79 * @cpuid: the id of the CPU we want to star
81 * Start the cpu designated by @cpuid and put it through its normal
82 * CPU reset process. The CPU will start in the way it is architected
83 * to start after a power-on reset.
85 * Returns: QEMU_ARM_POWERCTL_RET_SUCCESS on success.
86 * QEMU_ARM_POWERCTL_INVALID_PARAM if there is no CPU with that ID.
87 * QEMU_ARM_POWERCTL_ALREADY_ON if the CPU is already on.
88 * QEMU_ARM_POWERCTL_ON_PENDING if the CPU is already partway through
89 * powering on.
91 int arm_set_cpu_on_and_reset(uint64_t cpuid);
93 #endif