writeprotect, flashchips: clean up writeprotect fields

This patch deletes old `.wp` entries from the flashchips.c table
and creates a new function, `get_wp_for_flashchip()`, which finds
the appropriate `struct wp` instance for the chip. The `.wp` entry
was used in cli_classic.c, which has been updated accordingly.

`struct flashchip` still contains the `.wp` field, as it is currently
used by the linux_mtd and cros_ec programmers to override writeprotect.c
with their own functionality. This should be cleaned up in the future,
so the wp field can be deleted. However, this patch still significantly
reduces the overall diff with upstream.

The process of researching and verifying this change revealed several
inconsistent and redundant definitions, such as flashchips with `.wp`
fields that did not have any range entries in writeprotect.c and
flashchips that are handled in both the w25 and generic range table
lookup functions. These have all been resolved so as to avoid any change
in the wp field that is associated with each chip, and have been noted
in get_wp_for_flashchip() so they can be fixed later.

BUG=b:166294558
BRANCH=none
TEST=builds

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