Lines Matching +full:scu +full:- +full:index

1 // SPDX-License-Identifier: GPL-2.0
17 #include <asm/intel-family.h>
191 *unit_config = &(telm_conf->pss_config); in telem_get_unitconfig()
193 *unit_config = &(telm_conf->ioss_config); in telem_get_unitconfig()
195 return -EINVAL; in telem_get_unitconfig()
215 return -EINVAL; in telemetry_check_evtid()
221 return -EINVAL; in telemetry_check_evtid()
224 return -EINVAL; in telemetry_check_evtid()
229 if ((len + unit_config->ssram_evts_used) > in telemetry_check_evtid()
231 return -EINVAL; in telemetry_check_evtid()
234 return -EINVAL; in telemetry_check_evtid()
240 return -EINVAL; in telemetry_check_evtid()
247 static inline int telemetry_plt_config_ioss_event(u32 evt_id, int index) in telemetry_plt_config_ioss_event() argument
253 write_buf |= index; in telemetry_plt_config_ioss_event()
255 return intel_scu_ipc_dev_command(telm_conf->scu, IOSS_TELEM, in telemetry_plt_config_ioss_event()
260 static inline int telemetry_plt_config_pss_event(u32 evt_id, int index) in telemetry_plt_config_pss_event() argument
267 index, 0, &write_buf, NULL); in telemetry_plt_config_pss_event()
275 struct intel_scu_ipc_dev *scu = telm_conf->scu; in telemetry_setup_iossevtconfig() local
277 int ret, index, idx; in telemetry_setup_iossevtconfig() local
286 ret = intel_scu_ipc_dev_command(scu, IOSS_TELEM, in telemetry_setup_iossevtconfig()
297 ret = intel_scu_ipc_dev_command(scu, IOSS_TELEM, in telemetry_setup_iossevtconfig()
311 ret = intel_scu_ipc_dev_command(scu, IOSS_TELEM, in telemetry_setup_iossevtconfig()
319 telm_conf->ioss_config.ssram_evts_used = 0; in telemetry_setup_iossevtconfig()
324 telm_conf->ioss_config.telem_evts[idx].evt_id, in telemetry_setup_iossevtconfig()
327 telm_conf->ioss_config.telem_evts[idx].evt_id); in telemetry_setup_iossevtconfig()
330 telm_conf->ioss_config.ssram_evts_used++; in telemetry_setup_iossevtconfig()
334 /* Re-Configure Everything */ in telemetry_setup_iossevtconfig()
339 ret = intel_scu_ipc_dev_command(scu, IOSS_TELEM, in telemetry_setup_iossevtconfig()
347 telm_conf->ioss_config.ssram_evts_used = 0; in telemetry_setup_iossevtconfig()
350 for (index = 0; index < num_ioss_evts; index++) { in telemetry_setup_iossevtconfig()
351 telm_conf->ioss_config.telem_evts[index].evt_id = in telemetry_setup_iossevtconfig()
352 ioss_evtmap[index]; in telemetry_setup_iossevtconfig()
355 telm_conf->ioss_config.telem_evts[index].evt_id, in telemetry_setup_iossevtconfig()
356 index)) { in telemetry_setup_iossevtconfig()
358 ioss_evtmap[index]); in telemetry_setup_iossevtconfig()
361 telm_conf->ioss_config.ssram_evts_used++; in telemetry_setup_iossevtconfig()
368 for (index = telm_conf->ioss_config.ssram_evts_used, idx = 0; in telemetry_setup_iossevtconfig()
369 idx < num_ioss_evts; index++, idx++) { in telemetry_setup_iossevtconfig()
370 telm_conf->ioss_config.telem_evts[index].evt_id = in telemetry_setup_iossevtconfig()
374 telm_conf->ioss_config.telem_evts[index].evt_id, in telemetry_setup_iossevtconfig()
375 index)) { in telemetry_setup_iossevtconfig()
380 telm_conf->ioss_config.ssram_evts_used++; in telemetry_setup_iossevtconfig()
390 ret = intel_scu_ipc_dev_command(scu, IOSS_TELEM, in telemetry_setup_iossevtconfig()
398 telm_conf->ioss_config.curr_period = ioss_period; in telemetry_setup_iossevtconfig()
408 int ret, index, idx; in telemetry_setup_pssevtconfig() local
446 telm_conf->pss_config.ssram_evts_used = 0; in telemetry_setup_pssevtconfig()
450 telm_conf->pss_config.telem_evts[idx].evt_id, in telemetry_setup_pssevtconfig()
453 telm_conf->pss_config.telem_evts[idx].evt_id); in telemetry_setup_pssevtconfig()
456 telm_conf->pss_config.ssram_evts_used++; in telemetry_setup_pssevtconfig()
460 /* Re-Configure Everything */ in telemetry_setup_pssevtconfig()
472 telm_conf->pss_config.ssram_evts_used = 0; in telemetry_setup_pssevtconfig()
475 for (index = 0; index < num_pss_evts; index++) { in telemetry_setup_pssevtconfig()
476 telm_conf->pss_config.telem_evts[index].evt_id = in telemetry_setup_pssevtconfig()
477 pss_evtmap[index]; in telemetry_setup_pssevtconfig()
480 telm_conf->pss_config.telem_evts[index].evt_id, in telemetry_setup_pssevtconfig()
481 index)) { in telemetry_setup_pssevtconfig()
483 pss_evtmap[index]); in telemetry_setup_pssevtconfig()
486 telm_conf->pss_config.ssram_evts_used++; in telemetry_setup_pssevtconfig()
493 for (index = telm_conf->pss_config.ssram_evts_used, idx = 0; in telemetry_setup_pssevtconfig()
494 idx < num_pss_evts; index++, idx++) { in telemetry_setup_pssevtconfig()
496 telm_conf->pss_config.telem_evts[index].evt_id = in telemetry_setup_pssevtconfig()
500 telm_conf->pss_config.telem_evts[index].evt_id, in telemetry_setup_pssevtconfig()
501 index)) { in telemetry_setup_pssevtconfig()
506 telm_conf->pss_config.ssram_evts_used++; in telemetry_setup_pssevtconfig()
523 telm_conf->pss_config.curr_period = pss_period; in telemetry_setup_pssevtconfig()
534 mutex_lock(&(telm_conf->telem_lock)); in telemetry_setup_evtconfig()
536 if ((action == TELEM_UPDATE) && (telm_conf->telem_in_use)) { in telemetry_setup_evtconfig()
537 ret = -EBUSY; in telemetry_setup_evtconfig()
564 telm_conf->telem_in_use = true; in telemetry_setup_evtconfig()
566 telm_conf->telem_in_use = false; in telemetry_setup_evtconfig()
569 mutex_unlock(&(telm_conf->telem_lock)); in telemetry_setup_evtconfig()
579 ret = intel_scu_ipc_dev_command(telm_conf->scu, IOSS_TELEM, in telemetry_setup()
583 dev_err(&pdev->dev, "IOSS TELEM_INFO Read Failed\n"); in telemetry_setup()
593 dev_err(&pdev->dev, "IOSS:Insufficient Space for SRAM Trace\n"); in telemetry_setup()
594 dev_err(&pdev->dev, "SRAM Events %d; Event Regs %d\n", in telemetry_setup()
596 return -ENOMEM; in telemetry_setup()
599 telm_conf->ioss_config.min_period = TELEM_MIN_PERIOD(read_buf); in telemetry_setup()
600 telm_conf->ioss_config.max_period = TELEM_MAX_PERIOD(read_buf); in telemetry_setup()
606 dev_err(&pdev->dev, "PSS TELEM_INFO Read Failed\n"); in telemetry_setup()
616 dev_err(&pdev->dev, "PSS:Insufficient Space for SRAM Trace\n"); in telemetry_setup()
617 dev_err(&pdev->dev, "SRAM Events %d; Event Regs %d\n", in telemetry_setup()
619 return -ENOMEM; in telemetry_setup()
622 telm_conf->pss_config.min_period = TELEM_MIN_PERIOD(read_buf); in telemetry_setup()
623 telm_conf->pss_config.max_period = TELEM_MAX_PERIOD(read_buf); in telemetry_setup()
636 dev_err(&pdev->dev, "TELEMETRY Setup Failed\n"); in telemetry_setup()
647 int ret, index, timeout = 0; in telem_evtlog_read() local
653 if (len > unit_config->ssram_evts_used) in telem_evtlog_read()
654 len = unit_config->ssram_evts_used; in telem_evtlog_read()
657 timestamp_prev = readq(unit_config->regmap); in telem_evtlog_read()
660 return -EBUSY; in telem_evtlog_read()
663 ssram_region->start_time = readq(unit_config->regmap + in telem_evtlog_read()
666 for (index = 0; index < len; index++) { in telem_evtlog_read()
667 ssram_region->events[index] = in telem_evtlog_read()
668 readq(unit_config->regmap + TELEM_SSRAM_EVTLOG_OFFSET + in telem_evtlog_read()
669 BYTES_PER_LONG*index); in telem_evtlog_read()
672 timestamp_next = readq(unit_config->regmap); in telem_evtlog_read()
675 return -EBUSY; in telem_evtlog_read()
680 return -EBUSY; in telem_evtlog_read()
685 ssram_region->timestamp = timestamp_next; in telem_evtlog_read()
694 int index, idx1, ret, readlen = len; in telemetry_plt_raw_read_eventlog() local
700 evtmap = telm_conf->pss_config.telem_evts; in telemetry_plt_raw_read_eventlog()
704 evtmap = telm_conf->ioss_config.telem_evts; in telemetry_plt_raw_read_eventlog()
709 return -EINVAL; in telemetry_plt_raw_read_eventlog()
719 /* Invalid evt-id array specified via length mismatch */ in telemetry_plt_raw_read_eventlog()
721 return -EINVAL; in telemetry_plt_raw_read_eventlog()
724 for (index = 0; index < ret; index++) { in telemetry_plt_raw_read_eventlog()
725 evtlog[index].telem_evtlog = ssram_region.events[index]; in telemetry_plt_raw_read_eventlog()
726 evtlog[index].telem_evtid = evtmap[index].evt_id; in telemetry_plt_raw_read_eventlog()
729 for (index = 0, readlen = 0; (index < ret) && (readlen < len); in telemetry_plt_raw_read_eventlog()
730 index++) { in telemetry_plt_raw_read_eventlog()
733 if (evtmap[index].evt_id == in telemetry_plt_raw_read_eventlog()
736 ssram_region.events[index]; in telemetry_plt_raw_read_eventlog()
752 mutex_lock(&(telm_conf->telem_lock)); in telemetry_plt_read_eventlog()
755 mutex_unlock(&(telm_conf->telem_lock)); in telemetry_plt_read_eventlog()
767 return -EINVAL; in telemetry_plt_get_trace_verbosity()
769 mutex_lock(&(telm_conf->telem_trace_lock)); in telemetry_plt_get_trace_verbosity()
783 ret = intel_scu_ipc_dev_command(telm_conf->scu, in telemetry_plt_get_trace_verbosity()
795 ret = -EINVAL; in telemetry_plt_get_trace_verbosity()
801 mutex_unlock(&(telm_conf->telem_trace_lock)); in telemetry_plt_get_trace_verbosity()
813 mutex_lock(&(telm_conf->telem_trace_lock)); in telemetry_plt_set_trace_verbosity()
837 ret = intel_scu_ipc_dev_command(telm_conf->scu, IOSS_TELEM, in telemetry_plt_set_trace_verbosity()
848 ret = intel_scu_ipc_dev_command(telm_conf->scu, IOSS_TELEM, in telemetry_plt_set_trace_verbosity()
859 ret = -EINVAL; in telemetry_plt_set_trace_verbosity()
864 mutex_unlock(&(telm_conf->telem_trace_lock)); in telemetry_plt_set_trace_verbosity()
883 return -ENODEV; in telemetry_pltdrv_probe()
885 telm_conf = (struct telemetry_plt_config *)id->driver_data; in telemetry_pltdrv_probe()
887 telm_conf->pmc = dev_get_drvdata(pdev->dev.parent); in telemetry_pltdrv_probe()
893 telm_conf->pss_config.regmap = mem; in telemetry_pltdrv_probe()
899 telm_conf->ioss_config.regmap = mem; in telemetry_pltdrv_probe()
901 telm_conf->scu = devm_intel_scu_ipc_dev_get(&pdev->dev); in telemetry_pltdrv_probe()
902 if (!telm_conf->scu) { in telemetry_pltdrv_probe()
903 ret = -EPROBE_DEFER; in telemetry_pltdrv_probe()
907 mutex_init(&telm_conf->telem_lock); in telemetry_pltdrv_probe()
908 mutex_init(&telm_conf->telem_trace_lock); in telemetry_pltdrv_probe()
916 dev_err(&pdev->dev, "TELEMETRY Set Pltops Failed.\n"); in telemetry_pltdrv_probe()
923 dev_err(&pdev->dev, "TELEMETRY Setup Failed.\n"); in telemetry_pltdrv_probe()