blob: d45c269c7a0d2d141fe45522f38240083e564d5a [file] [log] [blame]
Mikael Olsson7da66192021-02-12 17:30:22 +01001/*
Mikael Olssonc4f16ef2023-02-10 11:39:40 +01002 * Copyright (c) 2021-2023, 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 Olssonc4f16ef2023-02-10 11:39:40 +010048 uint64_t reserved_memory_addr;
Mikael Olsson7da66192021-02-12 17:30:22 +010049 uint32_t num_cores;
Mikael Olsson3288b462022-08-15 17:12:58 +020050 struct ethosn_core_t cores[ETHOSN_DEV_CORE_NUM_MAX];
51 uint32_t num_allocators;
52 struct ethosn_asset_allocator_t asset_allocators[ETHOSN_DEV_ASSET_ALLOCATOR_NUM_MAX];
53};
54
55struct ethosn_config_t {
56 uint32_t num_devices;
57 struct ethosn_device_t devices[ETHOSN_DEV_NUM_MAX];
Mikael Olsson7da66192021-02-12 17:30:22 +010058};
59
Mikael Olsson7da66192021-02-12 17:30:22 +010060extern struct ethosn_config_t ethosn_config;
61
62#endif /* FCONF_ETHOSN_GETTER_H */