-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: Ben Skeggs <bskeggs@redhat.com>
- Loading branch information
Ben Skeggs
committed
Oct 3, 2012
1 parent
586c55f
commit 70c0f26
Showing
15 changed files
with
660 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,8 @@ | |
|
||
#include <asm/unaligned.h> | ||
|
||
#include <asm/unaligned.h> | ||
|
||
static inline int | ||
ffsll(u64 mask) | ||
{ | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright 2012 Red Hat Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the "Software"), | ||
* to deal in the Software without restriction, including without limitation | ||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
* and/or sell copies of the Software, and to permit persons to whom the | ||
* Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
* OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* Authors: Ben Skeggs | ||
*/ | ||
|
||
#include "core/object.h" | ||
|
||
#include "subdev/bios.h" | ||
#include "subdev/bios/bit.h" | ||
|
||
int | ||
bit_entry(struct nouveau_bios *bios, u8 id, struct bit_entry *bit) | ||
{ | ||
if (likely(bios->bit_offset)) { | ||
u8 entries = nv_ro08(bios, bios->bit_offset + 10); | ||
u32 entry = bios->bit_offset + 12; | ||
while (entries--) { | ||
if (nv_ro08(bios, entry + 0) == id) { | ||
bit->id = nv_ro08(bios, entry + 0); | ||
bit->version = nv_ro08(bios, entry + 1); | ||
bit->length = nv_ro16(bios, entry + 2); | ||
bit->offset = nv_ro16(bios, entry + 4); | ||
return 0; | ||
} | ||
|
||
entry += nv_ro08(bios, bios->bit_offset + 9); | ||
} | ||
|
||
return -ENOENT; | ||
} | ||
|
||
return -EINVAL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters