1/*
2 * Copyright (c) 2014, ETH Zurich. All rights reserved.
3 *
4 * This file is distributed under the terms in the attached LICENSE file.
5 * If you do not find this file, copies can be found by writing to:
6 * ETH Zurich D-INFK, Universitaetsstrasse 6, CH-8092 Zurich. Attn: Systems Group.
7 */
8
9#include <barrelfish/barrelfish.h>
10
11#include <ioat/ioat_dma_internal.h>
12#include <ioat/ioat_dma_dca_internal.h>
13
14#include <debug.h>
15
16/*
17 * ===========================================================================
18 * Library Internal Interface
19 * ===========================================================================
20 */
21
22static uint8_t dca_do_initialization = 0;
23
24/**
25 * \brief sets the do initialization flag
26 */
27void ioat_set_dca_enabled(void)
28{
29    IOATDCA_DEBUG("enabling DCA initialization\n");
30    dca_do_initialization = 1;
31}
32
33/*
34 * ===========================================================================
35 * Public Interface
36 * ===========================================================================
37 */
38
39/*
40 * ----------------------------------------------------------------------------
41 *  Enabling / Disabling DCA
42 * ----------------------------------------------------------------------------
43 */
44
45/**
46 * \brief enables direct cache access
47 */
48errval_t ioat_dma_dca_enable(void)
49{
50    if (!dca_do_initialization) {
51        return SYS_ERR_OK;
52    }
53    assert(!"NYI");
54    return SYS_ERR_OK;
55}
56
57/**
58 * \brief disables direct cache access
59 */
60errval_t ioat_dma_dca_disable(void)
61{
62    assert(!"NYI");
63    return SYS_ERR_OK;
64}
65
66/**
67 * \brief checks whether DCA is enabled
68 *
69 * \returns 1 if DCA is enabled
70 *          0 if DCA is disabled
71 */
72uint8_t ioat_dma_dca_is_enabled(void)
73{
74    return dca_do_initialization;
75}
76