Пример #1
0
void
nv50_dma_push(struct nouveau_channel *chan, struct nouveau_bo *bo,
              int delta, int length)
{
    struct nouveau_bo *pb = chan->push.buffer;
    struct nouveau_vma *vma;
    int ip = (chan->dma.ib_put * 2) + chan->dma.ib_base;
    u64 offset;

    vma = nouveau_bo_vma_find(bo, nv_client(chan->cli)->vm);
    BUG_ON(!vma);
    offset = vma->offset + delta;

    BUG_ON(chan->dma.ib_free < 1);

    nouveau_bo_wr32(pb, ip++, lower_32_bits(offset));
    nouveau_bo_wr32(pb, ip++, upper_32_bits(offset) | length << 8);

    chan->dma.ib_put = (chan->dma.ib_put + 1) & chan->dma.ib_max;

    mb();
    /* Flush writes. */
    nouveau_bo_rd32(pb, 0);

    nv_wo32(chan->object, 0x8c, chan->dma.ib_put);
    chan->dma.ib_free--;
}
Пример #2
0
static void
nvkm_client_fini(void *priv)
{
	struct nouveau_object *client = priv;
	nouveau_client_fini(nv_client(client), false);
	atomic_set(&client->refcount, 1);
	nouveau_object_ref(NULL, &client);
}
Пример #3
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);
}
Пример #4
0
int
nouveau_parent_sclass(struct nouveau_object *parent, u16 handle,
		      struct nouveau_object **pengine,
		      struct nouveau_oclass **poclass)
{
	struct nouveau_sclass *sclass;
	struct nouveau_engine *engine;
	struct nouveau_oclass *oclass;
	u64 mask;

	sclass = nv_parent(parent)->sclass;
	while (sclass) {
		if ((sclass->oclass->handle & 0xffff) == handle) {
			*pengine = parent->engine;
			*poclass = sclass->oclass;
			return 0;
		}

		sclass = sclass->sclass;
	}

	mask = nv_parent(parent)->engine;
	while (mask) {
		int i = __ffs64(mask);

		if (nv_iclass(parent, NV_CLIENT_CLASS))
			engine = nv_engine(nv_client(parent)->device);
		else
			engine = nouveau_engine(parent, i);

		if (engine) {
			oclass = engine->sclass;
			while (oclass->ofuncs) {
				if ((oclass->handle & 0xffff) == handle) {
					*pengine = nv_object(engine);
					*poclass = oclass;
					return 0;
				}
				oclass++;
			}
		}

		mask &= ~(1ULL << i);
	}

	return -EINVAL;
}
Пример #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);
}