quic/qbox
Loading...
Searching...
No Matches
underlying-dmi.h
1/*
2 * Copyright (c) 2025 Qualcomm Innovation Center, Inc. All Rights Reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef _LIBQBOX_TLM_EXTENSIONS_UNDERLYING_DMI_H
8#define _LIBQBOX_TLM_EXTENSIONS_UNDERLYING_DMI_H
9
10#include <tlm>
11namespace gs {
12
18class tlm_dmi_ex : public tlm::tlm_dmi
19{
20public:
21 enum dmi_type { dmi_mapped, dmi_nomap, dmi_valid, dmi_iommu } type;
22 sc_core::sc_module* module;
23 tlm_dmi_ex(sc_core::sc_module* m, tlm::tlm_dmi dmi, dmi_type t): module(m), tlm::tlm_dmi(dmi), type(t) {}
24};
25
32class UnderlyingDMITlmExtension : public tlm::tlm_extension<UnderlyingDMITlmExtension>,
33 public std::vector<gs::tlm_dmi_ex>
34{
35public:
36 UnderlyingDMITlmExtension() = default;
38
39 virtual tlm_extension_base* clone() const override { return new UnderlyingDMITlmExtension(*this); }
40
41 virtual void copy_from(tlm_extension_base const& ext) override
42 {
44 *this = other;
45 }
46 void add_dmi(sc_core::sc_module* m, tlm::tlm_dmi dmi, tlm_dmi_ex::dmi_type type)
47 {
48 tlm_dmi_ex d(m, dmi, type);
49 push_back(d);
50 }
51 bool has_dmi(tlm_dmi_ex::dmi_type type)
52 {
53 for (auto d = begin(); d != end(); d++) {
54 if (d->type == type) return true;
55 }
56 return false;
57 }
58 tlm::tlm_dmi& get_first(tlm_dmi_ex::dmi_type type)
59 {
60 for (auto d = begin(); d != end(); d++) {
61 if (d->type == type) return *d;
62 }
63 SCP_FATAL("UnderlyingDMITlmExtension")("No iommu DMI data found\n");
65 }
66 tlm::tlm_dmi& get_last(tlm_dmi_ex::dmi_type type)
67 {
68 for (auto d = rbegin(); d != rend(); d++) {
69 if (d->type == type) return *d;
70 }
71 SCP_FATAL("UnderlyingDMITlmExtension")("No iommu DMI data found\n");
73 }
74};
75
76} // namespace gs
77#endif
Definition target.h:160
Definition underlying-dmi.h:34
Definition underlying-dmi.h:19
Tool which reads a Lua configuration file and sets parameters.
Definition biflow.cc:10