summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua M. Clulow <josh@sysmgr.org>2019-11-15 15:41:02 -0800
committerJoshua M. Clulow <josh@sysmgr.org>2019-11-15 15:41:23 -0800
commit11ed32a0b3b424ec966d0330d0efaf049baaf8d2 (patch)
tree6a3d3348bdd7e88c807d2fa48bde69eaa85c40ee
parent48ed61a721b0db9229d5bad4d87f5b019867fbf1 (diff)
downloadillumos-joyent-11ed32a0b3b424ec966d0330d0efaf049baaf8d2.tar.gz
11968 APIC calibration should explicitly initialise the PIT
Reviewed by: John Levon <john.levon@joyent.com> Reviewed by: Paul Winder <paul@winders.demon.co.uk> Reviewed by: Garrett D'Amore <garrett@damore.org> Approved by: Robert Mustacchi <rm@fingolfin.org>
-rw-r--r--usr/src/uts/i86pc/io/microfind.c2
-rw-r--r--usr/src/uts/i86pc/io/pcplusmp/apic_common.c13
2 files changed, 14 insertions, 1 deletions
diff --git a/usr/src/uts/i86pc/io/microfind.c b/usr/src/uts/i86pc/io/microfind.c
index 60f9dc4e17..2c28cc4a94 100644
--- a/usr/src/uts/i86pc/io/microfind.c
+++ b/usr/src/uts/i86pc/io/microfind.c
@@ -91,7 +91,7 @@ microfind_pit_delta(void)
* until we write the low byte and then the high byte to the counter
* port.
*/
- outb(PITCTL_PORT, PIT_LOADMODE);
+ outb(PITCTL_PORT, PIT_C0 | PIT_LOADMODE | PIT_ENDSIGMODE);
/*
* Load the maximum counter value, 0xffff, into the counter port.
diff --git a/usr/src/uts/i86pc/io/pcplusmp/apic_common.c b/usr/src/uts/i86pc/io/pcplusmp/apic_common.c
index 65cdcaf763..e74d8cbf80 100644
--- a/usr/src/uts/i86pc/io/pcplusmp/apic_common.c
+++ b/usr/src/uts/i86pc/io/pcplusmp/apic_common.c
@@ -25,6 +25,7 @@
/*
* Copyright 2019, Joyent, Inc.
* Copyright (c) 2016, 2017 by Delphix. All rights reserved.
+ * Copyright 2019 Joshua M. Clulow <josh@sysmgr.org>
*/
/*
@@ -1114,6 +1115,18 @@ apic_calibrate_impl()
iflag = intr_clear();
+ /*
+ * Put the PIT in mode 0, "Interrupt On Terminal Count":
+ */
+ outb(PITCTL_PORT, PIT_C0 | PIT_LOADMODE | PIT_ENDSIGMODE);
+
+ /*
+ * The PIT counts down and then the counter value wraps around. Load
+ * the maximum counter value:
+ */
+ outb(PITCTR0_PORT, 0xFF);
+ outb(PITCTR0_PORT, 0xFF);
+
do {
pit_tick_lo = inb(PITCTR0_PORT);
pit_tick = (inb(PITCTR0_PORT) << 8) | pit_tick_lo;