diff --git a/headers/private/kernel/arch/x86/msi.h b/headers/private/kernel/arch/x86/msi.h index d0cec5b078..18685cb021 100644 --- a/headers/private/kernel/arch/x86/msi.h +++ b/headers/private/kernel/arch/x86/msi.h @@ -24,7 +24,6 @@ #define MSI_DELIVERY_MODE_EXT_INT 0x00000700 -void msi_init(); bool msi_supported(); status_t msi_allocate_vectors(uint8 count, uint8 *startVector, uint64 *address, uint16 *data); diff --git a/headers/private/kernel/arch/x86/msi_priv.h b/headers/private/kernel/arch/x86/msi_priv.h new file mode 100644 index 0000000000..236c173ed4 --- /dev/null +++ b/headers/private/kernel/arch/x86/msi_priv.h @@ -0,0 +1,12 @@ +/* + * Copyright 2010-2011, Michael Lotz, mmlr@mlotz.ch. All Rights Reserved. + * Distributed under the terms of the MIT license. + */ +#ifndef _KERNEL_ARCH_x86_MSI_PRIV_H +#define _KERNEL_ARCH_x86_MSI_PRIV_H + + +void msi_init(kernel_args* args); + + +#endif // _KERNEL_ARCH_x86_MSI_PRIV_H diff --git a/src/system/kernel/arch/x86/arch_int.cpp b/src/system/kernel/arch/x86/arch_int.cpp index e1836368cd..1fabe85b1b 100644 --- a/src/system/kernel/arch/x86/arch_int.cpp +++ b/src/system/kernel/arch/x86/arch_int.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include @@ -411,7 +411,7 @@ arch_int_init_post_vm(kernel_args* args) status_t arch_int_init_io(kernel_args* args) { - msi_init(); + msi_init(args); ioapic_init(args); return B_OK; } diff --git a/src/system/kernel/arch/x86/msi.cpp b/src/system/kernel/arch/x86/msi.cpp index 67b24225cc..54f4cffc28 100644 --- a/src/system/kernel/arch/x86/msi.cpp +++ b/src/system/kernel/arch/x86/msi.cpp @@ -12,10 +12,11 @@ static bool sMSISupported = false; +static uint32 sBootCPUAPICId = 0; void -msi_init() +msi_init(kernel_args* args) { if (!apic_available()) { dprintf("disabling msi due to missing apic\n"); @@ -24,6 +25,7 @@ msi_init() dprintf("msi support enabled\n"); sMSISupported = true; + sBootCPUAPICId = args->arch_args.cpu_apic_id[0]; } @@ -52,7 +54,7 @@ msi_allocate_vectors(uint8 count, uint8 *startVector, uint64 *address, } *startVector = (uint8)vector; - *address = MSI_ADDRESS_BASE | (0 << MSI_DESTINATION_ID_SHIFT) + *address = MSI_ADDRESS_BASE | (sBootCPUAPICId << MSI_DESTINATION_ID_SHIFT) | MSI_NO_REDIRECTION | MSI_DESTINATION_MODE_PHYSICAL; *data = MSI_TRIGGER_MODE_EDGE | MSI_DELIVERY_MODE_FIXED | ((uint16)vector + ARCH_INTERRUPT_BASE);