efi: Reset the SNP according to its state
Re-entering fastboot in the same boot fails to start the network with
DeviceError: dropping the previous session's EfiNetworkDevice leaves
the SNP in the Started state, where EDK2's SnpDxe fails Shutdown(), the
first call reset_simple_network() makes.
Read the state from the SNP mode and make only the calls that are valid
in it, failing on an out-of-spec state. Type the mode's state field as
a new EfiSimpleNetworkState enum of the same width, and test the reset
with a fake SNP that follows SnpDxe's state machine.
Bug: 582798239
Test: ./bootable/libbootloader/gbl/bazel.sh test @gbl//tests
Test: ./bootable/libbootloader/gbl/bazel.sh build @gbl//efi:x86_64_dev
Change-Id: I5b04ea806c9ca8533bc21f381a9ca63f61c9bc88
2 files changed