Lines Matching +full:sensor +full:- +full:id
1 /*-
2 * Copyright (c) 2009-2016 Solarflare Communications Inc.
40 /* Get port mask from one-based MCDI port number */
41 #define MCDI_MON_PORT_MASK(_emip) (1U << ((_emip)->emi_port - 1))
56 efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); in mcdi_mon_decode_stats()
58 uint16_t sensor; in mcdi_mon_decode_stats() local
73 EFSYS_ASSERT(emip->emi_port > 0); /* MCDI port number is one-based */ in mcdi_mon_decode_stats()
79 * The MCDI sensor readings in the DMA buffer are a packed array of in mcdi_mon_decode_stats()
82 * sensor readings do not include entries for the per-page NEXT_PAGE in mcdi_mon_decode_stats()
88 for (sensor = 0; sensor < sensor_max; ++sensor) { in mcdi_mon_decode_stats()
89 efx_mon_stat_t id; in mcdi_mon_decode_stats() local
94 if ((sensor % (MC_CMD_SENSOR_PAGE0_NEXT + 1)) == in mcdi_mon_decode_stats()
98 /* This sensor is one of the page boundary bits. */ in mcdi_mon_decode_stats()
101 if (~(sensor_mask[page]) & (1U << sensor)) in mcdi_mon_decode_stats()
103 /* This sensor not in DMA buffer */ in mcdi_mon_decode_stats()
108 * if we couldn't look up the id in mcdi_mon_decode_stats()
111 decode_ok = efx_mon_mcdi_to_efx_stat(sensor, &id); in mcdi_mon_decode_stats()
113 decode_ok && efx_mon_get_stat_portmap(id, &stat_portmask); in mcdi_mon_decode_stats()
119 EFSYS_ASSERT(id < EFX_MON_NSTATS); in mcdi_mon_decode_stats()
125 * If there is an entry in the MCDI sensor to monitor statistic in mcdi_mon_decode_stats()
126 * map then the sensor reading is used for the value of the in mcdi_mon_decode_stats()
129 stat_mask[id / EFX_MON_MASK_ELEMENT_SIZE] |= in mcdi_mon_decode_stats()
130 (1U << (id % EFX_MON_MASK_ELEMENT_SIZE)); in mcdi_mon_decode_stats()
135 /* Get MCDI sensor reading from DMA buffer */ in mcdi_mon_decode_stats()
136 EFSYS_MEM_READD(esmp, 4 * (idx - 1), &dword); in mcdi_mon_decode_stats()
138 /* Update EFX monitor stat from MCDI sensor reading */ in mcdi_mon_decode_stats()
139 stat[id].emsv_value = (uint16_t)EFX_DWORD_FIELD(dword, in mcdi_mon_decode_stats()
142 stat[id].emsv_state = (uint16_t)EFX_DWORD_FIELD(dword, in mcdi_mon_decode_stats()
145 stat[id].emsv_unit = in mcdi_mon_decode_stats()
146 efx_mon_get_stat_unit(id, &stat_unit) ? in mcdi_mon_decode_stats()
163 efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); in mcdi_mon_ev()
165 uint16_t sensor; in mcdi_mon_ev() local
168 efx_mon_stat_t id; in mcdi_mon_ev() local
171 EFSYS_ASSERT(emip->emi_port > 0); /* MCDI port number is one-based */ in mcdi_mon_ev()
174 sensor = (uint16_t)MCDI_EV_FIELD(eqp, SENSOREVT_MONITOR); in mcdi_mon_ev()
178 /* Hardware must support this MCDI sensor */ in mcdi_mon_ev()
179 EFSYS_ASSERT3U(sensor, <, in mcdi_mon_ev()
180 (8 * enp->en_nic_cfg.enc_mcdi_sensor_mask_size)); in mcdi_mon_ev()
181 EFSYS_ASSERT((sensor % (MC_CMD_SENSOR_PAGE0_NEXT + 1)) != in mcdi_mon_ev()
183 EFSYS_ASSERT(enp->en_nic_cfg.enc_mcdi_sensor_maskp != NULL); in mcdi_mon_ev()
184 EFSYS_ASSERT((enp->en_nic_cfg.enc_mcdi_sensor_maskp[ in mcdi_mon_ev()
185 sensor / (MC_CMD_SENSOR_PAGE0_NEXT + 1)] & in mcdi_mon_ev()
186 (1U << (sensor % (MC_CMD_SENSOR_PAGE0_NEXT + 1)))) != 0); in mcdi_mon_ev()
188 /* And we need to understand it, to get port-map */ in mcdi_mon_ev()
189 if (!efx_mon_mcdi_to_efx_stat(sensor, &id)) { in mcdi_mon_ev()
193 if (!(efx_mon_get_stat_portmap(id, &sensor_port_mask) && in mcdi_mon_ev()
197 EFSYS_ASSERT(id < EFX_MON_NSTATS); in mcdi_mon_ev()
199 *idp = id; in mcdi_mon_ev()
200 valuep->emsv_value = value; in mcdi_mon_ev()
201 valuep->emsv_state = state; in mcdi_mon_ev()
334 if ((page != (npages - 1)) && in efx_mcdi_sensor_info()
342 if (sensor_maskp[npages - 1] & (1U << MC_CMD_SENSOR_PAGE0_NEXT)) { in efx_mcdi_sensor_info()
366 __out_ecount((sizeof (*mask_part) * 8) - 1)
381 ((sizeof (*mask_part) * 8) - 1) * sizeof (efx_mon_stat_limits_t));
403 *mask_part = maskp->ed_u32[0];
413 mask_copy = mask_copy & ~(mask_copy ^ (mask_copy - 1));
415 limits->emlv_warning_min = EFX_QWORD_FIELD(*limit_info,
418 limits->emlv_warning_max = EFX_QWORD_FIELD(*limit_info,
421 limits->emlv_fatal_min = EFX_QWORD_FIELD(*limit_info,
424 limits->emlv_fatal_max = EFX_QWORD_FIELD(*limit_info,
446 efx_nic_cfg_t *encp = &(enp->en_nic_cfg); in mcdi_mon_stats_update()
447 uint32_t size = encp->enc_mon_stat_dma_buf_size; in mcdi_mon_stats_update()
456 encp->enc_mcdi_sensor_maskp, in mcdi_mon_stats_update()
457 encp->enc_mcdi_sensor_mask_size, in mcdi_mon_stats_update()
478 x = (input_mask ^ (input_mask - 1)); in lowest_set_bit()
512 page--; in mcdi_mon_limits_update()
562 efx_nic_cfg_t *encp = &(enp->en_nic_cfg); in mcdi_mon_cfg_build()
566 switch (enp->en_family) { in mcdi_mon_cfg_build()
569 encp->enc_mon_type = EFX_MON_SFC90X0; in mcdi_mon_cfg_build()
574 encp->enc_mon_type = EFX_MON_SFC91X0; in mcdi_mon_cfg_build()
579 encp->enc_mon_type = EFX_MON_SFC92X0; in mcdi_mon_cfg_build()
584 encp->enc_mon_type = EFX_MON_SFC92X0; in mcdi_mon_cfg_build()
592 /* Get mc sensor mask size */ in mcdi_mon_cfg_build()
597 encp->enc_mon_stat_dma_buf_size = npages * EFX_MON_STATS_PAGE_SIZE; in mcdi_mon_cfg_build()
598 encp->enc_mcdi_sensor_mask_size = npages * sizeof (uint32_t); in mcdi_mon_cfg_build()
600 /* Allocate mc sensor mask */ in mcdi_mon_cfg_build()
601 EFSYS_KMEM_ALLOC(enp->en_esip, in mcdi_mon_cfg_build()
602 encp->enc_mcdi_sensor_mask_size, in mcdi_mon_cfg_build()
603 encp->enc_mcdi_sensor_maskp); in mcdi_mon_cfg_build()
605 if (encp->enc_mcdi_sensor_maskp == NULL) { in mcdi_mon_cfg_build()
610 /* Read mc sensor mask */ in mcdi_mon_cfg_build()
612 encp->enc_mcdi_sensor_maskp, in mcdi_mon_cfg_build()
618 encp->enc_mcdi_sensor_maskp, in mcdi_mon_cfg_build()
619 encp->enc_mcdi_sensor_mask_size, in mcdi_mon_cfg_build()
620 NULL, encp->enc_mon_stat_mask, NULL); in mcdi_mon_cfg_build()
626 EFSYS_KMEM_FREE(enp->en_esip, in mcdi_mon_cfg_build()
627 encp->enc_mcdi_sensor_mask_size, in mcdi_mon_cfg_build()
628 encp->enc_mcdi_sensor_maskp); in mcdi_mon_cfg_build()
646 efx_nic_cfg_t *encp = &(enp->en_nic_cfg); in mcdi_mon_cfg_free()
648 if (encp->enc_mcdi_sensor_maskp != NULL) { in mcdi_mon_cfg_free()
649 EFSYS_KMEM_FREE(enp->en_esip, in mcdi_mon_cfg_free()
650 encp->enc_mcdi_sensor_mask_size, in mcdi_mon_cfg_free()
651 encp->enc_mcdi_sensor_maskp); in mcdi_mon_cfg_free()