summaryrefslogtreecommitdiffstats
path: root/IntelFrameworkModulePkg/Bus/Pci
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-09-08 07:57:40 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-09-08 07:57:40 +0000
commit2277ab96eb366cfbc8dc6ad12717cfa669e1b12d (patch)
treef8feb488b9956a49397c235be48d8e311e90c562 /IntelFrameworkModulePkg/Bus/Pci
parentbcdff90d2c46ca00dd494a9837ef7848ad2d9d5b (diff)
downloadedk2-2277ab96eb366cfbc8dc6ad12717cfa669e1b12d.tar.gz
edk2-2277ab96eb366cfbc8dc6ad12717cfa669e1b12d.tar.bz2
edk2-2277ab96eb366cfbc8dc6ad12717cfa669e1b12d.zip
updated IdeBus driver not to create new child handle if RemainingDeviepath is the End of Device Path Node, per UEFI 2.3.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9248 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Bus/Pci')
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c94
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);