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 8eac997..f11158b 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 68c4830..c5fa534 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 e0d2010..12cb766 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 8f32abf..2d6dc83 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 edead72..12673c9 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 3b0e69e..c0cec60 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 ed56578..43d3e38 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 71d9339..909912f 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 14f8bf2..96c5be4 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 ecb32f9..a5692f4 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 6a3778c..2ef31fb 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 15f02d6..e1d0f8d 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 88c4c3a..4be2c38 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 6a9cf13..34ab758 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 8cd6b8e..acba154 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 7bbb6f7..837a600 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 913ac22..d9b094d 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 7bbbb0f..7d16b5a 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 dd1c927..d778497 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 a59de11..ec496a6 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 932b8c5..0d57f76 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 81da020..0632473 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 684c664..9e8dbbe 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 8f52c34..973f13d 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 05edbd0..25b0429 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 cc925b1..7a1c23d 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 c7c1bdd..6621b64 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 1cb26fe..d378ae3 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 59e33b2..504d983 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 c42cc9c..303f354 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 57a44a0..7bdc78f 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 c193730..c83ca37 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