A method for avoiding the possibility of corruption when updating vital
code such as boot code stored in nonvolatile memory of a unit, such as a
host bus adapter, or adapter circuitry integrated onto a motherboard, or
a computer system, is disclosed. Prior to updating the vital code, the
method determines if the attempted update is unnecessary or regressive by
reading and comparing the region version number in nonvolatile memory to
the version number in the update code. If the update is unnecessary, the
user is alerted. In addition, the method tests the ability to
update/write to the nonvolatile memory by performing a write test
operation to a less vital region prior to updating the vital region. The
less vital region may comprise a test region set aside in the nonvolatile
memory for performing write tests, or it may be an application region
reserved for storing application programs.