- //\r
- // Register FtwNotificationEvent () notify function.\r
- //\r
- Status = gMmst->MmRegisterProtocolNotify (\r
- &gEfiSmmFaultTolerantWriteProtocolGuid,\r
- SmmFtwNotificationEvent,\r
- &SmmFtwRegistration\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- SmmFtwNotificationEvent (NULL, NULL, NULL);\r
+ if (!PcdGetBool (PcdEmuVariableNvModeEnable)) {\r
+ //\r
+ // Register FtwNotificationEvent () notify function.\r
+ //\r
+ Status = gMmst->MmRegisterProtocolNotify (\r
+ &gEfiSmmFaultTolerantWriteProtocolGuid,\r
+ SmmFtwNotificationEvent,\r
+ &SmmFtwRegistration\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ SmmFtwNotificationEvent (NULL, NULL, NULL);\r
+ } else {\r
+ //\r
+ // Emulated non-volatile variable mode does not depend on FVB and FTW.\r
+ //\r
+ VariableWriteServiceInitializeSmm ();\r
+ }\r