]> git.proxmox.com Git - mirror_edk2.git/commitdiff
This patch includes:
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 24 Jun 2009 05:49:49 +0000 (05:49 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 24 Jun 2009 05:49:49 +0000 (05:49 +0000)
1) Update and refine functions/header files comments
2) Try to use LinkedList library instance produced by BaseLib but not access linked list via pointer directly.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8641 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Universal/DataHubDxe/DataHub.c
IntelFrameworkModulePkg/Universal/DataHubDxe/DataHubDxe.inf

index a2e991a28876d59cf7cfffce6ccd86acb23bf19b..ff8e8a17168fcc815cb0d2e1d1a72aa6115182db 100644 (file)
@@ -1,17 +1,8 @@
-/**@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
+Copyright (c) 2006 - 2009, Intel Corporation                                                         \r
 All rights reserved. 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
@@ -27,7 +18,6 @@ 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
@@ -50,19 +40,18 @@ GetNextDataRecord (
   );\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
@@ -156,7 +145,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
@@ -177,24 +166,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
@@ -298,26 +287,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
@@ -388,15 +377,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
+  @param This           Protocol instance structure\r
 \r
-  @retval EFI_SUCCESS   - If FilterEvent was unregistered\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
@@ -432,17 +419,13 @@ DataHubUnregisterFilterDriver (
 \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
+  represents Event and return it.\r
 \r
-  @param Event - Event to be search for in the Head list.\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\r
-                               Head doubly linked list.\r
-\r
-  @retval NULL - If Event is not in the list\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
@@ -450,12 +433,11 @@ FindFilterDriverByEvent (
   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
+  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
@@ -467,19 +449,16 @@ FindFilterDriverByEvent (
 \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
+  matching element in Head and the MTC on the next entry.\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
+  @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
-\r
-  @retval NULL - If no data record exists.\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
@@ -502,7 +481,7 @@ GetNextDataRecord (
   ReturnFirstEntry  = (BOOLEAN) (*PtrCurrentMTC == 0);\r
 \r
   Record            = NULL;\r
-  for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {\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
@@ -522,7 +501,7 @@ GetNextDataRecord (
       // MTC to zero.\r
       //\r
       *PtrCurrentMTC = 0;\r
-      for (Link = Link->ForwardLink; Link != Head; Link = Link->ForwardLink) {\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
@@ -543,16 +522,13 @@ GetNextDataRecord (
 }\r
 \r
 /**\r
+  Driver's Entry point routine that install Driver to produce Data Hub protocol. \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
-\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
@@ -573,7 +549,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
index 7e75436f53b19fa33e9e636b54494e7b2ce9fff1..c63551ca800e282cb3e727e27d4d5184a8cf3895 100644 (file)
@@ -1,7 +1,26 @@
 #/** @file\r
-#  Component description file for DataHub module.\r
-#\r
 #  This driver initializes and installs the Data Hub protocol.\r
+#\r
+#  The data hub is a volatile database that is intended as the major focus for the accumulation of\r
+#  manageability data.T he hub is fed by "producers" with chunks of data in a defined format.\r
+#  Consumers may then extract the data in temporal "log" order.As an example, progress codes might\r
+#  be recorded in the data hub for future processing.Ot her data contributed to the data hub might\r
+#  include, for example, statistics on enumerated items such as memory, add-in buses, and add-in\r
+#  cards and data on errors encountered during boot (for example, the system did not boot off the\r
+#  network because the cable was not plugged in).\r
+#  Some classes of data have defined formats.For example, the amount of memory in the system is\r
+#  reported in a standard format so that consumers can be written to extract the data.O ther data is\r
+#  system specific.For example, additional detail on errors might be specific to the driver that\r
+#  discovered the error.The consumer might be a driver that tabularizes data from the data hub,\r
+#  providing a mechanism for the raw data to be made available to the OS for post-processing by\r
+#  OS-based applications.\r
+#  The intent of the data hub is for drivers that enumerate and configure parts of the system to report\r
+#  their discoveries to the data hub.This data can then be extracted by other drivers that report those\r
+#  discoveries using standard manageability interfaces such as SMBIOS and Intelligent Platform\r
+#  Management Interface (IPMI).The alternative to a data-hub-like architecture is to require all\r
+#  drivers to be aware of all reporting formats.\r
+#  For more information, please ref http://www.intel.com/technology/framework/\r
+#  \r
 #  Copyright (c) 2006 - 2009, Intel Corporation\r
 #\r
 #  All rights reserved. This program and the accompanying materials\r
@@ -51,7 +70,7 @@
 \r
 \r
 [Protocols]\r
-  gEfiDataHubProtocolGuid                       # PROTOCOL ALWAYS_PRODUCED\r
+  gEfiDataHubProtocolGuid                       # PROTOCOL PRODUCED\r
 \r
 \r
 [Depex]\r