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
d8f266a3
Commit
d8f266a3
authored
Aug 20, 2015
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/bios: switch to device pri macros
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
9155c162
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
30 deletions
+38
-30
drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
+7
-4
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c
+4
-3
drivers/gpu/drm/nouveau/nvkm/subdev/bios/ramcfg.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/ramcfg.c
+1
-1
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowramin.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowramin.c
+14
-11
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowrom.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowrom.c
+12
-11
No files found.
drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
View file @
d8f266a3
...
@@ -180,27 +180,30 @@ init_nvreg(struct nvbios_init *init, u32 reg)
...
@@ -180,27 +180,30 @@ init_nvreg(struct nvbios_init *init, u32 reg)
static
u32
static
u32
init_rd32
(
struct
nvbios_init
*
init
,
u32
reg
)
init_rd32
(
struct
nvbios_init
*
init
,
u32
reg
)
{
{
struct
nvkm_device
*
device
=
init
->
bios
->
subdev
.
device
;
reg
=
init_nvreg
(
init
,
reg
);
reg
=
init_nvreg
(
init
,
reg
);
if
(
reg
!=
~
0
&&
init_exec
(
init
))
if
(
reg
!=
~
0
&&
init_exec
(
init
))
return
nv
_rd32
(
init
->
subdev
,
reg
);
return
nv
km_rd32
(
device
,
reg
);
return
0x00000000
;
return
0x00000000
;
}
}
static
void
static
void
init_wr32
(
struct
nvbios_init
*
init
,
u32
reg
,
u32
val
)
init_wr32
(
struct
nvbios_init
*
init
,
u32
reg
,
u32
val
)
{
{
struct
nvkm_device
*
device
=
init
->
bios
->
subdev
.
device
;
reg
=
init_nvreg
(
init
,
reg
);
reg
=
init_nvreg
(
init
,
reg
);
if
(
reg
!=
~
0
&&
init_exec
(
init
))
if
(
reg
!=
~
0
&&
init_exec
(
init
))
nv
_wr32
(
init
->
subdev
,
reg
,
val
);
nv
km_wr32
(
device
,
reg
,
val
);
}
}
static
u32
static
u32
init_mask
(
struct
nvbios_init
*
init
,
u32
reg
,
u32
mask
,
u32
val
)
init_mask
(
struct
nvbios_init
*
init
,
u32
reg
,
u32
mask
,
u32
val
)
{
{
struct
nvkm_device
*
device
=
init
->
bios
->
subdev
.
device
;
reg
=
init_nvreg
(
init
,
reg
);
reg
=
init_nvreg
(
init
,
reg
);
if
(
reg
!=
~
0
&&
init_exec
(
init
))
{
if
(
reg
!=
~
0
&&
init_exec
(
init
))
{
u32
tmp
=
nv
_rd32
(
init
->
subdev
,
reg
);
u32
tmp
=
nv
km_rd32
(
device
,
reg
);
nv
_wr32
(
init
->
subdev
,
reg
,
(
tmp
&
~
mask
)
|
val
);
nv
km_wr32
(
device
,
reg
,
(
tmp
&
~
mask
)
|
val
);
return
tmp
;
return
tmp
;
}
}
return
0x00000000
;
return
0x00000000
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c
View file @
d8f266a3
...
@@ -221,6 +221,7 @@ pll_map_type(struct nvkm_bios *bios, u8 type, u32 *reg, u8 *ver, u8 *len)
...
@@ -221,6 +221,7 @@ pll_map_type(struct nvkm_bios *bios, u8 type, u32 *reg, u8 *ver, u8 *len)
int
int
nvbios_pll_parse
(
struct
nvkm_bios
*
bios
,
u32
type
,
struct
nvbios_pll
*
info
)
nvbios_pll_parse
(
struct
nvkm_bios
*
bios
,
u32
type
,
struct
nvbios_pll
*
info
)
{
{
struct
nvkm_device
*
device
=
bios
->
subdev
.
device
;
u8
ver
,
len
;
u8
ver
,
len
;
u32
reg
=
type
;
u32
reg
=
type
;
u16
data
;
u16
data
;
...
@@ -360,9 +361,9 @@ nvbios_pll_parse(struct nvkm_bios *bios, u32 type, struct nvbios_pll *info)
...
@@ -360,9 +361,9 @@ nvbios_pll_parse(struct nvkm_bios *bios, u32 type, struct nvbios_pll *info)
}
}
if
(
!
info
->
refclk
)
{
if
(
!
info
->
refclk
)
{
info
->
refclk
=
nv_device
(
bios
)
->
crystal
;
info
->
refclk
=
device
->
crystal
;
if
(
bios
->
version
.
chip
==
0x51
)
{
if
(
bios
->
version
.
chip
==
0x51
)
{
u32
sel_clk
=
nv
_rd32
(
bios
,
0x680524
);
u32
sel_clk
=
nv
km_rd32
(
device
,
0x680524
);
if
((
info
->
reg
==
0x680508
&&
sel_clk
&
0x20
)
||
if
((
info
->
reg
==
0x680508
&&
sel_clk
&
0x20
)
||
(
info
->
reg
==
0x680520
&&
sel_clk
&
0x80
))
{
(
info
->
reg
==
0x680520
&&
sel_clk
&
0x80
))
{
if
(
nv_rdvgac
(
bios
,
0
,
0x27
)
<
0xa3
)
if
(
nv_rdvgac
(
bios
,
0
,
0x27
)
<
0xa3
)
...
@@ -392,7 +393,7 @@ nvbios_pll_parse(struct nvkm_bios *bios, u32 type, struct nvbios_pll *info)
...
@@ -392,7 +393,7 @@ nvbios_pll_parse(struct nvkm_bios *bios, u32 type, struct nvbios_pll *info)
info
->
vco1
.
max_n
=
0xff
;
info
->
vco1
.
max_n
=
0xff
;
info
->
vco1
.
min_m
=
0x1
;
info
->
vco1
.
min_m
=
0x1
;
if
(
nv_device
(
bios
)
->
crystal
==
13500
)
{
if
(
device
->
crystal
==
13500
)
{
/* nv05 does this, nv11 doesn't, nv10 unknown */
/* nv05 does this, nv11 doesn't, nv10 unknown */
if
(
bios
->
version
.
chip
<
0x11
)
if
(
bios
->
version
.
chip
<
0x11
)
info
->
vco1
.
min_m
=
0x7
;
info
->
vco1
.
min_m
=
0x7
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/ramcfg.c
View file @
d8f266a3
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
static
u8
static
u8
nvbios_ramcfg_strap
(
struct
nvkm_subdev
*
subdev
)
nvbios_ramcfg_strap
(
struct
nvkm_subdev
*
subdev
)
{
{
return
(
nv
_rd32
(
subdev
,
0x101000
)
&
0x0000003c
)
>>
2
;
return
(
nv
km_rd32
(
subdev
->
device
,
0x101000
)
&
0x0000003c
)
>>
2
;
}
}
u8
u8
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowramin.c
View file @
d8f266a3
...
@@ -30,10 +30,11 @@ struct priv {
...
@@ -30,10 +30,11 @@ struct priv {
static
u32
static
u32
pramin_read
(
void
*
data
,
u32
offset
,
u32
length
,
struct
nvkm_bios
*
bios
)
pramin_read
(
void
*
data
,
u32
offset
,
u32
length
,
struct
nvkm_bios
*
bios
)
{
{
struct
nvkm_device
*
device
=
bios
->
subdev
.
device
;
u32
i
;
u32
i
;
if
(
offset
+
length
<=
0x00100000
)
{
if
(
offset
+
length
<=
0x00100000
)
{
for
(
i
=
offset
;
i
<
offset
+
length
;
i
+=
4
)
for
(
i
=
offset
;
i
<
offset
+
length
;
i
+=
4
)
*
(
u32
*
)
&
bios
->
data
[
i
]
=
nv
_rd32
(
bios
,
0x700000
+
i
);
*
(
u32
*
)
&
bios
->
data
[
i
]
=
nv
km_rd32
(
device
,
0x700000
+
i
);
return
length
;
return
length
;
}
}
return
0
;
return
0
;
...
@@ -44,7 +45,8 @@ pramin_fini(void *data)
...
@@ -44,7 +45,8 @@ pramin_fini(void *data)
{
{
struct
priv
*
priv
=
data
;
struct
priv
*
priv
=
data
;
if
(
priv
)
{
if
(
priv
)
{
nv_wr32
(
priv
->
bios
,
0x001700
,
priv
->
bar0
);
struct
nvkm_device
*
device
=
priv
->
bios
->
subdev
.
device
;
nvkm_wr32
(
device
,
0x001700
,
priv
->
bar0
);
kfree
(
priv
);
kfree
(
priv
);
}
}
}
}
...
@@ -52,19 +54,20 @@ pramin_fini(void *data)
...
@@ -52,19 +54,20 @@ pramin_fini(void *data)
static
void
*
static
void
*
pramin_init
(
struct
nvkm_bios
*
bios
,
const
char
*
name
)
pramin_init
(
struct
nvkm_bios
*
bios
,
const
char
*
name
)
{
{
struct
nvkm_device
*
device
=
bios
->
subdev
.
device
;
struct
priv
*
priv
=
NULL
;
struct
priv
*
priv
=
NULL
;
u64
addr
=
0
;
u64
addr
=
0
;
/* PRAMIN always potentially available prior to nv50 */
/* PRAMIN always potentially available prior to nv50 */
if
(
nv_device
(
bios
)
->
card_type
<
NV_50
)
if
(
device
->
card_type
<
NV_50
)
return
NULL
;
return
NULL
;
/* we can't get the bios image pointer without PDISP */
/* we can't get the bios image pointer without PDISP */
if
(
nv_device
(
bios
)
->
card_type
>=
GM100
)
if
(
device
->
card_type
>=
GM100
)
addr
=
nv
_rd32
(
bios
,
0x021c04
);
addr
=
nv
km_rd32
(
device
,
0x021c04
);
else
else
if
(
nv_device
(
bios
)
->
card_type
>=
NV_C0
)
if
(
device
->
card_type
>=
NV_C0
)
addr
=
nv
_rd32
(
bios
,
0x022500
);
addr
=
nv
km_rd32
(
device
,
0x022500
);
if
(
addr
&
0x00000001
)
{
if
(
addr
&
0x00000001
)
{
nv_debug
(
bios
,
"... display disabled
\n
"
);
nv_debug
(
bios
,
"... display disabled
\n
"
);
return
ERR_PTR
(
-
ENODEV
);
return
ERR_PTR
(
-
ENODEV
);
...
@@ -74,7 +77,7 @@ pramin_init(struct nvkm_bios *bios, const char *name)
...
@@ -74,7 +77,7 @@ pramin_init(struct nvkm_bios *bios, const char *name)
* important as we don't want to be touching vram on an
* important as we don't want to be touching vram on an
* uninitialised board
* uninitialised board
*/
*/
addr
=
nv
_rd32
(
bios
,
0x619f04
);
addr
=
nv
km_rd32
(
device
,
0x619f04
);
if
(
!
(
addr
&
0x00000008
))
{
if
(
!
(
addr
&
0x00000008
))
{
nv_debug
(
bios
,
"... not enabled
\n
"
);
nv_debug
(
bios
,
"... not enabled
\n
"
);
return
ERR_PTR
(
-
ENODEV
);
return
ERR_PTR
(
-
ENODEV
);
...
@@ -87,7 +90,7 @@ pramin_init(struct nvkm_bios *bios, const char *name)
...
@@ -87,7 +90,7 @@ pramin_init(struct nvkm_bios *bios, const char *name)
/* some alternate method inherited from xf86-video-nv... */
/* some alternate method inherited from xf86-video-nv... */
addr
=
(
addr
&
0xffffff00
)
<<
8
;
addr
=
(
addr
&
0xffffff00
)
<<
8
;
if
(
!
addr
)
{
if
(
!
addr
)
{
addr
=
(
u64
)
nv
_rd32
(
bios
,
0x001700
)
<<
16
;
addr
=
(
u64
)
nv
km_rd32
(
device
,
0x001700
)
<<
16
;
addr
+=
0xf0000
;
addr
+=
0xf0000
;
}
}
...
@@ -98,8 +101,8 @@ pramin_init(struct nvkm_bios *bios, const char *name)
...
@@ -98,8 +101,8 @@ pramin_init(struct nvkm_bios *bios, const char *name)
}
}
priv
->
bios
=
bios
;
priv
->
bios
=
bios
;
priv
->
bar0
=
nv
_rd32
(
bios
,
0x001700
);
priv
->
bar0
=
nv
km_rd32
(
device
,
0x001700
);
nv
_wr32
(
bios
,
0x001700
,
addr
>>
16
);
nv
km_wr32
(
device
,
0x001700
,
addr
>>
16
);
return
priv
;
return
priv
;
}
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowrom.c
View file @
d8f266a3
...
@@ -25,10 +25,11 @@
...
@@ -25,10 +25,11 @@
static
u32
static
u32
prom_read
(
void
*
data
,
u32
offset
,
u32
length
,
struct
nvkm_bios
*
bios
)
prom_read
(
void
*
data
,
u32
offset
,
u32
length
,
struct
nvkm_bios
*
bios
)
{
{
struct
nvkm_device
*
device
=
data
;
u32
i
;
u32
i
;
if
(
offset
+
length
<=
0x00100000
)
{
if
(
offset
+
length
<=
0x00100000
)
{
for
(
i
=
offset
;
i
<
offset
+
length
;
i
+=
4
)
for
(
i
=
offset
;
i
<
offset
+
length
;
i
+=
4
)
*
(
u32
*
)
&
bios
->
data
[
i
]
=
nv
_rd32
(
bios
,
0x300000
+
i
);
*
(
u32
*
)
&
bios
->
data
[
i
]
=
nv
km_rd32
(
device
,
0x300000
+
i
);
return
length
;
return
length
;
}
}
return
0
;
return
0
;
...
@@ -37,25 +38,25 @@ prom_read(void *data, u32 offset, u32 length, struct nvkm_bios *bios)
...
@@ -37,25 +38,25 @@ prom_read(void *data, u32 offset, u32 length, struct nvkm_bios *bios)
static
void
static
void
prom_fini
(
void
*
data
)
prom_fini
(
void
*
data
)
{
{
struct
nvkm_
bios
*
bios
=
data
;
struct
nvkm_
device
*
device
=
data
;
if
(
nv_device
(
bios
)
->
card_type
<
NV_50
)
if
(
device
->
card_type
<
NV_50
)
nv
_mask
(
bios
,
0x001850
,
0x00000001
,
0x00000001
);
nv
km_mask
(
device
,
0x001850
,
0x00000001
,
0x00000001
);
else
else
nv
_mask
(
bios
,
0x088050
,
0x00000001
,
0x00000001
);
nv
km_mask
(
device
,
0x088050
,
0x00000001
,
0x00000001
);
}
}
static
void
*
static
void
*
prom_init
(
struct
nvkm_bios
*
bios
,
const
char
*
name
)
prom_init
(
struct
nvkm_bios
*
bios
,
const
char
*
name
)
{
{
if
(
nv_device
(
bios
)
->
card_type
<
NV_50
)
{
struct
nvkm_device
*
device
=
bios
->
subdev
.
device
;
if
(
nv_device
(
bios
)
->
card_type
==
NV_40
&&
if
(
device
->
card_type
<
NV_50
)
{
nv_device
(
bios
)
->
chipset
>=
0x4c
)
if
(
device
->
card_type
==
NV_40
&&
device
->
chipset
>=
0x4c
)
return
ERR_PTR
(
-
ENODEV
);
return
ERR_PTR
(
-
ENODEV
);
nv
_mask
(
bios
,
0x001850
,
0x00000001
,
0x00000000
);
nv
km_mask
(
device
,
0x001850
,
0x00000001
,
0x00000000
);
}
else
{
}
else
{
nv
_mask
(
bios
,
0x088050
,
0x00000001
,
0x00000000
);
nv
km_mask
(
device
,
0x088050
,
0x00000001
,
0x00000000
);
}
}
return
bios
;
return
device
;
}
}
const
struct
nvbios_source
const
struct
nvbios_source
...
...
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