-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
The attached patch adds the suggestion of toggling the PCI express
ASPM mode where applicable.
Best regards,
Erik
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkmkTokACgkQN7qBt+4UG0EnmwCeNMCRS6KV6xKWkEr+d2v1aNbF
r4IAn2qnEHR234mnA6orQ7mCaEhWKDFm
=dJ1L
-----END PGP SIGNATURE-----
Index: powertop.c
===================================================================
--- powertop.c (revision 319)
+++ powertop.c (working copy)
@@ -1141,6 +1141,7 @@
suggest_xrandr_TV_off();
suggest_WOL_off();
suggest_writeback_time();
+ suggest_pcie_aspm();
suggest_usb_autosuspend();
usb_activity_hint();
Index: powertop.h
===================================================================
--- powertop.h (revision 319)
+++ powertop.h (working copy)
@@ -57,6 +57,7 @@
void suggest_xrandr_TV_off(void);
void suggest_WOL_off(void);
void suggest_writeback_time(void);
+void suggest_pcie_aspm(void);
void suggest_usb_autosuspend(void);
void usb_activity_hint(void);
Index: misctips.c
===================================================================
--- misctips.c (revision 319)
+++ misctips.c (working copy)
@@ -252,3 +252,42 @@
}
fclose(file);
}
+
+void pcie_aspm_on(void)
+{
+ FILE *file;
+ file = fopen("/sys/module/pcie_aspm/parameters/policy", "w");
+ if (!file)
+ return;
+ fprintf(file, "powersave");
+ fclose(file);
+}
+
+void suggest_pcie_aspm(void)
+{
+ FILE *file;
+ char buffer[1024];
+ char *p = buffer;
+ file = fopen("/sys/module/pcie_aspm/parameters/policy", "r");
+ if (!file)
+ return;
+ if (!fgets(buffer, 1023, file)) {
+ fclose(file);
+ return;
+ }
+
+ /* The active mode is enclosed in brackets. Find it! */
+ while((*p != '[') && (*p != '\0'))
+ p++;
+
+ /* We didn't find any active mode */
+ if (*p == '\0')
+ return;
+
+ if ((!strncmp(++p, "default", 7)) || (!strncmp(p, "performance", 11))) {
+ add_suggestion( _("Suggestion: enable the PCI express ASPM with the following command:\n"
+ " echo powersave > /sys/module/pcie_aspm/parameters/policy\n"
+ "or by pressing the A key."), 10, 'A', _(" A - Enable PCI express ASPM"), pcie_aspm_on);
+ }
+ fclose(file);
+}
_______________________________________________
Power mailing list
[email protected]
http://www.bughost.org/mailman/listinfo/power