Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70c0f263 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/bios: pull in basic vbios subdev, more to come later



v2: Ben Skeggs <bskeggs@redhat.com>
- use unaligned macros to access vbios image
- endianness fixes

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 586c55f6
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ nouveau-y += core/core/printk.o
nouveau-y += core/core/ramht.o
nouveau-y += core/core/subdev.o

nouveau-y += core/subdev/bios/base.o
nouveau-y += core/subdev/bios/bit.o
nouveau-y += core/subdev/device/base.o
nouveau-y += core/subdev/device/nv04.o
nouveau-y += core/subdev/device/nv10.o
+34 −0
Original line number Diff line number Diff line
#ifndef __NOUVEAU_BIOS_H__
#define __NOUVEAU_BIOS_H__

#include <core/subdev.h>
#include <core/device.h>

struct nouveau_bios {
	struct nouveau_subdev base;
	u32 size;
	u8 *data;

	u32 bmp_offset;
	u32 bit_offset;

	struct {
		u8 major;
		u8 chip;
		u8 minor;
		u8 micro;
	} version;
};

static inline struct nouveau_bios *
nouveau_bios(void *obj)
{
	return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_VBIOS];
}

u8  nvbios_checksum(const u8 *data, int size);
u16 nvbios_findstr(const u8 *data, int size, const char *str, int len);

extern struct nouveau_oclass nouveau_bios_oclass;

#endif
+13 −0
Original line number Diff line number Diff line
#ifndef __NVBIOS_BIT_H__
#define __NVBIOS_BIT_H__

struct bit_entry {
	u8  id;
	u8  version;
	u16 length;
	u16 offset;
};

int bit_entry(struct nouveau_bios *, u8 id, struct bit_entry *);

#endif
+39 −0
Original line number Diff line number Diff line
#ifndef __NVBIOS_BMP_H__
#define __NVBIOS_BMP_H__

static inline u16
bmp_version(struct nouveau_bios *bios)
{
	if (bios->bmp_offset) {
		return nv_ro08(bios, bios->bmp_offset + 5) << 8 |
		       nv_ro08(bios, bios->bmp_offset + 6);
	}

	return 0x0000;
}

static inline u16
bmp_mem_init_table(struct nouveau_bios *bios)
{
	if (bmp_version(bios) >= 0x0300)
		return nv_ro16(bios, bios->bmp_offset + 24);
	return 0x0000;
}

static inline u16
bmp_sdr_seq_table(struct nouveau_bios *bios)
{
	if (bmp_version(bios) >= 0x0300)
		return nv_ro16(bios, bios->bmp_offset + 26);
	return 0x0000;
}

static inline u16
bmp_ddr_seq_table(struct nouveau_bios *bios)
{
	if (bmp_version(bios) >= 0x0300)
		return nv_ro16(bios, bios->bmp_offset + 28);
	return 0x0000;
}

#endif
+2 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@

#include <asm/unaligned.h>

#include <asm/unaligned.h>

static inline int
ffsll(u64 mask)
{
Loading