add resume support for hpet

Andrea Bittau a.bittau at cs.ucl.ac.uk
Tue Mar 27 12:37:41 UTC 2007


When resuming, the timer needs to be reactivated.  Some boxes use hpet for their
time of day and if hpet doesn't resume, the time of day never changes, screwing
up the whole box.  I'm not sure if this is the correct way to do thing [do you
need re-calibration?] but it seems to work for me.

---

Index: acpi_hpet.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/acpica/acpi_hpet.c,v
retrieving revision 1.5
diff -u -p -r1.5 acpi_hpet.c
--- acpi_hpet.c	11 Aug 2006 17:12:16 -0000	1.5
+++ acpi_hpet.c	27 Mar 2007 12:06:07 -0000
@@ -154,6 +154,17 @@ acpi_hpet_detach(device_t dev)
 	return (EBUSY);
 }
 
+static int
+acpi_hpet_resume(device_t dev)
+{
+	struct acpi_hpet_softc *sc;
+	
+	sc = device_get_softc(dev);
+	bus_write_4(sc->mem_res, HPET_OFFSET_ENABLE, 1);
+
+	return 0;
+}
+
 /* Print some basic latency/rate information to assist in debugging. */
 static void
 acpi_hpet_test(struct acpi_hpet_softc *sc)
@@ -188,6 +199,7 @@ static device_method_t acpi_hpet_methods
 	DEVMETHOD(device_probe, acpi_hpet_probe),
 	DEVMETHOD(device_attach, acpi_hpet_attach),
 	DEVMETHOD(device_detach, acpi_hpet_detach),
+	DEVMETHOD(device_resume, acpi_hpet_resume),
 
 	{0, 0}
 };


More information about the freebsd-acpi mailing list