Contributor
Aarya

GSoC Project Proposal for Flashrom


Mentors
Thomas Heijligen, Simon_B
Organization
Flashrom
Technologies
c, x86, bios, rom, spi, flash
Topics
Optimize Erase-Function Selection
The write operation in flash can only change bits in a specific way and the erase operation changes all the bits of a block to 1s. So to modify any bit the whole block needs to be copied to another memory, erased on the flash, and then copied again from the other memory with the change. Due to this “erase overhead” write operations may require copying a lot of data to modify a small amount. Most flash chips support multiple erase-block sizes and flashrom keeps a list of these sizes and ranges for all supported flash chips. Currently, flashrom tries these functions one by one and uses the same function until the operation is completed or an error occurs. Usually, the first function works correctly but this function erases the smallest erase-block so flashrom would have to use it multiple times to complete the erase operation on a large region, which could have been done more efficiently using functions using larger erase-blocks, thus resulting in a transaction overhead. If a large erase-block size to erase a small region is chosen it would result in a larger erase overhead. So the erase-block size should be picked according to the size of the region left to be erased. Also checking in advance to tell if the programmer supports the given erase function and then sorting the supported functions in order of the erase-block sizes can further help the function selection.