[flashrom] [PATCH] Use read-only mappings for DMI tables everywhere.
Stefan Tauner
stefan.tauner at student.tuwien.ac.at
Thu Feb 20 20:42:39 CET 2014
R/W mappings cause explosions sometimes.
Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
---
Simply rename (and refine) physmap_round to physmap_ro_round because dmi
is the only user anyway.
The patch was tested on real hardware that had problems without it.
W/o patch:
http://paste.flashrom.org/view.php?id=1983
With patch:
http://paste.flashrom.org/view.php?id=1990
Without vetoes I will commit this soonish.
dmi.c | 2 +-
physmap.c | 4 ++--
programmer.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dmi.c b/dmi.c
index ef7ae2c..708e2b2 100644
--- a/dmi.c
+++ b/dmi.c
@@ -153,7 +153,7 @@ static void dmi_table(uint32_t base, uint16_t len, uint16_t num)
{
int i = 0, j = 0;
- uint8_t *dmi_table_mem = physmap_round("DMI Table", base, len);
+ uint8_t *dmi_table_mem = physmap_ro_round("DMI Table", base, len);
if (dmi_table_mem == NULL) {
msg_perr("Unable to access DMI Table\n");
return;
diff --git a/physmap.c b/physmap.c
index 9638c78..ad7586e 100644
--- a/physmap.c
+++ b/physmap.c
@@ -318,9 +318,9 @@ void *rphysmap(const char *descr, uintptr_t phys_addr, size_t len)
return physmap_common(descr, phys_addr, len, PHYSM_RW, PHYSM_CLEANUP, PHYSM_ROUND);
}
-void *physmap_round(const char *descr, uintptr_t phys_addr, size_t len)
+void *physmap_ro_round(const char *descr, uintptr_t phys_addr, size_t len)
{
- return physmap_common(descr, phys_addr, len, PHYSM_RW, PHYSM_NOCLEANUP, PHYSM_ROUND);
+ return physmap_common(descr, phys_addr, len, PHYSM_RO, PHYSM_NOCLEANUP, PHYSM_ROUND);
}
void *physmap_ro(const char *descr, uintptr_t phys_addr, size_t len)
diff --git a/programmer.h b/programmer.h
index 0c51f58..f08286a 100644
--- a/programmer.h
+++ b/programmer.h
@@ -277,7 +277,7 @@ int processor_flash_enable(void);
/* physmap.c */
void *physmap(const char *descr, uintptr_t phys_addr, size_t len);
void *rphysmap(const char *descr, uintptr_t phys_addr, size_t len);
-void *physmap_round(const char *descr, uintptr_t phys_addr, size_t len);
+void *physmap_ro_round(const char *descr, uintptr_t phys_addr, size_t len);
void *physmap_ro(const char *descr, uintptr_t phys_addr, size_t len);
void physunmap(void *virt_addr, size_t len);
#if CONFIG_INTERNAL == 1
--
Kind regards, Stefan Tauner
More information about the flashrom
mailing list