]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/ComponentName.c
IntelFrameworkModulePkg: Remove a duplicated hardcode string
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / IsaSerialDxe / ComponentName.c
index 4534b537294c92d2fa49779f30e458afe7645884..4b17c5423c643a72695dbeac18cd36a1905b7365 100644 (file)
@@ -1,8 +1,8 @@
-/**@file\r
+/** @file\r
+  UEFI Component Name and Name2 protocol for Isa serial driver.\r
 \r
-  \r
-Copyright (c) 2006 - 2007, Intel Corporation.<BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -17,23 +17,23 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 //\r
 // EFI Component Name Protocol\r
 //\r
-EFI_COMPONENT_NAME_PROTOCOL  gIsaSerialComponentName = {\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gIsaSerialComponentName = {\r
   IsaSerialComponentNameGetDriverName,\r
   IsaSerialComponentNameGetControllerName,\r
   "eng"\r
-  };\r
+};\r
 \r
 //\r
 // EFI Component Name 2 Protocol\r
 //\r
-EFI_COMPONENT_NAME2_PROTOCOL gIsaSerialComponentName2 = {\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gIsaSerialComponentName2 = {\r
   (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) IsaSerialComponentNameGetDriverName,\r
   (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) IsaSerialComponentNameGetControllerName,\r
   "en"\r
-  };\r
+};\r
 \r
 \r
-STATIC EFI_UNICODE_STRING_TABLE mIsaSerialDriverNameTable[] = {\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIsaSerialDriverNameTable[] = {\r
   {\r
     "eng;en",\r
     L"ISA Serial Driver"\r
@@ -44,6 +44,8 @@ STATIC EFI_UNICODE_STRING_TABLE mIsaSerialDriverNameTable[] = {
   }\r
 };\r
 \r
+GLOBAL_REMOVE_IF_UNREFERENCED CHAR16 mSerialPortName[] = L"ISA Serial Port # ";\r
+\r
 /**\r
   Retrieves a Unicode string that is the user readable name of the driver.\r
 \r
@@ -64,7 +66,7 @@ STATIC EFI_UNICODE_STRING_TABLE mIsaSerialDriverNameTable[] = {
                                 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
+                                in RFC 4646 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
@@ -137,7 +139,7 @@ IsaSerialComponentNameGetDriverName (
                                 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
+                                RFC 4646 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
@@ -151,7 +153,7 @@ IsaSerialComponentNameGetDriverName (
                                 driver specified by This was returned in\r
                                 DriverName.\r
 \r
-  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
 \r
   @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
                                 EFI_HANDLE.\r
@@ -227,44 +229,33 @@ IsaSerialComponentNameGetControllerName (
            );\r
 }\r
 \r
+/**\r
+  Add the ISO639-2 and RFC4646 component name both for the Serial IO device\r
+\r
+  @param SerialDevice     A pointer to the SERIAL_DEV instance.\r
+\r
+  @param IsaIo            A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+\r
+**/\r
 VOID\r
 AddName (\r
   IN  SERIAL_DEV                               *SerialDevice,\r
   IN  EFI_ISA_IO_PROTOCOL                      *IsaIo\r
   )\r
-/*++\r
-\r
-  Routine Description:\r
-  \r
-    Add the component name for the serial io device\r
-\r
-  Arguments:\r
-  \r
-    SerialDevice              - A pointer to the SERIAL_DEV instance.\r
-    IsaIo                     - A pointer to the EFI_ISA_IO_PROTOCOL or EFI_LIGHT_ISA_IO_PROTOCOL instance.\r
-    \r
-  Returns:\r
-\r
-    None\r
-    \r
---*/\r
 {\r
-  CHAR16  SerialPortName[sizeof (SERIAL_PORT_NAME)];\r
-\r
-  StrCpy (SerialPortName, L"ISA Serial Port # ");\r
-  SerialPortName[sizeof (SERIAL_PORT_NAME) - 2] = (CHAR16) (L'0' + (UINT8) IsaIo->ResourceList->Device.UID);\r
+  mSerialPortName[(sizeof (mSerialPortName) / 2) - 2] = (CHAR16) (L'0' + (UINT8) IsaIo->ResourceList->Device.UID);\r
   AddUnicodeString2 (\r
     "eng",\r
     gIsaSerialComponentName.SupportedLanguages,\r
     &SerialDevice->ControllerNameTable,\r
-    (CHAR16 *) SerialPortName,\r
+    mSerialPortName,\r
     TRUE\r
     );\r
   AddUnicodeString2 (\r
     "en",\r
     gIsaSerialComponentName2.SupportedLanguages,\r
     &SerialDevice->ControllerNameTable,\r
-    (CHAR16 *) SerialPortName,\r
+    mSerialPortName,\r
     FALSE\r
     );\r
 \r