1/**
2 * \file acpi_generic.c
3 * \brief
4 */
5
6
7/*
8 * Copyright (c) 2017 ETH Zurich.
9 * All rights reserved.
10 *
11 * This file is distributed under the terms in the attached LICENSE file.
12 * If you do not find this file, copies can be found by writing to:
13 * ETH Zurich D-INFK, Universitaetsstrasse 6, CH-8092 Zurich. Attn: Systems Group.
14 */
15
16#include <barrelfish/barrelfish.h>
17#include <barrelfish/capabilities.h>
18#include <if/monitor_blocking_defs.h>
19
20#include "acpi_debug.h"
21#include "acpi_shared.h"
22#include "acpi_allocators.h"
23
24errval_t acpi_allocators_init_arch(struct bootinfo *bootinfo)
25{
26    errval_t err;
27
28    struct monitor_blocking_binding *cl = get_monitor_blocking_binding();
29    assert(cl != NULL);
30
31    // Request I/O Cap
32    struct capref requested_caps;
33    errval_t error_code;
34    err = slot_alloc(&requested_caps);
35    if (err_is_fail(err)) {
36        USER_PANIC_ERR(err, "slot_alloc for monitor->get_io_cap");
37    }
38    err = cl->rpc_tx_vtbl.get_io_cap(cl, &requested_caps, &error_code);
39    assert(err_is_ok(err) && err_is_ok(error_code));
40    // Copy into correct slot
41    struct capref caps_io = {
42        .cnode = cnode_task,
43        .slot  = TASKCN_SLOT_IO
44    };
45    return cap_copy(caps_io, requested_caps);
46}
47