From 7831621f8d296049d793160538c38d53f30df766 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Tue, 27 Dec 2011 13:09:38 +0800 Subject: [PATCH] x86_64: Don't allocate MSI if LAPIC is not enabled --- sys/platform/pc64/x86_64/nexus.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/platform/pc64/x86_64/nexus.c b/sys/platform/pc64/x86_64/nexus.c index 6192e107ae..43658987e7 100644 --- a/sys/platform/pc64/x86_64/nexus.c +++ b/sys/platform/pc64/x86_64/nexus.c @@ -59,6 +59,7 @@ #include #include #include +#include #include #include "pcib_if.h" @@ -572,12 +573,20 @@ static int nexus_alloc_msi(device_t dev, device_t child, int count, int maxcount, int *irqs, int cpuid) { + if (!lapic_enable) + return ENODEV; + + /* XXX temporary */ + if (MachIntrABI.msi_alloc == NULL) + return ENODEV; + return MachIntrABI.msi_alloc(irqs, count, cpuid); } static int nexus_release_msi(device_t dev, device_t child, int count, int *irqs, int cpuid) { + KKASSERT(lapic_enable); MachIntrABI.msi_release(irqs, count, cpuid); return 0; } @@ -586,6 +595,7 @@ static int nexus_map_msi(device_t dev, device_t child, int irq, uint64_t *addr, uint32_t *data, int cpuid) { + KKASSERT(lapic_enable); MachIntrABI.msi_map(irq, addr, data, cpuid); return 0; } -- 2.41.0