Fix component name bugs when input Controller Name is invalid
authorqhuang8 <qhuang8@de2fecce-e211-0410-80a6-f3fac2684e05>
Fri, 19 Jan 2007 08:04:03 +0000 (08:04 +0000)
committerqhuang8 <qhuang8@de2fecce-e211-0410-80a6-f3fac2684e05>
Fri, 19 Jan 2007 08:04:03 +0000 (08:04 +0000)
Fix the driver binding version for platform/OEM specific drivers

git-svn-id: https://edk2.tianocore.org/svn/edk2/trunk@2273 de2fecce-e211-0410-80a6-f3fac2684e05

14 files changed:
edk2/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/ComponentName.c
edk2/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c
edk2/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ComponentName.c
edk2/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c
edk2/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/ComponentName.c
edk2/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c
edk2/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/ComponentName.c
edk2/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c
edk2/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/ComponentName.c
edk2/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c
edk2/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/ComponentName.c
edk2/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c
edk2/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/ComponentName.c
edk2/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c

index a24f6da..fb9cc42 100644 (file)
@@ -160,7 +160,17 @@ WinNtBlockIoComponentNameGetControllerName (
   if (ChildHandle != NULL) {\r
     return EFI_UNSUPPORTED;\r
   }\r
-\r
+  //\r
+  // Make sure this driver is currently managing ControllerHandle\r
+  //\r
+  Status = EfiTestManagedDevice (\r
+             ControllerHandle,\r
+             gWinNtBlockIoDriverBinding.DriverBindingHandle,\r
+             &gEfiWinNtIoProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
   //\r
   // Get our context back\r
   //\r
index 014f8a6..c160aaf 100644 (file)
@@ -66,7 +66,7 @@ EFI_DRIVER_BINDING_PROTOCOL gWinNtBlockIoDriverBinding = {
   WinNtBlockIoDriverBindingSupported,\r
   WinNtBlockIoDriverBindingStart,\r
   WinNtBlockIoDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index d10f9ab..81db085 100644 (file)
@@ -160,7 +160,17 @@ WinNtConsoleComponentNameGetControllerName (
   if (ChildHandle != NULL) {\r
     return EFI_UNSUPPORTED;\r
   }\r
-\r
+  //\r
+  // Make sure this driver is currently managing ControllerHandle\r
+  //\r
+  Status = EfiTestManagedDevice (\r
+             ControllerHandle,\r
+             gWinNtConsoleDriverBinding.DriverBindingHandle,\r
+             &gEfiWinNtIoProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
   //\r
   // Get out context back\r
   //\r
index 0bc344c..0027069 100644 (file)
@@ -50,7 +50,7 @@ EFI_DRIVER_BINDING_PROTOCOL gWinNtConsoleDriverBinding = {
   WinNtConsoleDriverBindingSupported,\r
   WinNtConsoleDriverBindingStart,\r
   WinNtConsoleDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 9263b3d..8bdf113 100644 (file)
@@ -162,8 +162,18 @@ WinNtGopComponentNameGetControllerName (
   if (ChildHandle != NULL) {
     return EFI_UNSUPPORTED;
   }
-
-  //
+  //\r
+  // Make sure this driver is currently managing ControllerHandle\r
+  //\r
+  Status = EfiTestManagedDevice (\r
+             ControllerHandle,\r
+             gWinNtGopDriverBinding.DriverBindingHandle,\r
+             &gEfiWinNtIoProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+  //\r
   // Get our context back
   //
   Status = gBS->OpenProtocol (
index 067033b..6013165 100644 (file)
@@ -28,7 +28,7 @@ EFI_DRIVER_BINDING_PROTOCOL gWinNtGopDriverBinding = {
   WinNtGopDriverBindingSupported,
   WinNtGopDriverBindingStart,
   WinNtGopDriverBindingStop,
-  0x10,
+  0xa,
   NULL,
   NULL
 };
index 8205786..d22f030 100644 (file)
@@ -154,6 +154,18 @@ WinNtSerialIoComponentNameGetControllerName (
   EFI_SERIAL_IO_PROTOCOL        *SerialIo;\r
   WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;\r
 \r
+  //\r
+  // Make sure this driver is currently managing ControllHandle\r
+  //\r
+  Status = EfiTestManagedDevice (\r
+             ControllerHandle,\r
+             gWinNtSerialIoDriverBinding.DriverBindingHandle,\r
+             &gEfiWinNtIoProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
   //\r
   // This is a bus driver, so ChildHandle must not be NULL.\r
   //\r
@@ -161,6 +173,15 @@ WinNtSerialIoComponentNameGetControllerName (
     return EFI_UNSUPPORTED;\r
   }\r
 \r
+  Status = EfiTestChildHandle (\r
+             ControllerHandle,\r
+             ChildHandle,\r
+             &gEfiWinNtIoProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
   //\r
   // Get our context back\r
   //\r
index 38c03a8..a4a7a32 100644 (file)
@@ -51,7 +51,7 @@ EFI_DRIVER_BINDING_PROTOCOL gWinNtSerialIoDriverBinding = {
   WinNtSerialIoDriverBindingSupported,\r
   WinNtSerialIoDriverBindingStart,\r
   WinNtSerialIoDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index de4abd7..c6240df 100644 (file)
@@ -167,6 +167,17 @@ WinNtSimpleFileSystemComponentNameGetControllerName (
     return EFI_UNSUPPORTED;\r
   }\r
 \r
+  //\r
+  // Make sure this driver is currently managing ControllerHandle\r
+  //\r
+  Status = EfiTestManagedDevice (\r
+             ControllerHandle,\r
+             gWinNtSimpleFileSystemDriverBinding.DriverBindingHandle,\r
+             &gEfiWinNtIoProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
   //\r
   // Get our context back\r
   //\r
index 5552bc2..bea7de4 100644 (file)
@@ -30,7 +30,7 @@ EFI_DRIVER_BINDING_PROTOCOL gWinNtSimpleFileSystemDriverBinding = {
   WinNtSimpleFileSystemDriverBindingSupported,\r
   WinNtSimpleFileSystemDriverBindingStart,\r
   WinNtSimpleFileSystemDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 7b9c297..9107719 100644 (file)
@@ -161,6 +161,17 @@ WinNtUgaComponentNameGetControllerName (
     return EFI_UNSUPPORTED;\r
   }\r
 \r
+  //\r
+  // Make sure this driver is currently managing ControllerHandle\r
+  //\r
+  Status = EfiTestManagedDevice (\r
+             ControllerHandle,\r
+             gWinNtUgaDriverBinding.DriverBindingHandle,\r
+             &gEfiWinNtIoProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
   //\r
   // Get our context back\r
   //\r
index 58908d9..a270ec7 100644 (file)
@@ -31,7 +31,7 @@ EFI_DRIVER_BINDING_PROTOCOL gWinNtUgaDriverBinding = {
   WinNtUgaDriverBindingSupported,\r
   WinNtUgaDriverBindingStart,\r
   WinNtUgaDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 7dee4bd..b03fc8b 100644 (file)
@@ -154,6 +154,18 @@ WinNtBusDriverComponentNameGetControllerName (
   EFI_WIN_NT_IO_PROTOCOL  *WinNtIo;\r
   WIN_NT_IO_DEVICE        *Private;\r
 \r
+  //\r
+  // Make sure this driver is currently managing ControllHandle\r
+  //\r
+  Status = EfiTestManagedDevice (\r
+             ControllerHandle,\r
+             gWinNtBusDriverBinding.DriverBindingHandle,\r
+             &gEfiWinNtThunkProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
   //\r
   // This is a bus driver, so ChildHandle can not be NULL.\r
   //\r
@@ -161,6 +173,15 @@ WinNtBusDriverComponentNameGetControllerName (
     return EFI_UNSUPPORTED;\r
   }\r
 \r
+  Status = EfiTestChildHandle (\r
+             ControllerHandle,\r
+             ChildHandle,\r
+             &gEfiWinNtThunkProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
   //\r
   // Get our context back\r
   //\r
index 4ce5286..5eddc08 100644 (file)
@@ -114,7 +114,7 @@ EFI_DRIVER_BINDING_PROTOCOL           gWinNtBusDriverBinding = {
   WinNtBusDriverBindingSupported,\r
   WinNtBusDriverBindingStart,\r
   WinNtBusDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r