Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
7f5f518f
Commit
7f5f518f
authored
Aug 20, 2015
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/bios: remove object accessor functions
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
53003941
Changes
45
Show whitespace changes
Inline
Side-by-side
Showing
45 changed files
with
881 additions
and
970 deletions
+881
-970
drivers/gpu/drm/nouveau/include/nvkm/core/object.h
drivers/gpu/drm/nouveau/include/nvkm/core/object.h
+0
-14
drivers/gpu/drm/nouveau/include/nvkm/subdev/bios.h
drivers/gpu/drm/nouveau/include/nvkm/subdev/bios.h
+5
-0
drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/bmp.h
drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/bmp.h
+5
-5
drivers/gpu/drm/nouveau/nvkm/engine/disp/dport.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/dport.c
+4
-4
drivers/gpu/drm/nouveau/nvkm/subdev/bios/M0203.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/M0203.c
+10
-10
drivers/gpu/drm/nouveau/nvkm/subdev/bios/M0205.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/M0205.c
+10
-10
drivers/gpu/drm/nouveau/nvkm/subdev/bios/M0209.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/M0209.c
+13
-13
drivers/gpu/drm/nouveau/nvkm/subdev/bios/P0260.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/P0260.c
+7
-7
drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
+23
-57
drivers/gpu/drm/nouveau/nvkm/subdev/bios/bit.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/bit.c
+7
-7
drivers/gpu/drm/nouveau/nvkm/subdev/bios/boost.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/boost.c
+14
-14
drivers/gpu/drm/nouveau/nvkm/subdev/bios/conn.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/conn.c
+15
-15
drivers/gpu/drm/nouveau/nvkm/subdev/bios/cstep.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/cstep.c
+13
-13
drivers/gpu/drm/nouveau/nvkm/subdev/bios/dcb.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/dcb.c
+16
-16
drivers/gpu/drm/nouveau/nvkm/subdev/bios/disp.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/disp.c
+18
-18
drivers/gpu/drm/nouveau/nvkm/subdev/bios/dp.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/dp.c
+39
-39
drivers/gpu/drm/nouveau/nvkm/subdev/bios/extdev.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/extdev.c
+8
-8
drivers/gpu/drm/nouveau/nvkm/subdev/bios/fan.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/fan.c
+9
-9
drivers/gpu/drm/nouveau/nvkm/subdev/bios/gpio.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/gpio.c
+15
-15
drivers/gpu/drm/nouveau/nvkm/subdev/bios/i2c.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/i2c.c
+24
-24
drivers/gpu/drm/nouveau/nvkm/subdev/bios/image.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/image.c
+1
-1
drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
+208
-208
drivers/gpu/drm/nouveau/nvkm/subdev/bios/mxm.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/mxm.c
+10
-10
drivers/gpu/drm/nouveau/nvkm/subdev/bios/npde.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/npde.c
+4
-4
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pcir.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pcir.c
+14
-14
drivers/gpu/drm/nouveau/nvkm/subdev/bios/perf.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/perf.c
+44
-44
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c
+75
-75
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pmu.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pmu.c
+17
-17
drivers/gpu/drm/nouveau/nvkm/subdev/bios/ramcfg.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/ramcfg.c
+5
-5
drivers/gpu/drm/nouveau/nvkm/subdev/bios/rammap.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/rammap.c
+90
-90
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
+18
-64
drivers/gpu/drm/nouveau/nvkm/subdev/bios/therm.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/therm.c
+14
-14
drivers/gpu/drm/nouveau/nvkm/subdev/bios/timing.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/timing.c
+49
-49
drivers/gpu/drm/nouveau/nvkm/subdev/bios/vmap.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/vmap.c
+20
-20
drivers/gpu/drm/nouveau/nvkm/subdev/bios/volt.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/volt.c
+26
-26
drivers/gpu/drm/nouveau/nvkm/subdev/bios/xpio.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/xpio.c
+13
-13
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c
+6
-6
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv05.c
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv05.c
+3
-3
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c
+1
-1
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c
+3
-3
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv40.c
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv40.c
+1
-1
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gf110.c
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gf110.c
+1
-1
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/nv50.c
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/nv50.c
+1
-1
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
+1
-1
drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c
+1
-1
No files found.
drivers/gpu/drm/nouveau/include/nvkm/core/object.h
View file @
7f5f518f
...
...
@@ -178,18 +178,4 @@ nv_mo32(void *obj, u64 addr, u32 mask, u32 data)
nv_wo32
(
obj
,
addr
,
(
temp
&
~
mask
)
|
data
);
return
temp
;
}
static
inline
int
nv_memcmp
(
void
*
obj
,
u32
addr
,
const
char
*
str
,
u32
len
)
{
unsigned
char
c1
,
c2
;
while
(
len
--
)
{
c1
=
nv_ro08
(
obj
,
addr
++
);
c2
=
*
(
str
++
);
if
(
c1
!=
c2
)
return
c1
-
c2
;
}
return
0
;
}
#endif
drivers/gpu/drm/nouveau/include/nvkm/subdev/bios.h
View file @
7f5f518f
...
...
@@ -27,6 +27,11 @@ nvkm_bios(void *obj)
u8
nvbios_checksum
(
const
u8
*
data
,
int
size
);
u16
nvbios_findstr
(
const
u8
*
data
,
int
size
,
const
char
*
str
,
int
len
);
int
nvbios_memcmp
(
struct
nvkm_bios
*
,
u32
addr
,
const
char
*
,
u32
len
);
#define nvbios_rd08(b,o) (b)->data[(o)]
#define nvbios_rd16(b,o) get_unaligned_le16(&(b)->data[(o)])
#define nvbios_rd32(b,o) get_unaligned_le32(&(b)->data[(o)])
extern
struct
nvkm_oclass
nvkm_bios_oclass
;
#endif
drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/bmp.h
View file @
7f5f518f
...
...
@@ -4,8 +4,8 @@ static inline u16
bmp_version
(
struct
nvkm_bios
*
bios
)
{
if
(
bios
->
bmp_offset
)
{
return
nv
_ro
08
(
bios
,
bios
->
bmp_offset
+
5
)
<<
8
|
nv
_ro
08
(
bios
,
bios
->
bmp_offset
+
6
);
return
nv
bios_rd
08
(
bios
,
bios
->
bmp_offset
+
5
)
<<
8
|
nv
bios_rd
08
(
bios
,
bios
->
bmp_offset
+
6
);
}
return
0x0000
;
...
...
@@ -15,7 +15,7 @@ static inline u16
bmp_mem_init_table
(
struct
nvkm_bios
*
bios
)
{
if
(
bmp_version
(
bios
)
>=
0x0300
)
return
nv
_ro
16
(
bios
,
bios
->
bmp_offset
+
24
);
return
nv
bios_rd
16
(
bios
,
bios
->
bmp_offset
+
24
);
return
0x0000
;
}
...
...
@@ -23,7 +23,7 @@ static inline u16
bmp_sdr_seq_table
(
struct
nvkm_bios
*
bios
)
{
if
(
bmp_version
(
bios
)
>=
0x0300
)
return
nv
_ro
16
(
bios
,
bios
->
bmp_offset
+
26
);
return
nv
bios_rd
16
(
bios
,
bios
->
bmp_offset
+
26
);
return
0x0000
;
}
...
...
@@ -31,7 +31,7 @@ static inline u16
bmp_ddr_seq_table
(
struct
nvkm_bios
*
bios
)
{
if
(
bmp_version
(
bios
)
>=
0x0300
)
return
nv
_ro
16
(
bios
,
bios
->
bmp_offset
+
28
);
return
nv
bios_rd
16
(
bios
,
bios
->
bmp_offset
+
28
);
return
0x0000
;
}
#endif
drivers/gpu/drm/nouveau/nvkm/engine/disp/dport.c
View file @
7f5f518f
...
...
@@ -69,13 +69,13 @@ dp_set_link_config(struct dp_state *dp)
/* set desired link configuration on the source */
if
((
lnkcmp
=
dp
->
outp
->
info
.
lnkcmp
))
{
if
(
outp
->
version
<
0x30
)
{
while
((
dp
->
link_bw
/
10
)
<
nv
_ro
16
(
bios
,
lnkcmp
))
while
((
dp
->
link_bw
/
10
)
<
nv
bios_rd
16
(
bios
,
lnkcmp
))
lnkcmp
+=
4
;
init
.
offset
=
nv
_ro
16
(
bios
,
lnkcmp
+
2
);
init
.
offset
=
nv
bios_rd
16
(
bios
,
lnkcmp
+
2
);
}
else
{
while
((
dp
->
link_bw
/
27000
)
<
nv
_ro
08
(
bios
,
lnkcmp
))
while
((
dp
->
link_bw
/
27000
)
<
nv
bios_rd
08
(
bios
,
lnkcmp
))
lnkcmp
+=
3
;
init
.
offset
=
nv
_ro
16
(
bios
,
lnkcmp
+
1
);
init
.
offset
=
nv
bios_rd
16
(
bios
,
lnkcmp
+
1
);
}
nvbios_exec
(
&
init
);
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/M0203.c
View file @
7f5f518f
...
...
@@ -33,14 +33,14 @@ nvbios_M0203Te(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
if
(
!
bit_entry
(
bios
,
'M'
,
&
bit_M
))
{
if
(
bit_M
.
version
==
2
&&
bit_M
.
length
>
0x04
)
data
=
nv
_ro
16
(
bios
,
bit_M
.
offset
+
0x03
);
data
=
nv
bios_rd
16
(
bios
,
bit_M
.
offset
+
0x03
);
if
(
data
)
{
*
ver
=
nv
_ro
08
(
bios
,
data
+
0x00
);
*
ver
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
switch
(
*
ver
)
{
case
0x10
:
*
hdr
=
nv
_ro
08
(
bios
,
data
+
0x01
);
*
len
=
nv
_ro
08
(
bios
,
data
+
0x02
);
*
cnt
=
nv
_ro
08
(
bios
,
data
+
0x03
);
*
hdr
=
nv
bios_rd
08
(
bios
,
data
+
0x01
);
*
len
=
nv
bios_rd
08
(
bios
,
data
+
0x02
);
*
cnt
=
nv
bios_rd
08
(
bios
,
data
+
0x03
);
return
data
;
default:
break
;
...
...
@@ -59,8 +59,8 @@ nvbios_M0203Tp(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len,
memset
(
info
,
0x00
,
sizeof
(
*
info
));
switch
(
!!
data
*
*
ver
)
{
case
0x10
:
info
->
type
=
nv
_ro
08
(
bios
,
data
+
0x04
);
info
->
pointer
=
nv
_ro
16
(
bios
,
data
+
0x05
);
info
->
type
=
nv
bios_rd
08
(
bios
,
data
+
0x04
);
info
->
pointer
=
nv
bios_rd
16
(
bios
,
data
+
0x05
);
break
;
default:
break
;
...
...
@@ -89,9 +89,9 @@ nvbios_M0203Ep(struct nvkm_bios *bios, int idx, u8 *ver, u8 *hdr,
memset
(
info
,
0x00
,
sizeof
(
*
info
));
switch
(
!!
data
*
*
ver
)
{
case
0x10
:
info
->
type
=
(
nv
_ro
08
(
bios
,
data
+
0x00
)
&
0x0f
)
>>
0
;
info
->
strap
=
(
nv
_ro
08
(
bios
,
data
+
0x00
)
&
0xf0
)
>>
4
;
info
->
group
=
(
nv
_ro
08
(
bios
,
data
+
0x01
)
&
0x0f
)
>>
0
;
info
->
type
=
(
nv
bios_rd
08
(
bios
,
data
+
0x00
)
&
0x0f
)
>>
0
;
info
->
strap
=
(
nv
bios_rd
08
(
bios
,
data
+
0x00
)
&
0xf0
)
>>
4
;
info
->
group
=
(
nv
bios_rd
08
(
bios
,
data
+
0x01
)
&
0x0f
)
>>
0
;
return
data
;
default:
break
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/M0205.c
View file @
7f5f518f
...
...
@@ -34,16 +34,16 @@ nvbios_M0205Te(struct nvkm_bios *bios,
if
(
!
bit_entry
(
bios
,
'M'
,
&
bit_M
))
{
if
(
bit_M
.
version
==
2
&&
bit_M
.
length
>
0x08
)
data
=
nv
_ro
32
(
bios
,
bit_M
.
offset
+
0x05
);
data
=
nv
bios_rd
32
(
bios
,
bit_M
.
offset
+
0x05
);
if
(
data
)
{
*
ver
=
nv
_ro
08
(
bios
,
data
+
0x00
);
*
ver
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
switch
(
*
ver
)
{
case
0x10
:
*
hdr
=
nv
_ro
08
(
bios
,
data
+
0x01
);
*
len
=
nv
_ro
08
(
bios
,
data
+
0x02
);
*
ssz
=
nv
_ro
08
(
bios
,
data
+
0x03
);
*
snr
=
nv
_ro
08
(
bios
,
data
+
0x04
);
*
cnt
=
nv
_ro
08
(
bios
,
data
+
0x05
);
*
hdr
=
nv
bios_rd
08
(
bios
,
data
+
0x01
);
*
len
=
nv
bios_rd
08
(
bios
,
data
+
0x02
);
*
ssz
=
nv
bios_rd
08
(
bios
,
data
+
0x03
);
*
snr
=
nv
bios_rd
08
(
bios
,
data
+
0x04
);
*
cnt
=
nv
bios_rd
08
(
bios
,
data
+
0x05
);
return
data
;
default:
break
;
...
...
@@ -63,7 +63,7 @@ nvbios_M0205Tp(struct nvkm_bios *bios,
memset
(
info
,
0x00
,
sizeof
(
*
info
));
switch
(
!!
data
*
*
ver
)
{
case
0x10
:
info
->
freq
=
nv
_ro
16
(
bios
,
data
+
0x06
);
info
->
freq
=
nv
bios_rd
16
(
bios
,
data
+
0x06
);
break
;
default:
break
;
...
...
@@ -96,7 +96,7 @@ nvbios_M0205Ep(struct nvkm_bios *bios, int idx,
memset
(
info
,
0x00
,
sizeof
(
*
info
));
switch
(
!!
data
*
*
ver
)
{
case
0x10
:
info
->
type
=
nv
_ro
08
(
bios
,
data
+
0x00
)
&
0x0f
;
info
->
type
=
nv
bios_rd
08
(
bios
,
data
+
0x00
)
&
0x0f
;
return
data
;
default:
break
;
...
...
@@ -126,7 +126,7 @@ nvbios_M0205Sp(struct nvkm_bios *bios, int ent, int idx, u8 *ver, u8 *hdr,
memset
(
info
,
0x00
,
sizeof
(
*
info
));
switch
(
!!
data
*
*
ver
)
{
case
0x10
:
info
->
data
=
nv
_ro
08
(
bios
,
data
+
0x00
);
info
->
data
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
return
data
;
default:
break
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/M0209.c
View file @
7f5f518f
...
...
@@ -34,16 +34,16 @@ nvbios_M0209Te(struct nvkm_bios *bios,
if
(
!
bit_entry
(
bios
,
'M'
,
&
bit_M
))
{
if
(
bit_M
.
version
==
2
&&
bit_M
.
length
>
0x0c
)
data
=
nv
_ro
32
(
bios
,
bit_M
.
offset
+
0x09
);
data
=
nv
bios_rd
32
(
bios
,
bit_M
.
offset
+
0x09
);
if
(
data
)
{
*
ver
=
nv
_ro
08
(
bios
,
data
+
0x00
);
*
ver
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
switch
(
*
ver
)
{
case
0x10
:
*
hdr
=
nv
_ro
08
(
bios
,
data
+
0x01
);
*
len
=
nv
_ro
08
(
bios
,
data
+
0x02
);
*
ssz
=
nv
_ro
08
(
bios
,
data
+
0x03
);
*
hdr
=
nv
bios_rd
08
(
bios
,
data
+
0x01
);
*
len
=
nv
bios_rd
08
(
bios
,
data
+
0x02
);
*
ssz
=
nv
bios_rd
08
(
bios
,
data
+
0x03
);
*
snr
=
1
;
*
cnt
=
nv
_ro
08
(
bios
,
data
+
0x04
);
*
cnt
=
nv
bios_rd
08
(
bios
,
data
+
0x04
);
return
data
;
default:
break
;
...
...
@@ -78,12 +78,12 @@ nvbios_M0209Ep(struct nvkm_bios *bios, int idx,
memset
(
info
,
0x00
,
sizeof
(
*
info
));
switch
(
!!
data
*
*
ver
)
{
case
0x10
:
info
->
v00_40
=
(
nv
_ro
08
(
bios
,
data
+
0x00
)
&
0x40
)
>>
6
;
info
->
bits
=
nv
_ro
08
(
bios
,
data
+
0x00
)
&
0x3f
;
info
->
modulo
=
nv
_ro
08
(
bios
,
data
+
0x01
);
info
->
v02_40
=
(
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x40
)
>>
6
;
info
->
v02_07
=
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x07
;
info
->
v03
=
nv
_ro
08
(
bios
,
data
+
0x03
);
info
->
v00_40
=
(
nv
bios_rd
08
(
bios
,
data
+
0x00
)
&
0x40
)
>>
6
;
info
->
bits
=
nv
bios_rd
08
(
bios
,
data
+
0x00
)
&
0x3f
;
info
->
modulo
=
nv
bios_rd
08
(
bios
,
data
+
0x01
);
info
->
v02_40
=
(
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x40
)
>>
6
;
info
->
v02_07
=
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x07
;
info
->
v03
=
nv
bios_rd
08
(
bios
,
data
+
0x03
);
return
data
;
default:
break
;
...
...
@@ -122,7 +122,7 @@ nvbios_M0209Sp(struct nvkm_bios *bios, int ent, int idx, u8 *ver, u8 *hdr,
u32
mask
=
(
1ULL
<<
M0209E
.
bits
)
-
1
;
u16
off
=
bits
/
8
;
u8
mod
=
bits
%
8
;
info
->
data
[
i
]
=
nv
_ro
32
(
bios
,
data
+
off
);
info
->
data
[
i
]
=
nv
bios_rd
32
(
bios
,
data
+
off
);
info
->
data
[
i
]
=
info
->
data
[
i
]
>>
mod
;
info
->
data
[
i
]
=
info
->
data
[
i
]
&
mask
;
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/P0260.c
View file @
7f5f518f
...
...
@@ -34,15 +34,15 @@ nvbios_P0260Te(struct nvkm_bios *bios,
if
(
!
bit_entry
(
bios
,
'P'
,
&
bit_P
))
{
if
(
bit_P
.
version
==
2
&&
bit_P
.
length
>
0x63
)
data
=
nv
_ro
32
(
bios
,
bit_P
.
offset
+
0x60
);
data
=
nv
bios_rd
32
(
bios
,
bit_P
.
offset
+
0x60
);
if
(
data
)
{
*
ver
=
nv
_ro
08
(
bios
,
data
+
0
);
*
ver
=
nv
bios_rd
08
(
bios
,
data
+
0
);
switch
(
*
ver
)
{
case
0x10
:
*
hdr
=
nv
_ro
08
(
bios
,
data
+
1
);
*
cnt
=
nv
_ro
08
(
bios
,
data
+
2
);
*
hdr
=
nv
bios_rd
08
(
bios
,
data
+
1
);
*
cnt
=
nv
bios_rd
08
(
bios
,
data
+
2
);
*
len
=
4
;
*
xnr
=
nv
_ro
08
(
bios
,
data
+
3
);
*
xnr
=
nv
bios_rd
08
(
bios
,
data
+
3
);
*
xsz
=
4
;
return
data
;
default:
...
...
@@ -72,7 +72,7 @@ nvbios_P0260Ep(struct nvkm_bios *bios, int idx, u8 *ver, u8 *len,
memset
(
info
,
0x00
,
sizeof
(
*
info
));
switch
(
!!
data
*
*
ver
)
{
case
0x10
:
info
->
data
=
nv
_ro
32
(
bios
,
data
);
info
->
data
=
nv
bios_rd
32
(
bios
,
data
);
return
data
;
default:
break
;
...
...
@@ -98,7 +98,7 @@ nvbios_P0260Xp(struct nvkm_bios *bios, int idx, u8 *ver, u8 *hdr,
memset
(
info
,
0x00
,
sizeof
(
*
info
));
switch
(
!!
data
*
*
ver
)
{
case
0x10
:
info
->
data
=
nv
_ro
32
(
bios
,
data
);
info
->
data
=
nv
bios_rd
32
(
bios
,
data
);
return
data
;
default:
break
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
View file @
7f5f518f
...
...
@@ -52,6 +52,20 @@ nvbios_findstr(const u8 *data, int size, const char *str, int len)
return
0
;
}
int
nvbios_memcmp
(
struct
nvkm_bios
*
bios
,
u32
addr
,
const
char
*
str
,
u32
len
)
{
unsigned
char
c1
,
c2
;
while
(
len
--
)
{
c1
=
nvbios_rd08
(
bios
,
addr
++
);
c2
=
*
(
str
++
);
if
(
c1
!=
c2
)
return
c1
-
c2
;
}
return
0
;
}
int
nvbios_extend
(
struct
nvkm_bios
*
bios
,
u32
length
)
{
...
...
@@ -69,48 +83,6 @@ nvbios_extend(struct nvkm_bios *bios, u32 length)
return
0
;
}
static
u8
nvkm_bios_rd08
(
struct
nvkm_object
*
object
,
u64
addr
)
{
struct
nvkm_bios
*
bios
=
(
void
*
)
object
;
return
bios
->
data
[
addr
];
}
static
u16
nvkm_bios_rd16
(
struct
nvkm_object
*
object
,
u64
addr
)
{
struct
nvkm_bios
*
bios
=
(
void
*
)
object
;
return
get_unaligned_le16
(
&
bios
->
data
[
addr
]);
}
static
u32
nvkm_bios_rd32
(
struct
nvkm_object
*
object
,
u64
addr
)
{
struct
nvkm_bios
*
bios
=
(
void
*
)
object
;
return
get_unaligned_le32
(
&
bios
->
data
[
addr
]);
}
static
void
nvkm_bios_wr08
(
struct
nvkm_object
*
object
,
u64
addr
,
u8
data
)
{
struct
nvkm_bios
*
bios
=
(
void
*
)
object
;
bios
->
data
[
addr
]
=
data
;
}
static
void
nvkm_bios_wr16
(
struct
nvkm_object
*
object
,
u64
addr
,
u16
data
)
{
struct
nvkm_bios
*
bios
=
(
void
*
)
object
;
put_unaligned_le16
(
data
,
&
bios
->
data
[
addr
]);
}
static
void
nvkm_bios_wr32
(
struct
nvkm_object
*
object
,
u64
addr
,
u32
data
)
{
struct
nvkm_bios
*
bios
=
(
void
*
)
object
;
put_unaligned_le32
(
data
,
&
bios
->
data
[
addr
]);
}
static
int
nvkm_bios_ctor
(
struct
nvkm_object
*
parent
,
struct
nvkm_object
*
engine
,
struct
nvkm_oclass
*
oclass
,
void
*
data
,
u32
size
,
...
...
@@ -146,17 +118,17 @@ nvkm_bios_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
/* determine the vbios version number */
if
(
!
bit_entry
(
bios
,
'i'
,
&
bit_i
)
&&
bit_i
.
length
>=
4
)
{
bios
->
version
.
major
=
nv
_ro
08
(
bios
,
bit_i
.
offset
+
3
);
bios
->
version
.
chip
=
nv
_ro
08
(
bios
,
bit_i
.
offset
+
2
);
bios
->
version
.
minor
=
nv
_ro
08
(
bios
,
bit_i
.
offset
+
1
);
bios
->
version
.
micro
=
nv
_ro
08
(
bios
,
bit_i
.
offset
+
0
);
bios
->
version
.
patch
=
nv
_ro
08
(
bios
,
bit_i
.
offset
+
4
);
bios
->
version
.
major
=
nv
bios_rd
08
(
bios
,
bit_i
.
offset
+
3
);
bios
->
version
.
chip
=
nv
bios_rd
08
(
bios
,
bit_i
.
offset
+
2
);
bios
->
version
.
minor
=
nv
bios_rd
08
(
bios
,
bit_i
.
offset
+
1
);
bios
->
version
.
micro
=
nv
bios_rd
08
(
bios
,
bit_i
.
offset
+
0
);
bios
->
version
.
patch
=
nv
bios_rd
08
(
bios
,
bit_i
.
offset
+
4
);
}
else
if
(
bmp_version
(
bios
))
{
bios
->
version
.
major
=
nv
_ro
08
(
bios
,
bios
->
bmp_offset
+
13
);
bios
->
version
.
chip
=
nv
_ro
08
(
bios
,
bios
->
bmp_offset
+
12
);
bios
->
version
.
minor
=
nv
_ro
08
(
bios
,
bios
->
bmp_offset
+
11
);
bios
->
version
.
micro
=
nv
_ro
08
(
bios
,
bios
->
bmp_offset
+
10
);
bios
->
version
.
major
=
nv
bios_rd
08
(
bios
,
bios
->
bmp_offset
+
13
);
bios
->
version
.
chip
=
nv
bios_rd
08
(
bios
,
bios
->
bmp_offset
+
12
);
bios
->
version
.
minor
=
nv
bios_rd
08
(
bios
,
bios
->
bmp_offset
+
11
);
bios
->
version
.
micro
=
nv
bios_rd
08
(
bios
,
bios
->
bmp_offset
+
10
);
}
nvkm_info
(
&
bios
->
subdev
,
"version %02x.%02x.%02x.%02x.%02x
\n
"
,
...
...
@@ -195,11 +167,5 @@ nvkm_bios_oclass = {
.
dtor
=
nvkm_bios_dtor
,
.
init
=
nvkm_bios_init
,
.
fini
=
nvkm_bios_fini
,
.
rd08
=
nvkm_bios_rd08
,
.
rd16
=
nvkm_bios_rd16
,
.
rd32
=
nvkm_bios_rd32
,
.
wr08
=
nvkm_bios_wr08
,
.
wr16
=
nvkm_bios_wr16
,
.
wr32
=
nvkm_bios_wr32
,
},
};
drivers/gpu/drm/nouveau/nvkm/subdev/bios/bit.c
View file @
7f5f518f
...
...
@@ -28,18 +28,18 @@ int
bit_entry
(
struct
nvkm_bios
*
bios
,
u8
id
,
struct
bit_entry
*
bit
)
{
if
(
likely
(
bios
->
bit_offset
))
{
u8
entries
=
nv
_ro
08
(
bios
,
bios
->
bit_offset
+
10
);
u8
entries
=
nv
bios_rd
08
(
bios
,
bios
->
bit_offset
+
10
);
u32
entry
=
bios
->
bit_offset
+
12
;
while
(
entries
--
)
{
if
(
nv
_ro
08
(
bios
,
entry
+
0
)
==
id
)
{
bit
->
id
=
nv
_ro
08
(
bios
,
entry
+
0
);
bit
->
version
=
nv
_ro
08
(
bios
,
entry
+
1
);
bit
->
length
=
nv
_ro
16
(
bios
,
entry
+
2
);
bit
->
offset
=
nv
_ro
16
(
bios
,
entry
+
4
);
if
(
nv
bios_rd
08
(
bios
,
entry
+
0
)
==
id
)
{
bit
->
id
=
nv
bios_rd
08
(
bios
,
entry
+
0
);
bit
->
version
=
nv
bios_rd
08
(
bios
,
entry
+
1
);
bit
->
length
=
nv
bios_rd
16
(
bios
,
entry
+
2
);
bit
->
offset
=
nv
bios_rd
16
(
bios
,
entry
+
4
);
return
0
;
}
entry
+=
nv
_ro
08
(
bios
,
bios
->
bit_offset
+
9
);
entry
+=
nv
bios_rd
08
(
bios
,
bios
->
bit_offset
+
9
);
}
return
-
ENOENT
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/boost.c
View file @
7f5f518f
...
...
@@ -34,17 +34,17 @@ nvbios_boostTe(struct nvkm_bios *bios,
if
(
!
bit_entry
(
bios
,
'P'
,
&
bit_P
))
{
if
(
bit_P
.
version
==
2
)
boost
=
nv
_ro
16
(
bios
,
bit_P
.
offset
+
0x30
);
boost
=
nv
bios_rd
16
(
bios
,
bit_P
.
offset
+
0x30
);
if
(
boost
)
{
*
ver
=
nv
_ro
08
(
bios
,
boost
+
0
);
*
ver
=
nv
bios_rd
08
(
bios
,
boost
+
0
);
switch
(
*
ver
)
{
case
0x11
:
*
hdr
=
nv
_ro
08
(
bios
,
boost
+
1
);
*
cnt
=
nv
_ro
08
(
bios
,
boost
+
5
);
*
len
=
nv
_ro
08
(
bios
,
boost
+
2
);
*
snr
=
nv
_ro
08
(
bios
,
boost
+
4
);
*
ssz
=
nv
_ro
08
(
bios
,
boost
+
3
);
*
hdr
=
nv
bios_rd
08
(
bios
,
boost
+
1
);
*
cnt
=
nv
bios_rd
08
(
bios
,
boost
+
5
);
*
len
=
nv
bios_rd
08
(
bios
,
boost
+
2
);
*
snr
=
nv
bios_rd
08
(
bios
,
boost
+
4
);
*
ssz
=
nv
bios_rd
08
(
bios
,
boost
+
3
);
return
boost
;
default:
break
;
...
...
@@ -78,9 +78,9 @@ nvbios_boostEp(struct nvkm_bios *bios, int idx,
u16
data
=
nvbios_boostEe
(
bios
,
idx
,
ver
,
hdr
,
cnt
,
len
);
memset
(
info
,
0x00
,
sizeof
(
*
info
));
if
(
data
)
{
info
->
pstate
=
(
nv
_ro
16
(
bios
,
data
+
0x00
)
&
0x01e0
)
>>
5
;
info
->
min
=
nv
_ro
16
(
bios
,
data
+
0x02
)
*
1000
;
info
->
max
=
nv
_ro
16
(
bios
,
data
+
0x04
)
*
1000
;
info
->
pstate
=
(
nv
bios_rd
16
(
bios
,
data
+
0x00
)
&
0x01e0
)
>>
5
;
info
->
min
=
nv
bios_rd
16
(
bios
,
data
+
0x02
)
*
1000
;
info
->
max
=
nv
bios_rd
16
(
bios
,
data
+
0x04
)
*
1000
;
}
return
data
;
}
...
...
@@ -117,10 +117,10 @@ nvbios_boostSp(struct nvkm_bios *bios, int idx,
data
=
nvbios_boostSe
(
bios
,
idx
,
data
,
ver
,
hdr
,
cnt
,
len
);
memset
(
info
,
0x00
,
sizeof
(
*
info
));
if
(
data
)
{
info
->
domain
=
nv
_ro
08
(
bios
,
data
+
0x00
);
info
->
percent
=
nv
_ro
08
(
bios
,
data
+
0x01
);
info
->
min
=
nv
_ro
16
(
bios
,
data
+
0x02
)
*
1000
;
info
->
max
=
nv
_ro
16
(
bios
,
data
+
0x04
)
*
1000
;
info
->
domain
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
info
->
percent
=
nv
bios_rd
08
(
bios
,
data
+
0x01
);
info
->
min
=
nv
bios_rd
16
(
bios
,
data
+
0x02
)
*
1000
;
info
->
max
=
nv
bios_rd
16
(
bios
,
data
+
0x04
)
*
1000
;
}
return
data
;
}
drivers/gpu/drm/nouveau/nvkm/subdev/bios/conn.c
View file @
7f5f518f
...
...
@@ -30,12 +30,12 @@ nvbios_connTe(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
{
u32
dcb
=
dcb_table
(
bios
,
ver
,
hdr
,
cnt
,
len
);
if
(
dcb
&&
*
ver
>=
0x30
&&
*
hdr
>=
0x16
)
{
u32
data
=
nv
_ro
16
(
bios
,
dcb
+
0x14
);
u32
data
=
nv
bios_rd
16
(
bios
,
dcb
+
0x14
);
if
(
data
)
{
*
ver
=
nv
_ro
08
(
bios
,
data
+
0
);
*
hdr
=
nv
_ro
08
(
bios
,
data
+
1
);
*
cnt
=
nv
_ro
08
(
bios
,
data
+
2
);
*
len
=
nv
_ro
08
(
bios
,
data
+
3
);
*
ver
=
nv
bios_rd
08
(
bios
,
data
+
0
);
*
hdr
=
nv
bios_rd
08
(
bios
,
data
+
1
);
*
cnt
=
nv
bios_rd
08
(
bios
,
data
+
2
);
*
len
=
nv
bios_rd
08
(
bios
,
data
+
3
);
return
data
;
}
}
...
...
@@ -77,18 +77,18 @@ nvbios_connEp(struct nvkm_bios *bios, u8 idx, u8 *ver, u8 *len,
switch
(
!!
data
*
*
ver
)
{
case
0x30
:
case
0x40
:
info
->
type
=
nv
_ro
08
(
bios
,
data
+
0x00
);
info
->
location
=
nv
_ro
08
(
bios
,
data
+
0x01
)
&
0x0f
;
info
->
hpd
=
(
nv
_ro
08
(
bios
,
data
+
0x01
)
&
0x30
)
>>
4
;
info
->
dp
=
(
nv
_ro
08
(
bios
,
data
+
0x01
)
&
0xc0
)
>>
6
;
info
->
type
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
info
->
location
=
nv
bios_rd
08
(
bios
,
data
+
0x01
)
&
0x0f
;
info
->
hpd
=
(
nv
bios_rd
08
(
bios
,
data
+
0x01
)
&
0x30
)
>>
4
;
info
->
dp
=
(
nv
bios_rd
08
(
bios
,
data
+
0x01
)
&
0xc0
)
>>
6
;
if
(
*
len
<
4
)
return
data
;
info
->
hpd
|=
(
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x03
)
<<
2
;
info
->
dp
|=
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x0c
;
info
->
di
=
(
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0xf0
)
>>
4
;
info
->
hpd
|=
(
nv
_ro
08
(
bios
,
data
+
0x03
)
&
0x07
)
<<
4
;
info
->
sr
=
(
nv
_ro
08
(
bios
,
data
+
0x03
)
&
0x08
)
>>
3
;
info
->
lcdid
=
(
nv
_ro
08
(
bios
,
data
+
0x03
)
&
0x70
)
>>
4
;
info
->
hpd
|=
(
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x03
)
<<
2
;
info
->
dp
|=
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x0c
;
info
->
di
=
(
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0xf0
)
>>
4
;
info
->
hpd
|=
(
nv
bios_rd
08
(
bios
,
data
+
0x03
)
&
0x07
)
<<
4
;
info
->
sr
=
(
nv
bios_rd
08
(
bios
,
data
+
0x03
)
&
0x08
)
>>
3
;
info
->
lcdid
=
(
nv
bios_rd
08
(
bios
,
data
+
0x03
)
&
0x70
)
>>
4
;
return
data
;
default:
break
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/cstep.c
View file @
7f5f518f
...
...
@@ -34,17 +34,17 @@ nvbios_cstepTe(struct nvkm_bios *bios,
if
(
!
bit_entry
(
bios
,
'P'
,
&
bit_P
))
{
if
(
bit_P
.
version
==
2
)
cstep
=
nv
_ro
16
(
bios
,
bit_P
.
offset
+
0x34
);
cstep
=
nv
bios_rd
16
(
bios
,
bit_P
.
offset
+
0x34
);
if
(
cstep
)
{
*
ver
=
nv
_ro
08
(
bios
,
cstep
+
0
);
*
ver
=
nv
bios_rd
08
(
bios
,
cstep
+
0
);
switch
(
*
ver
)
{
case
0x10
:
*
hdr
=
nv
_ro
08
(
bios
,
cstep
+
1
);
*
cnt
=
nv
_ro
08
(
bios
,
cstep
+
3
);
*
len
=
nv
_ro
08
(
bios
,
cstep
+
2
);
*
xnr
=
nv
_ro
08
(
bios
,
cstep
+
5
);
*
xsz
=
nv
_ro
08
(
bios
,
cstep
+
4
);
*
hdr
=
nv
bios_rd
08
(
bios
,
cstep
+
1
);
*
cnt
=
nv
bios_rd
08
(
bios
,
cstep
+
3
);
*
len
=
nv
bios_rd
08
(
bios
,
cstep
+
2
);
*
xnr
=
nv
bios_rd
08
(
bios
,
cstep
+
5
);
*
xsz
=
nv
bios_rd
08
(
bios
,
cstep
+
4
);
return
cstep
;
default:
break
;
...
...
@@ -75,8 +75,8 @@ nvbios_cstepEp(struct nvkm_bios *bios, int idx, u8 *ver, u8 *hdr,
u16
data
=
nvbios_cstepEe
(
bios
,
idx
,
ver
,
hdr
);
memset
(
info
,
0x00
,
sizeof
(
*
info
));
if
(
data
)
{
info
->
pstate
=
(
nv
_ro
16
(
bios
,
data
+
0x00
)
&
0x01e0
)
>>
5
;
info
->
index
=
nv
_ro
08
(
bios
,
data
+
0x03
);
info
->
pstate
=
(
nv
bios_rd
16
(
bios
,
data
+
0x00
)
&
0x01e0
)
>>
5
;
info
->
index
=
nv
bios_rd
08
(
bios
,
data
+
0x03
);
}
return
data
;
}
...
...
@@ -113,10 +113,10 @@ nvbios_cstepXp(struct nvkm_bios *bios, int idx, u8 *ver, u8 *hdr,
u16
data
=
nvbios_cstepXe
(
bios
,
idx
,
ver
,
hdr
);
memset
(
info
,
0x00
,
sizeof
(
*
info
));
if
(
data
)
{
info
->
freq
=
nv
_ro
16
(
bios
,
data
+
0x00
)
*
1000
;
info
->
unkn
[
0
]
=
nv
_ro
08
(
bios
,
data
+
0x02
);
info
->
unkn
[
1
]
=
nv
_ro
08
(
bios
,
data
+
0x03
);
info
->
voltage
=
nv
_ro
08
(
bios
,
data
+
0x04
);
info
->
freq
=
nv
bios_rd
16
(
bios
,
data
+
0x00
)
*
1000
;
info
->
unkn
[
0
]
=
nv
bios_rd
08
(
bios
,
data
+
0x02
);
info
->
unkn
[
1
]
=
nv
bios_rd
08
(
bios
,
data
+
0x03
);
info
->
voltage
=
nv
bios_rd
08
(
bios
,
data
+
0x04
);
}
return
data
;
}
drivers/gpu/drm/nouveau/nvkm/subdev/bios/dcb.c
View file @
7f5f518f
...
...
@@ -32,29 +32,29 @@ dcb_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
u16
dcb
=
0x0000
;
if
(
device
->
card_type
>
NV_04
)
dcb
=
nv
_ro
16
(
bios
,
0x36
);
dcb
=
nv
bios_rd
16
(
bios
,
0x36
);
if
(
!
dcb
)
{
nvkm_warn
(
subdev
,
"DCB table not found
\n
"
);
return
dcb
;
}
*
ver
=
nv
_ro
08
(
bios
,
dcb
);
*
ver
=
nv
bios_rd
08
(
bios
,
dcb
);
if
(
*
ver
>=
0x42
)
{
nvkm_warn
(
subdev
,
"DCB version 0x%02x unknown
\n
"
,
*
ver
);
return
0x0000
;
}
else
if
(
*
ver
>=
0x30
)
{
if
(
nv
_ro
32
(
bios
,
dcb
+
6
)
==
0x4edcbdcb
)
{
*
hdr
=
nv
_ro
08
(
bios
,
dcb
+
1
);
*
cnt
=
nv
_ro
08
(
bios
,
dcb
+
2
);
*
len
=
nv
_ro
08
(
bios
,
dcb
+
3
);
if
(
nv
bios_rd
32
(
bios
,
dcb
+
6
)
==
0x4edcbdcb
)
{
*
hdr
=
nv
bios_rd
08
(
bios
,
dcb
+
1
);
*
cnt
=
nv
bios_rd
08
(
bios
,
dcb
+
2
);
*
len
=
nv
bios_rd
08
(
bios
,
dcb
+
3
);
return
dcb
;
}
}
else
if
(
*
ver
>=
0x20
)
{
if
(
nv
_ro
32
(
bios
,
dcb
+
4
)
==
0x4edcbdcb
)
{
u16
i2c
=
nv
_ro
16
(
bios
,
dcb
+
2
);
if
(
nv
bios_rd
32
(
bios
,
dcb
+
4
)
==
0x4edcbdcb
)
{
u16
i2c
=
nv
bios_rd
16
(
bios
,
dcb
+
2
);
*
hdr
=
8
;
*
cnt
=
(
i2c
-
dcb
)
/
8
;
*
len
=
8
;
...
...
@@ -62,8 +62,8 @@ dcb_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
}
}
else
if
(
*
ver
>=
0x15
)
{
if
(
!
nv_memcmp
(
bios
,
dcb
-
7
,
"DEV_REC"
,
7
))
{
u16
i2c
=
nv
_ro
16
(
bios
,
dcb
+
2
);
if
(
!
nv
bios
_memcmp
(
bios
,
dcb
-
7
,
"DEV_REC"
,
7
))
{
u16
i2c
=
nv
bios_rd
16
(
bios
,
dcb
+
2
);
*
hdr
=
4
;
*
cnt
=
(
i2c
-
dcb
)
/
10
;
*
len
=
10
;
...
...
@@ -125,7 +125,7 @@ dcb_outp_parse(struct nvkm_bios *bios, u8 idx, u8 *ver, u8 *len,
memset
(
outp
,
0x00
,
sizeof
(
*
outp
));
if
(
dcb
)
{
if
(
*
ver
>=
0x20
)
{
u32
conn
=
nv
_ro
32
(
bios
,
dcb
+
0x00
);
u32
conn
=
nv
bios_rd
32
(
bios
,
dcb
+
0x00
);
outp
->
or
=
(
conn
&
0x0f000000
)
>>
24
;
outp
->
location
=
(
conn
&
0x00300000
)
>>
20
;
outp
->
bus
=
(
conn
&
0x000f0000
)
>>
16
;
...
...
@@ -139,7 +139,7 @@ dcb_outp_parse(struct nvkm_bios *bios, u8 idx, u8 *ver, u8 *len,
}
if
(
*
ver
>=
0x40
)
{
u32
conf
=
nv
_ro
32
(
bios
,
dcb
+
0x04
);
u32
conf
=
nv
bios_rd
32
(
bios
,
dcb
+
0x04
);
switch
(
outp
->
type
)
{
case
DCB_OUTPUT_DP
:
switch
(
conf
&
0x00e00000
)
{
...
...
@@ -213,14 +213,14 @@ dcb_outp_foreach(struct nvkm_bios *bios, void *data,
u16
outp
;
while
((
outp
=
dcb_outp
(
bios
,
++
idx
,
&
ver
,
&
len
)))
{
if
(
nv
_ro
32
(
bios
,
outp
)
==
0x00000000
)
if
(
nv
bios_rd
32
(
bios
,
outp
)
==
0x00000000
)
break
;
/* seen on an NV11 with DCB v1.5 */
if
(
nv
_ro
32
(
bios
,
outp
)
==
0xffffffff
)
if
(
nv
bios_rd
32
(
bios
,
outp
)
==
0xffffffff
)
break
;
/* seen on an NV17 with DCB v2.0 */
if
(
nv
_ro
08
(
bios
,
outp
)
==
DCB_OUTPUT_UNUSED
)
if
(
nv
bios_rd
08
(
bios
,
outp
)
==
DCB_OUTPUT_UNUSED
)
continue
;
if
(
nv
_ro
08
(
bios
,
outp
)
==
DCB_OUTPUT_EOL
)
if
(
nv
bios_rd
08
(
bios
,
outp
)
==
DCB_OUTPUT_EOL
)
break
;
ret
=
exec
(
bios
,
data
,
idx
,
outp
);
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/disp.c
View file @
7f5f518f
...
...
@@ -33,17 +33,17 @@ nvbios_disp_table(struct nvkm_bios *bios,
if
(
!
bit_entry
(
bios
,
'U'
,
&
U
))
{
if
(
U
.
version
==
1
)
{
u16
data
=
nv
_ro
16
(
bios
,
U
.
offset
);
u16
data
=
nv
bios_rd
16
(
bios
,
U
.
offset
);
if
(
data
)
{
*
ver
=
nv
_ro
08
(
bios
,
data
+
0x00
);
*
ver
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
switch
(
*
ver
)
{
case
0x20
:
case
0x21
:
case
0x22
:
*
hdr
=
nv
_ro
08
(
bios
,
data
+
0x01
);
*
len
=
nv
_ro
08
(
bios
,
data
+
0x02
);
*
cnt
=
nv
_ro
08
(
bios
,
data
+
0x03
);
*
sub
=
nv
_ro
08
(
bios
,
data
+
0x04
);
*
hdr
=
nv
bios_rd
08
(
bios
,
data
+
0x01
);
*
len
=
nv
bios_rd
08
(
bios
,
data
+
0x02
);
*
cnt
=
nv
bios_rd
08
(
bios
,
data
+
0x03
);
*
sub
=
nv
bios_rd
08
(
bios
,
data
+
0x04
);
return
data
;
default:
break
;
...
...
@@ -72,7 +72,7 @@ nvbios_disp_parse(struct nvkm_bios *bios, u8 idx, u8 *ver, u8 *len, u8 *sub,
{
u16
data
=
nvbios_disp_entry
(
bios
,
idx
,
ver
,
len
,
sub
);
if
(
data
&&
*
len
>=
2
)
{
info
->
data
=
nv
_ro
16
(
bios
,
data
+
0
);
info
->
data
=
nv
bios_rd
16
(
bios
,
data
+
0
);
return
data
;
}
return
0x0000
;
...
...
@@ -85,7 +85,7 @@ nvbios_outp_entry(struct nvkm_bios *bios, u8 idx,
struct
nvbios_disp
info
;
u16
data
=
nvbios_disp_parse
(
bios
,
idx
,
ver
,
len
,
hdr
,
&
info
);
if
(
data
)
{
*
cnt
=
nv
_ro
08
(
bios
,
info
.
data
+
0x05
);
*
cnt
=
nv
bios_rd
08
(
bios
,
info
.
data
+
0x05
);
*
len
=
0x06
;
data
=
info
.
data
;
}
...
...
@@ -98,15 +98,15 @@ nvbios_outp_parse(struct nvkm_bios *bios, u8 idx,
{
u16
data
=
nvbios_outp_entry
(
bios
,
idx
,
ver
,
hdr
,
cnt
,
len
);
if
(
data
&&
*
hdr
>=
0x0a
)
{
info
->
type
=
nv
_ro
16
(
bios
,
data
+
0x00
);
info
->
mask
=
nv
_ro
32
(
bios
,
data
+
0x02
);
info
->
type
=
nv
bios_rd
16
(
bios
,
data
+
0x00
);
info
->
mask
=
nv
bios_rd
32
(
bios
,
data
+
0x02
);
if
(
*
ver
<=
0x20
)
/* match any link */
info
->
mask
|=
0x00c0
;
info
->
script
[
0
]
=
nv
_ro
16
(
bios
,
data
+
0x06
);
info
->
script
[
1
]
=
nv
_ro
16
(
bios
,
data
+
0x08
);
info
->
script
[
0
]
=
nv
bios_rd
16
(
bios
,
data
+
0x06
);
info
->
script
[
1
]
=
nv
bios_rd
16
(
bios
,
data
+
0x08
);
info
->
script
[
2
]
=
0x0000
;
if
(
*
hdr
>=
0x0c
)
info
->
script
[
2
]
=
nv
_ro
16
(
bios
,
data
+
0x0a
);
info
->
script
[
2
]
=
nv
bios_rd
16
(
bios
,
data
+
0x0a
);
return
data
;
}
return
0x0000
;
...
...
@@ -141,9 +141,9 @@ nvbios_ocfg_parse(struct nvkm_bios *bios, u16 outp, u8 idx,
{
u16
data
=
nvbios_ocfg_entry
(
bios
,
outp
,
idx
,
ver
,
hdr
,
cnt
,
len
);
if
(
data
)
{
info
->
match
=
nv
_ro
16
(
bios
,
data
+
0x00
);
info
->
clkcmp
[
0
]
=
nv
_ro
16
(
bios
,
data
+
0x02
);
info
->
clkcmp
[
1
]
=
nv
_ro
16
(
bios
,
data
+
0x04
);
info
->
match
=
nv
bios_rd
16
(
bios
,
data
+
0x00
);
info
->
clkcmp
[
0
]
=
nv
bios_rd
16
(
bios
,
data
+
0x02
);
info
->
clkcmp
[
1
]
=
nv
bios_rd
16
(
bios
,
data
+
0x04
);
}
return
data
;
}
...
...
@@ -164,8 +164,8 @@ u16
nvbios_oclk_match
(
struct
nvkm_bios
*
bios
,
u16
cmp
,
u32
khz
)
{
while
(
cmp
)
{
if
(
khz
/
10
>=
nv
_ro
16
(
bios
,
cmp
+
0x00
))
return
nv
_ro
16
(
bios
,
cmp
+
0x02
);
if
(
khz
/
10
>=
nv
bios_rd
16
(
bios
,
cmp
+
0x00
))
return
nv
bios_rd
16
(
bios
,
cmp
+
0x02
);
cmp
+=
0x04
;
}
return
0x0000
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/dp.c
View file @
7f5f518f
...
...
@@ -32,17 +32,17 @@ nvbios_dp_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
if
(
!
bit_entry
(
bios
,
'd'
,
&
d
))
{
if
(
d
.
version
==
1
&&
d
.
length
>=
2
)
{
u16
data
=
nv
_ro
16
(
bios
,
d
.
offset
);
u16
data
=
nv
bios_rd
16
(
bios
,
d
.
offset
);
if
(
data
)
{
*
ver
=
nv
_ro
08
(
bios
,
data
+
0x00
);
*
ver
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
switch
(
*
ver
)
{
case
0x21
:
case
0x30
:
case
0x40
:
case
0x41
:
*
hdr
=
nv
_ro
08
(
bios
,
data
+
0x01
);
*
len
=
nv
_ro
08
(
bios
,
data
+
0x02
);
*
cnt
=
nv
_ro
08
(
bios
,
data
+
0x03
);
*
hdr
=
nv
bios_rd
08
(
bios
,
data
+
0x01
);
*
len
=
nv
bios_rd
08
(
bios
,
data
+
0x02
);
*
cnt
=
nv
bios_rd
08
(
bios
,
data
+
0x03
);
return
data
;
default:
break
;
...
...
@@ -60,17 +60,17 @@ nvbios_dpout_entry(struct nvkm_bios *bios, u8 idx,
{
u16
data
=
nvbios_dp_table
(
bios
,
ver
,
hdr
,
cnt
,
len
);
if
(
data
&&
idx
<
*
cnt
)
{
u16
outp
=
nv
_ro
16
(
bios
,
data
+
*
hdr
+
idx
*
*
len
);
u16
outp
=
nv
bios_rd
16
(
bios
,
data
+
*
hdr
+
idx
*
*
len
);
switch
(
*
ver
*
!!
outp
)
{
case
0x21
:
case
0x30
:
*
hdr
=
nv
_ro
08
(
bios
,
data
+
0x04
);
*
len
=
nv
_ro
08
(
bios
,
data
+
0x05
);
*
cnt
=
nv
_ro
08
(
bios
,
outp
+
0x04
);
*
hdr
=
nv
bios_rd
08
(
bios
,
data
+
0x04
);
*
len
=
nv
bios_rd
08
(
bios
,
data
+
0x05
);
*
cnt
=
nv
bios_rd
08
(
bios
,
outp
+
0x04
);
break
;
case
0x40
:
case
0x41
:
*
hdr
=
nv
_ro
08
(
bios
,
data
+
0x04
);
*
hdr
=
nv
bios_rd
08
(
bios
,
data
+
0x04
);
*
cnt
=
0
;
*
len
=
0
;
break
;
...
...
@@ -91,31 +91,31 @@ nvbios_dpout_parse(struct nvkm_bios *bios, u8 idx,
u16
data
=
nvbios_dpout_entry
(
bios
,
idx
,
ver
,
hdr
,
cnt
,
len
);
memset
(
info
,
0x00
,
sizeof
(
*
info
));
if
(
data
&&
*
ver
)
{
info
->
type
=
nv
_ro
16
(
bios
,
data
+
0x00
);
info
->
mask
=
nv
_ro
16
(
bios
,
data
+
0x02
);
info
->
type
=
nv
bios_rd
16
(
bios
,
data
+
0x00
);
info
->
mask
=
nv
bios_rd
16
(
bios
,
data
+
0x02
);
switch
(
*
ver
)
{
case
0x21
:
case
0x30
:
info
->
flags
=
nv
_ro
08
(
bios
,
data
+
0x05
);
info
->
script
[
0
]
=
nv
_ro
16
(
bios
,
data
+
0x06
);
info
->
script
[
1
]
=
nv
_ro
16
(
bios
,
data
+
0x08
);
info
->
lnkcmp
=
nv
_ro
16
(
bios
,
data
+
0x0a
);
info
->
flags
=
nv
bios_rd
08
(
bios
,
data
+
0x05
);
info
->
script
[
0
]
=
nv
bios_rd
16
(
bios
,
data
+
0x06
);
info
->
script
[
1
]
=
nv
bios_rd
16
(
bios
,
data
+
0x08
);
info
->
lnkcmp
=
nv
bios_rd
16
(
bios
,
data
+
0x0a
);
if
(
*
len
>=
0x0f
)
{
info
->
script
[
2
]
=
nv
_ro
16
(
bios
,
data
+
0x0c
);
info
->
script
[
3
]
=
nv
_ro
16
(
bios
,
data
+
0x0e
);
info
->
script
[
2
]
=
nv
bios_rd
16
(
bios
,
data
+
0x0c
);
info
->
script
[
3
]
=
nv
bios_rd
16
(
bios
,
data
+
0x0e
);
}
if
(
*
len
>=
0x11
)
info
->
script
[
4
]
=
nv
_ro
16
(
bios
,
data
+
0x10
);
info
->
script
[
4
]
=
nv
bios_rd
16
(
bios
,
data
+
0x10
);
break
;
case
0x40
:
case
0x41
:
info
->
flags
=
nv
_ro
08
(
bios
,
data
+
0x04
);
info
->
script
[
0
]
=
nv
_ro
16
(
bios
,
data
+
0x05
);
info
->
script
[
1
]
=
nv
_ro
16
(
bios
,
data
+
0x07
);
info
->
lnkcmp
=
nv
_ro
16
(
bios
,
data
+
0x09
);
info
->
script
[
2
]
=
nv
_ro
16
(
bios
,
data
+
0x0b
);
info
->
script
[
3
]
=
nv
_ro
16
(
bios
,
data
+
0x0d
);
info
->
script
[
4
]
=
nv
_ro
16
(
bios
,
data
+
0x0f
);
info
->
flags
=
nv
bios_rd
08
(
bios
,
data
+
0x04
);
info
->
script
[
0
]
=
nv
bios_rd
16
(
bios
,
data
+
0x05
);
info
->
script
[
1
]
=
nv
bios_rd
16
(
bios
,
data
+
0x07
);
info
->
lnkcmp
=
nv
bios_rd
16
(
bios
,
data
+
0x09
);
info
->
script
[
2
]
=
nv
bios_rd
16
(
bios
,
data
+
0x0b
);
info
->
script
[
3
]
=
nv
bios_rd
16
(
bios
,
data
+
0x0d
);
info
->
script
[
4
]
=
nv
bios_rd
16
(
bios
,
data
+
0x0f
);
break
;
default:
data
=
0x0000
;
...
...
@@ -147,9 +147,9 @@ nvbios_dpcfg_entry(struct nvkm_bios *bios, u16 outp, u8 idx,
if
(
*
ver
>=
0x40
)
{
outp
=
nvbios_dp_table
(
bios
,
ver
,
hdr
,
cnt
,
len
);
*
hdr
=
*
hdr
+
(
*
len
*
*
cnt
);
*
len
=
nv
_ro
08
(
bios
,
outp
+
0x06
);
*
cnt
=
nv
_ro
08
(
bios
,
outp
+
0x07
)
*
nv
_ro
08
(
bios
,
outp
+
0x05
);
*
len
=
nv
bios_rd
08
(
bios
,
outp
+
0x06
);
*
cnt
=
nv
bios_rd
08
(
bios
,
outp
+
0x07
)
*
nv
bios_rd
08
(
bios
,
outp
+
0x05
);
}
if
(
idx
<
*
cnt
)
...
...
@@ -168,17 +168,17 @@ nvbios_dpcfg_parse(struct nvkm_bios *bios, u16 outp, u8 idx,
if
(
data
)
{
switch
(
*
ver
)
{
case
0x21
:
info
->
dc
=
nv
_ro
08
(
bios
,
data
+
0x02
);
info
->
pe
=
nv
_ro
08
(
bios
,
data
+
0x03
);
info
->
tx_pu
=
nv
_ro
08
(
bios
,
data
+
0x04
);
info
->
dc
=
nv
bios_rd
08
(
bios
,
data
+
0x02
);
info
->
pe
=
nv
bios_rd
08
(
bios
,
data
+
0x03
);
info
->
tx_pu
=
nv
bios_rd
08
(
bios
,
data
+
0x04
);
break
;
case
0x30
:
case
0x40
:
case
0x41
:
info
->
pc
=
nv
_ro
08
(
bios
,
data
+
0x00
);
info
->
dc
=
nv
_ro
08
(
bios
,
data
+
0x01
);
info
->
pe
=
nv
_ro
08
(
bios
,
data
+
0x02
);
info
->
tx_pu
=
nv
_ro
08
(
bios
,
data
+
0x03
);
info
->
pc
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
info
->
dc
=
nv
bios_rd
08
(
bios
,
data
+
0x01
);
info
->
pe
=
nv
bios_rd
08
(
bios
,
data
+
0x02
);
info
->
tx_pu
=
nv
bios_rd
08
(
bios
,
data
+
0x03
);
break
;
default:
data
=
0x0000
;
...
...
@@ -200,12 +200,12 @@ nvbios_dpcfg_match(struct nvkm_bios *bios, u16 outp, u8 pc, u8 vs, u8 pe,
const
u8
vsoff
[]
=
{
0
,
4
,
7
,
9
};
idx
=
(
pc
*
10
)
+
vsoff
[
vs
]
+
pe
;
if
(
*
ver
>=
0x40
&&
*
hdr
>=
0x12
)
idx
+=
nv
_ro
08
(
bios
,
outp
+
0x11
)
*
40
;
idx
+=
nv
bios_rd
08
(
bios
,
outp
+
0x11
)
*
40
;
}
else
{
while
((
data
=
nvbios_dpcfg_entry
(
bios
,
outp
,
++
idx
,
ver
,
hdr
,
cnt
,
len
)))
{
if
(
nv
_ro
08
(
bios
,
data
+
0x00
)
==
vs
&&
nv
_ro
08
(
bios
,
data
+
0x01
)
==
pe
)
if
(
nv
bios_rd
08
(
bios
,
data
+
0x00
)
==
vs
&&
nv
bios_rd
08
(
bios
,
data
+
0x01
)
==
pe
)
break
;
}
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/extdev.c
View file @
7f5f518f
...
...
@@ -35,14 +35,14 @@ extdev_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *len, u8 *cnt)
if
(
!
dcb
||
(
dcb_ver
!=
0x30
&&
dcb_ver
!=
0x40
))
return
0x0000
;
extdev
=
nv
_ro
16
(
bios
,
dcb
+
18
);
extdev
=
nv
bios_rd
16
(
bios
,
dcb
+
18
);
if
(
!
extdev
)
return
0x0000
;
*
ver
=
nv
_ro
08
(
bios
,
extdev
+
0
);
*
hdr
=
nv
_ro
08
(
bios
,
extdev
+
1
);
*
cnt
=
nv
_ro
08
(
bios
,
extdev
+
2
);
*
len
=
nv
_ro
08
(
bios
,
extdev
+
3
);
*
ver
=
nv
bios_rd
08
(
bios
,
extdev
+
0
);
*
hdr
=
nv
bios_rd
08
(
bios
,
extdev
+
1
);
*
cnt
=
nv
bios_rd
08
(
bios
,
extdev
+
2
);
*
len
=
nv
bios_rd
08
(
bios
,
extdev
+
3
);
return
extdev
+
*
hdr
;
}
...
...
@@ -60,9 +60,9 @@ static void
extdev_parse_entry
(
struct
nvkm_bios
*
bios
,
u16
offset
,
struct
nvbios_extdev_func
*
entry
)
{
entry
->
type
=
nv
_ro
08
(
bios
,
offset
+
0
);
entry
->
addr
=
nv
_ro
08
(
bios
,
offset
+
1
);
entry
->
bus
=
(
nv
_ro
08
(
bios
,
offset
+
2
)
>>
4
)
&
1
;
entry
->
type
=
nv
bios_rd
08
(
bios
,
offset
+
0
);
entry
->
addr
=
nv
bios_rd
08
(
bios
,
offset
+
1
);
entry
->
bus
=
(
nv
bios_rd
08
(
bios
,
offset
+
2
)
>>
4
)
&
1
;
}
int
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/fan.c
View file @
7f5f518f
...
...
@@ -33,15 +33,15 @@ nvbios_fan_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
if
(
!
bit_entry
(
bios
,
'P'
,
&
bit_P
))
{
if
(
bit_P
.
version
==
2
&&
bit_P
.
length
>=
0x5a
)
fan
=
nv
_ro
16
(
bios
,
bit_P
.
offset
+
0x58
);
fan
=
nv
bios_rd
16
(
bios
,
bit_P
.
offset
+
0x58
);
if
(
fan
)
{
*
ver
=
nv
_ro
08
(
bios
,
fan
+
0
);
*
ver
=
nv
bios_rd
08
(
bios
,
fan
+
0
);
switch
(
*
ver
)
{
case
0x10
:
*
hdr
=
nv
_ro
08
(
bios
,
fan
+
1
);
*
len
=
nv
_ro
08
(
bios
,
fan
+
2
);
*
cnt
=
nv
_ro
08
(
bios
,
fan
+
3
);
*
hdr
=
nv
bios_rd
08
(
bios
,
fan
+
1
);
*
len
=
nv
bios_rd
08
(
bios
,
fan
+
2
);
*
cnt
=
nv
bios_rd
08
(
bios
,
fan
+
3
);
return
fan
;
default:
break
;
...
...
@@ -69,7 +69,7 @@ nvbios_fan_parse(struct nvkm_bios *bios, struct nvbios_therm_fan *fan)
u16
data
=
nvbios_fan_entry
(
bios
,
0
,
&
ver
,
&
hdr
,
&
cnt
,
&
len
);
if
(
data
)
{
u8
type
=
nv
_ro
08
(
bios
,
data
+
0x00
);
u8
type
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
switch
(
type
)
{
case
0
:
fan
->
type
=
NVBIOS_THERM_FAN_TOGGLE
;
...
...
@@ -83,10 +83,10 @@ nvbios_fan_parse(struct nvkm_bios *bios, struct nvbios_therm_fan *fan)
fan
->
type
=
NVBIOS_THERM_FAN_UNK
;
}
fan
->
min_duty
=
nv
_ro
08
(
bios
,
data
+
0x02
);
fan
->
max_duty
=
nv
_ro
08
(
bios
,
data
+
0x03
);
fan
->
min_duty
=
nv
bios_rd
08
(
bios
,
data
+
0x02
);
fan
->
max_duty
=
nv
bios_rd
08
(
bios
,
data
+
0x03
);
fan
->
pwm_freq
=
nv
_ro
32
(
bios
,
data
+
0x0b
)
&
0xffffff
;
fan
->
pwm_freq
=
nv
bios_rd
32
(
bios
,
data
+
0x0b
)
&
0xffffff
;
}
return
data
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/gpio.c
View file @
7f5f518f
...
...
@@ -33,22 +33,22 @@ dcb_gpio_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
u16
dcb
=
dcb_table
(
bios
,
ver
,
hdr
,
cnt
,
len
);
if
(
dcb
)
{
if
(
*
ver
>=
0x30
&&
*
hdr
>=
0x0c
)
data
=
nv
_ro
16
(
bios
,
dcb
+
0x0a
);
data
=
nv
bios_rd
16
(
bios
,
dcb
+
0x0a
);
else
if
(
*
ver
>=
0x22
&&
nv
_ro
08
(
bios
,
dcb
-
1
)
>=
0x13
)
data
=
nv
_ro
16
(
bios
,
dcb
-
0x0f
);
if
(
*
ver
>=
0x22
&&
nv
bios_rd
08
(
bios
,
dcb
-
1
)
>=
0x13
)
data
=
nv
bios_rd
16
(
bios
,
dcb
-
0x0f
);
if
(
data
)
{
*
ver
=
nv
_ro
08
(
bios
,
data
+
0x00
);
*
ver
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
if
(
*
ver
<
0x30
)
{
*
hdr
=
3
;
*
cnt
=
nv
_ro
08
(
bios
,
data
+
0x02
);
*
len
=
nv
_ro
08
(
bios
,
data
+
0x01
);
*
cnt
=
nv
bios_rd
08
(
bios
,
data
+
0x02
);
*
len
=
nv
bios_rd
08
(
bios
,
data
+
0x01
);
}
else
if
(
*
ver
<=
0x41
)
{
*
hdr
=
nv
_ro
08
(
bios
,
data
+
0x01
);
*
cnt
=
nv
_ro
08
(
bios
,
data
+
0x02
);
*
len
=
nv
_ro
08
(
bios
,
data
+
0x03
);
*
hdr
=
nv
bios_rd
08
(
bios
,
data
+
0x01
);
*
cnt
=
nv
bios_rd
08
(
bios
,
data
+
0x02
);
*
len
=
nv
bios_rd
08
(
bios
,
data
+
0x03
);
}
else
{
data
=
0x0000
;
}
...
...
@@ -81,7 +81,7 @@ dcb_gpio_parse(struct nvkm_bios *bios, int idx, int ent, u8 *ver, u8 *len,
u16
data
=
dcb_gpio_entry
(
bios
,
idx
,
ent
,
ver
,
len
);
if
(
data
)
{
if
(
*
ver
<
0x40
)
{
u16
info
=
nv
_ro
16
(
bios
,
data
);
u16
info
=
nv
bios_rd
16
(
bios
,
data
);
*
gpio
=
(
struct
dcb_gpio_func
)
{
.
line
=
(
info
&
0x001f
)
>>
0
,
.
func
=
(
info
&
0x07e0
)
>>
5
,
...
...
@@ -91,7 +91,7 @@ dcb_gpio_parse(struct nvkm_bios *bios, int idx, int ent, u8 *ver, u8 *len,
};
}
else
if
(
*
ver
<
0x41
)
{
u32
info
=
nv
_ro
32
(
bios
,
data
);
u32
info
=
nv
bios_rd
32
(
bios
,
data
);
*
gpio
=
(
struct
dcb_gpio_func
)
{
.
line
=
(
info
&
0x0000001f
)
>>
0
,
.
func
=
(
info
&
0x0000ff00
)
>>
8
,
...
...
@@ -100,8 +100,8 @@ dcb_gpio_parse(struct nvkm_bios *bios, int idx, int ent, u8 *ver, u8 *len,
.
param
=
!!
(
info
&
0x80000000
),
};
}
else
{
u32
info
=
nv
_ro
32
(
bios
,
data
+
0
);
u8
info1
=
nv
_ro
32
(
bios
,
data
+
4
);
u32
info
=
nv
bios_rd
32
(
bios
,
data
+
0
);
u8
info1
=
nv
bios_rd
32
(
bios
,
data
+
4
);
*
gpio
=
(
struct
dcb_gpio_func
)
{
.
line
=
(
info
&
0x0000003f
)
>>
0
,
.
func
=
(
info
&
0x0000ff00
)
>>
8
,
...
...
@@ -131,8 +131,8 @@ dcb_gpio_match(struct nvkm_bios *bios, int idx, u8 func, u8 line,
/* DCB 2.2, fixed TVDAC GPIO data */
if
((
data
=
dcb_table
(
bios
,
ver
,
&
hdr
,
&
cnt
,
len
)))
{
if
(
*
ver
>=
0x22
&&
*
ver
<
0x30
&&
func
==
DCB_GPIO_TVDAC0
)
{
u8
conf
=
nv
_ro
08
(
bios
,
data
-
5
);
u8
addr
=
nv
_ro
08
(
bios
,
data
-
4
);
u8
conf
=
nv
bios_rd
08
(
bios
,
data
-
5
);
u8
addr
=
nv
bios_rd
08
(
bios
,
data
-
4
);
if
(
conf
&
0x01
)
{
*
gpio
=
(
struct
dcb_gpio_func
)
{
.
func
=
DCB_GPIO_TVDAC0
,
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/i2c.c
View file @
7f5f518f
...
...
@@ -32,9 +32,9 @@ dcb_i2c_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
u16
dcb
=
dcb_table
(
bios
,
ver
,
hdr
,
cnt
,
len
);
if
(
dcb
)
{
if
(
*
ver
>=
0x15
)
i2c
=
nv
_ro
16
(
bios
,
dcb
+
2
);
i2c
=
nv
bios_rd
16
(
bios
,
dcb
+
2
);
if
(
*
ver
>=
0x30
)
i2c
=
nv
_ro
16
(
bios
,
dcb
+
4
);
i2c
=
nv
bios_rd
16
(
bios
,
dcb
+
4
);
}
if
(
i2c
&&
*
ver
>=
0x42
)
{
...
...
@@ -43,10 +43,10 @@ dcb_i2c_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
}
if
(
i2c
&&
*
ver
>=
0x30
)
{
*
ver
=
nv
_ro
08
(
bios
,
i2c
+
0
);
*
hdr
=
nv
_ro
08
(
bios
,
i2c
+
1
);
*
cnt
=
nv
_ro
08
(
bios
,
i2c
+
2
);
*
len
=
nv
_ro
08
(
bios
,
i2c
+
3
);
*
ver
=
nv
bios_rd
08
(
bios
,
i2c
+
0
);
*
hdr
=
nv
bios_rd
08
(
bios
,
i2c
+
1
);
*
cnt
=
nv
bios_rd
08
(
bios
,
i2c
+
2
);
*
len
=
nv
bios_rd
08
(
bios
,
i2c
+
3
);
}
else
{
*
ver
=
*
ver
;
/* use DCB version */
*
hdr
=
0
;
...
...
@@ -75,7 +75,7 @@ dcb_i2c_parse(struct nvkm_bios *bios, u8 idx, struct dcb_i2c_entry *info)
u16
ent
=
dcb_i2c_entry
(
bios
,
idx
,
&
ver
,
&
len
);
if
(
ent
)
{
if
(
ver
>=
0x41
)
{
u32
ent_value
=
nv
_ro
32
(
bios
,
ent
);
u32
ent_value
=
nv
bios_rd
32
(
bios
,
ent
);
u8
i2c_port
=
(
ent_value
>>
27
)
&
0x1f
;
u8
dpaux_port
=
(
ent_value
>>
22
)
&
0x1f
;
/* value 0x1f means unused according to DCB 4.x spec */
...
...
@@ -85,9 +85,9 @@ dcb_i2c_parse(struct nvkm_bios *bios, u8 idx, struct dcb_i2c_entry *info)
info
->
type
=
DCB_I2C_PMGR
;
}
else
if
(
ver
>=
0x30
)
{
info
->
type
=
nv
_ro
08
(
bios
,
ent
+
0x03
);
info
->
type
=
nv
bios_rd
08
(
bios
,
ent
+
0x03
);
}
else
{
info
->
type
=
nv
_ro
08
(
bios
,
ent
+
0x03
)
&
0x07
;
info
->
type
=
nv
bios_rd
08
(
bios
,
ent
+
0x03
)
&
0x07
;
if
(
info
->
type
==
0x07
)
info
->
type
=
DCB_I2C_UNUSED
;
}
...
...
@@ -99,27 +99,27 @@ dcb_i2c_parse(struct nvkm_bios *bios, u8 idx, struct dcb_i2c_entry *info)
switch
(
info
->
type
)
{
case
DCB_I2C_NV04_BIT
:
info
->
drive
=
nv
_ro
08
(
bios
,
ent
+
0
);
info
->
sense
=
nv
_ro
08
(
bios
,
ent
+
1
);
info
->
drive
=
nv
bios_rd
08
(
bios
,
ent
+
0
);
info
->
sense
=
nv
bios_rd
08
(
bios
,
ent
+
1
);
return
0
;
case
DCB_I2C_NV4E_BIT
:
info
->
drive
=
nv
_ro
08
(
bios
,
ent
+
1
);
info
->
drive
=
nv
bios_rd
08
(
bios
,
ent
+
1
);
return
0
;
case
DCB_I2C_NVIO_BIT
:
info
->
drive
=
nv
_ro
08
(
bios
,
ent
+
0
)
&
0x0f
;
if
(
nv
_ro
08
(
bios
,
ent
+
1
)
&
0x01
)
info
->
share
=
nv
_ro
08
(
bios
,
ent
+
1
)
>>
1
;
info
->
drive
=
nv
bios_rd
08
(
bios
,
ent
+
0
)
&
0x0f
;
if
(
nv
bios_rd
08
(
bios
,
ent
+
1
)
&
0x01
)
info
->
share
=
nv
bios_rd
08
(
bios
,
ent
+
1
)
>>
1
;
return
0
;
case
DCB_I2C_NVIO_AUX
:
info
->
auxch
=
nv
_ro
08
(
bios
,
ent
+
0
)
&
0x0f
;
if
(
nv
_ro
08
(
bios
,
ent
+
1
)
&
0x01
)
info
->
auxch
=
nv
bios_rd
08
(
bios
,
ent
+
0
)
&
0x0f
;
if
(
nv
bios_rd
08
(
bios
,
ent
+
1
)
&
0x01
)
info
->
share
=
info
->
auxch
;
return
0
;
case
DCB_I2C_PMGR
:
info
->
drive
=
(
nv
_ro
16
(
bios
,
ent
+
0
)
&
0x01f
)
>>
0
;
info
->
drive
=
(
nv
bios_rd
16
(
bios
,
ent
+
0
)
&
0x01f
)
>>
0
;
if
(
info
->
drive
==
0x1f
)
info
->
drive
=
DCB_I2C_UNUSED
;
info
->
auxch
=
(
nv
_ro
16
(
bios
,
ent
+
0
)
&
0x3e0
)
>>
5
;
info
->
auxch
=
(
nv
bios_rd
16
(
bios
,
ent
+
0
)
&
0x3e0
)
>>
5
;
if
(
info
->
auxch
==
0x1f
)
info
->
auxch
=
DCB_I2C_UNUSED
;
info
->
share
=
info
->
auxch
;
...
...
@@ -137,21 +137,21 @@ dcb_i2c_parse(struct nvkm_bios *bios, u8 idx, struct dcb_i2c_entry *info)
/* BMP (from v4.0 has i2c info in the structure, it's in a
* fixed location on earlier VBIOS
*/
if
(
nv
_ro
08
(
bios
,
bios
->
bmp_offset
+
5
)
<
4
)
if
(
nv
bios_rd
08
(
bios
,
bios
->
bmp_offset
+
5
)
<
4
)
ent
=
0x0048
;
else
ent
=
0x0036
+
bios
->
bmp_offset
;
if
(
idx
==
0
)
{
info
->
drive
=
nv
_ro
08
(
bios
,
ent
+
4
);
info
->
drive
=
nv
bios_rd
08
(
bios
,
ent
+
4
);
if
(
!
info
->
drive
)
info
->
drive
=
0x3f
;
info
->
sense
=
nv
_ro
08
(
bios
,
ent
+
5
);
info
->
sense
=
nv
bios_rd
08
(
bios
,
ent
+
5
);
if
(
!
info
->
sense
)
info
->
sense
=
0x3e
;
}
else
if
(
idx
==
1
)
{
info
->
drive
=
nv
_ro
08
(
bios
,
ent
+
6
);
info
->
drive
=
nv
bios_rd
08
(
bios
,
ent
+
6
);
if
(
!
info
->
drive
)
info
->
drive
=
0x37
;
info
->
sense
=
nv
_ro
08
(
bios
,
ent
+
7
);
info
->
sense
=
nv
bios_rd
08
(
bios
,
ent
+
7
);
if
(
!
info
->
sense
)
info
->
sense
=
0x36
;
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/image.c
View file @
7f5f518f
...
...
@@ -36,7 +36,7 @@ nvbios_imagen(struct nvkm_bios *bios, struct nvbios_image *image)
u16
hdr
;
u32
data
;
switch
((
data
=
nv
_ro
16
(
bios
,
image
->
base
+
0x00
)))
{
switch
((
data
=
nv
bios_rd
16
(
bios
,
image
->
base
+
0x00
)))
{
case
0xaa55
:
case
0xbb77
:
case
0x4e56
:
/* NV */
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
View file @
7f5f518f
...
...
@@ -374,7 +374,7 @@ init_table_(struct nvbios_init *init, u16 offset, const char *name)
u16
len
,
data
=
init_table
(
bios
,
&
len
);
if
(
data
)
{
if
(
len
>=
offset
+
2
)
{
data
=
nv
_ro
16
(
bios
,
data
+
offset
);
data
=
nv
bios_rd
16
(
bios
,
data
+
offset
);
if
(
data
)
return
data
;
...
...
@@ -410,12 +410,12 @@ init_script(struct nvkm_bios *bios, int index)
return
0x0000
;
data
=
bios
->
bmp_offset
+
(
bmp_ver
<
0x0200
?
14
:
18
);
return
nv
_ro
16
(
bios
,
data
+
(
index
*
2
));
return
nv
bios_rd
16
(
bios
,
data
+
(
index
*
2
));
}
data
=
init_script_table
(
&
init
);
if
(
data
)
return
nv
_ro
16
(
bios
,
data
+
(
index
*
2
));
return
nv
bios_rd
16
(
bios
,
data
+
(
index
*
2
));
return
0x0000
;
}
...
...
@@ -425,7 +425,7 @@ init_unknown_script(struct nvkm_bios *bios)
{
u16
len
,
data
=
init_table
(
bios
,
&
len
);
if
(
data
&&
len
>=
16
)
return
nv
_ro
16
(
bios
,
data
+
14
);
return
nv
bios_rd
16
(
bios
,
data
+
14
);
return
0x0000
;
}
...
...
@@ -457,9 +457,9 @@ init_xlat_(struct nvbios_init *init, u8 index, u8 offset)
struct
nvkm_bios
*
bios
=
init
->
bios
;
u16
table
=
init_xlat_table
(
init
);
if
(
table
)
{
u16
data
=
nv
_ro
16
(
bios
,
table
+
(
index
*
2
));
u16
data
=
nv
bios_rd
16
(
bios
,
table
+
(
index
*
2
));
if
(
data
)
return
nv
_ro
08
(
bios
,
data
+
offset
);
return
nv
bios_rd
08
(
bios
,
data
+
offset
);
warn
(
"xlat table pointer %d invalid
\n
"
,
index
);
}
return
0x00
;
...
...
@@ -475,9 +475,9 @@ init_condition_met(struct nvbios_init *init, u8 cond)
struct
nvkm_bios
*
bios
=
init
->
bios
;
u16
table
=
init_condition_table
(
init
);
if
(
table
)
{
u32
reg
=
nv
_ro
32
(
bios
,
table
+
(
cond
*
12
)
+
0
);
u32
msk
=
nv
_ro
32
(
bios
,
table
+
(
cond
*
12
)
+
4
);
u32
val
=
nv
_ro
32
(
bios
,
table
+
(
cond
*
12
)
+
8
);
u32
reg
=
nv
bios_rd
32
(
bios
,
table
+
(
cond
*
12
)
+
0
);
u32
msk
=
nv
bios_rd
32
(
bios
,
table
+
(
cond
*
12
)
+
4
);
u32
val
=
nv
bios_rd
32
(
bios
,
table
+
(
cond
*
12
)
+
8
);
trace
(
"
\t
[0x%02x] (R[0x%06x] & 0x%08x) == 0x%08x
\n
"
,
cond
,
reg
,
msk
,
val
);
return
(
init_rd32
(
init
,
reg
)
&
msk
)
==
val
;
...
...
@@ -491,10 +491,10 @@ init_io_condition_met(struct nvbios_init *init, u8 cond)
struct
nvkm_bios
*
bios
=
init
->
bios
;
u16
table
=
init_io_condition_table
(
init
);
if
(
table
)
{
u16
port
=
nv
_ro
16
(
bios
,
table
+
(
cond
*
5
)
+
0
);
u8
index
=
nv
_ro
08
(
bios
,
table
+
(
cond
*
5
)
+
2
);
u8
mask
=
nv
_ro
08
(
bios
,
table
+
(
cond
*
5
)
+
3
);
u8
value
=
nv
_ro
08
(
bios
,
table
+
(
cond
*
5
)
+
4
);
u16
port
=
nv
bios_rd
16
(
bios
,
table
+
(
cond
*
5
)
+
0
);
u8
index
=
nv
bios_rd
08
(
bios
,
table
+
(
cond
*
5
)
+
2
);
u8
mask
=
nv
bios_rd
08
(
bios
,
table
+
(
cond
*
5
)
+
3
);
u8
value
=
nv
bios_rd
08
(
bios
,
table
+
(
cond
*
5
)
+
4
);
trace
(
"
\t
[0x%02x] (0x%04x[0x%02x] & 0x%02x) == 0x%02x
\n
"
,
cond
,
port
,
index
,
mask
,
value
);
return
(
init_rdvgai
(
init
,
port
,
index
)
&
mask
)
==
value
;
...
...
@@ -508,15 +508,15 @@ init_io_flag_condition_met(struct nvbios_init *init, u8 cond)
struct
nvkm_bios
*
bios
=
init
->
bios
;
u16
table
=
init_io_flag_condition_table
(
init
);
if
(
table
)
{
u16
port
=
nv
_ro
16
(
bios
,
table
+
(
cond
*
9
)
+
0
);
u8
index
=
nv
_ro
08
(
bios
,
table
+
(
cond
*
9
)
+
2
);
u8
mask
=
nv
_ro
08
(
bios
,
table
+
(
cond
*
9
)
+
3
);
u8
shift
=
nv
_ro
08
(
bios
,
table
+
(
cond
*
9
)
+
4
);
u16
data
=
nv
_ro
16
(
bios
,
table
+
(
cond
*
9
)
+
5
);
u8
dmask
=
nv
_ro
08
(
bios
,
table
+
(
cond
*
9
)
+
7
);
u8
value
=
nv
_ro
08
(
bios
,
table
+
(
cond
*
9
)
+
8
);
u16
port
=
nv
bios_rd
16
(
bios
,
table
+
(
cond
*
9
)
+
0
);
u8
index
=
nv
bios_rd
08
(
bios
,
table
+
(
cond
*
9
)
+
2
);
u8
mask
=
nv
bios_rd
08
(
bios
,
table
+
(
cond
*
9
)
+
3
);
u8
shift
=
nv
bios_rd
08
(
bios
,
table
+
(
cond
*
9
)
+
4
);
u16
data
=
nv
bios_rd
16
(
bios
,
table
+
(
cond
*
9
)
+
5
);
u8
dmask
=
nv
bios_rd
08
(
bios
,
table
+
(
cond
*
9
)
+
7
);
u8
value
=
nv
bios_rd
08
(
bios
,
table
+
(
cond
*
9
)
+
8
);
u8
ioval
=
(
init_rdvgai
(
init
,
port
,
index
)
&
mask
)
>>
shift
;
return
(
nv
_ro
08
(
bios
,
data
+
ioval
)
&
dmask
)
==
value
;
return
(
nv
bios_rd
08
(
bios
,
data
+
ioval
)
&
dmask
)
==
value
;
}
return
false
;
}
...
...
@@ -576,7 +576,7 @@ init_tmds_reg(struct nvbios_init *init, u8 tmds)
static
void
init_reserved
(
struct
nvbios_init
*
init
)
{
u8
opcode
=
nv
_ro
08
(
init
->
bios
,
init
->
offset
);
u8
opcode
=
nv
bios_rd
08
(
init
->
bios
,
init
->
offset
);
u8
length
,
i
;
switch
(
opcode
)
{
...
...
@@ -590,7 +590,7 @@ init_reserved(struct nvbios_init *init)
trace
(
"RESERVED 0x%02x
\t
"
,
opcode
);
for
(
i
=
1
;
i
<
length
;
i
++
)
cont
(
" 0x%02x"
,
nv
_ro
08
(
init
->
bios
,
init
->
offset
+
i
));
cont
(
" 0x%02x"
,
nv
bios_rd
08
(
init
->
bios
,
init
->
offset
+
i
));
cont
(
"
\n
"
);
init
->
offset
+=
length
;
}
...
...
@@ -614,12 +614,12 @@ static void
init_io_restrict_prog
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u16
port
=
nv
_ro
16
(
bios
,
init
->
offset
+
1
);
u8
index
=
nv
_ro
08
(
bios
,
init
->
offset
+
3
);
u8
mask
=
nv
_ro
08
(
bios
,
init
->
offset
+
4
);
u8
shift
=
nv
_ro
08
(
bios
,
init
->
offset
+
5
);
u8
count
=
nv
_ro
08
(
bios
,
init
->
offset
+
6
);
u32
reg
=
nv
_ro
32
(
bios
,
init
->
offset
+
7
);
u16
port
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
1
);
u8
index
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
3
);
u8
mask
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
4
);
u8
shift
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
5
);
u8
count
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
6
);
u32
reg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
7
);
u8
conf
,
i
;
trace
(
"IO_RESTRICT_PROG
\t
R[0x%06x] = "
...
...
@@ -629,7 +629,7 @@ init_io_restrict_prog(struct nvbios_init *init)
conf
=
(
init_rdvgai
(
init
,
port
,
index
)
&
mask
)
>>
shift
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
u32
data
=
nv
_ro
32
(
bios
,
init
->
offset
);
u32
data
=
nv
bios_rd
32
(
bios
,
init
->
offset
);
if
(
i
==
conf
)
{
trace
(
"
\t
0x%08x *
\n
"
,
data
);
...
...
@@ -651,7 +651,7 @@ static void
init_repeat
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
count
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
count
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u16
repeat
=
init
->
repeat
;
trace
(
"REPEAT
\t
0x%02x
\n
"
,
count
);
...
...
@@ -677,13 +677,13 @@ static void
init_io_restrict_pll
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u16
port
=
nv
_ro
16
(
bios
,
init
->
offset
+
1
);
u8
index
=
nv
_ro
08
(
bios
,
init
->
offset
+
3
);
u8
mask
=
nv
_ro
08
(
bios
,
init
->
offset
+
4
);
u8
shift
=
nv
_ro
08
(
bios
,
init
->
offset
+
5
);
s8
iofc
=
nv
_ro
08
(
bios
,
init
->
offset
+
6
);
u8
count
=
nv
_ro
08
(
bios
,
init
->
offset
+
7
);
u32
reg
=
nv
_ro
32
(
bios
,
init
->
offset
+
8
);
u16
port
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
1
);
u8
index
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
3
);
u8
mask
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
4
);
u8
shift
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
5
);
s8
iofc
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
6
);
u8
count
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
7
);
u32
reg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
8
);
u8
conf
,
i
;
trace
(
"IO_RESTRICT_PLL
\t
R[0x%06x] =PLL= "
...
...
@@ -693,7 +693,7 @@ init_io_restrict_pll(struct nvbios_init *init)
conf
=
(
init_rdvgai
(
init
,
port
,
index
)
&
mask
)
>>
shift
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
u32
freq
=
nv
_ro
16
(
bios
,
init
->
offset
)
*
10
;
u32
freq
=
nv
bios_rd
16
(
bios
,
init
->
offset
)
*
10
;
if
(
i
==
conf
)
{
trace
(
"
\t
%dkHz *
\n
"
,
freq
);
...
...
@@ -733,12 +733,12 @@ static void
init_copy
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
reg
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u8
shift
=
nv
_ro
08
(
bios
,
init
->
offset
+
5
);
u8
smask
=
nv
_ro
08
(
bios
,
init
->
offset
+
6
);
u16
port
=
nv
_ro
16
(
bios
,
init
->
offset
+
7
);
u8
index
=
nv
_ro
08
(
bios
,
init
->
offset
+
9
);
u8
mask
=
nv
_ro
08
(
bios
,
init
->
offset
+
10
);
u32
reg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u8
shift
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
5
);
u8
smask
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
6
);
u16
port
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
7
);
u8
index
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
9
);
u8
mask
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
10
);
u8
data
;
trace
(
"COPY
\t
0x%04x[0x%02x] &= 0x%02x |= "
...
...
@@ -772,7 +772,7 @@ static void
init_io_flag_condition
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
cond
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
cond
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
trace
(
"IO_FLAG_CONDITION
\t
0x%02x
\n
"
,
cond
);
init
->
offset
+=
2
;
...
...
@@ -790,8 +790,8 @@ init_dp_condition(struct nvbios_init *init)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
struct
nvbios_dpout
info
;
u8
cond
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
unkn
=
nv
_ro
08
(
bios
,
init
->
offset
+
2
);
u8
cond
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
unkn
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
2
);
u8
ver
,
hdr
,
cnt
,
len
;
u16
data
;
...
...
@@ -837,7 +837,7 @@ static void
init_io_mask_or
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
index
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
index
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
or
=
init_or
(
init
);
u8
data
;
...
...
@@ -856,7 +856,7 @@ static void
init_io_or
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
index
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
index
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
or
=
init_or
(
init
);
u8
data
;
...
...
@@ -875,8 +875,8 @@ static void
init_andn_reg
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
reg
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u32
mask
=
nv
_ro
32
(
bios
,
init
->
offset
+
5
);
u32
reg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u32
mask
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
5
);
trace
(
"ANDN_REG
\t
R[0x%06x] &= ~0x%08x
\n
"
,
reg
,
mask
);
init
->
offset
+=
9
;
...
...
@@ -892,8 +892,8 @@ static void
init_or_reg
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
reg
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u32
mask
=
nv
_ro
32
(
bios
,
init
->
offset
+
5
);
u32
reg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u32
mask
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
5
);
trace
(
"OR_REG
\t
R[0x%06x] |= 0x%08x
\n
"
,
reg
,
mask
);
init
->
offset
+=
9
;
...
...
@@ -909,19 +909,19 @@ static void
init_idx_addr_latched
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
creg
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u32
dreg
=
nv
_ro
32
(
bios
,
init
->
offset
+
5
);
u32
mask
=
nv
_ro
32
(
bios
,
init
->
offset
+
9
);
u32
data
=
nv
_ro
32
(
bios
,
init
->
offset
+
13
);
u8
count
=
nv
_ro
08
(
bios
,
init
->
offset
+
17
);
u32
creg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u32
dreg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
5
);
u32
mask
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
9
);
u32
data
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
13
);
u8
count
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
17
);
trace
(
"INDEX_ADDRESS_LATCHED
\t
R[0x%06x] : R[0x%06x]
\n
"
,
creg
,
dreg
);
trace
(
"
\t
CTRL &= 0x%08x |= 0x%08x
\n
"
,
mask
,
data
);
init
->
offset
+=
18
;
while
(
count
--
)
{
u8
iaddr
=
nv
_ro
08
(
bios
,
init
->
offset
+
0
);
u8
idata
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
iaddr
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
0
);
u8
idata
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
trace
(
"
\t
[0x%02x] = 0x%02x
\n
"
,
iaddr
,
idata
);
init
->
offset
+=
2
;
...
...
@@ -939,12 +939,12 @@ static void
init_io_restrict_pll2
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u16
port
=
nv
_ro
16
(
bios
,
init
->
offset
+
1
);
u8
index
=
nv
_ro
08
(
bios
,
init
->
offset
+
3
);
u8
mask
=
nv
_ro
08
(
bios
,
init
->
offset
+
4
);
u8
shift
=
nv
_ro
08
(
bios
,
init
->
offset
+
5
);
u8
count
=
nv
_ro
08
(
bios
,
init
->
offset
+
6
);
u32
reg
=
nv
_ro
32
(
bios
,
init
->
offset
+
7
);
u16
port
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
1
);
u8
index
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
3
);
u8
mask
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
4
);
u8
shift
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
5
);
u8
count
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
6
);
u32
reg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
7
);
u8
conf
,
i
;
trace
(
"IO_RESTRICT_PLL2
\t
"
...
...
@@ -954,7 +954,7 @@ init_io_restrict_pll2(struct nvbios_init *init)
conf
=
(
init_rdvgai
(
init
,
port
,
index
)
&
mask
)
>>
shift
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
u32
freq
=
nv
_ro
32
(
bios
,
init
->
offset
);
u32
freq
=
nv
bios_rd
32
(
bios
,
init
->
offset
);
if
(
i
==
conf
)
{
trace
(
"
\t
%dkHz *
\n
"
,
freq
);
init_prog_pll
(
init
,
reg
,
freq
);
...
...
@@ -974,8 +974,8 @@ static void
init_pll2
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
reg
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u32
freq
=
nv
_ro
32
(
bios
,
init
->
offset
+
5
);
u32
reg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u32
freq
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
5
);
trace
(
"PLL2
\t
R[0x%06x] =PLL= %dkHz
\n
"
,
reg
,
freq
);
init
->
offset
+=
9
;
...
...
@@ -991,17 +991,17 @@ static void
init_i2c_byte
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
index
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
addr
=
nv
_ro
08
(
bios
,
init
->
offset
+
2
)
>>
1
;
u8
count
=
nv
_ro
08
(
bios
,
init
->
offset
+
3
);
u8
index
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
addr
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
2
)
>>
1
;
u8
count
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
3
);
trace
(
"I2C_BYTE
\t
I2C[0x%02x][0x%02x]
\n
"
,
index
,
addr
);
init
->
offset
+=
4
;
while
(
count
--
)
{
u8
reg
=
nv
_ro
08
(
bios
,
init
->
offset
+
0
);
u8
mask
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
data
=
nv
_ro
08
(
bios
,
init
->
offset
+
2
);
u8
reg
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
0
);
u8
mask
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
data
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
2
);
int
val
;
trace
(
"
\t
[0x%02x] &= 0x%02x |= 0x%02x
\n
"
,
reg
,
mask
,
data
);
...
...
@@ -1022,16 +1022,16 @@ static void
init_zm_i2c_byte
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
index
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
addr
=
nv
_ro
08
(
bios
,
init
->
offset
+
2
)
>>
1
;
u8
count
=
nv
_ro
08
(
bios
,
init
->
offset
+
3
);
u8
index
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
addr
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
2
)
>>
1
;
u8
count
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
3
);
trace
(
"ZM_I2C_BYTE
\t
I2C[0x%02x][0x%02x]
\n
"
,
index
,
addr
);
init
->
offset
+=
4
;
while
(
count
--
)
{
u8
reg
=
nv
_ro
08
(
bios
,
init
->
offset
+
0
);
u8
data
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
reg
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
0
);
u8
data
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
trace
(
"
\t
[0x%02x] = 0x%02x
\n
"
,
reg
,
data
);
init
->
offset
+=
2
;
...
...
@@ -1048,16 +1048,16 @@ static void
init_zm_i2c
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
index
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
addr
=
nv
_ro
08
(
bios
,
init
->
offset
+
2
)
>>
1
;
u8
count
=
nv
_ro
08
(
bios
,
init
->
offset
+
3
);
u8
index
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
addr
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
2
)
>>
1
;
u8
count
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
3
);
u8
data
[
256
],
i
;
trace
(
"ZM_I2C
\t
I2C[0x%02x][0x%02x]
\n
"
,
index
,
addr
);
init
->
offset
+=
4
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
data
[
i
]
=
nv
_ro
08
(
bios
,
init
->
offset
);
data
[
i
]
=
nv
bios_rd
08
(
bios
,
init
->
offset
);
trace
(
"
\t
0x%02x
\n
"
,
data
[
i
]);
init
->
offset
++
;
}
...
...
@@ -1082,10 +1082,10 @@ static void
init_tmds
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
tmds
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
addr
=
nv
_ro
08
(
bios
,
init
->
offset
+
2
);
u8
mask
=
nv
_ro
08
(
bios
,
init
->
offset
+
3
);
u8
data
=
nv
_ro
08
(
bios
,
init
->
offset
+
4
);
u8
tmds
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
addr
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
2
);
u8
mask
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
3
);
u8
data
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
4
);
u32
reg
=
init_tmds_reg
(
init
,
tmds
);
trace
(
"TMDS
\t
T[0x%02x][0x%02x] &= 0x%02x |= 0x%02x
\n
"
,
...
...
@@ -1108,16 +1108,16 @@ static void
init_zm_tmds_group
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
tmds
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
count
=
nv
_ro
08
(
bios
,
init
->
offset
+
2
);
u8
tmds
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
count
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
2
);
u32
reg
=
init_tmds_reg
(
init
,
tmds
);
trace
(
"TMDS_ZM_GROUP
\t
T[0x%02x]
\n
"
,
tmds
);
init
->
offset
+=
3
;
while
(
count
--
)
{
u8
addr
=
nv
_ro
08
(
bios
,
init
->
offset
+
0
);
u8
data
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
addr
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
0
);
u8
data
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
trace
(
"
\t
[0x%02x] = 0x%02x
\n
"
,
addr
,
data
);
init
->
offset
+=
2
;
...
...
@@ -1135,10 +1135,10 @@ static void
init_cr_idx_adr_latch
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
addr0
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
addr1
=
nv
_ro
08
(
bios
,
init
->
offset
+
2
);
u8
base
=
nv
_ro
08
(
bios
,
init
->
offset
+
3
);
u8
count
=
nv
_ro
08
(
bios
,
init
->
offset
+
4
);
u8
addr0
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
addr1
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
2
);
u8
base
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
3
);
u8
count
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
4
);
u8
save0
;
trace
(
"CR_INDEX_ADDR C[%02x] C[%02x]
\n
"
,
addr0
,
addr1
);
...
...
@@ -1146,7 +1146,7 @@ init_cr_idx_adr_latch(struct nvbios_init *init)
save0
=
init_rdvgai
(
init
,
0x03d4
,
addr0
);
while
(
count
--
)
{
u8
data
=
nv
_ro
08
(
bios
,
init
->
offset
);
u8
data
=
nv
bios_rd
08
(
bios
,
init
->
offset
);
trace
(
"
\t\t
[0x%02x] = 0x%02x
\n
"
,
base
,
data
);
init
->
offset
+=
1
;
...
...
@@ -1165,9 +1165,9 @@ static void
init_cr
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
addr
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
mask
=
nv
_ro
08
(
bios
,
init
->
offset
+
2
);
u8
data
=
nv
_ro
08
(
bios
,
init
->
offset
+
3
);
u8
addr
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
mask
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
2
);
u8
data
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
3
);
u8
val
;
trace
(
"CR
\t\t
C[0x%02x] &= 0x%02x |= 0x%02x
\n
"
,
addr
,
mask
,
data
);
...
...
@@ -1185,8 +1185,8 @@ static void
init_zm_cr
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
addr
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
data
=
nv
_ro
08
(
bios
,
init
->
offset
+
2
);
u8
addr
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
data
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
2
);
trace
(
"ZM_CR
\t
C[0x%02x] = 0x%02x
\n
"
,
addr
,
data
);
init
->
offset
+=
3
;
...
...
@@ -1202,14 +1202,14 @@ static void
init_zm_cr_group
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
count
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
count
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
trace
(
"ZM_CR_GROUP
\n
"
);
init
->
offset
+=
2
;
while
(
count
--
)
{
u8
addr
=
nv
_ro
08
(
bios
,
init
->
offset
+
0
);
u8
data
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
addr
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
0
);
u8
data
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
trace
(
"
\t\t
C[0x%02x] = 0x%02x
\n
"
,
addr
,
data
);
init
->
offset
+=
2
;
...
...
@@ -1226,8 +1226,8 @@ static void
init_condition_time
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
cond
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
retry
=
nv
_ro
08
(
bios
,
init
->
offset
+
2
);
u8
cond
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
retry
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
2
);
u8
wait
=
min
((
u16
)
retry
*
50
,
100
);
trace
(
"CONDITION_TIME
\t
0x%02x 0x%02x
\n
"
,
cond
,
retry
);
...
...
@@ -1253,7 +1253,7 @@ static void
init_ltime
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u16
msec
=
nv
_ro
16
(
bios
,
init
->
offset
+
1
);
u16
msec
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
1
);
trace
(
"LTIME
\t
0x%04x
\n
"
,
msec
);
init
->
offset
+=
3
;
...
...
@@ -1270,14 +1270,14 @@ static void
init_zm_reg_sequence
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
base
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u8
count
=
nv
_ro
08
(
bios
,
init
->
offset
+
5
);
u32
base
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u8
count
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
5
);
trace
(
"ZM_REG_SEQUENCE
\t
0x%02x
\n
"
,
count
);
init
->
offset
+=
6
;
while
(
count
--
)
{
u32
data
=
nv
_ro
32
(
bios
,
init
->
offset
);
u32
data
=
nv
bios_rd
32
(
bios
,
init
->
offset
);
trace
(
"
\t\t
R[0x%06x] = 0x%08x
\n
"
,
base
,
data
);
init
->
offset
+=
4
;
...
...
@@ -1295,9 +1295,9 @@ static void
init_pll_indirect
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
reg
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u16
addr
=
nv
_ro
16
(
bios
,
init
->
offset
+
5
);
u32
freq
=
(
u32
)
nv
_ro
16
(
bios
,
addr
)
*
1000
;
u32
reg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u16
addr
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
5
);
u32
freq
=
(
u32
)
nv
bios_rd
16
(
bios
,
addr
)
*
1000
;
trace
(
"PLL_INDIRECT
\t
R[0x%06x] =PLL= VBIOS[%04x] = %dkHz
\n
"
,
reg
,
addr
,
freq
);
...
...
@@ -1314,9 +1314,9 @@ static void
init_zm_reg_indirect
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
reg
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u16
addr
=
nv
_ro
16
(
bios
,
init
->
offset
+
5
);
u32
data
=
nv
_ro
32
(
bios
,
addr
);
u32
reg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u16
addr
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
5
);
u32
data
=
nv
bios_rd
32
(
bios
,
addr
);
trace
(
"ZM_REG_INDIRECT
\t
R[0x%06x] = VBIOS[0x%04x] = 0x%08x
\n
"
,
reg
,
addr
,
data
);
...
...
@@ -1333,7 +1333,7 @@ static void
init_sub_direct
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u16
addr
=
nv
_ro
16
(
bios
,
init
->
offset
+
1
);
u16
addr
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
1
);
u16
save
;
trace
(
"SUB_DIRECT
\t
0x%04x
\n
"
,
addr
);
...
...
@@ -1359,7 +1359,7 @@ static void
init_jump
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u16
offset
=
nv
_ro
16
(
bios
,
init
->
offset
+
1
);
u16
offset
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
1
);
trace
(
"JUMP
\t
0x%04x
\n
"
,
offset
);
...
...
@@ -1377,11 +1377,11 @@ static void
init_i2c_if
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
index
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
addr
=
nv
_ro
08
(
bios
,
init
->
offset
+
2
);
u8
reg
=
nv
_ro
08
(
bios
,
init
->
offset
+
3
);
u8
mask
=
nv
_ro
08
(
bios
,
init
->
offset
+
4
);
u8
data
=
nv
_ro
08
(
bios
,
init
->
offset
+
5
);
u8
index
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
addr
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
2
);
u8
reg
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
3
);
u8
mask
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
4
);
u8
data
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
5
);
u8
value
;
trace
(
"I2C_IF
\t
I2C[0x%02x][0x%02x][0x%02x] & 0x%02x == 0x%02x
\n
"
,
...
...
@@ -1404,12 +1404,12 @@ static void
init_copy_nv_reg
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
sreg
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u8
shift
=
nv
_ro
08
(
bios
,
init
->
offset
+
5
);
u32
smask
=
nv
_ro
32
(
bios
,
init
->
offset
+
6
);
u32
sxor
=
nv
_ro
32
(
bios
,
init
->
offset
+
10
);
u32
dreg
=
nv
_ro
32
(
bios
,
init
->
offset
+
14
);
u32
dmask
=
nv
_ro
32
(
bios
,
init
->
offset
+
18
);
u32
sreg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u8
shift
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
5
);
u32
smask
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
6
);
u32
sxor
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
10
);
u32
dreg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
14
);
u32
dmask
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
18
);
u32
data
;
trace
(
"COPY_NV_REG
\t
R[0x%06x] &= 0x%08x |= "
...
...
@@ -1430,9 +1430,9 @@ static void
init_zm_index_io
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u16
port
=
nv
_ro
16
(
bios
,
init
->
offset
+
1
);
u8
index
=
nv
_ro
08
(
bios
,
init
->
offset
+
3
);
u8
data
=
nv
_ro
08
(
bios
,
init
->
offset
+
4
);
u16
port
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
1
);
u8
index
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
3
);
u8
data
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
4
);
trace
(
"ZM_INDEX_IO
\t
I[0x%04x][0x%02x] = 0x%02x
\n
"
,
port
,
index
,
data
);
init
->
offset
+=
5
;
...
...
@@ -1466,9 +1466,9 @@ static void
init_reset
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
reg
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u32
data1
=
nv
_ro
32
(
bios
,
init
->
offset
+
5
);
u32
data2
=
nv
_ro
32
(
bios
,
init
->
offset
+
9
);
u32
reg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u32
data1
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
5
);
u32
data2
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
9
);
u32
savepci19
;
trace
(
"RESET
\t
R[0x%08x] = 0x%08x, 0x%08x"
,
reg
,
data1
,
data2
);
...
...
@@ -1516,14 +1516,14 @@ init_configure_mem(struct nvbios_init *init)
mdata
=
init_configure_mem_clk
(
init
);
sdata
=
bmp_sdr_seq_table
(
bios
);
if
(
nv
_ro
08
(
bios
,
mdata
)
&
0x01
)
if
(
nv
bios_rd
08
(
bios
,
mdata
)
&
0x01
)
sdata
=
bmp_ddr_seq_table
(
bios
);
mdata
+=
6
;
/* skip to data */
data
=
init_rdvgai
(
init
,
0x03c4
,
0x01
);
init_wrvgai
(
init
,
0x03c4
,
0x01
,
data
|
0x20
);
for
(;
(
addr
=
nv
_ro
32
(
bios
,
sdata
))
!=
0xffffffff
;
sdata
+=
4
)
{
for
(;
(
addr
=
nv
bios_rd
32
(
bios
,
sdata
))
!=
0xffffffff
;
sdata
+=
4
)
{
switch
(
addr
)
{
case
0x10021c
:
/* CKE_NORMAL */
case
0x1002d0
:
/* CMD_REFRESH */
...
...
@@ -1531,7 +1531,7 @@ init_configure_mem(struct nvbios_init *init)
data
=
0x00000001
;
break
;
default:
data
=
nv
_ro
32
(
bios
,
mdata
);
data
=
nv
bios_rd
32
(
bios
,
mdata
);
mdata
+=
4
;
if
(
data
==
0xffffffff
)
continue
;
...
...
@@ -1566,12 +1566,12 @@ init_configure_clk(struct nvbios_init *init)
mdata
=
init_configure_mem_clk
(
init
);
/* NVPLL */
clock
=
nv
_ro
16
(
bios
,
mdata
+
4
)
*
10
;
clock
=
nv
bios_rd
16
(
bios
,
mdata
+
4
)
*
10
;
init_prog_pll
(
init
,
0x680500
,
clock
);
/* MPLL */
clock
=
nv
_ro
16
(
bios
,
mdata
+
2
)
*
10
;
if
(
nv
_ro
08
(
bios
,
mdata
)
&
0x01
)
clock
=
nv
bios_rd
16
(
bios
,
mdata
+
2
)
*
10
;
if
(
nv
bios_rd
08
(
bios
,
mdata
)
&
0x01
)
clock
*=
2
;
init_prog_pll
(
init
,
0x680504
,
clock
);
...
...
@@ -1612,9 +1612,9 @@ static void
init_io
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u16
port
=
nv
_ro
16
(
bios
,
init
->
offset
+
1
);
u8
mask
=
nv
_ro
16
(
bios
,
init
->
offset
+
3
);
u8
data
=
nv
_ro
16
(
bios
,
init
->
offset
+
4
);
u16
port
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
1
);
u8
mask
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
3
);
u8
data
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
4
);
u8
value
;
trace
(
"IO
\t\t
I[0x%04x] &= 0x%02x |= 0x%02x
\n
"
,
port
,
mask
,
data
);
...
...
@@ -1652,7 +1652,7 @@ static void
init_sub
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
index
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
index
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u16
addr
,
save
;
trace
(
"SUB
\t
0x%02x
\n
"
,
index
);
...
...
@@ -1679,8 +1679,8 @@ static void
init_ram_condition
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
mask
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
value
=
nv
_ro
08
(
bios
,
init
->
offset
+
2
);
u8
mask
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
value
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
2
);
trace
(
"RAM_CONDITION
\t
"
"(R[0x100000] & 0x%02x) == 0x%02x
\n
"
,
mask
,
value
);
...
...
@@ -1698,9 +1698,9 @@ static void
init_nv_reg
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
reg
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u32
mask
=
nv
_ro
32
(
bios
,
init
->
offset
+
5
);
u32
data
=
nv
_ro
32
(
bios
,
init
->
offset
+
9
);
u32
reg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u32
mask
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
5
);
u32
data
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
9
);
trace
(
"NV_REG
\t
R[0x%06x] &= 0x%08x |= 0x%08x
\n
"
,
reg
,
mask
,
data
);
init
->
offset
+=
13
;
...
...
@@ -1716,15 +1716,15 @@ static void
init_macro
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
macro
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
macro
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u16
table
;
trace
(
"MACRO
\t
0x%02x
\n
"
,
macro
);
table
=
init_macro_table
(
init
);
if
(
table
)
{
u32
addr
=
nv
_ro
32
(
bios
,
table
+
(
macro
*
8
)
+
0
);
u32
data
=
nv
_ro
32
(
bios
,
table
+
(
macro
*
8
)
+
4
);
u32
addr
=
nv
bios_rd
32
(
bios
,
table
+
(
macro
*
8
)
+
0
);
u32
data
=
nv
bios_rd
32
(
bios
,
table
+
(
macro
*
8
)
+
4
);
trace
(
"
\t\t
R[0x%06x] = 0x%08x
\n
"
,
addr
,
data
);
init_wr32
(
init
,
addr
,
data
);
}
...
...
@@ -1752,8 +1752,8 @@ static void
init_strap_condition
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
mask
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u32
value
=
nv
_ro
32
(
bios
,
init
->
offset
+
5
);
u32
mask
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u32
value
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
5
);
trace
(
"STRAP_CONDITION
\t
(R[0x101000] & 0x%08x) == 0x%08x
\n
"
,
mask
,
value
);
init
->
offset
+=
9
;
...
...
@@ -1770,7 +1770,7 @@ static void
init_time
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u16
usec
=
nv
_ro
16
(
bios
,
init
->
offset
+
1
);
u16
usec
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
1
);
trace
(
"TIME
\t
0x%04x
\n
"
,
usec
);
init
->
offset
+=
3
;
...
...
@@ -1791,7 +1791,7 @@ static void
init_condition
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
cond
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
cond
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
trace
(
"CONDITION
\t
0x%02x
\n
"
,
cond
);
init
->
offset
+=
2
;
...
...
@@ -1808,7 +1808,7 @@ static void
init_io_condition
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
cond
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
cond
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
trace
(
"IO_CONDITION
\t
0x%02x
\n
"
,
cond
);
init
->
offset
+=
2
;
...
...
@@ -1825,8 +1825,8 @@ static void
init_zm_reg16
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
addr
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u16
data
=
nv
_ro
16
(
bios
,
init
->
offset
+
5
);
u32
addr
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u16
data
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
5
);
trace
(
"ZM_REG
\t
R[0x%06x] = 0x%04x
\n
"
,
addr
,
data
);
init
->
offset
+=
7
;
...
...
@@ -1842,10 +1842,10 @@ static void
init_index_io
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u16
port
=
nv
_ro
16
(
bios
,
init
->
offset
+
1
);
u8
index
=
nv
_ro
16
(
bios
,
init
->
offset
+
3
);
u8
mask
=
nv
_ro
08
(
bios
,
init
->
offset
+
4
);
u8
data
=
nv
_ro
08
(
bios
,
init
->
offset
+
5
);
u16
port
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
1
);
u8
index
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
3
);
u8
mask
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
4
);
u8
data
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
5
);
u8
value
;
trace
(
"INDEX_IO
\t
I[0x%04x][0x%02x] &= 0x%02x |= 0x%02x
\n
"
,
...
...
@@ -1864,8 +1864,8 @@ static void
init_pll
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
reg
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u32
freq
=
nv
_ro
16
(
bios
,
init
->
offset
+
5
)
*
10
;
u32
reg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u32
freq
=
nv
bios_rd
16
(
bios
,
init
->
offset
+
5
)
*
10
;
trace
(
"PLL
\t
R[0x%06x] =PLL= %dkHz
\n
"
,
reg
,
freq
);
init
->
offset
+=
7
;
...
...
@@ -1881,8 +1881,8 @@ static void
init_zm_reg
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
addr
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u32
data
=
nv
_ro
32
(
bios
,
init
->
offset
+
5
);
u32
addr
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u32
data
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
5
);
trace
(
"ZM_REG
\t
R[0x%06x] = 0x%08x
\n
"
,
addr
,
data
);
init
->
offset
+=
9
;
...
...
@@ -1901,7 +1901,7 @@ static void
init_ram_restrict_pll
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
type
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
type
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
count
=
init_ram_restrict_group_count
(
init
);
u8
strap
=
init_ram_restrict
(
init
);
u8
cconf
;
...
...
@@ -1910,7 +1910,7 @@ init_ram_restrict_pll(struct nvbios_init *init)
init
->
offset
+=
2
;
for
(
cconf
=
0
;
cconf
<
count
;
cconf
++
)
{
u32
freq
=
nv
_ro
32
(
bios
,
init
->
offset
);
u32
freq
=
nv
bios_rd
32
(
bios
,
init
->
offset
);
if
(
cconf
==
strap
)
{
trace
(
"%dkHz *
\n
"
,
freq
);
...
...
@@ -1947,9 +1947,9 @@ static void
init_ram_restrict_zm_reg_group
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
addr
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u8
incr
=
nv
_ro
08
(
bios
,
init
->
offset
+
5
);
u8
num
=
nv
_ro
08
(
bios
,
init
->
offset
+
6
);
u32
addr
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u8
incr
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
5
);
u8
num
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
6
);
u8
count
=
init_ram_restrict_group_count
(
init
);
u8
index
=
init_ram_restrict
(
init
);
u8
i
,
j
;
...
...
@@ -1961,7 +1961,7 @@ init_ram_restrict_zm_reg_group(struct nvbios_init *init)
for
(
i
=
0
;
i
<
num
;
i
++
)
{
trace
(
"
\t
R[0x%06x] = {
\n
"
,
addr
);
for
(
j
=
0
;
j
<
count
;
j
++
)
{
u32
data
=
nv
_ro
32
(
bios
,
init
->
offset
);
u32
data
=
nv
bios_rd
32
(
bios
,
init
->
offset
);
if
(
j
==
index
)
{
trace
(
"
\t\t
0x%08x *
\n
"
,
data
);
...
...
@@ -1985,8 +1985,8 @@ static void
init_copy_zm_reg
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
sreg
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u32
dreg
=
nv
_ro
32
(
bios
,
init
->
offset
+
5
);
u32
sreg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u32
dreg
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
5
);
trace
(
"COPY_ZM_REG
\t
R[0x%06x] = R[0x%06x]
\n
"
,
dreg
,
sreg
);
init
->
offset
+=
9
;
...
...
@@ -2002,14 +2002,14 @@ static void
init_zm_reg_group
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
addr
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u8
count
=
nv
_ro
08
(
bios
,
init
->
offset
+
5
);
u32
addr
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u8
count
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
5
);
trace
(
"ZM_REG_GROUP
\t
R[0x%06x] =
\n
"
,
addr
);
init
->
offset
+=
6
;
while
(
count
--
)
{
u32
data
=
nv
_ro
32
(
bios
,
init
->
offset
);
u32
data
=
nv
bios_rd
32
(
bios
,
init
->
offset
);
trace
(
"
\t
0x%08x
\n
"
,
data
);
init_wr32
(
init
,
addr
,
data
);
init
->
offset
+=
4
;
...
...
@@ -2024,13 +2024,13 @@ static void
init_xlat
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
saddr
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u8
sshift
=
nv
_ro
08
(
bios
,
init
->
offset
+
5
);
u8
smask
=
nv
_ro
08
(
bios
,
init
->
offset
+
6
);
u8
index
=
nv
_ro
08
(
bios
,
init
->
offset
+
7
);
u32
daddr
=
nv
_ro
32
(
bios
,
init
->
offset
+
8
);
u32
dmask
=
nv
_ro
32
(
bios
,
init
->
offset
+
12
);
u8
shift
=
nv
_ro
08
(
bios
,
init
->
offset
+
16
);
u32
saddr
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u8
sshift
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
5
);
u8
smask
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
6
);
u8
index
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
7
);
u32
daddr
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
8
);
u32
dmask
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
12
);
u8
shift
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
16
);
u32
data
;
trace
(
"INIT_XLAT
\t
R[0x%06x] &= 0x%08x |= "
...
...
@@ -2052,9 +2052,9 @@ static void
init_zm_mask_add
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
addr
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u32
mask
=
nv
_ro
32
(
bios
,
init
->
offset
+
5
);
u32
add
=
nv
_ro
32
(
bios
,
init
->
offset
+
9
);
u32
addr
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u32
mask
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
5
);
u32
add
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
9
);
u32
data
;
trace
(
"ZM_MASK_ADD
\t
R[0x%06x] &= 0x%08x += 0x%08x
\n
"
,
addr
,
mask
,
add
);
...
...
@@ -2073,15 +2073,15 @@ static void
init_auxch
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
addr
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u8
count
=
nv
_ro
08
(
bios
,
init
->
offset
+
5
);
u32
addr
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u8
count
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
5
);
trace
(
"AUXCH
\t
AUX[0x%08x] 0x%02x
\n
"
,
addr
,
count
);
init
->
offset
+=
6
;
while
(
count
--
)
{
u8
mask
=
nv
_ro
08
(
bios
,
init
->
offset
+
0
);
u8
data
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
mask
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
0
);
u8
data
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
trace
(
"
\t
AUX[0x%08x] &= 0x%02x |= 0x%02x
\n
"
,
addr
,
mask
,
data
);
mask
=
init_rdauxr
(
init
,
addr
)
&
mask
;
init_wrauxr
(
init
,
addr
,
mask
|
data
);
...
...
@@ -2097,14 +2097,14 @@ static void
init_zm_auxch
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u32
addr
=
nv
_ro
32
(
bios
,
init
->
offset
+
1
);
u8
count
=
nv
_ro
08
(
bios
,
init
->
offset
+
5
);
u32
addr
=
nv
bios_rd
32
(
bios
,
init
->
offset
+
1
);
u8
count
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
5
);
trace
(
"ZM_AUXCH
\t
AUX[0x%08x] 0x%02x
\n
"
,
addr
,
count
);
init
->
offset
+=
6
;
while
(
count
--
)
{
u8
data
=
nv
_ro
08
(
bios
,
init
->
offset
+
0
);
u8
data
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
0
);
trace
(
"
\t
AUX[0x%08x] = 0x%02x
\n
"
,
addr
,
data
);
init_wrauxr
(
init
,
addr
,
data
);
init
->
offset
+=
1
;
...
...
@@ -2119,12 +2119,12 @@ static void
init_i2c_long_if
(
struct
nvbios_init
*
init
)
{
struct
nvkm_bios
*
bios
=
init
->
bios
;
u8
index
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
addr
=
nv
_ro
08
(
bios
,
init
->
offset
+
2
)
>>
1
;
u8
reglo
=
nv
_ro
08
(
bios
,
init
->
offset
+
3
);
u8
reghi
=
nv
_ro
08
(
bios
,
init
->
offset
+
4
);
u8
mask
=
nv
_ro
08
(
bios
,
init
->
offset
+
5
);
u8
data
=
nv
_ro
08
(
bios
,
init
->
offset
+
6
);
u8
index
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
addr
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
2
)
>>
1
;
u8
reglo
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
3
);
u8
reghi
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
4
);
u8
mask
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
5
);
u8
data
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
6
);
struct
nvkm_i2c_port
*
port
;
trace
(
"I2C_LONG_IF
\t
"
...
...
@@ -2160,7 +2160,7 @@ init_gpio_ne(struct nvbios_init *init)
struct
nvkm_bios
*
bios
=
init
->
bios
;
struct
nvkm_gpio
*
gpio
=
nvkm_gpio
(
bios
);
struct
dcb_gpio_func
func
;
u8
count
=
nv
_ro
08
(
bios
,
init
->
offset
+
1
);
u8
count
=
nv
bios_rd
08
(
bios
,
init
->
offset
+
1
);
u8
idx
=
0
,
ver
,
len
;
u16
data
,
i
;
...
...
@@ -2168,13 +2168,13 @@ init_gpio_ne(struct nvbios_init *init)
init
->
offset
+=
2
;
for
(
i
=
init
->
offset
;
i
<
init
->
offset
+
count
;
i
++
)
cont
(
"0x%02x "
,
nv
_ro
08
(
bios
,
i
));
cont
(
"0x%02x "
,
nv
bios_rd
08
(
bios
,
i
));
cont
(
"
\n
"
);
while
((
data
=
dcb_gpio_parse
(
bios
,
0
,
idx
++
,
&
ver
,
&
len
,
&
func
)))
{
if
(
func
.
func
!=
DCB_GPIO_UNUSED
)
{
for
(
i
=
init
->
offset
;
i
<
init
->
offset
+
count
;
i
++
)
{
if
(
func
.
func
==
nv
_ro
08
(
bios
,
i
))
if
(
func
.
func
==
nv
bios_rd
08
(
bios
,
i
))
break
;
}
...
...
@@ -2272,7 +2272,7 @@ nvbios_exec(struct nvbios_init *init)
{
init
->
nested
++
;
while
(
init
->
offset
)
{
u8
opcode
=
nv
_ro
08
(
init
->
bios
,
init
->
offset
);
u8
opcode
=
nv
bios_rd
08
(
init
->
bios
,
init
->
offset
);
if
(
opcode
>=
init_opcode_nr
||
!
init_opcode
[
opcode
].
exec
)
{
error
(
"unknown opcode 0x%02x
\n
"
,
opcode
);
return
-
EINVAL
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/mxm.c
View file @
7f5f518f
...
...
@@ -78,14 +78,14 @@ mxm_sor_map(struct nvkm_bios *bios, u8 conn)
u8
ver
,
hdr
;
u16
mxm
=
mxm_table
(
bios
,
&
ver
,
&
hdr
);
if
(
mxm
&&
hdr
>=
6
)
{
u16
map
=
nv
_ro
16
(
bios
,
mxm
+
4
);
u16
map
=
nv
bios_rd
16
(
bios
,
mxm
+
4
);
if
(
map
)
{
ver
=
nv
_ro
08
(
bios
,
map
);
ver
=
nv
bios_rd
08
(
bios
,
map
);
if
(
ver
==
0x10
)
{
if
(
conn
<
nv
_ro
08
(
bios
,
map
+
3
))
{
map
+=
nv
_ro
08
(
bios
,
map
+
1
);
if
(
conn
<
nv
bios_rd
08
(
bios
,
map
+
3
))
{
map
+=
nv
bios_rd
08
(
bios
,
map
+
1
);
map
+=
conn
;
return
nv
_ro
08
(
bios
,
map
);
return
nv
bios_rd
08
(
bios
,
map
);
}
return
0x00
;
...
...
@@ -115,14 +115,14 @@ mxm_ddc_map(struct nvkm_bios *bios, u8 port)
u8
ver
,
hdr
;
u16
mxm
=
mxm_table
(
bios
,
&
ver
,
&
hdr
);
if
(
mxm
&&
hdr
>=
8
)
{
u16
map
=
nv
_ro
16
(
bios
,
mxm
+
6
);
u16
map
=
nv
bios_rd
16
(
bios
,
mxm
+
6
);
if
(
map
)
{
ver
=
nv
_ro
08
(
bios
,
map
);
ver
=
nv
bios_rd
08
(
bios
,
map
);
if
(
ver
==
0x10
)
{
if
(
port
<
nv
_ro
08
(
bios
,
map
+
3
))
{
map
+=
nv
_ro
08
(
bios
,
map
+
1
);
if
(
port
<
nv
bios_rd
08
(
bios
,
map
+
3
))
{
map
+=
nv
bios_rd
08
(
bios
,
map
+
1
);
map
+=
port
;
return
nv
_ro
08
(
bios
,
map
);
return
nv
bios_rd
08
(
bios
,
map
);
}
return
0x00
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/npde.c
View file @
7f5f518f
...
...
@@ -32,13 +32,13 @@ nvbios_npdeTe(struct nvkm_bios *bios, u32 base)
u8
ver
;
u16
hdr
;
u32
data
=
nvbios_pcirTp
(
bios
,
base
,
&
ver
,
&
hdr
,
&
pcir
);
if
(
data
=
(
data
+
hdr
+
0x0f
)
&
~
0x0f
,
data
)
{
switch
(
nv
_ro
32
(
bios
,
data
+
0x00
))
{
switch
(
nv
bios_rd
32
(
bios
,
data
+
0x00
))
{
case
0x4544504e
:
/* NPDE */
break
;
default:
nvkm_debug
(
&
bios
->
subdev
,
"%08x: NPDE signature (%08x) unknown
\n
"
,
data
,
nv
_ro
32
(
bios
,
data
+
0x00
));
data
,
nv
bios_rd
32
(
bios
,
data
+
0x00
));
data
=
0
;
break
;
}
...
...
@@ -52,8 +52,8 @@ nvbios_npdeTp(struct nvkm_bios *bios, u32 base, struct nvbios_npdeT *info)
u32
data
=
nvbios_npdeTe
(
bios
,
base
);
memset
(
info
,
0x00
,
sizeof
(
*
info
));
if
(
data
)
{
info
->
image_size
=
nv
_ro
16
(
bios
,
data
+
0x08
)
*
512
;
info
->
last
=
nv
_ro
08
(
bios
,
data
+
0x0a
)
&
0x80
;
info
->
image_size
=
nv
bios_rd
16
(
bios
,
data
+
0x08
)
*
512
;
info
->
last
=
nv
bios_rd
08
(
bios
,
data
+
0x0a
)
&
0x80
;
}
return
data
;
}
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pcir.c
View file @
7f5f518f
...
...
@@ -27,20 +27,20 @@
u32
nvbios_pcirTe
(
struct
nvkm_bios
*
bios
,
u32
base
,
u8
*
ver
,
u16
*
hdr
)
{
u32
data
=
nv
_ro
16
(
bios
,
base
+
0x18
);
u32
data
=
nv
bios_rd
16
(
bios
,
base
+
0x18
);
if
(
data
)
{
data
+=
base
;
switch
(
nv
_ro
32
(
bios
,
data
+
0x00
))
{
switch
(
nv
bios_rd
32
(
bios
,
data
+
0x00
))
{
case
0x52494350
:
/* PCIR */
case
0x53494752
:
/* RGIS */
case
0x5344504e
:
/* NPDS */
*
hdr
=
nv
_ro
16
(
bios
,
data
+
0x0a
);
*
ver
=
nv
_ro
08
(
bios
,
data
+
0x0c
);
*
hdr
=
nv
bios_rd
16
(
bios
,
data
+
0x0a
);
*
ver
=
nv
bios_rd
08
(
bios
,
data
+
0x0c
);
break
;
default:
nvkm_debug
(
&
bios
->
subdev
,
"%08x: PCIR signature (%08x) unknown
\n
"
,
data
,
nv
_ro
32
(
bios
,
data
+
0x00
));
data
,
nv
bios_rd
32
(
bios
,
data
+
0x00
));
data
=
0
;
break
;
}
...
...
@@ -55,15 +55,15 @@ nvbios_pcirTp(struct nvkm_bios *bios, u32 base, u8 *ver, u16 *hdr,
u32
data
=
nvbios_pcirTe
(
bios
,
base
,
ver
,
hdr
);
memset
(
info
,
0x00
,
sizeof
(
*
info
));
if
(
data
)
{
info
->
vendor_id
=
nv
_ro
16
(
bios
,
data
+
0x04
);
info
->
device_id
=
nv
_ro
16
(
bios
,
data
+
0x06
);
info
->
class_code
[
0
]
=
nv
_ro
08
(
bios
,
data
+
0x0d
);
info
->
class_code
[
1
]
=
nv
_ro
08
(
bios
,
data
+
0x0e
);
info
->
class_code
[
2
]
=
nv
_ro
08
(
bios
,
data
+
0x0f
);
info
->
image_size
=
nv
_ro
16
(
bios
,
data
+
0x10
)
*
512
;
info
->
image_rev
=
nv
_ro
16
(
bios
,
data
+
0x12
);
info
->
image_type
=
nv
_ro
08
(
bios
,
data
+
0x14
);
info
->
last
=
nv
_ro
08
(
bios
,
data
+
0x15
)
&
0x80
;
info
->
vendor_id
=
nv
bios_rd
16
(
bios
,
data
+
0x04
);
info
->
device_id
=
nv
bios_rd
16
(
bios
,
data
+
0x06
);
info
->
class_code
[
0
]
=
nv
bios_rd
08
(
bios
,
data
+
0x0d
);
info
->
class_code
[
1
]
=
nv
bios_rd
08
(
bios
,
data
+
0x0e
);
info
->
class_code
[
2
]
=
nv
bios_rd
08
(
bios
,
data
+
0x0f
);
info
->
image_size
=
nv
bios_rd
16
(
bios
,
data
+
0x10
)
*
512
;
info
->
image_rev
=
nv
bios_rd
16
(
bios
,
data
+
0x12
);
info
->
image_type
=
nv
bios_rd
08
(
bios
,
data
+
0x14
);
info
->
last
=
nv
bios_rd
08
(
bios
,
data
+
0x15
)
&
0x80
;
}
return
data
;
}
drivers/gpu/drm/nouveau/nvkm/subdev/bios/perf.c
View file @
7f5f518f
...
...
@@ -34,22 +34,22 @@ nvbios_perf_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr,
if
(
!
bit_entry
(
bios
,
'P'
,
&
bit_P
))
{
if
(
bit_P
.
version
<=
2
)
{
perf
=
nv
_ro
16
(
bios
,
bit_P
.
offset
+
0
);
perf
=
nv
bios_rd
16
(
bios
,
bit_P
.
offset
+
0
);
if
(
perf
)
{
*
ver
=
nv
_ro
08
(
bios
,
perf
+
0
);
*
hdr
=
nv
_ro
08
(
bios
,
perf
+
1
);
*
ver
=
nv
bios_rd
08
(
bios
,
perf
+
0
);
*
hdr
=
nv
bios_rd
08
(
bios
,
perf
+
1
);
if
(
*
ver
>=
0x40
&&
*
ver
<
0x41
)
{
*
cnt
=
nv
_ro
08
(
bios
,
perf
+
5
);
*
len
=
nv
_ro
08
(
bios
,
perf
+
2
);
*
snr
=
nv
_ro
08
(
bios
,
perf
+
4
);
*
ssz
=
nv
_ro
08
(
bios
,
perf
+
3
);
*
cnt
=
nv
bios_rd
08
(
bios
,
perf
+
5
);
*
len
=
nv
bios_rd
08
(
bios
,
perf
+
2
);
*
snr
=
nv
bios_rd
08
(
bios
,
perf
+
4
);
*
ssz
=
nv
bios_rd
08
(
bios
,
perf
+
3
);
return
perf
;
}
else
if
(
*
ver
>=
0x20
&&
*
ver
<
0x40
)
{
*
cnt
=
nv
_ro
08
(
bios
,
perf
+
2
);
*
len
=
nv
_ro
08
(
bios
,
perf
+
3
);
*
snr
=
nv
_ro
08
(
bios
,
perf
+
4
);
*
ssz
=
nv
_ro
08
(
bios
,
perf
+
5
);
*
cnt
=
nv
bios_rd
08
(
bios
,
perf
+
2
);
*
len
=
nv
bios_rd
08
(
bios
,
perf
+
3
);
*
snr
=
nv
bios_rd
08
(
bios
,
perf
+
4
);
*
ssz
=
nv
bios_rd
08
(
bios
,
perf
+
5
);
return
perf
;
}
}
...
...
@@ -57,13 +57,13 @@ nvbios_perf_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr,
}
if
(
bios
->
bmp_offset
)
{
if
(
nv
_ro
08
(
bios
,
bios
->
bmp_offset
+
6
)
>=
0x25
)
{
perf
=
nv
_ro
16
(
bios
,
bios
->
bmp_offset
+
0x94
);
if
(
nv
bios_rd
08
(
bios
,
bios
->
bmp_offset
+
6
)
>=
0x25
)
{
perf
=
nv
bios_rd
16
(
bios
,
bios
->
bmp_offset
+
0x94
);
if
(
perf
)
{
*
hdr
=
nv
_ro
08
(
bios
,
perf
+
0
);
*
ver
=
nv
_ro
08
(
bios
,
perf
+
1
);
*
cnt
=
nv
_ro
08
(
bios
,
perf
+
2
);
*
len
=
nv
_ro
08
(
bios
,
perf
+
3
);
*
hdr
=
nv
bios_rd
08
(
bios
,
perf
+
0
);
*
ver
=
nv
bios_rd
08
(
bios
,
perf
+
1
);
*
cnt
=
nv
bios_rd
08
(
bios
,
perf
+
2
);
*
len
=
nv
bios_rd
08
(
bios
,
perf
+
3
);
*
snr
=
0
;
*
ssz
=
0
;
return
perf
;
...
...
@@ -96,55 +96,55 @@ nvbios_perfEp(struct nvkm_bios *bios, int idx,
{
u16
perf
=
nvbios_perf_entry
(
bios
,
idx
,
ver
,
hdr
,
cnt
,
len
);
memset
(
info
,
0x00
,
sizeof
(
*
info
));
info
->
pstate
=
nv
_ro
08
(
bios
,
perf
+
0x00
);
info
->
pstate
=
nv
bios_rd
08
(
bios
,
perf
+
0x00
);
switch
(
!!
perf
*
*
ver
)
{
case
0x12
:
case
0x13
:
case
0x14
:
info
->
core
=
nv
_ro
32
(
bios
,
perf
+
0x01
)
*
10
;
info
->
memory
=
nv
_ro
32
(
bios
,
perf
+
0x05
)
*
20
;
info
->
fanspeed
=
nv
_ro
08
(
bios
,
perf
+
0x37
);
info
->
core
=
nv
bios_rd
32
(
bios
,
perf
+
0x01
)
*
10
;
info
->
memory
=
nv
bios_rd
32
(
bios
,
perf
+
0x05
)
*
20
;
info
->
fanspeed
=
nv
bios_rd
08
(
bios
,
perf
+
0x37
);
if
(
*
hdr
>
0x38
)
info
->
voltage
=
nv
_ro
08
(
bios
,
perf
+
0x38
);
info
->
voltage
=
nv
bios_rd
08
(
bios
,
perf
+
0x38
);
break
;
case
0x21
:
case
0x23
:
case
0x24
:
info
->
fanspeed
=
nv
_ro
08
(
bios
,
perf
+
0x04
);
info
->
voltage
=
nv
_ro
08
(
bios
,
perf
+
0x05
);
info
->
shader
=
nv
_ro
16
(
bios
,
perf
+
0x06
)
*
1000
;
info
->
fanspeed
=
nv
bios_rd
08
(
bios
,
perf
+
0x04
);
info
->
voltage
=
nv
bios_rd
08
(
bios
,
perf
+
0x05
);
info
->
shader
=
nv
bios_rd
16
(
bios
,
perf
+
0x06
)
*
1000
;
info
->
core
=
info
->
shader
+
(
signed
char
)
nv
_ro
08
(
bios
,
perf
+
0x08
)
*
1000
;
nv
bios_rd
08
(
bios
,
perf
+
0x08
)
*
1000
;
switch
(
nv_device
(
bios
)
->
chipset
)
{
case
0x49
:
case
0x4b
:
info
->
memory
=
nv
_ro
16
(
bios
,
perf
+
0x0b
)
*
1000
;
info
->
memory
=
nv
bios_rd
16
(
bios
,
perf
+
0x0b
)
*
1000
;
break
;
default:
info
->
memory
=
nv
_ro
16
(
bios
,
perf
+
0x0b
)
*
2000
;
info
->
memory
=
nv
bios_rd
16
(
bios
,
perf
+
0x0b
)
*
2000
;
break
;
}
break
;
case
0x25
:
info
->
fanspeed
=
nv
_ro
08
(
bios
,
perf
+
0x04
);
info
->
voltage
=
nv
_ro
08
(
bios
,
perf
+
0x05
);
info
->
core
=
nv
_ro
16
(
bios
,
perf
+
0x06
)
*
1000
;
info
->
shader
=
nv
_ro
16
(
bios
,
perf
+
0x0a
)
*
1000
;
info
->
memory
=
nv
_ro
16
(
bios
,
perf
+
0x0c
)
*
1000
;
info
->
fanspeed
=
nv
bios_rd
08
(
bios
,
perf
+
0x04
);
info
->
voltage
=
nv
bios_rd
08
(
bios
,
perf
+
0x05
);
info
->
core
=
nv
bios_rd
16
(
bios
,
perf
+
0x06
)
*
1000
;
info
->
shader
=
nv
bios_rd
16
(
bios
,
perf
+
0x0a
)
*
1000
;
info
->
memory
=
nv
bios_rd
16
(
bios
,
perf
+
0x0c
)
*
1000
;
break
;
case
0x30
:
info
->
script
=
nv
_ro
16
(
bios
,
perf
+
0x02
);
info
->
script
=
nv
bios_rd
16
(
bios
,
perf
+
0x02
);
case
0x35
:
info
->
fanspeed
=
nv
_ro
08
(
bios
,
perf
+
0x06
);
info
->
voltage
=
nv
_ro
08
(
bios
,
perf
+
0x07
);
info
->
core
=
nv
_ro
16
(
bios
,
perf
+
0x08
)
*
1000
;
info
->
shader
=
nv
_ro
16
(
bios
,
perf
+
0x0a
)
*
1000
;
info
->
memory
=
nv
_ro
16
(
bios
,
perf
+
0x0c
)
*
1000
;
info
->
vdec
=
nv
_ro
16
(
bios
,
perf
+
0x10
)
*
1000
;
info
->
disp
=
nv
_ro
16
(
bios
,
perf
+
0x14
)
*
1000
;
info
->
fanspeed
=
nv
bios_rd
08
(
bios
,
perf
+
0x06
);
info
->
voltage
=
nv
bios_rd
08
(
bios
,
perf
+
0x07
);
info
->
core
=
nv
bios_rd
16
(
bios
,
perf
+
0x08
)
*
1000
;
info
->
shader
=
nv
bios_rd
16
(
bios
,
perf
+
0x0a
)
*
1000
;
info
->
memory
=
nv
bios_rd
16
(
bios
,
perf
+
0x0c
)
*
1000
;
info
->
vdec
=
nv
bios_rd
16
(
bios
,
perf
+
0x10
)
*
1000
;
info
->
disp
=
nv
bios_rd
16
(
bios
,
perf
+
0x14
)
*
1000
;
break
;
case
0x40
:
info
->
voltage
=
nv
_ro
08
(
bios
,
perf
+
0x02
);
info
->
voltage
=
nv
bios_rd
08
(
bios
,
perf
+
0x02
);
break
;
default:
return
0x0000
;
...
...
@@ -173,7 +173,7 @@ nvbios_perfSp(struct nvkm_bios *bios, u32 perfE, int idx,
memset
(
info
,
0x00
,
sizeof
(
*
info
));
switch
(
!!
data
*
*
ver
)
{
case
0x40
:
info
->
v40
.
freq
=
(
nv
_ro
16
(
bios
,
data
+
0x00
)
&
0x3fff
)
*
1000
;
info
->
v40
.
freq
=
(
nv
bios_rd
16
(
bios
,
data
+
0x00
)
&
0x3fff
)
*
1000
;
break
;
default:
break
;
...
...
@@ -191,7 +191,7 @@ nvbios_perf_fan_parse(struct nvkm_bios *bios,
return
-
ENODEV
;
if
(
ver
>=
0x20
&&
ver
<
0x40
&&
hdr
>
6
)
fan
->
pwm_divisor
=
nv
_ro
16
(
bios
,
perf
+
6
);
fan
->
pwm_divisor
=
nv
bios_rd
16
(
bios
,
perf
+
6
);
else
fan
->
pwm_divisor
=
0
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c
View file @
7f5f518f
...
...
@@ -83,20 +83,20 @@ pll_limits_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
struct
bit_entry
bit_C
;
if
(
!
bit_entry
(
bios
,
'C'
,
&
bit_C
)
&&
bit_C
.
length
>=
10
)
{
u16
data
=
nv
_ro
16
(
bios
,
bit_C
.
offset
+
8
);
u16
data
=
nv
bios_rd
16
(
bios
,
bit_C
.
offset
+
8
);
if
(
data
)
{
*
ver
=
nv
_ro
08
(
bios
,
data
+
0
);
*
hdr
=
nv
_ro
08
(
bios
,
data
+
1
);
*
len
=
nv
_ro
08
(
bios
,
data
+
2
);
*
cnt
=
nv
_ro
08
(
bios
,
data
+
3
);
*
ver
=
nv
bios_rd
08
(
bios
,
data
+
0
);
*
hdr
=
nv
bios_rd
08
(
bios
,
data
+
1
);
*
len
=
nv
bios_rd
08
(
bios
,
data
+
2
);
*
cnt
=
nv
bios_rd
08
(
bios
,
data
+
3
);
return
data
;
}
}
if
(
bmp_version
(
bios
)
>=
0x0524
)
{
u16
data
=
nv
_ro
16
(
bios
,
bios
->
bmp_offset
+
142
);
u16
data
=
nv
bios_rd
16
(
bios
,
bios
->
bmp_offset
+
142
);
if
(
data
)
{
*
ver
=
nv
_ro
08
(
bios
,
data
+
0
);
*
ver
=
nv
bios_rd
08
(
bios
,
data
+
0
);
*
hdr
=
1
;
*
cnt
=
1
;
*
len
=
0x18
;
...
...
@@ -145,8 +145,8 @@ pll_map_reg(struct nvkm_bios *bios, u32 reg, u32 *type, u8 *ver, u8 *len)
if
(
data
&&
*
ver
>=
0x30
)
{
data
+=
hdr
;
while
(
cnt
--
)
{
if
(
nv
_ro
32
(
bios
,
data
+
3
)
==
reg
)
{
*
type
=
nv
_ro
08
(
bios
,
data
+
0
);
if
(
nv
bios_rd
32
(
bios
,
data
+
3
)
==
reg
)
{
*
type
=
nv
bios_rd
08
(
bios
,
data
+
0
);
return
data
;
}
data
+=
*
len
;
...
...
@@ -160,7 +160,7 @@ pll_map_reg(struct nvkm_bios *bios, u32 reg, u32 *type, u8 *ver, u8 *len)
u16
addr
=
(
data
+=
hdr
);
*
type
=
map
->
type
;
while
(
cnt
--
)
{
if
(
nv
_ro
32
(
bios
,
data
)
==
map
->
reg
)
if
(
nv
bios_rd
32
(
bios
,
data
)
==
map
->
reg
)
return
data
;
data
+=
*
len
;
}
...
...
@@ -187,8 +187,8 @@ pll_map_type(struct nvkm_bios *bios, u8 type, u32 *reg, u8 *ver, u8 *len)
if
(
data
&&
*
ver
>=
0x30
)
{
data
+=
hdr
;
while
(
cnt
--
)
{
if
(
nv
_ro
08
(
bios
,
data
+
0
)
==
type
)
{
*
reg
=
nv
_ro
32
(
bios
,
data
+
3
);
if
(
nv
bios_rd
08
(
bios
,
data
+
0
)
==
type
)
{
*
reg
=
nv
bios_rd
32
(
bios
,
data
+
3
);
return
data
;
}
data
+=
*
len
;
...
...
@@ -202,7 +202,7 @@ pll_map_type(struct nvkm_bios *bios, u8 type, u32 *reg, u8 *ver, u8 *len)
u16
addr
=
(
data
+=
hdr
);
*
reg
=
map
->
reg
;
while
(
cnt
--
)
{
if
(
nv
_ro
32
(
bios
,
data
)
==
map
->
reg
)
if
(
nv
bios_rd
32
(
bios
,
data
)
==
map
->
reg
)
return
data
;
data
+=
*
len
;
}
...
...
@@ -246,12 +246,12 @@ nvbios_pll_parse(struct nvkm_bios *bios, u32 type, struct nvbios_pll *info)
break
;
case
0x10
:
case
0x11
:
info
->
vco1
.
min_freq
=
nv
_ro
32
(
bios
,
data
+
0
);
info
->
vco1
.
max_freq
=
nv
_ro
32
(
bios
,
data
+
4
);
info
->
vco2
.
min_freq
=
nv
_ro
32
(
bios
,
data
+
8
);
info
->
vco2
.
max_freq
=
nv
_ro
32
(
bios
,
data
+
12
);
info
->
vco1
.
min_inputfreq
=
nv
_ro
32
(
bios
,
data
+
16
);
info
->
vco2
.
min_inputfreq
=
nv
_ro
32
(
bios
,
data
+
20
);
info
->
vco1
.
min_freq
=
nv
bios_rd
32
(
bios
,
data
+
0
);
info
->
vco1
.
max_freq
=
nv
bios_rd
32
(
bios
,
data
+
4
);
info
->
vco2
.
min_freq
=
nv
bios_rd
32
(
bios
,
data
+
8
);
info
->
vco2
.
max_freq
=
nv
bios_rd
32
(
bios
,
data
+
12
);
info
->
vco1
.
min_inputfreq
=
nv
bios_rd
32
(
bios
,
data
+
16
);
info
->
vco2
.
min_inputfreq
=
nv
bios_rd
32
(
bios
,
data
+
20
);
info
->
vco1
.
max_inputfreq
=
INT_MAX
;
info
->
vco2
.
max_inputfreq
=
INT_MAX
;
...
...
@@ -292,69 +292,69 @@ nvbios_pll_parse(struct nvkm_bios *bios, u32 type, struct nvbios_pll *info)
break
;
case
0x20
:
case
0x21
:
info
->
vco1
.
min_freq
=
nv
_ro
16
(
bios
,
data
+
4
)
*
1000
;
info
->
vco1
.
max_freq
=
nv
_ro
16
(
bios
,
data
+
6
)
*
1000
;
info
->
vco2
.
min_freq
=
nv
_ro
16
(
bios
,
data
+
8
)
*
1000
;
info
->
vco2
.
max_freq
=
nv
_ro
16
(
bios
,
data
+
10
)
*
1000
;
info
->
vco1
.
min_inputfreq
=
nv
_ro
16
(
bios
,
data
+
12
)
*
1000
;
info
->
vco2
.
min_inputfreq
=
nv
_ro
16
(
bios
,
data
+
14
)
*
1000
;
info
->
vco1
.
max_inputfreq
=
nv
_ro
16
(
bios
,
data
+
16
)
*
1000
;
info
->
vco2
.
max_inputfreq
=
nv
_ro
16
(
bios
,
data
+
18
)
*
1000
;
info
->
vco1
.
min_n
=
nv
_ro
08
(
bios
,
data
+
20
);
info
->
vco1
.
max_n
=
nv
_ro
08
(
bios
,
data
+
21
);
info
->
vco1
.
min_m
=
nv
_ro
08
(
bios
,
data
+
22
);
info
->
vco1
.
max_m
=
nv
_ro
08
(
bios
,
data
+
23
);
info
->
vco2
.
min_n
=
nv
_ro
08
(
bios
,
data
+
24
);
info
->
vco2
.
max_n
=
nv
_ro
08
(
bios
,
data
+
25
);
info
->
vco2
.
min_m
=
nv
_ro
08
(
bios
,
data
+
26
);
info
->
vco2
.
max_m
=
nv
_ro
08
(
bios
,
data
+
27
);
info
->
max_p
=
nv
_ro
08
(
bios
,
data
+
29
);
info
->
vco1
.
min_freq
=
nv
bios_rd
16
(
bios
,
data
+
4
)
*
1000
;
info
->
vco1
.
max_freq
=
nv
bios_rd
16
(
bios
,
data
+
6
)
*
1000
;
info
->
vco2
.
min_freq
=
nv
bios_rd
16
(
bios
,
data
+
8
)
*
1000
;
info
->
vco2
.
max_freq
=
nv
bios_rd
16
(
bios
,
data
+
10
)
*
1000
;
info
->
vco1
.
min_inputfreq
=
nv
bios_rd
16
(
bios
,
data
+
12
)
*
1000
;
info
->
vco2
.
min_inputfreq
=
nv
bios_rd
16
(
bios
,
data
+
14
)
*
1000
;
info
->
vco1
.
max_inputfreq
=
nv
bios_rd
16
(
bios
,
data
+
16
)
*
1000
;
info
->
vco2
.
max_inputfreq
=
nv
bios_rd
16
(
bios
,
data
+
18
)
*
1000
;
info
->
vco1
.
min_n
=
nv
bios_rd
08
(
bios
,
data
+
20
);
info
->
vco1
.
max_n
=
nv
bios_rd
08
(
bios
,
data
+
21
);
info
->
vco1
.
min_m
=
nv
bios_rd
08
(
bios
,
data
+
22
);
info
->
vco1
.
max_m
=
nv
bios_rd
08
(
bios
,
data
+
23
);
info
->
vco2
.
min_n
=
nv
bios_rd
08
(
bios
,
data
+
24
);
info
->
vco2
.
max_n
=
nv
bios_rd
08
(
bios
,
data
+
25
);
info
->
vco2
.
min_m
=
nv
bios_rd
08
(
bios
,
data
+
26
);
info
->
vco2
.
max_m
=
nv
bios_rd
08
(
bios
,
data
+
27
);
info
->
max_p
=
nv
bios_rd
08
(
bios
,
data
+
29
);
info
->
max_p_usable
=
info
->
max_p
;
if
(
bios
->
version
.
chip
<
0x60
)
info
->
max_p_usable
=
0x6
;
info
->
bias_p
=
nv
_ro
08
(
bios
,
data
+
30
);
info
->
bias_p
=
nv
bios_rd
08
(
bios
,
data
+
30
);
if
(
len
>
0x22
)
info
->
refclk
=
nv
_ro
32
(
bios
,
data
+
31
);
info
->
refclk
=
nv
bios_rd
32
(
bios
,
data
+
31
);
break
;
case
0x30
:
data
=
nv
_ro
16
(
bios
,
data
+
1
);
info
->
vco1
.
min_freq
=
nv
_ro
16
(
bios
,
data
+
0
)
*
1000
;
info
->
vco1
.
max_freq
=
nv
_ro
16
(
bios
,
data
+
2
)
*
1000
;
info
->
vco2
.
min_freq
=
nv
_ro
16
(
bios
,
data
+
4
)
*
1000
;
info
->
vco2
.
max_freq
=
nv
_ro
16
(
bios
,
data
+
6
)
*
1000
;
info
->
vco1
.
min_inputfreq
=
nv
_ro
16
(
bios
,
data
+
8
)
*
1000
;
info
->
vco2
.
min_inputfreq
=
nv
_ro
16
(
bios
,
data
+
10
)
*
1000
;
info
->
vco1
.
max_inputfreq
=
nv
_ro
16
(
bios
,
data
+
12
)
*
1000
;
info
->
vco2
.
max_inputfreq
=
nv
_ro
16
(
bios
,
data
+
14
)
*
1000
;
info
->
vco1
.
min_n
=
nv
_ro
08
(
bios
,
data
+
16
);
info
->
vco1
.
max_n
=
nv
_ro
08
(
bios
,
data
+
17
);
info
->
vco1
.
min_m
=
nv
_ro
08
(
bios
,
data
+
18
);
info
->
vco1
.
max_m
=
nv
_ro
08
(
bios
,
data
+
19
);
info
->
vco2
.
min_n
=
nv
_ro
08
(
bios
,
data
+
20
);
info
->
vco2
.
max_n
=
nv
_ro
08
(
bios
,
data
+
21
);
info
->
vco2
.
min_m
=
nv
_ro
08
(
bios
,
data
+
22
);
info
->
vco2
.
max_m
=
nv
_ro
08
(
bios
,
data
+
23
);
info
->
max_p_usable
=
info
->
max_p
=
nv
_ro
08
(
bios
,
data
+
25
);
info
->
bias_p
=
nv
_ro
08
(
bios
,
data
+
27
);
info
->
refclk
=
nv
_ro
32
(
bios
,
data
+
28
);
data
=
nv
bios_rd
16
(
bios
,
data
+
1
);
info
->
vco1
.
min_freq
=
nv
bios_rd
16
(
bios
,
data
+
0
)
*
1000
;
info
->
vco1
.
max_freq
=
nv
bios_rd
16
(
bios
,
data
+
2
)
*
1000
;
info
->
vco2
.
min_freq
=
nv
bios_rd
16
(
bios
,
data
+
4
)
*
1000
;
info
->
vco2
.
max_freq
=
nv
bios_rd
16
(
bios
,
data
+
6
)
*
1000
;
info
->
vco1
.
min_inputfreq
=
nv
bios_rd
16
(
bios
,
data
+
8
)
*
1000
;
info
->
vco2
.
min_inputfreq
=
nv
bios_rd
16
(
bios
,
data
+
10
)
*
1000
;
info
->
vco1
.
max_inputfreq
=
nv
bios_rd
16
(
bios
,
data
+
12
)
*
1000
;
info
->
vco2
.
max_inputfreq
=
nv
bios_rd
16
(
bios
,
data
+
14
)
*
1000
;
info
->
vco1
.
min_n
=
nv
bios_rd
08
(
bios
,
data
+
16
);
info
->
vco1
.
max_n
=
nv
bios_rd
08
(
bios
,
data
+
17
);
info
->
vco1
.
min_m
=
nv
bios_rd
08
(
bios
,
data
+
18
);
info
->
vco1
.
max_m
=
nv
bios_rd
08
(
bios
,
data
+
19
);
info
->
vco2
.
min_n
=
nv
bios_rd
08
(
bios
,
data
+
20
);
info
->
vco2
.
max_n
=
nv
bios_rd
08
(
bios
,
data
+
21
);
info
->
vco2
.
min_m
=
nv
bios_rd
08
(
bios
,
data
+
22
);
info
->
vco2
.
max_m
=
nv
bios_rd
08
(
bios
,
data
+
23
);
info
->
max_p_usable
=
info
->
max_p
=
nv
bios_rd
08
(
bios
,
data
+
25
);
info
->
bias_p
=
nv
bios_rd
08
(
bios
,
data
+
27
);
info
->
refclk
=
nv
bios_rd
32
(
bios
,
data
+
28
);
break
;
case
0x40
:
info
->
refclk
=
nv
_ro
16
(
bios
,
data
+
9
)
*
1000
;
data
=
nv
_ro
16
(
bios
,
data
+
1
);
info
->
vco1
.
min_freq
=
nv
_ro
16
(
bios
,
data
+
0
)
*
1000
;
info
->
vco1
.
max_freq
=
nv
_ro
16
(
bios
,
data
+
2
)
*
1000
;
info
->
vco1
.
min_inputfreq
=
nv
_ro
16
(
bios
,
data
+
4
)
*
1000
;
info
->
vco1
.
max_inputfreq
=
nv
_ro
16
(
bios
,
data
+
6
)
*
1000
;
info
->
vco1
.
min_m
=
nv
_ro
08
(
bios
,
data
+
8
);
info
->
vco1
.
max_m
=
nv
_ro
08
(
bios
,
data
+
9
);
info
->
vco1
.
min_n
=
nv
_ro
08
(
bios
,
data
+
10
);
info
->
vco1
.
max_n
=
nv
_ro
08
(
bios
,
data
+
11
);
info
->
min_p
=
nv
_ro
08
(
bios
,
data
+
12
);
info
->
max_p
=
nv
_ro
08
(
bios
,
data
+
13
);
info
->
refclk
=
nv
bios_rd
16
(
bios
,
data
+
9
)
*
1000
;
data
=
nv
bios_rd
16
(
bios
,
data
+
1
);
info
->
vco1
.
min_freq
=
nv
bios_rd
16
(
bios
,
data
+
0
)
*
1000
;
info
->
vco1
.
max_freq
=
nv
bios_rd
16
(
bios
,
data
+
2
)
*
1000
;
info
->
vco1
.
min_inputfreq
=
nv
bios_rd
16
(
bios
,
data
+
4
)
*
1000
;
info
->
vco1
.
max_inputfreq
=
nv
bios_rd
16
(
bios
,
data
+
6
)
*
1000
;
info
->
vco1
.
min_m
=
nv
bios_rd
08
(
bios
,
data
+
8
);
info
->
vco1
.
max_m
=
nv
bios_rd
08
(
bios
,
data
+
9
);
info
->
vco1
.
min_n
=
nv
bios_rd
08
(
bios
,
data
+
10
);
info
->
vco1
.
max_n
=
nv
bios_rd
08
(
bios
,
data
+
11
);
info
->
min_p
=
nv
bios_rd
08
(
bios
,
data
+
12
);
info
->
max_p
=
nv
bios_rd
08
(
bios
,
data
+
13
);
break
;
default:
nvkm_error
(
subdev
,
"unknown pll limits version 0x%02x
\n
"
,
ver
);
...
...
@@ -381,8 +381,8 @@ nvbios_pll_parse(struct nvkm_bios *bios, u32 type, struct nvbios_pll *info)
* with an empty limit table (seen on nv18)
*/
if
(
!
info
->
vco1
.
max_freq
)
{
info
->
vco1
.
max_freq
=
nv
_ro
32
(
bios
,
bios
->
bmp_offset
+
67
);
info
->
vco1
.
min_freq
=
nv
_ro
32
(
bios
,
bios
->
bmp_offset
+
71
);
info
->
vco1
.
max_freq
=
nv
bios_rd
32
(
bios
,
bios
->
bmp_offset
+
67
);
info
->
vco1
.
min_freq
=
nv
bios_rd
32
(
bios
,
bios
->
bmp_offset
+
71
);
if
(
bmp_version
(
bios
)
<
0x0506
)
{
info
->
vco1
.
max_freq
=
256000
;
info
->
vco1
.
min_freq
=
128000
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pmu.c
View file @
7f5f518f
...
...
@@ -49,12 +49,12 @@ nvbios_pmuTe(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
if
(
!
bit_entry
(
bios
,
'p'
,
&
bit_p
))
{
if
(
bit_p
.
version
==
2
&&
bit_p
.
length
>=
4
)
data
=
nv
_ro
32
(
bios
,
bit_p
.
offset
+
0x00
);
data
=
nv
bios_rd
32
(
bios
,
bit_p
.
offset
+
0x00
);
if
((
data
=
weirdo_pointer
(
bios
,
data
)))
{
*
ver
=
nv
_ro
08
(
bios
,
data
+
0x00
);
/* maybe? */
*
hdr
=
nv
_ro
08
(
bios
,
data
+
0x01
);
*
len
=
nv
_ro
08
(
bios
,
data
+
0x02
);
*
cnt
=
nv
_ro
08
(
bios
,
data
+
0x03
);
*
ver
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
/* maybe? */
*
hdr
=
nv
bios_rd
08
(
bios
,
data
+
0x01
);
*
len
=
nv
bios_rd
08
(
bios
,
data
+
0x02
);
*
cnt
=
nv
bios_rd
08
(
bios
,
data
+
0x03
);
}
}
...
...
@@ -95,8 +95,8 @@ nvbios_pmuEp(struct nvkm_bios *bios, int idx, u8 *ver, u8 *hdr,
memset
(
info
,
0x00
,
sizeof
(
*
info
));
switch
(
!!
data
*
*
ver
)
{
default:
info
->
type
=
nv
_ro
08
(
bios
,
data
+
0x00
);
info
->
data
=
nv
_ro
32
(
bios
,
data
+
0x02
);
info
->
type
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
info
->
data
=
nv
bios_rd
32
(
bios
,
data
+
0x02
);
break
;
}
return
data
;
...
...
@@ -112,21 +112,21 @@ nvbios_pmuRm(struct nvkm_bios *bios, u8 type, struct nvbios_pmuR *info)
while
((
data
=
nvbios_pmuEp
(
bios
,
idx
++
,
&
ver
,
&
hdr
,
&
pmuE
)))
{
if
(
pmuE
.
type
==
type
&&
(
data
=
weirdo_pointer
(
bios
,
pmuE
.
data
)))
{
info
->
init_addr_pmu
=
nv
_ro
32
(
bios
,
data
+
0x08
);
info
->
args_addr_pmu
=
nv
_ro
32
(
bios
,
data
+
0x0c
);
info
->
init_addr_pmu
=
nv
bios_rd
32
(
bios
,
data
+
0x08
);
info
->
args_addr_pmu
=
nv
bios_rd
32
(
bios
,
data
+
0x0c
);
info
->
boot_addr
=
data
+
0x30
;
info
->
boot_addr_pmu
=
nv
_ro
32
(
bios
,
data
+
0x10
)
+
nv
_ro
32
(
bios
,
data
+
0x18
);
info
->
boot_size
=
nv
_ro
32
(
bios
,
data
+
0x1c
)
-
nv
_ro
32
(
bios
,
data
+
0x18
);
info
->
boot_addr_pmu
=
nv
bios_rd
32
(
bios
,
data
+
0x10
)
+
nv
bios_rd
32
(
bios
,
data
+
0x18
);
info
->
boot_size
=
nv
bios_rd
32
(
bios
,
data
+
0x1c
)
-
nv
bios_rd
32
(
bios
,
data
+
0x18
);
info
->
code_addr
=
info
->
boot_addr
+
info
->
boot_size
;
info
->
code_addr_pmu
=
info
->
boot_addr_pmu
+
info
->
boot_size
;
info
->
code_size
=
nv
_ro
32
(
bios
,
data
+
0x20
);
info
->
code_size
=
nv
bios_rd
32
(
bios
,
data
+
0x20
);
info
->
data_addr
=
data
+
0x30
+
nv
_ro
32
(
bios
,
data
+
0x24
);
info
->
data_addr_pmu
=
nv
_ro
32
(
bios
,
data
+
0x28
);
info
->
data_size
=
nv
_ro
32
(
bios
,
data
+
0x2c
);
nv
bios_rd
32
(
bios
,
data
+
0x24
);
info
->
data_addr_pmu
=
nv
bios_rd
32
(
bios
,
data
+
0x28
);
info
->
data_size
=
nv
bios_rd
32
(
bios
,
data
+
0x2c
);
return
true
;
}
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/ramcfg.c
View file @
7f5f518f
...
...
@@ -39,9 +39,9 @@ nvbios_ramcfg_count(struct nvkm_bios *bios)
if
(
!
bit_entry
(
bios
,
'M'
,
&
bit_M
))
{
if
(
bit_M
.
version
==
1
&&
bit_M
.
length
>=
5
)
return
nv
_ro
08
(
bios
,
bit_M
.
offset
+
2
);
return
nv
bios_rd
08
(
bios
,
bit_M
.
offset
+
2
);
if
(
bit_M
.
version
==
2
&&
bit_M
.
length
>=
3
)
return
nv
_ro
08
(
bios
,
bit_M
.
offset
+
0
);
return
nv
bios_rd
08
(
bios
,
bit_M
.
offset
+
0
);
}
return
0x00
;
...
...
@@ -59,7 +59,7 @@ nvbios_ramcfg_index(struct nvkm_subdev *subdev)
if
(
!
bit_entry
(
bios
,
'M'
,
&
bit_M
))
{
if
(
bit_M
.
version
==
1
&&
bit_M
.
length
>=
5
)
xlat
=
nv
_ro
16
(
bios
,
bit_M
.
offset
+
3
);
xlat
=
nv
bios_rd
16
(
bios
,
bit_M
.
offset
+
3
);
if
(
bit_M
.
version
==
2
&&
bit_M
.
length
>=
3
)
{
/*XXX: is M ever shorter than this?
* if not - what is xlat used for now?
...
...
@@ -68,11 +68,11 @@ nvbios_ramcfg_index(struct nvkm_subdev *subdev)
if
(
bit_M
.
length
>=
7
&&
nvbios_M0203Em
(
bios
,
strap
,
&
ver
,
&
hdr
,
&
M0203E
))
return
M0203E
.
group
;
xlat
=
nv
_ro
16
(
bios
,
bit_M
.
offset
+
1
);
xlat
=
nv
bios_rd
16
(
bios
,
bit_M
.
offset
+
1
);
}
}
if
(
xlat
)
strap
=
nv
_ro
08
(
bios
,
xlat
+
strap
);
strap
=
nv
bios_rd
08
(
bios
,
xlat
+
strap
);
return
strap
;
}
drivers/gpu/drm/nouveau/nvkm/subdev/bios/rammap.c
View file @
7f5f518f
...
...
@@ -34,18 +34,18 @@ nvbios_rammapTe(struct nvkm_bios *bios, u8 *ver, u8 *hdr,
if
(
!
bit_entry
(
bios
,
'P'
,
&
bit_P
))
{
if
(
bit_P
.
version
==
2
)
rammap
=
nv
_ro
16
(
bios
,
bit_P
.
offset
+
4
);
rammap
=
nv
bios_rd
16
(
bios
,
bit_P
.
offset
+
4
);
if
(
rammap
)
{
*
ver
=
nv
_ro
08
(
bios
,
rammap
+
0
);
*
ver
=
nv
bios_rd
08
(
bios
,
rammap
+
0
);
switch
(
*
ver
)
{
case
0x10
:
case
0x11
:
*
hdr
=
nv
_ro
08
(
bios
,
rammap
+
1
);
*
cnt
=
nv
_ro
08
(
bios
,
rammap
+
5
);
*
len
=
nv
_ro
08
(
bios
,
rammap
+
2
);
*
snr
=
nv
_ro
08
(
bios
,
rammap
+
4
);
*
ssz
=
nv
_ro
08
(
bios
,
rammap
+
3
);
*
hdr
=
nv
bios_rd
08
(
bios
,
rammap
+
1
);
*
cnt
=
nv
bios_rd
08
(
bios
,
rammap
+
5
);
*
len
=
nv
bios_rd
08
(
bios
,
rammap
+
2
);
*
snr
=
nv
bios_rd
08
(
bios
,
rammap
+
4
);
*
ssz
=
nv
bios_rd
08
(
bios
,
rammap
+
3
);
return
rammap
;
default:
break
;
...
...
@@ -80,9 +80,9 @@ nvbios_rammapEp_from_perf(struct nvkm_bios *bios, u32 data, u8 size,
{
memset
(
p
,
0x00
,
sizeof
(
*
p
));
p
->
rammap_00_16_20
=
(
nv
_ro
08
(
bios
,
data
+
0x16
)
&
0x20
)
>>
5
;
p
->
rammap_00_16_40
=
(
nv
_ro
08
(
bios
,
data
+
0x16
)
&
0x40
)
>>
6
;
p
->
rammap_00_17_02
=
(
nv
_ro
08
(
bios
,
data
+
0x17
)
&
0x02
)
>>
1
;
p
->
rammap_00_16_20
=
(
nv
bios_rd
08
(
bios
,
data
+
0x16
)
&
0x20
)
>>
5
;
p
->
rammap_00_16_40
=
(
nv
bios_rd
08
(
bios
,
data
+
0x16
)
&
0x40
)
>>
6
;
p
->
rammap_00_17_02
=
(
nv
bios_rd
08
(
bios
,
data
+
0x17
)
&
0x02
)
>>
1
;
return
data
;
}
...
...
@@ -97,18 +97,18 @@ nvbios_rammapEp(struct nvkm_bios *bios, int idx,
p
->
rammap_hdr
=
*
hdr
;
switch
(
!!
data
*
*
ver
)
{
case
0x10
:
p
->
rammap_min
=
nv
_ro
16
(
bios
,
data
+
0x00
);
p
->
rammap_max
=
nv
_ro
16
(
bios
,
data
+
0x02
);
p
->
rammap_10_04_02
=
(
nv
_ro
08
(
bios
,
data
+
0x04
)
&
0x02
)
>>
1
;
p
->
rammap_10_04_08
=
(
nv
_ro
08
(
bios
,
data
+
0x04
)
&
0x08
)
>>
3
;
p
->
rammap_min
=
nv
bios_rd
16
(
bios
,
data
+
0x00
);
p
->
rammap_max
=
nv
bios_rd
16
(
bios
,
data
+
0x02
);
p
->
rammap_10_04_02
=
(
nv
bios_rd
08
(
bios
,
data
+
0x04
)
&
0x02
)
>>
1
;
p
->
rammap_10_04_08
=
(
nv
bios_rd
08
(
bios
,
data
+
0x04
)
&
0x08
)
>>
3
;
break
;
case
0x11
:
p
->
rammap_min
=
nv
_ro
16
(
bios
,
data
+
0x00
);
p
->
rammap_max
=
nv
_ro
16
(
bios
,
data
+
0x02
);
p
->
rammap_11_08_01
=
(
nv
_ro
08
(
bios
,
data
+
0x08
)
&
0x01
)
>>
0
;
p
->
rammap_11_08_0c
=
(
nv
_ro
08
(
bios
,
data
+
0x08
)
&
0x0c
)
>>
2
;
p
->
rammap_11_08_10
=
(
nv
_ro
08
(
bios
,
data
+
0x08
)
&
0x10
)
>>
4
;
temp
=
nv
_ro
32
(
bios
,
data
+
0x09
);
p
->
rammap_min
=
nv
bios_rd
16
(
bios
,
data
+
0x00
);
p
->
rammap_max
=
nv
bios_rd
16
(
bios
,
data
+
0x02
);
p
->
rammap_11_08_01
=
(
nv
bios_rd
08
(
bios
,
data
+
0x08
)
&
0x01
)
>>
0
;
p
->
rammap_11_08_0c
=
(
nv
bios_rd
08
(
bios
,
data
+
0x08
)
&
0x0c
)
>>
2
;
p
->
rammap_11_08_10
=
(
nv
bios_rd
08
(
bios
,
data
+
0x08
)
&
0x10
)
>>
4
;
temp
=
nv
bios_rd
32
(
bios
,
data
+
0x09
);
p
->
rammap_11_09_01ff
=
(
temp
&
0x000001ff
)
>>
0
;
p
->
rammap_11_0a_03fe
=
(
temp
&
0x0003fe00
)
>>
9
;
p
->
rammap_11_0a_0400
=
(
temp
&
0x00040000
)
>>
18
;
...
...
@@ -117,10 +117,10 @@ nvbios_rammapEp(struct nvkm_bios *bios, int idx,
p
->
rammap_11_0b_0200
=
(
temp
&
0x02000000
)
>>
25
;
p
->
rammap_11_0b_0400
=
(
temp
&
0x04000000
)
>>
26
;
p
->
rammap_11_0b_0800
=
(
temp
&
0x08000000
)
>>
27
;
p
->
rammap_11_0d
=
nv
_ro
08
(
bios
,
data
+
0x0d
);
p
->
rammap_11_0e
=
nv
_ro
08
(
bios
,
data
+
0x0e
);
p
->
rammap_11_0f
=
nv
_ro
08
(
bios
,
data
+
0x0f
);
p
->
rammap_11_11_0c
=
(
nv
_ro
08
(
bios
,
data
+
0x11
)
&
0x0c
)
>>
2
;
p
->
rammap_11_0d
=
nv
bios_rd
08
(
bios
,
data
+
0x0d
);
p
->
rammap_11_0e
=
nv
bios_rd
08
(
bios
,
data
+
0x0e
);
p
->
rammap_11_0f
=
nv
bios_rd
08
(
bios
,
data
+
0x0f
);
p
->
rammap_11_11_0c
=
(
nv
bios_rd
08
(
bios
,
data
+
0x11
)
&
0x0c
)
>>
2
;
break
;
default:
data
=
0
;
...
...
@@ -165,22 +165,22 @@ nvbios_rammapSp_from_perf(struct nvkm_bios *bios, u32 data, u8 size, int idx,
return
0x00000000
;
p
->
ramcfg_ver
=
0
;
p
->
ramcfg_timing
=
nv
_ro
08
(
bios
,
data
+
0x01
);
p
->
ramcfg_00_03_01
=
(
nv
_ro
08
(
bios
,
data
+
0x03
)
&
0x01
)
>>
0
;
p
->
ramcfg_00_03_02
=
(
nv
_ro
08
(
bios
,
data
+
0x03
)
&
0x02
)
>>
1
;
p
->
ramcfg_DLLoff
=
(
nv
_ro
08
(
bios
,
data
+
0x03
)
&
0x04
)
>>
2
;
p
->
ramcfg_00_03_08
=
(
nv
_ro
08
(
bios
,
data
+
0x03
)
&
0x08
)
>>
3
;
p
->
ramcfg_RON
=
(
nv
_ro
08
(
bios
,
data
+
0x03
)
&
0x10
)
>>
3
;
p
->
ramcfg_00_04_02
=
(
nv
_ro
08
(
bios
,
data
+
0x04
)
&
0x02
)
>>
1
;
p
->
ramcfg_00_04_04
=
(
nv
_ro
08
(
bios
,
data
+
0x04
)
&
0x04
)
>>
2
;
p
->
ramcfg_00_04_20
=
(
nv
_ro
08
(
bios
,
data
+
0x04
)
&
0x20
)
>>
5
;
p
->
ramcfg_00_05
=
(
nv
_ro
08
(
bios
,
data
+
0x05
)
&
0xff
)
>>
0
;
p
->
ramcfg_00_06
=
(
nv
_ro
08
(
bios
,
data
+
0x06
)
&
0xff
)
>>
0
;
p
->
ramcfg_00_07
=
(
nv
_ro
08
(
bios
,
data
+
0x07
)
&
0xff
)
>>
0
;
p
->
ramcfg_00_08
=
(
nv
_ro
08
(
bios
,
data
+
0x08
)
&
0xff
)
>>
0
;
p
->
ramcfg_00_09
=
(
nv
_ro
08
(
bios
,
data
+
0x09
)
&
0xff
)
>>
0
;
p
->
ramcfg_00_0a_0f
=
(
nv
_ro
08
(
bios
,
data
+
0x0a
)
&
0x0f
)
>>
0
;
p
->
ramcfg_00_0a_f0
=
(
nv
_ro
08
(
bios
,
data
+
0x0a
)
&
0xf0
)
>>
4
;
p
->
ramcfg_timing
=
nv
bios_rd
08
(
bios
,
data
+
0x01
);
p
->
ramcfg_00_03_01
=
(
nv
bios_rd
08
(
bios
,
data
+
0x03
)
&
0x01
)
>>
0
;
p
->
ramcfg_00_03_02
=
(
nv
bios_rd
08
(
bios
,
data
+
0x03
)
&
0x02
)
>>
1
;
p
->
ramcfg_DLLoff
=
(
nv
bios_rd
08
(
bios
,
data
+
0x03
)
&
0x04
)
>>
2
;
p
->
ramcfg_00_03_08
=
(
nv
bios_rd
08
(
bios
,
data
+
0x03
)
&
0x08
)
>>
3
;
p
->
ramcfg_RON
=
(
nv
bios_rd
08
(
bios
,
data
+
0x03
)
&
0x10
)
>>
3
;
p
->
ramcfg_00_04_02
=
(
nv
bios_rd
08
(
bios
,
data
+
0x04
)
&
0x02
)
>>
1
;
p
->
ramcfg_00_04_04
=
(
nv
bios_rd
08
(
bios
,
data
+
0x04
)
&
0x04
)
>>
2
;
p
->
ramcfg_00_04_20
=
(
nv
bios_rd
08
(
bios
,
data
+
0x04
)
&
0x20
)
>>
5
;
p
->
ramcfg_00_05
=
(
nv
bios_rd
08
(
bios
,
data
+
0x05
)
&
0xff
)
>>
0
;
p
->
ramcfg_00_06
=
(
nv
bios_rd
08
(
bios
,
data
+
0x06
)
&
0xff
)
>>
0
;
p
->
ramcfg_00_07
=
(
nv
bios_rd
08
(
bios
,
data
+
0x07
)
&
0xff
)
>>
0
;
p
->
ramcfg_00_08
=
(
nv
bios_rd
08
(
bios
,
data
+
0x08
)
&
0xff
)
>>
0
;
p
->
ramcfg_00_09
=
(
nv
bios_rd
08
(
bios
,
data
+
0x09
)
&
0xff
)
>>
0
;
p
->
ramcfg_00_0a_0f
=
(
nv
bios_rd
08
(
bios
,
data
+
0x0a
)
&
0x0f
)
>>
0
;
p
->
ramcfg_00_0a_f0
=
(
nv
bios_rd
08
(
bios
,
data
+
0x0a
)
&
0xf0
)
>>
4
;
return
data
;
}
...
...
@@ -195,58 +195,58 @@ nvbios_rammapSp(struct nvkm_bios *bios, u32 data,
p
->
ramcfg_hdr
=
*
hdr
;
switch
(
!!
data
*
*
ver
)
{
case
0x10
:
p
->
ramcfg_timing
=
nv
_ro
08
(
bios
,
data
+
0x01
);
p
->
ramcfg_10_02_01
=
(
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x01
)
>>
0
;
p
->
ramcfg_10_02_02
=
(
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x02
)
>>
1
;
p
->
ramcfg_10_02_04
=
(
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x04
)
>>
2
;
p
->
ramcfg_10_02_08
=
(
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x08
)
>>
3
;
p
->
ramcfg_10_02_10
=
(
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x10
)
>>
4
;
p
->
ramcfg_10_02_20
=
(
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x20
)
>>
5
;
p
->
ramcfg_DLLoff
=
(
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x40
)
>>
6
;
p
->
ramcfg_10_03_0f
=
(
nv
_ro
08
(
bios
,
data
+
0x03
)
&
0x0f
)
>>
0
;
p
->
ramcfg_10_04_01
=
(
nv
_ro
08
(
bios
,
data
+
0x04
)
&
0x01
)
>>
0
;
p
->
ramcfg_10_05
=
(
nv
_ro
08
(
bios
,
data
+
0x05
)
&
0xff
)
>>
0
;
p
->
ramcfg_10_06
=
(
nv
_ro
08
(
bios
,
data
+
0x06
)
&
0xff
)
>>
0
;
p
->
ramcfg_10_07
=
(
nv
_ro
08
(
bios
,
data
+
0x07
)
&
0xff
)
>>
0
;
p
->
ramcfg_10_08
=
(
nv
_ro
08
(
bios
,
data
+
0x08
)
&
0xff
)
>>
0
;
p
->
ramcfg_10_09_0f
=
(
nv
_ro
08
(
bios
,
data
+
0x09
)
&
0x0f
)
>>
0
;
p
->
ramcfg_10_09_f0
=
(
nv
_ro
08
(
bios
,
data
+
0x09
)
&
0xf0
)
>>
4
;
p
->
ramcfg_timing
=
nv
bios_rd
08
(
bios
,
data
+
0x01
);
p
->
ramcfg_10_02_01
=
(
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x01
)
>>
0
;
p
->
ramcfg_10_02_02
=
(
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x02
)
>>
1
;
p
->
ramcfg_10_02_04
=
(
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x04
)
>>
2
;
p
->
ramcfg_10_02_08
=
(
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x08
)
>>
3
;
p
->
ramcfg_10_02_10
=
(
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x10
)
>>
4
;
p
->
ramcfg_10_02_20
=
(
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x20
)
>>
5
;
p
->
ramcfg_DLLoff
=
(
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x40
)
>>
6
;
p
->
ramcfg_10_03_0f
=
(
nv
bios_rd
08
(
bios
,
data
+
0x03
)
&
0x0f
)
>>
0
;
p
->
ramcfg_10_04_01
=
(
nv
bios_rd
08
(
bios
,
data
+
0x04
)
&
0x01
)
>>
0
;
p
->
ramcfg_10_05
=
(
nv
bios_rd
08
(
bios
,
data
+
0x05
)
&
0xff
)
>>
0
;
p
->
ramcfg_10_06
=
(
nv
bios_rd
08
(
bios
,
data
+
0x06
)
&
0xff
)
>>
0
;
p
->
ramcfg_10_07
=
(
nv
bios_rd
08
(
bios
,
data
+
0x07
)
&
0xff
)
>>
0
;
p
->
ramcfg_10_08
=
(
nv
bios_rd
08
(
bios
,
data
+
0x08
)
&
0xff
)
>>
0
;
p
->
ramcfg_10_09_0f
=
(
nv
bios_rd
08
(
bios
,
data
+
0x09
)
&
0x0f
)
>>
0
;
p
->
ramcfg_10_09_f0
=
(
nv
bios_rd
08
(
bios
,
data
+
0x09
)
&
0xf0
)
>>
4
;
break
;
case
0x11
:
p
->
ramcfg_timing
=
nv
_ro
08
(
bios
,
data
+
0x00
);
p
->
ramcfg_11_01_01
=
(
nv
_ro
08
(
bios
,
data
+
0x01
)
&
0x01
)
>>
0
;
p
->
ramcfg_11_01_02
=
(
nv
_ro
08
(
bios
,
data
+
0x01
)
&
0x02
)
>>
1
;
p
->
ramcfg_11_01_04
=
(
nv
_ro
08
(
bios
,
data
+
0x01
)
&
0x04
)
>>
2
;
p
->
ramcfg_11_01_08
=
(
nv
_ro
08
(
bios
,
data
+
0x01
)
&
0x08
)
>>
3
;
p
->
ramcfg_11_01_10
=
(
nv
_ro
08
(
bios
,
data
+
0x01
)
&
0x10
)
>>
4
;
p
->
ramcfg_11_01_20
=
(
nv
_ro
08
(
bios
,
data
+
0x01
)
&
0x20
)
>>
5
;
p
->
ramcfg_11_01_40
=
(
nv
_ro
08
(
bios
,
data
+
0x01
)
&
0x40
)
>>
6
;
p
->
ramcfg_11_01_80
=
(
nv
_ro
08
(
bios
,
data
+
0x01
)
&
0x80
)
>>
7
;
p
->
ramcfg_11_02_03
=
(
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x03
)
>>
0
;
p
->
ramcfg_11_02_04
=
(
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x04
)
>>
2
;
p
->
ramcfg_11_02_08
=
(
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x08
)
>>
3
;
p
->
ramcfg_11_02_10
=
(
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x10
)
>>
4
;
p
->
ramcfg_11_02_40
=
(
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x40
)
>>
6
;
p
->
ramcfg_11_02_80
=
(
nv
_ro
08
(
bios
,
data
+
0x02
)
&
0x80
)
>>
7
;
p
->
ramcfg_11_03_0f
=
(
nv
_ro
08
(
bios
,
data
+
0x03
)
&
0x0f
)
>>
0
;
p
->
ramcfg_11_03_30
=
(
nv
_ro
08
(
bios
,
data
+
0x03
)
&
0x30
)
>>
4
;
p
->
ramcfg_11_03_c0
=
(
nv
_ro
08
(
bios
,
data
+
0x03
)
&
0xc0
)
>>
6
;
p
->
ramcfg_11_03_f0
=
(
nv
_ro
08
(
bios
,
data
+
0x03
)
&
0xf0
)
>>
4
;
p
->
ramcfg_11_04
=
(
nv
_ro
08
(
bios
,
data
+
0x04
)
&
0xff
)
>>
0
;
p
->
ramcfg_11_06
=
(
nv
_ro
08
(
bios
,
data
+
0x06
)
&
0xff
)
>>
0
;
p
->
ramcfg_11_07_02
=
(
nv
_ro
08
(
bios
,
data
+
0x07
)
&
0x02
)
>>
1
;
p
->
ramcfg_11_07_04
=
(
nv
_ro
08
(
bios
,
data
+
0x07
)
&
0x04
)
>>
2
;
p
->
ramcfg_11_07_08
=
(
nv
_ro
08
(
bios
,
data
+
0x07
)
&
0x08
)
>>
3
;
p
->
ramcfg_11_07_10
=
(
nv
_ro
08
(
bios
,
data
+
0x07
)
&
0x10
)
>>
4
;
p
->
ramcfg_11_07_40
=
(
nv
_ro
08
(
bios
,
data
+
0x07
)
&
0x40
)
>>
6
;
p
->
ramcfg_11_07_80
=
(
nv
_ro
08
(
bios
,
data
+
0x07
)
&
0x80
)
>>
7
;
p
->
ramcfg_11_08_01
=
(
nv
_ro
08
(
bios
,
data
+
0x08
)
&
0x01
)
>>
0
;
p
->
ramcfg_11_08_02
=
(
nv
_ro
08
(
bios
,
data
+
0x08
)
&
0x02
)
>>
1
;
p
->
ramcfg_11_08_04
=
(
nv
_ro
08
(
bios
,
data
+
0x08
)
&
0x04
)
>>
2
;
p
->
ramcfg_11_08_08
=
(
nv
_ro
08
(
bios
,
data
+
0x08
)
&
0x08
)
>>
3
;
p
->
ramcfg_11_08_10
=
(
nv
_ro
08
(
bios
,
data
+
0x08
)
&
0x10
)
>>
4
;
p
->
ramcfg_11_08_20
=
(
nv
_ro
08
(
bios
,
data
+
0x08
)
&
0x20
)
>>
5
;
p
->
ramcfg_11_09
=
(
nv
_ro
08
(
bios
,
data
+
0x09
)
&
0xff
)
>>
0
;
p
->
ramcfg_timing
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
p
->
ramcfg_11_01_01
=
(
nv
bios_rd
08
(
bios
,
data
+
0x01
)
&
0x01
)
>>
0
;
p
->
ramcfg_11_01_02
=
(
nv
bios_rd
08
(
bios
,
data
+
0x01
)
&
0x02
)
>>
1
;
p
->
ramcfg_11_01_04
=
(
nv
bios_rd
08
(
bios
,
data
+
0x01
)
&
0x04
)
>>
2
;
p
->
ramcfg_11_01_08
=
(
nv
bios_rd
08
(
bios
,
data
+
0x01
)
&
0x08
)
>>
3
;
p
->
ramcfg_11_01_10
=
(
nv
bios_rd
08
(
bios
,
data
+
0x01
)
&
0x10
)
>>
4
;
p
->
ramcfg_11_01_20
=
(
nv
bios_rd
08
(
bios
,
data
+
0x01
)
&
0x20
)
>>
5
;
p
->
ramcfg_11_01_40
=
(
nv
bios_rd
08
(
bios
,
data
+
0x01
)
&
0x40
)
>>
6
;
p
->
ramcfg_11_01_80
=
(
nv
bios_rd
08
(
bios
,
data
+
0x01
)
&
0x80
)
>>
7
;
p
->
ramcfg_11_02_03
=
(
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x03
)
>>
0
;
p
->
ramcfg_11_02_04
=
(
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x04
)
>>
2
;
p
->
ramcfg_11_02_08
=
(
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x08
)
>>
3
;
p
->
ramcfg_11_02_10
=
(
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x10
)
>>
4
;
p
->
ramcfg_11_02_40
=
(
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x40
)
>>
6
;
p
->
ramcfg_11_02_80
=
(
nv
bios_rd
08
(
bios
,
data
+
0x02
)
&
0x80
)
>>
7
;
p
->
ramcfg_11_03_0f
=
(
nv
bios_rd
08
(
bios
,
data
+
0x03
)
&
0x0f
)
>>
0
;
p
->
ramcfg_11_03_30
=
(
nv
bios_rd
08
(
bios
,
data
+
0x03
)
&
0x30
)
>>
4
;
p
->
ramcfg_11_03_c0
=
(
nv
bios_rd
08
(
bios
,
data
+
0x03
)
&
0xc0
)
>>
6
;
p
->
ramcfg_11_03_f0
=
(
nv
bios_rd
08
(
bios
,
data
+
0x03
)
&
0xf0
)
>>
4
;
p
->
ramcfg_11_04
=
(
nv
bios_rd
08
(
bios
,
data
+
0x04
)
&
0xff
)
>>
0
;
p
->
ramcfg_11_06
=
(
nv
bios_rd
08
(
bios
,
data
+
0x06
)
&
0xff
)
>>
0
;
p
->
ramcfg_11_07_02
=
(
nv
bios_rd
08
(
bios
,
data
+
0x07
)
&
0x02
)
>>
1
;
p
->
ramcfg_11_07_04
=
(
nv
bios_rd
08
(
bios
,
data
+
0x07
)
&
0x04
)
>>
2
;
p
->
ramcfg_11_07_08
=
(
nv
bios_rd
08
(
bios
,
data
+
0x07
)
&
0x08
)
>>
3
;
p
->
ramcfg_11_07_10
=
(
nv
bios_rd
08
(
bios
,
data
+
0x07
)
&
0x10
)
>>
4
;
p
->
ramcfg_11_07_40
=
(
nv
bios_rd
08
(
bios
,
data
+
0x07
)
&
0x40
)
>>
6
;
p
->
ramcfg_11_07_80
=
(
nv
bios_rd
08
(
bios
,
data
+
0x07
)
&
0x80
)
>>
7
;
p
->
ramcfg_11_08_01
=
(
nv
bios_rd
08
(
bios
,
data
+
0x08
)
&
0x01
)
>>
0
;
p
->
ramcfg_11_08_02
=
(
nv
bios_rd
08
(
bios
,
data
+
0x08
)
&
0x02
)
>>
1
;
p
->
ramcfg_11_08_04
=
(
nv
bios_rd
08
(
bios
,
data
+
0x08
)
&
0x04
)
>>
2
;
p
->
ramcfg_11_08_08
=
(
nv
bios_rd
08
(
bios
,
data
+
0x08
)
&
0x08
)
>>
3
;
p
->
ramcfg_11_08_10
=
(
nv
bios_rd
08
(
bios
,
data
+
0x08
)
&
0x10
)
>>
4
;
p
->
ramcfg_11_08_20
=
(
nv
bios_rd
08
(
bios
,
data
+
0x08
)
&
0x20
)
>>
5
;
p
->
ramcfg_11_09
=
(
nv
bios_rd
08
(
bios
,
data
+
0x09
)
&
0xff
)
>>
0
;
break
;
default:
data
=
0
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
View file @
7f5f518f
...
...
@@ -28,7 +28,6 @@
#include <subdev/bios/image.h>
struct
shadow
{
struct
nvkm_oclass
base
;
u32
skip
;
const
struct
nvbios_source
*
func
;
void
*
data
;
...
...
@@ -37,9 +36,8 @@ struct shadow {
};
static
bool
shadow_fetch
(
struct
nvkm_bios
*
bios
,
u32
upto
)
shadow_fetch
(
struct
nvkm_bios
*
bios
,
struct
shadow
*
mthd
,
u32
upto
)
{
struct
shadow
*
mthd
=
(
void
*
)
nv_object
(
bios
)
->
oclass
;
const
u32
limit
=
(
upto
+
3
)
&
~
3
;
const
u32
start
=
bios
->
size
;
void
*
data
=
mthd
->
data
;
...
...
@@ -50,50 +48,18 @@ shadow_fetch(struct nvkm_bios *bios, u32 upto)
return
bios
->
size
>=
limit
;
}
static
u8
shadow_rd08
(
struct
nvkm_object
*
object
,
u64
addr
)
{
struct
nvkm_bios
*
bios
=
(
void
*
)
object
;
if
(
shadow_fetch
(
bios
,
addr
+
1
))
return
bios
->
data
[
addr
];
return
0x00
;
}
static
u16
shadow_rd16
(
struct
nvkm_object
*
object
,
u64
addr
)
{
struct
nvkm_bios
*
bios
=
(
void
*
)
object
;
if
(
shadow_fetch
(
bios
,
addr
+
2
))
return
get_unaligned_le16
(
&
bios
->
data
[
addr
]);
return
0x0000
;
}
static
u32
shadow_rd32
(
struct
nvkm_object
*
object
,
u64
addr
)
{
struct
nvkm_bios
*
bios
=
(
void
*
)
object
;
if
(
shadow_fetch
(
bios
,
addr
+
4
))
return
get_unaligned_le32
(
&
bios
->
data
[
addr
]);
return
0x00000000
;
}
static
struct
nvkm_oclass
shadow_class
=
{
.
handle
=
NV_SUBDEV
(
VBIOS
,
0x00
),
.
ofuncs
=
&
(
struct
nvkm_ofuncs
)
{
.
rd08
=
shadow_rd08
,
.
rd16
=
shadow_rd16
,
.
rd32
=
shadow_rd32
,
},
};
static
int
shadow_image
(
struct
nvkm_bios
*
bios
,
int
idx
,
struct
shadow
*
mthd
)
shadow_image
(
struct
nvkm_bios
*
bios
,
int
idx
,
u32
offset
,
struct
shadow
*
mthd
)
{
struct
nvkm_subdev
*
subdev
=
&
bios
->
subdev
;
struct
nvbios_image
image
;
int
score
=
1
;
if
(
!
shadow_fetch
(
bios
,
mthd
,
offset
+
0x1000
))
{
nvkm_debug
(
subdev
,
"%08x: header fetch failed
\n
"
,
offset
);
return
0
;
}
if
(
!
nvbios_image
(
bios
,
idx
,
&
image
))
{
nvkm_debug
(
subdev
,
"image %d invalid
\n
"
,
idx
);
return
0
;
...
...
@@ -101,7 +67,7 @@ shadow_image(struct nvkm_bios *bios, int idx, struct shadow *mthd)
nvkm_debug
(
subdev
,
"%08x: type %02x, %d bytes
\n
"
,
image
.
base
,
image
.
type
,
image
.
size
);
if
(
!
shadow_fetch
(
bios
,
image
.
size
))
{
if
(
!
shadow_fetch
(
bios
,
mthd
,
image
.
size
))
{
nvkm_debug
(
subdev
,
"%08x: fetch failed
\n
"
,
image
.
base
);
return
0
;
}
...
...
@@ -124,22 +90,10 @@ shadow_image(struct nvkm_bios *bios, int idx, struct shadow *mthd)
}
if
(
!
image
.
last
)
score
+=
shadow_image
(
bios
,
idx
+
1
,
mthd
);
score
+=
shadow_image
(
bios
,
idx
+
1
,
offset
+
image
.
size
,
mthd
);
return
score
;
}
static
int
shadow_score
(
struct
nvkm_bios
*
bios
,
struct
shadow
*
mthd
)
{
struct
nvkm_oclass
*
oclass
=
nv_object
(
bios
)
->
oclass
;
int
score
;
nv_object
(
bios
)
->
oclass
=
&
mthd
->
base
;
score
=
shadow_image
(
bios
,
0
,
mthd
);
nv_object
(
bios
)
->
oclass
=
oclass
;
return
score
;
}
static
int
shadow_method
(
struct
nvkm_bios
*
bios
,
struct
shadow
*
mthd
,
const
char
*
name
)
{
...
...
@@ -154,7 +108,7 @@ shadow_method(struct nvkm_bios *bios, struct shadow *mthd, const char *name)
return
0
;
}
}
mthd
->
score
=
shadow_
score
(
bios
,
mthd
);
mthd
->
score
=
shadow_
image
(
bios
,
0
,
0
,
mthd
);
if
(
func
->
fini
)
func
->
fini
(
mthd
->
data
);
nvkm_debug
(
subdev
,
"scored %d
\n
"
,
mthd
->
score
);
...
...
@@ -203,14 +157,14 @@ nvbios_shadow(struct nvkm_bios *bios)
struct
nvkm_subdev
*
subdev
=
&
bios
->
subdev
;
struct
nvkm_device
*
device
=
subdev
->
device
;
struct
shadow
mthds
[]
=
{
{
shadow_class
,
0
,
&
nvbios_of
},
{
shadow_class
,
0
,
&
nvbios_ramin
},
{
shadow_class
,
0
,
&
nvbios_rom
},
{
shadow_class
,
0
,
&
nvbios_acpi_fast
},
{
shadow_class
,
4
,
&
nvbios_acpi_slow
},
{
shadow_class
,
1
,
&
nvbios_pcirom
},
{
shadow_class
,
1
,
&
nvbios_platform
},
{
shadow_class
}
{
0
,
&
nvbios_of
},
{
0
,
&
nvbios_ramin
},
{
0
,
&
nvbios_rom
},
{
0
,
&
nvbios_acpi_fast
},
{
4
,
&
nvbios_acpi_slow
},
{
1
,
&
nvbios_pcirom
},
{
1
,
&
nvbios_platform
},
{}
},
*
mthd
,
*
best
=
NULL
;
const
char
*
optarg
;
char
*
source
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/therm.c
View file @
7f5f518f
...
...
@@ -33,9 +33,9 @@ therm_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *len, u8 *cnt)
if
(
!
bit_entry
(
bios
,
'P'
,
&
bit_P
))
{
if
(
bit_P
.
version
==
1
)
therm
=
nv
_ro
16
(
bios
,
bit_P
.
offset
+
12
);
therm
=
nv
bios_rd
16
(
bios
,
bit_P
.
offset
+
12
);
else
if
(
bit_P
.
version
==
2
)
therm
=
nv
_ro
16
(
bios
,
bit_P
.
offset
+
16
);
therm
=
nv
bios_rd
16
(
bios
,
bit_P
.
offset
+
16
);
else
nvkm_error
(
&
bios
->
subdev
,
"unknown offset for thermal in BIT P %d
\n
"
,
...
...
@@ -46,11 +46,11 @@ therm_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *len, u8 *cnt)
if
(
!
therm
)
return
0x0000
;
*
ver
=
nv
_ro
08
(
bios
,
therm
+
0
);
*
hdr
=
nv
_ro
08
(
bios
,
therm
+
1
);
*
len
=
nv
_ro
08
(
bios
,
therm
+
2
);
*
cnt
=
nv
_ro
08
(
bios
,
therm
+
3
);
return
therm
+
nv
_ro
08
(
bios
,
therm
+
1
);
*
ver
=
nv
bios_rd
08
(
bios
,
therm
+
0
);
*
hdr
=
nv
bios_rd
08
(
bios
,
therm
+
1
);
*
len
=
nv
bios_rd
08
(
bios
,
therm
+
2
);
*
cnt
=
nv
bios_rd
08
(
bios
,
therm
+
3
);
return
therm
+
nv
bios_rd
08
(
bios
,
therm
+
1
);
}
static
u16
...
...
@@ -81,9 +81,9 @@ nvbios_therm_sensor_parse(struct nvkm_bios *bios,
sensor_section
=
-
1
;
i
=
0
;
while
((
entry
=
nvbios_therm_entry
(
bios
,
i
++
,
&
ver
,
&
len
)))
{
s16
value
=
nv
_ro
16
(
bios
,
entry
+
1
);
s16
value
=
nv
bios_rd
16
(
bios
,
entry
+
1
);
switch
(
nv
_ro
08
(
bios
,
entry
+
0
))
{
switch
(
nv
bios_rd
08
(
bios
,
entry
+
0
))
{
case
0x0
:
thrs_section
=
value
;
if
(
value
>
0
)
...
...
@@ -92,7 +92,7 @@ nvbios_therm_sensor_parse(struct nvkm_bios *bios,
case
0x01
:
sensor_section
++
;
if
(
sensor_section
==
0
)
{
offset
=
((
s8
)
nv
_ro
08
(
bios
,
entry
+
2
))
/
2
;
offset
=
((
s8
)
nv
bios_rd
08
(
bios
,
entry
+
2
))
/
2
;
sensor
->
offset_constant
=
offset
;
}
break
;
...
...
@@ -163,9 +163,9 @@ nvbios_therm_fan_parse(struct nvkm_bios *bios, struct nvbios_therm_fan *fan)
fan
->
nr_fan_trip
=
0
;
fan
->
fan_mode
=
NVBIOS_THERM_FAN_OTHER
;
while
((
entry
=
nvbios_therm_entry
(
bios
,
i
++
,
&
ver
,
&
len
)))
{
s16
value
=
nv
_ro
16
(
bios
,
entry
+
1
);
s16
value
=
nv
bios_rd
16
(
bios
,
entry
+
1
);
switch
(
nv
_ro
08
(
bios
,
entry
+
0
))
{
switch
(
nv
bios_rd
08
(
bios
,
entry
+
0
))
{
case
0x22
:
fan
->
min_duty
=
value
&
0xff
;
fan
->
max_duty
=
(
value
&
0xff00
)
>>
8
;
...
...
@@ -196,8 +196,8 @@ nvbios_therm_fan_parse(struct nvkm_bios *bios, struct nvbios_therm_fan *fan)
case
0x46
:
if
(
fan
->
fan_mode
>
NVBIOS_THERM_FAN_LINEAR
)
fan
->
fan_mode
=
NVBIOS_THERM_FAN_LINEAR
;
fan
->
linear_min_temp
=
nv
_ro
08
(
bios
,
entry
+
1
);
fan
->
linear_max_temp
=
nv
_ro
08
(
bios
,
entry
+
2
);
fan
->
linear_min_temp
=
nv
bios_rd
08
(
bios
,
entry
+
1
);
fan
->
linear_max_temp
=
nv
bios_rd
08
(
bios
,
entry
+
2
);
break
;
}
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/timing.c
View file @
7f5f518f
...
...
@@ -34,27 +34,27 @@ nvbios_timingTe(struct nvkm_bios *bios,
if
(
!
bit_entry
(
bios
,
'P'
,
&
bit_P
))
{
if
(
bit_P
.
version
==
1
)
timing
=
nv
_ro
16
(
bios
,
bit_P
.
offset
+
4
);
timing
=
nv
bios_rd
16
(
bios
,
bit_P
.
offset
+
4
);
else
if
(
bit_P
.
version
==
2
)
timing
=
nv
_ro
16
(
bios
,
bit_P
.
offset
+
8
);
timing
=
nv
bios_rd
16
(
bios
,
bit_P
.
offset
+
8
);
if
(
timing
)
{
*
ver
=
nv
_ro
08
(
bios
,
timing
+
0
);
*
ver
=
nv
bios_rd
08
(
bios
,
timing
+
0
);
switch
(
*
ver
)
{
case
0x10
:
*
hdr
=
nv
_ro
08
(
bios
,
timing
+
1
);
*
cnt
=
nv
_ro
08
(
bios
,
timing
+
2
);
*
len
=
nv
_ro
08
(
bios
,
timing
+
3
);
*
hdr
=
nv
bios_rd
08
(
bios
,
timing
+
1
);
*
cnt
=
nv
bios_rd
08
(
bios
,
timing
+
2
);
*
len
=
nv
bios_rd
08
(
bios
,
timing
+
3
);
*
snr
=
0
;
*
ssz
=
0
;
return
timing
;
case
0x20
:
*
hdr
=
nv
_ro
08
(
bios
,
timing
+
1
);
*
cnt
=
nv
_ro
08
(
bios
,
timing
+
5
);
*
len
=
nv
_ro
08
(
bios
,
timing
+
2
);
*
snr
=
nv
_ro
08
(
bios
,
timing
+
4
);
*
ssz
=
nv
_ro
08
(
bios
,
timing
+
3
);
*
hdr
=
nv
bios_rd
08
(
bios
,
timing
+
1
);
*
cnt
=
nv
bios_rd
08
(
bios
,
timing
+
5
);
*
len
=
nv
bios_rd
08
(
bios
,
timing
+
2
);
*
snr
=
nv
bios_rd
08
(
bios
,
timing
+
4
);
*
ssz
=
nv
bios_rd
08
(
bios
,
timing
+
3
);
return
timing
;
default:
break
;
...
...
@@ -90,20 +90,20 @@ nvbios_timingEp(struct nvkm_bios *bios, int idx,
p
->
timing_hdr
=
*
hdr
;
switch
(
!!
data
*
*
ver
)
{
case
0x10
:
p
->
timing_10_WR
=
nv
_ro
08
(
bios
,
data
+
0x00
);
p
->
timing_10_WTR
=
nv
_ro
08
(
bios
,
data
+
0x01
);
p
->
timing_10_CL
=
nv
_ro
08
(
bios
,
data
+
0x02
);
p
->
timing_10_RC
=
nv
_ro
08
(
bios
,
data
+
0x03
);
p
->
timing_10_RFC
=
nv
_ro
08
(
bios
,
data
+
0x05
);
p
->
timing_10_RAS
=
nv
_ro
08
(
bios
,
data
+
0x07
);
p
->
timing_10_RP
=
nv
_ro
08
(
bios
,
data
+
0x09
);
p
->
timing_10_RCDRD
=
nv
_ro
08
(
bios
,
data
+
0x0a
);
p
->
timing_10_RCDWR
=
nv
_ro
08
(
bios
,
data
+
0x0b
);
p
->
timing_10_RRD
=
nv
_ro
08
(
bios
,
data
+
0x0c
);
p
->
timing_10_13
=
nv
_ro
08
(
bios
,
data
+
0x0d
);
p
->
timing_10_ODT
=
nv
_ro
08
(
bios
,
data
+
0x0e
)
&
0x07
;
p
->
timing_10_WR
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
p
->
timing_10_WTR
=
nv
bios_rd
08
(
bios
,
data
+
0x01
);
p
->
timing_10_CL
=
nv
bios_rd
08
(
bios
,
data
+
0x02
);
p
->
timing_10_RC
=
nv
bios_rd
08
(
bios
,
data
+
0x03
);
p
->
timing_10_RFC
=
nv
bios_rd
08
(
bios
,
data
+
0x05
);
p
->
timing_10_RAS
=
nv
bios_rd
08
(
bios
,
data
+
0x07
);
p
->
timing_10_RP
=
nv
bios_rd
08
(
bios
,
data
+
0x09
);
p
->
timing_10_RCDRD
=
nv
bios_rd
08
(
bios
,
data
+
0x0a
);
p
->
timing_10_RCDWR
=
nv
bios_rd
08
(
bios
,
data
+
0x0b
);
p
->
timing_10_RRD
=
nv
bios_rd
08
(
bios
,
data
+
0x0c
);
p
->
timing_10_13
=
nv
bios_rd
08
(
bios
,
data
+
0x0d
);
p
->
timing_10_ODT
=
nv
bios_rd
08
(
bios
,
data
+
0x0e
)
&
0x07
;
if
(
p
->
ramcfg_ver
>=
0x10
)
p
->
ramcfg_RON
=
nv
_ro
08
(
bios
,
data
+
0x0e
)
&
0x07
;
p
->
ramcfg_RON
=
nv
bios_rd
08
(
bios
,
data
+
0x0e
)
&
0x07
;
p
->
timing_10_24
=
0xff
;
p
->
timing_10_21
=
0
;
...
...
@@ -114,45 +114,45 @@ nvbios_timingEp(struct nvkm_bios *bios, int idx,
switch
(
min_t
(
u8
,
*
hdr
,
25
))
{
case
25
:
p
->
timing_10_24
=
nv
_ro
08
(
bios
,
data
+
0x18
);
p
->
timing_10_24
=
nv
bios_rd
08
(
bios
,
data
+
0x18
);
case
24
:
case
23
:
case
22
:
p
->
timing_10_21
=
nv
_ro
08
(
bios
,
data
+
0x15
);
p
->
timing_10_21
=
nv
bios_rd
08
(
bios
,
data
+
0x15
);
case
21
:
p
->
timing_10_20
=
nv
_ro
08
(
bios
,
data
+
0x14
);
p
->
timing_10_20
=
nv
bios_rd
08
(
bios
,
data
+
0x14
);
case
20
:
p
->
timing_10_CWL
=
nv
_ro
08
(
bios
,
data
+
0x13
);
p
->
timing_10_CWL
=
nv
bios_rd
08
(
bios
,
data
+
0x13
);
case
19
:
p
->
timing_10_18
=
nv
_ro
08
(
bios
,
data
+
0x12
);
p
->
timing_10_18
=
nv
bios_rd
08
(
bios
,
data
+
0x12
);
case
18
:
case
17
:
p
->
timing_10_16
=
nv
_ro
08
(
bios
,
data
+
0x10
);
p
->
timing_10_16
=
nv
bios_rd
08
(
bios
,
data
+
0x10
);
}
break
;
case
0x20
:
p
->
timing
[
0
]
=
nv
_ro
32
(
bios
,
data
+
0x00
);
p
->
timing
[
1
]
=
nv
_ro
32
(
bios
,
data
+
0x04
);
p
->
timing
[
2
]
=
nv
_ro
32
(
bios
,
data
+
0x08
);
p
->
timing
[
3
]
=
nv
_ro
32
(
bios
,
data
+
0x0c
);
p
->
timing
[
4
]
=
nv
_ro
32
(
bios
,
data
+
0x10
);
p
->
timing
[
5
]
=
nv
_ro
32
(
bios
,
data
+
0x14
);
p
->
timing
[
6
]
=
nv
_ro
32
(
bios
,
data
+
0x18
);
p
->
timing
[
7
]
=
nv
_ro
32
(
bios
,
data
+
0x1c
);
p
->
timing
[
8
]
=
nv
_ro
32
(
bios
,
data
+
0x20
);
p
->
timing
[
9
]
=
nv
_ro
32
(
bios
,
data
+
0x24
);
p
->
timing
[
10
]
=
nv
_ro
32
(
bios
,
data
+
0x28
);
p
->
timing_20_2e_03
=
(
nv
_ro
08
(
bios
,
data
+
0x2e
)
&
0x03
)
>>
0
;
p
->
timing_20_2e_30
=
(
nv
_ro
08
(
bios
,
data
+
0x2e
)
&
0x30
)
>>
4
;
p
->
timing_20_2e_c0
=
(
nv
_ro
08
(
bios
,
data
+
0x2e
)
&
0xc0
)
>>
6
;
p
->
timing_20_2f_03
=
(
nv
_ro
08
(
bios
,
data
+
0x2f
)
&
0x03
)
>>
0
;
temp
=
nv
_ro
16
(
bios
,
data
+
0x2c
);
p
->
timing
[
0
]
=
nv
bios_rd
32
(
bios
,
data
+
0x00
);
p
->
timing
[
1
]
=
nv
bios_rd
32
(
bios
,
data
+
0x04
);
p
->
timing
[
2
]
=
nv
bios_rd
32
(
bios
,
data
+
0x08
);
p
->
timing
[
3
]
=
nv
bios_rd
32
(
bios
,
data
+
0x0c
);
p
->
timing
[
4
]
=
nv
bios_rd
32
(
bios
,
data
+
0x10
);
p
->
timing
[
5
]
=
nv
bios_rd
32
(
bios
,
data
+
0x14
);
p
->
timing
[
6
]
=
nv
bios_rd
32
(
bios
,
data
+
0x18
);
p
->
timing
[
7
]
=
nv
bios_rd
32
(
bios
,
data
+
0x1c
);
p
->
timing
[
8
]
=
nv
bios_rd
32
(
bios
,
data
+
0x20
);
p
->
timing
[
9
]
=
nv
bios_rd
32
(
bios
,
data
+
0x24
);
p
->
timing
[
10
]
=
nv
bios_rd
32
(
bios
,
data
+
0x28
);
p
->
timing_20_2e_03
=
(
nv
bios_rd
08
(
bios
,
data
+
0x2e
)
&
0x03
)
>>
0
;
p
->
timing_20_2e_30
=
(
nv
bios_rd
08
(
bios
,
data
+
0x2e
)
&
0x30
)
>>
4
;
p
->
timing_20_2e_c0
=
(
nv
bios_rd
08
(
bios
,
data
+
0x2e
)
&
0xc0
)
>>
6
;
p
->
timing_20_2f_03
=
(
nv
bios_rd
08
(
bios
,
data
+
0x2f
)
&
0x03
)
>>
0
;
temp
=
nv
bios_rd
16
(
bios
,
data
+
0x2c
);
p
->
timing_20_2c_003f
=
(
temp
&
0x003f
)
>>
0
;
p
->
timing_20_2c_1fc0
=
(
temp
&
0x1fc0
)
>>
6
;
p
->
timing_20_30_07
=
(
nv
_ro
08
(
bios
,
data
+
0x30
)
&
0x07
)
>>
0
;
p
->
timing_20_30_f8
=
(
nv
_ro
08
(
bios
,
data
+
0x30
)
&
0xf8
)
>>
3
;
temp
=
nv
_ro
16
(
bios
,
data
+
0x31
);
p
->
timing_20_30_07
=
(
nv
bios_rd
08
(
bios
,
data
+
0x30
)
&
0x07
)
>>
0
;
p
->
timing_20_30_f8
=
(
nv
bios_rd
08
(
bios
,
data
+
0x30
)
&
0xf8
)
>>
3
;
temp
=
nv
bios_rd
16
(
bios
,
data
+
0x31
);
p
->
timing_20_31_0007
=
(
temp
&
0x0007
)
>>
0
;
p
->
timing_20_31_0078
=
(
temp
&
0x0078
)
>>
3
;
p
->
timing_20_31_0780
=
(
temp
&
0x0780
)
>>
7
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/vmap.c
View file @
7f5f518f
...
...
@@ -33,15 +33,15 @@ nvbios_vmap_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
if
(
!
bit_entry
(
bios
,
'P'
,
&
bit_P
))
{
if
(
bit_P
.
version
==
2
)
{
vmap
=
nv
_ro
16
(
bios
,
bit_P
.
offset
+
0x20
);
vmap
=
nv
bios_rd
16
(
bios
,
bit_P
.
offset
+
0x20
);
if
(
vmap
)
{
*
ver
=
nv
_ro
08
(
bios
,
vmap
+
0
);
*
ver
=
nv
bios_rd
08
(
bios
,
vmap
+
0
);
switch
(
*
ver
)
{
case
0x10
:
case
0x20
:
*
hdr
=
nv
_ro
08
(
bios
,
vmap
+
1
);
*
cnt
=
nv
_ro
08
(
bios
,
vmap
+
3
);
*
len
=
nv
_ro
08
(
bios
,
vmap
+
2
);
*
hdr
=
nv
bios_rd
08
(
bios
,
vmap
+
1
);
*
cnt
=
nv
bios_rd
08
(
bios
,
vmap
+
3
);
*
len
=
nv
bios_rd
08
(
bios
,
vmap
+
2
);
return
vmap
;
default:
break
;
...
...
@@ -88,23 +88,23 @@ nvbios_vmap_entry_parse(struct nvkm_bios *bios, int idx, u8 *ver, u8 *len,
switch
(
!!
vmap
*
*
ver
)
{
case
0x10
:
info
->
link
=
0xff
;
info
->
min
=
nv
_ro
32
(
bios
,
vmap
+
0x00
);
info
->
max
=
nv
_ro
32
(
bios
,
vmap
+
0x04
);
info
->
arg
[
0
]
=
nv
_ro
32
(
bios
,
vmap
+
0x08
);
info
->
arg
[
1
]
=
nv
_ro
32
(
bios
,
vmap
+
0x0c
);
info
->
arg
[
2
]
=
nv
_ro
32
(
bios
,
vmap
+
0x10
);
info
->
min
=
nv
bios_rd
32
(
bios
,
vmap
+
0x00
);
info
->
max
=
nv
bios_rd
32
(
bios
,
vmap
+
0x04
);
info
->
arg
[
0
]
=
nv
bios_rd
32
(
bios
,
vmap
+
0x08
);
info
->
arg
[
1
]
=
nv
bios_rd
32
(
bios
,
vmap
+
0x0c
);
info
->
arg
[
2
]
=
nv
bios_rd
32
(
bios
,
vmap
+
0x10
);
break
;
case
0x20
:
info
->
unk0
=
nv
_ro
08
(
bios
,
vmap
+
0x00
);
info
->
link
=
nv
_ro
08
(
bios
,
vmap
+
0x01
);
info
->
min
=
nv
_ro
32
(
bios
,
vmap
+
0x02
);
info
->
max
=
nv
_ro
32
(
bios
,
vmap
+
0x06
);
info
->
arg
[
0
]
=
nv
_ro
32
(
bios
,
vmap
+
0x0a
);
info
->
arg
[
1
]
=
nv
_ro
32
(
bios
,
vmap
+
0x0e
);
info
->
arg
[
2
]
=
nv
_ro
32
(
bios
,
vmap
+
0x12
);
info
->
arg
[
3
]
=
nv
_ro
32
(
bios
,
vmap
+
0x16
);
info
->
arg
[
4
]
=
nv
_ro
32
(
bios
,
vmap
+
0x1a
);
info
->
arg
[
5
]
=
nv
_ro
32
(
bios
,
vmap
+
0x1e
);
info
->
unk0
=
nv
bios_rd
08
(
bios
,
vmap
+
0x00
);
info
->
link
=
nv
bios_rd
08
(
bios
,
vmap
+
0x01
);
info
->
min
=
nv
bios_rd
32
(
bios
,
vmap
+
0x02
);
info
->
max
=
nv
bios_rd
32
(
bios
,
vmap
+
0x06
);
info
->
arg
[
0
]
=
nv
bios_rd
32
(
bios
,
vmap
+
0x0a
);
info
->
arg
[
1
]
=
nv
bios_rd
32
(
bios
,
vmap
+
0x0e
);
info
->
arg
[
2
]
=
nv
bios_rd
32
(
bios
,
vmap
+
0x12
);
info
->
arg
[
3
]
=
nv
bios_rd
32
(
bios
,
vmap
+
0x16
);
info
->
arg
[
4
]
=
nv
bios_rd
32
(
bios
,
vmap
+
0x1a
);
info
->
arg
[
5
]
=
nv
bios_rd
32
(
bios
,
vmap
+
0x1e
);
break
;
}
return
vmap
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/volt.c
View file @
7f5f518f
...
...
@@ -33,30 +33,30 @@ nvbios_volt_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
if
(
!
bit_entry
(
bios
,
'P'
,
&
bit_P
))
{
if
(
bit_P
.
version
==
2
)
volt
=
nv
_ro
16
(
bios
,
bit_P
.
offset
+
0x0c
);
volt
=
nv
bios_rd
16
(
bios
,
bit_P
.
offset
+
0x0c
);
else
if
(
bit_P
.
version
==
1
)
volt
=
nv
_ro
16
(
bios
,
bit_P
.
offset
+
0x10
);
volt
=
nv
bios_rd
16
(
bios
,
bit_P
.
offset
+
0x10
);
if
(
volt
)
{
*
ver
=
nv
_ro
08
(
bios
,
volt
+
0
);
*
ver
=
nv
bios_rd
08
(
bios
,
volt
+
0
);
switch
(
*
ver
)
{
case
0x12
:
*
hdr
=
5
;
*
cnt
=
nv
_ro
08
(
bios
,
volt
+
2
);
*
len
=
nv
_ro
08
(
bios
,
volt
+
1
);
*
cnt
=
nv
bios_rd
08
(
bios
,
volt
+
2
);
*
len
=
nv
bios_rd
08
(
bios
,
volt
+
1
);
return
volt
;
case
0x20
:
*
hdr
=
nv
_ro
08
(
bios
,
volt
+
1
);
*
cnt
=
nv
_ro
08
(
bios
,
volt
+
2
);
*
len
=
nv
_ro
08
(
bios
,
volt
+
3
);
*
hdr
=
nv
bios_rd
08
(
bios
,
volt
+
1
);
*
cnt
=
nv
bios_rd
08
(
bios
,
volt
+
2
);
*
len
=
nv
bios_rd
08
(
bios
,
volt
+
3
);
return
volt
;
case
0x30
:
case
0x40
:
case
0x50
:
*
hdr
=
nv
_ro
08
(
bios
,
volt
+
1
);
*
cnt
=
nv
_ro
08
(
bios
,
volt
+
3
);
*
len
=
nv
_ro
08
(
bios
,
volt
+
2
);
*
hdr
=
nv
bios_rd
08
(
bios
,
volt
+
1
);
*
cnt
=
nv
bios_rd
08
(
bios
,
volt
+
3
);
*
len
=
nv
bios_rd
08
(
bios
,
volt
+
2
);
return
volt
;
}
}
...
...
@@ -73,28 +73,28 @@ nvbios_volt_parse(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len,
memset
(
info
,
0x00
,
sizeof
(
*
info
));
switch
(
!!
volt
*
*
ver
)
{
case
0x12
:
info
->
vidmask
=
nv
_ro
08
(
bios
,
volt
+
0x04
);
info
->
vidmask
=
nv
bios_rd
08
(
bios
,
volt
+
0x04
);
break
;
case
0x20
:
info
->
vidmask
=
nv
_ro
08
(
bios
,
volt
+
0x05
);
info
->
vidmask
=
nv
bios_rd
08
(
bios
,
volt
+
0x05
);
break
;
case
0x30
:
info
->
vidmask
=
nv
_ro
08
(
bios
,
volt
+
0x04
);
info
->
vidmask
=
nv
bios_rd
08
(
bios
,
volt
+
0x04
);
break
;
case
0x40
:
info
->
base
=
nv
_ro
32
(
bios
,
volt
+
0x04
);
info
->
step
=
nv
_ro
16
(
bios
,
volt
+
0x08
);
info
->
vidmask
=
nv
_ro
08
(
bios
,
volt
+
0x0b
);
info
->
base
=
nv
bios_rd
32
(
bios
,
volt
+
0x04
);
info
->
step
=
nv
bios_rd
16
(
bios
,
volt
+
0x08
);
info
->
vidmask
=
nv
bios_rd
08
(
bios
,
volt
+
0x0b
);
/*XXX*/
info
->
min
=
0
;
info
->
max
=
info
->
base
;
break
;
case
0x50
:
info
->
vidmask
=
nv
_ro
08
(
bios
,
volt
+
0x06
);
info
->
min
=
nv
_ro
32
(
bios
,
volt
+
0x0a
);
info
->
max
=
nv
_ro
32
(
bios
,
volt
+
0x0e
);
info
->
base
=
nv
_ro
32
(
bios
,
volt
+
0x12
)
&
0x00ffffff
;
info
->
step
=
nv
_ro
16
(
bios
,
volt
+
0x16
);
info
->
vidmask
=
nv
bios_rd
08
(
bios
,
volt
+
0x06
);
info
->
min
=
nv
bios_rd
32
(
bios
,
volt
+
0x0a
);
info
->
max
=
nv
bios_rd
32
(
bios
,
volt
+
0x0e
);
info
->
base
=
nv
bios_rd
32
(
bios
,
volt
+
0x12
)
&
0x00ffffff
;
info
->
step
=
nv
bios_rd
16
(
bios
,
volt
+
0x16
);
break
;
}
return
volt
;
...
...
@@ -121,12 +121,12 @@ nvbios_volt_entry_parse(struct nvkm_bios *bios, int idx, u8 *ver, u8 *len,
switch
(
!!
volt
*
*
ver
)
{
case
0x12
:
case
0x20
:
info
->
voltage
=
nv
_ro
08
(
bios
,
volt
+
0x00
)
*
10000
;
info
->
vid
=
nv
_ro
08
(
bios
,
volt
+
0x01
);
info
->
voltage
=
nv
bios_rd
08
(
bios
,
volt
+
0x00
)
*
10000
;
info
->
vid
=
nv
bios_rd
08
(
bios
,
volt
+
0x01
);
break
;
case
0x30
:
info
->
voltage
=
nv
_ro
08
(
bios
,
volt
+
0x00
)
*
10000
;
info
->
vid
=
nv
_ro
08
(
bios
,
volt
+
0x01
)
>>
2
;
info
->
voltage
=
nv
bios_rd
08
(
bios
,
volt
+
0x00
)
*
10000
;
info
->
vid
=
nv
bios_rd
08
(
bios
,
volt
+
0x01
)
>>
2
;
break
;
case
0x40
:
case
0x50
:
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/xpio.c
View file @
7f5f518f
...
...
@@ -30,12 +30,12 @@ dcb_xpiod_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
{
u16
data
=
dcb_gpio_table
(
bios
,
ver
,
hdr
,
cnt
,
len
);
if
(
data
&&
*
ver
>=
0x40
&&
*
hdr
>=
0x06
)
{
u16
xpio
=
nv
_ro
16
(
bios
,
data
+
0x04
);
u16
xpio
=
nv
bios_rd
16
(
bios
,
data
+
0x04
);
if
(
xpio
)
{
*
ver
=
nv
_ro
08
(
bios
,
data
+
0x00
);
*
hdr
=
nv
_ro
08
(
bios
,
data
+
0x01
);
*
cnt
=
nv
_ro
08
(
bios
,
data
+
0x02
);
*
len
=
nv
_ro
08
(
bios
,
data
+
0x03
);
*
ver
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
*
hdr
=
nv
bios_rd
08
(
bios
,
data
+
0x01
);
*
cnt
=
nv
bios_rd
08
(
bios
,
data
+
0x02
);
*
len
=
nv
bios_rd
08
(
bios
,
data
+
0x03
);
return
xpio
;
}
}
...
...
@@ -48,12 +48,12 @@ dcb_xpio_table(struct nvkm_bios *bios, u8 idx,
{
u16
data
=
dcb_xpiod_table
(
bios
,
ver
,
hdr
,
cnt
,
len
);
if
(
data
&&
idx
<
*
cnt
)
{
u16
xpio
=
nv
_ro
16
(
bios
,
data
+
*
hdr
+
(
idx
*
*
len
));
u16
xpio
=
nv
bios_rd
16
(
bios
,
data
+
*
hdr
+
(
idx
*
*
len
));
if
(
xpio
)
{
*
ver
=
nv
_ro
08
(
bios
,
data
+
0x00
);
*
hdr
=
nv
_ro
08
(
bios
,
data
+
0x01
);
*
cnt
=
nv
_ro
08
(
bios
,
data
+
0x02
);
*
len
=
nv
_ro
08
(
bios
,
data
+
0x03
);
*
ver
=
nv
bios_rd
08
(
bios
,
data
+
0x00
);
*
hdr
=
nv
bios_rd
08
(
bios
,
data
+
0x01
);
*
cnt
=
nv
bios_rd
08
(
bios
,
data
+
0x02
);
*
len
=
nv
bios_rd
08
(
bios
,
data
+
0x03
);
return
xpio
;
}
}
...
...
@@ -66,9 +66,9 @@ dcb_xpio_parse(struct nvkm_bios *bios, u8 idx,
{
u16
data
=
dcb_xpio_table
(
bios
,
idx
,
ver
,
hdr
,
cnt
,
len
);
if
(
data
&&
*
len
>=
6
)
{
info
->
type
=
nv
_ro
08
(
bios
,
data
+
0x04
);
info
->
addr
=
nv
_ro
08
(
bios
,
data
+
0x05
);
info
->
flags
=
nv
_ro
08
(
bios
,
data
+
0x06
);
info
->
type
=
nv
bios_rd
08
(
bios
,
data
+
0x04
);
info
->
addr
=
nv
bios_rd
08
(
bios
,
data
+
0x05
);
info
->
flags
=
nv
bios_rd
08
(
bios
,
data
+
0x06
);
}
return
0x0000
;
}
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c
View file @
7f5f518f
...
...
@@ -38,7 +38,7 @@ pmu_code(struct nv50_devinit *init, u32 pmu, u32 img, u32 len, bool sec)
for
(
i
=
0
;
i
<
len
;
i
+=
4
)
{
if
((
i
&
0xff
)
==
0
)
nvkm_wr32
(
device
,
0x10a188
,
(
pmu
+
i
)
>>
8
);
nvkm_wr32
(
device
,
0x10a184
,
nv
_ro
32
(
bios
,
img
+
i
));
nvkm_wr32
(
device
,
0x10a184
,
nv
bios_rd
32
(
bios
,
img
+
i
));
}
while
(
i
&
0xff
)
{
...
...
@@ -56,7 +56,7 @@ pmu_data(struct nv50_devinit *init, u32 pmu, u32 img, u32 len)
nvkm_wr32
(
device
,
0x10a1c0
,
0x01000000
|
pmu
);
for
(
i
=
0
;
i
<
len
;
i
+=
4
)
nvkm_wr32
(
device
,
0x10a1c4
,
nv
_ro
32
(
bios
,
img
+
i
));
nvkm_wr32
(
device
,
0x10a1c4
,
nv
bios_rd
32
(
bios
,
img
+
i
));
}
static
u32
...
...
@@ -138,16 +138,16 @@ gm204_devinit_post(struct nvkm_subdev *subdev, bool post)
/* upload first chunk of init data */
if
(
post
)
{
u32
pmu
=
pmu_args
(
init
,
args
+
0x08
,
0x08
);
u32
img
=
nv
_ro
16
(
bios
,
bit_I
.
offset
+
0x14
);
u32
len
=
nv
_ro
16
(
bios
,
bit_I
.
offset
+
0x16
);
u32
img
=
nv
bios_rd
16
(
bios
,
bit_I
.
offset
+
0x14
);
u32
len
=
nv
bios_rd
16
(
bios
,
bit_I
.
offset
+
0x16
);
pmu_data
(
init
,
pmu
,
img
,
len
);
}
/* upload second chunk of init data */
if
(
post
)
{
u32
pmu
=
pmu_args
(
init
,
args
+
0x08
,
0x10
);
u32
img
=
nv
_ro
16
(
bios
,
bit_I
.
offset
+
0x18
);
u32
len
=
nv
_ro
16
(
bios
,
bit_I
.
offset
+
0x1a
);
u32
img
=
nv
bios_rd
16
(
bios
,
bit_I
.
offset
+
0x18
);
u32
len
=
nv
bios_rd
16
(
bios
,
bit_I
.
offset
+
0x1a
);
pmu_data
(
init
,
pmu
,
img
,
len
);
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv05.c
View file @
7f5f518f
...
...
@@ -62,8 +62,8 @@ nv05_devinit_meminit(struct nvkm_devinit *init)
strap
=
(
nvkm_rd32
(
device
,
0x101000
)
&
0x0000003c
)
>>
2
;
if
((
data
=
bmp_mem_init_table
(
bios
)))
{
ramcfg
[
0
]
=
nv
_ro
08
(
bios
,
data
+
2
*
strap
+
0
);
ramcfg
[
1
]
=
nv
_ro
08
(
bios
,
data
+
2
*
strap
+
1
);
ramcfg
[
0
]
=
nv
bios_rd
08
(
bios
,
data
+
2
*
strap
+
0
);
ramcfg
[
1
]
=
nv
bios_rd
08
(
bios
,
data
+
2
*
strap
+
1
);
}
else
{
ramcfg
[
0
]
=
default_config_tab
[
strap
][
0
];
ramcfg
[
1
]
=
default_config_tab
[
strap
][
1
];
...
...
@@ -80,7 +80,7 @@ nv05_devinit_meminit(struct nvkm_devinit *init)
/* If present load the hardcoded scrambling table */
if
(
data
)
{
for
(
i
=
0
,
data
+=
0x10
;
i
<
8
;
i
++
,
data
+=
4
)
{
u32
scramble
=
nv
_ro
32
(
bios
,
data
);
u32
scramble
=
nv
bios_rd
32
(
bios
,
data
);
nvkm_wr32
(
device
,
NV04_PFB_SCRAMBLE
(
i
),
scramble
);
}
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c
View file @
7f5f518f
...
...
@@ -165,7 +165,7 @@ gf100_ram_calc(struct nvkm_fb *fb, u32 freq)
}
/* lookup memory timings, if bios says they're present */
strap
=
nv
_ro
08
(
bios
,
ramcfg
.
data
+
0x01
);
strap
=
nv
bios_rd
08
(
bios
,
ramcfg
.
data
+
0x01
);
if
(
strap
!=
0xff
)
{
timing
.
data
=
nvbios_timingEe
(
bios
,
strap
,
&
ver
,
&
timing
.
size
,
&
cnt
,
&
len
);
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c
View file @
7f5f518f
...
...
@@ -1340,8 +1340,8 @@ gk104_ram_init(struct nvkm_object *object)
if
(
!
data
||
hdr
<
0x15
)
return
-
EINVAL
;
cnt
=
nv
_ro
08
(
bios
,
data
+
0x14
);
/* guess at count */
data
=
nv
_ro
32
(
bios
,
data
+
0x10
);
/* guess u32... */
cnt
=
nv
bios_rd
08
(
bios
,
data
+
0x14
);
/* guess at count */
data
=
nv
bios_rd
32
(
bios
,
data
+
0x10
);
/* guess u32... */
save
=
nvkm_rd32
(
device
,
0x10f65c
)
&
0x000000f0
;
for
(
i
=
0
;
i
<
cnt
;
i
++
,
data
+=
4
)
{
if
(
i
!=
save
>>
4
)
{
...
...
@@ -1349,7 +1349,7 @@ gk104_ram_init(struct nvkm_object *object)
nvbios_exec
(
&
(
struct
nvbios_init
)
{
.
subdev
=
nv_subdev
(
fb
),
.
bios
=
bios
,
.
offset
=
nv
_ro
32
(
bios
,
data
),
.
offset
=
nv
bios_rd
32
(
bios
,
data
),
.
execute
=
1
,
});
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv40.c
View file @
7f5f518f
...
...
@@ -154,7 +154,7 @@ nv40_ram_prog(struct nvkm_fb *fb)
struct
nvbios_init
init
=
{
.
subdev
=
nv_subdev
(
fb
),
.
bios
=
bios
,
.
offset
=
nv
_ro
16
(
bios
,
M
.
offset
+
0x00
),
.
offset
=
nv
bios_rd
16
(
bios
,
M
.
offset
+
0x00
),
.
execute
=
1
,
};
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gf110.c
View file @
7f5f518f
...
...
@@ -33,7 +33,7 @@ gf110_gpio_reset(struct nvkm_gpio *gpio, u8 match)
int
ent
=
-
1
;
while
((
entry
=
dcb_gpio_entry
(
bios
,
0
,
++
ent
,
&
ver
,
&
len
)))
{
u32
data
=
nv
_ro
32
(
bios
,
entry
);
u32
data
=
nv
bios_rd
32
(
bios
,
entry
);
u8
line
=
(
data
&
0x0000003f
);
u8
defs
=
!!
(
data
&
0x00000080
);
u8
func
=
(
data
&
0x0000ff00
)
>>
8
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/nv50.c
View file @
7f5f518f
...
...
@@ -34,7 +34,7 @@ nv50_gpio_reset(struct nvkm_gpio *gpio, u8 match)
while
((
entry
=
dcb_gpio_entry
(
bios
,
0
,
++
ent
,
&
ver
,
&
len
)))
{
static
const
u32
regs
[]
=
{
0xe100
,
0xe28c
};
u32
data
=
nv
_ro
32
(
bios
,
entry
);
u32
data
=
nv
bios_rd
32
(
bios
,
entry
);
u8
line
=
(
data
&
0x0000001f
);
u8
func
=
(
data
&
0x0000ff00
)
>>
8
;
u8
defs
=
!!
(
data
&
0x01000000
);
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
View file @
7f5f518f
...
...
@@ -176,7 +176,7 @@ nvkm_i2c_find(struct nvkm_i2c *i2c, u8 index)
u8
ver
,
hdr
,
cnt
,
len
;
u16
i2c
=
dcb_i2c_table
(
bios
,
&
ver
,
&
hdr
,
&
cnt
,
&
len
);
if
(
i2c
&&
ver
>=
0x30
)
{
u8
auxidx
=
nv
_ro
08
(
bios
,
i2c
+
4
);
u8
auxidx
=
nv
bios_rd
08
(
bios
,
i2c
+
4
);
if
(
index
==
NV_I2C_DEFAULT
(
0
))
index
=
(
auxidx
&
0x0f
)
>>
0
;
else
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c
View file @
7f5f518f
...
...
@@ -243,7 +243,7 @@ nvkm_mxm_create_(struct nvkm_object *parent, struct nvkm_object *engine,
return
ret
;
data
=
mxm_table
(
bios
,
&
ver
,
&
len
);
if
(
!
data
||
!
(
ver
=
nv
_ro
08
(
bios
,
data
)))
{
if
(
!
data
||
!
(
ver
=
nv
bios_rd
08
(
bios
,
data
)))
{
nvkm_debug
(
&
mxm
->
subdev
,
"no VBIOS data, nothing to do
\n
"
);
return
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment