drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c- Extension
.c- Size
- 4213 bytes
- Lines
- 125
- 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
priv.hsubdev/gsp.h
Detected Declarations
function filesfunction gk104_top_new
Annotated Snippet
if (!info) {
if (!(info = nvkm_top_device_new(top)))
return -ENOMEM;
type = ~0;
inst = 0;
}
data = nvkm_rd32(device, 0x022700 + (i * 0x04));
nvkm_trace(subdev, "%02x: %08x\n", i, data);
switch (data & 0x00000003) {
case 0x00000000: /* NOT_VALID */
continue;
case 0x00000001: /* DATA */
inst = (data & 0x3c000000) >> 26;
info->addr = (data & 0x00fff000);
if (data & 0x00000004)
info->fault = (data & 0x000003f8) >> 3;
break;
case 0x00000002: /* ENUM */
if (data & 0x00000020)
info->engine = (data & 0x3c000000) >> 26;
if (data & 0x00000010)
info->runlist = (data & 0x01e00000) >> 21;
if (data & 0x00000008)
info->intr = (data & 0x000f8000) >> 15;
if (data & 0x00000004)
info->reset = (data & 0x00003e00) >> 9;
break;
case 0x00000003: /* ENGINE_TYPE */
type = (data & 0x7ffffffc) >> 2;
break;
}
if (data & 0x80000000)
continue;
/* Translate engine type to NVKM engine identifier. */
#define I_(T,I) do { info->type = (T); info->inst = (I); } while(0)
#define O_(T,I) do { WARN_ON(inst); I_(T, I); } while (0)
switch (type) {
case 0x00000000: O_(NVKM_ENGINE_GR , 0); break;
case 0x00000001: O_(NVKM_ENGINE_CE , 0); break;
case 0x00000002: O_(NVKM_ENGINE_CE , 1); break;
case 0x00000003: O_(NVKM_ENGINE_CE , 2); break;
case 0x00000008: O_(NVKM_ENGINE_MSPDEC, 0); break;
case 0x00000009: O_(NVKM_ENGINE_MSPPP , 0); break;
case 0x0000000a: O_(NVKM_ENGINE_MSVLD , 0); break;
case 0x0000000b: O_(NVKM_ENGINE_MSENC , 0); break;
case 0x0000000c: O_(NVKM_ENGINE_VIC , 0); break;
case 0x0000000d: O_(NVKM_ENGINE_SEC2 , 0); break;
case 0x0000000e: I_(NVKM_ENGINE_NVENC , inst); break;
case 0x0000000f: O_(NVKM_ENGINE_NVENC , 1); break;
case 0x00000010: I_(NVKM_ENGINE_NVDEC , inst); break;
case 0x00000012: I_(NVKM_SUBDEV_IOCTRL, inst); break;
case 0x00000013: I_(NVKM_ENGINE_CE , inst); break;
case 0x00000014: O_(NVKM_SUBDEV_GSP , 0); break;
case 0x00000015: I_(NVKM_ENGINE_NVJPG , inst); break;
default:
break;
}
nvkm_debug(subdev, "%02x.%d (%8s): addr %06x fault %2d "
"engine %2d runlist %2d intr %2d "
"reset %2d\n", type, inst,
info->type == NVKM_SUBDEV_NR ? "????????" : nvkm_subdev_type[info->type],
info->addr, info->fault, info->engine, info->runlist,
info->intr, info->reset);
info = NULL;
}
return 0;
}
static const struct nvkm_top_func
gk104_top = {
.parse = gk104_top_parse,
};
int
gk104_top_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_top **ptop)
{
if (nvkm_gsp_rm(device->gsp))
return -ENODEV;
return nvkm_top_new_(&gk104_top, device, type, inst, ptop);
}
Annotation
- Immediate include surface: `priv.h`, `subdev/gsp.h`.
- Detected declarations: `function files`, `function gk104_top_new`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.