1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_BIOS_H__
3 #define __NVKM_BIOS_H__
4 #include <core/subdev.h>
5 
6 struct nvkm_bios {
7 	struct nvkm_subdev subdev;
8 	u32 size;
9 	u8 *data;
10 
11 	u32 image0_size;
12 	u32 imaged_addr;
13 
14 	u32 bmp_offset;
15 	u32 bit_offset;
16 
17 	struct {
18 		u8 major;
19 		u8 chip;
20 		u8 minor;
21 		u8 micro;
22 		u8 patch;
23 	} version;
24 };
25 
26 u8  nvbios_checksum(const u8 *data, int size);
27 u16 nvbios_findstr(const u8 *data, int size, const char *str, int len);
28 int nvbios_memcmp(struct nvkm_bios *, u32 addr, const char *, u32 len);
29 u8  nvbios_rd08(struct nvkm_bios *, u32 addr);
30 u16 nvbios_rd16(struct nvkm_bios *, u32 addr);
31 u32 nvbios_rd32(struct nvkm_bios *, u32 addr);
32 
33 int nvkm_bios_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_bios **);
34 #endif
35