ArmPlatformPkg/Bds: Check OptionalData is not NULL before accessing it

Change-Id: Ia0be1e637baa4c9db4b85050df3f1fd65e3d37de
Format ArmPlatformPkg/Drivers/NorFlashDxe with consistent line endings

Use unix line endings for all lines in these files. It may be necessary
to run unix2dos before applying upstream patches in the future, and
then running dos2unix again to only get the new changes.

ObSheesh: Sheesh.

Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
Raise and lower TPL only while EFI is actually running

The NorFlash code uses the TPL to prevent other UEFI tasks from
interrupting while flash reprogramming is happening. Since TPL
depends on BootServices, attempting to alter the TPL after UEFI
has passed CPU control to Linux causes crashes. Put checks around
the TPL access stuff to prevent that from happening.

This patch allows EFI to reprogram the flash for EFI based updates
and allows Linux to update efiboot variables stored in flash.

Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>