drm/nouveau/vic: switch to instanced constructor
Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Reviewed-by: Lyude Paul <lyude@redhat.com>
This commit is contained in:
parent
8d6461d832
commit
0fa5680c28
|
@ -32,7 +32,6 @@ struct nvkm_device {
|
|||
|
||||
struct nvkm_event event;
|
||||
|
||||
u64 disable_mask;
|
||||
u32 debug;
|
||||
|
||||
const struct nvkm_device_chip *chip;
|
||||
|
@ -60,8 +59,6 @@ struct nvkm_device {
|
|||
struct notifier_block nb;
|
||||
} acpi;
|
||||
|
||||
struct nvkm_engine *vic;
|
||||
|
||||
#define NVKM_LAYOUT_ONCE(type,data,ptr) data *ptr;
|
||||
#define NVKM_LAYOUT_INST(type,data,ptr,cnt) data *ptr[cnt];
|
||||
#include <core/layout.h>
|
||||
|
@ -101,8 +98,6 @@ struct nvkm_device_chip {
|
|||
#include <core/layout.h>
|
||||
#undef NVKM_LAYOUT_INST
|
||||
#undef NVKM_LAYOUT_ONCE
|
||||
|
||||
int (*vic )(struct nvkm_device *, int idx, struct nvkm_engine **);
|
||||
};
|
||||
|
||||
struct nvkm_device *nvkm_device_find(u64 name);
|
||||
|
|
|
@ -45,4 +45,5 @@ NVKM_LAYOUT_ONCE(NVKM_ENGINE_PM , struct nvkm_pm , pm)
|
|||
NVKM_LAYOUT_ONCE(NVKM_ENGINE_SEC , struct nvkm_engine , sec)
|
||||
NVKM_LAYOUT_ONCE(NVKM_ENGINE_SEC2 , struct nvkm_sec2 , sec2)
|
||||
NVKM_LAYOUT_ONCE(NVKM_ENGINE_SW , struct nvkm_sw , sw)
|
||||
NVKM_LAYOUT_ONCE(NVKM_ENGINE_VIC , struct nvkm_engine , vic)
|
||||
NVKM_LAYOUT_ONCE(NVKM_ENGINE_VP , struct nvkm_engine , vp)
|
||||
|
|
|
@ -14,8 +14,7 @@ struct nvkm_devinit {
|
|||
u32 nvkm_devinit_mmio(struct nvkm_devinit *, u32 addr);
|
||||
int nvkm_devinit_pll_set(struct nvkm_devinit *, u32 type, u32 khz);
|
||||
void nvkm_devinit_meminit(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 *);
|
||||
|
||||
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 **);
|
||||
|
|
|
@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = {
|
|||
#include <core/layout.h>
|
||||
#undef NVKM_LAYOUT_ONCE
|
||||
#undef NVKM_LAYOUT_INST
|
||||
[NVKM_ENGINE_VIC ] = "vic",
|
||||
};
|
||||
|
||||
void
|
||||
|
|
|
@ -2644,9 +2644,6 @@ nvkm_device_subdev(struct nvkm_device *device, int type, int inst)
|
|||
{
|
||||
struct nvkm_subdev *subdev;
|
||||
|
||||
if (device->disable_mask & (1ULL << (type + inst)))
|
||||
return NULL;
|
||||
|
||||
list_for_each_entry(subdev, &device->subdev, head) {
|
||||
if (subdev->index == type + inst)
|
||||
return subdev;
|
||||
|
@ -2725,7 +2722,7 @@ nvkm_device_preinit(struct nvkm_device *device)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
ret = nvkm_devinit_post(device->devinit, &device->disable_mask);
|
||||
ret = nvkm_devinit_post(device->devinit);
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
|
@ -2790,7 +2787,6 @@ nvkm_device_del(struct nvkm_device **pdevice)
|
|||
struct nvkm_subdev *subdev, *subtmp;
|
||||
if (device) {
|
||||
mutex_lock(&nv_devices_mutex);
|
||||
device->disable_mask = 0;
|
||||
|
||||
list_for_each_entry_safe_reverse(subdev, subtmp, &device->subdev, head)
|
||||
nvkm_subdev_del(&subdev);
|
||||
|
@ -3104,21 +3100,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
|
|||
mutex_init(&device->mutex);
|
||||
|
||||
for (i = 0; i < NVKM_SUBDEV_NR; i++) {
|
||||
#define _(s,m) case s: \
|
||||
if (device->chip->m && (subdev_mask & (1ULL << (s)))) { \
|
||||
ret = device->chip->m(device, (s), &device->m); \
|
||||
if (ret) { \
|
||||
subdev = nvkm_device_subdev(device, (s), 0); \
|
||||
nvkm_subdev_del(&subdev); \
|
||||
device->m = NULL; \
|
||||
if (ret != -ENODEV) { \
|
||||
nvdev_error(device, "%s ctor failed, %d\n", \
|
||||
nvkm_subdev_type[(s)], ret); \
|
||||
goto done; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
break
|
||||
switch (i) {
|
||||
#define NVKM_LAYOUT_ONCE(type,data,ptr) case type: \
|
||||
if (device->chip->ptr.inst && (subdev_mask & (BIT_ULL(type)))) { \
|
||||
|
@ -3162,7 +3143,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
|
|||
#include <core/layout.h>
|
||||
#undef NVKM_LAYOUT_INST
|
||||
#undef NVKM_LAYOUT_ONCE
|
||||
_(NVKM_ENGINE_VIC , vic);
|
||||
case NVKM_ENGINE_CE1:
|
||||
case NVKM_ENGINE_CE2:
|
||||
case NVKM_ENGINE_CE3:
|
||||
|
@ -3180,7 +3160,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
|
|||
WARN_ON(1);
|
||||
continue;
|
||||
}
|
||||
#undef _
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
|
|
@ -56,12 +56,12 @@ nvkm_devinit_disable(struct nvkm_devinit *init)
|
|||
}
|
||||
|
||||
int
|
||||
nvkm_devinit_post(struct nvkm_devinit *init, u64 *disable)
|
||||
nvkm_devinit_post(struct nvkm_devinit *init)
|
||||
{
|
||||
int ret = 0;
|
||||
if (init && init->func->post)
|
||||
ret = init->func->post(init, init->post);
|
||||
*disable = nvkm_devinit_disable(init);
|
||||
nvkm_devinit_disable(init);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ mcp89_devinit_disable(struct nvkm_devinit *init)
|
|||
if (!(r00154c & 0x00000020))
|
||||
nvkm_subdev_disable(device, NVKM_ENGINE_MSVLD, 0);
|
||||
if (!(r00154c & 0x00000040))
|
||||
disable |= (1ULL << NVKM_ENGINE_VIC);
|
||||
nvkm_subdev_disable(device, NVKM_ENGINE_VIC, 0);
|
||||
if (!(r00154c & 0x00000200))
|
||||
nvkm_subdev_disable(device, NVKM_ENGINE_CE, 0);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ struct nvkm_devinit_func {
|
|||
|
||||
void nvkm_devinit_ctor(const struct nvkm_devinit_func *, struct nvkm_device *,
|
||||
enum nvkm_subdev_type, int inst, struct nvkm_devinit *);
|
||||
u64 nvkm_devinit_disable(struct nvkm_devinit *);
|
||||
|
||||
int nv04_devinit_post(struct nvkm_devinit *, bool);
|
||||
int tu102_devinit_post(struct nvkm_devinit *, bool);
|
||||
|
|
Loading…
Reference in New Issue