blob: 5b9a7ed9d05c5d63ee1ea4b5cd333286b29d3516 [file] [log] [blame]
Mikael Olsson7da66192021-02-12 17:30:22 +01001/*
Mikael Olsson3288b462022-08-15 17:12:58 +02002 * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
Mikael Olsson7da66192021-02-12 17:30:22 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef FCONF_ETHOSN_GETTER_H
8#define FCONF_ETHOSN_GETTER_H
9
10#include <assert.h>
Mikael Olsson3288b462022-08-15 17:12:58 +020011#include <stdbool.h>
Mikael Olsson7da66192021-02-12 17:30:22 +010012
13#include <lib/fconf/fconf.h>
14
15#define hw_config__ethosn_config_getter(prop) ethosn_config.prop
Mikael Olsson3288b462022-08-15 17:12:58 +020016#define hw_config__ethosn_device_getter(dev_idx) __extension__ ({ \
17 assert(dev_idx < ethosn_config.num_devices); \
18 &ethosn_config.devices[dev_idx]; \
Mikael Olsson7da66192021-02-12 17:30:22 +010019})
20
Mikael Olsson3288b462022-08-15 17:12:58 +020021#define ETHOSN_DEV_NUM_MAX U(2)
22#define ETHOSN_DEV_CORE_NUM_MAX U(8)
23#define ETHOSN_DEV_ASSET_ALLOCATOR_NUM_MAX U(16)
Mikael Olsson7da66192021-02-12 17:30:22 +010024
Mikael Olsson3288b462022-08-15 17:12:58 +020025struct ethosn_allocator_t {
26 uint32_t stream_id;
27};
28
29struct ethosn_main_allocator_t {
30 struct ethosn_allocator_t firmware;
31 struct ethosn_allocator_t working_data;
32};
33
34struct ethosn_asset_allocator_t {
35 struct ethosn_allocator_t command_stream;
36 struct ethosn_allocator_t weight_data;
37 struct ethosn_allocator_t buffer_data;
38 struct ethosn_allocator_t intermediate_data;
39};
Mikael Olsson7da66192021-02-12 17:30:22 +010040
Laurent Carlier5205df22021-09-16 15:10:35 +010041struct ethosn_core_t {
42 uint64_t addr;
Mikael Olsson3288b462022-08-15 17:12:58 +020043 struct ethosn_main_allocator_t main_allocator;
Laurent Carlier5205df22021-09-16 15:10:35 +010044};
45
Mikael Olsson3288b462022-08-15 17:12:58 +020046struct ethosn_device_t {
47 bool has_reserved_memory;
Mikael Olsson7da66192021-02-12 17:30:22 +010048 uint32_t num_cores;
Mikael Olsson3288b462022-08-15 17:12:58 +020049 struct ethosn_core_t cores[ETHOSN_DEV_CORE_NUM_MAX];
50 uint32_t num_allocators;
51 struct ethosn_asset_allocator_t asset_allocators[ETHOSN_DEV_ASSET_ALLOCATOR_NUM_MAX];
52};
53
54struct ethosn_config_t {
55 uint32_t num_devices;
56 struct ethosn_device_t devices[ETHOSN_DEV_NUM_MAX];
Mikael Olsson7da66192021-02-12 17:30:22 +010057};
58
59int fconf_populate_arm_ethosn(uintptr_t config);
60
61extern struct ethosn_config_t ethosn_config;
62
63#endif /* FCONF_ETHOSN_GETTER_H */