Module Name: src Committed By: dyoung Date: Wed Aug 17 14:56:55 UTC 2011
Modified Files: src/sys/arch/x86/pci: pci_intr_machdep.c Log Message: In pci_msi_establish(), replace several anonymous constants with IOAPIC_ symbols. No change in the generated assembly. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/x86/pci/pci_intr_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/x86/pci/pci_intr_machdep.c diff -u src/sys/arch/x86/pci/pci_intr_machdep.c:1.21 src/sys/arch/x86/pci/pci_intr_machdep.c:1.22 --- src/sys/arch/x86/pci/pci_intr_machdep.c:1.21 Wed Aug 17 00:59:47 2011 +++ src/sys/arch/x86/pci/pci_intr_machdep.c Wed Aug 17 14:56:55 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_intr_machdep.c,v 1.21 2011/08/17 00:59:47 dyoung Exp $ */ +/* $NetBSD: pci_intr_machdep.c,v 1.22 2011/08/17 14:56:55 dyoung Exp $ */ /*- * Copyright (c) 1997, 1998, 2009 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.21 2011/08/17 00:59:47 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.22 2011/08/17 14:56:55 dyoung Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -93,6 +93,7 @@ #include "opt_acpi.h" #if NIOAPIC > 0 || NACPICA > 0 +#include <machine/i82093reg.h> #include <machine/i82093var.h> #include <machine/mpconfig.h> #include <machine/mpbiosvar.h> @@ -393,17 +394,28 @@ ci = ih->ih_cpu; is = ci->ci_isources[ih->ih_slot]; reg = pci_conf_read(pa->pa_pc, pa->pa_tag, co + PCI_MSI_CTL); - /* 0xfee00000 == IOAPIC_??? */ pci_conf_write(pa->pa_pc, pa->pa_tag, co + PCI_MSI_MADDR64_LO, - 0xfee00000 | ci->ci_cpuid << 12); + IOAPIC_MSIADDR_BASE | + __SHIFTIN(ci->ci_cpuid, IOAPIC_MSIADDR_DSTID_MASK)); if (reg & PCI_MSI_CTL_64BIT_ADDR) { pci_conf_write(pa->pa_pc, pa->pa_tag, co + PCI_MSI_MADDR64_HI, 0); + /* XXX according to the manual, ASSERT is unnecessary if + * EDGE + */ pci_conf_write(pa->pa_pc, pa->pa_tag, co + PCI_MSI_MDATA64, - is->is_idtvec | 0x4000); - } else + __SHIFTIN(is->is_idtvec, IOAPIC_MSIDATA_VECTOR_MASK) | + IOAPIC_MSIDATA_TRGMODE_EDGE | IOAPIC_MSIDATA_LEVEL_ASSERT | + IOAPIC_MSIDATA_DM_FIXED); + } else { + /* XXX according to the manual, ASSERT is unnecessary if + * EDGE + */ pci_conf_write(pa->pa_pc, pa->pa_tag, co + PCI_MSI_MDATA, - is->is_idtvec | 0x4000); + __SHIFTIN(is->is_idtvec, IOAPIC_MSIDATA_VECTOR_MASK) | + IOAPIC_MSIDATA_TRGMODE_EDGE | IOAPIC_MSIDATA_LEVEL_ASSERT | + IOAPIC_MSIDATA_DM_FIXED); + } pci_conf_write(pa->pa_pc, pa->pa_tag, co + PCI_MSI_CTL, PCI_MSI_CTL_MSI_ENABLE); return msih;