1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2020-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: MIT
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 #ifndef _SMBPBI_NVSWITCH_H_
25 #define _SMBPBI_NVSWITCH_H_
26 
27 #include "soe/soeifsmbpbi.h"
28 #include "smbpbi_shared_nvswitch.h"
29 #include "oob/smbpbi_priv.h"
30 
31 typedef struct
32 {
33     NvBool isValid;
34     NvU64  attemptedTrainingMask0;
35     NvU64  trainingErrorMask0;
36 } NVSWITCH_LINK_TRAINING_ERROR_INFO;
37 
38 typedef struct
39 {
40     NvBool isValid;
41     NvU64  mask0;
42 } NVSWITCH_LINK_RUNTIME_ERROR_INFO;
43 
44 struct smbpbi
45 {
46     SOE_SMBPBI_SHARED_SURFACE       *sharedSurface;
47     NvU64                           dmaHandle;
48     NvU32                           logMessageNesting;
49 };
50 
51 NvlStatus nvswitch_smbpbi_init(nvswitch_device *);
52 NvlStatus nvswitch_smbpbi_post_init(nvswitch_device *);
53 NvlStatus nvswitch_smbpbi_set_link_error_info(nvswitch_device *,
54                                               NVSWITCH_LINK_TRAINING_ERROR_INFO *pLinkTrainingErrorInfo,
55                                               NVSWITCH_LINK_RUNTIME_ERROR_INFO  *pLinkRuntimeError);
56 void nvswitch_smbpbi_unload(nvswitch_device *);
57 void nvswitch_smbpbi_destroy(nvswitch_device *);
58 NvlStatus nvswitch_smbpbi_refresh_ecc_counts(nvswitch_device *);
59 
60 #endif //_SMBPBI_NVSWITCH_H_
61