MSI: Use the effective APIC id of the boot CPU for the address destination.

* This should only affect systems where the CPU ids aren't sequential (mostly
non Intel).
* Fixes #9807.
This commit is contained in:
Jérôme Duval 2013-07-26 17:58:55 +02:00
parent e52af6a9e1
commit 46f7a54d8c
4 changed files with 18 additions and 5 deletions

View File

@ -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);

View File

@ -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

View File

@ -24,7 +24,7 @@
#include <arch/x86/apic.h>
#include <arch/x86/descriptors.h>
#include <arch/x86/msi.h>
#include <arch/x86/msi_priv.h>
#include <stdio.h>
@ -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;
}

View File

@ -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);