[flashrom] [PATCH] Undo all PCI writes on shutdown

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Tue Nov 9 10:08:15 CET 2010


Undo all PCI config space writes on shutdown.
This means all chipset enables etc. will be undone on shutdown.
Any writes which are one-shot should use the permanent ppci_write_*
variants.

Extend the number of available register_shutdown slots to 32.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>

Index: flashrom-const_strlen/processor_enable.c
===================================================================
--- flashrom-const_strlen/processor_enable.c	(Revision 1225)
+++ flashrom-const_strlen/processor_enable.c	(Arbeitskopie)
@@ -56,13 +56,13 @@
 		while (*ptr && isspace((unsigned char)*ptr))
 			ptr++;
 		/* "cpu" part appears only with some Linux versions.  */
-		if (strncmp(ptr, "cpu", sizeof("cpu") - 1) == 0)
-			ptr += sizeof("cpu") - 1;
+		if (strncmp(ptr, "cpu", strlen("cpu")) == 0)
+			ptr += strlen("cpu");
 		while (*ptr && isspace((unsigned char)*ptr))
 			ptr++;
-		if (strncmp(ptr, "model", sizeof("model") - 1) != 0)
+		if (strncmp(ptr, "model", strlen("model")) != 0)
 			continue;
-		ptr += sizeof("model") - 1;
+		ptr += strlen("model");
 		while (*ptr && isspace((unsigned char)*ptr))
 			ptr++;
 		if (*ptr != ':')
@@ -72,9 +72,9 @@
 			ptr++;
 		fclose(cpuinfo);
 		return (strncmp(ptr, "ICT Loongson-2 V0.3",
-				sizeof("ICT Loongson-2 V0.3") - 1) == 0)
+				strlen("ICT Loongson-2 V0.3")) == 0)
 		    || (strncmp(ptr, "Godson2 V0.3  FPU V0.1",
-				sizeof("Godson2 V0.3  FPU V0.1") - 1) == 0);
+				strlen("Godson2 V0.3  FPU V0.1")) == 0);
 	}
 	fclose(cpuinfo);
 	return 0;


-- 
http://www.hailfinger.org/





More information about the flashrom mailing list