sb600spi.c: Modify read() callback to memory map

This patch is sort of a hybrid from two previous patches that allows
it to be reasonably cleanly applied on ToT CrOS Flashrom.

Revert "sb600spi.c: Unwind CrOS performance hack causing invalid mmap"

This reverts commit 8510ab7e87a294ee28cb77408cd85610d8090b18.

After commit 12d8f836fa1b61af1bc97d773044910cdb8a2455 mmap should be
possible again even with this layering violation. However, this is
required until a proper fix is known and hardware is easier to
access to do testing with.

If spi drv like sb600spi.c are to layer violate with .read callback set
to the internal function `read_memmapped()` that dispatches mmap_reads
then we must hack read_from_flash() to map_flash() to avoid incuring an
invalid mmap().

BUG=b:157511574
BRANCH=none
TEST=verified to fix Vilboz+W25Q128JWPIM
TEST=`# flashrom -VV -p host -i COREBOOT:/tmp/flashrom_UmOklu -r` on
Grunt.

Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Change-Id: I0f3e2fc091444439d5eabcb46da95e9fbd331a66
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/flashrom/+/2517203
Tested-by: Frank Wu <frank_wu@compal.corp-partner.google.com>
Reviewed-by: Sam McNally <sammc@chromium.org>
Commit-Queue: Kangheui Won <khwon@chromium.org>
1 file changed
tree: 4d7c1bf04d4e21e60024e541a12453726a28de34
  1. Documentation/
  2. tests/
  3. util/
  4. .gitattributes
  5. .gitignore
  6. 82802ab.c
  7. action_descriptor.c
  8. action_descriptor.h
  9. amd_imc.c
  10. archtest.c
  11. at45db.c
  12. atahpt.c
  13. atapromise.c
  14. atavia.c
  15. big_lock.c
  16. big_lock.h
  17. bitbang_spi.c
  18. board_enable.c
  19. buspirate_spi.c
  20. cbtable.c
  21. ch341a_spi.c
  22. chipdrivers.h
  23. chipset_enable.c
  24. cli_classic.c
  25. cli_common.c
  26. cli_output.c
  27. COPYING
  28. coreboot_tables.h
  29. cros_alias.c
  30. cros_ec.c
  31. cros_ec.h
  32. cros_ec_commands.h
  33. cros_ec_dev.c
  34. custom_baud.c
  35. custom_baud.h
  36. dediprog.c
  37. developerbox_spi.c
  38. digilent_spi.c
  39. dmi.c
  40. drkaiser.c
  41. dummyflasher.c
  42. edi.c
  43. edi.h
  44. en29lv640b.c
  45. endiantest.c
  46. ene.h
  47. ene_lpc.c
  48. file.c
  49. file.h
  50. file_lock.c
  51. flash.h
  52. flashchips.c
  53. flashchips.h
  54. flashchips_hwseq.c
  55. flashrom.8.tmpl
  56. flashrom.c
  57. fmap.c
  58. fmap.h
  59. ft2232_spi.c
  60. gfxnvidia.c
  61. helpers.c
  62. hwaccess.c
  63. hwaccess.h
  64. i2c_helper.h
  65. i2c_helper_linux.c
  66. ich_descriptors.c
  67. ich_descriptors.h
  68. ichspi.c
  69. internal.c
  70. ipc_lock.h
  71. it8212.c
  72. it85spi.c
  73. it87spi.c
  74. jedec.c
  75. jlink_spi.c
  76. layout.c
  77. layout.h
  78. libflashrom.h
  79. linux_mtd.c
  80. linux_spi.c
  81. lspcon_i2c_spi.c
  82. m29f400bt.c
  83. Makefile
  84. mcp6x_spi.c
  85. mec1308.c
  86. meson.build
  87. meson_options.txt
  88. mstarddc_spi.c
  89. ni845x_spi.c
  90. nic3com.c
  91. nicintel.c
  92. nicintel_eeprom.c
  93. nicintel_spi.c
  94. nicnatsemi.c
  95. nicrealtek.c
  96. ogp_spi.c
  97. opaque.c
  98. os.h
  99. OWNERS
  100. pcidev.c
  101. physmap.c
  102. pickit2_spi.c
  103. platform.h
  104. pony_spi.c
  105. power.c
  106. power.h
  107. PRESUBMIT.cfg
  108. print.c
  109. print_wiki.c
  110. processor_enable.c
  111. programmer.c
  112. programmer.h
  113. raiden_debug_spi.c
  114. rayer_spi.c
  115. README.chromiumos
  116. realtek_mst_i2c_spi.c
  117. s25f.c
  118. satamv.c
  119. satasii.c
  120. sb600spi.c
  121. search.c
  122. search.h
  123. serial.c
  124. serprog.c
  125. serprog.h
  126. sfdp.c
  127. sharplhf00l04.c
  128. spi.c
  129. spi.h
  130. spi25.c
  131. spi25_statusreg.c
  132. spi4ba.c
  133. spi4ba.h
  134. spi95.c
  135. sst28sf040.c
  136. sst49lfxxxc.c
  137. sst_fwhub.c
  138. stlinkv3_spi.c
  139. stm50.c
  140. stm50flw0x0x.c
  141. udelay.c
  142. usb_device.c
  143. usb_device.h
  144. usbblaster_spi.c
  145. usbdev.c
  146. w29ee011.c
  147. w39.c
  148. wbsio_spi.c
  149. wpce775x.c
  150. writeprotect.c
  151. writeprotect.h