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
nexedi
linux
Commits
0a0dc8f5
Commit
0a0dc8f5
authored
Nov 27, 2013
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/bios: make common code to handle ramcfg strap etc
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
59054392
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
86 additions
and
91 deletions
+86
-91
drivers/gpu/drm/nouveau/Makefile
drivers/gpu/drm/nouveau/Makefile
+1
-0
drivers/gpu/drm/nouveau/core/include/subdev/bios/ramcfg.h
drivers/gpu/drm/nouveau/core/include/subdev/bios/ramcfg.h
+9
-0
drivers/gpu/drm/nouveau/core/subdev/bios/init.c
drivers/gpu/drm/nouveau/core/subdev/bios/init.c
+5
-43
drivers/gpu/drm/nouveau/core/subdev/bios/ramcfg.c
drivers/gpu/drm/nouveau/core/subdev/bios/ramcfg.c
+67
-0
drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c
drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c
+1
-12
drivers/gpu/drm/nouveau/core/subdev/fb/ramnva3.c
drivers/gpu/drm/nouveau/core/subdev/fb/ramnva3.c
+1
-11
drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c
drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c
+1
-13
drivers/gpu/drm/nouveau/core/subdev/fb/ramnve0.c
drivers/gpu/drm/nouveau/core/subdev/fb/ramnve0.c
+1
-12
No files found.
drivers/gpu/drm/nouveau/Makefile
View file @
0a0dc8f5
...
@@ -41,6 +41,7 @@ nouveau-y += core/subdev/bios/init.o
...
@@ -41,6 +41,7 @@ nouveau-y += core/subdev/bios/init.o
nouveau-y
+=
core/subdev/bios/mxm.o
nouveau-y
+=
core/subdev/bios/mxm.o
nouveau-y
+=
core/subdev/bios/perf.o
nouveau-y
+=
core/subdev/bios/perf.o
nouveau-y
+=
core/subdev/bios/pll.o
nouveau-y
+=
core/subdev/bios/pll.o
nouveau-y
+=
core/subdev/bios/ramcfg.o
nouveau-y
+=
core/subdev/bios/rammap.o
nouveau-y
+=
core/subdev/bios/rammap.o
nouveau-y
+=
core/subdev/bios/timing.o
nouveau-y
+=
core/subdev/bios/timing.o
nouveau-y
+=
core/subdev/bios/therm.o
nouveau-y
+=
core/subdev/bios/therm.o
...
...
drivers/gpu/drm/nouveau/core/include/subdev/bios/ramcfg.h
0 → 100644
View file @
0a0dc8f5
#ifndef __NVBIOS_RAMCFG_H__
#define __NVBIOS_RAMCFG_H__
struct
nouveau_bios
;
u8
nvbios_ramcfg_count
(
struct
nouveau_bios
*
);
u8
nvbios_ramcfg_index
(
struct
nouveau_bios
*
);
#endif
drivers/gpu/drm/nouveau/core/subdev/bios/init.c
View file @
0a0dc8f5
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include <subdev/bios/dp.h>
#include <subdev/bios/dp.h>
#include <subdev/bios/gpio.h>
#include <subdev/bios/gpio.h>
#include <subdev/bios/init.h>
#include <subdev/bios/init.h>
#include <subdev/bios/ramcfg.h>
#include <subdev/devinit.h>
#include <subdev/devinit.h>
#include <subdev/i2c.h>
#include <subdev/i2c.h>
#include <subdev/vga.h>
#include <subdev/vga.h>
...
@@ -391,43 +392,14 @@ init_unknown_script(struct nouveau_bios *bios)
...
@@ -391,43 +392,14 @@ init_unknown_script(struct nouveau_bios *bios)
return
0x0000
;
return
0x0000
;
}
}
static
u16
init_ram_restrict_table
(
struct
nvbios_init
*
init
)
{
struct
nouveau_bios
*
bios
=
init
->
bios
;
struct
bit_entry
bit_M
;
u16
data
=
0x0000
;
if
(
!
bit_entry
(
bios
,
'M'
,
&
bit_M
))
{
if
(
bit_M
.
version
==
1
&&
bit_M
.
length
>=
5
)
data
=
nv_ro16
(
bios
,
bit_M
.
offset
+
3
);
if
(
bit_M
.
version
==
2
&&
bit_M
.
length
>=
3
)
data
=
nv_ro16
(
bios
,
bit_M
.
offset
+
1
);
}
if
(
data
==
0x0000
)
warn
(
"ram restrict table not found
\n
"
);
return
data
;
}
static
u8
static
u8
init_ram_restrict_group_count
(
struct
nvbios_init
*
init
)
init_ram_restrict_group_count
(
struct
nvbios_init
*
init
)
{
{
struct
nouveau_bios
*
bios
=
init
->
bios
;
return
nvbios_ramcfg_count
(
init
->
bios
);
struct
bit_entry
bit_M
;
if
(
!
bit_entry
(
bios
,
'M'
,
&
bit_M
))
{
if
(
bit_M
.
version
==
1
&&
bit_M
.
length
>=
5
)
return
nv_ro08
(
bios
,
bit_M
.
offset
+
2
);
if
(
bit_M
.
version
==
2
&&
bit_M
.
length
>=
3
)
return
nv_ro08
(
bios
,
bit_M
.
offset
+
0
);
}
return
0x00
;
}
}
static
u8
static
u8
init_ram_restrict
_strap
(
struct
nvbios_init
*
init
)
init_ram_restrict
(
struct
nvbios_init
*
init
)
{
{
/* This appears to be the behaviour of the VBIOS parser, and *is*
/* This appears to be the behaviour of the VBIOS parser, and *is*
* important to cache the NV_PEXTDEV_BOOT0 on later chipsets to
* important to cache the NV_PEXTDEV_BOOT0 on later chipsets to
...
@@ -438,18 +410,8 @@ init_ram_restrict_strap(struct nvbios_init *init)
...
@@ -438,18 +410,8 @@ init_ram_restrict_strap(struct nvbios_init *init)
* in case *not* re-reading the strap causes similar breakage.
* in case *not* re-reading the strap causes similar breakage.
*/
*/
if
(
!
init
->
ramcfg
||
init
->
bios
->
version
.
major
<
0x70
)
if
(
!
init
->
ramcfg
||
init
->
bios
->
version
.
major
<
0x70
)
init
->
ramcfg
=
init_rd32
(
init
,
0x101000
);
init
->
ramcfg
=
0x80000000
|
nvbios_ramcfg_index
(
init
->
bios
);
return
(
init
->
ramcfg
&
0x00000003c
)
>>
2
;
return
(
init
->
ramcfg
&
0x7fffffff
);
}
static
u8
init_ram_restrict
(
struct
nvbios_init
*
init
)
{
u8
strap
=
init_ram_restrict_strap
(
init
);
u16
table
=
init_ram_restrict_table
(
init
);
if
(
table
)
return
nv_ro08
(
init
->
bios
,
table
+
strap
);
return
0x00
;
}
}
static
u8
static
u8
...
...
drivers/gpu/drm/nouveau/core/subdev/bios/ramcfg.c
0 → 100644
View file @
0a0dc8f5
/*
* Copyright 2013 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: Ben Skeggs <bskeggs@redhat.com>
*/
#include <subdev/bios.h>
#include <subdev/bios/bit.h>
#include <subdev/bios/ramcfg.h>
static
u8
nvbios_ramcfg_strap
(
struct
nouveau_bios
*
bios
)
{
return
(
nv_rd32
(
bios
,
0x101000
)
&
0x0000003c
)
>>
2
;
}
u8
nvbios_ramcfg_count
(
struct
nouveau_bios
*
bios
)
{
struct
bit_entry
bit_M
;
if
(
!
bit_entry
(
bios
,
'M'
,
&
bit_M
))
{
if
(
bit_M
.
version
==
1
&&
bit_M
.
length
>=
5
)
return
nv_ro08
(
bios
,
bit_M
.
offset
+
2
);
if
(
bit_M
.
version
==
2
&&
bit_M
.
length
>=
3
)
return
nv_ro08
(
bios
,
bit_M
.
offset
+
0
);
}
return
0x00
;
}
u8
nvbios_ramcfg_index
(
struct
nouveau_bios
*
bios
)
{
u8
strap
=
nvbios_ramcfg_strap
(
bios
);
u32
xlat
=
0x00000000
;
struct
bit_entry
bit_M
;
if
(
!
bit_entry
(
bios
,
'M'
,
&
bit_M
))
{
if
(
bit_M
.
version
==
1
&&
bit_M
.
length
>=
5
)
xlat
=
nv_ro16
(
bios
,
bit_M
.
offset
+
3
);
if
(
bit_M
.
version
==
2
&&
bit_M
.
length
>=
3
)
xlat
=
nv_ro16
(
bios
,
bit_M
.
offset
+
1
);
}
if
(
xlat
)
strap
=
nv_ro08
(
bios
,
xlat
+
strap
);
return
strap
;
}
drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c
View file @
0a0dc8f5
...
@@ -70,13 +70,11 @@ nv50_ram_calc(struct nouveau_fb *pfb, u32 freq)
...
@@ -70,13 +70,11 @@ nv50_ram_calc(struct nouveau_fb *pfb, u32 freq)
struct
nv50_ramseq
*
hwsq
=
&
ram
->
hwsq
;
struct
nv50_ramseq
*
hwsq
=
&
ram
->
hwsq
;
struct
nvbios_perfE
perfE
;
struct
nvbios_perfE
perfE
;
struct
nvbios_pll
mpll
;
struct
nvbios_pll
mpll
;
struct
bit_entry
M
;
struct
{
struct
{
u32
data
;
u32
data
;
u8
size
;
u8
size
;
}
ramcfg
,
timing
;
}
ramcfg
,
timing
;
u8
ver
,
hdr
,
cnt
,
strap
;
u8
ver
,
hdr
,
cnt
,
strap
;
u32
data
;
int
N1
,
M1
,
N2
,
M2
,
P
;
int
N1
,
M1
,
N2
,
M2
,
P
;
int
ret
,
i
;
int
ret
,
i
;
...
@@ -93,16 +91,7 @@ nv50_ram_calc(struct nouveau_fb *pfb, u32 freq)
...
@@ -93,16 +91,7 @@ nv50_ram_calc(struct nouveau_fb *pfb, u32 freq)
}
while
(
perfE
.
memory
<
freq
);
}
while
(
perfE
.
memory
<
freq
);
/* locate specific data set for the attached memory */
/* locate specific data set for the attached memory */
if
(
bit_entry
(
bios
,
'M'
,
&
M
)
||
M
.
version
!=
1
||
M
.
length
<
5
)
{
strap
=
nvbios_ramcfg_index
(
bios
);
nv_error
(
pfb
,
"invalid/missing memory table
\n
"
);
return
-
EINVAL
;
}
strap
=
(
nv_rd32
(
pfb
,
0x101000
)
&
0x0000003c
)
>>
2
;
data
=
nv_ro16
(
bios
,
M
.
offset
+
3
);
if
(
data
)
strap
=
nv_ro08
(
bios
,
data
+
strap
);
if
(
strap
>=
cnt
)
{
if
(
strap
>=
cnt
)
{
nv_error
(
pfb
,
"invalid ramcfg strap
\n
"
);
nv_error
(
pfb
,
"invalid ramcfg strap
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
...
...
drivers/gpu/drm/nouveau/core/subdev/fb/ramnva3.c
View file @
0a0dc8f5
...
@@ -79,7 +79,6 @@ nva3_ram_calc(struct nouveau_fb *pfb, u32 freq)
...
@@ -79,7 +79,6 @@ nva3_ram_calc(struct nouveau_fb *pfb, u32 freq)
struct
nva3_ram
*
ram
=
(
void
*
)
pfb
->
ram
;
struct
nva3_ram
*
ram
=
(
void
*
)
pfb
->
ram
;
struct
nva3_ramfuc
*
fuc
=
&
ram
->
fuc
;
struct
nva3_ramfuc
*
fuc
=
&
ram
->
fuc
;
struct
nva3_clock_info
mclk
;
struct
nva3_clock_info
mclk
;
struct
bit_entry
M
;
u8
ver
,
cnt
,
strap
;
u8
ver
,
cnt
,
strap
;
u32
data
;
u32
data
;
struct
{
struct
{
...
@@ -99,16 +98,7 @@ nva3_ram_calc(struct nouveau_fb *pfb, u32 freq)
...
@@ -99,16 +98,7 @@ nva3_ram_calc(struct nouveau_fb *pfb, u32 freq)
}
}
/* locate specific data set for the attached memory */
/* locate specific data set for the attached memory */
if
(
bit_entry
(
bios
,
'M'
,
&
M
)
||
M
.
version
!=
2
||
M
.
length
<
3
)
{
strap
=
nvbios_ramcfg_index
(
bios
);
nv_error
(
pfb
,
"invalid/missing memory table
\n
"
);
return
-
EINVAL
;
}
strap
=
(
nv_rd32
(
pfb
,
0x101000
)
&
0x0000003c
)
>>
2
;
data
=
nv_ro16
(
bios
,
M
.
offset
+
1
);
if
(
data
)
strap
=
nv_ro08
(
bios
,
data
+
strap
);
if
(
strap
>=
cnt
)
{
if
(
strap
>=
cnt
)
{
nv_error
(
pfb
,
"invalid ramcfg strap
\n
"
);
nv_error
(
pfb
,
"invalid ramcfg strap
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
...
...
drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c
View file @
0a0dc8f5
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
*/
*/
#include <subdev/bios.h>
#include <subdev/bios.h>
#include <subdev/bios/bit.h>
#include <subdev/bios/pll.h>
#include <subdev/bios/pll.h>
#include <subdev/bios/rammap.h>
#include <subdev/bios/rammap.h>
#include <subdev/bios/timing.h>
#include <subdev/bios/timing.h>
...
@@ -134,9 +133,7 @@ nvc0_ram_calc(struct nouveau_fb *pfb, u32 freq)
...
@@ -134,9 +133,7 @@ nvc0_ram_calc(struct nouveau_fb *pfb, u32 freq)
struct
nouveau_bios
*
bios
=
nouveau_bios
(
pfb
);
struct
nouveau_bios
*
bios
=
nouveau_bios
(
pfb
);
struct
nvc0_ram
*
ram
=
(
void
*
)
pfb
->
ram
;
struct
nvc0_ram
*
ram
=
(
void
*
)
pfb
->
ram
;
struct
nvc0_ramfuc
*
fuc
=
&
ram
->
fuc
;
struct
nvc0_ramfuc
*
fuc
=
&
ram
->
fuc
;
struct
bit_entry
M
;
u8
ver
,
cnt
,
strap
;
u8
ver
,
cnt
,
strap
;
u32
data
;
struct
{
struct
{
u32
data
;
u32
data
;
u8
size
;
u8
size
;
...
@@ -155,16 +152,7 @@ nvc0_ram_calc(struct nouveau_fb *pfb, u32 freq)
...
@@ -155,16 +152,7 @@ nvc0_ram_calc(struct nouveau_fb *pfb, u32 freq)
}
}
/* locate specific data set for the attached memory */
/* locate specific data set for the attached memory */
if
(
bit_entry
(
bios
,
'M'
,
&
M
)
||
M
.
version
!=
2
||
M
.
length
<
3
)
{
strap
=
nvbios_ramcfg_index
(
bios
);
nv_error
(
pfb
,
"invalid/missing memory table
\n
"
);
return
-
EINVAL
;
}
strap
=
(
nv_rd32
(
pfb
,
0x101000
)
&
0x0000003c
)
>>
2
;
data
=
nv_ro16
(
bios
,
M
.
offset
+
1
);
if
(
data
)
strap
=
nv_ro08
(
bios
,
data
+
strap
);
if
(
strap
>=
cnt
)
{
if
(
strap
>=
cnt
)
{
nv_error
(
pfb
,
"invalid ramcfg strap
\n
"
);
nv_error
(
pfb
,
"invalid ramcfg strap
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
...
...
drivers/gpu/drm/nouveau/core/subdev/fb/ramnve0.c
View file @
0a0dc8f5
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
#include <subdev/gpio.h>
#include <subdev/gpio.h>
#include <subdev/bios.h>
#include <subdev/bios.h>
#include <subdev/bios/bit.h>
#include <subdev/bios/pll.h>
#include <subdev/bios/pll.h>
#include <subdev/bios/init.h>
#include <subdev/bios/init.h>
#include <subdev/bios/rammap.h>
#include <subdev/bios/rammap.h>
...
@@ -876,7 +875,6 @@ nve0_ram_calc(struct nouveau_fb *pfb, u32 freq)
...
@@ -876,7 +875,6 @@ nve0_ram_calc(struct nouveau_fb *pfb, u32 freq)
struct
nouveau_bios
*
bios
=
nouveau_bios
(
pfb
);
struct
nouveau_bios
*
bios
=
nouveau_bios
(
pfb
);
struct
nve0_ram
*
ram
=
(
void
*
)
pfb
->
ram
;
struct
nve0_ram
*
ram
=
(
void
*
)
pfb
->
ram
;
struct
nve0_ramfuc
*
fuc
=
&
ram
->
fuc
;
struct
nve0_ramfuc
*
fuc
=
&
ram
->
fuc
;
struct
bit_entry
M
;
int
ret
,
refclk
,
strap
,
i
;
int
ret
,
refclk
,
strap
,
i
;
u32
data
;
u32
data
;
u8
cnt
;
u8
cnt
;
...
@@ -893,16 +891,7 @@ nve0_ram_calc(struct nouveau_fb *pfb, u32 freq)
...
@@ -893,16 +891,7 @@ nve0_ram_calc(struct nouveau_fb *pfb, u32 freq)
}
}
/* locate specific data set for the attached memory */
/* locate specific data set for the attached memory */
if
(
bit_entry
(
bios
,
'M'
,
&
M
)
||
M
.
version
!=
2
||
M
.
length
<
3
)
{
strap
=
nvbios_ramcfg_index
(
bios
);
nv_error
(
pfb
,
"invalid/missing memory table
\n
"
);
return
-
EINVAL
;
}
strap
=
(
nv_rd32
(
pfb
,
0x101000
)
&
0x0000003c
)
>>
2
;
data
=
nv_ro16
(
bios
,
M
.
offset
+
1
);
if
(
data
)
strap
=
nv_ro08
(
bios
,
data
+
strap
);
if
(
strap
>=
cnt
)
{
if
(
strap
>=
cnt
)
{
nv_error
(
pfb
,
"invalid ramcfg strap
\n
"
);
nv_error
(
pfb
,
"invalid ramcfg strap
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
...
...
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