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
0a34fb31
Commit
0a34fb31
authored
Aug 20, 2015
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/pci: new subdev
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
fbd58ebd
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
491 additions
and
39 deletions
+491
-39
drivers/gpu/drm/nouveau/include/nvkm/core/device.h
drivers/gpu/drm/nouveau/include/nvkm/core/device.h
+3
-0
drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h
drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h
+21
-0
drivers/gpu/drm/nouveau/nvkm/core/subdev.c
drivers/gpu/drm/nouveau/nvkm/core/subdev.c
+1
-0
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
+96
-28
drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
+1
-0
drivers/gpu/drm/nouveau/nvkm/subdev/Kbuild
drivers/gpu/drm/nouveau/nvkm/subdev/Kbuild
+1
-0
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowrom.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowrom.c
+6
-11
drivers/gpu/drm/nouveau/nvkm/subdev/pci/Kbuild
drivers/gpu/drm/nouveau/nvkm/subdev/pci/Kbuild
+6
-0
drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c
+82
-0
drivers/gpu/drm/nouveau/nvkm/subdev/pci/gf100.c
drivers/gpu/drm/nouveau/nvkm/subdev/pci/gf100.c
+44
-0
drivers/gpu/drm/nouveau/nvkm/subdev/pci/nv04.c
drivers/gpu/drm/nouveau/nvkm/subdev/pci/nv04.c
+58
-0
drivers/gpu/drm/nouveau/nvkm/subdev/pci/nv40.c
drivers/gpu/drm/nouveau/nvkm/subdev/pci/nv40.c
+65
-0
drivers/gpu/drm/nouveau/nvkm/subdev/pci/nv4c.c
drivers/gpu/drm/nouveau/nvkm/subdev/pci/nv4c.c
+37
-0
drivers/gpu/drm/nouveau/nvkm/subdev/pci/nv50.c
drivers/gpu/drm/nouveau/nvkm/subdev/pci/nv50.c
+51
-0
drivers/gpu/drm/nouveau/nvkm/subdev/pci/priv.h
drivers/gpu/drm/nouveau/nvkm/subdev/pci/priv.h
+19
-0
No files found.
drivers/gpu/drm/nouveau/include/nvkm/core/device.h
View file @
0a34fb31
...
...
@@ -4,6 +4,7 @@
#include <core/object.h>
enum
nvkm_devidx
{
NVKM_SUBDEV_PCI
,
NVKM_SUBDEV_VBIOS
,
NVKM_SUBDEV_DEVINIT
,
NVKM_SUBDEV_IBUS
,
...
...
@@ -108,6 +109,7 @@ struct nvkm_device {
struct
nvkm_mc
*
mc
;
struct
nvkm_mmu
*
mmu
;
struct
nvkm_subdev
*
mxm
;
struct
nvkm_pci
*
pci
;
struct
nvkm_pmu
*
pmu
;
struct
nvkm_therm
*
therm
;
struct
nvkm_timer
*
timer
;
...
...
@@ -168,6 +170,7 @@ struct nvkm_device_chip {
int
(
*
mc
)(
struct
nvkm_device
*
,
int
idx
,
struct
nvkm_mc
**
);
int
(
*
mmu
)(
struct
nvkm_device
*
,
int
idx
,
struct
nvkm_mmu
**
);
int
(
*
mxm
)(
struct
nvkm_device
*
,
int
idx
,
struct
nvkm_subdev
**
);
int
(
*
pci
)(
struct
nvkm_device
*
,
int
idx
,
struct
nvkm_pci
**
);
int
(
*
pmu
)(
struct
nvkm_device
*
,
int
idx
,
struct
nvkm_pmu
**
);
int
(
*
therm
)(
struct
nvkm_device
*
,
int
idx
,
struct
nvkm_therm
**
);
int
(
*
timer
)(
struct
nvkm_device
*
,
int
idx
,
struct
nvkm_timer
**
);
...
...
drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h
0 → 100644
View file @
0a34fb31
#ifndef __NVKM_PCI_H__
#define __NVKM_PCI_H__
#include <core/subdev.h>
struct
nvkm_pci
{
const
struct
nvkm_pci_func
*
func
;
struct
nvkm_subdev
subdev
;
};
u32
nvkm_pci_rd32
(
struct
nvkm_pci
*
,
u16
addr
);
void
nvkm_pci_wr08
(
struct
nvkm_pci
*
,
u16
addr
,
u8
data
);
void
nvkm_pci_wr32
(
struct
nvkm_pci
*
,
u16
addr
,
u32
data
);
void
nvkm_pci_rom_shadow
(
struct
nvkm_pci
*
,
bool
shadow
);
void
nvkm_pci_msi_rearm
(
struct
nvkm_pci
*
);
int
nv04_pci_new
(
struct
nvkm_device
*
,
int
,
struct
nvkm_pci
**
);
int
nv40_pci_new
(
struct
nvkm_device
*
,
int
,
struct
nvkm_pci
**
);
int
nv4c_pci_new
(
struct
nvkm_device
*
,
int
,
struct
nvkm_pci
**
);
int
nv50_pci_new
(
struct
nvkm_device
*
,
int
,
struct
nvkm_pci
**
);
int
gf100_pci_new
(
struct
nvkm_device
*
,
int
,
struct
nvkm_pci
**
);
#endif
drivers/gpu/drm/nouveau/nvkm/core/subdev.c
View file @
0a34fb31
...
...
@@ -44,6 +44,7 @@ nvkm_subdev_name[NVKM_SUBDEV_NR] = {
[
NVKM_SUBDEV_MC
]
=
"mc"
,
[
NVKM_SUBDEV_MMU
]
=
"mmu"
,
[
NVKM_SUBDEV_MXM
]
=
"mxm"
,
[
NVKM_SUBDEV_PCI
]
=
"pci"
,
[
NVKM_SUBDEV_PMU
]
=
"pmu"
,
[
NVKM_SUBDEV_THERM
]
=
"therm"
,
[
NVKM_SUBDEV_TIMER
]
=
"tmr"
,
...
...
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
View file @
0a34fb31
This diff is collapsed.
Click to expand it.
drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
View file @
0a34fb31
...
...
@@ -17,6 +17,7 @@
#include <subdev/mc.h>
#include <subdev/mmu.h>
#include <subdev/mxm.h>
#include <subdev/pci.h>
#include <subdev/pmu.h>
#include <subdev/therm.h>
#include <subdev/timer.h>
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/Kbuild
View file @
0a34fb31
...
...
@@ -13,6 +13,7 @@ include $(src)/nvkm/subdev/ltc/Kbuild
include $(src)/nvkm/subdev/mc/Kbuild
include $(src)/nvkm/subdev/mmu/Kbuild
include $(src)/nvkm/subdev/mxm/Kbuild
include $(src)/nvkm/subdev/pci/Kbuild
include $(src)/nvkm/subdev/pmu/Kbuild
include $(src)/nvkm/subdev/therm/Kbuild
include $(src)/nvkm/subdev/timer/Kbuild
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowrom.c
View file @
0a34fb31
...
...
@@ -22,6 +22,8 @@
*/
#include "priv.h"
#include <subdev/pci.h>
static
u32
prom_read
(
void
*
data
,
u32
offset
,
u32
length
,
struct
nvkm_bios
*
bios
)
{
...
...
@@ -39,23 +41,16 @@ static void
prom_fini
(
void
*
data
)
{
struct
nvkm_device
*
device
=
data
;
if
(
device
->
card_type
<
NV_50
)
nvkm_mask
(
device
,
0x001850
,
0x00000001
,
0x00000001
);
else
nvkm_mask
(
device
,
0x088050
,
0x00000001
,
0x00000001
);
nvkm_pci_rom_shadow
(
device
->
pci
,
true
);
}
static
void
*
prom_init
(
struct
nvkm_bios
*
bios
,
const
char
*
name
)
{
struct
nvkm_device
*
device
=
bios
->
subdev
.
device
;
if
(
device
->
card_type
<
NV_50
)
{
if
(
device
->
card_type
==
NV_40
&&
device
->
chipset
>=
0x4c
)
return
ERR_PTR
(
-
ENODEV
);
nvkm_mask
(
device
,
0x001850
,
0x00000001
,
0x00000000
);
}
else
{
nvkm_mask
(
device
,
0x088050
,
0x00000001
,
0x00000000
);
}
if
(
device
->
card_type
==
NV_40
&&
device
->
chipset
>=
0x4c
)
return
ERR_PTR
(
-
ENODEV
);
nvkm_pci_rom_shadow
(
device
->
pci
,
false
);
return
device
;
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/pci/Kbuild
0 → 100644
View file @
0a34fb31
nvkm-y += nvkm/subdev/pci/base.o
nvkm-y += nvkm/subdev/pci/nv04.o
nvkm-y += nvkm/subdev/pci/nv40.o
nvkm-y += nvkm/subdev/pci/nv4c.o
nvkm-y += nvkm/subdev/pci/nv50.o
nvkm-y += nvkm/subdev/pci/gf100.o
drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c
0 → 100644
View file @
0a34fb31
/*
* Copyright 2015 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 "priv.h"
u32
nvkm_pci_rd32
(
struct
nvkm_pci
*
pci
,
u16
addr
)
{
return
pci
->
func
->
rd32
(
pci
,
addr
);
}
void
nvkm_pci_wr08
(
struct
nvkm_pci
*
pci
,
u16
addr
,
u8
data
)
{
pci
->
func
->
wr08
(
pci
,
addr
,
data
);
}
void
nvkm_pci_wr32
(
struct
nvkm_pci
*
pci
,
u16
addr
,
u32
data
)
{
pci
->
func
->
wr32
(
pci
,
addr
,
data
);
}
void
nvkm_pci_rom_shadow
(
struct
nvkm_pci
*
pci
,
bool
shadow
)
{
u32
data
=
nvkm_pci_rd32
(
pci
,
0x0050
);
if
(
shadow
)
data
|=
0x00000001
;
else
data
&=
~
0x00000001
;
nvkm_pci_wr32
(
pci
,
0x0050
,
data
);
}
void
nvkm_pci_msi_rearm
(
struct
nvkm_pci
*
pci
)
{
pci
->
func
->
msi_rearm
(
pci
);
}
static
void
*
nvkm_pci_dtor
(
struct
nvkm_subdev
*
subdev
)
{
return
nvkm_pci
(
subdev
);
}
static
const
struct
nvkm_subdev_func
nvkm_pci_func
=
{
.
dtor
=
nvkm_pci_dtor
,
};
int
nvkm_pci_new_
(
const
struct
nvkm_pci_func
*
func
,
struct
nvkm_device
*
device
,
int
index
,
struct
nvkm_pci
**
ppci
)
{
struct
nvkm_pci
*
pci
;
if
(
!
(
pci
=
*
ppci
=
kzalloc
(
sizeof
(
**
ppci
),
GFP_KERNEL
)))
return
-
ENOMEM
;
nvkm_subdev_ctor
(
&
nvkm_pci_func
,
device
,
index
,
0
,
&
pci
->
subdev
);
pci
->
func
=
func
;
return
0
;
}
drivers/gpu/drm/nouveau/nvkm/subdev/pci/gf100.c
0 → 100644
View file @
0a34fb31
/*
* Copyright 2015 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 "priv.h"
static
void
gf100_pci_msi_rearm
(
struct
nvkm_pci
*
pci
)
{
nvkm_pci_wr08
(
pci
,
0x0704
,
0xff
);
}
static
const
struct
nvkm_pci_func
gf100_pci_func
=
{
.
rd32
=
nv40_pci_rd32
,
.
wr08
=
nv40_pci_wr08
,
.
wr32
=
nv40_pci_wr32
,
.
msi_rearm
=
gf100_pci_msi_rearm
,
};
int
gf100_pci_new
(
struct
nvkm_device
*
device
,
int
index
,
struct
nvkm_pci
**
ppci
)
{
return
nvkm_pci_new_
(
&
gf100_pci_func
,
device
,
index
,
ppci
);
}
drivers/gpu/drm/nouveau/nvkm/subdev/pci/nv04.c
0 → 100644
View file @
0a34fb31
/*
* Copyright 2015 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 "priv.h"
static
u32
nv04_pci_rd32
(
struct
nvkm_pci
*
pci
,
u16
addr
)
{
struct
nvkm_device
*
device
=
pci
->
subdev
.
device
;
return
nvkm_rd32
(
device
,
0x001800
+
addr
);
}
static
void
nv04_pci_wr08
(
struct
nvkm_pci
*
pci
,
u16
addr
,
u8
data
)
{
struct
nvkm_device
*
device
=
pci
->
subdev
.
device
;
nvkm_wr08
(
device
,
0x001800
+
addr
,
data
);
}
static
void
nv04_pci_wr32
(
struct
nvkm_pci
*
pci
,
u16
addr
,
u32
data
)
{
struct
nvkm_device
*
device
=
pci
->
subdev
.
device
;
nvkm_wr32
(
device
,
0x001800
+
addr
,
data
);
}
static
const
struct
nvkm_pci_func
nv04_pci_func
=
{
.
rd32
=
nv04_pci_rd32
,
.
wr08
=
nv04_pci_wr08
,
.
wr32
=
nv04_pci_wr32
,
};
int
nv04_pci_new
(
struct
nvkm_device
*
device
,
int
index
,
struct
nvkm_pci
**
ppci
)
{
return
nvkm_pci_new_
(
&
nv04_pci_func
,
device
,
index
,
ppci
);
}
drivers/gpu/drm/nouveau/nvkm/subdev/pci/nv40.c
0 → 100644
View file @
0a34fb31
/*
* Copyright 2015 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 "priv.h"
u32
nv40_pci_rd32
(
struct
nvkm_pci
*
pci
,
u16
addr
)
{
struct
nvkm_device
*
device
=
pci
->
subdev
.
device
;
return
nvkm_rd32
(
device
,
0x088000
+
addr
);
}
void
nv40_pci_wr08
(
struct
nvkm_pci
*
pci
,
u16
addr
,
u8
data
)
{
struct
nvkm_device
*
device
=
pci
->
subdev
.
device
;
nvkm_wr08
(
device
,
0x088000
+
addr
,
data
);
}
void
nv40_pci_wr32
(
struct
nvkm_pci
*
pci
,
u16
addr
,
u32
data
)
{
struct
nvkm_device
*
device
=
pci
->
subdev
.
device
;
nvkm_wr32
(
device
,
0x088000
+
addr
,
data
);
}
static
void
nv40_pci_msi_rearm
(
struct
nvkm_pci
*
pci
)
{
nvkm_pci_wr08
(
pci
,
0x0068
,
0xff
);
}
static
const
struct
nvkm_pci_func
nv40_pci_func
=
{
.
rd32
=
nv40_pci_rd32
,
.
wr08
=
nv40_pci_wr08
,
.
wr32
=
nv40_pci_wr32
,
.
msi_rearm
=
nv40_pci_msi_rearm
,
};
int
nv40_pci_new
(
struct
nvkm_device
*
device
,
int
index
,
struct
nvkm_pci
**
ppci
)
{
return
nvkm_pci_new_
(
&
nv40_pci_func
,
device
,
index
,
ppci
);
}
drivers/gpu/drm/nouveau/nvkm/subdev/pci/nv4c.c
0 → 100644
View file @
0a34fb31
/*
* Copyright 2015 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 "priv.h"
static
const
struct
nvkm_pci_func
nv4c_pci_func
=
{
.
rd32
=
nv40_pci_rd32
,
.
wr08
=
nv40_pci_wr08
,
.
wr32
=
nv40_pci_wr32
,
};
int
nv4c_pci_new
(
struct
nvkm_device
*
device
,
int
index
,
struct
nvkm_pci
**
ppci
)
{
return
nvkm_pci_new_
(
&
nv4c_pci_func
,
device
,
index
,
ppci
);
}
drivers/gpu/drm/nouveau/nvkm/subdev/pci/nv50.c
0 → 100644
View file @
0a34fb31
/*
* Copyright 2015 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 "priv.h"
#include <core/pci.h>
/* MSI re-arm through the PRI appears to be broken on the original G80,
* so we access it via alternate PCI config space mechanisms.
*/
static
void
nv50_pci_msi_rearm
(
struct
nvkm_pci
*
pci
)
{
struct
nvkm_device
*
device
=
pci
->
subdev
.
device
;
struct
pci_dev
*
pdev
=
device
->
func
->
pci
(
device
)
->
pdev
;
pci_write_config_byte
(
pdev
,
0x68
,
0xff
);
}
static
const
struct
nvkm_pci_func
nv50_pci_func
=
{
.
rd32
=
nv40_pci_rd32
,
.
wr08
=
nv40_pci_wr08
,
.
wr32
=
nv40_pci_wr32
,
.
msi_rearm
=
nv50_pci_msi_rearm
,
};
int
nv50_pci_new
(
struct
nvkm_device
*
device
,
int
index
,
struct
nvkm_pci
**
ppci
)
{
return
nvkm_pci_new_
(
&
nv50_pci_func
,
device
,
index
,
ppci
);
}
drivers/gpu/drm/nouveau/nvkm/subdev/pci/priv.h
0 → 100644
View file @
0a34fb31
#ifndef __NVKM_PCI_PRIV_H__
#define __NVKM_PCI_PRIV_H__
#define nvkm_pci(p) container_of((p), struct nvkm_pci, subdev)
#include <subdev/pci.h>
int
nvkm_pci_new_
(
const
struct
nvkm_pci_func
*
,
struct
nvkm_device
*
,
int
index
,
struct
nvkm_pci
**
);
struct
nvkm_pci_func
{
u32
(
*
rd32
)(
struct
nvkm_pci
*
,
u16
addr
);
void
(
*
wr08
)(
struct
nvkm_pci
*
,
u16
addr
,
u8
data
);
void
(
*
wr32
)(
struct
nvkm_pci
*
,
u16
addr
,
u32
data
);
void
(
*
msi_rearm
)(
struct
nvkm_pci
*
);
};
u32
nv40_pci_rd32
(
struct
nvkm_pci
*
,
u16
);
void
nv40_pci_wr08
(
struct
nvkm_pci
*
,
u16
,
u8
);
void
nv40_pci_wr32
(
struct
nvkm_pci
*
,
u16
,
u32
);
#endif
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