]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update to support to produce Component Name and & Component Name 2 protocol based...
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 30 Sep 2007 02:32:16 +0000 (02:32 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 30 Sep 2007 02:32:16 +0000 (02:32 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3997 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/ComponentName.c
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/ComponentName.h
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/idebus.c
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/ComponentName.c
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/ComponentName.h
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/pcibus.c
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/pcibus.h
IntelFrameworkModulePkg/Bus/Pci/VgaMiniPortDxe/ComponentName.c
IntelFrameworkModulePkg/Bus/Pci/VgaMiniPortDxe/VgaMiniPort.c
IntelFrameworkModulePkg/Bus/Pci/VgaMiniPortDxe/VgaMiniPort.h

index 12673c9c92b66c8913b94e43632186d12d2dc7f5..611eb3d6ee5b8a5a9477f13ee9f5b2b705afc2af 100644 (file)
 //\r
 // EFI Component Name Protocol\r
 //\r
-EFI_COMPONENT_NAME_PROTOCOL     gIDEBusComponentName = {\r
+EFI_COMPONENT_NAME_PROTOCOL  gIDEBusComponentName = {\r
   IDEBusComponentNameGetDriverName,\r
   IDEBusComponentNameGetControllerName,\r
   "eng"\r
-};\r
+  };\r
+\r
+//\r
+// EFI Component Name 2 Protocol\r
+//\r
+EFI_COMPONENT_NAME2_PROTOCOL gIDEBusComponentName2 = {\r
+  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) IDEBusComponentNameGetDriverName,\r
+  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) IDEBusComponentNameGetControllerName,\r
+  "en"\r
+  };\r
+\r
 \r
 STATIC EFI_UNICODE_STRING_TABLE mIDEBusDriverNameTable[] = {\r
-  { "eng", (CHAR16 *) L"PCI IDE/ATAPI Bus Driver" },\r
+  { "eng;en", (CHAR16 *) L"PCI IDE/ATAPI Bus Driver" },\r
   { NULL , NULL }\r
 };\r
 \r
 STATIC EFI_UNICODE_STRING_TABLE mIDEBusControllerNameTable[] = {\r
-  { "eng", (CHAR16 *) L"PCI IDE/ATAPI Controller" },\r
+  { "eng;en", (CHAR16 *) L"PCI IDE/ATAPI Controller" },\r
   { NULL , NULL }\r
 };\r
 \r
 /**\r
-  Retrieves a Unicode string that is the user readable name of the EFI Driver.\r
-\r
-  @param  This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
-  @param  Language A pointer to a three character ISO 639-2 language identifier.\r
-  This is the language of the driver name that that the caller\r
-  is requesting, and it must match one of the languages specified\r
-  in SupportedLanguages.  The number of languages supported by a\r
-  driver is up to the driver writer.\r
-  @param  DriverName A pointer to the Unicode string to return.  This Unicode string\r
-  is the name of the driver specified by This in the language\r
-  specified by Language.\r
-\r
-  @retval  EFI_SUCCESS The Unicode string for the Driver specified by This\r
-  and the language specified by Language was returned\r
-  in DriverName.\r
-  @retval  EFI_INVALID_PARAMETER Language is NULL.\r
-  @retval  EFI_INVALID_PARAMETER DriverName is NULL.\r
-  @retval  EFI_UNSUPPORTED The driver specified by This does not support the\r
-  language specified by Language.\r
+  Retrieves a Unicode string that is the user readable name of the driver.\r
+\r
+  This function retrieves the user readable name of a driver in the form of a\r
+  Unicode string. If the driver specified by This has a user readable name in\r
+  the language specified by Language, then a pointer to the driver name is\r
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
+  by This does not support the language specified by Language,\r
+  then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+\r
+  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+                                array indicating the language. This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified\r
+                                in RFC 3066 or ISO 639-2 language code format.\r
+\r
+  @param  DriverName[out]       A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                driver specified by This in the language\r
+                                specified by Language.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the Driver specified by\r
+                                This and the language specified by Language was\r
+                                returned in DriverName.\r
+\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+\r
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -61,53 +88,81 @@ IDEBusComponentNameGetDriverName (
   OUT CHAR16                       **DriverName\r
   )\r
 {\r
-  return LookupUnicodeString (\r
-          Language,\r
-          gIDEBusComponentName.SupportedLanguages,\r
-          mIDEBusDriverNameTable,\r
-          DriverName\r
-          );\r
+  return LookupUnicodeString2 (\r
+           Language,\r
+           This->SupportedLanguages,\r
+           mIDEBusDriverNameTable,\r
+           DriverName,\r
+           (BOOLEAN)(This == &gIDEBusComponentName)\r
+           );\r
 }\r
 \r
 /**\r
   Retrieves a Unicode string that is the user readable name of the controller\r
-  that is being managed by an EFI Driver.\r
-\r
-  @param  This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
-  @param  ControllerHandle The handle of a controller that the driver specified by\r
-  This is managing.  This handle specifies the controller\r
-  whose name is to be returned.\r
-  @param  ChildHandle The handle of the child controller to retrieve the name\r
-  of.  This is an optional parameter that may be NULL.  It\r
-  will be NULL for device drivers.  It will also be NULL\r
-  for a bus drivers that wish to retrieve the name of the\r
-  bus controller.  It will not be NULL for a bus driver\r
-  that wishes to retrieve the name of a child controller.\r
-  @param  Language A pointer to a three character ISO 639-2 language\r
-  identifier.  This is the language of the controller name\r
-  that that the caller is requesting, and it must match one\r
-  of the languages specified in SupportedLanguages.  The\r
-  number of languages supported by a driver is up to the\r
-  driver writer.\r
-  @param  ControllerName A pointer to the Unicode string to return.  This Unicode\r
-  string is the name of the controller specified by\r
-  ControllerHandle and ChildHandle in the language\r
-  specified by Language from the point of view of the\r
-  driver specified by This.\r
-\r
-  @retval  EFI_SUCCESS The Unicode string for the user readable name in the\r
-  language specified by Language for the driver\r
-  specified by This was returned in DriverName.\r
-  @retval  EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
-  @retval  EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
-  EFI_HANDLE.\r
-  @retval  EFI_INVALID_PARAMETER Language is NULL.\r
-  @retval  EFI_INVALID_PARAMETER ControllerName is NULL.\r
-  @retval  EFI_UNSUPPORTED The driver specified by This is not currently\r
-  managing the controller specified by\r
-  ControllerHandle and ChildHandle.\r
-  @retval  EFI_UNSUPPORTED The driver specified by This does not support the\r
-  language specified by Language.\r
+  that is being managed by a driver.\r
+\r
+  This function retrieves the user readable name of the controller specified by\r
+  ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
+  driver specified by This has a user readable name in the language specified by\r
+  Language, then a pointer to the controller name is returned in ControllerName,\r
+  and EFI_SUCCESS is returned.  If the driver specified by This is not currently\r
+  managing the controller specified by ControllerHandle and ChildHandle,\r
+  then EFI_UNSUPPORTED is returned.  If the driver specified by This does not\r
+  support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+\r
+  @param  ControllerHandle[in]  The handle of a controller that the driver\r
+                                specified by This is managing.  This handle\r
+                                specifies the controller whose name is to be\r
+                                returned.\r
+\r
+  @param  ChildHandle[in]       The handle of the child controller to retrieve\r
+                                the name of.  This is an optional parameter that\r
+                                may be NULL.  It will be NULL for device\r
+                                drivers.  It will also be NULL for a bus drivers\r
+                                that wish to retrieve the name of the bus\r
+                                controller.  It will not be NULL for a bus\r
+                                driver that wishes to retrieve the name of a\r
+                                child controller.\r
+\r
+  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+                                array indicating the language.  This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified in\r
+                                RFC 3066 or ISO 639-2 language code format.\r
+\r
+  @param  ControllerName[out]   A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                controller specified by ControllerHandle and\r
+                                ChildHandle in the language specified by\r
+                                Language from the point of view of the driver\r
+                                specified by This.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the user readable name in\r
+                                the language specified by Language for the\r
+                                driver specified by This was returned in\r
+                                DriverName.\r
+\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
+                                EFI_HANDLE.\r
+\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+\r
+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This is not currently\r
+                                managing the controller specified by\r
+                                ControllerHandle and ChildHandle.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -137,12 +192,13 @@ IDEBusComponentNameGetControllerName (
   }\r
 \r
   if (ChildHandle == NULL) {\r
-    return LookupUnicodeString (\r
-            Language,\r
-            gIDEBusComponentName.SupportedLanguages,\r
-            mIDEBusControllerNameTable,\r
-            ControllerName\r
-            );\r
+    return LookupUnicodeString2 (\r
+             Language,\r
+             This->SupportedLanguages,\r
+             mIDEBusControllerNameTable,\r
+             ControllerName,\r
+             (BOOLEAN)(This == &gIDEBusComponentName)\r
+             );\r
   }\r
 \r
   Status = EfiTestChildHandle (\r
@@ -171,12 +227,13 @@ IDEBusComponentNameGetControllerName (
 \r
   IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_THIS (BlockIo);\r
 \r
-  return LookupUnicodeString (\r
-          Language,\r
-          gIDEBusComponentName.SupportedLanguages,\r
-          IdeBlkIoDevice->ControllerNameTable,\r
-          ControllerName\r
-          );\r
+  return LookupUnicodeString2 (\r
+           Language,\r
+           This->SupportedLanguages,\r
+           IdeBlkIoDevice->ControllerNameTable,\r
+           ControllerName,\r
+           (BOOLEAN)(This == &gIDEBusComponentName)\r
+           );\r
 }\r
 \r
 /**\r
@@ -201,10 +258,19 @@ AddName (
     ModelName[StringIndex] = IdeBlkIoDevicePtr->ModelName[StringIndex];\r
   }\r
 \r
-  AddUnicodeString (\r
+  AddUnicodeString2 (\r
     "eng",\r
     gIDEBusComponentName.SupportedLanguages,\r
     &IdeBlkIoDevicePtr->ControllerNameTable,\r
-    ModelName\r
+    ModelName,\r
+    TRUE\r
     );\r
+  AddUnicodeString2 (\r
+    "en",\r
+    gIDEBusComponentName2.SupportedLanguages,\r
+    &IdeBlkIoDevicePtr->ControllerNameTable,\r
+    ModelName,\r
+    FALSE\r
+    );\r
+\r
 }\r
index e6bf11f209be9e87a11a08bbda3288c28b33afaa..d52de4c80cec25139a8c844e57a6dfd0f134e1c4 100644 (file)
 \r
 #define ADD_NAME(x) AddName ((x));\r
 \r
-extern EFI_COMPONENT_NAME_PROTOCOL  gIDEBusComponentName;\r
+extern EFI_COMPONENT_NAME_PROTOCOL   gIDEBusComponentName;\r
+extern EFI_COMPONENT_NAME2_PROTOCOL  gIDEBusComponentName2;\r
 \r
 \r
 //\r
 // EFI Component Name Functions\r
 //\r
 /**\r
-  TODO: Add function description\r
+  Retrieves a Unicode string that is the user readable name of the driver.\r
 \r
-  @param  This TODO: add argument description\r
-  @param  Language TODO: add argument description\r
-  @param  DriverName TODO: add argument description\r
+  This function retrieves the user readable name of a driver in the form of a\r
+  Unicode string. If the driver specified by This has a user readable name in\r
+  the language specified by Language, then a pointer to the driver name is\r
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
+  by This does not support the language specified by Language,\r
+  then EFI_UNSUPPORTED is returned.\r
 \r
-  TODO: add return values\r
+  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+\r
+  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+                                array indicating the language. This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified\r
+                                in RFC 3066 or ISO 639-2 language code format.\r
+\r
+  @param  DriverName[out]       A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                driver specified by This in the language\r
+                                specified by Language.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the Driver specified by\r
+                                This and the language specified by Language was\r
+                                returned in DriverName.\r
+\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+\r
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -37,19 +67,75 @@ IDEBusComponentNameGetDriverName (
   IN  EFI_COMPONENT_NAME_PROTOCOL  *This,\r
   IN  CHAR8                        *Language,\r
   OUT CHAR16                       **DriverName\r
-  )\r
-;\r
+  );\r
 \r
-/**\r
-  TODO: Add function description\r
 \r
-  @param  This TODO: add argument description\r
-  @param  ControllerHandle TODO: add argument description\r
-  @param  ChildHandle TODO: add argument description\r
-  @param  Language TODO: add argument description\r
-  @param  ControllerName TODO: add argument description\r
-\r
-  TODO: add return values\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the controller\r
+  that is being managed by a driver.\r
+\r
+  This function retrieves the user readable name of the controller specified by\r
+  ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
+  driver specified by This has a user readable name in the language specified by\r
+  Language, then a pointer to the controller name is returned in ControllerName,\r
+  and EFI_SUCCESS is returned.  If the driver specified by This is not currently\r
+  managing the controller specified by ControllerHandle and ChildHandle,\r
+  then EFI_UNSUPPORTED is returned.  If the driver specified by This does not\r
+  support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+\r
+  @param  ControllerHandle[in]  The handle of a controller that the driver\r
+                                specified by This is managing.  This handle\r
+                                specifies the controller whose name is to be\r
+                                returned.\r
+\r
+  @param  ChildHandle[in]       The handle of the child controller to retrieve\r
+                                the name of.  This is an optional parameter that\r
+                                may be NULL.  It will be NULL for device\r
+                                drivers.  It will also be NULL for a bus drivers\r
+                                that wish to retrieve the name of the bus\r
+                                controller.  It will not be NULL for a bus\r
+                                driver that wishes to retrieve the name of a\r
+                                child controller.\r
+\r
+  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+                                array indicating the language.  This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified in\r
+                                RFC 3066 or ISO 639-2 language code format.\r
+\r
+  @param  ControllerName[out]   A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                controller specified by ControllerHandle and\r
+                                ChildHandle in the language specified by\r
+                                Language from the point of view of the driver\r
+                                specified by This.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the user readable name in\r
+                                the language specified by Language for the\r
+                                driver specified by This was returned in\r
+                                DriverName.\r
+\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
+                                EFI_HANDLE.\r
+\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+\r
+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This is not currently\r
+                                managing the controller specified by\r
+                                ControllerHandle and ChildHandle.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -60,8 +146,8 @@ IDEBusComponentNameGetControllerName (
   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,\r
   IN  CHAR8                                           *Language,\r
   OUT CHAR16                                          **ControllerName\r
-  )\r
-;\r
+  );\r
+\r
 \r
 /**\r
   TODO: Add function description\r
index 35d489cb989711ba766fdeb8623502dc06b1749d..8f555c7cd5326d4b3175081149e5103ea211c1d1 100644 (file)
@@ -1398,14 +1398,13 @@ InitializeIdeBus(
   //\r
   // Install driver model protocol(s).\r
   //\r
-  Status = EfiLibInstallAllDriverProtocols (\r
+  Status = EfiLibInstallDriverBindingComponentName2 (\r
              ImageHandle,\r
              SystemTable,\r
              &gIDEBusDriverBinding,\r
              ImageHandle,\r
              &gIDEBusComponentName,\r
-             NULL,\r
-             NULL\r
+             &gIDEBusComponentName2\r
              );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
index 8fb5b1cd4cdaded734b34098b753c93f3612da7a..9320909654d46e727a3e7994bccd3da30b6beb0e 100644 (file)
@@ -16,17 +16,66 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 //\r
 // EFI Component Name Protocol\r
 //\r
-EFI_COMPONENT_NAME_PROTOCOL     gPciBusComponentName = {\r
+EFI_COMPONENT_NAME_PROTOCOL  gPciBusComponentName = {\r
   PciBusComponentNameGetDriverName,\r
   PciBusComponentNameGetControllerName,\r
   "eng"\r
-};\r
+  };\r
+\r
+//\r
+// EFI Component Name 2 Protocol\r
+//\r
+EFI_COMPONENT_NAME2_PROTOCOL gPciBusComponentName2 = {\r
+  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PciBusComponentNameGetDriverName,\r
+  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PciBusComponentNameGetControllerName,\r
+  "en"\r
+  };\r
+\r
 \r
 STATIC EFI_UNICODE_STRING_TABLE mPciBusDriverNameTable[] = {\r
-  { "eng", (CHAR16 *) L"PCI Bus Driver" },\r
+  { "eng;en", (CHAR16 *) L"PCI Bus Driver" },\r
   { NULL , NULL }\r
 };\r
 \r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the driver.\r
+\r
+  This function retrieves the user readable name of a driver in the form of a\r
+  Unicode string. If the driver specified by This has a user readable name in\r
+  the language specified by Language, then a pointer to the driver name is\r
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
+  by This does not support the language specified by Language,\r
+  then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+\r
+  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+                                array indicating the language. This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified\r
+                                in RFC 3066 or ISO 639-2 language code format.\r
+\r
+  @param  DriverName[out]       A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                driver specified by This in the language\r
+                                specified by Language.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the Driver specified by\r
+                                This and the language specified by Language was\r
+                                returned in DriverName.\r
+\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+\r
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PciBusComponentNameGetDriverName (\r
@@ -34,41 +83,84 @@ PciBusComponentNameGetDriverName (
   IN  CHAR8                        *Language,\r
   OUT CHAR16                       **DriverName\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    Retrieves a Unicode string that is the user readable name of the EFI Driver.\r
-\r
-  Arguments:\r
-    This       - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
-    Language   - A pointer to a three character ISO 639-2 language identifier.\r
-                 This is the language of the driver name that that the caller \r
-                 is requesting, and it must match one of the languages specified\r
-                 in SupportedLanguages.  The number of languages supported by a \r
-                 driver is up to the driver writer.\r
-    DriverName - A pointer to the Unicode string to return.  This Unicode string\r
-                 is the name of the driver specified by This in the language \r
-                 specified by Language.\r
-\r
-  Returns:\r
-    EFI_SUCCESS           - The Unicode string for the Driver specified by This\r
-                            and the language specified by Language was returned \r
-                            in DriverName.\r
-    EFI_INVALID_PARAMETER - Language is NULL.\r
-    EFI_INVALID_PARAMETER - DriverName is NULL.\r
-    EFI_UNSUPPORTED       - The driver specified by This does not support the \r
-                            language specified by Language.\r
-\r
---*/\r
 {\r
-  return LookupUnicodeString (\r
-          Language,\r
-          gPciBusComponentName.SupportedLanguages,\r
-          mPciBusDriverNameTable,\r
-          DriverName\r
-          );\r
+  return LookupUnicodeString2 (\r
+           Language,\r
+           This->SupportedLanguages,\r
+           mPciBusDriverNameTable,\r
+           DriverName,\r
+           (BOOLEAN)(This == &gPciBusComponentName)\r
+           );\r
 }\r
 \r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the controller\r
+  that is being managed by a driver.\r
+\r
+  This function retrieves the user readable name of the controller specified by\r
+  ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
+  driver specified by This has a user readable name in the language specified by\r
+  Language, then a pointer to the controller name is returned in ControllerName,\r
+  and EFI_SUCCESS is returned.  If the driver specified by This is not currently\r
+  managing the controller specified by ControllerHandle and ChildHandle,\r
+  then EFI_UNSUPPORTED is returned.  If the driver specified by This does not\r
+  support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+\r
+  @param  ControllerHandle[in]  The handle of a controller that the driver\r
+                                specified by This is managing.  This handle\r
+                                specifies the controller whose name is to be\r
+                                returned.\r
+\r
+  @param  ChildHandle[in]       The handle of the child controller to retrieve\r
+                                the name of.  This is an optional parameter that\r
+                                may be NULL.  It will be NULL for device\r
+                                drivers.  It will also be NULL for a bus drivers\r
+                                that wish to retrieve the name of the bus\r
+                                controller.  It will not be NULL for a bus\r
+                                driver that wishes to retrieve the name of a\r
+                                child controller.\r
+\r
+  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+                                array indicating the language.  This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified in\r
+                                RFC 3066 or ISO 639-2 language code format.\r
+\r
+  @param  ControllerName[out]   A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                controller specified by ControllerHandle and\r
+                                ChildHandle in the language specified by\r
+                                Language from the point of view of the driver\r
+                                specified by This.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the user readable name in\r
+                                the language specified by Language for the\r
+                                driver specified by This was returned in\r
+                                DriverName.\r
+\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
+                                EFI_HANDLE.\r
+\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+\r
+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This is not currently\r
+                                managing the controller specified by\r
+                                ControllerHandle and ChildHandle.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PciBusComponentNameGetControllerName (\r
@@ -78,50 +170,6 @@ PciBusComponentNameGetControllerName (
   IN  CHAR8                                           *Language,\r
   OUT CHAR16                                          **ControllerName\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-    Retrieves a Unicode string that is the user readable name of the controller\r
-    that is being managed by an EFI Driver.\r
-\r
-  Arguments:\r
-    This             - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
-    ControllerHandle - The handle of a controller that the driver specified by \r
-                       This is managing.  This handle specifies the controller \r
-                       whose name is to be returned.\r
-    ChildHandle      - The handle of the child controller to retrieve the name \r
-                       of.  This is an optional parameter that may be NULL.  It \r
-                       will be NULL for device drivers.  It will also be NULL \r
-                       for a bus drivers that wish to retrieve the name of the \r
-                       bus controller.  It will not be NULL for a bus driver \r
-                       that wishes to retrieve the name of a child controller.\r
-    Language         - A pointer to a three character ISO 639-2 language \r
-                       identifier.  This is the language of the controller name \r
-                       that that the caller is requesting, and it must match one\r
-                       of the languages specified in SupportedLanguages.  The \r
-                       number of languages supported by a driver is up to the \r
-                       driver writer.\r
-    ControllerName   - A pointer to the Unicode string to return.  This Unicode\r
-                       string is the name of the controller specified by \r
-                       ControllerHandle and ChildHandle in the language specified\r
-                       by Language from the point of view of the driver specified\r
-                       by This. \r
-\r
-  Returns:\r
-    EFI_SUCCESS           - The Unicode string for the user readable name in the \r
-                            language specified by Language for the driver \r
-                            specified by This was returned in DriverName.\r
-    EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
-    EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r
-    EFI_INVALID_PARAMETER - Language is NULL.\r
-    EFI_INVALID_PARAMETER - ControllerName is NULL.\r
-    EFI_UNSUPPORTED       - The driver specified by This is not currently managing \r
-                            the controller specified by ControllerHandle and \r
-                            ChildHandle.\r
-    EFI_UNSUPPORTED       - The driver specified by This does not support the \r
-                            language specified by Language.\r
-\r
---*/\r
 {\r
   return EFI_UNSUPPORTED;\r
 }\r
index a30946493f27818958d9067a1b487d214012e73b..f2323b2eaa01aa050c2d62a110938912d6cf694e 100644 (file)
@@ -15,37 +15,128 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #ifndef _EFI_PCI_BUS_COMPONENT_NAME_H\r
 #define _EFI_PCI_BUS_COMPONENT_NAME_H\r
 \r
-extern EFI_COMPONENT_NAME_PROTOCOL  gPciBusComponentName;\r
+extern EFI_COMPONENT_NAME_PROTOCOL   gPciBusComponentName;\r
+extern EFI_COMPONENT_NAME2_PROTOCOL  gPciBusComponentName2;\r
 \r
 //\r
 // EFI Component Name Functions\r
 //\r
-EFI_STATUS\r
-EFIAPI\r
-PciBusComponentNameGetDriverName (\r
-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,\r
-  IN  CHAR8                        *Language,\r
-  OUT CHAR16                       **DriverName\r
-  )\r
-/*++\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the driver.\r
 \r
-Routine Description:\r
+  This function retrieves the user readable name of a driver in the form of a\r
+  Unicode string. If the driver specified by This has a user readable name in\r
+  the language specified by Language, then a pointer to the driver name is\r
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
+  by This does not support the language specified by Language,\r
+  then EFI_UNSUPPORTED is returned.\r
 \r
-  TODO: Add function description\r
+  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
 \r
-Arguments:\r
+  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+                                array indicating the language. This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified\r
+                                in RFC 3066 or ISO 639-2 language code format.\r
 \r
-  This        - TODO: add argument description\r
-  Language    - TODO: add argument description\r
-  DriverName  - TODO: add argument description\r
+  @param  DriverName[out]       A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                driver specified by This in the language\r
+                                specified by Language.\r
 \r
-Returns:\r
+  @retval EFI_SUCCESS           The Unicode string for the Driver specified by\r
+                                This and the language specified by Language was\r
+                                returned in DriverName.\r
 \r
-  TODO: add return values\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
 \r
---*/\r
-;\r
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PciBusComponentNameGetDriverName (\r
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,\r
+  IN  CHAR8                        *Language,\r
+  OUT CHAR16                       **DriverName\r
+  );\r
+\r
+\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the controller\r
+  that is being managed by a driver.\r
+\r
+  This function retrieves the user readable name of the controller specified by\r
+  ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
+  driver specified by This has a user readable name in the language specified by\r
+  Language, then a pointer to the controller name is returned in ControllerName,\r
+  and EFI_SUCCESS is returned.  If the driver specified by This is not currently\r
+  managing the controller specified by ControllerHandle and ChildHandle,\r
+  then EFI_UNSUPPORTED is returned.  If the driver specified by This does not\r
+  support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+\r
+  @param  ControllerHandle[in]  The handle of a controller that the driver\r
+                                specified by This is managing.  This handle\r
+                                specifies the controller whose name is to be\r
+                                returned.\r
+\r
+  @param  ChildHandle[in]       The handle of the child controller to retrieve\r
+                                the name of.  This is an optional parameter that\r
+                                may be NULL.  It will be NULL for device\r
+                                drivers.  It will also be NULL for a bus drivers\r
+                                that wish to retrieve the name of the bus\r
+                                controller.  It will not be NULL for a bus\r
+                                driver that wishes to retrieve the name of a\r
+                                child controller.\r
+\r
+  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+                                array indicating the language.  This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified in\r
+                                RFC 3066 or ISO 639-2 language code format.\r
+\r
+  @param  ControllerName[out]   A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                controller specified by ControllerHandle and\r
+                                ChildHandle in the language specified by\r
+                                Language from the point of view of the driver\r
+                                specified by This.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the user readable name in\r
+                                the language specified by Language for the\r
+                                driver specified by This was returned in\r
+                                DriverName.\r
+\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
+                                EFI_HANDLE.\r
+\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+\r
+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This is not currently\r
+                                managing the controller specified by\r
+                                ControllerHandle and ChildHandle.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PciBusComponentNameGetControllerName (\r
@@ -54,26 +145,7 @@ PciBusComponentNameGetControllerName (
   IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,\r
   IN  CHAR8                                           *Language,\r
   OUT CHAR16                                          **ControllerName\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  TODO: Add function description\r
-\r
-Arguments:\r
-\r
-  This              - TODO: add argument description\r
-  ControllerHandle  - TODO: add argument description\r
-  ChildHandle       - TODO: add argument description\r
-  Language          - TODO: add argument description\r
-  ControllerName    - TODO: add argument description\r
-\r
-Returns:\r
-\r
-  TODO: add return values\r
+  );\r
 \r
---*/\r
-;\r
 \r
 #endif\r
index 8f8905dc3f9ad957debd28461f8c0acbfa596c18..ebf817b96fd1f327c9064c3cccc8d200fcae298d 100644 (file)
@@ -76,14 +76,13 @@ Returns:
   //\r
   // Install driver model protocol(s).\r
   //\r
-  Status = EfiLibInstallAllDriverProtocols (\r
+  Status = EfiLibInstallDriverBindingComponentName2 (\r
              ImageHandle,\r
              SystemTable,\r
              &gPciBusDriverBinding,\r
              ImageHandle,\r
              &gPciBusComponentName,\r
-             NULL,\r
-             NULL\r
+             &gPciBusComponentName2\r
              );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
index 83f93bd16a1942f0449f0ac76ad361b77b513560..448a9dbb16b2e5304986388109badc8cb9c6c01b 100644 (file)
@@ -239,6 +239,7 @@ typedef struct _PCI_IO_DEVICE {
 //\r
 extern EFI_DRIVER_BINDING_PROTOCOL                  gPciBusDriverBinding;\r
 extern EFI_COMPONENT_NAME_PROTOCOL                  gPciBusComponentName;\r
+extern EFI_COMPONENT_NAME2_PROTOCOL                 gPciBusComponentName2;\r
 extern LIST_ENTRY                                   gPciDevicePool;\r
 extern BOOLEAN                                      gFullEnumeration;\r
 extern UINTN                                        gPciHostBridgeNumber;\r
index 5ca4f38988783769335baa81e93ef8dab897f63c..3fc158611a823d952087d6fc4514591c63392691 100644 (file)
-/** @file
-
-Copyright (c) 2006 - 2007 Intel Corporation. All rights reserved
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution.  The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "VgaMiniPort.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-PciVgaMiniPortComponentNameGetDriverName (
-  IN  EFI_COMPONENT_NAME_PROTOCOL *This,
-  IN  CHAR8                        *Language,
-  OUT CHAR16                       **DriverName
-  );
-
-EFI_STATUS
-EFIAPI
-PciVgaMiniPortComponentNameGetControllerName (
-  IN  EFI_COMPONENT_NAME_PROTOCOL                    *This,
-  IN  EFI_HANDLE                                      ControllerHandle,
-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
-  IN  CHAR8                                           *Language,
-  OUT CHAR16                                          **ControllerName
-  );
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL    gPciVgaMiniPortComponentName = {
-  PciVgaMiniPortComponentNameGetDriverName,
-  PciVgaMiniPortComponentNameGetControllerName,
-  "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mPciVgaMiniPortDriverNameTable[] = {
-  {
-    "eng",
-    L"PCI VGA Mini Port Driver"
-  },
-  {
-    NULL,
-    NULL
-  }
-};
-
-EFI_STATUS
-EFIAPI
-PciVgaMiniPortComponentNameGetDriverName (
-  IN  EFI_COMPONENT_NAME_PROTOCOL *This,
-  IN  CHAR8                        *Language,
-  OUT CHAR16                       **DriverName
-  )
-/*++
-
-  Routine Description:
-    Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
-  Arguments:
-    This       - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
-    Language   - A pointer to a three character ISO 639-2 language identifier.
-                 This is the language of the driver name that that the caller
-                 is requesting, and it must match one of the languages specified
-                 in SupportedLanguages.  The number of languages supported by a
-                 driver is up to the driver writer.
-    DriverName - A pointer to the Unicode string to return.  This Unicode string
-                 is the name of the driver specified by This in the language
-                 specified by Language.
-
-  Returns:
-    EFI_SUCCESS           - The Unicode string for the Driver specified by This
-                            and the language specified by Language was returned
-                            in DriverName.
-    EFI_INVALID_PARAMETER - Language is NULL.
-    EFI_INVALID_PARAMETER - DriverName is NULL.
-    EFI_UNSUPPORTED       - The driver specified by This does not support the
-                            language specified by Language.
-
---*/
-{
-  return LookupUnicodeString (
-          Language,
-          gPciVgaMiniPortComponentName.SupportedLanguages,
-          mPciVgaMiniPortDriverNameTable,
-          DriverName
-          );
-}
-
-EFI_STATUS
-EFIAPI
-PciVgaMiniPortComponentNameGetControllerName (
-  IN  EFI_COMPONENT_NAME_PROTOCOL                    *This,
-  IN  EFI_HANDLE                                      ControllerHandle,
-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
-  IN  CHAR8                                           *Language,
-  OUT CHAR16                                          **ControllerName
-  )
-/*++
-
-  Routine Description:
-    Retrieves a Unicode string that is the user readable name of the controller
-    that is being managed by an EFI Driver.
-
-  Arguments:
-    This             - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
-    ControllerHandle - The handle of a controller that the driver specified by
-                       This is managing.  This handle specifies the controller
-                       whose name is to be returned.
-    ChildHandle      - The handle of the child controller to retrieve the name
-                       of.  This is an optional parameter that may be NULL.  It
-                       will be NULL for device drivers.  It will also be NULL
-                       for a bus drivers that wish to retrieve the name of the
-                       bus controller.  It will not be NULL for a bus driver
-                       that wishes to retrieve the name of a child controller.
-    Language         - A pointer to a three character ISO 639-2 language
-                       identifier.  This is the language of the controller name
-                       that that the caller is requesting, and it must match one
-                       of the languages specified in SupportedLanguages.  The
-                       number of languages supported by a driver is up to the
-                       driver writer.
-    ControllerName   - A pointer to the Unicode string to return.  This Unicode
-                       string is the name of the controller specified by
-                       ControllerHandle and ChildHandle in the language
-                       specified by Language from the point of view of the
-                       driver specified by This.
-
-  Returns:
-    EFI_SUCCESS           - The Unicode string for the user readable name in the
-                            language specified by Language for the driver
-                            specified by This was returned in DriverName.
-    EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
-    EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
-                            EFI_HANDLE.
-    EFI_INVALID_PARAMETER - Language is NULL.
-    EFI_INVALID_PARAMETER - ControllerName is NULL.
-    EFI_UNSUPPORTED       - The driver specified by This is not currently
-                            managing the controller specified by
-                            ControllerHandle and ChildHandle.
-    EFI_UNSUPPORTED       - The driver specified by This does not support the
-                            language specified by Language.
-
---*/
-{
-  return EFI_UNSUPPORTED;
-}
+/** @file\r
+\r
+Copyright (c) 2006 - 2007 Intel Corporation. All rights reserved\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
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "VgaMiniPort.h"\r
+\r
+//\r
+// EFI Component Name Functions\r
+//\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the driver.\r
+\r
+  This function retrieves the user readable name of a driver in the form of a\r
+  Unicode string. If the driver specified by This has a user readable name in\r
+  the language specified by Language, then a pointer to the driver name is\r
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
+  by This does not support the language specified by Language,\r
+  then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+\r
+  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+                                array indicating the language. This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified\r
+                                in RFC 3066 or ISO 639-2 language code format.\r
+\r
+  @param  DriverName[out]       A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                driver specified by This in the language\r
+                                specified by Language.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the Driver specified by\r
+                                This and the language specified by Language was\r
+                                returned in DriverName.\r
+\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+\r
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PciVgaMiniPortComponentNameGetDriverName (\r
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,\r
+  IN  CHAR8                        *Language,\r
+  OUT CHAR16                       **DriverName\r
+  );\r
+\r
+\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the controller\r
+  that is being managed by a driver.\r
+\r
+  This function retrieves the user readable name of the controller specified by\r
+  ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
+  driver specified by This has a user readable name in the language specified by\r
+  Language, then a pointer to the controller name is returned in ControllerName,\r
+  and EFI_SUCCESS is returned.  If the driver specified by This is not currently\r
+  managing the controller specified by ControllerHandle and ChildHandle,\r
+  then EFI_UNSUPPORTED is returned.  If the driver specified by This does not\r
+  support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+\r
+  @param  ControllerHandle[in]  The handle of a controller that the driver\r
+                                specified by This is managing.  This handle\r
+                                specifies the controller whose name is to be\r
+                                returned.\r
+\r
+  @param  ChildHandle[in]       The handle of the child controller to retrieve\r
+                                the name of.  This is an optional parameter that\r
+                                may be NULL.  It will be NULL for device\r
+                                drivers.  It will also be NULL for a bus drivers\r
+                                that wish to retrieve the name of the bus\r
+                                controller.  It will not be NULL for a bus\r
+                                driver that wishes to retrieve the name of a\r
+                                child controller.\r
+\r
+  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+                                array indicating the language.  This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified in\r
+                                RFC 3066 or ISO 639-2 language code format.\r
+\r
+  @param  ControllerName[out]   A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                controller specified by ControllerHandle and\r
+                                ChildHandle in the language specified by\r
+                                Language from the point of view of the driver\r
+                                specified by This.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the user readable name in\r
+                                the language specified by Language for the\r
+                                driver specified by This was returned in\r
+                                DriverName.\r
+\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
+                                EFI_HANDLE.\r
+\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+\r
+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This is not currently\r
+                                managing the controller specified by\r
+                                ControllerHandle and ChildHandle.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PciVgaMiniPortComponentNameGetControllerName (\r
+  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,\r
+  IN  EFI_HANDLE                                      ControllerHandle,\r
+  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,\r
+  IN  CHAR8                                           *Language,\r
+  OUT CHAR16                                          **ControllerName\r
+  );\r
+\r
+\r
+//\r
+// EFI Component Name Protocol\r
+//\r
+EFI_COMPONENT_NAME_PROTOCOL  gPciVgaMiniPortComponentName = {\r
+  PciVgaMiniPortComponentNameGetDriverName,\r
+  PciVgaMiniPortComponentNameGetControllerName,\r
+  "eng"\r
+  };\r
+\r
+//\r
+// EFI Component Name 2 Protocol\r
+//\r
+EFI_COMPONENT_NAME2_PROTOCOL gPciVgaMiniPortComponentName2 = {\r
+  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PciVgaMiniPortComponentNameGetDriverName,\r
+  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PciVgaMiniPortComponentNameGetControllerName,\r
+  "en"\r
+  };\r
+\r
+\r
+static EFI_UNICODE_STRING_TABLE mPciVgaMiniPortDriverNameTable[] = {\r
+  {\r
+    "eng;en",\r
+    L"PCI VGA Mini Port Driver"\r
+  },\r
+  {\r
+    NULL,\r
+    NULL\r
+  }\r
+};\r
+\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the driver.\r
+\r
+  This function retrieves the user readable name of a driver in the form of a\r
+  Unicode string. If the driver specified by This has a user readable name in\r
+  the language specified by Language, then a pointer to the driver name is\r
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
+  by This does not support the language specified by Language,\r
+  then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+\r
+  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+                                array indicating the language. This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified\r
+                                in RFC 3066 or ISO 639-2 language code format.\r
+\r
+  @param  DriverName[out]       A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                driver specified by This in the language\r
+                                specified by Language.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the Driver specified by\r
+                                This and the language specified by Language was\r
+                                returned in DriverName.\r
+\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+\r
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PciVgaMiniPortComponentNameGetDriverName (\r
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,\r
+  IN  CHAR8                        *Language,\r
+  OUT CHAR16                       **DriverName\r
+  )\r
+{\r
+  return LookupUnicodeString2 (\r
+           Language,\r
+           This->SupportedLanguages,\r
+           mPciVgaMiniPortDriverNameTable,\r
+           DriverName,\r
+           (BOOLEAN)(This == &gPciVgaMiniPortComponentName)\r
+           );\r
+}\r
+\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the controller\r
+  that is being managed by a driver.\r
+\r
+  This function retrieves the user readable name of the controller specified by\r
+  ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
+  driver specified by This has a user readable name in the language specified by\r
+  Language, then a pointer to the controller name is returned in ControllerName,\r
+  and EFI_SUCCESS is returned.  If the driver specified by This is not currently\r
+  managing the controller specified by ControllerHandle and ChildHandle,\r
+  then EFI_UNSUPPORTED is returned.  If the driver specified by This does not\r
+  support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This[in]              A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+\r
+  @param  ControllerHandle[in]  The handle of a controller that the driver\r
+                                specified by This is managing.  This handle\r
+                                specifies the controller whose name is to be\r
+                                returned.\r
+\r
+  @param  ChildHandle[in]       The handle of the child controller to retrieve\r
+                                the name of.  This is an optional parameter that\r
+                                may be NULL.  It will be NULL for device\r
+                                drivers.  It will also be NULL for a bus drivers\r
+                                that wish to retrieve the name of the bus\r
+                                controller.  It will not be NULL for a bus\r
+                                driver that wishes to retrieve the name of a\r
+                                child controller.\r
+\r
+  @param  Language[in]          A pointer to a Null-terminated ASCII string\r
+                                array indicating the language.  This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified in\r
+                                RFC 3066 or ISO 639-2 language code format.\r
+\r
+  @param  ControllerName[out]   A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                controller specified by ControllerHandle and\r
+                                ChildHandle in the language specified by\r
+                                Language from the point of view of the driver\r
+                                specified by This.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the user readable name in\r
+                                the language specified by Language for the\r
+                                driver specified by This was returned in\r
+                                DriverName.\r
+\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
+                                EFI_HANDLE.\r
+\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+\r
+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This is not currently\r
+                                managing the controller specified by\r
+                                ControllerHandle and ChildHandle.\r
+\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PciVgaMiniPortComponentNameGetControllerName (\r
+  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,\r
+  IN  EFI_HANDLE                                      ControllerHandle,\r
+  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,\r
+  IN  CHAR8                                           *Language,\r
+  OUT CHAR16                                          **ControllerName\r
+  )\r
+{\r
+  return EFI_UNSUPPORTED;\r
+}\r
index 8a183f48417b3782debb93c1bf0030b3011a0c9d..4ebcc7ccc57d4abe4e5d8b9d1e3827475498ca61 100644 (file)
-/** @file
-
-Copyright (c) 2006 Intel Corporation. All rights reserved
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution.  The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "VgaMiniPort.h"
-
-//
-// EFI Driver Binding Protocol Instance
-//
-//   This driver has a version value of 0x00000000.  This is the
-//   lowest possible priority for a driver.  This is done on purpose to help
-//   the developers of UGA drivers.  This driver can bind if no UGA driver
-//   is present, so a console is available.  Then, when a UGA driver is loaded
-//   this driver can be disconnected, and the UGA driver can be connected.
-//   As long as the UGA driver has a version value greater than 0x00000000, it
-//   will be connected first and will block this driver from connecting.
-//
-EFI_DRIVER_BINDING_PROTOCOL gPciVgaMiniPortDriverBinding = {
-  PciVgaMiniPortDriverBindingSupported,
-  PciVgaMiniPortDriverBindingStart,
-  PciVgaMiniPortDriverBindingStop,
-  0x00000000,
-  NULL,
-  NULL
-};
-
-//
-// Driver Entry Point
-//
-EFI_STATUS
-EFIAPI
-PciVgaMiniPortDriverEntryPoint (
-  IN EFI_HANDLE         ImageHandle,
-  IN EFI_SYSTEM_TABLE   *SystemTable
-  )
-/*++
-
-  Routine Description:
-    Driver Entry Point.
-
-  Arguments:
-    (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
-
-  Returns:
-    EFI_STATUS
---*/
-{
-  return EfiLibInstallAllDriverProtocols (
-          ImageHandle,
-          SystemTable,
-          &gPciVgaMiniPortDriverBinding,
-          ImageHandle,
-          &gPciVgaMiniPortComponentName,
-          NULL,
-          NULL
-          );
-}
-
-
-/**
-  Supported.
-
-  (Standard DriverBinding Protocol Supported() function)
-
-  @return EFI_STATUS
-
-**/
-EFI_STATUS
-EFIAPI
-PciVgaMiniPortDriverBindingSupported (
-  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
-  IN EFI_HANDLE                   Controller,
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
-  )
-{
-  EFI_STATUS          Status;
-  EFI_PCI_IO_PROTOCOL *PciIo;
-  PCI_TYPE00          Pci;
-
-  //
-  // Open the IO Abstraction(s) needed to perform the supported test
-  //
-  Status = gBS->OpenProtocol (
-                  Controller,
-                  &gEfiPciIoProtocolGuid,
-                  (VOID **) &PciIo,
-                  This->DriverBindingHandle,
-                  Controller,
-                  EFI_OPEN_PROTOCOL_BY_DRIVER
-                  );
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-  //
-  // See if this is a PCI VGA Controller by looking at the Command register and
-  // Class Code Register
-  //
-  Status = PciIo->Pci.Read (
-                        PciIo,
-                        EfiPciIoWidthUint32,
-                        0,
-                        sizeof (Pci) / sizeof (UINT32),
-                        &Pci
-                        );
-  if (EFI_ERROR (Status)) {
-    goto Done;
-  }
-
-  Status = EFI_UNSUPPORTED;
-  //
-  // See if the device is an enabled VGA device.
-  // Most systems can only have on VGA device on at a time.
-  //
-  if (((Pci.Hdr.Command & 0x03) == 0x03) && IS_PCI_VGA (&Pci)) {
-    Status = EFI_SUCCESS;
-  }
-
-Done:
-  gBS->CloseProtocol (
-        Controller,
-        &gEfiPciIoProtocolGuid,
-        This->DriverBindingHandle,
-        Controller
-        );
-
-  return Status;
-}
-
-
-/**
-  Install VGA Mini Port Protocol onto VGA device handles
-
-  (Standard DriverBinding Protocol Start() function)
-
-  @return EFI_STATUS
-
-**/
-EFI_STATUS
-EFIAPI
-PciVgaMiniPortDriverBindingStart (
-  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
-  IN EFI_HANDLE                   Controller,
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
-  )
-{
-  EFI_STATUS            Status;
-  EFI_PCI_IO_PROTOCOL   *PciIo;
-  PCI_VGA_MINI_PORT_DEV *PciVgaMiniPortPrivate;
-
-  PciVgaMiniPortPrivate = NULL;
-  PciIo                 = NULL;
-  //
-  // Open the IO Abstraction(s) needed
-  //
-  Status = gBS->OpenProtocol (
-                  Controller,
-                  &gEfiPciIoProtocolGuid,
-                  (VOID **) &PciIo,
-                  This->DriverBindingHandle,
-                  Controller,
-                  EFI_OPEN_PROTOCOL_BY_DRIVER
-                  );
-  if (EFI_ERROR (Status)) {
-    goto Done;
-  }
-  //
-  // Allocate the private device structure
-  //
-  Status = gBS->AllocatePool (
-                  EfiBootServicesData,
-                  sizeof (PCI_VGA_MINI_PORT_DEV),
-                  (VOID **) &PciVgaMiniPortPrivate
-                  );
-  if (EFI_ERROR (Status)) {
-    goto Done;
-  }
-
-  ZeroMem (PciVgaMiniPortPrivate, sizeof (PCI_VGA_MINI_PORT_DEV));
-
-  //
-  // Initialize the private device structure
-  //
-  PciVgaMiniPortPrivate->Signature = PCI_VGA_MINI_PORT_DEV_SIGNATURE;
-  PciVgaMiniPortPrivate->Handle = Controller;
-  PciVgaMiniPortPrivate->PciIo = PciIo;
-
-  PciVgaMiniPortPrivate->VgaMiniPort.SetMode = PciVgaMiniPortSetMode;
-  PciVgaMiniPortPrivate->VgaMiniPort.VgaMemoryOffset = 0xb8000;
-  PciVgaMiniPortPrivate->VgaMiniPort.CrtcAddressRegisterOffset = 0x3d4;
-  PciVgaMiniPortPrivate->VgaMiniPort.CrtcDataRegisterOffset = 0x3d5;
-  PciVgaMiniPortPrivate->VgaMiniPort.VgaMemoryBar = EFI_PCI_IO_PASS_THROUGH_BAR;
-  PciVgaMiniPortPrivate->VgaMiniPort.CrtcAddressRegisterBar = EFI_PCI_IO_PASS_THROUGH_BAR;
-  PciVgaMiniPortPrivate->VgaMiniPort.CrtcDataRegisterBar = EFI_PCI_IO_PASS_THROUGH_BAR;
-  PciVgaMiniPortPrivate->VgaMiniPort.MaxMode = 1;
-
-  //
-  // Install Vga Mini Port Protocol
-  //
-  Status = gBS->InstallMultipleProtocolInterfaces (
-                  &Controller,
-                  &gEfiVgaMiniPortProtocolGuid,
-                  &PciVgaMiniPortPrivate->VgaMiniPort,
-                  NULL
-                  );
-Done:
-  if (EFI_ERROR (Status)) {
-    gBS->CloseProtocol (
-          Controller,
-          &gEfiPciIoProtocolGuid,
-          This->DriverBindingHandle,
-          Controller
-          );
-    if (PciVgaMiniPortPrivate) {
-      gBS->FreePool (PciVgaMiniPortPrivate);
-    }
-  }
-
-  return Status;
-}
-
-
-/**
-  Stop.
-
-  (Standard DriverBinding Protocol Stop() function)
-
-  @return EFI_STATUS
-
-**/
-EFI_STATUS
-EFIAPI
-PciVgaMiniPortDriverBindingStop (
-  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,
-  IN  EFI_HANDLE                      Controller,
-  IN  UINTN                           NumberOfChildren,
-  IN  EFI_HANDLE                      *ChildHandleBuffer
-  )
-{
-  EFI_STATUS                  Status;
-  EFI_VGA_MINI_PORT_PROTOCOL  *VgaMiniPort;
-  PCI_VGA_MINI_PORT_DEV       *PciVgaMiniPortPrivate;
-
-  Status = gBS->OpenProtocol (
-                  Controller,
-                  &gEfiVgaMiniPortProtocolGuid,
-                  (VOID **) &VgaMiniPort,
-                  This->DriverBindingHandle,
-                  Controller,
-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL
-                  );
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  PciVgaMiniPortPrivate = PCI_VGA_MINI_PORT_DEV_FROM_THIS (VgaMiniPort);
-
-  Status = gBS->UninstallProtocolInterface (
-                  Controller,
-                  &gEfiVgaMiniPortProtocolGuid,
-                  &PciVgaMiniPortPrivate->VgaMiniPort
-                  );
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  gBS->CloseProtocol (
-        Controller,
-        &gEfiPciIoProtocolGuid,
-        This->DriverBindingHandle,
-        Controller
-        );
-
-  gBS->FreePool (PciVgaMiniPortPrivate);
-
-  return EFI_SUCCESS;
-}
-//
-// VGA Mini Port Protocol Functions
-//
-
-/**
-  GC_TODO: Add function description
-
-  @param  This             GC_TODO: add argument description
-  @param  ModeNumber       GC_TODO: add argument description
-
-  @retval EFI_UNSUPPORTED  GC_TODO: Add description for return value
-  @retval EFI_SUCCESS      GC_TODO: Add description for return value
-
-**/
-EFI_STATUS
-EFIAPI
-PciVgaMiniPortSetMode (
-  IN  EFI_VGA_MINI_PORT_PROTOCOL  *This,
-  IN  UINTN                       ModeNumber
-  )
-{
-  if (ModeNumber > This->MaxMode) {
-    return EFI_UNSUPPORTED;
-  }
-
-  return EFI_SUCCESS;
-}
+/** @file\r
+\r
+Copyright (c) 2006 Intel Corporation. All rights reserved\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
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "VgaMiniPort.h"\r
+\r
+//\r
+// EFI Driver Binding Protocol Instance\r
+//\r
+//   This driver has a version value of 0x00000000.  This is the\r
+//   lowest possible priority for a driver.  This is done on purpose to help\r
+//   the developers of UGA drivers.  This driver can bind if no UGA driver\r
+//   is present, so a console is available.  Then, when a UGA driver is loaded\r
+//   this driver can be disconnected, and the UGA driver can be connected.\r
+//   As long as the UGA driver has a version value greater than 0x00000000, it\r
+//   will be connected first and will block this driver from connecting.\r
+//\r
+EFI_DRIVER_BINDING_PROTOCOL gPciVgaMiniPortDriverBinding = {\r
+  PciVgaMiniPortDriverBindingSupported,\r
+  PciVgaMiniPortDriverBindingStart,\r
+  PciVgaMiniPortDriverBindingStop,\r
+  0x00000000,\r
+  NULL,\r
+  NULL\r
+};\r
+\r
+//\r
+// Driver Entry Point\r
+//\r
+EFI_STATUS\r
+EFIAPI\r
+PciVgaMiniPortDriverEntryPoint (\r
+  IN EFI_HANDLE         ImageHandle,\r
+  IN EFI_SYSTEM_TABLE   *SystemTable\r
+  )\r
+/*++\r
+\r
+  Routine Description:\r
+    Driver Entry Point.\r
+\r
+  Arguments:\r
+    (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r
+\r
+  Returns:\r
+    EFI_STATUS\r
+--*/\r
+{\r
+  return EfiLibInstallDriverBindingComponentName2 (\r
+           ImageHandle,\r
+           SystemTable,\r
+           &gPciVgaMiniPortDriverBinding,\r
+           ImageHandle,\r
+           &gPciVgaMiniPortComponentName,\r
+           &gPciVgaMiniPortComponentName2\r
+           );\r
+}\r
+\r
+\r
+/**\r
+  Supported.\r
+\r
+  (Standard DriverBinding Protocol Supported() function)\r
+\r
+  @return EFI_STATUS\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PciVgaMiniPortDriverBindingSupported (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                   Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  )\r
+{\r
+  EFI_STATUS          Status;\r
+  EFI_PCI_IO_PROTOCOL *PciIo;\r
+  PCI_TYPE00          Pci;\r
+\r
+  //\r
+  // Open the IO Abstraction(s) needed to perform the supported test\r
+  //\r
+  Status = gBS->OpenProtocol (\r
+                  Controller,\r
+                  &gEfiPciIoProtocolGuid,\r
+                  (VOID **) &PciIo,\r
+                  This->DriverBindingHandle,\r
+                  Controller,\r
+                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+  //\r
+  // See if this is a PCI VGA Controller by looking at the Command register and\r
+  // Class Code Register\r
+  //\r
+  Status = PciIo->Pci.Read (\r
+                        PciIo,\r
+                        EfiPciIoWidthUint32,\r
+                        0,\r
+                        sizeof (Pci) / sizeof (UINT32),\r
+                        &Pci\r
+                        );\r
+  if (EFI_ERROR (Status)) {\r
+    goto Done;\r
+  }\r
+\r
+  Status = EFI_UNSUPPORTED;\r
+  //\r
+  // See if the device is an enabled VGA device.\r
+  // Most systems can only have on VGA device on at a time.\r
+  //\r
+  if (((Pci.Hdr.Command & 0x03) == 0x03) && IS_PCI_VGA (&Pci)) {\r
+    Status = EFI_SUCCESS;\r
+  }\r
+\r
+Done:\r
+  gBS->CloseProtocol (\r
+        Controller,\r
+        &gEfiPciIoProtocolGuid,\r
+        This->DriverBindingHandle,\r
+        Controller\r
+        );\r
+\r
+  return Status;\r
+}\r
+\r
+\r
+/**\r
+  Install VGA Mini Port Protocol onto VGA device handles\r
+\r
+  (Standard DriverBinding Protocol Start() function)\r
+\r
+  @return EFI_STATUS\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PciVgaMiniPortDriverBindingStart (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                   Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  )\r
+{\r
+  EFI_STATUS            Status;\r
+  EFI_PCI_IO_PROTOCOL   *PciIo;\r
+  PCI_VGA_MINI_PORT_DEV *PciVgaMiniPortPrivate;\r
+\r
+  PciVgaMiniPortPrivate = NULL;\r
+  PciIo                 = NULL;\r
+  //\r
+  // Open the IO Abstraction(s) needed\r
+  //\r
+  Status = gBS->OpenProtocol (\r
+                  Controller,\r
+                  &gEfiPciIoProtocolGuid,\r
+                  (VOID **) &PciIo,\r
+                  This->DriverBindingHandle,\r
+                  Controller,\r
+                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    goto Done;\r
+  }\r
+  //\r
+  // Allocate the private device structure\r
+  //\r
+  Status = gBS->AllocatePool (\r
+                  EfiBootServicesData,\r
+                  sizeof (PCI_VGA_MINI_PORT_DEV),\r
+                  (VOID **) &PciVgaMiniPortPrivate\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    goto Done;\r
+  }\r
+\r
+  ZeroMem (PciVgaMiniPortPrivate, sizeof (PCI_VGA_MINI_PORT_DEV));\r
+\r
+  //\r
+  // Initialize the private device structure\r
+  //\r
+  PciVgaMiniPortPrivate->Signature = PCI_VGA_MINI_PORT_DEV_SIGNATURE;\r
+  PciVgaMiniPortPrivate->Handle = Controller;\r
+  PciVgaMiniPortPrivate->PciIo = PciIo;\r
+\r
+  PciVgaMiniPortPrivate->VgaMiniPort.SetMode = PciVgaMiniPortSetMode;\r
+  PciVgaMiniPortPrivate->VgaMiniPort.VgaMemoryOffset = 0xb8000;\r
+  PciVgaMiniPortPrivate->VgaMiniPort.CrtcAddressRegisterOffset = 0x3d4;\r
+  PciVgaMiniPortPrivate->VgaMiniPort.CrtcDataRegisterOffset = 0x3d5;\r
+  PciVgaMiniPortPrivate->VgaMiniPort.VgaMemoryBar = EFI_PCI_IO_PASS_THROUGH_BAR;\r
+  PciVgaMiniPortPrivate->VgaMiniPort.CrtcAddressRegisterBar = EFI_PCI_IO_PASS_THROUGH_BAR;\r
+  PciVgaMiniPortPrivate->VgaMiniPort.CrtcDataRegisterBar = EFI_PCI_IO_PASS_THROUGH_BAR;\r
+  PciVgaMiniPortPrivate->VgaMiniPort.MaxMode = 1;\r
+\r
+  //\r
+  // Install Vga Mini Port Protocol\r
+  //\r
+  Status = gBS->InstallMultipleProtocolInterfaces (\r
+                  &Controller,\r
+                  &gEfiVgaMiniPortProtocolGuid,\r
+                  &PciVgaMiniPortPrivate->VgaMiniPort,\r
+                  NULL\r
+                  );\r
+Done:\r
+  if (EFI_ERROR (Status)) {\r
+    gBS->CloseProtocol (\r
+          Controller,\r
+          &gEfiPciIoProtocolGuid,\r
+          This->DriverBindingHandle,\r
+          Controller\r
+          );\r
+    if (PciVgaMiniPortPrivate) {\r
+      gBS->FreePool (PciVgaMiniPortPrivate);\r
+    }\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
+\r
+/**\r
+  Stop.\r
+\r
+  (Standard DriverBinding Protocol Stop() function)\r
+\r
+  @return EFI_STATUS\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PciVgaMiniPortDriverBindingStop (\r
+  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,\r
+  IN  EFI_HANDLE                      Controller,\r
+  IN  UINTN                           NumberOfChildren,\r
+  IN  EFI_HANDLE                      *ChildHandleBuffer\r
+  )\r
+{\r
+  EFI_STATUS                  Status;\r
+  EFI_VGA_MINI_PORT_PROTOCOL  *VgaMiniPort;\r
+  PCI_VGA_MINI_PORT_DEV       *PciVgaMiniPortPrivate;\r
+\r
+  Status = gBS->OpenProtocol (\r
+                  Controller,\r
+                  &gEfiVgaMiniPortProtocolGuid,\r
+                  (VOID **) &VgaMiniPort,\r
+                  This->DriverBindingHandle,\r
+                  Controller,\r
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  PciVgaMiniPortPrivate = PCI_VGA_MINI_PORT_DEV_FROM_THIS (VgaMiniPort);\r
+\r
+  Status = gBS->UninstallProtocolInterface (\r
+                  Controller,\r
+                  &gEfiVgaMiniPortProtocolGuid,\r
+                  &PciVgaMiniPortPrivate->VgaMiniPort\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  gBS->CloseProtocol (\r
+        Controller,\r
+        &gEfiPciIoProtocolGuid,\r
+        This->DriverBindingHandle,\r
+        Controller\r
+        );\r
+\r
+  gBS->FreePool (PciVgaMiniPortPrivate);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+//\r
+// VGA Mini Port Protocol Functions\r
+//\r
+\r
+/**\r
+  GC_TODO: Add function description\r
+\r
+  @param  This             GC_TODO: add argument description\r
+  @param  ModeNumber       GC_TODO: add argument description\r
+\r
+  @retval EFI_UNSUPPORTED  GC_TODO: Add description for return value\r
+  @retval EFI_SUCCESS      GC_TODO: Add description for return value\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PciVgaMiniPortSetMode (\r
+  IN  EFI_VGA_MINI_PORT_PROTOCOL  *This,\r
+  IN  UINTN                       ModeNumber\r
+  )\r
+{\r
+  if (ModeNumber > This->MaxMode) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
index 101effd19ade142789516ae067afdc84956b8d83..207a954ec8f0925f51220d79be1a6e7f04117ea7 100644 (file)
@@ -1,95 +1,96 @@
-/** @file
-
-Copyright (c) 2006 - 2007 Intel Corporation. All rights reserved
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution.  The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _VGA_MINIPORT_H
-#define _VGA_MINIPORT_H
-
-//
-// The package level header files this module uses
-//
-#include <PiDxe.h>
-//
-// The protocols, PPI and GUID defintions for this module
-//
-#include <Protocol/PciIo.h>
-#include <Protocol/VgaMiniPort.h>
-#include <Protocol/ComponentName2.h>
-
-
-//
-// The Library classes this module consumes
-//
-#include <Library/DebugLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiDriverEntryPoint.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/UefiLib.h>
-
-#include <IndustryStandard/Pci22.h>
-
-//
-// PCI VGA MiniPort Device Structure
-//
-#define PCI_VGA_MINI_PORT_DEV_SIGNATURE   EFI_SIGNATURE_32('P','V','M','P')
-
-typedef struct {
-  UINTN                         Signature;
-  EFI_HANDLE                    Handle;
-  EFI_VGA_MINI_PORT_PROTOCOL    VgaMiniPort;
-  EFI_PCI_IO_PROTOCOL           *PciIo;
-} PCI_VGA_MINI_PORT_DEV;
-
-#define PCI_VGA_MINI_PORT_DEV_FROM_THIS(a) CR(a, PCI_VGA_MINI_PORT_DEV, VgaMiniPort, PCI_VGA_MINI_PORT_DEV_SIGNATURE)
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gPciVgaMiniPortDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gPciVgaMiniPortComponentName;
-
-//
-// Driver Binding Protocol functions
-//
-EFI_STATUS
-PciVgaMiniPortDriverBindingSupported (
-  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
-  IN EFI_HANDLE                   Controller,
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
-  );
-
-EFI_STATUS
-PciVgaMiniPortDriverBindingStart (
-  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
-  IN EFI_HANDLE                   Controller,
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
-  );
-
-EFI_STATUS
-PciVgaMiniPortDriverBindingStop (
-  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,
-  IN  EFI_HANDLE                   Controller,
-  IN  UINTN                        NumberOfChildren,
-  IN  EFI_HANDLE                   *ChildHandleBuffer
-  );
-
-//
-// VGA Mini Port Protocol functions
-//
-EFI_STATUS
-EFIAPI
-PciVgaMiniPortSetMode (
-  IN  EFI_VGA_MINI_PORT_PROTOCOL  *This,
-  IN  UINTN                       ModeNumber
-  );
-
-#endif
+/** @file\r
+\r
+Copyright (c) 2006 - 2007 Intel Corporation. All rights reserved\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
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _VGA_MINIPORT_H\r
+#define _VGA_MINIPORT_H\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiDxe.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+#include <Protocol/PciIo.h>\r
+#include <Protocol/VgaMiniPort.h>\r
+#include <Protocol/ComponentName2.h>\r
+\r
+\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/DebugLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/UefiDriverEntryPoint.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiLib.h>\r
+\r
+#include <IndustryStandard/Pci22.h>\r
+\r
+//\r
+// PCI VGA MiniPort Device Structure\r
+//\r
+#define PCI_VGA_MINI_PORT_DEV_SIGNATURE   EFI_SIGNATURE_32('P','V','M','P')\r
+\r
+typedef struct {\r
+  UINTN                         Signature;\r
+  EFI_HANDLE                    Handle;\r
+  EFI_VGA_MINI_PORT_PROTOCOL    VgaMiniPort;\r
+  EFI_PCI_IO_PROTOCOL           *PciIo;\r
+} PCI_VGA_MINI_PORT_DEV;\r
+\r
+#define PCI_VGA_MINI_PORT_DEV_FROM_THIS(a) CR(a, PCI_VGA_MINI_PORT_DEV, VgaMiniPort, PCI_VGA_MINI_PORT_DEV_SIGNATURE)\r
+\r
+//\r
+// Global Variables\r
+//\r
+extern EFI_DRIVER_BINDING_PROTOCOL  gPciVgaMiniPortDriverBinding;\r
+extern EFI_COMPONENT_NAME_PROTOCOL  gPciVgaMiniPortComponentName;\r
+extern EFI_COMPONENT_NAME2_PROTOCOL gPciVgaMiniPortComponentName2;\r
+\r
+//\r
+// Driver Binding Protocol functions\r
+//\r
+EFI_STATUS\r
+PciVgaMiniPortDriverBindingSupported (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                   Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  );\r
+\r
+EFI_STATUS\r
+PciVgaMiniPortDriverBindingStart (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                   Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  );\r
+\r
+EFI_STATUS\r
+PciVgaMiniPortDriverBindingStop (\r
+  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN  EFI_HANDLE                   Controller,\r
+  IN  UINTN                        NumberOfChildren,\r
+  IN  EFI_HANDLE                   *ChildHandleBuffer\r
+  );\r
+\r
+//\r
+// VGA Mini Port Protocol functions\r
+//\r
+EFI_STATUS\r
+EFIAPI\r
+PciVgaMiniPortSetMode (\r
+  IN  EFI_VGA_MINI_PORT_PROTOCOL  *This,\r
+  IN  UINTN                       ModeNumber\r
+  );\r
+\r
+#endif\r