summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus/Scsi
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-09-14 08:55:03 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-09-14 08:55:03 +0000
commitaf4a63857cd189964cc2c6b53b54483efaba78a3 (patch)
tree791e8df39b79520e7e3c7cbb9bb33bc2d0bb89c5 /MdeModulePkg/Bus/Scsi
parent0cd118f7799602a88a5feb8ff1ef3e011a04b8ad (diff)
downloadedk2-af4a63857cd189964cc2c6b53b54483efaba78a3.zip
edk2-af4a63857cd189964cc2c6b53b54483efaba78a3.tar.gz
edk2-af4a63857cd189964cc2c6b53b54483efaba78a3.tar.bz2
updated the Bus Driver that is able to create all or one of its child handles on each call to Start() not to create new child handle if RemainingDeviepath is the End of Device Path Node, per UEFI 2.3.
The others changes include: 1. Check RemainingDevicePath at beginning of Supported(), make sure it has been verified before Start() is called. 2. Check IO protocol firstly rather than EfiDevicePathProtocolGuid, reduce the times entering into Start() function because EfiDevicePathProtocolGuid existed on most of handle. 3. If no any child device is created on last time, and RemainingDevicePath is valid Uart Devcie path, go on creating child device handle based on this RemainingDevicePath. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9262 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus/Scsi')
-rw-r--r--MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c50
1 files changed, 45 insertions, 5 deletions
diff --git a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
index 2325b64..d53fdc8 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
+++ b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
@@ -2,7 +2,7 @@
SCSI Bus driver that layers on every SCSI Pass Thru and
Extended SCSI Pass Thru protocol in the system.
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>
+Copyright (c) 2006 - 2009, Intel Corporation. <BR>
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
@@ -142,9 +142,30 @@ SCSIBusDriverBindingSupported (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
- EFI_STATUS Status;
- EFI_SCSI_PASS_THRU_PROTOCOL *PassThru;
+ EFI_STATUS Status;
+ EFI_SCSI_PASS_THRU_PROTOCOL *PassThru;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *ExtPassThru;
+ EFI_DEV_PATH *Node;
+
+ if (RemainingDevicePath != NULL) {
+ Node = (EFI_DEV_PATH *) RemainingDevicePath;
+ //
+ // 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_SCSI_DP ||
+ DevicePathNodeLength(&Node->DevPath) != sizeof(ATAPI_DEVICE_PATH)) {
+ return EFI_UNSUPPORTED;
+ }
+ }
+ }
+
//
// Check for the existence of Extended SCSI Pass Thru Protocol and SCSI Pass Thru Protocol
//
@@ -188,6 +209,9 @@ SCSIBusDriverBindingSupported (
return EFI_SUCCESS;
}
+ //
+ // Close the I/O Abstraction(s) used to perform the supported test
+ //
gBS->CloseProtocol (
Controller,
&gEfiExtScsiPassThruProtocolGuid,
@@ -377,16 +401,32 @@ SCSIBusDriverBindingStart (
ScsiBusDev = SCSI_BUS_CONTROLLER_DEVICE_FROM_THIS (BusIdentify);
}
+ Lun = 0;
if (RemainingDevicePath == NULL) {
+ //
+ // If RemainingDevicePath is NULL,
+ // must enumerate all SCSI devices anyway
+ //
SetMem (ScsiTargetId, TARGET_MAX_BYTES,0xFF);
- Lun = 0;
FromFirstTarget = TRUE;
- } else {
+
+ } else if (!IsDevicePathEnd (RemainingDevicePath)) {
+ //
+ // If RemainingDevicePath isn't the End of Device Path Node,
+ // only scan the specified device by RemainingDevicePath
+ //
if (ScsiBusDev->ExtScsiSupport) {
ScsiBusDev->ExtScsiInterface->GetTargetLun (ScsiBusDev->ExtScsiInterface, RemainingDevicePath, &TargetId, &Lun);
} else {
ScsiBusDev->ScsiInterface->GetTargetLun (ScsiBusDev->ScsiInterface, RemainingDevicePath, &ScsiTargetId->ScsiId.Scsi, &Lun);
}
+
+ } else {
+ //
+ // If RemainingDevicePath is the End of Device Path Node,
+ // skip enumerate any device and return EFI_SUCESSS
+ //
+ ScanOtherPuns = FALSE;
}
while(ScanOtherPuns) {