git: 858397f868c0 - stable/14 - apic: add ioapic_get_dev() method
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 24 Oct 2024 02:46:07 UTC
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=858397f868c0372a074cd14736dabbb2fd0cb09a commit 858397f868c0372a074cd14736dabbb2fd0cb09a Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-10-12 22:52:44 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-10-24 02:44:40 +0000 apic: add ioapic_get_dev() method (cherry picked from commit ea4e4449b85593025c2eb31bb642732971d96225) --- sys/x86/include/apicvar.h | 1 + sys/x86/x86/io_apic.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/sys/x86/include/apicvar.h b/sys/x86/include/apicvar.h index ac6a82659e34..61c726f150df 100644 --- a/sys/x86/include/apicvar.h +++ b/sys/x86/include/apicvar.h @@ -258,6 +258,7 @@ void lapic_handle_intr(int vector, struct trapframe *frame); void lapic_handle_timer(struct trapframe *frame); int ioapic_get_rid(u_int apic_id, uint16_t *ridp); +device_t ioapic_get_dev(u_int apic_id); extern int x2apic_mode; extern int lapic_eoi_suppression; diff --git a/sys/x86/x86/io_apic.c b/sys/x86/x86/io_apic.c index 4337d1adc8a9..525547f9482a 100644 --- a/sys/x86/x86/io_apic.c +++ b/sys/x86/x86/io_apic.c @@ -1081,6 +1081,22 @@ ioapic_get_rid(u_int apic_id, uint16_t *ridp) return (0); } +device_t +ioapic_get_dev(u_int apic_id) +{ + struct ioapic *io; + + mtx_lock_spin(&icu_lock); + STAILQ_FOREACH(io, &ioapic_list, io_next) { + if (io->io_hw_apic_id == apic_id) + break; + } + mtx_unlock_spin(&icu_lock); + if (io != NULL) + return (io->pci_dev); + return (NULL); +} + /* * A new-bus driver to consume the memory resources associated with * the APICs in the system. On some systems ACPI or PnPBIOS system