| 605 | } |
| 606 | |
| 607 | static void |
| 608 | mca_record_entry(enum scan_mode mode, const struct mca_record *record) |
| 609 | { |
| 610 | struct mca_internal *rec; |
| 611 | |
| 612 | if (mode == POLLED) { |
| 613 | rec = malloc(sizeof(*rec), M_MCA, M_WAITOK); |
| 614 | mtx_lock_spin(&mca_lock); |
| 615 | } else { |
| 616 | mtx_lock_spin(&mca_lock); |
| 617 | rec = STAILQ_FIRST(&mca_freelist); |
| 618 | if (rec == NULL) { |
| 619 | printf("MCA: Unable to allocate space for an event.\n"); |
| 620 | mca_log(record); |
| 621 | mtx_unlock_spin(&mca_lock); |
| 622 | return; |
| 623 | } |
| 624 | STAILQ_REMOVE_HEAD(&mca_freelist, link); |
| 625 | mca_freecount--; |
| 626 | } |
| 627 | |
| 628 | rec->rec = *record; |
| 629 | STAILQ_INSERT_TAIL(&mca_pending, rec, link); |
| 630 | mtx_unlock_spin(&mca_lock); |
| 631 | } |
| 632 | |
| 633 | #ifdef DEV_APIC |
| 634 | /* |