diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/base.c b/drivers/gpu/drm/nouveau/core/subdev/fb/base.c index 821cd75b86a3c4f2e313bd7448929573ac81faa2..dab4bdbbc190d57e49a1cdfe63a9ac592f573cd8 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/base.c @@ -22,9 +22,10 @@ * Authors: Ben Skeggs */ -#include "subdev/fb.h" -#include "subdev/bios.h" -#include "subdev/bios/bit.h" +#include +#include + +#include "priv.h" int nouveau_fb_bios_memtype(struct nouveau_bios *bios) @@ -106,9 +107,9 @@ _nouveau_fb_dtor(struct nouveau_object *object) int nouveau_fb_create_(struct nouveau_object *parent, struct nouveau_object *engine, - struct nouveau_oclass *oclass, struct nouveau_oclass *ramcls, - int length, void **pobject) + struct nouveau_oclass *oclass, int length, void **pobject) { + struct nouveau_fb_impl *impl = (void *)oclass; static const char *name[] = { [NV_MEM_TYPE_UNKNOWN] = "unknown", [NV_MEM_TYPE_STOLEN ] = "stolen system memory", @@ -133,7 +134,7 @@ nouveau_fb_create_(struct nouveau_object *parent, struct nouveau_object *engine, return ret; ret = nouveau_object_ctor(nv_object(pfb), nv_object(pfb), - ramcls, NULL, 0, &ram); + impl->ram, NULL, 0, &ram); if (ret) { nv_fatal(pfb, "error detecting memory configuration!!\n"); return ret; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv04.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv04.c index b88e87b70948db90e1ec9a7770d4d39934176b28..3bf88210451ded81e85cc3a3318909cf9c330bf5 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv04.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv04.c @@ -65,7 +65,7 @@ nv04_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nv04_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nv04_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -75,12 +75,13 @@ nv04_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, } struct nouveau_oclass * -nv04_fb_oclass = &(struct nouveau_oclass) { - .handle = NV_SUBDEV(FB, 0x04), - .ofuncs = &(struct nouveau_ofuncs) { +nv04_fb_oclass = &(struct nouveau_fb_impl) { + .base.handle = NV_SUBDEV(FB, 0x04), + .base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv04_fb_ctor, .dtor = _nouveau_fb_dtor, .init = nv04_fb_init, .fini = _nouveau_fb_fini, }, -}; + .ram = &nv04_ram_oclass, +}.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv10.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv10.c index ab0ea940cd227e35d90c52af3c14ed6a0ab79cb9..ffed6085ae829c00e1b3a8195eed4ab143916949 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv10.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv10.c @@ -65,7 +65,7 @@ nv10_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nv10_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nv10_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -79,12 +79,13 @@ nv10_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, } struct nouveau_oclass * -nv10_fb_oclass = &(struct nouveau_oclass) { - .handle = NV_SUBDEV(FB, 0x10), - .ofuncs = &(struct nouveau_ofuncs) { +nv10_fb_oclass = &(struct nouveau_fb_impl) { + .base.handle = NV_SUBDEV(FB, 0x10), + .base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv10_fb_ctor, .dtor = _nouveau_fb_dtor, .init = _nouveau_fb_init, .fini = _nouveau_fb_fini, }, -}; + .ram = &nv10_ram_oclass, +}.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c index 5c91131ee471b768f65bb1fe9a4a314f1e2c4ebf..c67f52ffd651137dae1a8ee9b177ce4b06b88ac2 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c @@ -38,7 +38,7 @@ nv1a_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nv1a_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nv1a_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -52,12 +52,13 @@ nv1a_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, } struct nouveau_oclass * -nv1a_fb_oclass = &(struct nouveau_oclass) { - .handle = NV_SUBDEV(FB, 0x1a), - .ofuncs = &(struct nouveau_ofuncs) { +nv1a_fb_oclass = &(struct nouveau_fb_impl) { + .base.handle = NV_SUBDEV(FB, 0x1a), + .base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv1a_fb_ctor, .dtor = _nouveau_fb_dtor, .init = _nouveau_fb_init, .fini = _nouveau_fb_fini, }, -}; + .ram = &nv10_ram_oclass, +}.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c index 4ded3c08d61308fcc9a412d91d1c404b78f8f25d..9bd3f1aa1e29697d1f70039aac5d2d2efbffaf96 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv20.c @@ -88,7 +88,7 @@ nv20_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nv20_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nv20_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -103,12 +103,13 @@ nv20_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, } struct nouveau_oclass * -nv20_fb_oclass = &(struct nouveau_oclass) { - .handle = NV_SUBDEV(FB, 0x20), - .ofuncs = &(struct nouveau_ofuncs) { +nv20_fb_oclass = &(struct nouveau_fb_impl) { + .base.handle = NV_SUBDEV(FB, 0x20), + .base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv20_fb_ctor, .dtor = _nouveau_fb_dtor, .init = _nouveau_fb_init, .fini = _nouveau_fb_fini, }, -}; + .ram = &nv20_ram_oclass, +}.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c index 3c3e37b0d0810724d50dd1fb158970fcbf7ea2f0..23b6aadc1911dce95266c6334e227c47dd1be5a4 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv25.c @@ -54,7 +54,7 @@ nv25_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nv25_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nv20_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -69,12 +69,13 @@ nv25_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, } struct nouveau_oclass * -nv25_fb_oclass = &(struct nouveau_oclass) { - .handle = NV_SUBDEV(FB, 0x25), - .ofuncs = &(struct nouveau_ofuncs) { +nv25_fb_oclass = &(struct nouveau_fb_impl) { + .base.handle = NV_SUBDEV(FB, 0x25), + .base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv25_fb_ctor, .dtor = _nouveau_fb_dtor, .init = _nouveau_fb_init, .fini = _nouveau_fb_fini, }, -}; + .ram = &nv20_ram_oclass, +}.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c index fd05a84a540a70f026b3d302d8718afc3e02ec32..b747c72510eaeab870747168ef8733827d66d49f 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv30.c @@ -132,7 +132,7 @@ nv30_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nv30_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nv20_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -147,12 +147,13 @@ nv30_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, } struct nouveau_oclass * -nv30_fb_oclass = &(struct nouveau_oclass) { - .handle = NV_SUBDEV(FB, 0x30), - .ofuncs = &(struct nouveau_ofuncs) { +nv30_fb_oclass = &(struct nouveau_fb_impl) { + .base.handle = NV_SUBDEV(FB, 0x30), + .base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv30_fb_ctor, .dtor = _nouveau_fb_dtor, .init = nv30_fb_init, .fini = _nouveau_fb_fini, }, -}; + .ram = &nv20_ram_oclass, +}.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c index 0c4f82c882f1c3bfd5e54f28f742adb110414417..2131ba7b29c0cee145239032c029c5e69ecafd39 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv35.c @@ -55,7 +55,7 @@ nv35_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nv35_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nv20_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -70,12 +70,13 @@ nv35_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, } struct nouveau_oclass * -nv35_fb_oclass = &(struct nouveau_oclass) { - .handle = NV_SUBDEV(FB, 0x35), - .ofuncs = &(struct nouveau_ofuncs) { +nv35_fb_oclass = &(struct nouveau_fb_impl) { + .base.handle = NV_SUBDEV(FB, 0x35), + .base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv35_fb_ctor, .dtor = _nouveau_fb_dtor, .init = nv30_fb_init, .fini = _nouveau_fb_fini, }, -}; + .ram = &nv20_ram_oclass, +}.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c index b3e148a9c752ab627d0a55532201dfa201e47e96..5e7749d19035c1299719ef779a9c5b331ef31550 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv36.c @@ -55,7 +55,7 @@ nv36_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nv36_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nv20_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -70,12 +70,13 @@ nv36_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, } struct nouveau_oclass * -nv36_fb_oclass = &(struct nouveau_oclass) { - .handle = NV_SUBDEV(FB, 0x36), - .ofuncs = &(struct nouveau_ofuncs) { +nv36_fb_oclass = &(struct nouveau_fb_impl) { + .base.handle = NV_SUBDEV(FB, 0x36), + .base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv36_fb_ctor, .dtor = _nouveau_fb_dtor, .init = nv30_fb_init, .fini = _nouveau_fb_fini, }, -}; + .ram = &nv20_ram_oclass, +}.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c index c35154091318b9dfb7e566b14c92d05d6f185f4e..3f84c822db914ffb2b097f2b8a776b7a76c87618 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv40.c @@ -69,7 +69,7 @@ nv40_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nv40_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nv40_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -85,12 +85,13 @@ nv40_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass * -nv40_fb_oclass = &(struct nouveau_oclass) { - .handle = NV_SUBDEV(FB, 0x40), - .ofuncs = &(struct nouveau_ofuncs) { +nv40_fb_oclass = &(struct nouveau_fb_impl) { + .base.handle = NV_SUBDEV(FB, 0x40), + .base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv40_fb_ctor, .dtor = _nouveau_fb_dtor, .init = nv40_fb_init, .fini = _nouveau_fb_fini, }, -}; + .ram = &nv40_ram_oclass, +}.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv41.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv41.c index ee682f5cad026ebd56f5de3a2c9332bdc30d211b..f555dc7505df24cc1f67dc2a2b2b3a1cc755e6e3 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv41.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv41.c @@ -62,7 +62,7 @@ nv41_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nv41_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nv41_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -78,12 +78,13 @@ nv41_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass * -nv41_fb_oclass = &(struct nouveau_oclass) { - .handle = NV_SUBDEV(FB, 0x41), - .ofuncs = &(struct nouveau_ofuncs) { +nv41_fb_oclass = &(struct nouveau_fb_impl) { + .base.handle = NV_SUBDEV(FB, 0x41), + .base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv41_fb_ctor, .dtor = _nouveau_fb_dtor, .init = nv41_fb_init, .fini = _nouveau_fb_fini, }, -}; + .ram = &nv41_ram_oclass, +}.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv44.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv44.c index 92b4d95744942c8644b8883a65b186a59a827985..69b81ad4f8e5a87d38ed19c37349324538024d78 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv44.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv44.c @@ -72,7 +72,7 @@ nv44_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nv44_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nv44_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -87,12 +87,13 @@ nv44_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass * -nv44_fb_oclass = &(struct nouveau_oclass) { - .handle = NV_SUBDEV(FB, 0x44), - .ofuncs = &(struct nouveau_ofuncs) { +nv44_fb_oclass = &(struct nouveau_fb_impl) { + .base.handle = NV_SUBDEV(FB, 0x44), + .base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv44_fb_ctor, .dtor = _nouveau_fb_dtor, .init = nv44_fb_init, .fini = _nouveau_fb_fini, }, -}; + .ram = &nv44_ram_oclass, +}.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv46.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv46.c index 50d93d71f479e51df3ae0365696c36c22efa0e38..61a278f3f1ce61a9779e0887e8370d2be2a53cef 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv46.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv46.c @@ -52,7 +52,7 @@ nv46_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nv46_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nv44_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -67,12 +67,13 @@ nv46_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass * -nv46_fb_oclass = &(struct nouveau_oclass) { - .handle = NV_SUBDEV(FB, 0x46), - .ofuncs = &(struct nouveau_ofuncs) { +nv46_fb_oclass = &(struct nouveau_fb_impl) { + .base.handle = NV_SUBDEV(FB, 0x46), + .base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv46_fb_ctor, .dtor = _nouveau_fb_dtor, .init = nv44_fb_init, .fini = _nouveau_fb_fini, }, -}; + .ram = &nv44_ram_oclass, +}.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv47.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv47.c index 7c73db2842378c639c898f11cccef7062bfb1e75..e7286bd9139e8799e83fa96715e84767b5a795b9 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv47.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv47.c @@ -38,7 +38,7 @@ nv47_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nv47_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nv41_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -54,12 +54,13 @@ nv47_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass * -nv47_fb_oclass = &(struct nouveau_oclass) { - .handle = NV_SUBDEV(FB, 0x47), - .ofuncs = &(struct nouveau_ofuncs) { +nv47_fb_oclass = &(struct nouveau_fb_impl) { + .base.handle = NV_SUBDEV(FB, 0x47), + .base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv47_fb_ctor, .dtor = _nouveau_fb_dtor, .init = nv41_fb_init, .fini = _nouveau_fb_fini, }, -}; + .ram = &nv41_ram_oclass, +}.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv49.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv49.c index 9f7a22436e533e9ce32e8b75a9b4dd296d3f1ff7..f18df404bda6b105a67be8a1d91a63bfaca1294e 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv49.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv49.c @@ -38,7 +38,7 @@ nv49_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nv49_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nv49_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -54,12 +54,13 @@ nv49_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass * -nv49_fb_oclass = &(struct nouveau_oclass) { - .handle = NV_SUBDEV(FB, 0x49), - .ofuncs = &(struct nouveau_ofuncs) { +nv49_fb_oclass = &(struct nouveau_fb_impl) { + .base.handle = NV_SUBDEV(FB, 0x49), + .base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv49_fb_ctor, .dtor = _nouveau_fb_dtor, .init = nv41_fb_init, .fini = _nouveau_fb_fini, }, -}; + .ram = &nv49_ram_oclass, +}.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv4e.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv4e.c index 42d7dbf6392240d82d88e3518166d57b86a6074b..14a47cbb6691e226dc7ff318d5a291fe1e012fed 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv4e.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv4e.c @@ -38,7 +38,7 @@ nv4e_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nv4e_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nv4e_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -52,12 +52,13 @@ nv4e_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, } struct nouveau_oclass * -nv4e_fb_oclass = &(struct nouveau_oclass) { - .handle = NV_SUBDEV(FB, 0x4e), - .ofuncs = &(struct nouveau_ofuncs) { +nv4e_fb_oclass = &(struct nouveau_fb_impl) { + .base.handle = NV_SUBDEV(FB, 0x4e), + .base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv4e_fb_ctor, .dtor = _nouveau_fb_dtor, .init = nv44_fb_init, .fini = _nouveau_fb_fini, }, -}; + .ram = &nv4e_ram_oclass, +}.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c index 1fd0dc73aa7ca236d7566d95f75304a91ae89ad9..8577e3a10120fbdc64efae80f24f4113a4d24f56 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c @@ -243,7 +243,7 @@ nv50_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nv50_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nv50_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -304,12 +304,13 @@ nv50_fb_init(struct nouveau_object *object) struct nouveau_oclass * nv50_fb_oclass = &(struct nv50_fb_impl) { - .base.handle = NV_SUBDEV(FB, 0x50), - .base.ofuncs = &(struct nouveau_ofuncs) { + .base.base.handle = NV_SUBDEV(FB, 0x50), + .base.base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv50_fb_ctor, .dtor = nv50_fb_dtor, .init = nv50_fb_init, .fini = _nouveau_fb_fini, }, + .base.ram = &nv50_ram_oclass, .trap = 0x000707ff, -}.base; +}.base.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.h b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.h index b7e57928f2961d68a40b9f2f99c78ddb77a0c763..a1a9420529908b48eb0055674dddca5df252408a 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.h +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.h @@ -16,7 +16,7 @@ void nv50_fb_dtor(struct nouveau_object *); int nv50_fb_init(struct nouveau_object *); struct nv50_fb_impl { - struct nouveau_oclass base; + struct nouveau_fb_impl base; u32 trap; }; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv84.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv84.c index 0a6ee5d048fe07844b03e4ce487eee1627028c8e..4ad25349f68931286afd8020844574e6deb77b18 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv84.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv84.c @@ -26,12 +26,13 @@ struct nouveau_oclass * nv84_fb_oclass = &(struct nv50_fb_impl) { - .base.handle = NV_SUBDEV(FB, 0x84), - .base.ofuncs = &(struct nouveau_ofuncs) { + .base.base.handle = NV_SUBDEV(FB, 0x84), + .base.base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv50_fb_ctor, .dtor = nv50_fb_dtor, .init = nv50_fb_init, .fini = _nouveau_fb_fini, }, + .base.ram = &nv50_ram_oclass, .trap = 0x001d07ff, -}.base; +}.base.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nva3.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nva3.c index f41b344ebb91cbd5032f544334383e764e1dafe4..8b52839ba80e7cebf5337e155acbdf551a881add 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nva3.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nva3.c @@ -26,12 +26,13 @@ struct nouveau_oclass * nva3_fb_oclass = &(struct nv50_fb_impl) { - .base.handle = NV_SUBDEV(FB, 0xa3), - .base.ofuncs = &(struct nouveau_ofuncs) { + .base.base.handle = NV_SUBDEV(FB, 0xa3), + .base.base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv50_fb_ctor, .dtor = nv50_fb_dtor, .init = nv50_fb_init, .fini = _nouveau_fb_fini, }, + .base.ram = &nv50_ram_oclass, .trap = 0x000d0fff, -}.base; +}.base.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nvaa.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nvaa.c index 79c1683e840ed3935bdcc1d06cdd0ebd7341689d..ce784ba9cbf4e14522ca48a7d78bb02dbfefef65 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nvaa.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nvaa.c @@ -26,12 +26,13 @@ struct nouveau_oclass * nvaa_fb_oclass = &(struct nv50_fb_impl) { - .base.handle = NV_SUBDEV(FB, 0xaa), - .base.ofuncs = &(struct nouveau_ofuncs) { + .base.base.handle = NV_SUBDEV(FB, 0xaa), + .base.base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv50_fb_ctor, .dtor = nv50_fb_dtor, .init = nv50_fb_init, .fini = _nouveau_fb_fini, }, + .base.ram = &nv50_ram_oclass, .trap = 0x001d07ff, -}.base; +}.base.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nvaf.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nvaf.c index d6dfd901e42da17fcd3f5dd33edeb0b65802ee19..aaa2e84732be758b70fda827f305eec36451e3ac 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nvaf.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nvaf.c @@ -26,12 +26,13 @@ struct nouveau_oclass * nvaf_fb_oclass = &(struct nv50_fb_impl) { - .base.handle = NV_SUBDEV(FB, 0xaf), - .base.ofuncs = &(struct nouveau_ofuncs) { + .base.base.handle = NV_SUBDEV(FB, 0xaf), + .base.base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nv50_fb_ctor, .dtor = nv50_fb_dtor, .init = nv50_fb_init, .fini = _nouveau_fb_fini, }, + .base.ram = &nv50_ram_oclass, .trap = 0x089d1fff, -}.base; +}.base.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c index 5dedce9c5183b778c53165ec2c072d51fec432c1..f10f3db17e23530a98a7c84cd3f9321f851bfdf1 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c @@ -78,7 +78,7 @@ nvc0_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nvc0_fb_priv *priv; int ret; - ret = nouveau_fb_create(parent, engine, oclass, &nvc0_ram_oclass, &priv); + ret = nouveau_fb_create(parent, engine, oclass, &priv); *pobject = nv_object(priv); if (ret) return ret; @@ -99,12 +99,13 @@ nvc0_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass * -nvc0_fb_oclass = &(struct nouveau_oclass) { - .handle = NV_SUBDEV(FB, 0xc0), - .ofuncs = &(struct nouveau_ofuncs) { +nvc0_fb_oclass = &(struct nouveau_fb_impl) { + .base.handle = NV_SUBDEV(FB, 0xc0), + .base.ofuncs = &(struct nouveau_ofuncs) { .ctor = nvc0_fb_ctor, .dtor = nvc0_fb_dtor, .init = nvc0_fb_init, .fini = _nouveau_fb_fini, }, -}; + .ram = &nvc0_ram_oclass, +}.base; diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h b/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h index db9d6ddde52c31cc7395de7cca70ceaf0671d015..af7ee02bb5e1596d72a57b938e968ef78d98c426 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h @@ -26,10 +26,12 @@ extern struct nouveau_oclass nv44_ram_oclass; extern struct nouveau_oclass nv49_ram_oclass; extern struct nouveau_oclass nv4e_ram_oclass; extern struct nouveau_oclass nv50_ram_oclass; +extern struct nouveau_oclass nva3_ram_oclass; +extern struct nouveau_oclass nvaa_ram_oclass; extern struct nouveau_oclass nvc0_ram_oclass; -#define nouveau_fb_create(p,e,c,r,d) \ - nouveau_fb_create_((p), (e), (c), (r), sizeof(**d), (void **)d) +#define nouveau_fb_create(p,e,c,d) \ + nouveau_fb_create_((p), (e), (c), sizeof(**d), (void **)d) #define nouveau_fb_destroy(p) ({ \ struct nouveau_fb *pfb = (p); \ _nouveau_fb_dtor(nv_object(pfb)); \ @@ -44,12 +46,16 @@ extern struct nouveau_oclass nvc0_ram_oclass; }) int nouveau_fb_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, struct nouveau_oclass *, - int length, void **pobject); + struct nouveau_oclass *, int, void **); void _nouveau_fb_dtor(struct nouveau_object *); int _nouveau_fb_init(struct nouveau_object *); int _nouveau_fb_fini(struct nouveau_object *, bool); +struct nouveau_fb_impl { + struct nouveau_oclass base; + struct nouveau_oclass *ram; +}; + struct nouveau_bios; int nouveau_fb_bios_memtype(struct nouveau_bios *);