Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / include / hw / ppc / vof.h
blobd3f293da8b7637e79506db3faf151bd50465e90e
1 /*
2 * Virtual Open Firmware
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 #ifndef HW_VOF_H
7 #define HW_VOF_H
9 #include "qom/object.h"
10 #include "exec/address-spaces.h"
11 #include "exec/memory.h"
12 #include "exec/cpu-defs.h"
14 typedef struct Vof {
15 uint64_t top_addr; /* copied from rma_size */
16 GArray *claimed; /* array of SpaprOfClaimed */
17 uint64_t claimed_base;
18 GHashTable *of_instances; /* ihandle -> SpaprOfInstance */
19 uint32_t of_instance_last;
20 char *bootargs;
21 long fw_size;
22 } Vof;
24 int vof_client_call(MachineState *ms, Vof *vof, void *fdt,
25 target_ulong args_real);
26 uint64_t vof_claim(Vof *vof, uint64_t virt, uint64_t size, uint64_t align);
27 void vof_init(Vof *vof, uint64_t top_addr, Error **errp);
28 void vof_cleanup(Vof *vof);
29 void vof_build_dt(void *fdt, Vof *vof);
30 uint32_t vof_client_open_store(void *fdt, Vof *vof, const char *nodename,
31 const char *prop, const char *path);
33 #define TYPE_VOF_MACHINE_IF "vof-machine-if"
35 typedef struct VofMachineIfClass VofMachineIfClass;
36 DECLARE_CLASS_CHECKERS(VofMachineIfClass, VOF_MACHINE, TYPE_VOF_MACHINE_IF)
38 struct VofMachineIfClass {
39 InterfaceClass parent;
40 target_ulong (*client_architecture_support)(MachineState *ms, CPUState *cs,
41 target_ulong vec);
42 void (*quiesce)(MachineState *ms);
43 bool (*setprop)(MachineState *ms, const char *path, const char *propname,
44 void *val, int vallen);
48 * Initial stack size is from
49 * https://www.devicetree.org/open-firmware/bindings/ppc/release/ppc-2_1.html#REF27292
51 * "Client programs shall be invoked with a valid stack pointer (r1) with
52 * at least 32K bytes of memory available for stack growth".
54 #define VOF_STACK_SIZE 0x8000
56 #define VOF_MEM_READ(pa, buf, size) \
57 address_space_read(&address_space_memory, \
58 (pa), MEMTXATTRS_UNSPECIFIED, (buf), (size))
59 #define VOF_MEM_WRITE(pa, buf, size) \
60 address_space_write(&address_space_memory, \
61 (pa), MEMTXATTRS_UNSPECIFIED, (buf), (size))
63 #define PROM_ERROR (~0U)
65 #endif /* HW_VOF_H */