-EFI_EVENT mVirtualAddressChangeEvent;\r
-EFI_EVENT mExitBootServicesEvent;\r
-EFI_STATUS_CODE_DATA *mStatusCodeData;\r
-BOOLEAN mInSmm;\r
-EFI_SMM_BASE_PROTOCOL *mSmmBase;\r
-EFI_RUNTIME_SERVICES *mInternalRT;\r
-BOOLEAN mHaveExitedBootServices = FALSE;\r
-EFI_REPORT_STATUS_CODE mReportStatusCode = NULL;\r
+EFI_EVENT mVirtualAddressChangeEvent;\r
+EFI_EVENT mExitBootServicesEvent;\r
+EFI_STATUS_CODE_DATA *mStatusCodeData;\r
+BOOLEAN mInSmm;\r
+EFI_SMM_BASE_PROTOCOL *mSmmBase;\r
+EFI_RUNTIME_SERVICES *mInternalRT;\r
+BOOLEAN mHaveExitedBootServices = FALSE;\r
+EFI_REPORT_STATUS_CODE mReportStatusCode = NULL;\r
+EFI_SMM_STATUS_CODE_PROTOCOL *mSmmStatusCodeProtocol;\r
+\r
+/**\r
+ Locates and caches SMM Status Code Protocol.\r
+ \r
+**/\r
+VOID\r
+SmmStatusCodeInitialize (\r
+ VOID\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ Status = gBS->LocateProtocol (&gEfiSmmStatusCodeProtocolGuid, NULL, (VOID **) &mSmmStatusCodeProtocol);\r
+ if (EFI_ERROR (Status)) {\r
+ mSmmStatusCodeProtocol = NULL;\r
+ }\r
+}\r
+\r
+/**\r
+ Report status code via SMM Status Code Protocol.\r
+ \r
+ @param Type Indicates the type of status code being reported.\r
+ @param Value Describes the current status of a hardware or software entity. \r
+ This included information about the class and subclass that is used to classify the entity \r
+ as well as an operation. For progress codes, the operation is the current activity. \r
+ For error codes, it is the exception. For debug codes, it is not defined at this time. \r
+ @param Instance The enumeration of a hardware or software entity within the system. \r
+ A system may contain multiple entities that match a class/subclass pairing. \r
+ The instance differentiates between them. An instance of 0 indicates that instance information is unavailable, \r
+ not meaningful, or not relevant. Valid instance numbers start with 1.\r
+ @param CallerId This optional parameter may be used to identify the caller. \r
+ This parameter allows the status code driver to apply different rules to different callers. \r
+ @param Data This optional parameter may be used to pass additional data\r
+ \r
+ @retval EFI_SUCCESS Always return EFI_SUCCESS.\r
+\r
+**/\r
+EFI_STATUS\r
+SmmStatusCodeReport (\r
+ IN EFI_STATUS_CODE_TYPE Type,\r
+ IN EFI_STATUS_CODE_VALUE Value,\r
+ IN UINT32 Instance,\r
+ IN EFI_GUID *CallerId OPTIONAL,\r
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r
+ )\r
+{\r
+ if (mSmmStatusCodeProtocol != NULL) {\r
+ (mSmmStatusCodeProtocol->ReportStatusCode) (mSmmStatusCodeProtocol, Type, Value, Instance, CallerId, Data);\r
+ }\r
+ return EFI_SUCCESS;\r
+}\r