1/*
2 * Copyright 2019, Data61, CSIRO (ABN 41 687 119 230)
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#pragma once
8
9/***
10 * @module device_utils.h
11 * The device utils interface provides various helpers to establish different types devices for a given VM
12 * instance.
13 */
14
15#include <sel4vm/guest_vm.h>
16#include <sel4vmmplatsupport/device.h>
17
18/***
19 * @function vm_install_passthrough_device(vm, device)
20 * Install a passthrough device into a VM
21 * @param {vm_t *} vm                       A handle to the VM that the device should be install to
22 * @param {const struct device *} device    A description of the device
23 * @return                                  0 on success, -1 for error
24 */
25int vm_install_passthrough_device(vm_t *vm, const struct device *device);
26
27/***
28 * @function vm_install_ram_only_device(vm, device)
29 * Install a device backed by ram into a VM
30 * @param {vm_t *} vm                       A handle to the VM that the device should be install to
31 * @param {const struct device *} device    A description of the device
32 * @return                                  0 on success, -1 for error
33 */
34int vm_install_ram_only_device(vm_t *vm, const struct device *device);
35
36/***
37 * @function vm_install_listening_device(vm, device)
38 * Install a passthrough device into a VM, but trap and print all access
39 * @param {vm_t *} vm                       A handle to the VM that the device should be install to
40 * @param {const struct device *} device    A description of the device
41 * @return                                  0 on success, -1 for error
42 */
43int vm_install_listening_device(vm_t *vm, const struct device *device);
44