Changeset View
Changeset View
Standalone View
Standalone View
head/sys/arm64/arm64/gic_v3_its.c
Show First 20 Lines • Show All 1,305 Lines • ▼ Show 20 Lines | for (;;) { | ||||
} | } | ||||
DELAY(1); | DELAY(1); | ||||
} | } | ||||
} | } | ||||
static int | static int | ||||
its_cmd_send(struct gic_v3_its_softc *sc, struct its_cmd_desc *desc) | its_cmd_send(struct gic_v3_its_softc *sc, struct its_cmd_desc *desc) | ||||
{ | { | ||||
struct its_cmd *cmd, *cmd_sync; | struct its_cmd *cmd, *cmd_sync, *cmd_write; | ||||
struct its_col col_sync; | struct its_col col_sync; | ||||
struct its_cmd_desc desc_sync; | struct its_cmd_desc desc_sync; | ||||
uint64_t target, cwriter; | uint64_t target, cwriter; | ||||
mtx_lock_spin(&sc->its_spin_mtx); | mtx_lock_spin(&sc->its_spin_mtx); | ||||
cmd = its_cmd_alloc_locked(sc); | cmd = its_cmd_alloc_locked(sc); | ||||
mtx_unlock_spin(&sc->its_spin_mtx); | |||||
if (cmd == NULL) { | if (cmd == NULL) { | ||||
device_printf(sc->dev, "could not allocate ITS command\n"); | device_printf(sc->dev, "could not allocate ITS command\n"); | ||||
mtx_unlock_spin(&sc->its_spin_mtx); | |||||
return (EBUSY); | return (EBUSY); | ||||
} | } | ||||
target = its_cmd_prepare(cmd, desc); | target = its_cmd_prepare(cmd, desc); | ||||
its_cmd_sync(sc, cmd); | its_cmd_sync(sc, cmd); | ||||
if (target != ITS_TARGET_NONE) { | if (target != ITS_TARGET_NONE) { | ||||
mtx_lock_spin(&sc->its_spin_mtx); | |||||
cmd_sync = its_cmd_alloc_locked(sc); | cmd_sync = its_cmd_alloc_locked(sc); | ||||
mtx_unlock_spin(&sc->its_spin_mtx); | |||||
if (cmd_sync == NULL) | if (cmd_sync == NULL) | ||||
goto end; | goto end; | ||||
desc_sync.cmd_type = ITS_CMD_SYNC; | desc_sync.cmd_type = ITS_CMD_SYNC; | ||||
col_sync.col_target = target; | col_sync.col_target = target; | ||||
desc_sync.cmd_desc_sync.col = &col_sync; | desc_sync.cmd_desc_sync.col = &col_sync; | ||||
its_cmd_prepare(cmd_sync, &desc_sync); | its_cmd_prepare(cmd_sync, &desc_sync); | ||||
its_cmd_sync(sc, cmd_sync); | its_cmd_sync(sc, cmd_sync); | ||||
} | } | ||||
end: | end: | ||||
/* Update GITS_CWRITER */ | /* Update GITS_CWRITER */ | ||||
mtx_lock_spin(&sc->its_spin_mtx); | |||||
cwriter = its_cmd_cwriter_offset(sc, sc->its_cmdq_write); | cwriter = its_cmd_cwriter_offset(sc, sc->its_cmdq_write); | ||||
gic_its_write(sc, 8, GITS_CWRITER, cwriter); | gic_its_write(sc, 8, GITS_CWRITER, cwriter); | ||||
cmd_write = sc->its_cmdq_write; | |||||
mtx_unlock_spin(&sc->its_spin_mtx); | mtx_unlock_spin(&sc->its_spin_mtx); | ||||
its_cmd_wait_completion(sc, cmd, sc->its_cmdq_write); | its_cmd_wait_completion(sc, cmd, cmd_write); | ||||
return (0); | return (0); | ||||
} | } | ||||
static struct its_dev * | static struct its_dev * | ||||
its_device_find_locked(struct gic_v3_its_softc *sc, device_t pci_dev) | its_device_find_locked(struct gic_v3_its_softc *sc, device_t pci_dev) | ||||
{ | { | ||||
struct its_dev *its_dev; | struct its_dev *its_dev; | ||||
▲ Show 20 Lines • Show All 314 Lines • Show Last 20 Lines |