[flashrom] [commit] r1895 - trunk
repository service
svn at flashrom.org
Tue Jun 30 01:24:23 CEST 2015
Author: stefanct
Date: Tue Jun 30 01:24:23 2015
New Revision: 1895
URL: http://flashrom.org/trac/flashrom/changeset/1895
Log:
serprog: Fix FWH/LPC by implementing serprog_map.
The serprog protocol does only transmit 24 bit-wide address and ignores the
top 8 bit. This is fine as long as the underlying hardware ignores the latter
anyway (which is the case for parallel chips that even lack the respective pins).
FWH/LPC chips, however, operate on a full 32-bit (LPC) or 28-bit (FWH) address
space and would fail with the fallback mapping to NULL.
Signed-off-by: Urja Rannikko <urjaman at gmail.com>
Acked-by: Stefan Tauner <stefan.tauner at alumni.tuwien.ac.at>
Modified:
trunk/flashrom.c
trunk/programmer.h
trunk/serprog.c
Modified: trunk/flashrom.c
==============================================================================
--- trunk/flashrom.c Sun Jun 28 15:31:19 2015 (r1894)
+++ trunk/flashrom.c Tue Jun 30 01:24:23 2015 (r1895)
@@ -212,7 +212,7 @@
/* FIXME */
.devs.note = "All programmer devices speaking the serprog protocol\n",
.init = serprog_init,
- .map_flash_region = fallback_map,
+ .map_flash_region = serprog_map,
.unmap_flash_region = fallback_unmap,
.delay = serprog_delay,
},
Modified: trunk/programmer.h
==============================================================================
--- trunk/programmer.h Sun Jun 28 15:31:19 2015 (r1894)
+++ trunk/programmer.h Tue Jun 30 01:24:23 2015 (r1895)
@@ -706,6 +706,7 @@
#if CONFIG_SERPROG == 1
int serprog_init(void);
void serprog_delay(unsigned int usecs);
+void *serprog_map(const char *descr, uintptr_t phys_addr, size_t len);
#endif
/* serial.c */
Modified: trunk/serprog.c
==============================================================================
--- trunk/serprog.c Sun Jun 28 15:31:19 2015 (r1894)
+++ trunk/serprog.c Tue Jun 30 01:24:23 2015 (r1895)
@@ -943,3 +943,19 @@
}
return 0;
}
+
+void *serprog_map(const char *descr, uintptr_t phys_addr, size_t len)
+{
+ /* Serprog transmits 24 bits only and assumes the underlying implementation handles any remaining bits
+ * correctly (usually setting them to one either in software (for FWH/LPC) or relying on the fact that
+ * the hardware observes a subset of the address bits only). Combined with the standard mapping of
+ * flashrom this creates a 16 MB-wide window just below the 4 GB boundary where serprog can operate (as
+ * needed for non-SPI chips). Below we make sure that the requested range is within this window. */
+ if ((phys_addr & 0xFF000000) == 0xFF000000) {
+ return (void*)phys_addr;
+ } else {
+ msg_pwarn(MSGHEADER "requested mapping %s is incompatible: 0x%zx bytes at 0x%0*" PRIxPTR ".\n",
+ descr, len, PRIxPTR_WIDTH, phys_addr);
+ return NULL;
+ }
+}
More information about the flashrom
mailing list