| 337 | } |
| 338 | |
| 339 | static int |
| 340 | ccp_find_lsb_regions(struct ccp_queue *cmd_q, uint64_t status) |
| 341 | { |
| 342 | int q_mask = 1 << cmd_q->id; |
| 343 | int weight = 0; |
| 344 | int j; |
| 345 | |
| 346 | /* Build a bit mask to know which LSBs |
| 347 | * this queue has access to. |
| 348 | * Don't bother with segment 0 |
| 349 | * as it has special |
| 350 | * privileges. |
| 351 | */ |
| 352 | cmd_q->lsbmask = 0; |
| 353 | status >>= LSB_REGION_WIDTH; |
| 354 | for (j = 1; j < MAX_LSB_CNT; j++) { |
| 355 | if (status & q_mask) |
| 356 | ccp_set_bit(&cmd_q->lsbmask, j); |
| 357 | |
| 358 | status >>= LSB_REGION_WIDTH; |
| 359 | } |
| 360 | |
| 361 | for (j = 0; j < MAX_LSB_CNT; j++) |
| 362 | if (ccp_get_bit(&cmd_q->lsbmask, j)) |
| 363 | weight++; |
| 364 | |
| 365 | CCP_LOG_DBG("Queue %d can access %d LSB regions of mask %lu", |
| 366 | (int)cmd_q->id, weight, cmd_q->lsbmask); |
| 367 | |
| 368 | return weight ? 0 : -EINVAL; |
| 369 | } |
| 370 | |
| 371 | static int |
| 372 | ccp_find_and_assign_lsb_to_q(struct ccp_device *ccp, |
no test coverage detected