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#include <sel4vm/guest_vm.h>
10
11#include <sel4vmmplatsupport/arch/ac_device.h>
12#include <sel4vmmplatsupport/device.h>
13
14/**
15 * Clock Access control device
16 */
17struct clock_device;
18
19/**
20 * Install a CLOCK access control
21 * @param[in] vm         The VM to install the device into
22 * @param[in] default_ac The default access control state to apply
23 * @param[in] action     Action to take when access is violated
24 * @return               A handle to the GPIO Access control device, NULL on
25 *                       failure
26 */
27struct clock_device *vm_install_ac_clock(vm_t *vm, enum vacdev_default default_ac,
28                                         enum vacdev_action action);
29
30/**
31 * Provide clock access to the VM
32 * @param[in] clock_device  A handle to the clock Access Control device
33 * @param[in] clk_id        The ID of the clock to provide access to
34 * @return                  0 on success
35 */
36int vm_clock_provide(struct clock_device *clock_device, enum clk_id clk_id);
37
38/**
39 * Deny clock access to the VM
40 * @param[in] clock_device  A handle to the clock Access Control device
41 * @param[in] clk_id        The ID of the clock to deny access to
42 * @return                  0 on success
43 */
44int vm_clock_restrict(struct clock_device *clock_device, enum clk_id clk_id);
45