[Midnightbsd-cvs] src [8357] trunk/sys/dev/acpica/acpi_cpu.c: change sleep code

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Sep 18 14:37:58 EDT 2016


Revision: 8357
          http://svnweb.midnightbsd.org/src/?rev=8357
Author:   laffer1
Date:     2016-09-18 14:37:58 -0400 (Sun, 18 Sep 2016)
Log Message:
-----------
change sleep code

Modified Paths:
--------------
    trunk/sys/dev/acpica/acpi_cpu.c

Modified: trunk/sys/dev/acpica/acpi_cpu.c
===================================================================
--- trunk/sys/dev/acpica/acpi_cpu.c	2016-09-18 18:34:26 UTC (rev 8356)
+++ trunk/sys/dev/acpica/acpi_cpu.c	2016-09-18 18:37:58 UTC (rev 8357)
@@ -1,4 +1,3 @@
-/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2003-2005 Nate Lawson (SDG)
  * Copyright (c) 2001 Michael Smith
@@ -27,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: stable/9/sys/dev/acpica/acpi_cpu.c 283892 2015-06-01 19:26:24Z jkim $");
+__FBSDID("$FreeBSD: release/9.2.0/sys/dev/acpica/acpi_cpu.c 244618 2012-12-23 12:09:41Z avg $");
 
 #include "opt_acpi.h"
 #include <sys/param.h>
@@ -86,7 +85,6 @@
     int			 cpu_prev_sleep;/* Last idle sleep duration. */
     int			 cpu_features;	/* Child driver supported features. */
     /* Runtime state. */
-    int			 cpu_non_c2;	/* Index of lowest non-C2 state. */
     int			 cpu_non_c3;	/* Index of lowest non-C3 state. */
     u_int		 cpu_cx_stats[MAX_CX_STATES];/* Cx usage history. */
     /* Values for sysctl. */
@@ -172,8 +170,7 @@
 static void	acpi_cpu_cx_list(struct acpi_cpu_softc *sc);
 static void	acpi_cpu_idle(void);
 static void	acpi_cpu_notify(ACPI_HANDLE h, UINT32 notify, void *context);
-static void	acpi_cpu_quirks(void);
-static void	acpi_cpu_quirks_piix4(void);
+static int	acpi_cpu_quirks(void);
 static int	acpi_cpu_usage_sysctl(SYSCTL_HANDLER_ARGS);
 static int	acpi_cpu_set_cx_lowest(struct acpi_cpu_softc *sc);
 static int	acpi_cpu_cx_lowest_sysctl(SYSCTL_HANDLER_ARGS);
@@ -667,10 +664,8 @@
     cx_ptr->type = ACPI_STATE_C1;
     cx_ptr->trans_lat = 0;
     cx_ptr++;
-    sc->cpu_non_c2 = sc->cpu_cx_count;
     sc->cpu_non_c3 = sc->cpu_cx_count;
     sc->cpu_cx_count++;
-    cpu_deepest_sleep = 1;
 
     /* 
      * The spec says P_BLK must be 6 bytes long.  However, some systems
@@ -696,7 +691,6 @@
 	    cx_ptr++;
 	    sc->cpu_non_c3 = sc->cpu_cx_count;
 	    sc->cpu_cx_count++;
-	    cpu_deepest_sleep = 2;
 	}
     }
     if (sc->cpu_p_blk_len < 6)
@@ -713,7 +707,7 @@
 	    cx_ptr->trans_lat = AcpiGbl_FADT.C3Latency;
 	    cx_ptr++;
 	    sc->cpu_cx_count++;
-	    cpu_deepest_sleep = 3;
+	    cpu_can_deep_sleep = 1;
 	}
     }
 }
@@ -759,7 +753,6 @@
 	count = MAX_CX_STATES;
     }
 
-    sc->cpu_non_c2 = 0;
     sc->cpu_non_c3 = 0;
     sc->cpu_cx_count = 0;
     cx_ptr = sc->cpu_cx_states;
@@ -771,7 +764,6 @@
     cx_ptr->type = ACPI_STATE_C0;
     cx_ptr++;
     sc->cpu_cx_count++;
-    cpu_deepest_sleep = 1;
 
     /* Set up all valid states. */
     for (i = 0; i < count; i++) {
@@ -792,7 +784,6 @@
 		/* This is the first C1 state.  Use the reserved slot. */
 		sc->cpu_cx_states[0] = *cx_ptr;
 	    } else {
-		sc->cpu_non_c2 = sc->cpu_cx_count;
 		sc->cpu_non_c3 = sc->cpu_cx_count;
 		cx_ptr++;
 		sc->cpu_cx_count++;
@@ -800,8 +791,6 @@
 	    continue;
 	case ACPI_STATE_C2:
 	    sc->cpu_non_c3 = sc->cpu_cx_count;
-	    if (cpu_deepest_sleep < 2)
-		    cpu_deepest_sleep = 2;
 	    break;
 	case ACPI_STATE_C3:
 	default:
@@ -811,7 +800,7 @@
 				 device_get_unit(sc->cpu_dev), i));
 		continue;
 	    } else
-		cpu_deepest_sleep = 3;
+		cpu_can_deep_sleep = 1;
 	    break;
 	}
 
@@ -992,9 +981,7 @@
 
     /* Find the lowest state that has small enough latency. */
     cx_next_idx = 0;
-    if (cpu_disable_c2_sleep)
-	i = min(sc->cpu_cx_lowest, sc->cpu_non_c2);
-    else if (cpu_disable_c3_sleep)
+    if (cpu_disable_deep_sleep)
 	i = min(sc->cpu_cx_lowest, sc->cpu_non_c3);
     else
 	i = sc->cpu_cx_lowest;
@@ -1124,9 +1111,12 @@
     acpi_UserNotify("PROCESSOR", sc->cpu_handle, notify);
 }
 
-static void
+static int
 acpi_cpu_quirks(void)
 {
+    device_t acpi_dev;
+    uint32_t val;
+
     ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
     /*
@@ -1160,16 +1150,6 @@
     }
 
     /* Look for various quirks of the PIIX4 part. */
-    acpi_cpu_quirks_piix4();
-}
-
-static void
-acpi_cpu_quirks_piix4(void)
-{
-#ifdef __i386__
-    device_t acpi_dev;
-    uint32_t val;
-
     acpi_dev = pci_find_device(PCI_VENDOR_INTEL, PCI_DEVICE_82371AB_3);
     if (acpi_dev != NULL) {
 	switch (pci_get_revid(acpi_dev)) {
@@ -1218,7 +1198,8 @@
 	    break;
 	}
     }
-#endif
+
+    return (0);
 }
 
 static int



More information about the Midnightbsd-cvs mailing list