blob: aaa373339704a0fee3e082ea1bb96dd5259b5772 [file] [log] [blame]
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +01001/*
Mikael Olssond4ad9e52024-02-07 11:22:26 +01002 * SPDX-FileCopyrightText: Copyright 2022-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
3 * SPDX-License-Identifier: GPL-2.0-only
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +01004 *
5 * This program is free software and is provided to you under the terms of the
6 * GNU General Public License version 2 as published by the Free Software
7 * Foundation, and any use by you of this program is subject to the terms
8 * of such GNU licence.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, you can access it online at
17 * http://www.gnu.org/licenses/gpl-2.0.html.
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010018 */
19
20#ifndef ETHOSU_NETWORK_INFO_H
21#define ETHOSU_NETWORK_INFO_H
22
23/****************************************************************************
24 * Includes
25 ****************************************************************************/
26
Mikael Olssond4ad9e52024-02-07 11:22:26 +010027#include <rpmsg/ethosu_rpmsg_mailbox.h>
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010028
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010029#include <linux/types.h>
30#include <linux/completion.h>
31
32/****************************************************************************
33 * Types
34 ****************************************************************************/
35
Kristofer Jonssond779a082023-01-04 17:09:47 +010036struct ethosu_core_msg_network_info_rsp;
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010037struct ethosu_network;
38struct ethosu_uapi_network_info;
39
40struct ethosu_network_info {
Kristofer Jonssonec477042023-01-20 13:38:13 +010041 struct device *dev;
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010042 struct ethosu_network *net;
43 struct ethosu_uapi_network_info *uapi;
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010044 struct completion done;
45 int errno;
Kristofer Jonsson442fefb2022-03-17 17:15:52 +010046 struct ethosu_mailbox_msg msg;
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010047};
48
49/****************************************************************************
50 * Functions
51 ****************************************************************************/
52
53/**
Davide Grohmann32660f92022-04-27 16:49:07 +020054 * ethosu_network_info_request() - Send a network info request
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010055 *
56 * This function must be called in the context of a user space process.
57 *
Davide Grohmann32660f92022-04-27 16:49:07 +020058 * Return: 0 on success, .
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010059 */
Kristofer Jonssonec477042023-01-20 13:38:13 +010060int ethosu_network_info_request(struct device *dev,
61 struct ethosu_mailbox *mailbox,
62 struct ethosu_network *net,
Davide Grohmann32660f92022-04-27 16:49:07 +020063 struct ethosu_uapi_network_info *uapi);
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010064
65/**
66 * ethosu_network_info_rsp() - Handle network info response.
67 */
Kristofer Jonssonec477042023-01-20 13:38:13 +010068void ethosu_network_info_rsp(struct ethosu_mailbox *mailbox,
Kristofer Jonssond779a082023-01-04 17:09:47 +010069 int msg_id,
70 struct ethosu_core_msg_network_info_rsp *rsp);
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +010071
72#endif /* ETHOSU_NETWORK_INFO_H */