MCPcopy Create free account
hub / github.com/F-Stack/f-stack / smmu_init_queue

Function smmu_init_queue

freebsd/arm64/iommu/smmu.c:309–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309static int
310smmu_init_queue(struct smmu_softc *sc, struct smmu_queue *q,
311 uint32_t prod_off, uint32_t cons_off, uint32_t dwords)
312{
313 int sz;
314
315 sz = (1 << q->size_log2) * dwords * 8;
316
317 /* Set up the command circular buffer */
318 q->vaddr = contigmalloc(sz, M_SMMU,
319 M_WAITOK | M_ZERO, 0, (1ul << 48) - 1, SMMU_Q_ALIGN, 0);
320 if (q->vaddr == NULL) {
321 device_printf(sc->dev, "failed to allocate %d bytes\n", sz);
322 return (-1);
323 }
324
325 q->prod_off = prod_off;
326 q->cons_off = cons_off;
327 q->paddr = vtophys(q->vaddr);
328
329 q->base = CMDQ_BASE_RA | EVENTQ_BASE_WA | PRIQ_BASE_WA;
330 q->base |= q->paddr & Q_BASE_ADDR_M;
331 q->base |= q->size_log2 << Q_LOG2SIZE_S;
332
333 return (0);
334}
335
336static int
337smmu_init_queues(struct smmu_softc *sc)

Callers 1

smmu_init_queuesFunction · 0.85

Calls 2

contigmallocFunction · 0.85
device_printfFunction · 0.85

Tested by

no test coverage detected