break;\r
}\r
}\r
- FreePool (OpenInfoBuffer);\r
\r
- if (Index < EntryCount) {\r
- //\r
- // If gEfiSerialIoProtocolGuid is opened by one child device, return\r
- //\r
- return Status;\r
- }\r
- //\r
- // If gEfiSerialIoProtocolGuid is not opened by any child device,\r
- // go further to create child device handle based on RemainingDevicePath\r
- //\r
+ FreePool (OpenInfoBuffer);\r
+ return Status;\r
}\r
\r
if (RemainingDevicePath != NULL) {\r
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;\r
EFI_DEV_PATH_PTR Node;\r
\r
+ //\r
+ // Check RemainingDevicePath validation\r
+ //\r
if (RemainingDevicePath != NULL) {\r
- Node.DevPath = RemainingDevicePath;\r
- if (Node.DevPath->Type != HARDWARE_DEVICE_PATH ||\r
- Node.DevPath->SubType != HW_PCI_DP ||\r
- DevicePathNodeLength(Node.DevPath) != sizeof(PCI_DEVICE_PATH)) {\r
- return EFI_UNSUPPORTED;\r
+ //\r
+ // Check if RemainingDevicePath is the End of Device Path Node, \r
+ // if yes, go on checking other conditions\r
+ //\r
+ if (!IsDevicePathEnd (RemainingDevicePath)) {\r
+ //\r
+ // If RemainingDevicePath isn't the End of Device Path Node,\r
+ // check its validation\r
+ //\r
+ Node.DevPath = RemainingDevicePath;\r
+ if (Node.DevPath->Type != HARDWARE_DEVICE_PATH ||\r
+ Node.DevPath->SubType != HW_PCI_DP ||\r
+ DevicePathNodeLength(Node.DevPath) != sizeof(PCI_DEVICE_PATH)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
}\r
}\r
+\r
//\r
- // Open the IO Abstraction(s) needed to perform the supported test\r
+ // Check if Pci Root Bridge IO protocol is installed by platform\r
//\r
Status = gBS->OpenProtocol (\r
Controller,\r
- &gEfiDevicePathProtocolGuid,\r
- (VOID **) &ParentDevicePath,\r
+ &gEfiPciRootBridgeIoProtocolGuid,\r
+ (VOID **) &PciRootBridgeIo,\r
This->DriverBindingHandle,\r
Controller,\r
EFI_OPEN_PROTOCOL_BY_DRIVER\r
return Status;\r
}\r
\r
+ //\r
+ // Close the I/O Abstraction(s) used to perform the supported test\r
+ //\r
gBS->CloseProtocol (\r
Controller,\r
- &gEfiDevicePathProtocolGuid,\r
+ &gEfiPciRootBridgeIoProtocolGuid,\r
This->DriverBindingHandle,\r
Controller\r
);\r
\r
//\r
- // Check if Pci Root Bridge IO protocol is installed by platform\r
+ // Open the EFI Device Path protocol needed to perform the supported test\r
//\r
Status = gBS->OpenProtocol (\r
Controller,\r
- &gEfiPciRootBridgeIoProtocolGuid,\r
- (VOID **) &PciRootBridgeIo,\r
+ &gEfiDevicePathProtocolGuid,\r
+ (VOID **) &ParentDevicePath,\r
This->DriverBindingHandle,\r
Controller,\r
EFI_OPEN_PROTOCOL_BY_DRIVER\r
return Status;\r
}\r
\r
+ //\r
+ // Close protocol, don't use device path protocol in the Support() function\r
+ //\r
gBS->CloseProtocol (\r
Controller,\r
- &gEfiPciRootBridgeIoProtocolGuid,\r
+ &gEfiDevicePathProtocolGuid,\r
This->DriverBindingHandle,\r
Controller\r
);\r
{\r
EFI_STATUS Status;\r
\r
+ //\r
+ // Check RemainingDevicePath validation\r
+ //\r
+ if (RemainingDevicePath != NULL) {\r
+ //\r
+ // Check if RemainingDevicePath is the End of Device Path Node, \r
+ // if yes, return EFI_SUCCESS\r
+ //\r
+ if (IsDevicePathEnd (RemainingDevicePath)) {\r
+ return EFI_SUCCESS;\r
+ }\r
+ }\r
+\r
Status = gBS->LocateProtocol (\r
&gEfiIncompatiblePciDeviceSupportProtocolGuid,\r
NULL,\r
EFI_DISK_IO_PROTOCOL *DiskIo;\r
EFI_DEV_PATH *Node;\r
\r
+ //\r
+ // Check RemainingDevicePath validation\r
+ //\r
if (RemainingDevicePath != NULL) {\r
- Node = (EFI_DEV_PATH *) RemainingDevicePath;\r
- if (Node->DevPath.Type != MEDIA_DEVICE_PATH ||\r
+ //\r
+ // Check if RemainingDevicePath is the End of Device Path Node, \r
+ // if yes, go on checking other conditions\r
+ //\r
+ if (!IsDevicePathEnd (RemainingDevicePath)) {\r
+ //\r
+ // If RemainingDevicePath isn't the End of Device Path Node,\r
+ // check its validation\r
+ //\r
+ Node = (EFI_DEV_PATH *) RemainingDevicePath;\r
+ if (Node->DevPath.Type != MEDIA_DEVICE_PATH ||\r
Node->DevPath.SubType != MEDIA_HARDDRIVE_DP ||\r
- DevicePathNodeLength (&Node->DevPath) != sizeof (HARDDRIVE_DEVICE_PATH)\r
- ) {\r
+ DevicePathNodeLength (&Node->DevPath) != sizeof (HARDDRIVE_DEVICE_PATH)) {\r
return EFI_UNSUPPORTED;\r
+ }\r
}\r
}\r
+\r
//\r
// Open the IO Abstraction(s) needed to perform the supported test\r
//\r
Status = gBS->OpenProtocol (\r
ControllerHandle,\r
- &gEfiDevicePathProtocolGuid,\r
- (VOID **) &ParentDevicePath,\r
+ &gEfiDiskIoProtocolGuid,\r
+ (VOID **) &DiskIo,\r
This->DriverBindingHandle,\r
ControllerHandle,\r
EFI_OPEN_PROTOCOL_BY_DRIVER\r
//\r
gBS->CloseProtocol (\r
ControllerHandle,\r
- &gEfiDevicePathProtocolGuid,\r
+ &gEfiDiskIoProtocolGuid,\r
This->DriverBindingHandle,\r
ControllerHandle\r
);\r
\r
//\r
- // Open the IO Abstraction(s) needed to perform the supported test\r
+ // Open the EFI Device Path protocol needed to perform the supported test\r
//\r
Status = gBS->OpenProtocol (\r
ControllerHandle,\r
- &gEfiDiskIoProtocolGuid,\r
- (VOID **) &DiskIo,\r
+ &gEfiDevicePathProtocolGuid,\r
+ (VOID **) &ParentDevicePath,\r
This->DriverBindingHandle,\r
ControllerHandle,\r
EFI_OPEN_PROTOCOL_BY_DRIVER\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
+\r
//\r
- // Close the I/O Abstraction(s) used to perform the supported test\r
+ // Close protocol, don't use device path protocol in the Support() function\r
//\r
gBS->CloseProtocol (\r
ControllerHandle,\r
- &gEfiDiskIoProtocolGuid,\r
+ &gEfiDevicePathProtocolGuid,\r
This->DriverBindingHandle,\r
ControllerHandle\r
);\r
PARTITION_DETECT_ROUTINE *Routine;\r
BOOLEAN MediaPresent;\r
\r
+ //\r
+ // Check RemainingDevicePath validation\r
+ //\r
+ if (RemainingDevicePath != NULL) {\r
+ //\r
+ // Check if RemainingDevicePath is the End of Device Path Node, \r
+ // if yes, return EFI_SUCCESS\r
+ //\r
+ if (IsDevicePathEnd (RemainingDevicePath)) {\r
+ return EFI_SUCCESS;\r
+ }\r
+ }\r
+\r
Status = gBS->OpenProtocol (\r
ControllerHandle,\r
&gEfiBlockIoProtocolGuid,\r
break;\r
}\r
}\r
+\r
FreePool (OpenInfoBuffer);\r
- \r
- if (Index < EntryCount) {\r
- //\r
- // If gEfiWinNtIoProtocolGuid is opened by one child device, return\r
- //\r
- return Status;\r
- }\r
- //\r
- // If gEfiWinNtIoProtocolGuid is not opened by any child device,\r
- // go further to create child device handle based on RemainingDevicePath\r
- //\r
+ return Status;\r
}\r
\r
if (RemainingDevicePath == NULL) {\r
}\r
\r
FreePool (OpenInfoBuffer);\r
- if (Index < EntryCount) {\r
- //\r
- // If gEfiUnixIoProtocolGuid is opened by one child device, return\r
- //\r
- return Status;\r
- }\r
- //\r
- // If gEfiUnixIoProtocolGuid is not opened by any child device,\r
- // go further to create child device handle based on RemainingDevicePath\r
- //\r
+ return Status;\r
}\r
\r
if (RemainingDevicePath == NULL) {\r