4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Runtime memory status code worker.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This program and the accompanying materials
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync are licensed and made available under the terms and conditions of the BSD License
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync which accompanies this distribution. The full text of the license may be found at
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncRUNTIME_MEMORY_STATUSCODE_HEADER *mSmmMemoryStatusCodeTable;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Initialize SMM memory status code table as initialization for memory status code worker
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_SUCCESS SMM memory status code table successfully initialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Allocate SMM memory status code pool.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync mSmmMemoryStatusCodeTable = (RUNTIME_MEMORY_STATUSCODE_HEADER *)AllocateZeroPool (sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) + PcdGet16 (PcdStatusCodeMemorySize) * 1024);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync mSmmMemoryStatusCodeTable->MaxRecordsNumber = (PcdGet16 (PcdStatusCodeMemorySize) * 1024) / sizeof (MEMORY_STATUSCODE_RECORD);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Report status code into runtime memory. If the runtime pool is full, roll back to the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync first record and overwrite it.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param CodeType Indicates the type of status code being reported.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Value Describes the current status of a hardware or software entity.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This included information about the class and subclass that is used to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync classify the entity as well as an operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Instance The enumeration of a hardware or software entity within
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the system. Valid instance numbers start with 1.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param CallerId This optional parameter may be used to identify the caller.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This parameter allows the status code driver to apply different rules to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync different callers.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Data This optional parameter may be used to pass additional data.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_SUCCESS Status code successfully recorded in runtime memory status code table.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Locate current record buffer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Record = (MEMORY_STATUSCODE_RECORD *) (mSmmMemoryStatusCodeTable + 1);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Record = &Record[mSmmMemoryStatusCodeTable->RecordIndex++];
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Save status code.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // If record index equals to max record number, then wrap around record index to zero.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // The reader of status code should compare the number of records with max records number,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // If it is equal to or larger than the max number, then the wrap-around had happened,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // so the first record is pointed by record index.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // If it is less then max number, index of the first record is zero.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if (mSmmMemoryStatusCodeTable->RecordIndex == mSmmMemoryStatusCodeTable->MaxRecordsNumber) {
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Wrap around record index.