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
2984506f
Commit
2984506f
authored
Oct 15, 2013
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/bus: add interfaces/helpers for sequencer
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
48ae0b35
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
371 additions
and
15 deletions
+371
-15
drivers/gpu/drm/nouveau/Makefile
drivers/gpu/drm/nouveau/Makefile
+1
-0
drivers/gpu/drm/nouveau/core/engine/device/nv50.c
drivers/gpu/drm/nouveau/core/engine/device/nv50.c
+10
-10
drivers/gpu/drm/nouveau/core/include/subdev/bus.h
drivers/gpu/drm/nouveau/core/include/subdev/bus.h
+12
-0
drivers/gpu/drm/nouveau/core/subdev/bus/hwsq.c
drivers/gpu/drm/nouveau/core/subdev/bus/hwsq.c
+145
-0
drivers/gpu/drm/nouveau/core/subdev/bus/hwsq.h
drivers/gpu/drm/nouveau/core/subdev/bus/hwsq.h
+113
-0
drivers/gpu/drm/nouveau/core/subdev/bus/nv04.c
drivers/gpu/drm/nouveau/core/subdev/bus/nv04.c
+2
-0
drivers/gpu/drm/nouveau/core/subdev/bus/nv04.h
drivers/gpu/drm/nouveau/core/subdev/bus/nv04.h
+7
-3
drivers/gpu/drm/nouveau/core/subdev/bus/nv50.c
drivers/gpu/drm/nouveau/core/subdev/bus/nv50.c
+22
-2
drivers/gpu/drm/nouveau/core/subdev/bus/nv94.c
drivers/gpu/drm/nouveau/core/subdev/bus/nv94.c
+59
-0
No files found.
drivers/gpu/drm/nouveau/Makefile
View file @
2984506f
...
...
@@ -44,6 +44,7 @@ nouveau-y += core/subdev/bios/xpio.o
nouveau-y
+=
core/subdev/bus/nv04.o
nouveau-y
+=
core/subdev/bus/nv31.o
nouveau-y
+=
core/subdev/bus/nv50.o
nouveau-y
+=
core/subdev/bus/nv94.o
nouveau-y
+=
core/subdev/bus/nvc0.o
nouveau-y
+=
core/subdev/clock/nv04.o
nouveau-y
+=
core/subdev/clock/nv40.o
...
...
drivers/gpu/drm/nouveau/core/engine/device/nv50.c
View file @
2984506f
...
...
@@ -166,7 +166,7 @@ nv50_identify(struct nouveau_device *device)
device
->
oclass
[
NVDEV_SUBDEV_MXM
]
=
&
nv50_mxm_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_DEVINIT
]
=
&
nv50_devinit_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_MC
]
=
nv94_mc_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
50
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
94
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_TIMER
]
=
&
nv04_timer_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_FB
]
=
nv84_fb_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_INSTMEM
]
=
&
nv50_instmem_oclass
;
...
...
@@ -192,7 +192,7 @@ nv50_identify(struct nouveau_device *device)
device
->
oclass
[
NVDEV_SUBDEV_MXM
]
=
&
nv50_mxm_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_DEVINIT
]
=
&
nv50_devinit_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_MC
]
=
nv94_mc_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
50
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
94
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_TIMER
]
=
&
nv04_timer_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_FB
]
=
nv84_fb_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_INSTMEM
]
=
&
nv50_instmem_oclass
;
...
...
@@ -218,7 +218,7 @@ nv50_identify(struct nouveau_device *device)
device
->
oclass
[
NVDEV_SUBDEV_MXM
]
=
&
nv50_mxm_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_DEVINIT
]
=
&
nv50_devinit_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_MC
]
=
nv98_mc_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
50
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
94
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_TIMER
]
=
&
nv04_timer_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_FB
]
=
nv84_fb_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_INSTMEM
]
=
&
nv50_instmem_oclass
;
...
...
@@ -244,7 +244,7 @@ nv50_identify(struct nouveau_device *device)
device
->
oclass
[
NVDEV_SUBDEV_MXM
]
=
&
nv50_mxm_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_DEVINIT
]
=
&
nv50_devinit_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_MC
]
=
nv98_mc_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
50
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
94
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_TIMER
]
=
&
nv04_timer_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_FB
]
=
nv84_fb_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_INSTMEM
]
=
&
nv50_instmem_oclass
;
...
...
@@ -270,7 +270,7 @@ nv50_identify(struct nouveau_device *device)
device
->
oclass
[
NVDEV_SUBDEV_MXM
]
=
&
nv50_mxm_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_DEVINIT
]
=
&
nv50_devinit_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_MC
]
=
nv98_mc_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
50
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
94
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_TIMER
]
=
&
nv04_timer_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_FB
]
=
nvaa_fb_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_INSTMEM
]
=
&
nv50_instmem_oclass
;
...
...
@@ -296,7 +296,7 @@ nv50_identify(struct nouveau_device *device)
device
->
oclass
[
NVDEV_SUBDEV_MXM
]
=
&
nv50_mxm_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_DEVINIT
]
=
&
nv50_devinit_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_MC
]
=
nv98_mc_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
50
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
94
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_TIMER
]
=
&
nv04_timer_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_FB
]
=
nvaa_fb_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_INSTMEM
]
=
&
nv50_instmem_oclass
;
...
...
@@ -322,7 +322,7 @@ nv50_identify(struct nouveau_device *device)
device
->
oclass
[
NVDEV_SUBDEV_MXM
]
=
&
nv50_mxm_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_DEVINIT
]
=
&
nva3_devinit_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_MC
]
=
nv98_mc_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
50
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
94
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_TIMER
]
=
&
nv04_timer_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_FB
]
=
nva3_fb_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_INSTMEM
]
=
&
nv50_instmem_oclass
;
...
...
@@ -350,7 +350,7 @@ nv50_identify(struct nouveau_device *device)
device
->
oclass
[
NVDEV_SUBDEV_MXM
]
=
&
nv50_mxm_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_DEVINIT
]
=
&
nva3_devinit_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_MC
]
=
nv98_mc_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
50
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
94
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_TIMER
]
=
&
nv04_timer_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_FB
]
=
nva3_fb_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_INSTMEM
]
=
&
nv50_instmem_oclass
;
...
...
@@ -377,7 +377,7 @@ nv50_identify(struct nouveau_device *device)
device
->
oclass
[
NVDEV_SUBDEV_MXM
]
=
&
nv50_mxm_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_DEVINIT
]
=
&
nva3_devinit_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_MC
]
=
nv98_mc_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
50
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
94
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_TIMER
]
=
&
nv04_timer_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_FB
]
=
nva3_fb_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_INSTMEM
]
=
&
nv50_instmem_oclass
;
...
...
@@ -404,7 +404,7 @@ nv50_identify(struct nouveau_device *device)
device
->
oclass
[
NVDEV_SUBDEV_MXM
]
=
&
nv50_mxm_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_DEVINIT
]
=
&
nva3_devinit_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_MC
]
=
nv98_mc_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
50
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_BUS
]
=
nv
94
_bus_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_TIMER
]
=
&
nv04_timer_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_FB
]
=
nvaf_fb_oclass
;
device
->
oclass
[
NVDEV_SUBDEV_INSTMEM
]
=
&
nv50_instmem_oclass
;
...
...
drivers/gpu/drm/nouveau/core/include/subdev/bus.h
View file @
2984506f
...
...
@@ -11,6 +11,8 @@ struct nouveau_bus_intr {
struct
nouveau_bus
{
struct
nouveau_subdev
base
;
int
(
*
hwsq_exec
)(
struct
nouveau_bus
*
,
u32
*
,
u32
);
u32
hwsq_size
;
};
static
inline
struct
nouveau_bus
*
...
...
@@ -36,6 +38,16 @@ nouveau_bus(void *obj)
extern
struct
nouveau_oclass
*
nv04_bus_oclass
;
extern
struct
nouveau_oclass
*
nv31_bus_oclass
;
extern
struct
nouveau_oclass
*
nv50_bus_oclass
;
extern
struct
nouveau_oclass
*
nv94_bus_oclass
;
extern
struct
nouveau_oclass
*
nvc0_bus_oclass
;
/* interface to sequencer */
struct
nouveau_hwsq
;
int
nouveau_hwsq_init
(
struct
nouveau_bus
*
,
struct
nouveau_hwsq
**
);
int
nouveau_hwsq_fini
(
struct
nouveau_hwsq
**
,
bool
exec
);
void
nouveau_hwsq_wr32
(
struct
nouveau_hwsq
*
,
u32
addr
,
u32
data
);
void
nouveau_hwsq_setf
(
struct
nouveau_hwsq
*
,
u8
flag
,
int
data
);
void
nouveau_hwsq_wait
(
struct
nouveau_hwsq
*
,
u8
flag
,
u8
data
);
void
nouveau_hwsq_nsec
(
struct
nouveau_hwsq
*
,
u32
nsec
);
#endif
drivers/gpu/drm/nouveau/core/subdev/bus/hwsq.c
0 → 100644
View file @
2984506f
/*
* 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/timer.h>
#include <subdev/bus.h>
struct
nouveau_hwsq
{
struct
nouveau_bus
*
pbus
;
u32
addr
;
u32
data
;
struct
{
u8
data
[
512
];
u8
size
;
}
c
;
};
static
void
hwsq_cmd
(
struct
nouveau_hwsq
*
hwsq
,
int
size
,
u8
data
[])
{
memcpy
(
&
hwsq
->
c
.
data
[
hwsq
->
c
.
size
],
data
,
size
*
sizeof
(
data
[
0
]));
hwsq
->
c
.
size
+=
size
;
}
int
nouveau_hwsq_init
(
struct
nouveau_bus
*
pbus
,
struct
nouveau_hwsq
**
phwsq
)
{
struct
nouveau_hwsq
*
hwsq
;
hwsq
=
*
phwsq
=
kmalloc
(
sizeof
(
*
hwsq
),
GFP_KERNEL
);
if
(
hwsq
)
{
hwsq
->
pbus
=
pbus
;
hwsq
->
addr
=
~
0
;
hwsq
->
data
=
~
0
;
memset
(
hwsq
->
c
.
data
,
0x7f
,
sizeof
(
hwsq
->
c
.
data
));
hwsq
->
c
.
size
=
0
;
}
return
hwsq
?
0
:
-
ENOMEM
;
}
int
nouveau_hwsq_fini
(
struct
nouveau_hwsq
**
phwsq
,
bool
exec
)
{
struct
nouveau_hwsq
*
hwsq
=
*
phwsq
;
int
ret
=
0
,
i
;
if
(
hwsq
)
{
struct
nouveau_bus
*
pbus
=
hwsq
->
pbus
;
hwsq
->
c
.
size
=
(
hwsq
->
c
.
size
+
4
)
/
4
;
if
(
hwsq
->
c
.
size
<=
pbus
->
hwsq_size
)
{
if
(
exec
)
ret
=
pbus
->
hwsq_exec
(
pbus
,
(
u32
*
)
hwsq
->
c
.
data
,
hwsq
->
c
.
size
);
if
(
ret
)
nv_error
(
pbus
,
"hwsq exec failed: %d
\n
"
,
ret
);
}
else
{
nv_error
(
pbus
,
"hwsq ucode too large
\n
"
);
ret
=
-
ENOSPC
;
}
for
(
i
=
0
;
ret
&&
i
<
hwsq
->
c
.
size
;
i
++
)
nv_error
(
pbus
,
"
\t
0x%08x
\n
"
,
((
u32
*
)
hwsq
->
c
.
data
)[
i
]);
*
phwsq
=
NULL
;
kfree
(
hwsq
);
}
return
ret
;
}
void
nouveau_hwsq_wr32
(
struct
nouveau_hwsq
*
hwsq
,
u32
addr
,
u32
data
)
{
nv_debug
(
hwsq
->
pbus
,
"R[%06x] = 0x%08x
\n
"
,
addr
,
data
);
if
(
hwsq
->
data
!=
data
)
{
if
((
data
&
0xffff0000
)
!=
(
hwsq
->
data
&
0xffff0000
))
{
hwsq_cmd
(
hwsq
,
5
,
(
u8
[]){
0xe2
,
data
,
data
>>
8
,
data
>>
16
,
data
>>
24
});
}
else
{
hwsq_cmd
(
hwsq
,
3
,
(
u8
[]){
0x42
,
data
,
data
>>
8
});
}
}
if
((
addr
&
0xffff0000
)
!=
(
hwsq
->
addr
&
0xffff0000
))
{
hwsq_cmd
(
hwsq
,
5
,
(
u8
[]){
0xe0
,
addr
,
addr
>>
8
,
addr
>>
16
,
addr
>>
24
});
}
else
{
hwsq_cmd
(
hwsq
,
3
,
(
u8
[]){
0x40
,
addr
,
addr
>>
8
});
}
hwsq
->
addr
=
addr
;
hwsq
->
data
=
data
;
}
void
nouveau_hwsq_setf
(
struct
nouveau_hwsq
*
hwsq
,
u8
flag
,
int
data
)
{
nv_debug
(
hwsq
->
pbus
,
" FLAG[%02x] = %d
\n
"
,
flag
,
data
);
flag
+=
0x80
;
if
(
data
>=
0
)
flag
+=
0x20
;
if
(
data
>=
1
)
flag
+=
0x20
;
hwsq_cmd
(
hwsq
,
1
,
(
u8
[]){
flag
});
}
void
nouveau_hwsq_wait
(
struct
nouveau_hwsq
*
hwsq
,
u8
flag
,
u8
data
)
{
nv_debug
(
hwsq
->
pbus
,
" WAIT[%02x] = %d
\n
"
,
flag
,
data
);
hwsq_cmd
(
hwsq
,
3
,
(
u8
[]){
0x5f
,
flag
,
data
});
}
void
nouveau_hwsq_nsec
(
struct
nouveau_hwsq
*
hwsq
,
u32
nsec
)
{
u8
shift
=
0
,
usec
=
nsec
/
1000
;
while
(
usec
&
~
3
)
{
usec
>>=
2
;
shift
++
;
}
nv_debug
(
hwsq
->
pbus
,
" DELAY = %d ns
\n
"
,
nsec
);
hwsq_cmd
(
hwsq
,
1
,
(
u8
[]){
0x00
|
(
shift
<<
2
)
|
usec
});
}
drivers/gpu/drm/nouveau/core/subdev/bus/hwsq.h
0 → 100644
View file @
2984506f
#ifndef __NVKM_BUS_HWSQ_H__
#define __NVKM_BUS_HWSQ_H__
#include <subdev/bus.h>
struct
hwsq
{
struct
nouveau_subdev
*
subdev
;
struct
nouveau_hwsq
*
hwsq
;
int
sequence
;
};
struct
hwsq_reg
{
int
sequence
;
bool
force
;
u32
addr
[
2
];
u32
data
;
};
static
inline
struct
hwsq_reg
hwsq_reg2
(
u32
addr1
,
u32
addr2
)
{
return
(
struct
hwsq_reg
)
{
.
sequence
=
0
,
.
force
=
0
,
.
addr
=
{
addr1
,
addr2
},
.
data
=
0xdeadbeef
,
};
}
static
inline
struct
hwsq_reg
hwsq_reg
(
u32
addr
)
{
return
hwsq_reg2
(
addr
,
addr
);
}
static
inline
int
hwsq_init
(
struct
hwsq
*
ram
,
struct
nouveau_subdev
*
subdev
)
{
struct
nouveau_bus
*
pbus
=
nouveau_bus
(
subdev
);
int
ret
;
ret
=
nouveau_hwsq_init
(
pbus
,
&
ram
->
hwsq
);
if
(
ret
)
return
ret
;
ram
->
sequence
++
;
ram
->
subdev
=
subdev
;
return
0
;
}
static
inline
int
hwsq_exec
(
struct
hwsq
*
ram
,
bool
exec
)
{
int
ret
=
0
;
if
(
ram
->
subdev
)
{
ret
=
nouveau_hwsq_fini
(
&
ram
->
hwsq
,
exec
);
ram
->
subdev
=
NULL
;
}
return
ret
;
}
static
inline
u32
hwsq_rd32
(
struct
hwsq
*
ram
,
struct
hwsq_reg
*
reg
)
{
if
(
reg
->
sequence
!=
ram
->
sequence
)
reg
->
data
=
nv_rd32
(
ram
->
subdev
,
reg
->
addr
[
0
]);
return
reg
->
data
;
}
static
inline
void
hwsq_wr32
(
struct
hwsq
*
ram
,
struct
hwsq_reg
*
reg
,
u32
data
)
{
reg
->
sequence
=
ram
->
sequence
;
reg
->
data
=
data
;
if
(
reg
->
addr
[
0
]
!=
reg
->
addr
[
1
])
nouveau_hwsq_wr32
(
ram
->
hwsq
,
reg
->
addr
[
1
],
reg
->
data
);
nouveau_hwsq_wr32
(
ram
->
hwsq
,
reg
->
addr
[
0
],
reg
->
data
);
}
static
inline
void
hwsq_nuke
(
struct
hwsq
*
ram
,
struct
hwsq_reg
*
reg
)
{
reg
->
force
=
true
;
}
static
inline
u32
hwsq_mask
(
struct
hwsq
*
ram
,
struct
hwsq_reg
*
reg
,
u32
mask
,
u32
data
)
{
u32
temp
=
hwsq_rd32
(
ram
,
reg
);
if
(
temp
!=
((
temp
&
~
mask
)
|
data
)
||
reg
->
force
)
hwsq_wr32
(
ram
,
reg
,
(
temp
&
~
mask
)
|
data
);
return
temp
;
}
static
inline
void
hwsq_setf
(
struct
hwsq
*
ram
,
u8
flag
,
int
data
)
{
nouveau_hwsq_setf
(
ram
->
hwsq
,
flag
,
data
);
}
static
inline
void
hwsq_wait
(
struct
hwsq
*
ram
,
u8
flag
,
u8
data
)
{
nouveau_hwsq_wait
(
ram
->
hwsq
,
flag
,
data
);
}
static
inline
void
hwsq_nsec
(
struct
hwsq
*
ram
,
u32
nsec
)
{
nouveau_hwsq_nsec
(
ram
->
hwsq
,
nsec
);
}
#endif
drivers/gpu/drm/nouveau/core/subdev/bus/nv04.c
View file @
2984506f
...
...
@@ -77,6 +77,8 @@ nv04_bus_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
return
ret
;
nv_subdev
(
priv
)
->
intr
=
impl
->
intr
;
priv
->
base
.
hwsq_exec
=
impl
->
hwsq_exec
;
priv
->
base
.
hwsq_size
=
impl
->
hwsq_size
;
return
0
;
}
...
...
drivers/gpu/drm/nouveau/core/subdev/bus/nv04.h
View file @
2984506f
...
...
@@ -10,10 +10,14 @@ struct nv04_bus_priv {
int
nv04_bus_ctor
(
struct
nouveau_object
*
,
struct
nouveau_object
*
,
struct
nouveau_oclass
*
,
void
*
,
u32
,
struct
nouveau_object
**
);
int
nv50_bus_init
(
struct
nouveau_object
*
);
void
nv50_bus_intr
(
struct
nouveau_subdev
*
);
struct
nv04_bus_impl
{
struct
nouveau_oclass
base
;
void
(
*
intr
)(
struct
nouveau_subdev
*
);
int
(
*
hwsq_exec
)(
struct
nouveau_bus
*
,
u32
*
,
u32
);
u32
hwsq_size
;
};
#endif
drivers/gpu/drm/nouveau/core/subdev/bus/nv50.c
View file @
2984506f
...
...
@@ -23,9 +23,27 @@
* Ben Skeggs
*/
#include <subdev/timer.h>
#include "nv04.h"
static
void
static
int
nv50_bus_hwsq_exec
(
struct
nouveau_bus
*
pbus
,
u32
*
data
,
u32
size
)
{
struct
nv50_bus_priv
*
priv
=
(
void
*
)
pbus
;
int
i
;
nv_mask
(
pbus
,
0x001098
,
0x00000008
,
0x00000000
);
nv_wr32
(
pbus
,
0x001304
,
0x00000000
);
for
(
i
=
0
;
i
<
size
;
i
++
)
nv_wr32
(
priv
,
0x001400
+
(
i
*
4
),
data
[
i
]);
nv_mask
(
pbus
,
0x001098
,
0x00000018
,
0x00000018
);
nv_wr32
(
pbus
,
0x00130c
,
0x00000003
);
return
nv_wait
(
pbus
,
0x001308
,
0x00000100
,
0x00000000
)
?
0
:
-
ETIMEDOUT
;
}
void
nv50_bus_intr
(
struct
nouveau_subdev
*
subdev
)
{
struct
nouveau_bus
*
pbus
=
nouveau_bus
(
subdev
);
...
...
@@ -57,7 +75,7 @@ nv50_bus_intr(struct nouveau_subdev *subdev)
}
}
static
int
int
nv50_bus_init
(
struct
nouveau_object
*
object
)
{
struct
nv04_bus_priv
*
priv
=
(
void
*
)
object
;
...
...
@@ -82,4 +100,6 @@ nv50_bus_oclass = &(struct nv04_bus_impl) {
.
fini
=
_nouveau_bus_fini
,
},
.
intr
=
nv50_bus_intr
,
.
hwsq_exec
=
nv50_bus_hwsq_exec
,
.
hwsq_size
=
64
,
}.
base
;
drivers/gpu/drm/nouveau/core/subdev/bus/nv94.c
0 → 100644
View file @
2984506f
/*
* Copyright 2012 Nouveau Community
*
* 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: Martin Peres <martin.peres@labri.fr>
* Ben Skeggs
*/
#include <subdev/timer.h>
#include "nv04.h"
static
int
nv94_bus_hwsq_exec
(
struct
nouveau_bus
*
pbus
,
u32
*
data
,
u32
size
)
{
struct
nv50_bus_priv
*
priv
=
(
void
*
)
pbus
;
int
i
;
nv_mask
(
pbus
,
0x001098
,
0x00000008
,
0x00000000
);
nv_wr32
(
pbus
,
0x001304
,
0x00000000
);
nv_wr32
(
pbus
,
0x001318
,
0x00000000
);
for
(
i
=
0
;
i
<
size
;
i
++
)
nv_wr32
(
priv
,
0x080000
+
(
i
*
4
),
data
[
i
]);
nv_mask
(
pbus
,
0x001098
,
0x00000018
,
0x00000018
);
nv_wr32
(
pbus
,
0x00130c
,
0x00000001
);
return
nv_wait
(
pbus
,
0x001308
,
0x00000100
,
0x00000000
)
?
0
:
-
ETIMEDOUT
;
}
struct
nouveau_oclass
*
nv94_bus_oclass
=
&
(
struct
nv04_bus_impl
)
{
.
base
.
handle
=
NV_SUBDEV
(
BUS
,
0x94
),
.
base
.
ofuncs
=
&
(
struct
nouveau_ofuncs
)
{
.
ctor
=
nv04_bus_ctor
,
.
dtor
=
_nouveau_bus_dtor
,
.
init
=
nv50_bus_init
,
.
fini
=
_nouveau_bus_fini
,
},
.
intr
=
nv50_bus_intr
,
.
hwsq_exec
=
nv94_bus_hwsq_exec
,
.
hwsq_size
=
128
,
}.
base
;
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