]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/DataHubDxe/DataHub.c
Fix bug in DataHub where it would skip the first record in a set when a filter is...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / DataHubDxe / DataHub.c
index b58de9db6fe8275ac65e85fbef3f9223f252418c..e4dfa29d69f0b5a9b497b5a38ada9cf30dcbf32f 100644 (file)
@@ -1,18 +1,9 @@
-/**@file\r
+/** @file\r
   This code produces the Data Hub protocol. It preloads the data hub\r
   with status information copied in from PEI HOBs.\r
   \r
-  Only code that implements the Data Hub protocol should go in this file!\r
-\r
-  The Term MTC stands for MonoTonicCounter. \r
-\r
-  For more information please look at DataHub.doc\r
-\r
-  NOTE: For extra security of the log GetNextDataRecord () could return a copy\r
-        of the data record.\r
-  \r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \r
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+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
 http://opensource.org/licenses/bsd-license.php                                            \r
@@ -27,42 +18,24 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 CONST EFI_GUID gZeroGuid  = { 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 } };\r
 \r
 //\r
-// Module Global:\r
 //  Since this driver will only ever produce one instance of the Logging Hub\r
 //  protocol you are not required to dynamically allocate the PrivateData.\r
 //\r
 DATA_HUB_INSTANCE mPrivateData;\r
 \r
-//\r
-// Worker functions private to this file\r
-//\r
-DATA_HUB_FILTER_DRIVER  *\r
-FindFilterDriverByEvent (\r
-  IN  LIST_ENTRY      *Head,\r
-  IN  EFI_EVENT       Event\r
-  );\r
-\r
-EFI_DATA_RECORD_HEADER  *\r
-GetNextDataRecord (\r
-  IN  LIST_ENTRY          *Head,\r
-  IN  UINT64              ClassFilter,\r
-  IN OUT  UINT64          *PtrCurrentMTC\r
-  );\r
-\r
 /**\r
-\r
   Log data record into the data logging hub\r
 \r
-  @param This                - Protocol instance structure\r
-  @param DataRecordGuid      - GUID that defines record contents\r
-  @param ProducerName        - GUID that defines the name of the producer of the data\r
-  @param DataRecordClass     - Class that defines generic record type\r
-  @param RawData             - Data Log record as defined by DataRecordGuid\r
-  @param RawDataSize         - Size of Data Log data in bytes\r
+  @param This                   Protocol instance structure\r
+  @param DataRecordGuid         GUID that defines record contents\r
+  @param ProducerName           GUID that defines the name of the producer of the data\r
+  @param DataRecordClass        Class that defines generic record type\r
+  @param RawData                Data Log record as defined by DataRecordGuid\r
+  @param RawDataSize            Size of Data Log data in bytes\r
 \r
-  @retval EFI_SUCCESS           If data was logged\r
-  @retval EFI_OUT_OF_RESOURCES  If data was not logged due to lack of system \r
-                                  resources.\r
+  @retval EFI_SUCCESS           If data was logged\r
+  @retval EFI_OUT_OF_RESOURCES  If data was not logged due to lack of system \r
+                                resources.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -126,7 +99,7 @@ DataHubLogData (
   // Build Standard Log Header\r
   //\r
   Record->Version     = EFI_DATA_RECORD_HEADER_VERSION;\r
-  Record->HeaderSize  = sizeof (EFI_DATA_RECORD_HEADER);\r
+  Record->HeaderSize  = (UINT16) sizeof (EFI_DATA_RECORD_HEADER);\r
   Record->RecordSize  = RecordSize;\r
   CopyMem (&Record->DataRecordGuid, DataRecordGuid, sizeof (EFI_GUID));\r
   CopyMem (&Record->ProducerName, ProducerName, sizeof (EFI_GUID));\r
@@ -156,7 +129,7 @@ DataHubLogData (
   //  in the record's class and guid.\r
   //\r
   Head = &Private->FilterDriverListHead;\r
-  for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {\r
+  for (Link = GetFirstNode(Head); Link != Head; Link = GetNextNode(Head, Link)) {\r
     FilterEntry = FILTER_ENTRY_FROM_LINK (Link);\r
     if (((FilterEntry->ClassFilter & DataRecordClass) != 0) &&\r
         (CompareGuid (&FilterEntry->FilterDataRecordGuid, &gZeroGuid) || \r
@@ -168,6 +141,110 @@ DataHubLogData (
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Search the Head doubly linked list for the passed in MTC. Return the \r
+  matching element in Head and the MTC on the next entry.\r
+\r
+  @param Head             Head of Data Log linked list.\r
+  @param ClassFilter      Only match the MTC if it is in the same Class as the\r
+                          ClassFilter.\r
+  @param PtrCurrentMTC    On IN contians MTC to search for. On OUT contians next\r
+                          MTC in the data log list or zero if at end of the list.\r
+  \r
+  @retval EFI_DATA_LOG_ENTRY  Return pointer to data log data from Head list.\r
+  @retval NULL                If no data record exists.\r
+\r
+**/\r
+EFI_DATA_RECORD_HEADER *\r
+GetNextDataRecord (\r
+  IN  LIST_ENTRY          *Head,\r
+  IN  UINT64              ClassFilter,\r
+  IN OUT  UINT64          *PtrCurrentMTC\r
+  )\r
+\r
+{\r
+  EFI_DATA_ENTRY          *LogEntry;\r
+  LIST_ENTRY              *Link;\r
+  BOOLEAN                 ReturnFirstEntry;\r
+  EFI_DATA_RECORD_HEADER  *Record;\r
+  EFI_DATA_ENTRY          *NextLogEntry;\r
+\r
+  //\r
+  // If MonotonicCount == 0 just return the first one\r
+  //\r
+  ReturnFirstEntry  = (BOOLEAN) (*PtrCurrentMTC == 0);\r
+\r
+  Record            = NULL;\r
+  for (Link = GetFirstNode(Head); Link != Head; Link = GetNextNode(Head, Link)) {\r
+    LogEntry = DATA_ENTRY_FROM_LINK (Link);\r
+    if ((LogEntry->Record->DataRecordClass & ClassFilter) == 0) {\r
+      //\r
+      // Skip any entry that does not have the correct ClassFilter\r
+      //\r
+      continue;\r
+    }\r
+\r
+    if ((LogEntry->Record->LogMonotonicCount == *PtrCurrentMTC) || ReturnFirstEntry) {\r
+      //\r
+      // Return record to the user\r
+      //\r
+      Record = LogEntry->Record;\r
+\r
+      //\r
+      // Calculate the next MTC value. If there is no next entry set\r
+      // MTC to zero.\r
+      //\r
+      *PtrCurrentMTC = 0;\r
+      for (Link = GetNextNode(Head, Link); Link != Head; Link = GetNextNode(Head, Link)) {\r
+        NextLogEntry = DATA_ENTRY_FROM_LINK (Link);\r
+        if ((NextLogEntry->Record->DataRecordClass & ClassFilter) != 0) {\r
+          //\r
+          // Return the MTC of the next thing to search for if found\r
+          //\r
+          *PtrCurrentMTC = NextLogEntry->Record->LogMonotonicCount;\r
+          break;\r
+        }\r
+      }\r
+      //\r
+      // Record found exit loop and return\r
+      //\r
+      break;\r
+    }\r
+  }\r
+\r
+  return Record;\r
+}\r
+\r
+/**\r
+  Search the Head list for a EFI_DATA_HUB_FILTER_DRIVER member that\r
+  represents Event and return it.\r
+\r
+  @param Head   Pointer to head of dual linked list of EFI_DATA_HUB_FILTER_DRIVER structures.\r
+  @param Event  Event to be search for in the Head list.\r
+\r
+  @retval EFI_DATA_HUB_FILTER_DRIVER  Returned if Event stored in the Head doubly linked list.\r
+  @retval NULL                        If Event is not in the list\r
+\r
+**/\r
+DATA_HUB_FILTER_DRIVER *\r
+FindFilterDriverByEvent (\r
+  IN  LIST_ENTRY      *Head,\r
+  IN  EFI_EVENT       Event\r
+  )\r
+{\r
+  DATA_HUB_FILTER_DRIVER  *FilterEntry;\r
+  LIST_ENTRY              *Link;\r
+\r
+  for (Link = GetFirstNode(Head); Link != Head; Link = GetNextNode(Head, Link)) {\r
+    FilterEntry = FILTER_ENTRY_FROM_LINK (Link);\r
+    if (FilterEntry->Event == Event) {\r
+      return FilterEntry;\r
+    }\r
+  }\r
+\r
+  return NULL;\r
+}\r
+\r
 /**\r
 \r
   Get a previously logged data record and the MonotonicCount for the next\r
@@ -177,24 +254,24 @@ DataHubLogData (
   not yet read by the filter driver. If FilterDriverEvent is NULL and \r
   MonotonicCount is zero return the first data record.\r
 \r
-  @param This                 The EFI_DATA_HUB_PROTOCOL instance.\r
-  @param MonotonicCount       Specifies the Record to return. On input, zero means\r
-                              return the first record. On output, contains the next\r
-                              record to availible. Zero indicates no more records.\r
-  @param FilterDriverEvent    If FilterDriverEvent is not passed in a MonotonicCount \r
-                              of zero, it means to return the first data record. \r
-                              If FilterDriverEvent is passed in, then a MonotonicCount \r
-                              of zero means to return the first data not yet read by \r
-                              FilterDriverEvent.\r
-  @param Record              Returns a dynamically allocated memory buffer with a data \r
-                             record that matches MonotonicCount.\r
-\r
-  @retval EFI_SUCCESS             Data was returned in Record.\r
-  @retval EFI_INVALID_PARAMETER   FilterDriverEvent was passed in but does not exist.\r
-  @retval EFI_NOT_FOUND           MonotonicCount does not match any data record in the\r
-                            system. If a MonotonicCount of zero was passed in, then\r
-                            no data records exist in the system.\r
-  @retval EFI_OUT_OF_RESOURCES    Record was not returned due to lack of system resources.\r
+  @param This                     Pointer to the EFI_DATA_HUB_PROTOCOL instance.\r
+  @param MonotonicCount           Specifies the Record to return. On input, zero means\r
+                                  return the first record. On output, contains the next\r
+                                  record to availible. Zero indicates no more records.\r
+  @param FilterDriverEvent        If FilterDriverEvent is not passed in a MonotonicCount \r
+                                  of zero, it means to return the first data record. \r
+                                  If FilterDriverEvent is passed in, then a MonotonicCount \r
+                                  of zero means to return the first data not yet read by \r
+                                  FilterDriverEvent.\r
+  @param Record                   Returns a dynamically allocated memory buffer with a data \r
+                                  record that matches MonotonicCount.\r
+\r
+  @retval EFI_SUCCESS             Data was returned in Record.\r
+  @retval EFI_INVALID_PARAMETER   FilterDriverEvent was passed in but does not exist.\r
+  @retval EFI_NOT_FOUND           MonotonicCount does not match any data record in the\r
+                                  system. If a MonotonicCount of zero was passed in, then\r
+                                  no data records exist in the system.\r
+  @retval EFI_OUT_OF_RESOURCES    Record was not returned due to lack of system resources.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -209,82 +286,96 @@ DataHubGetNextRecord (
   DATA_HUB_INSTANCE       *Private;\r
   DATA_HUB_FILTER_DRIVER  *FilterDriver;\r
   UINT64                  ClassFilter;\r
-  UINT64                  FilterMonotonicCount;\r
 \r
   Private               = DATA_HUB_INSTANCE_FROM_THIS (This);\r
 \r
   FilterDriver          = NULL;\r
-  FilterMonotonicCount  = 0;\r
   ClassFilter = EFI_DATA_RECORD_CLASS_DEBUG |\r
     EFI_DATA_RECORD_CLASS_ERROR |\r
     EFI_DATA_RECORD_CLASS_DATA |\r
     EFI_DATA_RECORD_CLASS_PROGRESS_CODE;\r
 \r
-  if (FilterDriverEvent != NULL) {\r
-    //\r
-    // For events the beginning is the last unread record. This info is\r
-    // stored in the instance structure, so we must look up the event\r
-    // to get the data.\r
-    //\r
-    FilterDriver = FindFilterDriverByEvent (\r
-                    &Private->FilterDriverListHead,\r
-                    *FilterDriverEvent\r
-                    );\r
-    if (FilterDriver == NULL) {\r
-      return EFI_INVALID_PARAMETER;\r
+  //\r
+  // If FilterDriverEvent is NULL, then return the next record\r
+  //\r
+  if (FilterDriverEvent == NULL) {\r
+    *Record = GetNextDataRecord (&Private->DataListHead, ClassFilter, MonotonicCount);\r
+    if (*Record == NULL) {\r
+      return EFI_NOT_FOUND;\r
     }\r
-    //\r
-    // Use the Class filter the event was created with.\r
-    //\r
-    ClassFilter = FilterDriver->ClassFilter;\r
+    return EFI_SUCCESS;\r
+  }\r
+    \r
+  //\r
+  // For events the beginning is the last unread record. This info is\r
+  // stored in the instance structure, so we must look up the event\r
+  // to get the data.\r
+  //\r
+  FilterDriver = FindFilterDriverByEvent (\r
+                  &Private->FilterDriverListHead,\r
+                  *FilterDriverEvent\r
+                  );\r
+  if (FilterDriver == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+  //\r
+  // Use the Class filter the event was created with.\r
+  //\r
+  ClassFilter = FilterDriver->ClassFilter;\r
 \r
-    if (*MonotonicCount == 0) {\r
+  //\r
+  // Retrieve the next record or the first record.\r
+  //   \r
+  if (*MonotonicCount != 0 || FilterDriver->GetNextMonotonicCount == 0) { \r
+    *Record = GetNextDataRecord (&Private->DataListHead, ClassFilter, MonotonicCount);\r
+    if (*Record == NULL) {\r
+      return EFI_NOT_FOUND;\r
+    }\r
+    \r
+    if (*MonotonicCount != 0) {\r
       //\r
-      // Use the MTC from the Filter Driver.\r
+      // If this was not the last record then update the count associated with the filter \r
       //\r
-      FilterMonotonicCount = FilterDriver->GetNextMonotonicCount;\r
-      if (FilterMonotonicCount != 0) {\r
-        //\r
-        // The GetNextMonotonicCount field remembers the last value from the previous time.\r
-        // But we already processed this vaule, so we need to find the next one.\r
-        //\r
-        *Record         = GetNextDataRecord (&Private->DataListHead, ClassFilter, &FilterMonotonicCount);\r
-        *MonotonicCount = FilterMonotonicCount;\r
-        if (FilterMonotonicCount == 0) {\r
-          //\r
-          // If there is no new record to get exit now.\r
-          //\r
-          return EFI_NOT_FOUND;\r
-        }\r
-      }\r
+      FilterDriver->GetNextMonotonicCount = *MonotonicCount;\r
+    } else {\r
+      //\r
+      // Save the MonotonicCount of the last record which has been read\r
+      //\r
+      FilterDriver->GetNextMonotonicCount = (*Record)->LogMonotonicCount;\r
     }\r
+    return EFI_SUCCESS;\r
   }\r
+  \r
+  //\r
+  // This is a request to read the first record that has not been read yet.  \r
+  // Set MonotoicCount to the last record successfuly read\r
+  //\r
+  *MonotonicCount = FilterDriver->GetNextMonotonicCount;\r
+  \r
   //\r
-  // Return the record\r
+  // Retrieve the last record successfuly read again, but do not return it since\r
+  // it has already been returned before.\r
   //\r
   *Record = GetNextDataRecord (&Private->DataListHead, ClassFilter, MonotonicCount);\r
   if (*Record == NULL) {\r
     return EFI_NOT_FOUND;\r
   }\r
-\r
-  if (FilterDriver != NULL) {\r
+  \r
+  if (*MonotonicCount != 0) {\r
     //\r
-    // If we have a filter driver update the records that have been read.\r
-    // If MonotonicCount is zero No more reacords left.\r
+    // Update the count associated with the filter \r
     //\r
-    if (*MonotonicCount == 0) {\r
-      //\r
-      // Save the current Record MonotonicCount.\r
-      //\r
-      FilterDriver->GetNextMonotonicCount = (*Record)->LogMonotonicCount;\r
-    } else {\r
-      //\r
-      // Point to next undread record\r
-      //\r
-      FilterDriver->GetNextMonotonicCount = *MonotonicCount;\r
+    FilterDriver->GetNextMonotonicCount = *MonotonicCount;\r
+\r
+    //\r
+    // Retrieve the record after the last record successfuly read \r
+    //  \r
+    *Record = GetNextDataRecord (&Private->DataListHead, ClassFilter, MonotonicCount);\r
+    if (*Record == NULL) {\r
+      return EFI_NOT_FOUND;\r
     }\r
   }\r
-\r
+  \r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -295,26 +386,26 @@ DataHubGetNextRecord (
   with data records that have been recorded prior to the FilterEvent being \r
   registered.\r
     \r
-  @param This                  - The EFI_DATA_HUB_PROTOCOL instance.\r
-  @param FilterEvent           - The EFI_EVENT to signal whenever data that matches \r
-                          FilterClass is logged in the system.\r
-  @param FilterTpl             - The maximum EFI_TPL at which FilterEvent can be \r
-                          signaled. It is strongly recommended that you use the \r
-                          lowest EFI_TPL possible.\r
-  @param FilterClass           - FilterEvent will be signaled whenever a bit in \r
-                          EFI_DATA_RECORD_HEADER.DataRecordClass is also set in \r
-                          FilterClass. If FilterClass is zero, no class-based \r
-                          filtering will be performed.\r
-  @param FilterDataRecordGuid  - FilterEvent will be signaled whenever FilterDataRecordGuid \r
-                          matches EFI_DATA_RECORD_HEADER.DataRecordGuid. If \r
-                          FilterDataRecordGuid is NULL, then no GUID-based filtering \r
-                          will be performed.              \r
-\r
-  @retval EFI_SUCCESS             - The filter driver event was registered.\r
-  @retval EFI_ALREADY_STARTED     - FilterEvent was previously registered and cannot be \r
-                            registered again.\r
-  @retval EFI_OUT_OF_RESOURCES    - The filter driver event was not registered due to lack of \r
-                            system resources.\r
+  @param This                   Pointer to  The EFI_DATA_HUB_PROTOCOL instance.\r
+  @param FilterEvent            The EFI_EVENT to signal whenever data that matches \r
+                                FilterClass is logged in the system.\r
+  @param FilterTpl              The maximum EFI_TPL at which FilterEvent can be \r
+                                signaled. It is strongly recommended that you use the \r
+                                lowest EFI_TPL possible.\r
+  @param FilterClass            FilterEvent will be signaled whenever a bit in \r
+                                EFI_DATA_RECORD_HEADER.DataRecordClass is also set in \r
+                                FilterClass. If FilterClass is zero, no class-based \r
+                                filtering will be performed.\r
+  @param FilterDataRecordGuid   FilterEvent will be signaled whenever FilterDataRecordGuid \r
+                                matches EFI_DATA_RECORD_HEADER.DataRecordGuid. If \r
+                                FilterDataRecordGuid is NULL, then no GUID-based filtering \r
+                                will be performed.              \r
+\r
+  @retval EFI_SUCCESS           The filter driver event was registered.\r
+  @retval EFI_ALREADY_STARTED   FilterEvent was previously registered and cannot be \r
+                                registered again.\r
+  @retval EFI_OUT_OF_RESOURCES  The filter driver event was not registered due to lack of \r
+                                system resources.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -385,15 +476,13 @@ DataHubRegisterFilterDriver (
   Remove a Filter Driver, so it no longer gets called when data \r
    information is logged.\r
 \r
-  @param This        - Protocol instance structure\r
-\r
-  @param FilterEvent - Event that represents a filter driver that is to be \r
-                 Unregistered.\r
-\r
-  @retval EFI_SUCCESS   - If FilterEvent was unregistered\r
+  @param This           Protocol instance structure\r
 \r
-  @retval EFI_NOT_FOUND - If FilterEvent does not exist\r
+  @param FilterEvent    Event that represents a filter driver that is to be \r
+                        Unregistered.\r
 \r
+  @retval EFI_SUCCESS   If FilterEvent was unregistered\r
+  @retval EFI_NOT_FOUND If FilterEvent does not exist\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -427,129 +516,16 @@ DataHubUnregisterFilterDriver (
   return EFI_SUCCESS;\r
 }\r
 \r
-/**\r
-  Search the Head list for a EFI_DATA_HUB_FILTER_DRIVER member that\r
-   represents Event and return it.\r
-\r
-  @param Head  - Head of dual linked list of EFI_DATA_HUB_FILTER_DRIVER\r
-           structures.\r
 \r
-  @param Event - Event to be search for in the Head list.\r
-\r
-  @retval EFI_DATA_HUB_FILTER_DRIVER - Returned if Event stored in the\r
-                               Head doubly linked list.\r
-\r
-  @retval NULL - If Event is not in the list\r
-\r
-**/\r
-DATA_HUB_FILTER_DRIVER *\r
-FindFilterDriverByEvent (\r
-  IN  LIST_ENTRY      *Head,\r
-  IN  EFI_EVENT       Event\r
-  )\r
-\r
-{\r
-  DATA_HUB_FILTER_DRIVER  *FilterEntry;\r
-  LIST_ENTRY              *Link;\r
-\r
-  for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {\r
-    FilterEntry = FILTER_ENTRY_FROM_LINK (Link);\r
-    if (FilterEntry->Event == Event) {\r
-      return FilterEntry;\r
-    }\r
-  }\r
-\r
-  return NULL;\r
-}\r
 \r
 /**\r
-  Search the Head doubly linked list for the passed in MTC. Return the \r
-   matching element in Head and the MTC on the next entry.\r
-\r
-  @param Head          - Head of Data Log linked list.\r
-\r
-  @param ClassFilter   - Only match the MTC if it is in the same Class as the\r
-                  ClassFilter.\r
-\r
-  @param PtrCurrentMTC - On IN contians MTC to search for. On OUT contians next\r
-                   MTC in the data log list or zero if at end of the list.\r
-  \r
-  @retval EFI_DATA_LOG_ENTRY - Return pointer to data log data from Head list.\r
-\r
-  @retval NULL - If no data record exists.\r
-\r
-**/\r
-EFI_DATA_RECORD_HEADER *\r
-GetNextDataRecord (\r
-  IN  LIST_ENTRY          *Head,\r
-  IN  UINT64              ClassFilter,\r
-  IN OUT  UINT64          *PtrCurrentMTC\r
-  )\r
-\r
-{\r
-  EFI_DATA_ENTRY          *LogEntry;\r
-  LIST_ENTRY              *Link;\r
-  BOOLEAN                 ReturnFirstEntry;\r
-  EFI_DATA_RECORD_HEADER  *Record;\r
-  EFI_DATA_ENTRY          *NextLogEntry;\r
-\r
-  //\r
-  // If MonotonicCount == 0 just return the first one\r
-  //\r
-  ReturnFirstEntry  = (BOOLEAN) (*PtrCurrentMTC == 0);\r
-\r
-  Record            = NULL;\r
-  for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {\r
-    LogEntry = DATA_ENTRY_FROM_LINK (Link);\r
-    if ((LogEntry->Record->DataRecordClass & ClassFilter) == 0) {\r
-      //\r
-      // Skip any entry that does not have the correct ClassFilter\r
-      //\r
-      continue;\r
-    }\r
-\r
-    if ((LogEntry->Record->LogMonotonicCount == *PtrCurrentMTC) || ReturnFirstEntry) {\r
-      //\r
-      // Return record to the user\r
-      //\r
-      Record = LogEntry->Record;\r
-\r
-      //\r
-      // Calculate the next MTC value. If there is no next entry set\r
-      // MTC to zero.\r
-      //\r
-      *PtrCurrentMTC = 0;\r
-      for (Link = Link->ForwardLink; Link != Head; Link = Link->ForwardLink) {\r
-        NextLogEntry = DATA_ENTRY_FROM_LINK (Link);\r
-        if ((NextLogEntry->Record->DataRecordClass & ClassFilter) != 0) {\r
-          //\r
-          // Return the MTC of the next thing to search for if found\r
-          //\r
-          *PtrCurrentMTC = NextLogEntry->Record->LogMonotonicCount;\r
-          break;\r
-        }\r
-      }\r
-      //\r
-      // Record found exit loop and return\r
-      //\r
-      break;\r
-    }\r
-  }\r
-\r
-  return Record;\r
-}\r
-\r
-/**\r
-\r
-  Install Driver to produce Data Hub protocol. \r
-\r
-  @param ImageHandle Module's image handle\r
-  @param SystemTable Pointer of EFI_SYSTEM_TABLE\r
-\r
+  Driver's Entry point routine that install Driver to produce Data Hub protocol. \r
 \r
-  @retval EFI_SUCCESS - Logging Hub protocol installed\r
+  @param ImageHandle    Module's image handle\r
+  @param SystemTable    Pointer of EFI_SYSTEM_TABLE\r
 \r
-  @retval Other       - No protocol installed, unload driver.\r
+  @retval EFI_SUCCESS   Logging Hub protocol installed\r
+  @retval Other         No protocol installed, unload driver.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -570,7 +546,7 @@ DataHubInstall (
 \r
   //\r
   // Initialize Private Data in CORE_LOGGING_HUB_INSTANCE that is\r
-  //  required by this protocol\r
+  // required by this protocol\r
   //\r
   InitializeListHead (&mPrivateData.DataListHead);\r
   InitializeListHead (&mPrivateData.FilterDriverListHead);\r