} // for\r
}\r
\r
+/**\r
+ Function to test if two Generic Timer Block Frame Info structures have the\r
+ same frame number.\r
+\r
+ @param [in] Frame1 Pointer to the first GT Block Frame Info\r
+ structure.\r
+ @param [in] Frame2 Pointer to the second GT Block Frame Info\r
+ structure.\r
+ @param [in] Index1 Index of Frame1 in the shared GT Block Frame\r
+ Information List.\r
+ @param [in] Index2 Index of Frame2 in the shared GT Block Frame\r
+ Information List.\r
+\r
+ @retval TRUE Frame1 and Frame2 have the same frame number.\r
+ @return FALSE Frame1 and Frame2 have different frame numbers.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+IsGtFrameNumberEqual (\r
+ IN CONST VOID * Frame1,\r
+ IN CONST VOID * Frame2,\r
+ IN UINTN Index1,\r
+ IN UINTN Index2\r
+ )\r
+{\r
+ UINT8 FrameNumber1;\r
+ UINT8 FrameNumber2;\r
+\r
+ ASSERT ((Frame1 != NULL) && (Frame2 != NULL));\r
+\r
+ FrameNumber1 = ((CM_ARM_GTBLOCK_TIMER_FRAME_INFO*)Frame1)->FrameNumber;\r
+ FrameNumber2 = ((CM_ARM_GTBLOCK_TIMER_FRAME_INFO*)Frame2)->FrameNumber;\r
+\r
+ if (FrameNumber1 == FrameNumber2) {\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "ERROR: GTDT: GT Block Frame Info Structures %d and %d have the same " \\r
+ "frame number: 0x%x.\n",\r
+ Index1,\r
+ Index2,\r
+ FrameNumber1\r
+ ));\r
+ return TRUE;\r
+ }\r
+\r
+ return FALSE;\r
+}\r
+\r
/** Update the GT Block Timer Frame lists in the GTDT Table.\r
\r
@param [in] GtBlockFrame Pointer to the GT Block Frames\r
Information List.\r
@param [in] GTBlockFrameCount Number of GT Block Frames.\r
\r
- @retval EFI_SUCCESS Table generated successfully.\r
- @retval EFI_INVALID_PARAMETER A parameter is invalid.\r
+ @retval EFI_SUCCESS Table generated successfully.\r
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.\r
**/\r
STATIC\r
EFI_STATUS\r
IN UINT32 GTBlockFrameCount\r
)\r
{\r
+ BOOLEAN IsFrameNumberDuplicated;\r
+\r
ASSERT (GtBlockFrame != NULL);\r
ASSERT (GTBlockTimerFrameList != NULL);\r
\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ IsFrameNumberDuplicated = FindDuplicateValue (\r
+ GTBlockTimerFrameList,\r
+ GTBlockFrameCount,\r
+ sizeof (CM_ARM_GTBLOCK_TIMER_FRAME_INFO),\r
+ IsGtFrameNumberEqual\r
+ );\r
+ // Duplicate entry was found so timer frame numbers provided are invalid\r
+ if (IsFrameNumberDuplicated) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
while (GTBlockFrameCount-- != 0) {\r
DEBUG ((\r
DEBUG_INFO,\r