Move flash search code into a separate file (2nd attempt)

At present we have an algorithm which searches through the flash looking
for an FMAP signature. We want to use it to search for other things also,
such as an FDTMAP.

Move this useful algorithm into its own module, and adjust the API so that
callers can repeatedly call it and it will return a new offset to check,
each time. Then adjust the fmap code to use this new function.

Note: This is a re-hash of Simon's original CL. This version uses
read_flash() to avoid aborting prematurely due to searching locked
regions on Intel platforms with a management engine.

BUG=chromium-os:38794
BRANCH=none
TEST=Partial read of FRID region on Stumpy, observed ME region access
     errors being ignored.

Change-Id: I344ae9998ae65cc45b8b35024adb4bd224571814
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45276
6 files changed