1// Copyright 2018 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#pragma once
6
7#include <threads.h>
8#include <zircon/types.h>
9
10__BEGIN_CDECLS;
11// Initializes the iommu_manager using the ACPI DMAR table. If this fails,
12// the IOMMU manager will be left in a well-defined empty state, and
13// iommu_manager_iommu_for_bdf() can still succeed (yielding dummy IOMMU
14// handles).
15zx_status_t iommu_manager_init(void);
16
17// Returns a handle to the IOMMU that is responsible for the given BDF. The
18// returned handle is borrowed from the iommu_manager.  The caller
19// must not close the handle.
20zx_status_t iommu_manager_iommu_for_bdf(uint32_t bdf, zx_handle_t* iommu);
21
22// Returns a handle to the dummy IOMMU. The returned handle is BORROWED from
23// the iommu_manager.
24zx_status_t iommu_manager_get_dummy_iommu(zx_handle_t* iommu);
25
26__END_CDECLS;
27