Skip to content

Commit

Permalink
drm/nouveau/bios: pull in basic vbios subdev, more to come later
Browse files Browse the repository at this point in the history
v2: Ben Skeggs <bskeggs@redhat.com>
- use unaligned macros to access vbios image
- endianness fixes

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Ben Skeggs committed Oct 3, 2012
1 parent 586c55f commit 70c0f26
Show file tree
Hide file tree
Showing 15 changed files with 660 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gpu/drm/nouveau/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions drivers/gpu/drm/nouveau/core/include/subdev/bios.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#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 changes: 13 additions & 0 deletions drivers/gpu/drm/nouveau/core/include/subdev/bios/bit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#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 changes: 39 additions & 0 deletions drivers/gpu/drm/nouveau/core/include/subdev/bios/bmp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#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 changes: 2 additions & 0 deletions drivers/gpu/drm/nouveau/core/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

#include <asm/unaligned.h>

#include <asm/unaligned.h>

static inline int
ffsll(u64 mask)
{
Expand Down
Loading

0 comments on commit 70c0f26

Please sign in to comment.