Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/pci In pci_msi_establish(), replace several ano...



details:   https://anonhg.NetBSD.org/src/rev/143cacf34c48
branches:  trunk
changeset: 768492:143cacf34c48
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Wed Aug 17 14:56:55 2011 +0000

description:
In pci_msi_establish(), replace several anonymous constants with IOAPIC_
symbols.  No change in the generated assembly.

diffstat:

 sys/arch/x86/pci/pci_intr_machdep.c |  26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diffs (60 lines):

diff -r d7d90f941c81 -r 143cacf34c48 sys/arch/x86/pci/pci_intr_machdep.c
--- a/sys/arch/x86/pci/pci_intr_machdep.c       Wed Aug 17 14:55:11 2011 +0000
+++ b/sys/arch/x86/pci/pci_intr_machdep.c       Wed Aug 17 14:56:55 2011 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index