svn commit: r244619 - stable/8/sys/dev/acpica

Andriy Gapon avg at FreeBSD.org
Sun Dec 23 12:09:53 UTC 2012


Author: avg
Date: Sun Dec 23 12:09:52 2012
New Revision: 244619
URL: http://svnweb.freebsd.org/changeset/base/244619

Log:
  MFC r243404: acpi_cpu: use fixed resource ids for cx state i/o resources

Modified:
  stable/8/sys/dev/acpica/acpi_cpu.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/acpica/   (props changed)

Modified: stable/8/sys/dev/acpica/acpi_cpu.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi_cpu.c	Sun Dec 23 12:09:41 2012	(r244618)
+++ stable/8/sys/dev/acpica/acpi_cpu.c	Sun Dec 23 12:09:52 2012	(r244619)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/pcpu.h>
 #include <sys/power.h>
 #include <sys/proc.h>
+#include <sys/sched.h>
 #include <sys/sbuf.h>
 #include <sys/smp.h>
 
@@ -65,6 +66,7 @@ struct acpi_cx {
     uint32_t		 trans_lat;	/* Transition latency (usec). */
     uint32_t		 power;		/* Power consumed (mW). */
     int			 res_type;	/* Resource type for p_lvlx. */
+    int			 res_rid;	/* Resource ID for p_lvlx. */
 };
 #define MAX_CX_STATES	 8
 
@@ -89,7 +91,6 @@ struct acpi_cpu_softc {
     int			 cpu_cx_lowest_lim;
     int			 cpu_disable_idle; /* Disable entry to idle function */
     char 		 cpu_cx_supported[64];
-    int			 cpu_rid;
 };
 
 struct acpi_cpu_device {
@@ -670,10 +671,10 @@ acpi_cpu_generic_cx_probe(struct acpi_cp
     gas.BitWidth = 8;
     if (AcpiGbl_FADT.C2Latency <= 100) {
 	gas.Address = sc->cpu_p_blk + 4;
-	acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &sc->cpu_rid,
+	cx_ptr->res_rid = 0;
+	acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &cx_ptr->res_rid,
 	    &gas, &cx_ptr->p_lvlx, RF_SHAREABLE);
 	if (cx_ptr->p_lvlx != NULL) {
-	    sc->cpu_rid++;
 	    cx_ptr->type = ACPI_STATE_C2;
 	    cx_ptr->trans_lat = AcpiGbl_FADT.C2Latency;
 	    cx_ptr++;
@@ -687,10 +688,10 @@ acpi_cpu_generic_cx_probe(struct acpi_cp
     /* Validate and allocate resources for C3 (P_LVL3). */
     if (AcpiGbl_FADT.C3Latency <= 1000 && !(cpu_quirks & CPU_QUIRK_NO_C3)) {
 	gas.Address = sc->cpu_p_blk + 5;
-	acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &sc->cpu_rid, &gas,
-	    &cx_ptr->p_lvlx, RF_SHAREABLE);
+	cx_ptr->res_rid = 1;
+	acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &cx_ptr->res_rid,
+	    &gas, &cx_ptr->p_lvlx, RF_SHAREABLE);
 	if (cx_ptr->p_lvlx != NULL) {
-	    sc->cpu_rid++;
 	    cx_ptr->type = ACPI_STATE_C3;
 	    cx_ptr->trans_lat = AcpiGbl_FADT.C3Latency;
 	    cx_ptr++;
@@ -790,19 +791,18 @@ acpi_cpu_cx_cst(struct acpi_cpu_softc *s
 	    break;
 	}
 
-#ifdef notyet
 	/* Free up any previous register. */
 	if (cx_ptr->p_lvlx != NULL) {
-	    bus_release_resource(sc->cpu_dev, 0, 0, cx_ptr->p_lvlx);
+	    bus_release_resource(sc->cpu_dev, cx_ptr->res_type, cx_ptr->res_rid,
+	        cx_ptr->p_lvlx);
 	    cx_ptr->p_lvlx = NULL;
 	}
-#endif
 
 	/* Allocate the control register for C2 or C3. */
-	acpi_PkgGas(sc->cpu_dev, pkg, 0, &cx_ptr->res_type, &sc->cpu_rid,
+	cx_ptr->res_rid = sc->cpu_cx_count;
+	acpi_PkgGas(sc->cpu_dev, pkg, 0, &cx_ptr->res_type, &cx_ptr->res_rid,
 	    &cx_ptr->p_lvlx, RF_SHAREABLE);
 	if (cx_ptr->p_lvlx) {
-	    sc->cpu_rid++;
 	    ACPI_DEBUG_PRINT((ACPI_DB_INFO,
 			     "acpi_cpu%d: Got C%d - %d latency\n",
 			     device_get_unit(sc->cpu_dev), cx_ptr->type,


More information about the svn-src-all mailing list