xref: /linux/drivers/gpu/drm/nouveau/include/nvkm/subdev/bios.h (revision b85d45947951d23cb22d90caecf4c1eb81342c96)
1 #ifndef __NVKM_BIOS_H__
2 #define __NVKM_BIOS_H__
3 #include <core/subdev.h>
4 
5 struct nvkm_bios {
6 	struct nvkm_subdev subdev;
7 	u32 size;
8 	u8 *data;
9 
10 	u32 bmp_offset;
11 	u32 bit_offset;
12 
13 	struct {
14 		u8 major;
15 		u8 chip;
16 		u8 minor;
17 		u8 micro;
18 		u8 patch;
19 	} version;
20 };
21 
22 u8  nvbios_checksum(const u8 *data, int size);
23 u16 nvbios_findstr(const u8 *data, int size, const char *str, int len);
24 int nvbios_memcmp(struct nvkm_bios *, u32 addr, const char *, u32 len);
25 
26 #define nvbios_rd08(b,o) (b)->data[(o)]
27 #define nvbios_rd16(b,o) get_unaligned_le16(&(b)->data[(o)])
28 #define nvbios_rd32(b,o) get_unaligned_le32(&(b)->data[(o)])
29 
30 int nvkm_bios_new(struct nvkm_device *, int, struct nvkm_bios **);
31 #endif
32