Attempt to disable SMM write protection when it's enabled.

BUG=chrome-os-partner:6166
TEST=use flashrom to flash an image on coreboot/stumpy/lumpy and see it
     succeed.

Change-Id: I3ec57ac788dc651092e45ca38f9573e546359dae
Reviewed-on: http://gerrit.chromium.org/gerrit/9948
Tested-by: Stefan Reinauer <reinauer@google.com>
Commit-Ready: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
diff --git a/chipset_enable.c b/chipset_enable.c
index 9941fc8..9bd59f1 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -257,6 +257,7 @@
 	 * just treating it as 8 bit wide seems to work fine in practice.
 	 */
 	old = pci_read_byte(dev, bios_cntl);
+	new = old;
 
 	msg_pdbg("\nBIOS Lock Enable: %sabled, ",
 		     (old & (1 << 1)) ? "en" : "dis");
@@ -272,9 +273,13 @@
 	 * In earlier chipsets this bit is reserved. */
 	if (old & (1 << 5)) {
 		msg_pinfo("WARNING: BIOS region SMM protection is enabled!\n");
+		msg_pdbg("Trying to clear BIOS region SMM protection.\n");
+		new &= ~(1 << 5);
 	}
 
-	new = old | 1;
+	new |= (1 << 0);
+
+	/* Only write the register if it's necessary */
 	if (new == old)
 		return 0;