Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Feb 2010 09:46:31 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r203749 - stable/8/sys/dev/acpica
Message-ID:  <201002100946.o1A9kVUL051259@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Wed Feb 10 09:46:31 2010
New Revision: 203749
URL: http://svn.freebsd.org/changeset/base/203749

Log:
  MFC r203062: acpi_hpet: correctly get number of timers in a timer block

Modified:
  stable/8/sys/dev/acpica/acpi_hpet.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/netinet/   (props changed)

Modified: stable/8/sys/dev/acpica/acpi_hpet.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi_hpet.c	Wed Feb 10 08:50:06 2010	(r203748)
+++ stable/8/sys/dev/acpica/acpi_hpet.c	Wed Feb 10 09:46:31 2010	(r203749)
@@ -42,6 +42,9 @@ __FBSDID("$FreeBSD$");
 #include <dev/acpica/acpivar.h>
 #include <dev/acpica/acpi_hpet.h>
 
+#define HPET_VENDID_AMD		0x4353
+#define HPET_VENDID_INTEL	0x8086
+
 ACPI_SERIAL_DECL(hpet, "ACPI HPET support");
 
 static devclass_t acpi_hpet_devclass;
@@ -155,9 +158,10 @@ static int
 acpi_hpet_attach(device_t dev)
 {
 	struct acpi_hpet_softc *sc;
-	int rid;
+	int rid, num_timers;
 	uint32_t val, val2;
 	uintmax_t freq;
+	uint16_t vendor;
 
 	ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__);
 
@@ -194,10 +198,21 @@ acpi_hpet_attach(device_t dev)
 	freq = (1000000000000000LL + val / 2) / val;
 	if (bootverbose) {
 		val = bus_read_4(sc->mem_res, HPET_CAPABILITIES);
+
+		/*
+		 * ATI/AMD violates IA-PC HPET (High Precision Event Timers)
+		 * Specification and provides an off by one number
+		 * of timers/comparators.
+		 * Additionally, they use unregistered value in VENDOR_ID field.
+		 */
+		num_timers = 1 + ((val & HPET_CAP_NUM_TIM) >> 8);
+		vendor = val >> 16;
+		if (vendor == HPET_VENDID_AMD && num_timers > 0)
+			num_timers--;
 		device_printf(dev,
 		    "vend: 0x%x rev: 0x%x num: %d hz: %jd opts:%s%s\n",
-		    val >> 16, val & HPET_CAP_REV_ID,
-		    (val & HPET_CAP_NUM_TIM) >> 8, freq,
+		    vendor, val & HPET_CAP_REV_ID,
+		    num_timers, freq,
 		    (val & HPET_CAP_LEG_RT) ? " legacy_route" : "",
 		    (val & HPET_CAP_COUNT_SIZE) ? " 64-bit" : "");
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002100946.o1A9kVUL051259>