- LoadOptions = EfiBootManagerGetLoadOptions (&LoadOptionCount, LoadOptionTypePlatformRecovery);\r
- if (EfiBootManagerFindLoadOption (&LoadOption, LoadOptions, LoadOptionCount) == -1) {\r
- for (Index = 0; Index < LoadOptionCount; Index++) {\r
- //\r
- // The PlatformRecovery#### options are sorted by OptionNumber.\r
- // Find the the smallest unused number as the new OptionNumber.\r
- //\r
- if (LoadOptions[Index].OptionNumber != Index) {\r
- break;\r
+\r
+ //\r
+ // System firmware must include a PlatformRecovery#### variable specifying\r
+ // a short-form File Path Media Device Path containing the platform default\r
+ // file path for removable media if the platform supports Platform Recovery.\r
+ //\r
+ if (PcdGetBool (PcdPlatformRecoverySupport)) {\r
+ LoadOptions = EfiBootManagerGetLoadOptions (&LoadOptionCount, LoadOptionTypePlatformRecovery);\r
+ if (EfiBootManagerFindLoadOption (&PlatformDefaultBootOption, LoadOptions, LoadOptionCount) == -1) {\r
+ for (Index = 0; Index < LoadOptionCount; Index++) {\r
+ //\r
+ // The PlatformRecovery#### options are sorted by OptionNumber.\r
+ // Find the the smallest unused number as the new OptionNumber.\r
+ //\r
+ if (LoadOptions[Index].OptionNumber != Index) {\r
+ break;\r
+ }\r