drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c- Extension
.c- Size
- 3698 bytes
- Lines
- 151
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
priv.h
Detected Declarations
function filesfunction nvkm_bar_bar1_vmmfunction nvkm_bar_bar1_resetfunction nvkm_bar_bar2_vmmfunction nvkm_bar_bar2_resetfunction nvkm_bar_bar2_finifunction nvkm_bar_bar2_initfunction nvkm_bar_finifunction nvkm_bar_initfunction nvkm_bar_oneinitfunction nvkm_bar_dtorfunction nvkm_bar_ctor
Annotated Snippet
#include "priv.h"
void
nvkm_bar_flush(struct nvkm_bar *bar)
{
if (bar && bar->func->flush)
bar->func->flush(bar);
}
struct nvkm_vmm *
nvkm_bar_bar1_vmm(struct nvkm_device *device)
{
return device->bar->func->bar1.vmm(device->bar);
}
void
nvkm_bar_bar1_reset(struct nvkm_device *device)
{
struct nvkm_bar *bar = device->bar;
if (bar) {
bar->func->bar1.init(bar);
bar->func->bar1.wait(bar);
}
}
struct nvkm_vmm *
nvkm_bar_bar2_vmm(struct nvkm_device *device)
{
/* Denies access to BAR2 when it's not initialised, used by INSTMEM
* to know when object access needs to go through the BAR0 window.
*/
struct nvkm_bar *bar = device->bar;
if (bar && bar->bar2)
return bar->func->bar2.vmm(bar);
return NULL;
}
void
nvkm_bar_bar2_reset(struct nvkm_device *device)
{
struct nvkm_bar *bar = device->bar;
if (bar && bar->bar2) {
bar->func->bar2.init(bar);
bar->func->bar2.wait(bar);
}
}
void
nvkm_bar_bar2_fini(struct nvkm_device *device)
{
struct nvkm_bar *bar = device->bar;
if (bar && bar->bar2) {
bar->func->bar2.fini(bar);
bar->bar2 = false;
}
}
void
nvkm_bar_bar2_init(struct nvkm_device *device)
{
struct nvkm_bar *bar = device->bar;
if (bar && bar->subdev.oneinit && !bar->bar2 && bar->func->bar2.init) {
bar->func->bar2.init(bar);
bar->func->bar2.wait(bar);
bar->bar2 = true;
}
}
static int
nvkm_bar_fini(struct nvkm_subdev *subdev, enum nvkm_suspend_state suspend)
{
struct nvkm_bar *bar = nvkm_bar(subdev);
if (!subdev->use.enabled)
return 0;
if (bar->func->bar1.fini)
bar->func->bar1.fini(bar);
if (!suspend) /* Handled by instmem. */
nvkm_bar_bar2_fini(subdev->device);
return 0;
}
static int
nvkm_bar_init(struct nvkm_subdev *subdev)
{
struct nvkm_bar *bar = nvkm_bar(subdev);
bar->func->bar1.init(bar);
Annotation
- Immediate include surface: `priv.h`.
- Detected declarations: `function files`, `function nvkm_bar_bar1_vmm`, `function nvkm_bar_bar1_reset`, `function nvkm_bar_bar2_vmm`, `function nvkm_bar_bar2_reset`, `function nvkm_bar_bar2_fini`, `function nvkm_bar_bar2_init`, `function nvkm_bar_fini`, `function nvkm_bar_init`, `function nvkm_bar_oneinit`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.