diff --git a/drivers/gpu/drm/nouveau/core/core/gpuobj.c b/drivers/gpu/drm/nouveau/core/core/gpuobj.c index 560b221..e520a04 100644 --- a/drivers/gpu/drm/nouveau/core/core/gpuobj.c +++ b/drivers/gpu/drm/nouveau/core/core/gpuobj.c @@ -92,10 +92,7 @@ nouveau_gpuobj_create_(struct nouveau_object *parent, size = nv_memobj(pargpu)->size; if (bar && bar->alloc) { - struct nouveau_instobj *iobj = (void *)parent; - struct nouveau_mem **mem = (void *)(iobj + 1); - struct nouveau_mem *node = *mem; - if (!bar->alloc(bar, parent, node, &pargpu)) { + if (!bar->alloc(bar, parent, &pargpu)) { nouveau_object_ref(NULL, &parent); parent = pargpu; } diff --git a/drivers/gpu/drm/nouveau/core/include/core/mm.h b/drivers/gpu/drm/nouveau/core/include/core/mm.h index 2514e81..ec048db 100644 --- a/drivers/gpu/drm/nouveau/core/include/core/mm.h +++ b/drivers/gpu/drm/nouveau/core/include/core/mm.h @@ -1,6 +1,8 @@ #ifndef __NOUVEAU_MM_H__ #define __NOUVEAU_MM_H__ +#include + struct nouveau_mm_node { struct list_head nl_entry; struct list_head fl_entry; diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bar.h b/drivers/gpu/drm/nouveau/core/include/subdev/bar.h index 4f4ff45..2390e40 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/bar.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/bar.h @@ -12,7 +12,7 @@ struct nouveau_bar { struct nouveau_subdev base; int (*alloc)(struct nouveau_bar *, struct nouveau_object *, - struct nouveau_mem *, struct nouveau_object **); + struct nouveau_object **); void __iomem *iomem; int (*kmap)(struct nouveau_bar *, struct nouveau_mem *, @@ -50,6 +50,9 @@ extern struct nouveau_oclass nvc0_bar_oclass; int nouveau_bar_alloc(struct nouveau_bar *, struct nouveau_object *, struct nouveau_mem *, struct nouveau_object **); +int nv50_bar_alloc(struct nouveau_bar *bar, struct nouveau_object *parent, + struct nouveau_object **pobject); + void nv84_bar_flush(struct nouveau_bar *); #endif diff --git a/drivers/gpu/drm/nouveau/core/subdev/bar/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/bar/nv50.c index c3acf5b..670ef8d 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bar/nv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bar/nv50.c @@ -28,6 +28,7 @@ #include #include #include +#include struct nv50_bar_priv { struct nouveau_bar base; @@ -105,6 +106,14 @@ nv84_bar_flush(struct nouveau_bar *bar) spin_unlock_irqrestore(&priv->lock, flags); } +int +nv50_bar_alloc(struct nouveau_bar *bar, struct nouveau_object *parent, + struct nouveau_object **pobject) +{ + struct nv50_instobj_priv *ipriv = (void *)parent; + return nouveau_bar_alloc(bar, parent, ipriv->mem, pobject); +} + static int nv50_bar_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass *oclass, void *data, u32 size, @@ -194,7 +203,7 @@ nv50_bar_ctor(struct nouveau_object *parent, struct nouveau_object *engine, nv_wo32(priv->bar1, 0x10, 0x00000000); nv_wo32(priv->bar1, 0x14, 0x00000000); - priv->base.alloc = nouveau_bar_alloc; + priv->base.alloc = nv50_bar_alloc; priv->base.kmap = nv50_bar_kmap; priv->base.umap = nv50_bar_umap; priv->base.unmap = nv50_bar_unmap; diff --git a/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c index 77a6fb7..75b3238 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c @@ -156,7 +156,7 @@ nvc0_bar_ctor(struct nouveau_object *parent, struct nouveau_object *engine, nv_wo32(mem, 0x0208, lower_32_bits(pci_resource_len(pdev, 1) - 1)); nv_wo32(mem, 0x020c, upper_32_bits(pci_resource_len(pdev, 1) - 1)); - priv->base.alloc = nouveau_bar_alloc; + priv->base.alloc = nv50_bar_alloc; priv->base.kmap = nvc0_bar_kmap; priv->base.umap = nvc0_bar_umap; priv->base.unmap = nvc0_bar_unmap; diff --git a/drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.c index cfc7e31..5a2bf0f 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.c @@ -22,22 +22,16 @@ * Authors: Ben Skeggs */ -#include -#include - #include +#include "nv50.h" + struct nv50_instmem_priv { struct nouveau_instmem base; spinlock_t lock; u64 addr; }; -struct nv50_instobj_priv { - struct nouveau_instobj base; - struct nouveau_mem *mem; -}; - static int nv50_instobj_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass *oclass, void *data, u32 size, diff --git a/drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.h b/drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.h new file mode 100644 index 0000000..3b88877 --- /dev/null +++ b/drivers/gpu/drm/nouveau/core/subdev/instmem/nv50.h @@ -0,0 +1,12 @@ +#ifndef __NV50_INSTMEM_H__ +#define __NV50_INSTMEM_H__ + +#include +#include + +struct nv50_instobj_priv { + struct nouveau_instobj base; + struct nouveau_mem *mem; +}; + +#endif