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

Function its_cmd_wait_completion

freebsd/arm64/arm64/gicv3_its.c:1593–1629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1591}
1592
1593static void
1594its_cmd_wait_completion(device_t dev, struct its_cmd *cmd_first,
1595 struct its_cmd *cmd_last)
1596{
1597 struct gicv3_its_softc *sc;
1598 uint64_t first, last, read;
1599 size_t us_left;
1600
1601 sc = device_get_softc(dev);
1602
1603 /*
1604 * XXX ARM64TODO: This is obviously a significant delay.
1605 * The reason for that is that currently the time frames for
1606 * the command to complete are not known.
1607 */
1608 us_left = 1000000;
1609
1610 first = its_cmd_cwriter_offset(sc, cmd_first);
1611 last = its_cmd_cwriter_offset(sc, cmd_last);
1612
1613 for (;;) {
1614 read = gic_its_read_8(sc, GITS_CREADR);
1615 if (first < last) {
1616 if (read < first || read >= last)
1617 break;
1618 } else if (read < first && read >= last)
1619 break;
1620
1621 if (us_left-- == 0) {
1622 /* This means timeout */
1623 device_printf(dev,
1624 "Timeout while waiting for CMD completion.\n");
1625 return;
1626 }
1627 DELAY(1);
1628 }
1629}
1630
1631static struct its_cmd *
1632its_cmd_alloc_locked(device_t dev)

Callers 1

its_cmd_sendFunction · 0.85

Calls 4

device_get_softcFunction · 0.85
its_cmd_cwriter_offsetFunction · 0.85
device_printfFunction · 0.85
DELAYFunction · 0.50

Tested by

no test coverage detected