summaryrefslogtreecommitdiff
path: root/drm/nouveau/nvkm/subdev/bios/shadowpci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drm/nouveau/nvkm/subdev/bios/shadowpci.c')
-rw-r--r--drm/nouveau/nvkm/subdev/bios/shadowpci.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drm/nouveau/nvkm/subdev/bios/shadowpci.c b/drm/nouveau/nvkm/subdev/bios/shadowpci.c
index 0979bc89e..9b91da09d 100644
--- a/drm/nouveau/nvkm/subdev/bios/shadowpci.c
+++ b/drm/nouveau/nvkm/subdev/bios/shadowpci.c
@@ -22,6 +22,8 @@
*/
#include "priv.h"
+#include <core/pci.h>
+
struct priv {
struct pci_dev *pdev;
void __iomem *rom;
@@ -51,10 +53,16 @@ pcirom_fini(void *data)
static void *
pcirom_init(struct nvkm_bios *bios, const char *name)
{
- struct pci_dev *pdev = bios->subdev.device->pdev;
+ struct nvkm_device *device = bios->subdev.device;
struct priv *priv = NULL;
+ struct pci_dev *pdev;
int ret;
+ if (device->func->pci)
+ pdev = device->func->pci(device)->pdev;
+ else
+ return ERR_PTR(-ENODEV);
+
if (!(ret = pci_enable_rom(pdev))) {
if (ret = -ENOMEM,
(priv = kmalloc(sizeof(*priv), GFP_KERNEL))) {
@@ -83,10 +91,16 @@ nvbios_pcirom = {
static void *
platform_init(struct nvkm_bios *bios, const char *name)
{
- struct pci_dev *pdev = bios->subdev.device->pdev;
+ struct nvkm_device *device = bios->subdev.device;
+ struct pci_dev *pdev;
struct priv *priv;
int ret = -ENOMEM;
+ if (device->func->pci)
+ pdev = device->func->pci(device)->pdev;
+ else
+ return ERR_PTR(-ENODEV);
+
if ((priv = kmalloc(sizeof(*priv), GFP_KERNEL))) {
if (ret = -ENODEV,
(priv->rom = pci_platform_rom(pdev, &priv->size)))