| 695 | } |
| 696 | |
| 697 | static int |
| 698 | its_init_cpu(device_t dev, struct gicv3_its_softc *sc) |
| 699 | { |
| 700 | device_t gicv3; |
| 701 | vm_paddr_t target; |
| 702 | u_int cpuid; |
| 703 | struct redist_pcpu *rpcpu; |
| 704 | |
| 705 | gicv3 = device_get_parent(dev); |
| 706 | cpuid = PCPU_GET(cpuid); |
| 707 | if (!CPU_ISSET(cpuid, &sc->sc_cpus)) |
| 708 | return (0); |
| 709 | |
| 710 | /* Check if the ITS is enabled on this CPU */ |
| 711 | if ((gic_r_read_4(gicv3, GICR_TYPER) & GICR_TYPER_PLPIS) == 0) |
| 712 | return (ENXIO); |
| 713 | |
| 714 | rpcpu = gicv3_get_redist(dev); |
| 715 | |
| 716 | /* Do per-cpu LPI init once */ |
| 717 | if (!rpcpu->lpi_enabled) { |
| 718 | its_init_cpu_lpi(dev, sc); |
| 719 | rpcpu->lpi_enabled = true; |
| 720 | } |
| 721 | |
| 722 | if ((gic_its_read_8(sc, GITS_TYPER) & GITS_TYPER_PTA) != 0) { |
| 723 | /* This ITS wants the redistributor physical address */ |
| 724 | target = vtophys(rman_get_virtual(&rpcpu->res)); |
| 725 | } else { |
| 726 | /* This ITS wants the unique processor number */ |
| 727 | target = GICR_TYPER_CPUNUM(gic_r_read_8(gicv3, GICR_TYPER)) << |
| 728 | CMD_TARGET_SHIFT; |
| 729 | } |
| 730 | |
| 731 | sc->sc_its_cols[cpuid]->col_target = target; |
| 732 | sc->sc_its_cols[cpuid]->col_id = cpuid; |
| 733 | |
| 734 | its_cmd_mapc(dev, sc->sc_its_cols[cpuid], 1); |
| 735 | its_cmd_invall(dev, sc->sc_its_cols[cpuid]); |
| 736 | |
| 737 | return (0); |
| 738 | } |
| 739 | |
| 740 | static int |
| 741 | gicv3_its_sysctl_trace_enable(SYSCTL_HANDLER_ARGS) |
no test coverage detected