| 307 | } |
| 308 | |
| 309 | static int |
| 310 | smmu_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 | |
| 336 | static int |
| 337 | smmu_init_queues(struct smmu_softc *sc) |
no test coverage detected