summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include/nvgpu/firmware.h
blob: cf206dc277b88028bbaeef288dca9284cef65b83 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * Copyright (c) 2016-2017, NVIDIA CORPORATION.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _NVGPU_FIRMWARE_H_
#define _NVGPU_FIRMWARE_H_

struct gk20a;

#define NVGPU_REQUEST_FIRMWARE_NO_WARN		(1UL << 0)
#define NVGPU_REQUEST_FIRMWARE_NO_SOC		(1UL << 1)

struct nvgpu_firmware {
	u8 *data;
	size_t size;
};

/**
 * nvgpu_request_firmware - load a firmware blob from filesystem.
 *
 * @g		The GPU driver struct for device to load firmware for
 * @fw_name	The base name of the firmware file.
 * @flags	Flags for loading;
 *
 * 		NVGPU_REQUEST_FIRMWARE_NO_WARN: Do not display warning on
 * 		failed load.
 *
 * 		NVGPU_REQUEST_FIRMWARE_NO_SOC: Do not attempt loading from
 * 		path <SOC_NAME>.
 *
 * nvgpu_request_firmware() will load firmware from:
 *
 * <system firmware load path>/<GPU name>/<fw_name>
 *
 * If that fails and NO_SOC is not enabled, it'll try next from:
 *
 * <system firmware load path>/<SOC name>/<fw_name>
 *
 * It'll allocate a nvgpu_firmware structure and initializes it and returns
 * it to caller.
 */
struct nvgpu_firmware *nvgpu_request_firmware(struct gk20a *g,
					      const char *fw_name,
					      int flags);

/**
 * nvgpu_release_firmware - free firmware and associated nvgpu_firmware blob
 *
 * @g		The GPU driver struct for device to free firmware for
 * @fw		The firmware to free. fw blob will also be freed.
 */
void nvgpu_release_firmware(struct gk20a *g, struct nvgpu_firmware *fw);

#endif