diff options
| author | Joshua Bakita <bakitajoshua@gmail.com> | 2023-06-28 18:24:25 -0400 |
|---|---|---|
| committer | Joshua Bakita <bakitajoshua@gmail.com> | 2023-06-28 18:24:25 -0400 |
| commit | 01e6fac4d61fdd7fff5433942ec93fc2ea1e4df1 (patch) | |
| tree | 4ef34501728a087be24f4ba0af90f91486bf780b /include/os/linux/debug_bios.c | |
| parent | 306a03d18b305e4e573be3b2931978fa10679eb9 (diff) | |
Include nvgpu headers
These are needed to build on NVIDIA's Jetson boards for the time
being. Only a couple structs are required, so it should be fairly
easy to remove this dependency at some point in the future.
Diffstat (limited to 'include/os/linux/debug_bios.c')
| -rw-r--r-- | include/os/linux/debug_bios.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/include/os/linux/debug_bios.c b/include/os/linux/debug_bios.c new file mode 100644 index 0000000..f69ccf3 --- /dev/null +++ b/include/os/linux/debug_bios.c | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2018 NVIDIA Corporation. All rights reserved. | ||
| 3 | * | ||
| 4 | * This software is licensed under the terms of the GNU General Public | ||
| 5 | * License version 2, as published by the Free Software Foundation, and | ||
| 6 | * may be copied, distributed, and modified under those terms. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | |||
| 15 | #include <nvgpu/types.h> | ||
| 16 | |||
| 17 | #include "debug_bios.h" | ||
| 18 | #include "os_linux.h" | ||
| 19 | |||
| 20 | #include <linux/debugfs.h> | ||
| 21 | #include <linux/uaccess.h> | ||
| 22 | |||
| 23 | static int bios_version_show(struct seq_file *s, void *unused) | ||
| 24 | { | ||
| 25 | struct gk20a *g = s->private; | ||
| 26 | |||
| 27 | seq_printf(s, "Version %02x.%02x.%02x.%02x.%02x\n", | ||
| 28 | (g->bios.vbios_version >> 24) & 0xFF, | ||
| 29 | (g->bios.vbios_version >> 16) & 0xFF, | ||
| 30 | (g->bios.vbios_version >> 8) & 0xFF, | ||
| 31 | (g->bios.vbios_version >> 0) & 0xFF, | ||
| 32 | (g->bios.vbios_oem_version) & 0xFF); | ||
| 33 | |||
| 34 | return 0; | ||
| 35 | } | ||
| 36 | |||
| 37 | static int bios_version_open(struct inode *inode, struct file *file) | ||
| 38 | { | ||
| 39 | return single_open(file, bios_version_show, inode->i_private); | ||
| 40 | } | ||
| 41 | |||
| 42 | static const struct file_operations bios_version_fops = { | ||
| 43 | .open = bios_version_open, | ||
| 44 | .read = seq_read, | ||
| 45 | .llseek = seq_lseek, | ||
| 46 | .release = single_release, | ||
| 47 | }; | ||
| 48 | |||
| 49 | |||
| 50 | int nvgpu_bios_debugfs_init(struct gk20a *g) | ||
| 51 | { | ||
| 52 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | ||
| 53 | struct dentry *gpu_root = l->debugfs; | ||
| 54 | |||
| 55 | debugfs_create_file("bios", S_IRUGO, | ||
| 56 | gpu_root, g, | ||
| 57 | &bios_version_fops); | ||
| 58 | |||
| 59 | return 0; | ||
| 60 | } | ||
