Commit 4a34fd0e authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/devinit: switch to instanced constructor

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 98fd7f83
...@@ -60,7 +60,6 @@ struct nvkm_device { ...@@ -60,7 +60,6 @@ struct nvkm_device {
struct notifier_block nb; struct notifier_block nb;
} acpi; } acpi;
struct nvkm_devinit *devinit;
struct nvkm_fault *fault; struct nvkm_fault *fault;
struct nvkm_fb *fb; struct nvkm_fb *fb;
struct nvkm_fuse *fuse; struct nvkm_fuse *fuse;
...@@ -143,7 +142,6 @@ struct nvkm_device_chip { ...@@ -143,7 +142,6 @@ struct nvkm_device_chip {
#include <core/layout.h> #include <core/layout.h>
#undef NVKM_LAYOUT_INST #undef NVKM_LAYOUT_INST
#undef NVKM_LAYOUT_ONCE #undef NVKM_LAYOUT_ONCE
int (*devinit )(struct nvkm_device *, int idx, struct nvkm_devinit **);
int (*fault )(struct nvkm_device *, int idx, struct nvkm_fault **); int (*fault )(struct nvkm_device *, int idx, struct nvkm_fault **);
int (*fb )(struct nvkm_device *, int idx, struct nvkm_fb **); int (*fb )(struct nvkm_device *, int idx, struct nvkm_fb **);
int (*fuse )(struct nvkm_device *, int idx, struct nvkm_fuse **); int (*fuse )(struct nvkm_device *, int idx, struct nvkm_fuse **);
......
/* SPDX-License-Identifier: MIT */ /* SPDX-License-Identifier: MIT */
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VBIOS , struct nvkm_bios , bios) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VBIOS , struct nvkm_bios , bios)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_DEVINIT , struct nvkm_devinit , devinit)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BUS , struct nvkm_bus , bus) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BUS , struct nvkm_bus , bus)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BAR , struct nvkm_bar , bar) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_BAR , struct nvkm_bar , bar)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_ACR , struct nvkm_acr , acr) NVKM_LAYOUT_ONCE(NVKM_SUBDEV_ACR , struct nvkm_acr , acr)
......
...@@ -17,20 +17,20 @@ void nvkm_devinit_meminit(struct nvkm_devinit *); ...@@ -17,20 +17,20 @@ void nvkm_devinit_meminit(struct nvkm_devinit *);
u64 nvkm_devinit_disable(struct nvkm_devinit *); u64 nvkm_devinit_disable(struct nvkm_devinit *);
int nvkm_devinit_post(struct nvkm_devinit *, u64 *disable); int nvkm_devinit_post(struct nvkm_devinit *, u64 *disable);
int nv04_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); int nv04_devinit_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
int nv05_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); int nv05_devinit_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
int nv10_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); int nv10_devinit_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
int nv1a_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); int nv1a_devinit_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
int nv20_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); int nv20_devinit_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
int nv50_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); int nv50_devinit_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
int g84_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); int g84_devinit_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
int g98_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); int g98_devinit_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
int gt215_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); int gt215_devinit_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
int mcp89_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); int mcp89_devinit_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
int gf100_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); int gf100_devinit_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
int gm107_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); int gm107_devinit_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
int gm200_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); int gm200_devinit_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
int gv100_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); int gv100_devinit_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
int tu102_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); int tu102_devinit_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
int ga100_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **); int ga100_devinit_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
#endif #endif
...@@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = { ...@@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = {
#include <core/layout.h> #include <core/layout.h>
#undef NVKM_LAYOUT_ONCE #undef NVKM_LAYOUT_ONCE
#undef NVKM_LAYOUT_INST #undef NVKM_LAYOUT_INST
[NVKM_SUBDEV_DEVINIT ] = "devinit",
[NVKM_SUBDEV_FAULT ] = "fault", [NVKM_SUBDEV_FAULT ] = "fault",
[NVKM_SUBDEV_FB ] = "fb", [NVKM_SUBDEV_FB ] = "fb",
[NVKM_SUBDEV_FUSE ] = "fuse", [NVKM_SUBDEV_FUSE ] = "fuse",
......
...@@ -126,11 +126,10 @@ nvkm_devinit = { ...@@ -126,11 +126,10 @@ nvkm_devinit = {
}; };
void void
nvkm_devinit_ctor(const struct nvkm_devinit_func *func, nvkm_devinit_ctor(const struct nvkm_devinit_func *func, struct nvkm_device *device,
struct nvkm_device *device, int index, enum nvkm_subdev_type type, int inst, struct nvkm_devinit *init)
struct nvkm_devinit *init)
{ {
nvkm_subdev_ctor(&nvkm_devinit, device, index, &init->subdev); nvkm_subdev_ctor(&nvkm_devinit, device, type, inst, &init->subdev);
init->func = func; init->func = func;
init->force_post = nvkm_boolopt(device->cfgopt, "NvForcePost", false); init->force_post = nvkm_boolopt(device->cfgopt, "NvForcePost", false);
} }
...@@ -61,8 +61,8 @@ g84_devinit = { ...@@ -61,8 +61,8 @@ g84_devinit = {
}; };
int int
g84_devinit_new(struct nvkm_device *device, int index, g84_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_devinit **pinit) struct nvkm_devinit **pinit)
{ {
return nv50_devinit_new_(&g84_devinit, device, index, pinit); return nv50_devinit_new_(&g84_devinit, device, type, inst, pinit);
} }
...@@ -60,8 +60,8 @@ g98_devinit = { ...@@ -60,8 +60,8 @@ g98_devinit = {
}; };
int int
g98_devinit_new(struct nvkm_device *device, int index, g98_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_devinit **pinit) struct nvkm_devinit **pinit)
{ {
return nv50_devinit_new_(&g98_devinit, device, index, pinit); return nv50_devinit_new_(&g98_devinit, device, type, inst, pinit);
} }
...@@ -70,7 +70,8 @@ ga100_devinit = { ...@@ -70,7 +70,8 @@ ga100_devinit = {
}; };
int int
ga100_devinit_new(struct nvkm_device *device, int index, struct nvkm_devinit **pinit) ga100_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_devinit **pinit)
{ {
return nv50_devinit_new_(&ga100_devinit, device, index, pinit); return nv50_devinit_new_(&ga100_devinit, device, type, inst, pinit);
} }
...@@ -114,8 +114,8 @@ gf100_devinit = { ...@@ -114,8 +114,8 @@ gf100_devinit = {
}; };
int int
gf100_devinit_new(struct nvkm_device *device, int index, gf100_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_devinit **pinit) struct nvkm_devinit **pinit)
{ {
return nv50_devinit_new_(&gf100_devinit, device, index, pinit); return nv50_devinit_new_(&gf100_devinit, device, type, inst, pinit);
} }
...@@ -54,8 +54,8 @@ gm107_devinit = { ...@@ -54,8 +54,8 @@ gm107_devinit = {
}; };
int int
gm107_devinit_new(struct nvkm_device *device, int index, gm107_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_devinit **pinit) struct nvkm_devinit **pinit)
{ {
return nv50_devinit_new_(&gm107_devinit, device, index, pinit); return nv50_devinit_new_(&gm107_devinit, device, type, inst, pinit);
} }
...@@ -179,8 +179,8 @@ gm200_devinit = { ...@@ -179,8 +179,8 @@ gm200_devinit = {
}; };
int int
gm200_devinit_new(struct nvkm_device *device, int index, gm200_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_devinit **pinit) struct nvkm_devinit **pinit)
{ {
return nv50_devinit_new_(&gm200_devinit, device, index, pinit); return nv50_devinit_new_(&gm200_devinit, device, type, inst, pinit);
} }
...@@ -146,8 +146,8 @@ gt215_devinit = { ...@@ -146,8 +146,8 @@ gt215_devinit = {
}; };
int int
gt215_devinit_new(struct nvkm_device *device, int index, gt215_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_devinit **pinit) struct nvkm_devinit **pinit)
{ {
return nv50_devinit_new_(&gt215_devinit, device, index, pinit); return nv50_devinit_new_(&gt215_devinit, device, type, inst, pinit);
} }
...@@ -72,8 +72,8 @@ gv100_devinit = { ...@@ -72,8 +72,8 @@ gv100_devinit = {
}; };
int int
gv100_devinit_new(struct nvkm_device *device, int index, gv100_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_devinit **pinit) struct nvkm_devinit **pinit)
{ {
return nv50_devinit_new_(&gv100_devinit, device, index, pinit); return nv50_devinit_new_(&gv100_devinit, device, type, inst, pinit);
} }
...@@ -61,8 +61,8 @@ mcp89_devinit = { ...@@ -61,8 +61,8 @@ mcp89_devinit = {
}; };
int int
mcp89_devinit_new(struct nvkm_device *device, int index, mcp89_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_devinit **pinit) struct nvkm_devinit **pinit)
{ {
return nv50_devinit_new_(&mcp89_devinit, device, index, pinit); return nv50_devinit_new_(&mcp89_devinit, device, type, inst, pinit);
} }
...@@ -434,9 +434,8 @@ nv04_devinit_dtor(struct nvkm_devinit *base) ...@@ -434,9 +434,8 @@ nv04_devinit_dtor(struct nvkm_devinit *base)
} }
int int
nv04_devinit_new_(const struct nvkm_devinit_func *func, nv04_devinit_new_(const struct nvkm_devinit_func *func, struct nvkm_device *device,
struct nvkm_device *device, int index, enum nvkm_subdev_type type, int inst, struct nvkm_devinit **pinit)
struct nvkm_devinit **pinit)
{ {
struct nv04_devinit *init; struct nv04_devinit *init;
...@@ -444,7 +443,7 @@ nv04_devinit_new_(const struct nvkm_devinit_func *func, ...@@ -444,7 +443,7 @@ nv04_devinit_new_(const struct nvkm_devinit_func *func,
return -ENOMEM; return -ENOMEM;
*pinit = &init->base; *pinit = &init->base;
nvkm_devinit_ctor(func, device, index, &init->base); nvkm_devinit_ctor(func, device, type, inst, &init->base);
init->owner = -1; init->owner = -1;
return 0; return 0;
} }
...@@ -459,8 +458,8 @@ nv04_devinit = { ...@@ -459,8 +458,8 @@ nv04_devinit = {
}; };
int int
nv04_devinit_new(struct nvkm_device *device, int index, nv04_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_devinit **pinit) struct nvkm_devinit **pinit)
{ {
return nv04_devinit_new_(&nv04_devinit, device, index, pinit); return nv04_devinit_new_(&nv04_devinit, device, type, inst, pinit);
} }
...@@ -11,7 +11,7 @@ struct nv04_devinit { ...@@ -11,7 +11,7 @@ struct nv04_devinit {
}; };
int nv04_devinit_new_(const struct nvkm_devinit_func *, struct nvkm_device *, int nv04_devinit_new_(const struct nvkm_devinit_func *, struct nvkm_device *,
int, struct nvkm_devinit **); enum nvkm_subdev_type, int, struct nvkm_devinit **);
void *nv04_devinit_dtor(struct nvkm_devinit *); void *nv04_devinit_dtor(struct nvkm_devinit *);
void nv04_devinit_preinit(struct nvkm_devinit *); void nv04_devinit_preinit(struct nvkm_devinit *);
void nv04_devinit_fini(struct nvkm_devinit *); void nv04_devinit_fini(struct nvkm_devinit *);
......
...@@ -136,8 +136,8 @@ nv05_devinit = { ...@@ -136,8 +136,8 @@ nv05_devinit = {
}; };
int int
nv05_devinit_new(struct nvkm_device *device, int index, nv05_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_devinit **pinit) struct nvkm_devinit **pinit)
{ {
return nv04_devinit_new_(&nv05_devinit, device, index, pinit); return nv04_devinit_new_(&nv05_devinit, device, type, inst, pinit);
} }
...@@ -106,8 +106,8 @@ nv10_devinit = { ...@@ -106,8 +106,8 @@ nv10_devinit = {
}; };
int int
nv10_devinit_new(struct nvkm_device *device, int index, nv10_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_devinit **pinit) struct nvkm_devinit **pinit)
{ {
return nv04_devinit_new_(&nv10_devinit, device, index, pinit); return nv04_devinit_new_(&nv10_devinit, device, type, inst, pinit);
} }
...@@ -35,8 +35,8 @@ nv1a_devinit = { ...@@ -35,8 +35,8 @@ nv1a_devinit = {
}; };
int int
nv1a_devinit_new(struct nvkm_device *device, int index, nv1a_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_devinit **pinit) struct nvkm_devinit **pinit)
{ {
return nv04_devinit_new_(&nv1a_devinit, device, index, pinit); return nv04_devinit_new_(&nv1a_devinit, device, type, inst, pinit);
} }
...@@ -72,8 +72,8 @@ nv20_devinit = { ...@@ -72,8 +72,8 @@ nv20_devinit = {
}; };
int int
nv20_devinit_new(struct nvkm_device *device, int index, nv20_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_devinit **pinit) struct nvkm_devinit **pinit)
{ {
return nv04_devinit_new_(&nv20_devinit, device, index, pinit); return nv04_devinit_new_(&nv20_devinit, device, type, inst, pinit);
} }
...@@ -148,9 +148,8 @@ nv50_devinit_init(struct nvkm_devinit *base) ...@@ -148,9 +148,8 @@ nv50_devinit_init(struct nvkm_devinit *base)
} }
int int
nv50_devinit_new_(const struct nvkm_devinit_func *func, nv50_devinit_new_(const struct nvkm_devinit_func *func, struct nvkm_device *device,
struct nvkm_device *device, int index, enum nvkm_subdev_type type, int inst, struct nvkm_devinit **pinit)
struct nvkm_devinit **pinit)
{ {
struct nv50_devinit *init; struct nv50_devinit *init;
...@@ -158,7 +157,7 @@ nv50_devinit_new_(const struct nvkm_devinit_func *func, ...@@ -158,7 +157,7 @@ nv50_devinit_new_(const struct nvkm_devinit_func *func,
return -ENOMEM; return -ENOMEM;
*pinit = &init->base; *pinit = &init->base;
nvkm_devinit_ctor(func, device, index, &init->base); nvkm_devinit_ctor(func, device, type, inst, &init->base);
return 0; return 0;
} }
...@@ -172,8 +171,8 @@ nv50_devinit = { ...@@ -172,8 +171,8 @@ nv50_devinit = {
}; };
int int
nv50_devinit_new(struct nvkm_device *device, int index, nv50_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_devinit **pinit) struct nvkm_devinit **pinit)
{ {
return nv50_devinit_new_(&nv50_devinit, device, index, pinit); return nv50_devinit_new_(&nv50_devinit, device, type, inst, pinit);
} }
...@@ -9,7 +9,7 @@ struct nv50_devinit { ...@@ -9,7 +9,7 @@ struct nv50_devinit {
u32 r001540; u32 r001540;
}; };
int nv50_devinit_new_(const struct nvkm_devinit_func *, struct nvkm_device *, int nv50_devinit_new_(const struct nvkm_devinit_func *, struct nvkm_device *, enum nvkm_subdev_type,
int, struct nvkm_devinit **); int, struct nvkm_devinit **);
void nv50_devinit_preinit(struct nvkm_devinit *); void nv50_devinit_preinit(struct nvkm_devinit *);
void nv50_devinit_init(struct nvkm_devinit *); void nv50_devinit_init(struct nvkm_devinit *);
......
...@@ -16,7 +16,7 @@ struct nvkm_devinit_func { ...@@ -16,7 +16,7 @@ struct nvkm_devinit_func {
}; };
void nvkm_devinit_ctor(const struct nvkm_devinit_func *, struct nvkm_device *, void nvkm_devinit_ctor(const struct nvkm_devinit_func *, struct nvkm_device *,
int index, struct nvkm_devinit *); enum nvkm_subdev_type, int inst, struct nvkm_devinit *);
int nv04_devinit_post(struct nvkm_devinit *, bool); int nv04_devinit_post(struct nvkm_devinit *, bool);
int tu102_devinit_post(struct nvkm_devinit *, bool); int tu102_devinit_post(struct nvkm_devinit *, bool);
......
...@@ -82,8 +82,8 @@ tu102_devinit = { ...@@ -82,8 +82,8 @@ tu102_devinit = {
}; };
int int
tu102_devinit_new(struct nvkm_device *device, int index, tu102_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_devinit **pinit) struct nvkm_devinit **pinit)
{ {
return nv50_devinit_new_(&tu102_devinit, device, index, pinit); return nv50_devinit_new_(&tu102_devinit, device, type, inst, pinit);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment