drivers/gpu/drm/nouveau/nouveau_abi16.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nouveau_abi16.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/nouveau/nouveau_abi16.c
Extension
.c
Size
23776 bytes
Lines
920
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct nouveau_abi16_obj {
	enum nouveau_abi16_obj_type {
		DEVICE,
		ENGOBJ,
	} type;
	u64 object;

	struct nvif_object engobj;

	struct list_head head; /* protected by nouveau_abi16.cli.mutex */
};

static struct nouveau_abi16_obj *
nouveau_abi16_obj_find(struct nouveau_abi16 *abi16, u64 object)
{
	struct nouveau_abi16_obj *obj;

	list_for_each_entry(obj, &abi16->objects, head) {
		if (obj->object == object)
			return obj;
	}

	return NULL;
}

static void
nouveau_abi16_obj_del(struct nouveau_abi16_obj *obj)
{
	list_del(&obj->head);
	kfree(obj);
}

static struct nouveau_abi16_obj *
nouveau_abi16_obj_new(struct nouveau_abi16 *abi16, enum nouveau_abi16_obj_type type, u64 object)
{
	struct nouveau_abi16_obj *obj;

	obj = nouveau_abi16_obj_find(abi16, object);
	if (obj)
		return ERR_PTR(-EEXIST);

	obj = kzalloc_obj(*obj);
	if (!obj)
		return ERR_PTR(-ENOMEM);

	obj->type = type;
	obj->object = object;
	list_add_tail(&obj->head, &abi16->objects);
	return obj;
}

s32
nouveau_abi16_swclass(struct nouveau_drm *drm)
{
	switch (drm->client.device.info.family) {
	case NV_DEVICE_INFO_V0_TNT:
		return NVIF_CLASS_SW_NV04;
	case NV_DEVICE_INFO_V0_CELSIUS:
	case NV_DEVICE_INFO_V0_KELVIN:
	case NV_DEVICE_INFO_V0_RANKINE:
	case NV_DEVICE_INFO_V0_CURIE:
		return NVIF_CLASS_SW_NV10;
	case NV_DEVICE_INFO_V0_TESLA:
		return NVIF_CLASS_SW_NV50;
	case NV_DEVICE_INFO_V0_FERMI:
	case NV_DEVICE_INFO_V0_KEPLER:
	case NV_DEVICE_INFO_V0_MAXWELL:
	case NV_DEVICE_INFO_V0_PASCAL:
	case NV_DEVICE_INFO_V0_VOLTA:
		return NVIF_CLASS_SW_GF100;
	}

	return 0x0000;
}

static void
nouveau_abi16_ntfy_fini(struct nouveau_abi16_chan *chan,
			struct nouveau_abi16_ntfy *ntfy)
{
	nvif_object_dtor(&ntfy->object);
	nvkm_mm_free(&chan->heap, &ntfy->node);
	list_del(&ntfy->head);
	kfree(ntfy);
}

static void
nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16,
			struct nouveau_abi16_chan *chan)
{
	struct nouveau_abi16_ntfy *ntfy, *temp;

Annotation

Implementation Notes