Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162224607
D58086.id181459.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D58086.id181459.diff
View Options
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
@@ -797,9 +797,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");
@@ -929,8 +930,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,21 @@
lapic_read32(LAPIC_LVT_THERMAL)));
}
-void
+bool
lapic_enable_thermal(lapic_thermal_handler_t *func, void *func_arg)
{
+ int maxlvt;
+
#ifdef DEV_ATPIC
/* Fail if the local APIC is not present. */
if (!x2apic_mode && lapic_map == NULL)
- return;
+ return (false);
#endif
+ maxlvt = lapic_maxlvt(lapic_read32(LAPIC_VERSION));
+ if (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,17 +1688,25 @@
MPASS(mp_ncpus == 1 || smp_started);
smp_rendezvous(NULL, lapic_update_thermal, NULL, NULL);
+
+ return (true);
}
void
lapic_disable_thermal(void)
{
+ int maxlvt;
+
#ifdef DEV_ATPIC
/* Fail if the local APIC is not present. */
if (!x2apic_mode && lapic_map == NULL)
return;
#endif
+ maxlvt = lapic_maxlvt(lapic_read32(LAPIC_VERSION));
+ if (maxlvt < APIC_LVT_THERMAL)
+ return;
+
lvts[APIC_LVT_THERMAL].lvt_masked = 1;
#ifdef SMP
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jul 12, 1:38 AM (5 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34982897
Default Alt Text
D58086.id181459.diff (2 KB)
Attached To
Mode
D58086: x86/local_apic.c: Fiddle with thermal LVT slot only if supported
Attached
Detach File
Event Timeline
Log In to Comment