Page MenuHomeFreeBSD

D58086.id181540.diff
No OneTemporary

D58086.id181540.diff

diff --git a/sys/x86/include/apicvar.h b/sys/x86/include/apicvar.h
--- a/sys/x86/include/apicvar.h
+++ b/sys/x86/include/apicvar.h
@@ -236,7 +236,7 @@
void apic_disable_vector(u_int apic_id, u_int vector);
void apic_free_vector(u_int apic_id, u_int vector, u_int irq);
void lapic_calibrate_timer(void);
-void lapic_enable_thermal(lapic_thermal_handler_t *func, void *func_arg);
+bool lapic_enable_thermal(lapic_thermal_handler_t *func, void *func_arg);
void lapic_disable_thermal(void);
int lapic_enable_pcint(void);
void lapic_disable_pcint(void);
diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
--- a/sys/x86/x86/local_apic.c
+++ b/sys/x86/x86/local_apic.c
@@ -807,9 +807,10 @@
printf("\n lint0: 0x%08x lint1: 0x%08x TPR: 0x%08x SVR: 0x%08x\n",
lapic_read32(LAPIC_LVT_LINT0), lapic_read32(LAPIC_LVT_LINT1),
lapic_read32(LAPIC_TPR), lapic_read32(LAPIC_SVR));
- printf(" timer: 0x%08x therm: 0x%08x err: 0x%08x",
- lapic_read32(LAPIC_LVT_TIMER), lapic_read32(LAPIC_LVT_THERMAL),
+ printf(" timer: 0x%08x err: 0x%08x", lapic_read32(LAPIC_LVT_TIMER),
lapic_read32(LAPIC_LVT_ERROR));
+ if (maxlvt >= APIC_LVT_THERMAL)
+ printf(" therm: 0x%08x", lapic_read32(LAPIC_LVT_THERMAL));
if (maxlvt >= APIC_LVT_PMC)
printf(" pmc: 0x%08x", lapic_read32(LAPIC_LVT_PCINT));
printf("\n");
@@ -935,8 +936,9 @@
lapic_write32(LAPIC_ESR, 0);
/* Thermal LVT */
- lapic_write32(LAPIC_LVT_THERMAL, lvt_mode(la, APIC_LVT_THERMAL,
- lapic_read32(LAPIC_LVT_THERMAL)));
+ if (maxlvt >= APIC_LVT_THERMAL)
+ lapic_write32(LAPIC_LVT_THERMAL, lvt_mode(la, APIC_LVT_THERMAL,
+ lapic_read32(LAPIC_LVT_THERMAL)));
/* Program the CMCI LVT entry if present. */
if (maxlvt >= APIC_LVT_CMCI) {
@@ -1663,15 +1665,18 @@
lapic_read32(LAPIC_LVT_THERMAL)));
}
-void
+bool
lapic_enable_thermal(lapic_thermal_handler_t *func, void *func_arg)
{
#ifdef DEV_ATPIC
/* Fail if the local APIC is not present. */
if (!x2apic_mode && lapic_map == NULL)
- return;
+ return (false);
#endif
+ if (lapic_maxlvt() < APIC_LVT_THERMAL)
+ return (false);
+
lapic_thermal_function_arg = func_arg;
atomic_store_rel_ptr((uintptr_t *)&lapic_thermal_function,
(uintptr_t)func);
@@ -1680,6 +1685,8 @@
MPASS(mp_ncpus == 1 || smp_started);
smp_rendezvous(NULL, lapic_update_thermal, NULL, NULL);
+
+ return (true);
}
void
@@ -1691,6 +1698,9 @@
return;
#endif
+ if (lapic_maxlvt() < APIC_LVT_THERMAL)
+ return;
+
lvts[APIC_LVT_THERMAL].lvt_masked = 1;
#ifdef SMP

File Metadata

Mime Type
text/plain
Expires
Sun, Jul 12, 7:01 PM (11 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35007606
Default Alt Text
D58086.id181540.diff (2 KB)

Event Timeline