/** @file\r
- Runtime memory status code worker in DXE.\r
+ Runtime memory status code worker.\r
\r
- Copyright (c) 2006, Intel Corporation \r
+ Copyright (c) 2006 - 2009, Intel Corporation \r
All rights reserved. This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
\r
- Module Name: RtMemoryStatusCodeWorker.c\r
-\r
**/\r
\r
#include "DxeStatusCode.h"\r
\r
+RUNTIME_MEMORY_STATUSCODE_HEADER *mRtMemoryStatusCodeTable;\r
+\r
/**\r
- Initialize runtime memory status code.\r
+ Initialize runtime memory status code table as initialization for runtime memory status code worker\r
\r
- @return The function always return EFI_SUCCESS\r
+ @retval EFI_SUCCESS Runtime memory status code table successfully initialized.\r
\r
**/\r
EFI_STATUS\r
VOID\r
)\r
{\r
- RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable;\r
-\r
//\r
// Allocate runtime memory status code pool.\r
//\r
- RtMemoryStatusCodeTable = \r
- (RUNTIME_MEMORY_STATUSCODE_HEADER *) AllocatePool (\r
- sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) +\r
- PcdGet16 (PcdStatusCodeRuntimeMemorySize) *\r
- 1024\r
- );\r
-\r
- ASSERT (NULL != RtMemoryStatusCodeTable);\r
-\r
- RtMemoryStatusCodeTable->RecordIndex = 0;\r
- RtMemoryStatusCodeTable->NumberOfRecords = 0;\r
- RtMemoryStatusCodeTable->MaxRecordsNumber = \r
+ mRtMemoryStatusCodeTable = AllocateRuntimePool (\r
+ sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) +\r
+ PcdGet16 (PcdStatusCodeRuntimeMemorySize) *\r
+ 1024\r
+ );\r
+ ASSERT (mRtMemoryStatusCodeTable != NULL);\r
+\r
+ mRtMemoryStatusCodeTable->RecordIndex = 0;\r
+ mRtMemoryStatusCodeTable->NumberOfRecords = 0;\r
+ mRtMemoryStatusCodeTable->MaxRecordsNumber = \r
(PcdGet16 (PcdStatusCodeRuntimeMemorySize) * 1024) / sizeof (MEMORY_STATUSCODE_RECORD);\r
\r
- gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE] = RtMemoryStatusCodeTable;\r
return EFI_SUCCESS;\r
}\r
\r
Report status code into runtime memory. If the runtime pool is full, roll back to the \r
first record and overwrite it.\r
\r
- @param RtMemoryStatusCodeTable \r
- Point to Runtime memory table header.\r
-\r
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r
- \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
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below. \r
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r
- \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 CodeType 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\r
+ classify the entity as well as an operation.\r
+ @param Instance The enumeration of a hardware or software entity within\r
+ the system. Valid instance numbers start with 1.\r
\r
- @return The function always return EFI_SUCCESS.\r
+ @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.\r
\r
**/\r
EFI_STATUS\r
RtMemoryStatusCodeReportWorker (\r
- RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable,\r
IN EFI_STATUS_CODE_TYPE CodeType,\r
IN EFI_STATUS_CODE_VALUE Value,\r
IN UINT32 Instance\r
{\r
MEMORY_STATUSCODE_RECORD *Record;\r
\r
- ASSERT (NULL != RtMemoryStatusCodeTable);\r
-\r
//\r
// Locate current record buffer.\r
//\r
- Record = (MEMORY_STATUSCODE_RECORD *) (RtMemoryStatusCodeTable + 1);\r
- Record = &Record[RtMemoryStatusCodeTable->RecordIndex++];\r
+ Record = (MEMORY_STATUSCODE_RECORD *) (mRtMemoryStatusCodeTable + 1);\r
+ Record = &Record[mRtMemoryStatusCodeTable->RecordIndex++];\r
\r
//\r
// Save status code.\r
//\r
- Record->CodeType = CodeType;\r
- Record->Value = Value;\r
- Record->Instance = Instance;\r
+ Record->CodeType = CodeType;\r
+ Record->Value = Value;\r
+ Record->Instance = Instance;\r
\r
//\r
- // Record total number of records, we compare the number with max records number,\r
- // if it is bigger than the max number, then the roll back had happened, the record index points to \r
- // the first record. if it is less then max number, then the zero index is the first record.\r
+ // If record index equals to max record number, then wrap around record index to zero.\r
+ //\r
+ // The reader of status code should compare the number of records with max records number,\r
+ // If it is equal to or larger than the max number, then the wrap-around had happened,\r
+ // so the first record is pointed by record index.\r
+ // If it is less then max number, index of the first record is zero.\r
//\r
- RtMemoryStatusCodeTable->NumberOfRecords++;\r
- if (RtMemoryStatusCodeTable->RecordIndex == RtMemoryStatusCodeTable->MaxRecordsNumber) {\r
+ mRtMemoryStatusCodeTable->NumberOfRecords++;\r
+ if (mRtMemoryStatusCodeTable->RecordIndex == mRtMemoryStatusCodeTable->MaxRecordsNumber) {\r
//\r
- // Roll back record index.\r
+ // Wrap around record index.\r
//\r
- RtMemoryStatusCodeTable->RecordIndex = 0;\r
+ mRtMemoryStatusCodeTable->RecordIndex = 0;\r
}\r
\r
return EFI_SUCCESS;\r