drivers/gpu/drm/nouveau/nvif/chan.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvif/chan.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvif/chan.c- Extension
.c- Size
- 3761 bytes
- Lines
- 160
- 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
nvif/chan.h
Detected Declarations
function Copyrightfunction nvif_chan_gpfifo_push_waitfunction nvif_chan_gpfifo_postfunction nvif_chan_gpfifo_pushfunction nvif_chan_gpfifo_waitfunction nvif_chan_gpfifo_ctorfunction nvif_chan_dma_wait
Annotated Snippet
if (chan->gpfifo.free < gpfifo_nr) {
if (!time--)
return -ETIMEDOUT;
udelay(1);
}
}
return 0;
}
void
nvif_chan_gpfifo_ctor(const struct nvif_chan_func *func, void *userd, void *gpfifo, u32 gpfifo_size,
void *push, u64 push_addr, u32 push_size, struct nvif_chan *chan)
{
chan->func = func;
chan->userd.map.ptr = userd;
chan->gpfifo.map.ptr = gpfifo;
chan->gpfifo.max = (gpfifo_size >> 3) - 1;
chan->gpfifo.free = chan->gpfifo.max;
chan->push.mem.object.map.ptr = push;
chan->push.wait = nvif_chan_gpfifo_push_wait;
chan->push.kick = nvif_chan_gpfifo_push_kick;
chan->push.addr = push_addr;
chan->push.hw.max = push_size >> 2;
chan->push.bgn = chan->push.cur = chan->push.end = push;
}
int
nvif_chan_dma_wait(struct nvif_chan *chan, u32 nr)
{
struct nvif_push *push = &chan->push;
u32 cur = push->cur - (u32 *)push->mem.object.map.ptr;
u32 free, time = 1000000;
nr += chan->func->gpfifo.post_size;
do {
u32 get = chan->func->push.read_get(chan);
if (get <= cur) {
free = push->hw.max - cur;
if (free >= nr)
break;
PUSH_KICK(push);
while (get == 0) {
get = chan->func->push.read_get(chan);
if (get == 0) {
if (!time--)
return -ETIMEDOUT;
udelay(1);
}
}
cur = 0;
}
free = get - cur - 1;
if (free < nr) {
if (!time--)
return -ETIMEDOUT;
udelay(1);
}
} while (free < nr);
push->bgn = (u32 *)push->mem.object.map.ptr + cur;
push->cur = push->bgn;
push->end = push->bgn + free - chan->func->gpfifo.post_size;
return 0;
}
Annotation
- Immediate include surface: `nvif/chan.h`.
- Detected declarations: `function Copyright`, `function nvif_chan_gpfifo_push_wait`, `function nvif_chan_gpfifo_post`, `function nvif_chan_gpfifo_push`, `function nvif_chan_gpfifo_wait`, `function nvif_chan_gpfifo_ctor`, `function nvif_chan_dma_wait`.
- 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.