Ejemplo n.º 1
0
static int
nouveau_fifo_chid(struct nouveau_fifo *priv, struct nouveau_object *object)
{
	int engidx = nv_hclass(priv) & 0xff;

	while (object && object->parent) {
		if ( nv_iclass(object->parent, NV_ENGCTX_CLASS) &&
		    (nv_hclass(object->parent) & 0xff) == engidx)
			return nouveau_fifo_chan(object)->chid;
		object = object->parent;
	}

	return -1;
}
Ejemplo n.º 2
0
void
nouveau_subdev_destroy(struct nouveau_subdev *subdev)
{
	int subidx = nv_hclass(subdev) & 0xff;
	nv_device(subdev)->subdev[subidx] = NULL;
	nouveau_object_destroy(&subdev->base);
}
Ejemplo n.º 3
0
int
nouveau_subdev_create_(struct nouveau_object *parent,
		       struct nouveau_object *engine,
		       struct nouveau_oclass *oclass, u32 pclass,
		       const char *subname, const char *sysname,
		       int size, void **pobject)
{
	struct nouveau_subdev *subdev;
	int ret;

	ret = nouveau_object_create_(parent, engine, oclass, pclass |
				     NV_SUBDEV_CLASS, size, pobject);
	subdev = *pobject;
	if (ret)
		return ret;

	__mutex_init(&subdev->mutex, subname, &oclass->lock_class_key);
	subdev->name = subname;

	if (parent) {
		struct nouveau_device *device = nv_device(parent);
		int subidx = nv_hclass(subdev) & 0xff;

		subdev->debug = nouveau_dbgopt(device->dbgopt, subname);
		subdev->mmio  = nv_subdev(device)->mmio;
		device->subdev[subidx] = *pobject;
	}

	return 0;
}
Ejemplo n.º 4
0
void
nv_printk_(struct nouveau_object *object, const char *pfx, int level,
	   const char *fmt, ...)
{
	static const char name[] = { '!', 'E', 'W', ' ', 'D', 'T', 'P', 'S' };
	char mfmt[256];
	va_list args;

	if (object && !nv_iclass(object, NV_CLIENT_CLASS)) {
		struct nouveau_object *device = object;
		struct nouveau_object *subdev = object;
		char obuf[64], *ofmt = "";

		if (object->engine) {
			snprintf(obuf, sizeof(obuf), "[0x%08x][%p]",
				 nv_hclass(object), object);
			ofmt = obuf;
			subdev = object->engine;
			device = object->engine;
		}

		if (subdev->parent)
			device = subdev->parent;

		if (level > nv_subdev(subdev)->debug)
			return;

		snprintf(mfmt, sizeof(mfmt), "%snouveau %c[%8s][%s]%s %s", pfx,
			 name[level], nv_subdev(subdev)->name,
			 nv_device(device)->name, ofmt, fmt);
	} else
	if (object && nv_iclass(object, NV_CLIENT_CLASS)) {
		if (level > nv_client(object)->debug)
			return;

		snprintf(mfmt, sizeof(mfmt), "%snouveau %c[%8s] %s", pfx,
			 name[level], nv_client(object)->name, fmt);
	} else {
		snprintf(mfmt, sizeof(mfmt), "%snouveau: %s", pfx, fmt);
	}

	va_start(args, fmt);
	vprintk(mfmt, args);
	va_end(args);
}
Ejemplo n.º 5
0
void
nv_printk_(struct nvkm_object *object, int level, const char *fmt, ...)
{
    static const char name[] = { '!', 'E', 'W', ' ', 'D', 'T', 'P', 'S' };
    const char *pfx;
    char mfmt[256];
    va_list args;

    switch (level) {
    case NV_DBG_FATAL:
        pfx = KERN_CRIT;
        break;
    case NV_DBG_ERROR:
        pfx = KERN_ERR;
        break;
    case NV_DBG_WARN:
        pfx = KERN_WARNING;
        break;
    case NV_DBG_INFO_NORMAL:
        pfx = KERN_INFO;
        break;
    case NV_DBG_DEBUG:
    case NV_DBG_PARANOIA:
    case NV_DBG_TRACE:
    case NV_DBG_SPAM:
    default:
        pfx = KERN_DEBUG;
        break;
    }

    if (object && !nv_iclass(object, NV_CLIENT_CLASS)) {
        struct nvkm_object *device;
        struct nvkm_object *subdev;
        char obuf[64], *ofmt = "";

        if (object->engine == NULL) {
            subdev = object;
            while (subdev && !nv_iclass(subdev, NV_SUBDEV_CLASS))
                subdev = subdev->parent;
        } else {
            subdev = &object->engine->subdev.object;
        }

        device = subdev;
        if (device->parent)
            device = device->parent;

        if (object != subdev) {
            snprintf(obuf, sizeof(obuf), "[0x%08x]",
                     nv_hclass(object));
            ofmt = obuf;
        }

        if (level > nv_subdev(subdev)->debug)
            return;

        snprintf(mfmt, sizeof(mfmt), "%snouveau %c[%8s][%s]%s %s", pfx,
                 name[level], nv_subdev(subdev)->name,
                 nv_device(device)->name, ofmt, fmt);
    } else if (object && nv_iclass(object, NV_CLIENT_CLASS)) {
        if (level > nv_client(object)->debug)
            return;

        snprintf(mfmt, sizeof(mfmt), "%snouveau %c[%8s] %s", pfx,
                 name[level], nv_client(object)->name, fmt);
    } else {
        snprintf(mfmt, sizeof(mfmt), "%snouveau: %s", pfx, fmt);
    }

    va_start(args, fmt);
    vprintk(mfmt, args);
    va_end(args);
}