]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/DataHubDxe/DataHub.c
Patch to remove STATIC modifier. This is on longer recommended by EFI Framework codin...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / DataHubDxe / DataHub.c
index 75c1addb0981348c9658060b30027dfcd4e9dd60..af68644e9c02c94033679ebc4229a5fb345c0775 100644 (file)
@@ -29,14 +29,12 @@ CONST EFI_GUID gZeroGuid  = { 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 } };
 //\r
 // Worker functions private to this file\r
 //\r
-STATIC\r
 DATA_HUB_FILTER_DRIVER  *\r
 FindFilterDriverByEvent (\r
   IN  LIST_ENTRY      *Head,\r
   IN  EFI_EVENT       Event\r
   );\r
 \r
-STATIC\r
 EFI_DATA_RECORD_HEADER  *\r
 GetNextDataRecord (\r
   IN  LIST_ENTRY          *Head,\r
@@ -44,7 +42,21 @@ GetNextDataRecord (
   IN OUT  UINT64          *PtrCurrentMTC\r
   );\r
 \r
-STATIC\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
+\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
 DataHubLogData (\r
@@ -55,33 +67,6 @@ DataHubLogData (
   IN  VOID                    *RawData,\r
   IN  UINT32                  RawDataSize\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Log data record into the data logging hub\r
-\r
-Arguments:\r
-\r
-  This                - Protocol instance structure\r
-\r
-  DataRecordGuid      - GUID that defines record contents\r
-\r
-  ProducerName        - GUID that defines the name of the producer of the data\r
-\r
-  DataRecordClass     - Class that defines generic record type\r
-\r
-  RawData             - Data Log record as defined by DataRecordGuid\r
-  \r
-  RawDataSize         - Size of Data Log data in bytes\r
-\r
-Returns: \r
-\r
-  EFI_SUCCESS           - If data was logged\r
-\r
-  EFI_OUT_OF_RESOURCES  - If data was not logged due to lack of system \r
-                           resources.\r
---*/\r
 {\r
   EFI_STATUS              Status;\r
   DATA_HUB_INSTANCE       *Private;\r
@@ -140,7 +125,10 @@ Returns:
   CopyMem (&Record->ProducerName, ProducerName, sizeof (EFI_GUID));\r
   Record->DataRecordClass   = DataRecordClass;\r
 \r
-  Record->LogMonotonicCount = Private->GlobalMonotonicCount++;\r
+  //\r
+  // Ensure LogMonotonicCount is not zero\r
+  //\r
+  Record->LogMonotonicCount = ++Private->GlobalMonotonicCount;\r
 \r
   gRT->GetTime (&Record->LogTime, NULL);\r
 \r
@@ -173,18 +161,7 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-DataHubGetNextRecord (\r
-  IN EFI_DATA_HUB_PROTOCOL            *This,\r
-  IN OUT UINT64                       *MonotonicCount,\r
-  IN EFI_EVENT                        *FilterDriverEvent, OPTIONAL\r
-  OUT EFI_DATA_RECORD_HEADER          **Record\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
 \r
   Get a previously logged data record and the MonotonicCount for the next\r
   availible Record. This allows all records or all records later \r
@@ -193,30 +170,34 @@ Routine Description:
   not yet read by the filter driver. If FilterDriverEvent is NULL and \r
   MonotonicCount is zero return the first data record.\r
 \r
-Arguments:\r
-\r
-  This              - The EFI_DATA_HUB_PROTOCOL instance.\r
-  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
-  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
-  Record            - Returns a dynamically allocated memory buffer with a data \r
-                      record that matches MonotonicCount.\r
-\r
-Returns: \r
-\r
-  EFI_SUCCESS             - Data was returned in Record.\r
-  EFI_INVALID_PARAMETER   - FilterDriverEvent was passed in but does not exist.\r
-  EFI_NOT_FOUND           - MonotonicCount does not match any data record in the\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
-  EFI_OUT_OF_RESOURCES    - Record was not returned due to lack of system resources.\r
+  @retval EFI_OUT_OF_RESOURCES    - Record was not returned due to lack of system resources.\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DataHubGetNextRecord (\r
+  IN EFI_DATA_HUB_PROTOCOL            *This,\r
+  IN OUT UINT64                       *MonotonicCount,\r
+  IN EFI_EVENT                        *FilterDriverEvent, OPTIONAL\r
+  OUT EFI_DATA_RECORD_HEADER          **Record\r
+  )\r
 {\r
   DATA_HUB_INSTANCE       *Private;\r
   DATA_HUB_FILTER_DRIVER  *FilterDriver;\r
@@ -258,8 +239,7 @@ Returns:
       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. So if\r
-        // It is not the first time get the new record entry.\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
@@ -286,12 +266,10 @@ Returns:
     // If MonotonicCount is zero No more reacords left.\r
     //\r
     if (*MonotonicCount == 0) {\r
-      if (FilterMonotonicCount != 0) {\r
-        //\r
-        // Return the result of our extra GetNextDataRecord.\r
-        //\r
-        FilterDriver->GetNextMonotonicCount = FilterMonotonicCount;\r
-      }\r
+      //\r
+      // Save the current Record MonotonicCount.\r
+      //\r
+      FilterDriver->GetNextMonotonicCount = (*Record)->LogMonotonicCount;\r
     } else {\r
       //\r
       // Point to next undread record\r
@@ -303,51 +281,45 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-DataHubRegisterFilterDriver (\r
-  IN EFI_DATA_HUB_PROTOCOL    * This,\r
-  IN EFI_EVENT                FilterEvent,\r
-  IN EFI_TPL                  FilterTpl,\r
-  IN UINT64                   FilterClass,\r
-  IN EFI_GUID                 * FilterDataRecordGuid OPTIONAL\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   This function registers the data hub filter driver that is represented \r
   by FilterEvent. Only one instance of each FilterEvent can be registered.\r
   After the FilterEvent is registered, it will be signaled so it can sync \r
   with data records that have been recorded prior to the FilterEvent being \r
   registered.\r
     \r
-Arguments:\r
-\r
-  This                  - The EFI_DATA_HUB_PROTOCOL instance.\r
-  FilterEvent           - The EFI_EVENT to signal whenever data that matches \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
-  FilterTpl             - The maximum EFI_TPL at which FilterEvent can be \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
-  FilterClass           - FilterEvent will be signaled whenever a bit in \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
-  FilterDataRecordGuid  - FilterEvent will be signaled whenever FilterDataRecordGuid \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
-Returns: \r
 \r
-  EFI_SUCCESS             - The filter driver event was registered.\r
-  EFI_ALREADY_STARTED     - FilterEvent was previously registered and cannot be \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
-  EFI_OUT_OF_RESOURCES    - The filter driver event was not registered due to lack of \r
+  @retval EFI_OUT_OF_RESOURCES    - The filter driver event was not registered due to lack of \r
                             system resources.\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DataHubRegisterFilterDriver (\r
+  IN EFI_DATA_HUB_PROTOCOL    * This,\r
+  IN EFI_EVENT                FilterEvent,\r
+  IN EFI_TPL                  FilterTpl,\r
+  IN UINT64                   FilterClass,\r
+  IN EFI_GUID                 * FilterDataRecordGuid OPTIONAL\r
+  )\r
+\r
 {\r
   DATA_HUB_INSTANCE       *Private;\r
   DATA_HUB_FILTER_DRIVER  *FilterDriver;\r
@@ -402,34 +374,26 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-DataHubUnregisterFilterDriver (\r
-  IN EFI_DATA_HUB_PROTOCOL    *This,\r
-  IN EFI_EVENT                FilterEvent\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
   Remove a Filter Driver, so it no longer gets called when data \r
    information is logged.\r
 \r
-Arguments:\r
+  @param This        - Protocol instance structure\r
 \r
-  This        - Protocol instance structure\r
-\r
-  FilterEvent - Event that represents a filter driver that is to be \r
+  @param FilterEvent - Event that represents a filter driver that is to be \r
                  Unregistered.\r
 \r
-Returns: \r
-\r
-  EFI_SUCCESS   - If FilterEvent was unregistered\r
+  @retval EFI_SUCCESS   - If FilterEvent was unregistered\r
 \r
-  EFI_NOT_FOUND - If FilterEvent does not exist\r
+  @retval EFI_NOT_FOUND - If FilterEvent does not exist\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DataHubUnregisterFilterDriver (\r
+  IN EFI_DATA_HUB_PROTOCOL    *This,\r
+  IN EFI_EVENT                FilterEvent\r
+  )\r
 {\r
   DATA_HUB_INSTANCE       *Private;\r
   DATA_HUB_FILTER_DRIVER  *FilterDriver;\r
@@ -455,36 +419,28 @@ Returns:
 \r
   return EFI_SUCCESS;\r
 }\r
-//\r
-// STATIC Worker fucntions follow\r
-//\r
-STATIC\r
-DATA_HUB_FILTER_DRIVER *\r
-FindFilterDriverByEvent (\r
-  IN  LIST_ENTRY      *Head,\r
-  IN  EFI_EVENT       Event\r
-  )\r
-/*++\r
 \r
-Routine Description:\r
+/**\r
   Search the Head list for a EFI_DATA_HUB_FILTER_DRIVER member that\r
    represents Event and return it.\r
 \r
-Arguments:\r
-\r
-  Head  - Head of dual linked list of EFI_DATA_HUB_FILTER_DRIVER\r
+  @param Head  - Head of dual linked list of EFI_DATA_HUB_FILTER_DRIVER\r
            structures.\r
 \r
-  Event - Event to be search for in the Head list.\r
-\r
-Returns: \r
+  @param Event - Event to be search for in the Head list.\r
 \r
-  EFI_DATA_HUB_FILTER_DRIVER - Returned if Event stored in the\r
+  @retval EFI_DATA_HUB_FILTER_DRIVER - Returned if Event stored in the\r
                                Head doubly linked list.\r
 \r
-  NULL - If Event is not in the 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
---*/\r
 {\r
   DATA_HUB_FILTER_DRIVER  *FilterEntry;\r
   LIST_ENTRY              *Link;\r
@@ -499,36 +455,30 @@ Returns:
   return NULL;\r
 }\r
 \r
-STATIC\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
-Routine Description:\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
-Arguments:\r
+  @param Head          - Head of Data Log linked list.\r
 \r
-  Head          - Head of Data Log linked list.\r
-\r
-  ClassFilter   - Only match the MTC if it is in the same Class as the\r
+  @param ClassFilter   - Only match the MTC if it is in the same Class as the\r
                   ClassFilter.\r
 \r
-  PtrCurrentMTC - On IN contians MTC to search for. On OUT contians next\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
-Returns:\r
+  @retval EFI_DATA_LOG_ENTRY - Return pointer to data log data from Head list.\r
 \r
-  EFI_DATA_LOG_ENTRY - Return pointer to data log data from Head list.\r
+  @retval NULL - If no data record exists.\r
 \r
-  NULL - If no data record exists.\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
   EFI_DATA_ENTRY          *LogEntry;\r
   LIST_ENTRY              *Link;\r
@@ -588,27 +538,25 @@ Returns:
 //\r
 DATA_HUB_INSTANCE mPrivateData;\r
 \r
-EFI_STATUS\r
-EFIAPI\r
-DataHubInstall (\r
-  IN EFI_HANDLE           ImageHandle,\r
-  IN EFI_SYSTEM_TABLE     *SystemTable\r
-  )\r
-/*++\r
+/**\r
 \r
-Routine Description:\r
   Install Driver to produce Data Hub protocol. \r
 \r
-Arguments:\r
-  (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r
+  @param ImageHandle Module's image handle\r
+  @param SystemTable Pointer of EFI_SYSTEM_TABLE\r
 \r
-Returns: \r
 \r
-  EFI_SUCCESS - Logging Hub protocol installed\r
+  @retval EFI_SUCCESS - Logging Hub protocol installed\r
 \r
-  Other       - No protocol installed, unload driver.\r
+  @retval Other       - No protocol installed, unload driver.\r
 \r
---*/\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DataHubInstall (\r
+  IN EFI_HANDLE           ImageHandle,\r
+  IN EFI_SYSTEM_TABLE     *SystemTable\r
+  )\r
 {\r
   EFI_STATUS  Status;\r
   UINT32      HighMontonicCount;\r
@@ -652,3 +600,4 @@ Returns:
                   );\r
   return Status;\r
 }\r
+\r