2017-04-18 22:16:26 +00:00
|
|
|
diff -u -x '*.d' -x '*.o' ../clean/flashrom-0.9.9/spi.c flashrom-0.9.9/spi.c
|
2017-04-18 22:01:21 +00:00
|
|
|
--- ../clean/flashrom-0.9.9/spi.c 2014-07-20 00:03:29.000000000 +0200
|
2017-04-18 22:16:26 +00:00
|
|
|
+++ flashrom-0.9.9/spi.c 2017-04-19 00:04:25.138374544 +0200
|
2017-03-30 18:35:30 +00:00
|
|
|
@@ -100,6 +100,20 @@
|
|
|
|
return spi_write_chunked(flash, buf, start, len, max_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
+static int my_ffs(int x)
|
|
|
|
+{
|
|
|
|
+ int rc = 0;
|
|
|
|
+ while(x)
|
|
|
|
+ {
|
|
|
|
+ if (x & 1)
|
|
|
|
+ return rc;
|
|
|
|
+ rc++;
|
|
|
|
+ x >>= 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
int spi_chip_read(struct flashctx *flash, uint8_t *buf, unsigned int start,
|
|
|
|
unsigned int len)
|
|
|
|
{
|
|
|
|
@@ -119,7 +133,7 @@
|
|
|
|
/* Check if alignment is native (at least the largest power of two which
|
|
|
|
* is a factor of the mapped size of the chip).
|
|
|
|
*/
|
|
|
|
- if (ffs(flash->chip->total_size * 1024) > (ffs(addrbase) ? : 33)) {
|
|
|
|
+ if (my_ffs(flash->chip->total_size * 1024) > (my_ffs(addrbase) ? : 33)) {
|
|
|
|
msg_perr("Flash chip is not aligned natively in the allowed "
|
|
|
|
"access window.\n");
|
|
|
|
msg_perr("Read will probably return garbage.\n");
|