summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2014-02-18 01:15:32 +0000
committerjhb <jhb@FreeBSD.org>2014-02-18 01:15:32 +0000
commit8e8bf4982f8ffa39cb70af30e58f272cb2ec7341 (patch)
tree8e42404b602b19729f836474e03a9e08f1a13279
parenta3fafc30d3fadeaba77468909b84eabce7ad54d6 (diff)
downloadFreeBSD-src-8e8bf4982f8ffa39cb70af30e58f272cb2ec7341.zip
FreeBSD-src-8e8bf4982f8ffa39cb70af30e58f272cb2ec7341.tar.gz
MFC 259140:
Move constants for indices in the local APIC's local vector table from apicvar.h to apicreg.h.
-rw-r--r--sys/amd64/include/apicvar.h9
-rw-r--r--sys/i386/include/apicvar.h9
-rw-r--r--sys/x86/acpica/madt.c4
-rw-r--r--sys/x86/include/apicreg.h10
-rw-r--r--sys/x86/x86/local_apic.c50
-rw-r--r--sys/x86/x86/mptable.c9
6 files changed, 42 insertions, 49 deletions
diff --git a/sys/amd64/include/apicvar.h b/sys/amd64/include/apicvar.h
index 9cd4c95..e7423a3 100644
--- a/sys/amd64/include/apicvar.h
+++ b/sys/amd64/include/apicvar.h
@@ -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
diff --git a/sys/i386/include/apicvar.h b/sys/i386/include/apicvar.h
index 5d1f522..df99ebe 100644
--- a/sys/i386/include/apicvar.h
+++ b/sys/i386/include/apicvar.h
@@ -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
diff --git a/sys/x86/acpica/madt.c b/sys/x86/acpica/madt.c
index 85cf1da..5929fde 100644
--- a/sys/x86/acpica/madt.c
+++ b/sys/x86/acpica/madt.c
@@ -517,9 +517,9 @@ madt_parse_local_nmi(ACPI_MADT_LOCAL_APIC_NMI *nmi)
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,
diff --git a/sys/x86/include/apicreg.h b/sys/x86/include/apicreg.h
index 00cb571..283d50e 100644
--- a/sys/x86/include/apicreg.h
+++ b/sys/x86/include/apicreg.h
@@ -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
*/
diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
index 8c8eef6..9c33ee4 100644
--- a/sys/x86/x86/local_apic.c
+++ b/sys/x86/x86/local_apic.c
@@ -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, uint32_t value)
{
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 pin, u_int32_t mode)
{
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);
}
diff --git a/sys/x86/x86/mptable.c b/sys/x86/x86/mptable.c
index fe520eb..f9fdbf3 100644
--- a/sys/x86/x86/mptable.c
+++ b/sys/x86/x86/mptable.c
@@ -786,9 +786,9 @@ mptable_parse_local_int(int_entry_ptr intr)
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();
OpenPOWER on IntegriCloud