Lines Matching full:dn

292 	/* DN/HN-F/CXHA */
377 static struct arm_cmn_nodeid arm_cmn_nid(const struct arm_cmn_node *dn) in arm_cmn_nid() argument
381 nid.dev = dn->id & ((1U << dn->deviceid_bits) - 1); in arm_cmn_nid()
382 nid.port = (dn->id >> dn->deviceid_bits) & ((1U << dn->portid_bits) - 1); in arm_cmn_nid()
387 const struct arm_cmn_node *dn) in arm_cmn_node_to_xp() argument
389 int id = dn->id >> (dn->portid_bits + dn->deviceid_bits); in arm_cmn_node_to_xp()
399 struct arm_cmn_node *dn; in arm_cmn_node() local
401 for (dn = cmn->dns; dn->type; dn++) in arm_cmn_node()
402 if (dn->type == type) in arm_cmn_node()
403 return dn; in arm_cmn_node()
425 static int arm_cmn_pmu_offset(const struct arm_cmn *cmn, const struct arm_cmn_node *dn) in arm_cmn_pmu_offset() argument
428 if (dn->type == CMN_TYPE_XP) in arm_cmn_pmu_offset()
500 struct arm_cmn_node *dn; in arm_cmn_show_logid() local
503 for (dn = cmn->dns; dn->type; dn++) { in arm_cmn_show_logid()
504 int pad = dn->logid < 10; in arm_cmn_show_logid()
506 if (dn->type == CMN_TYPE_XP) in arm_cmn_show_logid()
509 if (dn->type < CMN_TYPE_HNI) in arm_cmn_show_logid()
512 if (dn->id != id) in arm_cmn_show_logid()
515 seq_printf(s, " %*c#%-*d |", pad + 1, ' ', 3 - pad, dn->logid); in arm_cmn_show_logid()
595 struct arm_cmn_node *dn; member
612 #define for_each_hw_dn(hw, dn, i) \ argument
613 for (i = 0, dn = hw->dn; i < hw->num_dns; i++, dn++)
1449 struct arm_cmn_node *dn; in arm_cmn_read_dtm() local
1454 for_each_hw_dn(hw, dn, i) { in arm_cmn_read_dtm()
1455 if (dtm != &cmn->dtms[dn->dtm]) { in arm_cmn_read_dtm()
1456 dtm = &cmn->dtms[dn->dtm] + hw->dtm_offset; in arm_cmn_read_dtm()
1524 static int arm_cmn_set_event_sel_hi(struct arm_cmn_node *dn, in arm_cmn_set_event_sel_hi() argument
1532 if (!dn->occupid[fsel].count) { in arm_cmn_set_event_sel_hi()
1533 dn->occupid[fsel].val = occupid; in arm_cmn_set_event_sel_hi()
1535 dn->occupid[SEL_CBUSY_SNTHROTTLE_SEL].val) | in arm_cmn_set_event_sel_hi()
1537 dn->occupid[SEL_SN_HOME_SEL].val) | in arm_cmn_set_event_sel_hi()
1539 dn->occupid[SEL_HBT_LBT_SEL].val) | in arm_cmn_set_event_sel_hi()
1541 dn->occupid[SEL_CLASS_OCCUP_ID].val) | in arm_cmn_set_event_sel_hi()
1543 dn->occupid[SEL_OCCUP1ID].val); in arm_cmn_set_event_sel_hi()
1544 writel_relaxed(reg >> 32, dn->pmu_base + CMN_PMU_EVENT_SEL + 4); in arm_cmn_set_event_sel_hi()
1545 } else if (dn->occupid[fsel].val != occupid) { in arm_cmn_set_event_sel_hi()
1548 dn->occupid[fsel].count++; in arm_cmn_set_event_sel_hi()
1552 static void arm_cmn_set_event_sel_lo(struct arm_cmn_node *dn, int dtm_idx, in arm_cmn_set_event_sel_lo() argument
1556 dn->event_w[dtm_idx] = eventid; in arm_cmn_set_event_sel_lo()
1557 writeq_relaxed(le64_to_cpu(dn->event_sel_w), dn->pmu_base + CMN_PMU_EVENT_SEL); in arm_cmn_set_event_sel_lo()
1559 dn->event[dtm_idx] = eventid; in arm_cmn_set_event_sel_lo()
1560 writel_relaxed(le32_to_cpu(dn->event_sel), dn->pmu_base + CMN_PMU_EVENT_SEL); in arm_cmn_set_event_sel_lo()
1568 struct arm_cmn_node *dn; in arm_cmn_event_start() local
1583 for_each_hw_dn(hw, dn, i) { in arm_cmn_event_start()
1584 void __iomem *base = dn->pmu_base + CMN_DTM_OFFSET(hw->dtm_offset); in arm_cmn_event_start()
1590 } else for_each_hw_dn(hw, dn, i) { in arm_cmn_event_start()
1593 arm_cmn_set_event_sel_lo(dn, dtm_idx, CMN_EVENT_EVENTID(event), in arm_cmn_event_start()
1602 struct arm_cmn_node *dn; in arm_cmn_event_stop() local
1612 for_each_hw_dn(hw, dn, i) { in arm_cmn_event_stop()
1613 void __iomem *base = dn->pmu_base + CMN_DTM_OFFSET(hw->dtm_offset); in arm_cmn_event_stop()
1619 } else for_each_hw_dn(hw, dn, i) { in arm_cmn_event_stop()
1622 arm_cmn_set_event_sel_lo(dn, dtm_idx, 0, hw->wide_sel); in arm_cmn_event_stop()
1653 struct arm_cmn_node *dn; in arm_cmn_val_add_event() local
1669 for_each_hw_dn(hw, dn, i) { in arm_cmn_val_add_event()
1670 int wp_idx, dtm = dn->dtm, sel = hw->filter_sel; in arm_cmn_val_add_event()
1689 struct arm_cmn_node *dn; in arm_cmn_validate_group() local
1720 for_each_hw_dn(hw, dn, i) { in arm_cmn_validate_group()
1721 int wp_idx, dtm = dn->dtm, sel = hw->filter_sel; in arm_cmn_validate_group()
1768 struct arm_cmn_node *dn; in arm_cmn_event_init() local
1809 hw->dn = arm_cmn_node(cmn, type); in arm_cmn_event_init()
1810 if (!hw->dn) in arm_cmn_event_init()
1814 for (dn = hw->dn; dn->type == type; dn++) { in arm_cmn_event_init()
1815 if (bynodeid && dn->id != nodeid) { in arm_cmn_event_init()
1816 hw->dn++; in arm_cmn_event_init()
1820 if (dn->dtc < 0) in arm_cmn_event_init()
1823 hw->dtc_idx[dn->dtc] = 0; in arm_cmn_event_init()
1844 struct arm_cmn_dtm *dtm = &cmn->dtms[hw->dn[i].dtm] + hw->dtm_offset; in arm_cmn_event_clear()
1854 hw->dn[i].occupid[hw->filter_sel].count--; in arm_cmn_event_clear()
1870 struct arm_cmn_node *dn; in arm_cmn_event_add() local
1901 for_each_hw_dn(hw, dn, i) { in arm_cmn_event_add()
1902 struct arm_cmn_dtm *dtm = &cmn->dtms[dn->dtm] + hw->dtm_offset; in arm_cmn_event_add()
1903 unsigned int dtm_idx, shift, d = max_t(int, dn->dtc, 0); in arm_cmn_event_add()
1933 struct arm_cmn_nodeid nid = arm_cmn_nid(dn); in arm_cmn_event_add()
1941 if (arm_cmn_set_event_sel_hi(dn, hw->filter_sel, CMN_EVENT_OCCUPID(event))) in arm_cmn_event_add()
2127 static int arm_cmn_init_dtc(struct arm_cmn *cmn, struct arm_cmn_node *dn, int idx) in arm_cmn_init_dtc() argument
2131 dtc->pmu_base = dn->pmu_base; in arm_cmn_init_dtc()
2132 dtc->base = dtc->pmu_base - arm_cmn_pmu_offset(cmn, dn); in arm_cmn_init_dtc()
2158 struct arm_cmn_node *dn, *xp; in arm_cmn_init_dtcs() local
2171 dn = arm_cmn_node(cmn, CMN_TYPE_DTC); in arm_cmn_init_dtcs()
2173 arm_cmn_node_to_xp(cmn, dn + i)->dtc = i; in arm_cmn_init_dtcs()
2176 for (dn = cmn->dns; dn->type; dn++) { in arm_cmn_init_dtcs()
2177 if (dn->type == CMN_TYPE_XP) in arm_cmn_init_dtcs()
2180 xp = arm_cmn_node_to_xp(cmn, dn); in arm_cmn_init_dtcs()
2181 dn->portid_bits = xp->portid_bits; in arm_cmn_init_dtcs()
2182 dn->deviceid_bits = xp->deviceid_bits; in arm_cmn_init_dtcs()
2183 dn->dtc = xp->dtc; in arm_cmn_init_dtcs()
2184 dn->dtm = xp->dtm; in arm_cmn_init_dtcs()
2186 dn->dtm += arm_cmn_nid(dn).port / 2; in arm_cmn_init_dtcs()
2188 if (dn->type == CMN_TYPE_DTC) { in arm_cmn_init_dtcs()
2189 int err = arm_cmn_init_dtc(cmn, dn, dtc_idx++); in arm_cmn_init_dtcs()
2196 if (dn->type == CMN_TYPE_RND) in arm_cmn_init_dtcs()
2197 dn->type = CMN_TYPE_RNI; in arm_cmn_init_dtcs()
2200 if (dn->type == CMN_TYPE_CCLA_RNI) in arm_cmn_init_dtcs()
2201 dn->type = CMN_TYPE_CCLA; in arm_cmn_init_dtcs()
2257 struct arm_cmn_node cfg, *dn; in arm_cmn_discover() local
2326 dn = devm_kcalloc(cmn->dev, cmn->num_dns * 2 - cmn->num_xps, in arm_cmn_discover()
2327 sizeof(*dn), GFP_KERNEL); in arm_cmn_discover()
2328 if (!dn) in arm_cmn_discover()
2340 cmn->dns = dn; in arm_cmn_discover()
2344 struct arm_cmn_node *xp = dn++; in arm_cmn_discover()
2422 arm_cmn_init_node_info(cmn, reg & CMN_CHILD_NODE_ADDR, dn); in arm_cmn_discover()
2424 switch (dn->type) { in arm_cmn_discover()
2427 dn++; in arm_cmn_discover()
2442 dn++; in arm_cmn_discover()
2445 dn->pmu_base += CMN_CCLA_PMU_EVENT_SEL; in arm_cmn_discover()
2446 dn++; in arm_cmn_discover()
2465 dn[1] = dn[0]; in arm_cmn_discover()
2466 dn[0].pmu_base += CMN_CCLA_PMU_EVENT_SEL; in arm_cmn_discover()
2467 dn[1].type = arm_cmn_subtype(dn->type); in arm_cmn_discover()
2468 dn += 2; in arm_cmn_discover()
2472 dev_err(cmn->dev, "invalid device node type: 0x%x\n", dn->type); in arm_cmn_discover()
2479 cmn->num_dns = dn - cmn->dns; in arm_cmn_discover()
2482 sz = (void *)(dn + 1) - (void *)cmn->dns; in arm_cmn_discover()
2483 dn = devm_krealloc(cmn->dev, cmn->dns, sz, GFP_KERNEL); in arm_cmn_discover()
2484 if (dn) in arm_cmn_discover()
2485 cmn->dns = dn; in arm_cmn_discover()