Author: jhb
Date: Tue Feb 18 01:15:32 2014
New Revision: 262141
URL: http://svnweb.freebsd.org/changeset/base/262141

Log:
  MFC 259140:
  Move constants for indices in the local APIC's local vector table from
  apicvar.h to apicreg.h.

Modified:
  stable/10/sys/amd64/include/apicvar.h
  stable/10/sys/i386/include/apicvar.h
  stable/10/sys/x86/acpica/madt.c
  stable/10/sys/x86/include/apicreg.h
  stable/10/sys/x86/x86/local_apic.c
  stable/10/sys/x86/x86/mptable.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/include/apicvar.h
==============================================================================
--- stable/10/sys/amd64/include/apicvar.h       Mon Feb 17 23:07:16 2014        
(r262140)
+++ stable/10/sys/amd64/include/apicvar.h       Tue Feb 18 01:15:32 2014        
(r262141)
@@ -136,15 +136,6 @@
  */
 #define        APIC_SPURIOUS_INT 255
 
-#define        LVT_LINT0       0
-#define        LVT_LINT1       1
-#define        LVT_TIMER       2
-#define        LVT_ERROR       3
-#define        LVT_PMC         4
-#define        LVT_THERMAL     5
-#define        LVT_CMCI        6
-#define        LVT_MAX         LVT_CMCI
-
 #ifndef LOCORE
 
 #define        APIC_IPI_DEST_SELF      -1

Modified: stable/10/sys/i386/include/apicvar.h
==============================================================================
--- stable/10/sys/i386/include/apicvar.h        Mon Feb 17 23:07:16 2014        
(r262140)
+++ stable/10/sys/i386/include/apicvar.h        Tue Feb 18 01:15:32 2014        
(r262141)
@@ -135,15 +135,6 @@
  */
 #define        APIC_SPURIOUS_INT 255
 
-#define        LVT_LINT0       0
-#define        LVT_LINT1       1
-#define        LVT_TIMER       2
-#define        LVT_ERROR       3
-#define        LVT_PMC         4
-#define        LVT_THERMAL     5
-#define        LVT_CMCI        6
-#define        LVT_MAX         LVT_CMCI
-
 #ifndef LOCORE
 
 #define        APIC_IPI_DEST_SELF      -1

Modified: stable/10/sys/x86/acpica/madt.c
==============================================================================
--- stable/10/sys/x86/acpica/madt.c     Mon Feb 17 23:07:16 2014        
(r262140)
+++ stable/10/sys/x86/acpica/madt.c     Tue Feb 18 01:15:32 2014        
(r262141)
@@ -517,9 +517,9 @@ madt_parse_local_nmi(ACPI_MADT_LOCAL_API
                return;
        }
        if (nmi->Lint == 0)
-               pin = LVT_LINT0;
+               pin = APIC_LVT_LINT0;
        else
-               pin = LVT_LINT1;
+               pin = APIC_LVT_LINT1;
        lapic_set_lvt_mode(apic_id, pin, APIC_LVT_DM_NMI);
        if (!(nmi->IntiFlags & ACPI_MADT_TRIGGER_CONFORMS))
                lapic_set_lvt_triggermode(apic_id, pin,

Modified: stable/10/sys/x86/include/apicreg.h
==============================================================================
--- stable/10/sys/x86/include/apicreg.h Mon Feb 17 23:07:16 2014        
(r262140)
+++ stable/10/sys/x86/include/apicreg.h Tue Feb 18 01:15:32 2014        
(r262141)
@@ -357,6 +357,16 @@ typedef struct IOAPIC ioapic_t;
 #define APIC_TDCR_128          0x0a
 #define APIC_TDCR_1            0x0b
 
+/* LVT table indices */
+#define        APIC_LVT_LINT0          0
+#define        APIC_LVT_LINT1          1
+#define        APIC_LVT_TIMER          2
+#define        APIC_LVT_ERROR          3
+#define        APIC_LVT_PMC            4
+#define        APIC_LVT_THERMAL        5
+#define        APIC_LVT_CMCI           6
+#define        APIC_LVT_MAX            APIC_LVT_CMCI
+
 /******************************************************************************
  * I/O APIC defines
  */

Modified: stable/10/sys/x86/x86/local_apic.c
==============================================================================
--- stable/10/sys/x86/x86/local_apic.c  Mon Feb 17 23:07:16 2014        
(r262140)
+++ stable/10/sys/x86/x86/local_apic.c  Tue Feb 18 01:15:32 2014        
(r262141)
@@ -112,7 +112,7 @@ struct lvt {
 };
 
 struct lapic {
-       struct lvt la_lvts[LVT_MAX + 1];
+       struct lvt la_lvts[APIC_LVT_MAX + 1];
        u_int la_id:8;
        u_int la_cluster:4;
        u_int la_cluster_id:2;
@@ -126,7 +126,7 @@ struct lapic {
 } static lapics[MAX_APIC_ID + 1];
 
 /* Global defaults for local APIC LVT entries. */
-static struct lvt lvts[LVT_MAX + 1] = {
+static struct lvt lvts[APIC_LVT_MAX + 1] = {
        { 1, 1, 1, 1, APIC_LVT_DM_EXTINT, 0 },  /* LINT0: masked ExtINT */
        { 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 },     /* LINT1: NMI */
        { 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_TIMER_INT },      /* Timer */
@@ -180,7 +180,7 @@ lvt_mode(struct lapic *la, u_int pin, ui
 {
        struct lvt *lvt;
 
-       KASSERT(pin <= LVT_MAX, ("%s: pin %u out of range", __func__, pin));
+       KASSERT(pin <= APIC_LVT_MAX, ("%s: pin %u out of range", __func__, 
pin));
        if (la->la_lvts[pin].lvt_active)
                lvt = &la->la_lvts[pin];
        else
@@ -301,7 +301,7 @@ lapic_create(u_int apic_id, int boot_cpu
         */
        lapics[apic_id].la_present = 1;
        lapics[apic_id].la_id = apic_id;
-       for (i = 0; i <= LVT_MAX; i++) {
+       for (i = 0; i <= APIC_LVT_MAX; i++) {
                lapics[apic_id].la_lvts[i] = lvts[i];
                lapics[apic_id].la_lvts[i].lvt_active = 0;
        }
@@ -340,10 +340,10 @@ lapic_dump(const char* str)
            lapic->lvt_lint0, lapic->lvt_lint1, lapic->tpr, lapic->svr);
        printf("  timer: 0x%08x therm: 0x%08x err: 0x%08x",
            lapic->lvt_timer, lapic->lvt_thermal, lapic->lvt_error);
-       if (maxlvt >= LVT_PMC)
+       if (maxlvt >= APIC_LVT_PMC)
                printf(" pmc: 0x%08x", lapic->lvt_pcint);
        printf("\n");
-       if (maxlvt >= LVT_CMCI)
+       if (maxlvt >= APIC_LVT_CMCI)
                printf("   cmci: 0x%08x\n", lapic->lvt_cmci);
 }
 
@@ -367,16 +367,16 @@ lapic_setup(int boot)
        lapic_enable();
 
        /* Program LINT[01] LVT entries. */
-       lapic->lvt_lint0 = lvt_mode(la, LVT_LINT0, lapic->lvt_lint0);
-       lapic->lvt_lint1 = lvt_mode(la, LVT_LINT1, lapic->lvt_lint1);
+       lapic->lvt_lint0 = lvt_mode(la, APIC_LVT_LINT0, lapic->lvt_lint0);
+       lapic->lvt_lint1 = lvt_mode(la, APIC_LVT_LINT1, lapic->lvt_lint1);
 
        /* Program the PMC LVT entry if present. */
-       if (maxlvt >= LVT_PMC)
-               lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint);
+       if (maxlvt >= APIC_LVT_PMC)
+               lapic->lvt_pcint = lvt_mode(la, APIC_LVT_PMC, lapic->lvt_pcint);
 
        /* Program timer LVT and setup handler. */
        la->lvt_timer_cache = lapic->lvt_timer =
-           lvt_mode(la, LVT_TIMER, lapic->lvt_timer);
+           lvt_mode(la, APIC_LVT_TIMER, lapic->lvt_timer);
        if (boot) {
                snprintf(buf, sizeof(buf), "cpu%d:timer", PCPU_GET(cpuid));
                intrcnt_add(buf, &la->la_timer_count);
@@ -394,14 +394,14 @@ lapic_setup(int boot)
        }
 
        /* Program error LVT and clear any existing errors. */
-       lapic->lvt_error = lvt_mode(la, LVT_ERROR, lapic->lvt_error);
+       lapic->lvt_error = lvt_mode(la, APIC_LVT_ERROR, lapic->lvt_error);
        lapic->esr = 0;
 
        /* XXX: Thermal LVT */
 
        /* Program the CMCI LVT entry if present. */
-       if (maxlvt >= LVT_CMCI)
-               lapic->lvt_cmci = lvt_mode(la, LVT_CMCI, lapic->lvt_cmci);
+       if (maxlvt >= APIC_LVT_CMCI)
+               lapic->lvt_cmci = lvt_mode(la, APIC_LVT_CMCI, lapic->lvt_cmci);
            
        intr_restore(saveintr);
 }
@@ -425,7 +425,7 @@ lapic_update_pmc(void *dummy)
        struct lapic *la;
 
        la = &lapics[lapic_id()];
-       lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint);
+       lapic->lvt_pcint = lvt_mode(la, APIC_LVT_PMC, lapic->lvt_pcint);
 }
 #endif
 
@@ -441,10 +441,10 @@ lapic_enable_pmc(void)
 
        /* Fail if the PMC LVT is not present. */
        maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
-       if (maxlvt < LVT_PMC)
+       if (maxlvt < APIC_LVT_PMC)
                return (0);
 
-       lvts[LVT_PMC].lvt_masked = 0;
+       lvts[APIC_LVT_PMC].lvt_masked = 0;
 
 #ifdef SMP
        /*
@@ -475,10 +475,10 @@ lapic_disable_pmc(void)
 
        /* Fail if the PMC LVT is not present. */
        maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
-       if (maxlvt < LVT_PMC)
+       if (maxlvt < APIC_LVT_PMC)
                return;
 
-       lvts[LVT_PMC].lvt_masked = 1;
+       lvts[APIC_LVT_PMC].lvt_masked = 1;
 
 #ifdef SMP
        /* The APs should always be started when hwpmc is unloaded. */
@@ -618,7 +618,7 @@ int
 lapic_set_lvt_mask(u_int apic_id, u_int pin, u_char masked)
 {
 
-       if (pin > LVT_MAX)
+       if (pin > APIC_LVT_MAX)
                return (EINVAL);
        if (apic_id == APIC_ID_ALL) {
                lvts[pin].lvt_masked = masked;
@@ -642,7 +642,7 @@ lapic_set_lvt_mode(u_int apic_id, u_int 
 {
        struct lvt *lvt;
 
-       if (pin > LVT_MAX)
+       if (pin > APIC_LVT_MAX)
                return (EINVAL);
        if (apic_id == APIC_ID_ALL) {
                lvt = &lvts[pin];
@@ -697,7 +697,7 @@ int
 lapic_set_lvt_polarity(u_int apic_id, u_int pin, enum intr_polarity pol)
 {
 
-       if (pin > LVT_MAX || pol == INTR_POLARITY_CONFORM)
+       if (pin > APIC_LVT_MAX || pol == INTR_POLARITY_CONFORM)
                return (EINVAL);
        if (apic_id == APIC_ID_ALL) {
                lvts[pin].lvt_activehi = (pol == INTR_POLARITY_HIGH);
@@ -722,7 +722,7 @@ int
 lapic_set_lvt_triggermode(u_int apic_id, u_int pin, enum intr_trigger trigger)
 {
 
-       if (pin > LVT_MAX || trigger == INTR_TRIGGER_CONFORM)
+       if (pin > APIC_LVT_MAX || trigger == INTR_TRIGGER_CONFORM)
                return (EINVAL);
        if (apic_id == APIC_ID_ALL) {
                lvts[pin].lvt_edgetrigger = (trigger == INTR_TRIGGER_EDGE);
@@ -895,8 +895,8 @@ lapic_enable_cmc(void)
        apic_id = PCPU_GET(apic_id);
        KASSERT(lapics[apic_id].la_present,
            ("%s: missing APIC %u", __func__, apic_id));
-       lapics[apic_id].la_lvts[LVT_CMCI].lvt_masked = 0;
-       lapics[apic_id].la_lvts[LVT_CMCI].lvt_active = 1;
+       lapics[apic_id].la_lvts[APIC_LVT_CMCI].lvt_masked = 0;
+       lapics[apic_id].la_lvts[APIC_LVT_CMCI].lvt_active = 1;
        if (bootverbose)
                printf("lapic%u: CMCI unmasked\n", apic_id);
 }

Modified: stable/10/sys/x86/x86/mptable.c
==============================================================================
--- stable/10/sys/x86/x86/mptable.c     Mon Feb 17 23:07:16 2014        
(r262140)
+++ stable/10/sys/x86/x86/mptable.c     Tue Feb 18 01:15:32 2014        
(r262141)
@@ -786,9 +786,9 @@ mptable_parse_local_int(int_entry_ptr in
        else
                apic_id = intr->dst_apic_id;
        if (intr->dst_apic_int == 0)
-               pin = LVT_LINT0;
+               pin = APIC_LVT_LINT0;
        else
-               pin = LVT_LINT1;
+               pin = APIC_LVT_LINT1;
        switch (intr->int_type) {
        case INTENTRY_TYPE_INT:
 #if 1
@@ -902,8 +902,9 @@ mptable_parse_ints(void)
        /* Is this a pre-defined config? */
        if (mpfps->config_type != 0) {
                /* Configure LINT pins. */
-               lapic_set_lvt_mode(APIC_ID_ALL, LVT_LINT0, APIC_LVT_DM_EXTINT);
-               lapic_set_lvt_mode(APIC_ID_ALL, LVT_LINT1, APIC_LVT_DM_NMI);
+               lapic_set_lvt_mode(APIC_ID_ALL, APIC_LVT_LINT0,
+                   APIC_LVT_DM_EXTINT);
+               lapic_set_lvt_mode(APIC_ID_ALL, APIC_LVT_LINT1, 
APIC_LVT_DM_NMI);
 
                /* Configure I/O APIC pins. */
                mptable_parse_default_config_ints();
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to