diff options
author | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2012-09-04 01:49:49 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2012-09-04 01:49:49 +0000 |
commit | b66ba1e2c25033cd8b367efe88f97a1e5fd36dce (patch) | |
tree | a80421602494ad7747c1836fbd6bc2db11124097 | |
parent | bb4fed74b6432641fa3674511388498b43a3f428 (diff) | |
download | flashrom-b66ba1e2c25033cd8b367efe88f97a1e5fd36dce.tar.gz flashrom-b66ba1e2c25033cd8b367efe88f97a1e5fd36dce.tar.bz2 flashrom-b66ba1e2c25033cd8b367efe88f97a1e5fd36dce.zip |
Nvidia chipset enables: refactor setting bit 0 in 0x6d
This patch also changes semantics: previously failing to set this was interpreted as
a fatal error by enable_flash_ck804 and enable_flash_mcp55 although the output
indicated otherwise. Also, in enable_flash_nvidia_nforce2 there was no check
if settings the bit succeeds.
Now all methods check for success and return ERROR_NONFATAL on failure.
Corresponding to flashrom svn r1592.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
-rw-r--r-- | chipset_enable.c | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/chipset_enable.c b/chipset_enable.c index 03cb67e0..2e4a5fc9 100644 --- a/chipset_enable.c +++ b/chipset_enable.c @@ -968,19 +968,33 @@ static int enable_flash_sb600(struct pci_dev *dev, const char *name) return ret; } -static int enable_flash_nvidia_nforce2(struct pci_dev *dev, const char *name) +/* sets bit 0 in 0x6d */ +static int enable_flash_nvidia_common(struct pci_dev *dev, const char *name) { - uint8_t tmp; - - rpci_write_byte(dev, 0x92, 0); + uint8_t old, new; - tmp = pci_read_byte(dev, 0x6d); - tmp |= 0x01; - rpci_write_byte(dev, 0x6d, tmp); + old = pci_read_byte(dev, 0x6d); + new = old | 0x01; + if (new == old) + return 0; + rpci_write_byte(dev, 0x6d, new); + if (pci_read_byte(dev, 0x6d) != new) { + msg_pinfo("Setting register 0x6d to 0x%02x on %s failed.\n", new, name); + return 1; + } return 0; } +static int enable_flash_nvidia_nforce2(struct pci_dev *dev, const char *name) +{ + rpci_write_byte(dev, 0x92, 0); + if (enable_flash_nvidia_common(dev, name)) + return ERROR_NONFATAL; + else + return 0; +} + static int enable_flash_ck804(struct pci_dev *dev, const char *name) { uint8_t old, new; @@ -1001,19 +1015,10 @@ static int enable_flash_ck804(struct pci_dev *dev, const char *name) } } - old = pci_read_byte(dev, 0x6d); - new = old | 0x01; - if (new == old) + if (enable_flash_nvidia_common(dev, name)) + return ERROR_NONFATAL; + else return 0; - rpci_write_byte(dev, 0x6d, new); - - if (pci_read_byte(dev, 0x6d) != new) { - msg_pinfo("Setting register 0x%x to 0x%x on %s failed " - "(WARNING ONLY).\n", 0x6d, new, name); - return -1; - } - - return 0; } static int enable_flash_osb4(struct pci_dev *dev, const char *name) @@ -1071,7 +1076,7 @@ static int enable_flash_sb400(struct pci_dev *dev, const char *name) static int enable_flash_mcp55(struct pci_dev *dev, const char *name) { - uint8_t old, new, val; + uint8_t val; uint16_t wordval; /* Set the 0-16 MB enable bits. */ @@ -1085,19 +1090,10 @@ static int enable_flash_mcp55(struct pci_dev *dev, const char *name) wordval |= 0x7fff; /* 16M */ rpci_write_word(dev, 0x90, wordval); - old = pci_read_byte(dev, 0x6d); - new = old | 0x01; - if (new == old) + if (enable_flash_nvidia_common(dev, name)) + return ERROR_NONFATAL; + else return 0; - rpci_write_byte(dev, 0x6d, new); - - if (pci_read_byte(dev, 0x6d) != new) { - msg_pinfo("Setting register 0x%x to 0x%x on %s failed " - "(WARNING ONLY).\n", 0x6d, new, name); - return -1; - } - - return 0; } /* |