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 {
struct notifier_block nb;
} acpi;
struct nvkm_devinit *devinit;
struct nvkm_fault *fault;
struct nvkm_fb *fb;
struct nvkm_fuse *fuse;
......@@ -143,7 +142,6 @@ struct nvkm_device_chip {
#include <core/layout.h>
#undef NVKM_LAYOUT_INST
#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 (*fb )(struct nvkm_device *, int idx, struct nvkm_fb **);
int (*fuse )(struct nvkm_device *, int idx, struct nvkm_fuse **);
......
/* SPDX-License-Identifier: MIT */
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_BAR , struct nvkm_bar , bar)
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_ACR , struct nvkm_acr , acr)
......
......@@ -17,20 +17,20 @@ void nvkm_devinit_meminit(struct nvkm_devinit *);
u64 nvkm_devinit_disable(struct nvkm_devinit *);
int nvkm_devinit_post(struct nvkm_devinit *, u64 *disable);
int nv04_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int nv05_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int nv10_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int nv1a_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int nv20_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int nv50_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int g84_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int g98_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int gt215_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int mcp89_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int gf100_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int gm107_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int gm200_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int gv100_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int tu102_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int ga100_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 *, enum nvkm_subdev_type, 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 *, enum nvkm_subdev_type, 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 *, enum nvkm_subdev_type, 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 *, enum nvkm_subdev_type, 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 *, enum nvkm_subdev_type, 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 *, enum nvkm_subdev_type, 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 *, enum nvkm_subdev_type, 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 *, enum nvkm_subdev_type, int, struct nvkm_devinit **);
#endif
......@@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = {
#include <core/layout.h>
#undef NVKM_LAYOUT_ONCE
#undef NVKM_LAYOUT_INST
[NVKM_SUBDEV_DEVINIT ] = "devinit",
[NVKM_SUBDEV_FAULT ] = "fault",
[NVKM_SUBDEV_FB ] = "fb",
[NVKM_SUBDEV_FUSE ] = "fuse",
......
......@@ -126,11 +126,10 @@ nvkm_devinit = {
};
void
nvkm_devinit_ctor(const struct nvkm_devinit_func *func,
struct nvkm_device *device, int index,
struct nvkm_devinit *init)
nvkm_devinit_ctor(const struct nvkm_devinit_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, 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->force_post = nvkm_boolopt(device->cfgopt, "NvForcePost", false);
}
......@@ -61,8 +61,8 @@ g84_devinit = {
};
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)
{
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 = {
};
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)
{
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 = {
};
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 = {
};
int
gf100_devinit_new(struct nvkm_device *device, int index,
struct nvkm_devinit **pinit)
gf100_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
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 = {
};
int
gm107_devinit_new(struct nvkm_device *device, int index,
struct nvkm_devinit **pinit)
gm107_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
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 = {
};
int
gm200_devinit_new(struct nvkm_device *device, int index,
struct nvkm_devinit **pinit)
gm200_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
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 = {
};
int
gt215_devinit_new(struct nvkm_device *device, int index,
struct nvkm_devinit **pinit)
gt215_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
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 = {
};
int
gv100_devinit_new(struct nvkm_device *device, int index,
struct nvkm_devinit **pinit)
gv100_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
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 = {
};
int
mcp89_devinit_new(struct nvkm_device *device, int index,
struct nvkm_devinit **pinit)
mcp89_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
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)
}
int
nv04_devinit_new_(const struct nvkm_devinit_func *func,
struct nvkm_device *device, int index,
struct nvkm_devinit **pinit)
nv04_devinit_new_(const struct nvkm_devinit_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_devinit **pinit)
{
struct nv04_devinit *init;
......@@ -444,7 +443,7 @@ nv04_devinit_new_(const struct nvkm_devinit_func *func,
return -ENOMEM;
*pinit = &init->base;
nvkm_devinit_ctor(func, device, index, &init->base);
nvkm_devinit_ctor(func, device, type, inst, &init->base);
init->owner = -1;
return 0;
}
......@@ -459,8 +458,8 @@ nv04_devinit = {
};
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)
{
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 {
};
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_preinit(struct nvkm_devinit *);
void nv04_devinit_fini(struct nvkm_devinit *);
......
......@@ -136,8 +136,8 @@ nv05_devinit = {
};
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)
{
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 = {
};
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)
{
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 = {
};
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)
{
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 = {
};
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)
{
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)
}
int
nv50_devinit_new_(const struct nvkm_devinit_func *func,
struct nvkm_device *device, int index,
struct nvkm_devinit **pinit)
nv50_devinit_new_(const struct nvkm_devinit_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_devinit **pinit)
{
struct nv50_devinit *init;
......@@ -158,7 +157,7 @@ nv50_devinit_new_(const struct nvkm_devinit_func *func,
return -ENOMEM;
*pinit = &init->base;
nvkm_devinit_ctor(func, device, index, &init->base);
nvkm_devinit_ctor(func, device, type, inst, &init->base);
return 0;
}
......@@ -172,8 +171,8 @@ nv50_devinit = {
};
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)
{
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 {
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 **);
void nv50_devinit_preinit(struct nvkm_devinit *);
void nv50_devinit_init(struct nvkm_devinit *);
......
......@@ -16,7 +16,7 @@ struct nvkm_devinit_func {
};
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 tu102_devinit_post(struct nvkm_devinit *, bool);
......
......@@ -82,8 +82,8 @@ tu102_devinit = {
};
int
tu102_devinit_new(struct nvkm_device *device, int index,
struct nvkm_devinit **pinit)
tu102_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
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