Hello,

My co-worker sent me a patch many months ago to forward upstream as
appropriate, but apparently I had forgotten to do so and now hit the bug
with my compiler version as well while testing something from SVN.

So attached is that patch now, so that flash chip detection would work
again on my Geode/CS5536 system.


PS: I'm not subscribed to flashrom list right now, so please CC me on
any replies


Regards,
Mart Raudsepp
msr_t memory layout may depend on compiler; with optimizations this
may lead to writing incorrect data to MSR.
Create a temporary buffer with correct layout to avoid this problem.

Signed-off-by: Anti Sullin <[email protected]>

---
diff -pur flashrom-091006/physmap.c flashrom-091006_/physmap.c
--- flashrom-091006/physmap.c	2009-10-06 13:42:22.000000000 +0300
+++ flashrom-091006_/physmap.c	2009-10-08 12:13:57.000000000 +0300
@@ -161,13 +161,17 @@ msr_t rdmsr(int addr)
 
 int wrmsr(int addr, msr_t msr)
 {
+	uint32_t buf[2];
+	buf[0] = msr.lo;
+	buf[1] = msr.hi;
+
 	if (lseek(fd_msr, (off_t) addr, SEEK_SET) == -1) {
 		perror("Could not lseek() to MSR");
 		close(fd_msr);
 		exit(1);
 	}
 
-	if (write(fd_msr, &msr, 8) != 8 && errno != EIO) {
+	if (write(fd_msr, buf, 8) != 8 && errno != EIO) {
 		perror("Could not write() MSR");
 		close(fd_msr);
 		exit(1);
_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to