summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-04-14 15:06:39 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-04-19 15:16:02 -0400
commita9c66768db400a82575a82ecddec71f1d3fd4aba (patch)
tree3b83db70149515fc21c9d700f68bbcf0fb4e58b4 /drivers/gpu/nvgpu/include
parent7eb59ff8d334e9980e21bac50b4680855bd8237f (diff)
gpu: nvgpu: Add abstraction for firmware loading
Add nvgpu_firmware data structure, and return it instead of Linux struct firmare from nvgpu_request_firmware. Also add abstraction for releasing firmware: nvgpu_release_firmware. JIRA NVGPU-16 Change-Id: I6dae8262957c0d4506f710289e3a43a6c1729fc7 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1463538 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/acr/nvgpu_acr.h10
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/firmware.h66
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/nvgpu_common.h7
3 files changed, 72 insertions, 11 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/acr/nvgpu_acr.h b/drivers/gpu/nvgpu/include/nvgpu/acr/nvgpu_acr.h
index 6991a0ba..3844362d 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/acr/nvgpu_acr.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/acr/nvgpu_acr.h
@@ -21,6 +21,8 @@
21#include "acr_objlsfm.h" 21#include "acr_objlsfm.h"
22#include "acr_objflcn.h" 22#include "acr_objflcn.h"
23 23
24struct nvgpu_firmware;
25
24#define MAX_SUPPORTED_LSFM 3 /*PMU, FECS, GPCCS*/ 26#define MAX_SUPPORTED_LSFM 3 /*PMU, FECS, GPCCS*/
25 27
26#define ACR_COMPLETION_TIMEOUT_MS 10000 /*in msec */ 28#define ACR_COMPLETION_TIMEOUT_MS 10000 /*in msec */
@@ -74,20 +76,20 @@ struct acr_desc {
74 struct bin_hdr *hsbin_hdr; 76 struct bin_hdr *hsbin_hdr;
75 struct acr_fw_header *fw_hdr; 77 struct acr_fw_header *fw_hdr;
76 u32 pmu_args; 78 u32 pmu_args;
77 const struct firmware *acr_fw; 79 struct nvgpu_firmware *acr_fw;
78 union{ 80 union{
79 struct flcn_acr_desc *acr_dmem_desc; 81 struct flcn_acr_desc *acr_dmem_desc;
80 struct flcn_acr_desc_v1 *acr_dmem_desc_v1; 82 struct flcn_acr_desc_v1 *acr_dmem_desc_v1;
81 }; 83 };
82 struct nvgpu_mem acr_ucode; 84 struct nvgpu_mem acr_ucode;
83 const struct firmware *hsbl_fw; 85 struct nvgpu_firmware *hsbl_fw;
84 struct nvgpu_mem hsbl_ucode; 86 struct nvgpu_mem hsbl_ucode;
85 union { 87 union {
86 struct flcn_bl_dmem_desc bl_dmem_desc; 88 struct flcn_bl_dmem_desc bl_dmem_desc;
87 struct flcn_bl_dmem_desc_v1 bl_dmem_desc_v1; 89 struct flcn_bl_dmem_desc_v1 bl_dmem_desc_v1;
88 }; 90 };
89 const struct firmware *pmu_fw; 91 struct nvgpu_firmware *pmu_fw;
90 const struct firmware *pmu_desc; 92 struct nvgpu_firmware *pmu_desc;
91 u32 capabilities; 93 u32 capabilities;
92}; 94};
93 95
diff --git a/drivers/gpu/nvgpu/include/nvgpu/firmware.h b/drivers/gpu/nvgpu/include/nvgpu/firmware.h
new file mode 100644
index 00000000..cf206dc2
--- /dev/null
+++ b/drivers/gpu/nvgpu/include/nvgpu/firmware.h
@@ -0,0 +1,66 @@
1/*
2 * Copyright (c) 2016-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 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef _NVGPU_FIRMWARE_H_
18#define _NVGPU_FIRMWARE_H_
19
20struct gk20a;
21
22#define NVGPU_REQUEST_FIRMWARE_NO_WARN (1UL << 0)
23#define NVGPU_REQUEST_FIRMWARE_NO_SOC (1UL << 1)
24
25struct nvgpu_firmware {
26 u8 *data;
27 size_t size;
28};
29
30/**
31 * nvgpu_request_firmware - load a firmware blob from filesystem.
32 *
33 * @g The GPU driver struct for device to load firmware for
34 * @fw_name The base name of the firmware file.
35 * @flags Flags for loading;
36 *
37 * NVGPU_REQUEST_FIRMWARE_NO_WARN: Do not display warning on
38 * failed load.
39 *
40 * NVGPU_REQUEST_FIRMWARE_NO_SOC: Do not attempt loading from
41 * path <SOC_NAME>.
42 *
43 * nvgpu_request_firmware() will load firmware from:
44 *
45 * <system firmware load path>/<GPU name>/<fw_name>
46 *
47 * If that fails and NO_SOC is not enabled, it'll try next from:
48 *
49 * <system firmware load path>/<SOC name>/<fw_name>
50 *
51 * It'll allocate a nvgpu_firmware structure and initializes it and returns
52 * it to caller.
53 */
54struct nvgpu_firmware *nvgpu_request_firmware(struct gk20a *g,
55 const char *fw_name,
56 int flags);
57
58/**
59 * nvgpu_release_firmware - free firmware and associated nvgpu_firmware blob
60 *
61 * @g The GPU driver struct for device to free firmware for
62 * @fw The firmware to free. fw blob will also be freed.
63 */
64void nvgpu_release_firmware(struct gk20a *g, struct nvgpu_firmware *fw);
65
66#endif
diff --git a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_common.h b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_common.h
index 85b4a3df..2a9e4f99 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_common.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_common.h
@@ -25,11 +25,4 @@ int nvgpu_probe(struct gk20a *g,
25 const char *interface_name, 25 const char *interface_name,
26 struct class *class); 26 struct class *class);
27 27
28#define NVGPU_REQUEST_FIRMWARE_NO_WARN BIT(0)
29#define NVGPU_REQUEST_FIRMWARE_NO_SOC BIT(1)
30
31const struct firmware *nvgpu_request_firmware(struct gk20a *g,
32 const char *fw_name,
33 int flags);
34
35#endif 28#endif