Apply library to test controller handle.
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 23 Nov 2007 06:10:27 +0000 (06:10 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 23 Nov 2007 06:10:27 +0000 (06:10 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4323 6f19259b-4bc3-4df7-8a09-765794883524

OptionRomPkg/CirrusLogic5430Dxe/ComponentName.c

index 8fddfc5..1a98b37 100644 (file)
@@ -175,9 +175,7 @@ CirrusLogic5430ComponentNameGetControllerName (
   OUT CHAR16                                          **ControllerName\r
   )\r
 {\r
   OUT CHAR16                                          **ControllerName\r
   )\r
 {\r
-  EFI_UGA_DRAW_PROTOCOL           *UgaDraw;\r
   EFI_STATUS                      Status;\r
   EFI_STATUS                      Status;\r
-  EFI_PCI_IO_PROTOCOL             *PciIoProtocol;\r
 \r
   //\r
   // This is a device driver, so ChildHandle must be NULL.\r
 \r
   //\r
   // This is a device driver, so ChildHandle must be NULL.\r
@@ -187,42 +185,13 @@ CirrusLogic5430ComponentNameGetControllerName (
   }\r
 \r
   //\r
   }\r
 \r
   //\r
-  // Check Controller's handle\r
+  // Make sure this driver is currently managing ControllHandle\r
   //\r
   //\r
-  Status = gBS->OpenProtocol (\r
-                  ControllerHandle,\r
-                  &gEfiPciIoProtocolGuid,\r
-                  (VOID **) &PciIoProtocol,\r
-                  gCirrusLogic5430DriverBinding.DriverBindingHandle,\r
-                  ControllerHandle,\r
-                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
-                  );\r
-  if (!EFI_ERROR (Status)) {\r
-    gBS->CloseProtocol (\r
-          ControllerHandle,\r
-          &gEfiPciIoProtocolGuid,\r
-          gCirrusLogic5430DriverBinding.DriverBindingHandle,\r
-          ControllerHandle\r
-          );\r
-\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
-  if (Status != EFI_ALREADY_STARTED) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
-  //\r
-  // Get the UGA Draw Protocol on Controller\r
-  //\r
-  Status = gBS->OpenProtocol (\r
-                  ControllerHandle,\r
-                  &gEfiUgaDrawProtocolGuid,\r
-                  (VOID **) &UgaDraw,\r
-                  gCirrusLogic5430DriverBinding.DriverBindingHandle,\r
-                  ControllerHandle,\r
-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                  );\r
+  Status = EfiTestManagedDevice (\r
+             ControllerHandle,\r
+             gCirrusLogic5430DriverBinding.DriverBindingHandle,\r
+             &gEfiPciIoProtocolGuid\r
+             );\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r