Revision: 17289
          http://sourceforge.net/p/edk2/code/17289
Author:   hwu1225
Date:     2015-05-05 02:34:20 +0000 (Tue, 05 May 2015)
Log Message:
-----------
IntelFrameworkModulePkg: Modify IsaSerialDxe to follow driver rules

IsaSerialDxe creates child handles and wishes to retrieve the name for
those child controllers.

However, in the IsaSerialComponentNameGetControllerName() function, it
directly return EFI_UNSUPPORTED when ChildHandle != NULL.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Reviewed-by: Michael Kinney <[email protected]>

Modified Paths:
--------------
    trunk/edk2/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/ComponentName.c

Modified: 
trunk/edk2/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/ComponentName.c
===================================================================
--- trunk/edk2/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/ComponentName.c     
2015-05-05 01:40:16 UTC (rev 17288)
+++ trunk/edk2/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/ComponentName.c     
2015-05-05 02:34:20 UTC (rev 17289)
@@ -180,17 +180,12 @@
   OUT CHAR16                                          **ControllerName
   )
 {
-  EFI_STATUS              Status;
-  EFI_SERIAL_IO_PROTOCOL  *SerialIo;
-  SERIAL_DEV              *SerialDevice;
+  EFI_STATUS                Status;
+  EFI_SERIAL_IO_PROTOCOL    *SerialIo;
+  SERIAL_DEV                *SerialDevice;
+  EFI_UNICODE_STRING_TABLE  *ControllerNameTable;
 
   //
-  // This is a device driver, so ChildHandle must be NULL.
-  //
-  if (ChildHandle != NULL) {
-    return EFI_UNSUPPORTED;
-  }
-  //
   // Make sure this driver is currently managing ControllerHandle
   //
   Status = EfiTestManagedDevice (
@@ -201,29 +196,44 @@
   if (EFI_ERROR (Status)) {
     return Status;
   }
-  //
-  // Get the Block I/O Protocol on Controller
-  //
-  Status = gBS->OpenProtocol (
-                  ControllerHandle,
-                  &gEfiSerialIoProtocolGuid,
-                  (VOID **) &SerialIo,
-                  gSerialControllerDriver.DriverBindingHandle,
-                  ControllerHandle,
-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL
-                  );
-  if (EFI_ERROR (Status)) {
-    return Status;
+
+  ControllerNameTable = NULL;
+  if (ChildHandle != NULL) {
+    Status = EfiTestChildHandle (
+               ControllerHandle,
+               ChildHandle,
+               &gEfiIsaIoProtocolGuid
+               );
+    if (EFI_ERROR (Status)) {
+      return Status;
+    }
+
+    //
+    // Get the Serial I/O Protocol from the child handle
+    //
+    Status = gBS->OpenProtocol (
+                    ChildHandle,
+                    &gEfiSerialIoProtocolGuid,
+                    (VOID **) &SerialIo,
+                    gSerialControllerDriver.DriverBindingHandle,
+                    ChildHandle,
+                    EFI_OPEN_PROTOCOL_GET_PROTOCOL
+                    );
+    if (EFI_ERROR (Status)) {
+      return Status;
+    }
+
+    //
+    // Get the Serial Controller's Device structure
+    //
+    SerialDevice = SERIAL_DEV_FROM_THIS (SerialIo);
+    ControllerNameTable = SerialDevice->ControllerNameTable;
   }
-  //
-  // Get the Serial Controller's Device structure
-  //
-  SerialDevice = SERIAL_DEV_FROM_THIS (SerialIo);
 
   return LookupUnicodeString2 (
            Language,
            This->SupportedLanguages,
-           SerialDevice->ControllerNameTable,
+           ControllerNameTable,
            ControllerName,
            (BOOLEAN)(This == &gIsaSerialComponentName)
            );


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to