Lines Matching refs:count

93 pci_msi_alloc_vectors(struct pic *msi_pic, uint *table_indexes, int *count)
101 vectors = kmem_zalloc(sizeof(vectors[0]) * (*count), KM_SLEEP);
103 for (i = 0; i < *count; i++) {
119 kmem_free(vectors, sizeof(vectors[0]) * (*count));
132 pci_msi_free_vectors(struct pic *msi_pic, pci_intr_handle_t *pihs, int count)
140 for (i = 0; i < count; i++) {
148 kmem_free(pihs, sizeof(pihs[0]) * count);
153 pci_msi_alloc_common(pci_intr_handle_t **ihps, int *count,
179 while (*count > 0) {
180 vectors = pci_msi_alloc_vectors(msi_pic, NULL, count);
189 (*count) >>= 1; /* must be power of 2. */
199 for (i = 0; i < *count; i++) {
203 error = msipic_set_msi_vectors(msi_pic, NULL, *count);
205 pci_msi_free_vectors(msi_pic, vectors, *count);
212 if (xen_map_msi_pirq(msi_pic, *count)) {
214 pci_msi_free_vectors(msi_pic, vectors, *count);
252 int *count, const struct pci_attach_args *pa, bool exact)
275 while (*count > 0) {
276 vectors = pci_msi_alloc_vectors(msix_pic, table_indexes, count);
285 (*count)--;
295 for (i = 0; i < *count; i++) {
299 error = msipic_set_msi_vectors(msix_pic, vectors, *count);
301 pci_msi_free_vectors(msix_pic, vectors, *count);
309 if (xen_map_msix_pirq(msix_pic, *count)) {
311 pci_msi_free_vectors(msix_pic, vectors, *count);
320 x86_pci_msi_alloc(pci_intr_handle_t **ihps, int *count,
324 return pci_msi_alloc_common(ihps, count, pa, false);
328 x86_pci_msi_alloc_exact(pci_intr_handle_t **ihps, int count,
332 return pci_msi_alloc_common(ihps, &count, pa, true);
337 x86_pci_msi_release_internal(pci_intr_handle_t *pihs, int count)
346 xen_pci_msi_release(pic, count);
348 pci_msi_free_vectors(pic, pihs, count);
354 x86_pci_msix_alloc(pci_intr_handle_t **ihps, int *count,
358 return pci_msix_alloc_common(ihps, NULL, count, pa, false);
362 x86_pci_msix_alloc_exact(pci_intr_handle_t **ihps, int count,
366 return pci_msix_alloc_common(ihps, NULL, &count, pa, true);
371 int count, const struct pci_attach_args *pa)
374 return pci_msix_alloc_common(ihps, table_indexes, &count, pa, true);
379 x86_pci_msix_release_internal(pci_intr_handle_t *pihs, int count)
388 xen_pci_msi_release(pic, count);
390 pci_msi_free_vectors(pic, pihs, count);
425 x86_pci_msi_release(pci_chipset_tag_t pc, pci_intr_handle_t *pihs, int count)
428 if (count < 1)
431 return x86_pci_msi_release_internal(pihs, count);
470 x86_pci_msix_release(pci_chipset_tag_t pc, pci_intr_handle_t *pihs, int count)
473 if (count < 1)
476 return x86_pci_msix_release_internal(pihs, count);
521 * "count" must be power of 2.
522 * "count" can decrease if struct intrsource cannot be allocated.
523 * if count == 0, return non-zero value.
527 int *count)
531 /* MSI vector count must be power of 2. */
532 KASSERT(*count > 0);
533 KASSERT(((*count - 1) & *count) == 0);
539 if (*count > hw_max) {
540 DPRINTF(("cut off MSI count to %d\n", hw_max));
541 *count = hw_max; /* cut off hw_max */
544 return x86_pci_msi_alloc(ihps, count, pa);
551 * "count" must be power of 2.
552 * "count" can not decrease.
553 * If "count" struct intrsources cannot be allocated, return non-zero value.
557 int count)
561 /* MSI vector count must be power of 2. */
562 KASSERT(count > 0);
563 KASSERT(((count - 1) & count) == 0);
569 if (count > hw_max) {
570 DPRINTF(("over hardware max MSI count %d\n", hw_max));
574 return x86_pci_msi_alloc_exact(ihps, count, pa);
581 * "count" can decrease if enough struct intrsources cannot be allocated.
582 * if count == 0, return non-zero value.
586 int *count)
590 KASSERT(*count > 0);
596 if (*count > hw_max) {
597 DPRINTF(("cut off MSI-X count to %d\n", hw_max));
598 *count = hw_max; /* cut off hw_max */
601 return x86_pci_msix_alloc(ihps, count, pa);
608 * "count" can not decrease.
609 * If "count" struct intrsource cannot be allocated, return non-zero value.
613 int count)
617 KASSERT(count > 0);
623 if (count > hw_max) {
624 DPRINTF(("over hardware max MSI-X count %d\n", hw_max));
628 return x86_pci_msix_alloc_exact(ihps, count, pa);
636 * "count" can not decrease.
637 * "map" size must be equal to "count".
638 * If "count" struct intrsource cannot be allocated, return non-zero value.
647 u_int *table_indexes, int count)
651 KASSERT(count > 0);
657 if (count > hw_max) {
658 DPRINTF(("over hardware max MSI-X count %d\n", hw_max));
663 for (i = 0; i < count; i++) {
673 for (j = i + 1; j < count; j++) {
681 return x86_pci_msix_alloc_map(ihps, table_indexes, count, pa);