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

Function its_cmd_alloc_locked

freebsd/arm64/arm64/gicv3_its.c:1631–1664  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1629}
1630
1631static struct its_cmd *
1632its_cmd_alloc_locked(device_t dev)
1633{
1634 struct gicv3_its_softc *sc;
1635 struct its_cmd *cmd;
1636 size_t us_left;
1637
1638 sc = device_get_softc(dev);
1639
1640 /*
1641 * XXX ARM64TODO: This is obviously a significant delay.
1642 * The reason for that is that currently the time frames for
1643 * the command to complete (and therefore free the descriptor)
1644 * are not known.
1645 */
1646 us_left = 1000000;
1647
1648 mtx_assert(&sc->sc_its_cmd_lock, MA_OWNED);
1649 while (its_cmd_queue_full(sc)) {
1650 if (us_left-- == 0) {
1651 /* Timeout while waiting for free command */
1652 device_printf(dev,
1653 "Timeout while waiting for free command\n");
1654 return (NULL);
1655 }
1656 DELAY(1);
1657 }
1658
1659 cmd = &sc->sc_its_cmd_base[sc->sc_its_cmd_next_idx];
1660 sc->sc_its_cmd_next_idx++;
1661 sc->sc_its_cmd_next_idx %= ITS_CMDQ_SIZE / sizeof(struct its_cmd);
1662
1663 return (cmd);
1664}
1665
1666static uint64_t
1667its_cmd_prepare(struct its_cmd *cmd, struct its_cmd_desc *desc)

Callers 1

its_cmd_sendFunction · 0.85

Calls 5

device_get_softcFunction · 0.85
mtx_assertFunction · 0.85
its_cmd_queue_fullFunction · 0.85
device_printfFunction · 0.85
DELAYFunction · 0.50

Tested by

no test coverage detected