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
bef002e8
Commit
bef002e8
authored
Aug 20, 2015
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/pmu: switch to device pri macros
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
83f56106
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
133 additions
and
120 deletions
+133
-120
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
+56
-51
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk104.c
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk104.c
+32
-32
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk110.c
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk110.c
+15
-14
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c
+10
-7
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gt215.c
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gt215.c
+3
-2
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c
+17
-14
No files found.
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
View file @
bef002e8
...
@@ -37,11 +37,12 @@ static int
...
@@ -37,11 +37,12 @@ static int
nvkm_pmu_send
(
struct
nvkm_pmu
*
pmu
,
u32
reply
[
2
],
nvkm_pmu_send
(
struct
nvkm_pmu
*
pmu
,
u32
reply
[
2
],
u32
process
,
u32
message
,
u32
data0
,
u32
data1
)
u32
process
,
u32
message
,
u32
data0
,
u32
data1
)
{
{
struct
nvkm_subdev
*
subdev
=
nv_subdev
(
pmu
);
struct
nvkm_subdev
*
subdev
=
&
pmu
->
subdev
;
struct
nvkm_device
*
device
=
subdev
->
device
;
u32
addr
;
u32
addr
;
/* wait for a free slot in the fifo */
/* wait for a free slot in the fifo */
addr
=
nv
_rd32
(
pmu
,
0x10a4a0
);
addr
=
nv
km_rd32
(
device
,
0x10a4a0
);
if
(
!
nv_wait_ne
(
pmu
,
0x10a4b0
,
0xffffffff
,
addr
^
8
))
if
(
!
nv_wait_ne
(
pmu
,
0x10a4b0
,
0xffffffff
,
addr
^
8
))
return
-
EBUSY
;
return
-
EBUSY
;
...
@@ -57,20 +58,20 @@ nvkm_pmu_send(struct nvkm_pmu *pmu, u32 reply[2],
...
@@ -57,20 +58,20 @@ nvkm_pmu_send(struct nvkm_pmu *pmu, u32 reply[2],
/* acquire data segment access */
/* acquire data segment access */
do
{
do
{
nv
_wr32
(
pmu
,
0x10a580
,
0x00000001
);
nv
km_wr32
(
device
,
0x10a580
,
0x00000001
);
}
while
(
nv
_rd32
(
pmu
,
0x10a580
)
!=
0x00000001
);
}
while
(
nv
km_rd32
(
device
,
0x10a580
)
!=
0x00000001
);
/* write the packet */
/* write the packet */
nv
_wr32
(
pmu
,
0x10a1c0
,
0x01000000
|
(((
addr
&
0x07
)
<<
4
)
+
nv
km_wr32
(
device
,
0x10a1c0
,
0x01000000
|
(((
addr
&
0x07
)
<<
4
)
+
pmu
->
send
.
base
));
pmu
->
send
.
base
));
nv
_wr32
(
pmu
,
0x10a1c4
,
process
);
nv
km_wr32
(
device
,
0x10a1c4
,
process
);
nv
_wr32
(
pmu
,
0x10a1c4
,
message
);
nv
km_wr32
(
device
,
0x10a1c4
,
message
);
nv
_wr32
(
pmu
,
0x10a1c4
,
data0
);
nv
km_wr32
(
device
,
0x10a1c4
,
data0
);
nv
_wr32
(
pmu
,
0x10a1c4
,
data1
);
nv
km_wr32
(
device
,
0x10a1c4
,
data1
);
nv
_wr32
(
pmu
,
0x10a4a0
,
(
addr
+
1
)
&
0x0f
);
nv
km_wr32
(
device
,
0x10a4a0
,
(
addr
+
1
)
&
0x0f
);
/* release data segment access */
/* release data segment access */
nv
_wr32
(
pmu
,
0x10a580
,
0x00000000
);
nv
km_wr32
(
device
,
0x10a580
,
0x00000000
);
/* wait for reply, if requested */
/* wait for reply, if requested */
if
(
reply
)
{
if
(
reply
)
{
...
@@ -87,29 +88,30 @@ static void
...
@@ -87,29 +88,30 @@ static void
nvkm_pmu_recv
(
struct
work_struct
*
work
)
nvkm_pmu_recv
(
struct
work_struct
*
work
)
{
{
struct
nvkm_pmu
*
pmu
=
container_of
(
work
,
struct
nvkm_pmu
,
recv
.
work
);
struct
nvkm_pmu
*
pmu
=
container_of
(
work
,
struct
nvkm_pmu
,
recv
.
work
);
struct
nvkm_device
*
device
=
pmu
->
subdev
.
device
;
u32
process
,
message
,
data0
,
data1
;
u32
process
,
message
,
data0
,
data1
;
/* nothing to do if GET == PUT */
/* nothing to do if GET == PUT */
u32
addr
=
nv
_rd32
(
pmu
,
0x10a4cc
);
u32
addr
=
nv
km_rd32
(
device
,
0x10a4cc
);
if
(
addr
==
nv
_rd32
(
pmu
,
0x10a4c8
))
if
(
addr
==
nv
km_rd32
(
device
,
0x10a4c8
))
return
;
return
;
/* acquire data segment access */
/* acquire data segment access */
do
{
do
{
nv
_wr32
(
pmu
,
0x10a580
,
0x00000002
);
nv
km_wr32
(
device
,
0x10a580
,
0x00000002
);
}
while
(
nv
_rd32
(
pmu
,
0x10a580
)
!=
0x00000002
);
}
while
(
nv
km_rd32
(
device
,
0x10a580
)
!=
0x00000002
);
/* read the packet */
/* read the packet */
nv
_wr32
(
pmu
,
0x10a1c0
,
0x02000000
|
(((
addr
&
0x07
)
<<
4
)
+
nv
km_wr32
(
device
,
0x10a1c0
,
0x02000000
|
(((
addr
&
0x07
)
<<
4
)
+
pmu
->
recv
.
base
));
pmu
->
recv
.
base
));
process
=
nv
_rd32
(
pmu
,
0x10a1c4
);
process
=
nv
km_rd32
(
device
,
0x10a1c4
);
message
=
nv
_rd32
(
pmu
,
0x10a1c4
);
message
=
nv
km_rd32
(
device
,
0x10a1c4
);
data0
=
nv
_rd32
(
pmu
,
0x10a1c4
);
data0
=
nv
km_rd32
(
device
,
0x10a1c4
);
data1
=
nv
_rd32
(
pmu
,
0x10a1c4
);
data1
=
nv
km_rd32
(
device
,
0x10a1c4
);
nv
_wr32
(
pmu
,
0x10a4cc
,
(
addr
+
1
)
&
0x0f
);
nv
km_wr32
(
device
,
0x10a4cc
,
(
addr
+
1
)
&
0x0f
);
/* release data segment access */
/* release data segment access */
nv
_wr32
(
pmu
,
0x10a580
,
0x00000000
);
nv
km_wr32
(
device
,
0x10a580
,
0x00000000
);
/* wake process if it's waiting on a synchronous reply */
/* wake process if it's waiting on a synchronous reply */
if
(
pmu
->
recv
.
process
)
{
if
(
pmu
->
recv
.
process
)
{
...
@@ -137,36 +139,37 @@ nvkm_pmu_recv(struct work_struct *work)
...
@@ -137,36 +139,37 @@ nvkm_pmu_recv(struct work_struct *work)
static
void
static
void
nvkm_pmu_intr
(
struct
nvkm_subdev
*
subdev
)
nvkm_pmu_intr
(
struct
nvkm_subdev
*
subdev
)
{
{
struct
nvkm_pmu
*
pmu
=
(
void
*
)
subdev
;
struct
nvkm_pmu
*
pmu
=
container_of
(
subdev
,
typeof
(
*
pmu
),
subdev
);
u32
disp
=
nv_rd32
(
pmu
,
0x10a01c
);
struct
nvkm_device
*
device
=
pmu
->
subdev
.
device
;
u32
intr
=
nv_rd32
(
pmu
,
0x10a008
)
&
disp
&
~
(
disp
>>
16
);
u32
disp
=
nvkm_rd32
(
device
,
0x10a01c
);
u32
intr
=
nvkm_rd32
(
device
,
0x10a008
)
&
disp
&
~
(
disp
>>
16
);
if
(
intr
&
0x00000020
)
{
if
(
intr
&
0x00000020
)
{
u32
stat
=
nv
_rd32
(
pmu
,
0x10a16c
);
u32
stat
=
nv
km_rd32
(
device
,
0x10a16c
);
if
(
stat
&
0x80000000
)
{
if
(
stat
&
0x80000000
)
{
nv_error
(
pmu
,
"UAS fault at 0x%06x addr 0x%08x
\n
"
,
nv_error
(
pmu
,
"UAS fault at 0x%06x addr 0x%08x
\n
"
,
stat
&
0x00ffffff
,
nv
_rd32
(
pmu
,
0x10a168
));
stat
&
0x00ffffff
,
nv
km_rd32
(
device
,
0x10a168
));
nv
_wr32
(
pmu
,
0x10a16c
,
0x00000000
);
nv
km_wr32
(
device
,
0x10a16c
,
0x00000000
);
intr
&=
~
0x00000020
;
intr
&=
~
0x00000020
;
}
}
}
}
if
(
intr
&
0x00000040
)
{
if
(
intr
&
0x00000040
)
{
schedule_work
(
&
pmu
->
recv
.
work
);
schedule_work
(
&
pmu
->
recv
.
work
);
nv
_wr32
(
pmu
,
0x10a004
,
0x00000040
);
nv
km_wr32
(
device
,
0x10a004
,
0x00000040
);
intr
&=
~
0x00000040
;
intr
&=
~
0x00000040
;
}
}
if
(
intr
&
0x00000080
)
{
if
(
intr
&
0x00000080
)
{
nv_info
(
pmu
,
"wr32 0x%06x 0x%08x
\n
"
,
nv
_rd32
(
pmu
,
0x10a7a0
),
nv_info
(
pmu
,
"wr32 0x%06x 0x%08x
\n
"
,
nv
km_rd32
(
device
,
0x10a7a0
),
nv
_rd32
(
pmu
,
0x10a7a4
));
nv
km_rd32
(
device
,
0x10a7a4
));
nv
_wr32
(
pmu
,
0x10a004
,
0x00000080
);
nv
km_wr32
(
device
,
0x10a004
,
0x00000080
);
intr
&=
~
0x00000080
;
intr
&=
~
0x00000080
;
}
}
if
(
intr
)
{
if
(
intr
)
{
nv_error
(
pmu
,
"intr 0x%08x
\n
"
,
intr
);
nv_error
(
pmu
,
"intr 0x%08x
\n
"
,
intr
);
nv
_wr32
(
pmu
,
0x10a004
,
intr
);
nv
km_wr32
(
device
,
0x10a004
,
intr
);
}
}
}
}
...
@@ -174,8 +177,9 @@ int
...
@@ -174,8 +177,9 @@ int
_nvkm_pmu_fini
(
struct
nvkm_object
*
object
,
bool
suspend
)
_nvkm_pmu_fini
(
struct
nvkm_object
*
object
,
bool
suspend
)
{
{
struct
nvkm_pmu
*
pmu
=
(
void
*
)
object
;
struct
nvkm_pmu
*
pmu
=
(
void
*
)
object
;
struct
nvkm_device
*
device
=
pmu
->
subdev
.
device
;
nv
_wr32
(
pmu
,
0x10a014
,
0x00000060
);
nv
km_wr32
(
device
,
0x10a014
,
0x00000060
);
flush_work
(
&
pmu
->
recv
.
work
);
flush_work
(
&
pmu
->
recv
.
work
);
return
nvkm_subdev_fini
(
&
pmu
->
subdev
,
suspend
);
return
nvkm_subdev_fini
(
&
pmu
->
subdev
,
suspend
);
...
@@ -186,6 +190,7 @@ _nvkm_pmu_init(struct nvkm_object *object)
...
@@ -186,6 +190,7 @@ _nvkm_pmu_init(struct nvkm_object *object)
{
{
const
struct
nvkm_pmu_impl
*
impl
=
(
void
*
)
object
->
oclass
;
const
struct
nvkm_pmu_impl
*
impl
=
(
void
*
)
object
->
oclass
;
struct
nvkm_pmu
*
pmu
=
(
void
*
)
object
;
struct
nvkm_pmu
*
pmu
=
(
void
*
)
object
;
struct
nvkm_device
*
device
=
pmu
->
subdev
.
device
;
int
ret
,
i
;
int
ret
,
i
;
ret
=
nvkm_subdev_init
(
&
pmu
->
subdev
);
ret
=
nvkm_subdev_init
(
&
pmu
->
subdev
);
...
@@ -197,44 +202,44 @@ _nvkm_pmu_init(struct nvkm_object *object)
...
@@ -197,44 +202,44 @@ _nvkm_pmu_init(struct nvkm_object *object)
pmu
->
pgob
=
nvkm_pmu_pgob
;
pmu
->
pgob
=
nvkm_pmu_pgob
;
/* prevent previous ucode from running, wait for idle, reset */
/* prevent previous ucode from running, wait for idle, reset */
nv
_wr32
(
pmu
,
0x10a014
,
0x0000ffff
);
/* INTR_EN_CLR = ALL */
nv
km_wr32
(
device
,
0x10a014
,
0x0000ffff
);
/* INTR_EN_CLR = ALL */
nv_wait
(
pmu
,
0x10a04c
,
0xffffffff
,
0x00000000
);
nv_wait
(
pmu
,
0x10a04c
,
0xffffffff
,
0x00000000
);
nv
_mask
(
pmu
,
0x000200
,
0x00002000
,
0x00000000
);
nv
km_mask
(
device
,
0x000200
,
0x00002000
,
0x00000000
);
nv
_mask
(
pmu
,
0x000200
,
0x00002000
,
0x00002000
);
nv
km_mask
(
device
,
0x000200
,
0x00002000
,
0x00002000
);
nv
_rd32
(
pmu
,
0x000200
);
nv
km_rd32
(
device
,
0x000200
);
nv_wait
(
pmu
,
0x10a10c
,
0x00000006
,
0x00000000
);
nv_wait
(
pmu
,
0x10a10c
,
0x00000006
,
0x00000000
);
/* upload data segment */
/* upload data segment */
nv
_wr32
(
pmu
,
0x10a1c0
,
0x01000000
);
nv
km_wr32
(
device
,
0x10a1c0
,
0x01000000
);
for
(
i
=
0
;
i
<
impl
->
data
.
size
/
4
;
i
++
)
for
(
i
=
0
;
i
<
impl
->
data
.
size
/
4
;
i
++
)
nv
_wr32
(
pmu
,
0x10a1c4
,
impl
->
data
.
data
[
i
]);
nv
km_wr32
(
device
,
0x10a1c4
,
impl
->
data
.
data
[
i
]);
/* upload code segment */
/* upload code segment */
nv
_wr32
(
pmu
,
0x10a180
,
0x01000000
);
nv
km_wr32
(
device
,
0x10a180
,
0x01000000
);
for
(
i
=
0
;
i
<
impl
->
code
.
size
/
4
;
i
++
)
{
for
(
i
=
0
;
i
<
impl
->
code
.
size
/
4
;
i
++
)
{
if
((
i
&
0x3f
)
==
0
)
if
((
i
&
0x3f
)
==
0
)
nv
_wr32
(
pmu
,
0x10a188
,
i
>>
6
);
nv
km_wr32
(
device
,
0x10a188
,
i
>>
6
);
nv
_wr32
(
pmu
,
0x10a184
,
impl
->
code
.
data
[
i
]);
nv
km_wr32
(
device
,
0x10a184
,
impl
->
code
.
data
[
i
]);
}
}
/* start it running */
/* start it running */
nv
_wr32
(
pmu
,
0x10a10c
,
0x00000000
);
nv
km_wr32
(
device
,
0x10a10c
,
0x00000000
);
nv
_wr32
(
pmu
,
0x10a104
,
0x00000000
);
nv
km_wr32
(
device
,
0x10a104
,
0x00000000
);
nv
_wr32
(
pmu
,
0x10a100
,
0x00000002
);
nv
km_wr32
(
device
,
0x10a100
,
0x00000002
);
/* wait for valid host->pmu ring configuration */
/* wait for valid host->pmu ring configuration */
if
(
!
nv_wait_ne
(
pmu
,
0x10a4d0
,
0xffffffff
,
0x00000000
))
if
(
!
nv_wait_ne
(
pmu
,
0x10a4d0
,
0xffffffff
,
0x00000000
))
return
-
EBUSY
;
return
-
EBUSY
;
pmu
->
send
.
base
=
nv
_rd32
(
pmu
,
0x10a4d0
)
&
0x0000ffff
;
pmu
->
send
.
base
=
nv
km_rd32
(
device
,
0x10a4d0
)
&
0x0000ffff
;
pmu
->
send
.
size
=
nv
_rd32
(
pmu
,
0x10a4d0
)
>>
16
;
pmu
->
send
.
size
=
nv
km_rd32
(
device
,
0x10a4d0
)
>>
16
;
/* wait for valid pmu->host ring configuration */
/* wait for valid pmu->host ring configuration */
if
(
!
nv_wait_ne
(
pmu
,
0x10a4dc
,
0xffffffff
,
0x00000000
))
if
(
!
nv_wait_ne
(
pmu
,
0x10a4dc
,
0xffffffff
,
0x00000000
))
return
-
EBUSY
;
return
-
EBUSY
;
pmu
->
recv
.
base
=
nv
_rd32
(
pmu
,
0x10a4dc
)
&
0x0000ffff
;
pmu
->
recv
.
base
=
nv
km_rd32
(
device
,
0x10a4dc
)
&
0x0000ffff
;
pmu
->
recv
.
size
=
nv
_rd32
(
pmu
,
0x10a4dc
)
>>
16
;
pmu
->
recv
.
size
=
nv
km_rd32
(
device
,
0x10a4dc
)
>>
16
;
nv
_wr32
(
pmu
,
0x10a010
,
0x000000e0
);
nv
km_wr32
(
device
,
0x10a010
,
0x000000e0
);
return
0
;
return
0
;
}
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk104.c
View file @
bef002e8
...
@@ -31,49 +31,49 @@
...
@@ -31,49 +31,49 @@
#include <subdev/timer.h>
#include <subdev/timer.h>
static
void
static
void
magic_
(
struct
nvkm_
pmu
*
pmu
,
u32
ctrl
,
int
size
)
magic_
(
struct
nvkm_
device
*
device
,
u32
ctrl
,
int
size
)
{
{
nv
_wr32
(
pmu
,
0x00c800
,
0x00000000
);
nv
km_wr32
(
device
,
0x00c800
,
0x00000000
);
nv
_wr32
(
pmu
,
0x00c808
,
0x00000000
);
nv
km_wr32
(
device
,
0x00c808
,
0x00000000
);
nv
_wr32
(
pmu
,
0x00c800
,
ctrl
);
nv
km_wr32
(
device
,
0x00c800
,
ctrl
);
if
(
nv_wait
(
pmu
,
0x00c800
,
0x40000000
,
0x40000000
))
{
if
(
nv_wait
(
device
,
0x00c800
,
0x40000000
,
0x40000000
))
{
while
(
size
--
)
while
(
size
--
)
nv
_wr32
(
pmu
,
0x00c804
,
0x00000000
);
nv
km_wr32
(
device
,
0x00c804
,
0x00000000
);
}
}
nv
_wr32
(
pmu
,
0x00c800
,
0x00000000
);
nv
km_wr32
(
device
,
0x00c800
,
0x00000000
);
}
}
static
void
static
void
magic
(
struct
nvkm_
pmu
*
pmu
,
u32
ctrl
)
magic
(
struct
nvkm_
device
*
device
,
u32
ctrl
)
{
{
magic_
(
pmu
,
0x8000a41f
|
ctrl
,
6
);
magic_
(
device
,
0x8000a41f
|
ctrl
,
6
);
magic_
(
pmu
,
0x80000421
|
ctrl
,
1
);
magic_
(
device
,
0x80000421
|
ctrl
,
1
);
}
}
static
void
static
void
gk104_pmu_pgob
(
struct
nvkm_pmu
*
pmu
,
bool
enable
)
gk104_pmu_pgob
(
struct
nvkm_pmu
*
pmu
,
bool
enable
)
{
{
struct
nvkm_device
*
device
=
nv_device
(
pmu
)
;
struct
nvkm_device
*
device
=
pmu
->
subdev
.
device
;
nv
_mask
(
pmu
,
0x000200
,
0x00001000
,
0x00000000
);
nv
km_mask
(
device
,
0x000200
,
0x00001000
,
0x00000000
);
nv
_rd32
(
pmu
,
0x000200
);
nv
km_rd32
(
device
,
0x000200
);
nv
_mask
(
pmu
,
0x000200
,
0x08000000
,
0x08000000
);
nv
km_mask
(
device
,
0x000200
,
0x08000000
,
0x08000000
);
msleep
(
50
);
msleep
(
50
);
nv
_mask
(
pmu
,
0x10a78c
,
0x00000002
,
0x00000002
);
nv
km_mask
(
device
,
0x10a78c
,
0x00000002
,
0x00000002
);
nv
_mask
(
pmu
,
0x10a78c
,
0x00000001
,
0x00000001
);
nv
km_mask
(
device
,
0x10a78c
,
0x00000001
,
0x00000001
);
nv
_mask
(
pmu
,
0x10a78c
,
0x00000001
,
0x00000000
);
nv
km_mask
(
device
,
0x10a78c
,
0x00000001
,
0x00000000
);
nv
_mask
(
pmu
,
0x020004
,
0xc0000000
,
enable
?
0xc0000000
:
0x40000000
);
nv
km_mask
(
device
,
0x020004
,
0xc0000000
,
enable
?
0xc0000000
:
0x40000000
);
msleep
(
50
);
msleep
(
50
);
nv
_mask
(
pmu
,
0x10a78c
,
0x00000002
,
0x00000000
);
nv
km_mask
(
device
,
0x10a78c
,
0x00000002
,
0x00000000
);
nv
_mask
(
pmu
,
0x10a78c
,
0x00000001
,
0x00000001
);
nv
km_mask
(
device
,
0x10a78c
,
0x00000001
,
0x00000001
);
nv
_mask
(
pmu
,
0x10a78c
,
0x00000001
,
0x00000000
);
nv
km_mask
(
device
,
0x10a78c
,
0x00000001
,
0x00000000
);
nv
_mask
(
pmu
,
0x000200
,
0x08000000
,
0x00000000
);
nv
km_mask
(
device
,
0x000200
,
0x08000000
,
0x00000000
);
nv
_mask
(
pmu
,
0x000200
,
0x00001000
,
0x00001000
);
nv
km_mask
(
device
,
0x000200
,
0x00001000
,
0x00001000
);
nv
_rd32
(
pmu
,
0x000200
);
nv
km_rd32
(
device
,
0x000200
);
if
(
nv_device_match
(
device
,
0x11fc
,
0x17aa
,
0x2211
)
/* Lenovo W541 */
if
(
nv_device_match
(
device
,
0x11fc
,
0x17aa
,
0x2211
)
/* Lenovo W541 */
||
nv_device_match
(
device
,
0x11fc
,
0x17aa
,
0x221e
)
/* Lenovo W541 */
||
nv_device_match
(
device
,
0x11fc
,
0x17aa
,
0x221e
)
/* Lenovo W541 */
...
@@ -81,18 +81,18 @@ gk104_pmu_pgob(struct nvkm_pmu *pmu, bool enable)
...
@@ -81,18 +81,18 @@ gk104_pmu_pgob(struct nvkm_pmu *pmu, bool enable)
nv_info
(
pmu
,
"hw bug workaround enabled
\n
"
);
nv_info
(
pmu
,
"hw bug workaround enabled
\n
"
);
switch
(
device
->
chipset
)
{
switch
(
device
->
chipset
)
{
case
0xe4
:
case
0xe4
:
magic
(
pmu
,
0x04000000
);
magic
(
device
,
0x04000000
);
magic
(
pmu
,
0x06000000
);
magic
(
device
,
0x06000000
);
magic
(
pmu
,
0x0c000000
);
magic
(
device
,
0x0c000000
);
magic
(
pmu
,
0x0e000000
);
magic
(
device
,
0x0e000000
);
break
;
break
;
case
0xe6
:
case
0xe6
:
magic
(
pmu
,
0x02000000
);
magic
(
device
,
0x02000000
);
magic
(
pmu
,
0x04000000
);
magic
(
device
,
0x04000000
);
magic
(
pmu
,
0x0a000000
);
magic
(
device
,
0x0a000000
);
break
;
break
;
case
0xe7
:
case
0xe7
:
magic
(
pmu
,
0x02000000
);
magic
(
device
,
0x02000000
);
break
;
break
;
default:
default:
break
;
break
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk110.c
View file @
bef002e8
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
void
void
gk110_pmu_pgob
(
struct
nvkm_pmu
*
pmu
,
bool
enable
)
gk110_pmu_pgob
(
struct
nvkm_pmu
*
pmu
,
bool
enable
)
{
{
struct
nvkm_device
*
device
=
pmu
->
subdev
.
device
;
static
const
struct
{
static
const
struct
{
u32
addr
;
u32
addr
;
u32
data
;
u32
data
;
...
@@ -54,28 +55,28 @@ gk110_pmu_pgob(struct nvkm_pmu *pmu, bool enable)
...
@@ -54,28 +55,28 @@ gk110_pmu_pgob(struct nvkm_pmu *pmu, bool enable)
};
};
int
i
;
int
i
;
nv
_mask
(
pmu
,
0x000200
,
0x00001000
,
0x00000000
);
nv
km_mask
(
device
,
0x000200
,
0x00001000
,
0x00000000
);
nv
_rd32
(
pmu
,
0x000200
);
nv
km_rd32
(
device
,
0x000200
);
nv
_mask
(
pmu
,
0x000200
,
0x08000000
,
0x08000000
);
nv
km_mask
(
device
,
0x000200
,
0x08000000
,
0x08000000
);
msleep
(
50
);
msleep
(
50
);
nv
_mask
(
pmu
,
0x10a78c
,
0x00000002
,
0x00000002
);
nv
km_mask
(
device
,
0x10a78c
,
0x00000002
,
0x00000002
);
nv
_mask
(
pmu
,
0x10a78c
,
0x00000001
,
0x00000001
);
nv
km_mask
(
device
,
0x10a78c
,
0x00000001
,
0x00000001
);
nv
_mask
(
pmu
,
0x10a78c
,
0x00000001
,
0x00000000
);
nv
km_mask
(
device
,
0x10a78c
,
0x00000001
,
0x00000000
);
nv
_mask
(
pmu
,
0x0206b4
,
0x00000000
,
0x00000000
);
nv
km_mask
(
device
,
0x0206b4
,
0x00000000
,
0x00000000
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
magic
);
i
++
)
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
magic
);
i
++
)
{
nv
_wr32
(
pmu
,
magic
[
i
].
addr
,
magic
[
i
].
data
);
nv
km_wr32
(
device
,
magic
[
i
].
addr
,
magic
[
i
].
data
);
nv_wait
(
pmu
,
magic
[
i
].
addr
,
0x80000000
,
0x00000000
);
nv_wait
(
pmu
,
magic
[
i
].
addr
,
0x80000000
,
0x00000000
);
}
}
nv
_mask
(
pmu
,
0x10a78c
,
0x00000002
,
0x00000000
);
nv
km_mask
(
device
,
0x10a78c
,
0x00000002
,
0x00000000
);
nv
_mask
(
pmu
,
0x10a78c
,
0x00000001
,
0x00000001
);
nv
km_mask
(
device
,
0x10a78c
,
0x00000001
,
0x00000001
);
nv
_mask
(
pmu
,
0x10a78c
,
0x00000001
,
0x00000000
);
nv
km_mask
(
device
,
0x10a78c
,
0x00000001
,
0x00000000
);
nv
_mask
(
pmu
,
0x000200
,
0x08000000
,
0x00000000
);
nv
km_mask
(
device
,
0x000200
,
0x08000000
,
0x00000000
);
nv
_mask
(
pmu
,
0x000200
,
0x00001000
,
0x00001000
);
nv
km_mask
(
device
,
0x000200
,
0x00001000
,
0x00001000
);
nv
_rd32
(
pmu
,
0x000200
);
nv
km_rd32
(
device
,
0x000200
);
}
}
struct
nvkm_oclass
*
struct
nvkm_oclass
*
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c
View file @
bef002e8
...
@@ -98,16 +98,18 @@ static int
...
@@ -98,16 +98,18 @@ static int
gk20a_pmu_dvfs_get_dev_status
(
struct
gk20a_pmu
*
pmu
,
gk20a_pmu_dvfs_get_dev_status
(
struct
gk20a_pmu
*
pmu
,
struct
gk20a_pmu_dvfs_dev_status
*
status
)
struct
gk20a_pmu_dvfs_dev_status
*
status
)
{
{
status
->
busy
=
nv_rd32
(
pmu
,
0x10a508
+
(
BUSY_SLOT
*
0x10
));
struct
nvkm_device
*
device
=
pmu
->
base
.
subdev
.
device
;
status
->
total
=
nv_rd32
(
pmu
,
0x10a508
+
(
CLK_SLOT
*
0x10
));
status
->
busy
=
nvkm_rd32
(
device
,
0x10a508
+
(
BUSY_SLOT
*
0x10
));
status
->
total
=
nvkm_rd32
(
device
,
0x10a508
+
(
CLK_SLOT
*
0x10
));
return
0
;
return
0
;
}
}
static
void
static
void
gk20a_pmu_dvfs_reset_dev_status
(
struct
gk20a_pmu
*
pmu
)
gk20a_pmu_dvfs_reset_dev_status
(
struct
gk20a_pmu
*
pmu
)
{
{
nv_wr32
(
pmu
,
0x10a508
+
(
BUSY_SLOT
*
0x10
),
0x80000000
);
struct
nvkm_device
*
device
=
pmu
->
base
.
subdev
.
device
;
nv_wr32
(
pmu
,
0x10a508
+
(
CLK_SLOT
*
0x10
),
0x80000000
);
nvkm_wr32
(
device
,
0x10a508
+
(
BUSY_SLOT
*
0x10
),
0x80000000
);
nvkm_wr32
(
device
,
0x10a508
+
(
CLK_SLOT
*
0x10
),
0x80000000
);
}
}
static
void
static
void
...
@@ -173,6 +175,7 @@ static int
...
@@ -173,6 +175,7 @@ static int
gk20a_pmu_init
(
struct
nvkm_object
*
object
)
gk20a_pmu_init
(
struct
nvkm_object
*
object
)
{
{
struct
gk20a_pmu
*
pmu
=
(
void
*
)
object
;
struct
gk20a_pmu
*
pmu
=
(
void
*
)
object
;
struct
nvkm_device
*
device
=
pmu
->
base
.
subdev
.
device
;
int
ret
;
int
ret
;
ret
=
nvkm_subdev_init
(
&
pmu
->
base
.
subdev
);
ret
=
nvkm_subdev_init
(
&
pmu
->
base
.
subdev
);
...
@@ -182,9 +185,9 @@ gk20a_pmu_init(struct nvkm_object *object)
...
@@ -182,9 +185,9 @@ gk20a_pmu_init(struct nvkm_object *object)
pmu
->
base
.
pgob
=
nvkm_pmu_pgob
;
pmu
->
base
.
pgob
=
nvkm_pmu_pgob
;
/* init pwr perf counter */
/* init pwr perf counter */
nv
_wr32
(
pmu
,
0x10a504
+
(
BUSY_SLOT
*
0x10
),
0x00200001
);
nv
km_wr32
(
device
,
0x10a504
+
(
BUSY_SLOT
*
0x10
),
0x00200001
);
nv
_wr32
(
pmu
,
0x10a50c
+
(
BUSY_SLOT
*
0x10
),
0x00000002
);
nv
km_wr32
(
device
,
0x10a50c
+
(
BUSY_SLOT
*
0x10
),
0x00000002
);
nv
_wr32
(
pmu
,
0x10a50c
+
(
CLK_SLOT
*
0x10
),
0x00000003
);
nv
km_wr32
(
device
,
0x10a50c
+
(
CLK_SLOT
*
0x10
),
0x00000003
);
nvkm_timer_alarm
(
pmu
,
2000000000
,
&
pmu
->
alarm
);
nvkm_timer_alarm
(
pmu
,
2000000000
,
&
pmu
->
alarm
);
return
ret
;
return
ret
;
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gt215.c
View file @
bef002e8
...
@@ -28,8 +28,9 @@ static int
...
@@ -28,8 +28,9 @@ static int
gt215_pmu_init
(
struct
nvkm_object
*
object
)
gt215_pmu_init
(
struct
nvkm_object
*
object
)
{
{
struct
nvkm_pmu
*
pmu
=
(
void
*
)
object
;
struct
nvkm_pmu
*
pmu
=
(
void
*
)
object
;
nv_mask
(
pmu
,
0x022210
,
0x00000001
,
0x00000000
);
struct
nvkm_device
*
device
=
pmu
->
subdev
.
device
;
nv_mask
(
pmu
,
0x022210
,
0x00000001
,
0x00000001
);
nvkm_mask
(
device
,
0x022210
,
0x00000001
,
0x00000000
);
nvkm_mask
(
device
,
0x022210
,
0x00000001
,
0x00000001
);
return
nvkm_pmu_init
(
pmu
);
return
nvkm_pmu_init
(
pmu
);
}
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c
View file @
bef002e8
...
@@ -16,13 +16,13 @@ struct nvkm_memx {
...
@@ -16,13 +16,13 @@ struct nvkm_memx {
static
void
static
void
memx_out
(
struct
nvkm_memx
*
memx
)
memx_out
(
struct
nvkm_memx
*
memx
)
{
{
struct
nvkm_
pmu
*
pmu
=
memx
->
pmu
;
struct
nvkm_
device
*
device
=
memx
->
pmu
->
subdev
.
device
;
int
i
;
int
i
;
if
(
memx
->
c
.
mthd
)
{
if
(
memx
->
c
.
mthd
)
{
nv
_wr32
(
pmu
,
0x10a1c4
,
(
memx
->
c
.
size
<<
16
)
|
memx
->
c
.
mthd
);
nv
km_wr32
(
device
,
0x10a1c4
,
(
memx
->
c
.
size
<<
16
)
|
memx
->
c
.
mthd
);
for
(
i
=
0
;
i
<
memx
->
c
.
size
;
i
++
)
for
(
i
=
0
;
i
<
memx
->
c
.
size
;
i
++
)
nv
_wr32
(
pmu
,
0x10a1c4
,
memx
->
c
.
data
[
i
]);
nv
km_wr32
(
device
,
0x10a1c4
,
memx
->
c
.
data
[
i
]);
memx
->
c
.
mthd
=
0
;
memx
->
c
.
mthd
=
0
;
memx
->
c
.
size
=
0
;
memx
->
c
.
size
=
0
;
}
}
...
@@ -42,6 +42,7 @@ memx_cmd(struct nvkm_memx *memx, u32 mthd, u32 size, u32 data[])
...
@@ -42,6 +42,7 @@ memx_cmd(struct nvkm_memx *memx, u32 mthd, u32 size, u32 data[])
int
int
nvkm_memx_init
(
struct
nvkm_pmu
*
pmu
,
struct
nvkm_memx
**
pmemx
)
nvkm_memx_init
(
struct
nvkm_pmu
*
pmu
,
struct
nvkm_memx
**
pmemx
)
{
{
struct
nvkm_device
*
device
=
pmu
->
subdev
.
device
;
struct
nvkm_memx
*
memx
;
struct
nvkm_memx
*
memx
;
u32
reply
[
2
];
u32
reply
[
2
];
int
ret
;
int
ret
;
...
@@ -60,9 +61,9 @@ nvkm_memx_init(struct nvkm_pmu *pmu, struct nvkm_memx **pmemx)
...
@@ -60,9 +61,9 @@ nvkm_memx_init(struct nvkm_pmu *pmu, struct nvkm_memx **pmemx)
/* acquire data segment access */
/* acquire data segment access */
do
{
do
{
nv
_wr32
(
pmu
,
0x10a580
,
0x00000003
);
nv
km_wr32
(
device
,
0x10a580
,
0x00000003
);
}
while
(
nv
_rd32
(
pmu
,
0x10a580
)
!=
0x00000003
);
}
while
(
nv
km_rd32
(
device
,
0x10a580
)
!=
0x00000003
);
nv
_wr32
(
pmu
,
0x10a1c0
,
0x01000000
|
memx
->
base
);
nv
km_wr32
(
device
,
0x10a1c0
,
0x01000000
|
memx
->
base
);
return
0
;
return
0
;
}
}
...
@@ -71,14 +72,15 @@ nvkm_memx_fini(struct nvkm_memx **pmemx, bool exec)
...
@@ -71,14 +72,15 @@ nvkm_memx_fini(struct nvkm_memx **pmemx, bool exec)
{
{
struct
nvkm_memx
*
memx
=
*
pmemx
;
struct
nvkm_memx
*
memx
=
*
pmemx
;
struct
nvkm_pmu
*
pmu
=
memx
->
pmu
;
struct
nvkm_pmu
*
pmu
=
memx
->
pmu
;
struct
nvkm_device
*
device
=
pmu
->
subdev
.
device
;
u32
finish
,
reply
[
2
];
u32
finish
,
reply
[
2
];
/* flush the cache... */
/* flush the cache... */
memx_out
(
memx
);
memx_out
(
memx
);
/* release data segment access */
/* release data segment access */
finish
=
nv
_rd32
(
pmu
,
0x10a1c0
)
&
0x00ffffff
;
finish
=
nv
km_rd32
(
device
,
0x10a1c0
)
&
0x00ffffff
;
nv
_wr32
(
pmu
,
0x10a580
,
0x00000000
);
nv
km_wr32
(
device
,
0x10a580
,
0x00000000
);
/* call MEMX process to execute the script, and wait for reply */
/* call MEMX process to execute the script, and wait for reply */
if
(
exec
)
{
if
(
exec
)
{
...
@@ -120,16 +122,16 @@ nvkm_memx_nsec(struct nvkm_memx *memx, u32 nsec)
...
@@ -120,16 +122,16 @@ nvkm_memx_nsec(struct nvkm_memx *memx, u32 nsec)
void
void
nvkm_memx_wait_vblank
(
struct
nvkm_memx
*
memx
)
nvkm_memx_wait_vblank
(
struct
nvkm_memx
*
memx
)
{
{
struct
nvkm_
pmu
*
pmu
=
memx
->
pmu
;
struct
nvkm_
device
*
device
=
memx
->
pmu
->
subdev
.
device
;
u32
heads
,
x
,
y
,
px
=
0
;
u32
heads
,
x
,
y
,
px
=
0
;
int
i
,
head_sync
;
int
i
,
head_sync
;
if
(
nv_device
(
pmu
)
->
chipset
<
0xd0
)
{
if
(
device
->
chipset
<
0xd0
)
{
heads
=
nv
_rd32
(
pmu
,
0x610050
);
heads
=
nv
km_rd32
(
device
,
0x610050
);
for
(
i
=
0
;
i
<
2
;
i
++
)
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
/* Heuristic: sync to head with biggest resolution */
/* Heuristic: sync to head with biggest resolution */
if
(
heads
&
(
2
<<
(
i
<<
3
)))
{
if
(
heads
&
(
2
<<
(
i
<<
3
)))
{
x
=
nv
_rd32
(
pmu
,
0x610b40
+
(
0x540
*
i
));
x
=
nv
km_rd32
(
device
,
0x610b40
+
(
0x540
*
i
));
y
=
(
x
&
0xffff0000
)
>>
16
;
y
=
(
x
&
0xffff0000
)
>>
16
;
x
&=
0x0000ffff
;
x
&=
0x0000ffff
;
if
((
x
*
y
)
>
px
)
{
if
((
x
*
y
)
>
px
)
{
...
@@ -160,6 +162,7 @@ nvkm_memx_train(struct nvkm_memx *memx)
...
@@ -160,6 +162,7 @@ nvkm_memx_train(struct nvkm_memx *memx)
int
int
nvkm_memx_train_result
(
struct
nvkm_pmu
*
pmu
,
u32
*
res
,
int
rsize
)
nvkm_memx_train_result
(
struct
nvkm_pmu
*
pmu
,
u32
*
res
,
int
rsize
)
{
{
struct
nvkm_device
*
device
=
pmu
->
subdev
.
device
;
u32
reply
[
2
],
base
,
size
,
i
;
u32
reply
[
2
],
base
,
size
,
i
;
int
ret
;
int
ret
;
...
@@ -174,10 +177,10 @@ nvkm_memx_train_result(struct nvkm_pmu *pmu, u32 *res, int rsize)
...
@@ -174,10 +177,10 @@ nvkm_memx_train_result(struct nvkm_pmu *pmu, u32 *res, int rsize)
return
-
ENOMEM
;
return
-
ENOMEM
;
/* read the packet */
/* read the packet */
nv
_wr32
(
pmu
,
0x10a1c0
,
0x02000000
|
base
);
nv
km_wr32
(
device
,
0x10a1c0
,
0x02000000
|
base
);
for
(
i
=
0
;
i
<
size
;
i
++
)
for
(
i
=
0
;
i
<
size
;
i
++
)
res
[
i
]
=
nv
_rd32
(
pmu
,
0x10a1c4
);
res
[
i
]
=
nv
km_rd32
(
device
,
0x10a1c4
);
return
0
;
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