drivers/gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.c
Extension
.c
Size
2142 bytes
Lines
68
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 nvkm_uvfn {
	struct nvkm_object object;
	struct nvkm_vfn *vfn;
};

static int
nvkm_uvfn_map(struct nvkm_object *object, void *argv, u32 argc,
	      enum nvkm_object_map *type, u64 *addr, u64 *size)
{
	struct nvkm_vfn *vfn = nvkm_uvfn(object)->vfn;
	struct nvkm_device *device = vfn->subdev.device;

	*addr = device->func->resource_addr(device, NVKM_BAR0_PRI) + vfn->addr.user;
	*size = vfn->func->user.size;
	*type = NVKM_OBJECT_MAP_IO;
	return 0;
}

static const struct nvkm_object_func
nvkm_uvfn = {
	.map = nvkm_uvfn_map,
};

int
nvkm_uvfn_new(struct nvkm_device *device, const struct nvkm_oclass *oclass,
	      void *argv, u32 argc, struct nvkm_object **pobject)
{
	struct nvkm_uvfn *uvfn;

	if (argc != 0)
		return -ENOSYS;

	if (!(uvfn = kzalloc_obj(*uvfn)))
		return -ENOMEM;

	nvkm_object_ctor(&nvkm_uvfn, oclass, &uvfn->object);
	uvfn->vfn = device->vfn;

	*pobject = &uvfn->object;
	return 0;
}

Annotation

Implementation Notes