/* Add a new entry for CmArmPccSubspace at Index. */
STATIC EFI_STATUS EFIAPI MappingTableAdd(IN MAPPING_TABLE *MappingTable, IN VOID *CmArmPccSubspace, IN UINT32 Index)
/* Add a new entry for CmArmPccSubspace at Index. */
STATIC EFI_STATUS EFIAPI MappingTableAdd(IN MAPPING_TABLE *MappingTable, IN VOID *CmArmPccSubspace, IN UINT32 Index)
{
  if ((MappingTable == NULL)        ||
      (MappingTable->Table == NULL) ||
      (CmArmPccSubspace == NULL))
  {
    ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER);
    return EFI_INVALID_PARAMETER;
  }
  if ((Index >= MappingTable->MaxIndex) ||
      (MappingTable->Table[Index] != 0))
  {
    ASSERT_EFI_ERROR (EFI_BUFFER_TOO_SMALL);
    return EFI_BUFFER_TOO_SMALL;
  }
  MappingTable->Table[Index] = CmArmPccSubspace;
  return EFI_SUCCESS;
}