Commit 3697ac75 authored by Mart Raudsepp's avatar Mart Raudsepp Committed by Uwe Hermann
Browse files

Further cleanups to enable_flash_cs5536


 - Remove the "enable write to flash" message, as the caller appears to
   already report that.

 - Move the 'modprobe msr' suggestions to the first lseek64 error handling, as
   we get an error there already.

 - Rename a perror string from "read" to "read msr", as we use the latter
   already in this function for another read.

Corresponding to flashrom svn r195 and coreboot v2 svn r3101.
Signed-off-by: default avatarMart Raudsepp <mart.raudsepp@artecdesign.ee>
Acked-by: default avatarUwe Hermann <uwe@hermann-uwe.de>
parent 97866087
...@@ -259,18 +259,17 @@ static int enable_flash_cs5536(struct pci_dev *dev, const char *name) ...@@ -259,18 +259,17 @@ static int enable_flash_cs5536(struct pci_dev *dev, const char *name)
if (lseek64(fd_msr, (off64_t) MSR_RCONF_DEFAULT, SEEK_SET) == -1) { if (lseek64(fd_msr, (off64_t) MSR_RCONF_DEFAULT, SEEK_SET) == -1) {
perror("lseek64"); perror("lseek64");
printf("Cannot operate on MSR. Did you run 'modprobe msr'?\n");
close(fd_msr); close(fd_msr);
return -1; return -1;
} }
if (read(fd_msr, buf, 8) != 8) { if (read(fd_msr, buf, 8) != 8) {
perror("read"); perror("read msr");
close(fd_msr); close(fd_msr);
return -1; return -1;
} }
printf("Enabling Geode MSR to write to flash.\n");
if (buf[7] != 0x22) { if (buf[7] != 0x22) {
buf[7] &= 0xfb; buf[7] &= 0xfb;
if (lseek64(fd_msr, (off64_t) MSR_RCONF_DEFAULT, SEEK_SET) == -1) { if (lseek64(fd_msr, (off64_t) MSR_RCONF_DEFAULT, SEEK_SET) == -1) {
...@@ -281,7 +280,6 @@ static int enable_flash_cs5536(struct pci_dev *dev, const char *name) ...@@ -281,7 +280,6 @@ static int enable_flash_cs5536(struct pci_dev *dev, const char *name)
if (write(fd_msr, buf, 8) < 0) { if (write(fd_msr, buf, 8) < 0) {
perror("msr write"); perror("msr write");
printf("Cannot write to MSR. Did you run 'modprobe msr'?\n");
close(fd_msr); close(fd_msr);
return -1; return -1;
} }
...@@ -309,7 +307,6 @@ static int enable_flash_cs5536(struct pci_dev *dev, const char *name) ...@@ -309,7 +307,6 @@ static int enable_flash_cs5536(struct pci_dev *dev, const char *name)
} }
if (write(fd_msr, buf, 8) < 0) { if (write(fd_msr, buf, 8) < 0) {
perror("msr write"); perror("msr write");
printf("Cannot write to MSR. Did you run 'modprobe msr'?\n");
close(fd_msr); close(fd_msr);
return -1; return -1;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment