Kristofer Jonsson | 3c6a260 | 2022-03-10 11:17:29 +0100 | [diff] [blame] | 1 | /* |
Kristofer Jonsson | d779a08 | 2023-01-04 17:09:47 +0100 | [diff] [blame] | 2 | * Copyright 2022-2023 Arm Limited and/or its affiliates |
Kristofer Jonsson | 3c6a260 | 2022-03-10 11:17:29 +0100 | [diff] [blame] | 3 | * |
| 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 Jonsson | 442fefb | 2022-03-17 17:15:52 +0100 | [diff] [blame] | 28 | #include "ethosu_mailbox.h" |
Kristofer Jonsson | 3c6a260 | 2022-03-10 11:17:29 +0100 | [diff] [blame] | 29 | |
Kristofer Jonsson | 3c6a260 | 2022-03-10 11:17:29 +0100 | [diff] [blame] | 30 | #include <linux/types.h> |
| 31 | #include <linux/completion.h> |
| 32 | |
| 33 | /**************************************************************************** |
| 34 | * Types |
| 35 | ****************************************************************************/ |
| 36 | |
Kristofer Jonsson | d779a08 | 2023-01-04 17:09:47 +0100 | [diff] [blame] | 37 | struct ethosu_core_msg_network_info_rsp; |
Kristofer Jonsson | 3c6a260 | 2022-03-10 11:17:29 +0100 | [diff] [blame] | 38 | struct ethosu_network; |
| 39 | struct ethosu_uapi_network_info; |
| 40 | |
| 41 | struct ethosu_network_info { |
Kristofer Jonsson | ec47704 | 2023-01-20 13:38:13 +0100 | [diff] [blame] | 42 | struct device *dev; |
Kristofer Jonsson | 3c6a260 | 2022-03-10 11:17:29 +0100 | [diff] [blame] | 43 | struct ethosu_network *net; |
| 44 | struct ethosu_uapi_network_info *uapi; |
Kristofer Jonsson | 3c6a260 | 2022-03-10 11:17:29 +0100 | [diff] [blame] | 45 | struct completion done; |
| 46 | int errno; |
Kristofer Jonsson | 442fefb | 2022-03-17 17:15:52 +0100 | [diff] [blame] | 47 | struct ethosu_mailbox_msg msg; |
Kristofer Jonsson | 3c6a260 | 2022-03-10 11:17:29 +0100 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | /**************************************************************************** |
| 51 | * Functions |
| 52 | ****************************************************************************/ |
| 53 | |
| 54 | /** |
Davide Grohmann | 32660f9 | 2022-04-27 16:49:07 +0200 | [diff] [blame] | 55 | * ethosu_network_info_request() - Send a network info request |
Kristofer Jonsson | 3c6a260 | 2022-03-10 11:17:29 +0100 | [diff] [blame] | 56 | * |
| 57 | * This function must be called in the context of a user space process. |
| 58 | * |
Davide Grohmann | 32660f9 | 2022-04-27 16:49:07 +0200 | [diff] [blame] | 59 | * Return: 0 on success, . |
Kristofer Jonsson | 3c6a260 | 2022-03-10 11:17:29 +0100 | [diff] [blame] | 60 | */ |
Kristofer Jonsson | ec47704 | 2023-01-20 13:38:13 +0100 | [diff] [blame] | 61 | int ethosu_network_info_request(struct device *dev, |
| 62 | struct ethosu_mailbox *mailbox, |
| 63 | struct ethosu_network *net, |
Davide Grohmann | 32660f9 | 2022-04-27 16:49:07 +0200 | [diff] [blame] | 64 | struct ethosu_uapi_network_info *uapi); |
Kristofer Jonsson | 3c6a260 | 2022-03-10 11:17:29 +0100 | [diff] [blame] | 65 | |
| 66 | /** |
| 67 | * ethosu_network_info_rsp() - Handle network info response. |
| 68 | */ |
Kristofer Jonsson | ec47704 | 2023-01-20 13:38:13 +0100 | [diff] [blame] | 69 | void ethosu_network_info_rsp(struct ethosu_mailbox *mailbox, |
Kristofer Jonsson | d779a08 | 2023-01-04 17:09:47 +0100 | [diff] [blame] | 70 | int msg_id, |
| 71 | struct ethosu_core_msg_network_info_rsp *rsp); |
Kristofer Jonsson | 3c6a260 | 2022-03-10 11:17:29 +0100 | [diff] [blame] | 72 | |
| 73 | #endif /* ETHOSU_NETWORK_INFO_H */ |