diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2017-08-08 13:53:25 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-09-12 16:00:19 -0400 |
commit | 89772b03cb093b3556dd4803e5a8deee60046ac9 (patch) | |
tree | c609de388b57161e9bb58ff21ef5aaf7ab663a5e /drivers/gpu/nvgpu/include | |
parent | b610bb95108afe54895219e06859cf241fabc9db (diff) |
gpu: nvgpu: Move XVE debugfs code to Linux module
Move XVE debugfs initialization code to live under common/linux.
JIRA NVGPU-62
Change-Id: Ic6677511d249bc0a2455dde01db5b230afc70bb1
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1535133
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/xve.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/xve.h b/drivers/gpu/nvgpu/include/nvgpu/xve.h new file mode 100644 index 00000000..ee599300 --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/xve.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | */ | ||
13 | #ifndef __NVGPU_XVE_H__ | ||
14 | #define __NVGPU_XVE_H__ | ||
15 | |||
16 | #include <nvgpu/types.h> | ||
17 | #include <nvgpu/log2.h> | ||
18 | |||
19 | /* | ||
20 | * For the available speeds bitmap. | ||
21 | */ | ||
22 | #define GPU_XVE_SPEED_2P5 (1 << 0) | ||
23 | #define GPU_XVE_SPEED_5P0 (1 << 1) | ||
24 | #define GPU_XVE_SPEED_8P0 (1 << 2) | ||
25 | #define GPU_XVE_NR_SPEEDS 3 | ||
26 | |||
27 | #define GPU_XVE_SPEED_MASK (GPU_XVE_SPEED_2P5 | \ | ||
28 | GPU_XVE_SPEED_5P0 | \ | ||
29 | GPU_XVE_SPEED_8P0) | ||
30 | |||
31 | /* | ||
32 | * The HW uses a 2 bit field where speed is defined by a number: | ||
33 | * | ||
34 | * NV_XVE_LINK_CONTROL_STATUS_LINK_SPEED_2P5 = 1 | ||
35 | * NV_XVE_LINK_CONTROL_STATUS_LINK_SPEED_5P0 = 2 | ||
36 | * NV_XVE_LINK_CONTROL_STATUS_LINK_SPEED_8P0 = 3 | ||
37 | * | ||
38 | * This isn't ideal for a bitmap with available speeds. So the external | ||
39 | * APIs think about speeds as a bit in a bitmap and this function converts | ||
40 | * from those bits to the actual HW speed setting. | ||
41 | * | ||
42 | * @speed_bit must have only 1 bit set and must be one of the 3 available | ||
43 | * HW speeds. Not all chips support all speeds so use available_speeds() to | ||
44 | * determine what a given chip supports. | ||
45 | */ | ||
46 | static inline const char *xve_speed_to_str(u32 speed) | ||
47 | { | ||
48 | if (!speed || !is_power_of_2(speed) || | ||
49 | !(speed & GPU_XVE_SPEED_MASK)) | ||
50 | return "Unknown ???"; | ||
51 | |||
52 | return speed & GPU_XVE_SPEED_2P5 ? "Gen1" : | ||
53 | speed & GPU_XVE_SPEED_5P0 ? "Gen2" : | ||
54 | speed & GPU_XVE_SPEED_8P0 ? "Gen3" : | ||
55 | "Unknown ???"; | ||
56 | } | ||
57 | |||
58 | #endif | ||