| 1591 | } |
| 1592 | |
| 1593 | static void |
| 1594 | its_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 | |
| 1631 | static struct its_cmd * |
| 1632 | its_cmd_alloc_locked(device_t dev) |
no test coverage detected