blob: 8c2e659f6ea394dce0448fed37c2ae41f6cbbcde [file] [log] [blame]
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +01001/*
Kristofer Jonssond779a082023-01-04 17:09:47 +01002 * Copyright 2022-2023 Arm Limited and/or its affiliates
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +01003 *
4 * This program is free software and is provided to you under the terms of the
5 * GNU General Public License version 2 as published by the Free Software
6 * Foundation, and any use by you of this program is subject to the terms
7 * of such GNU licence.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, you can access it online at
16 * http://www.gnu.org/licenses/gpl-2.0.html.
17 *
18 * SPDX-License-Identifier: GPL-2.0-only
19 */
20
21#ifndef ETHOSU_NETWORK_INFO_H
22#define ETHOSU_NETWORK_INFO_H
23
24/****************************************************************************
25 * Includes
26 ****************************************************************************/
27
Kristofer Jonsson442fefb2022-03-17 17:15:52 +010028#include "ethosu_mailbox.h"
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010029
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010030#include <linux/types.h>
31#include <linux/completion.h>
32
33/****************************************************************************
34 * Types
35 ****************************************************************************/
36
Kristofer Jonssond779a082023-01-04 17:09:47 +010037struct ethosu_core_msg_network_info_rsp;
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010038struct ethosu_network;
39struct ethosu_uapi_network_info;
40
41struct ethosu_network_info {
Kristofer Jonssonec477042023-01-20 13:38:13 +010042 struct device *dev;
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010043 struct ethosu_network *net;
44 struct ethosu_uapi_network_info *uapi;
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010045 struct completion done;
46 int errno;
Kristofer Jonsson442fefb2022-03-17 17:15:52 +010047 struct ethosu_mailbox_msg msg;
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010048};
49
50/****************************************************************************
51 * Functions
52 ****************************************************************************/
53
54/**
Davide Grohmann32660f92022-04-27 16:49:07 +020055 * ethosu_network_info_request() - Send a network info request
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010056 *
57 * This function must be called in the context of a user space process.
58 *
Davide Grohmann32660f92022-04-27 16:49:07 +020059 * Return: 0 on success, .
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010060 */
Kristofer Jonssonec477042023-01-20 13:38:13 +010061int ethosu_network_info_request(struct device *dev,
62 struct ethosu_mailbox *mailbox,
63 struct ethosu_network *net,
Davide Grohmann32660f92022-04-27 16:49:07 +020064 struct ethosu_uapi_network_info *uapi);
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010065
66/**
67 * ethosu_network_info_rsp() - Handle network info response.
68 */
Kristofer Jonssonec477042023-01-20 13:38:13 +010069void ethosu_network_info_rsp(struct ethosu_mailbox *mailbox,
Kristofer Jonssond779a082023-01-04 17:09:47 +010070 int msg_id,
71 struct ethosu_core_msg_network_info_rsp *rsp);
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010072
73#endif /* ETHOSU_NETWORK_INFO_H */