diff options
Diffstat (limited to 'IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c')
-rw-r--r-- | IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c | 94 |
1 files changed, 53 insertions, 41 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c index 3c7159502d..0d182cf562 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c +++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c @@ -3,7 +3,7 @@ Child device(Disk, CDROM, etc) enumeration and child handler installation, and
driver stop.
- Copyright (c) 2006 - 2008, Intel Corporation
+ Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -151,69 +151,79 @@ IDEBusDriverBindingSupported ( if (RemainingDevicePath != NULL) {
Node = (EFI_DEV_PATH *) RemainingDevicePath;
- if (Node->DevPath.Type != MESSAGING_DEVICE_PATH ||
- Node->DevPath.SubType != MSG_ATAPI_DP ||
- DevicePathNodeLength(&Node->DevPath) != sizeof(ATAPI_DEVICE_PATH)) {
- return EFI_UNSUPPORTED;
+ //
+ // Check if RemainingDevicePath is the End of Device Path Node,
+ // if yes, go on checking other conditions
+ //
+ if (!IsDevicePathEnd (Node)) {
+ //
+ // If RemainingDevicePath isn't the End of Device Path Node,
+ // check its validation
+ //
+ if (Node->DevPath.Type != MESSAGING_DEVICE_PATH ||
+ Node->DevPath.SubType != MSG_ATAPI_DP ||
+ DevicePathNodeLength(&Node->DevPath) != sizeof(ATAPI_DEVICE_PATH)) {
+ return EFI_UNSUPPORTED;
+ }
}
}
//
- // Open the IO Abstraction(s) needed to perform the supported test
+ // Verify the Ide Controller Init Protocol, which installed by the
+ // IdeController module.
+ // Note 1: PciIo protocol has been opened BY_DRIVER by ide_init, so We can't
+ // open BY_DRIVER here) That's why we don't check pciio protocol
+ // Note 2: ide_init driver check ide controller's pci config space, so we dont
+ // check here any more to save code size
//
Status = gBS->OpenProtocol (
Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
+ &gEfiIdeControllerInitProtocolGuid,
+ (VOID **) &IdeInit,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
+
if (Status == EFI_ALREADY_STARTED) {
return EFI_SUCCESS;
}
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
//
- // Close protocol, don't use device path protocol in the .Support() function
+ // If protocols were opened normally, closed it
//
gBS->CloseProtocol (
Controller,
- &gEfiDevicePathProtocolGuid,
+ &gEfiIdeControllerInitProtocolGuid,
This->DriverBindingHandle,
Controller
);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
//
- // Verify the Ide Controller Init Protocol, which installed by the
- // IdeController module.
- // Note 1: PciIo protocol has been opened BY_DRIVER by ide_init, so We can't
- // open BY_DRIVER here) That's why we don't check pciio protocol
- // Note 2: ide_init driver check ide controller's pci config space, so we dont
- // check here any more to save code size
+ // Open the EFI Device Path protocol needed to perform the supported test
//
Status = gBS->OpenProtocol (
Controller,
- &gEfiIdeControllerInitProtocolGuid,
- (VOID **) &IdeInit,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &ParentDevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
-
if (Status == EFI_ALREADY_STARTED) {
return EFI_SUCCESS;
}
//
- // If protocols were opened normally, closed it
+ // Close protocol, don't use device path protocol in the Support() function
//
gBS->CloseProtocol (
Controller,
- &gEfiIdeControllerInitProtocolGuid,
+ &gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
Controller
);
@@ -415,28 +425,20 @@ IDEBusDriverBindingStart ( ConfigurationOptions = 0x0f;
}
- if (EnumAll) {
+ if (EnumAll || RemainingDevicePath == NULL) {
//
- // If IdeInit->EnumAll is TRUE, must enumerate all IDE device anyway
+ // If IdeInit->EnumAll is TRUE or RemainingDevicePath is NULL,
+ // must enumerate all IDE device anyway
//
BeginningIdeChannel = IdePrimary;
EndIdeChannel = IdeSecondary;
BeginningIdeDevice = IdeMaster;
EndIdeDevice = IdeSlave;
- } else if (RemainingDevicePath == NULL) {
- //
- // RemainingDevicePath is NULL, scan IDE bus for each device;
- //
- BeginningIdeChannel = IdePrimary;
- EndIdeChannel = IdeSecondary;
- BeginningIdeDevice = IdeMaster;
- //
- // default, may be redefined by IdeInit
- //
- EndIdeDevice = IdeSlave;
- } else {
+
+ } else if (!IsDevicePathEnd (RemainingDevicePath)) {
//
- // RemainingDevicePath is not NULL, only scan the specified device.
+ // RemainingDevicePath is the End of Device Path Node,
+ // only scan the specified device by RemainingDevicePath.
//
Node = (EFI_DEV_PATH *) RemainingDevicePath;
BeginningIdeChannel = Node->Atapi.PrimarySecondary;
@@ -451,6 +453,16 @@ IDEBusDriverBindingStart ( Status = EFI_INVALID_PARAMETER;
goto ErrorExit;
}
+
+ } else {
+ //
+ // If RemainingDevicePath is not the End of Device Path Node,
+ // skip enumerate any device and return EFI_SUCESSS
+ //
+ BeginningIdeChannel = IdeMaxChannel;
+ EndIdeChannel = IdeMaxChannel - 1;
+ BeginningIdeDevice = IdeMaxDevice;
+ EndIdeDevice = IdeMaxDevice - 1;
}
//
@@ -846,7 +858,7 @@ IDEBusDriverBindingStart ( IdeInit->NotifyPhase (IdeInit, EfiIdeBusPhaseMaximum, 0);
if (SupportedModes != NULL) {
- gBS->FreePool (SupportedModes);
+ FreePool (SupportedModes);
}
PERF_START (NULL, "Finish IDE detection", "IDE", 1);
|