aboutsummaryrefslogtreecommitdiff
path: root/driver_library/src/ethosu.cpp
diff options
context:
space:
mode:
authorMikael Olsson <mikael.olsson@arm.com>2024-02-16 11:04:46 +0100
committerMikael Olsson <mikael.olsson@arm.com>2024-02-19 13:27:51 +0100
commitdc18ceaa54957d5ac05292b363a5ac6fe479f409 (patch)
treeb7fae5e1448ef4436e78c0c838f4a07e59ce3039 /driver_library/src/ethosu.cpp
parent16be28550f0906e2bfff20b94dd373f59b4a2ccf (diff)
downloadethos-u-linux-driver-stack-dc18ceaa54957d5ac05292b363a5ac6fe479f409.tar.gz
Add NPU device type to capabilities
In preparation to support the Linux kernel driver directly managing the NPU without a subsystem. A NPU device type has been added to the capabilities to be able to specify what kind of NPU is used. Change-Id: I45345b7d75d234f821d70b858453d3af2a99194e Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Diffstat (limited to 'driver_library/src/ethosu.cpp')
-rw-r--r--driver_library/src/ethosu.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/driver_library/src/ethosu.cpp b/driver_library/src/ethosu.cpp
index a4feef1..0166f0a 100644
--- a/driver_library/src/ethosu.cpp
+++ b/driver_library/src/ethosu.cpp
@@ -1,5 +1,5 @@
/*
- * SPDX-FileCopyrightText: Copyright 2020-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
+ * SPDX-FileCopyrightText: Copyright 2020-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
@@ -269,11 +269,25 @@ Capabilities Device::capabilities() const {
SemanticVersion(uapi.hw_id.version_major, uapi.hw_id.version_minor),
SemanticVersion(uapi.hw_id.product_major),
SemanticVersion(uapi.hw_id.arch_major_rev, uapi.hw_id.arch_minor_rev, uapi.hw_id.arch_patch_rev)),
- HardwareConfiguration(uapi.hw_cfg.macs_per_cc, uapi.hw_cfg.cmd_stream_version, bool(uapi.hw_cfg.custom_dma)),
+ HardwareConfiguration(
+ uapi.hw_cfg.macs_per_cc, uapi.hw_cfg.cmd_stream_version, uapi.hw_cfg.type, bool(uapi.hw_cfg.custom_dma)),
SemanticVersion(uapi.driver_major_rev, uapi.driver_minor_rev, uapi.driver_patch_rev));
return capabilities;
}
+ostream &operator<<(ostream &out, const HardwareConfiguration::DeviceType &deviceType) {
+ switch (deviceType) {
+ case HardwareConfiguration::DeviceType::UNKNOWN:
+ return out << "unknown";
+ case HardwareConfiguration::DeviceType::SUBSYSTEM:
+ return out << "subsystem";
+ case HardwareConfiguration::DeviceType::DIRECT:
+ return out << "direct";
+ default:
+ throw Exception(string("Invalid device type: ").append(to_string(static_cast<uint32_t>(deviceType))).c_str());
+ }
+}
+
/****************************************************************************
* Buffer
****************************************************************************/