110 if (wsp->chipid >= CMI_MAX_CHIPID &&
111 wsp->coreid >= CMI_MAX_COREID(wsp->core_nbits) &&
112 wsp->strandid >= CMI_MAX_STRANDID(wsp->strand_nbits))
113 return (B_FALSE);
114
115 /* increment the strand id */
116 wsp->strandid++;
117 carry = wsp->strandid >> wsp->strand_nbits;
118 wsp->strandid = wsp->strandid & CMI_MAX_STRANDID(wsp->strand_nbits);
119 if (carry == 0)
120 return (B_TRUE);
121
122 /* increment the core id */
123 wsp->coreid++;
124 carry = wsp->coreid >> wsp->core_nbits;
125 wsp->coreid = wsp->coreid & CMI_MAX_COREID(wsp->core_nbits);
126 if (carry == 0)
127 return (B_TRUE);
128
129 /* increment the chip id */
130 wsp->chipid = ++wsp->chipid & (CMI_MAX_CHIPID);
131
132 return (B_TRUE);
133 }
134
135 /*
136 * Lookup for the hdl entry of a given <chip,core,strand> tuple
137 */
138 static cmi_hdl_ent_t *
139 cmih_ent_lookup(struct cmih_walk_state *wsp)
140 {
141 if (wsp == NULL || wsp->chip_tab[wsp->chipid] == NULL)
142 return (NULL); /* chip is not present */
143
144 return (wsp->chip_tab[wsp->chipid] +
145 (((wsp->coreid & CMI_MAX_COREID(wsp->core_nbits)) <<
146 wsp->strand_nbits) |
147 ((wsp->strandid) & CMI_MAX_STRANDID(wsp->strand_nbits))));
148 }
149
150 /* forward decls */
|
110 if (wsp->chipid >= CMI_MAX_CHIPID &&
111 wsp->coreid >= CMI_MAX_COREID(wsp->core_nbits) &&
112 wsp->strandid >= CMI_MAX_STRANDID(wsp->strand_nbits))
113 return (B_FALSE);
114
115 /* increment the strand id */
116 wsp->strandid++;
117 carry = wsp->strandid >> wsp->strand_nbits;
118 wsp->strandid = wsp->strandid & CMI_MAX_STRANDID(wsp->strand_nbits);
119 if (carry == 0)
120 return (B_TRUE);
121
122 /* increment the core id */
123 wsp->coreid++;
124 carry = wsp->coreid >> wsp->core_nbits;
125 wsp->coreid = wsp->coreid & CMI_MAX_COREID(wsp->core_nbits);
126 if (carry == 0)
127 return (B_TRUE);
128
129 /* increment the chip id */
130 wsp->chipid = (wsp->chipid + 1) & (CMI_MAX_CHIPID);
131
132 return (B_TRUE);
133 }
134
135 /*
136 * Lookup for the hdl entry of a given <chip,core,strand> tuple
137 */
138 static cmi_hdl_ent_t *
139 cmih_ent_lookup(struct cmih_walk_state *wsp)
140 {
141 if (wsp == NULL || wsp->chip_tab[wsp->chipid] == NULL)
142 return (NULL); /* chip is not present */
143
144 return (wsp->chip_tab[wsp->chipid] +
145 (((wsp->coreid & CMI_MAX_COREID(wsp->core_nbits)) <<
146 wsp->strand_nbits) |
147 ((wsp->strandid) & CMI_MAX_STRANDID(wsp->strand_nbits))));
148 }
149
150 /* forward decls */
|