drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c- Extension
.c- Size
- 4038 bytes
- Lines
- 148
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
priv.hcore/option.hsubdev/top.h
Detected Declarations
function filesfunction nvkm_mc_intr_maskfunction nvkm_mc_reset_maskfunction nvkm_mc_resetfunction nvkm_mc_disablefunction nvkm_mc_enablefunction nvkm_mc_enabledfunction nvkm_mc_initfunction nvkm_mc_dtorfunction nvkm_mc_new_
Annotated Snippet
if (!(pmc_enable = nvkm_top_reset(device, type, inst))) {
for (map = mc->func->reset; map && map->stat; map++) {
if (!isauto || !map->noauto) {
if (map->type == type && map->inst == inst) {
pmc_enable = map->stat;
break;
}
}
}
}
}
return pmc_enable;
}
void
nvkm_mc_reset(struct nvkm_device *device, enum nvkm_subdev_type type, int inst)
{
u64 pmc_enable = nvkm_mc_reset_mask(device, true, type, inst);
if (pmc_enable) {
device->mc->func->device->disable(device->mc, pmc_enable);
device->mc->func->device->enable(device->mc, pmc_enable);
}
}
void
nvkm_mc_disable(struct nvkm_device *device, enum nvkm_subdev_type type, int inst)
{
u64 pmc_enable = nvkm_mc_reset_mask(device, false, type, inst);
if (pmc_enable)
device->mc->func->device->disable(device->mc, pmc_enable);
}
void
nvkm_mc_enable(struct nvkm_device *device, enum nvkm_subdev_type type, int inst)
{
u64 pmc_enable = nvkm_mc_reset_mask(device, false, type, inst);
if (pmc_enable)
device->mc->func->device->enable(device->mc, pmc_enable);
}
bool
nvkm_mc_enabled(struct nvkm_device *device, enum nvkm_subdev_type type, int inst)
{
u64 pmc_enable = nvkm_mc_reset_mask(device, false, type, inst);
return (pmc_enable != 0) && device->mc->func->device->enabled(device->mc, pmc_enable);
}
static int
nvkm_mc_init(struct nvkm_subdev *subdev)
{
struct nvkm_mc *mc = nvkm_mc(subdev);
if (mc->func->init)
mc->func->init(mc);
return 0;
}
static void *
nvkm_mc_dtor(struct nvkm_subdev *subdev)
{
return nvkm_mc(subdev);
}
static const struct nvkm_subdev_func
nvkm_mc = {
.dtor = nvkm_mc_dtor,
.init = nvkm_mc_init,
};
int
nvkm_mc_new_(const struct nvkm_mc_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_mc **pmc)
{
struct nvkm_mc *mc;
int ret;
if (!(mc = *pmc = kzalloc_obj(*mc)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_mc, device, type, inst, &mc->subdev);
mc->func = func;
if (mc->func->intr) {
ret = nvkm_intr_add(mc->func->intr, mc->func->intrs, &mc->subdev,
mc->func->intr_nonstall ? 2 : 1, &mc->intr);
if (ret)
return ret;
}
return 0;
Annotation
- Immediate include surface: `priv.h`, `core/option.h`, `subdev/top.h`.
- Detected declarations: `function files`, `function nvkm_mc_intr_mask`, `function nvkm_mc_reset_mask`, `function nvkm_mc_reset`, `function nvkm_mc_disable`, `function nvkm_mc_enable`, `function nvkm_mc_enabled`, `function nvkm_mc_init`, `function nvkm_mc_dtor`, `function nvkm_mc_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.