HomeFreeBSD

MFC r331123, r331126, r331129, r331132, r331136, r331138-r331139, r331141

Description

MFC r331123, r331126, r331129, r331132, r331136, r331138-r331139, r331141

r331123:
Do not overwrite the contents of BIO_WRITE buffers. SPI inherently
transfers data in both directions at once. When writing to the device,
use a dummy buffer for the incoming data, not the same buffer as the
outgoing data. Writes are done in FLASH_PAGE_SIZE chunks, which is only
256 bytes, so just put the dummy buffer into the softc.

r331126:
Remove a pointless KASSERT and reword a comment a bit. The KASSERT tested
for the same condition that the preceeding lines checked for and would have
returned EIO, so the assert could never possibly trigger (sc_sectorsize must
inherently be an integer multiple of FLASH_PAGE_SIZE).

r331129:
Eliminate some unneeded intermediate variables. Eliminate some redundant
parens in shift-and-mask expressions. Reword and reflow some comments.

r331132:
Bugfix: wait for writes/erases to complete after starting them, instead of
before starting them.

Using the wait-before logic would make sense if there was useful time-
consuming work that could be done between the end of one write and the
beginning of the next, but it also requires doing the wait-for-ready before
reading, because a prior write or erase could still be in progress. Reading
is the far more common case, so adding a whole extra bus transaction to
check for ready before each read would soak up any small gains that might be
had from doing async writes.

r331136:
Add sc_parent to the softc and use it in place of device_get_parent() calls
all over the place. Also pass the softc as the arg to all the internal
functions instead of passing a device_t and calling device_get_softc() in
each function.

r331138:
Make all internal routines return an int error status, and check the
status at all call points. Combine the get_status and wait_for_ready
routines, since waiting for ready is the only reason to ever get status.

r331139:
Add support for 4K and 32K erase block sizes. Many of the supported chips
have these flags set in the ident table, but there was no code to support
using the smaller erase sizes.

r331141:
Add the device/chip type to the disk d_descr field, and print more info
about the chip including the erase block size at attach time.

Also add myself to the copyrights since at this point svn blame would point
to me as the culprit for much of this.

Details

Provenance
ianAuthored on
Parents
rS331522: MFC r331068:
Branches
Unknown
Tags
Unknown