Fix component name bugs when input Controller Name is invalid
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 19 Jan 2007 08:06:15 +0000 (08:06 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 19 Jan 2007 08:06:15 +0000 (08:06 +0000)
Fix the driver binding version for platform/OEM specific drivers

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2274 6f19259b-4bc3-4df7-8a09-765794883524

32 files changed:
EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.c
EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.c
EdkModulePkg/Bus/Pci/Ehci/Dxe/ComponentName.c
EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.c
EdkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.c
EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.c
EdkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.c
EdkModulePkg/Bus/Pci/Uhci/Dxe/ComponentName.c
EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.c
EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Init.c
EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.c
EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ComponentName.c
EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.c
EdkModulePkg/Bus/Usb/UsbBot/Dxe/ComponentName.c
EdkModulePkg/Bus/Usb/UsbBot/Dxe/bot.c
EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.c
EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/Cbi0.c
EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/ComponentName.c
EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi1.c
EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.c
EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.c
EdkModulePkg/Bus/Usb/UsbMouse/Dxe/usbmouse.c
EdkModulePkg/Universal/ConPlatform/Dxe/ConPlatform.c
EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c
EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c
EdkModulePkg/Universal/Console/Terminal/Dxe/ComponentName.c
EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.c
EdkModulePkg/Universal/Disk/DiskIo/Dxe/diskio.c
EdkModulePkg/Universal/Disk/Partition/Dxe/Partition.c
EdkModulePkg/Universal/Network/PxeBc/Dxe/bc.c
EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4.c
EdkModulePkg/Universal/Network/Snp32_64/Dxe/snp.c

index 8eac997fc7a4ba482e514240b1ad4553ff5b9076..f11158bb9ce4c56ff3f99d68e775648e50fca898 100644 (file)
@@ -93,7 +93,7 @@ EFI_DRIVER_BINDING_PROTOCOL gAtapiScsiPassThruDriverBinding = {
   AtapiScsiPassThruDriverBindingSupported,\r
   AtapiScsiPassThruDriverBindingStart,\r
   AtapiScsiPassThruDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 68c483071cfda4bce1e4ec75d675e3241718971d..c5fa53464fbd9f87fdc3f017a47649b6c7c5dcc6 100644 (file)
@@ -30,7 +30,7 @@ EFI_DRIVER_BINDING_PROTOCOL gCirrusLogic5430DriverBinding = {
   CirrusLogic5430ControllerDriverSupported,\r
   CirrusLogic5430ControllerDriverStart,\r
   CirrusLogic5430ControllerDriverStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index e0d2010cd44f97c7d6594b01eac604d1fc3b6bb9..12cb7665d1b13e8181fa821282bbbe08e8ea0759 100644 (file)
@@ -162,6 +162,17 @@ EhciComponentNameGetControllerName (
     return EFI_UNSUPPORTED;\r
   }\r
   //\r
+  // Make sure this driver is currently managing ControllerHandle\r
+  //\r
+  Status = EfiTestManagedDevice (\r
+             ControllerHandle,\r
+             gEhciDriverBinding.DriverBindingHandle,\r
+             &gEfiPciIoProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+  //\r
   // Get the device context\r
   //\r
   Status = gBS->OpenProtocol (\r
index 8f32abf0dcef35c62858c64a312c51323b93c978..2d6dc838a4a71218ae68bf23498b71b332127317 100644 (file)
@@ -218,7 +218,7 @@ EFI_DRIVER_BINDING_PROTOCOL gEhciDriverBinding = {
   EhciDriverBindingSupported,\r
   EhciDriverBindingStart,\r
   EhciDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index edead729b40d5d12fe9866cc029d763dadd0d414..12673c9c92b66c8913b94e43632186d12d2dc7f5 100644 (file)
@@ -125,16 +125,13 @@ IDEBusComponentNameGetControllerName (
   IDE_BLK_IO_DEV        *IdeBlkIoDevice;\r
 \r
   //\r
-  // Get the controller context\r
+  // Make sure this driver is currently managing ControllHandle\r
   //\r
-  Status = gBS->OpenProtocol (\r
-                  ControllerHandle,\r
-                  &gEfiCallerIdGuid,\r
-                  NULL,\r
-                  gIDEBusDriverBinding.DriverBindingHandle,\r
-                  ControllerHandle,\r
-                  EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
-                  );\r
+  Status = EfiTestManagedDevice (\r
+             ControllerHandle,\r
+             gIDEBusDriverBinding.DriverBindingHandle,\r
+             &gEfiIdeControllerInitProtocolGuid\r
+             );\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
@@ -148,6 +145,15 @@ IDEBusComponentNameGetControllerName (
             );\r
   }\r
 \r
+  Status = EfiTestChildHandle (\r
+             ControllerHandle,\r
+             ChildHandle,\r
+             &gEfiPciIoProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
   //\r
   // Get the child context\r
   //\r
index 3b0e69e929162aa2437219afa859a931055ede6f..c0cec601b8696ba6df900b082c39c1435c51a449 100644 (file)
@@ -26,7 +26,7 @@ EFI_DRIVER_BINDING_PROTOCOL gIDEBusDriverBinding = {
   IDEBusDriverBindingSupported,\r
   IDEBusDriverBindingStart,\r
   IDEBusDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index ed56578757d9a2dbc161e6bb9e80742504a8768f..43d3e38dd1de066718337056601d0e8b05313cbe 100644 (file)
@@ -67,7 +67,7 @@ EFI_DRIVER_BINDING_PROTOCOL                   gPciBusDriverBinding = {
   PciBusDriverBindingSupported,\r
   PciBusDriverBindingStart,\r
   PciBusDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 71d9339a8fb36078e327b193848cac5af4ca5326..909912f329f11924f977e2e8d1414e402573db20 100644 (file)
@@ -162,6 +162,17 @@ UhciComponentNameGetControllerName (
     return EFI_UNSUPPORTED;\r
   }\r
   //\r
+  // Make sure this driver is currently managing ControllerHandle\r
+  //\r
+  Status = EfiTestManagedDevice (\r
+             ControllerHandle,\r
+             gUhciDriverBinding.DriverBindingHandle,\r
+             &gEfiPciIoProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+  //\r
   // Get the device context\r
   //\r
   Status = gBS->OpenProtocol (\r
index 14f8bf27902de98fab4ce3d9be6cd6bed4267809..96c5be48ba22373e8a4d534c803cd9ee5f0600c0 100644 (file)
@@ -364,7 +364,7 @@ EFI_DRIVER_BINDING_PROTOCOL gUhciDriverBinding = {
   UHCIDriverBindingSupported,\r
   UHCIDriverBindingStart,\r
   UHCIDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index ecb32f9adf517ace92c1f5e884a724e04b038a4a..a5692f4dbd3da7809b62a4f25e08b7eeb4f41e63 100644 (file)
@@ -192,7 +192,7 @@ EFI_DRIVER_BINDING_PROTOCOL  gUndiDriverBinding = {
   UndiDriverSupported,\r
   UndiDriverStart,\r
   UndiDriverStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 6a3778c9191631dee39ed9ee7620c50b98bfbbc5..2ef31fb38c28fdffe11ee18ec14c5688a578996e 100644 (file)
@@ -50,7 +50,7 @@ EFI_DRIVER_BINDING_PROTOCOL gSCSIBusDriverBinding = {
   SCSIBusDriverBindingSupported,\r
   SCSIBusDriverBindingStart,\r
   SCSIBusDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 15f02d6c41a22b53fea34991ffe9d088f52e79a4..e1d0f8d4700815ead489500cbfa2a20941a80ffc 100644 (file)
@@ -162,6 +162,17 @@ ScsiDiskComponentNameGetControllerName (
     return EFI_UNSUPPORTED;\r
   }\r
   \r
+  //\r
+  // Make sure this driver is currently managing ControllerHandle\r
+  //\r
+  Status = EfiTestManagedDevice (\r
+             ControllerHandle,\r
+             gScsiDiskDriverBinding.DriverBindingHandle,\r
+             &gEfiScsiIoProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
   //\r
   // Get the device context\r
   //\r
index 88c4c3aec8ad5e291b87bc1b9e8cdaffa7ce7c98..4be2c388177f4e34e1f1a3210f593d6db8f4f1dd 100644 (file)
@@ -48,7 +48,7 @@ EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding = {
   ScsiDiskDriverBindingSupported,\r
   ScsiDiskDriverBindingStart,\r
   ScsiDiskDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 6a9cf13456a7cfd01697396a27c8ba2d0ade4986..34ab75864f0c5ecee3d0bb8a4e8245db30ef3dd3 100644 (file)
@@ -161,7 +161,17 @@ UsbBotComponentNameGetControllerName (
   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
+             gUsbBotDriverBinding.DriverBindingHandle,\r
+             &gEfiUsbIoProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
   //\r
   // Get the device context\r
   //\r
index 8cd6b8e6f6bf2651e32f0961cfb749a2726a3454..acba154842dc24047047665867ca3d49a65fa73f 100644 (file)
@@ -62,7 +62,7 @@ EFI_DRIVER_BINDING_PROTOCOL   gUsbBotDriverBinding = {
   BotDriverBindingSupported,\r
   BotDriverBindingStart,\r
   BotDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 7bbb6f7a06060d07aabde1066adcd20cb3327260..837a6001dd44262c670e95f0720374a0a4835412 100644 (file)
@@ -68,7 +68,7 @@ EFI_DRIVER_BINDING_PROTOCOL gUsbBusDriverBinding = {
   UsbBusControllerDriverSupported,\r
   UsbBusControllerDriverStart,\r
   UsbBusControllerDriverStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 913ac225e9121e0447ced2e6e474595354bd85fa..d9b094d1143b666913193e8886149dac7e1d33f6 100644 (file)
@@ -73,7 +73,7 @@ EFI_DRIVER_BINDING_PROTOCOL         gUsbCbi0DriverBinding = {
   Cbi0DriverBindingSupported,\r
   Cbi0DriverBindingStart,\r
   Cbi0DriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 7bbbb0f70162a4fe48a6b2edcd18f299d3480e05..7d16b5a1e39f4ee8e5955c724e375642696cca03 100644 (file)
@@ -163,7 +163,17 @@ UsbCbi0ComponentNameGetControllerName (
   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
+             gUsbCbi0DriverBinding.DriverBindingHandle,\r
+             &gEfiUsbIoProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
   //\r
   // Get the device context\r
   //\r
index dd1c927daec0ab244baca2cf0ad84a967c969fb5..d778497096df0a912a98c3aabb15f31dc6e141c3 100644 (file)
@@ -117,7 +117,7 @@ EFI_DRIVER_BINDING_PROTOCOL   gCBI1DriverBinding = {
   CBI1DriverBindingSupported,\r
   CBI1DriverBindingStart,\r
   CBI1DriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index a59de119982cee48d276786c92387508e48c9b13..ec496a6e39ba7f0a5b7828606c503d5e16c0d43b 100644 (file)
@@ -103,7 +103,7 @@ EFI_DRIVER_BINDING_PROTOCOL gUsbKeyboardDriverBinding = {
   USBKeyboardDriverBindingSupported,\r
   USBKeyboardDriverBindingStart,\r
   USBKeyboardDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 932b8c5ed90bb13d172684f26846d1e8b1d680e6..0d57f7642d64c1d3ad17da72a0ae4d90c3d4bf2b 100644 (file)
@@ -109,7 +109,7 @@ EFI_DRIVER_BINDING_PROTOCOL         gUSBFloppyDriverBinding = {
   USBFloppyDriverBindingSupported,\r
   USBFloppyDriverBindingStart,\r
   USBFloppyDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 81da0205a46351fdc8a68042a4c4809ecaa4aa4d..063247376b325767584bbbdd873cba1363acaf6f 100644 (file)
@@ -61,7 +61,7 @@ EFI_DRIVER_BINDING_PROTOCOL gUsbMouseDriverBinding = {
   USBMouseDriverBindingSupported,\r
   USBMouseDriverBindingStart,\r
   USBMouseDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 684c66485235d600a6e0584e12c7a9447cb7dcf1..9e8dbbee7b878c0ee4cd6425b2f4f45e3db72fc9 100644 (file)
@@ -23,7 +23,7 @@ EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding = {
   ConPlatformTextInDriverBindingSupported,\r
   ConPlatformTextInDriverBindingStart,\r
   ConPlatformDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
@@ -32,7 +32,7 @@ EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding = {
   ConPlatformTextOutDriverBindingSupported,\r
   ConPlatformTextOutDriverBindingStart,\r
   ConPlatformDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 8f52c341dcf5ad331c789b4880427965cdda002c..973f13d0f3e66390dfe70b30760bbbac08ddb7e2 100644 (file)
@@ -217,7 +217,7 @@ EFI_DRIVER_BINDING_PROTOCOL           gConSplitterConInDriverBinding = {
   ConSplitterConInDriverBindingSupported,\r
   ConSplitterConInDriverBindingStart,\r
   ConSplitterConInDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
@@ -226,7 +226,7 @@ EFI_DRIVER_BINDING_PROTOCOL           gConSplitterSimplePointerDriverBinding = {
   ConSplitterSimplePointerDriverBindingSupported,\r
   ConSplitterSimplePointerDriverBindingStart,\r
   ConSplitterSimplePointerDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
@@ -235,7 +235,7 @@ EFI_DRIVER_BINDING_PROTOCOL           gConSplitterConOutDriverBinding = {
   ConSplitterConOutDriverBindingSupported,\r
   ConSplitterConOutDriverBindingStart,\r
   ConSplitterConOutDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
@@ -244,7 +244,7 @@ EFI_DRIVER_BINDING_PROTOCOL           gConSplitterStdErrDriverBinding = {
   ConSplitterStdErrDriverBindingSupported,\r
   ConSplitterStdErrDriverBindingStart,\r
   ConSplitterStdErrDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 05edbd0fec436db67c1403d1f164d7ceb688e73b..25b0429b1bc23ef47b3ecc1660fa41f502e21c9c 100644 (file)
@@ -144,7 +144,7 @@ EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding = {
   GraphicsConsoleControllerDriverSupported,\r
   GraphicsConsoleControllerDriverStart,\r
   GraphicsConsoleControllerDriverStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index cc925b13c907f73a1cc34cca72968ba21a98b3bb..7a1c23d17c5d5a8aaf80cc9cbd3eb5d401580c0e 100644 (file)
@@ -162,12 +162,34 @@ TerminalComponentNameGetControllerName (
   EFI_SIMPLE_TEXT_OUT_PROTOCOL  *SimpleTextOutput;\r
   TERMINAL_DEV                  *TerminalDevice;\r
 \r
+  //\r
+  // Make sure this driver is currently managing ControllHandle\r
+  //\r
+  Status = EfiTestManagedDevice (\r
+             ControllerHandle,\r
+             gTerminalDriverBinding.DriverBindingHandle,\r
+             &gEfiSerialIoProtocolGuid\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
   if (ChildHandle == NULL) {\r
     return EFI_UNSUPPORTED;\r
   }\r
+\r
+  Status = EfiTestChildHandle (\r
+             ControllerHandle,\r
+             ChildHandle,\r
+             &gEfiSerialIoProtocolGuid\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
   //\r
   // Get our context back\r
   //\r
index c7c1bdda8f8faf78c1e746e39c8d2ddf5a18b910..6621b64ace6b020014aec5a4b1164550205f2264 100644 (file)
@@ -57,7 +57,7 @@ EFI_DRIVER_BINDING_PROTOCOL gTerminalDriverBinding = {
   TerminalDriverBindingSupported,\r
   TerminalDriverBindingStart,\r
   TerminalDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 1cb26fe97628a531c31a3b2e6c215fedf57c4a40..d378ae3e33322efc73721a51e58f804674304b4e 100644 (file)
@@ -88,7 +88,7 @@ EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding = {
   DiskIoDriverBindingSupported,\r
   DiskIoDriverBindingStart,\r
   DiskIoDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 59e33b27c11ec780a6c7fc13aeb4971bf40ca99f..504d98357fabee76023071c33b0112613ebdcee5 100644 (file)
@@ -66,7 +66,7 @@ EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding = {
   PartitionDriverBindingSupported,\r
   PartitionDriverBindingStart,\r
   PartitionDriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index c42cc9cca8a984f5f97f5f3f730d92c6f0afab8a..303f3547ae6f855b7e6533a5df096c939e956616 100644 (file)
@@ -2119,7 +2119,7 @@ EFI_DRIVER_BINDING_PROTOCOL gPxeBcDriverBinding = {
   PxeBcDriverSupported,\r
   PxeBcDriverStart,\r
   PxeBcDriverStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index 57a44a02b41af0baca62c213fd180db4c97860c9..7bdc78fb512e50228f07a1502fea179e520fbcce 100644 (file)
@@ -66,7 +66,7 @@ EFI_DRIVER_BINDING_PROTOCOL gPxeDhcp4DriverBinding = {
   PxeDhcp4DriverBindingSupported,\r
   PxeDhcp4DriverBindingStart,\r
   PxeDhcp4DriverBindingStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r
index c193730ffa03be3e51bdf5d2156831ce3c75ddf5..c83ca377ab67ba40feb9c9f0fc6b5688ccb58420 100644 (file)
@@ -79,7 +79,7 @@ EFI_DRIVER_BINDING_PROTOCOL mSimpleNetworkDriverBinding = {
   SimpleNetworkDriverSupported,\r
   SimpleNetworkDriverStart,\r
   SimpleNetworkDriverStop,\r
-  0x10,\r
+  0xa,\r
   NULL,\r
   NULL\r
 };\r