X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FIScsiDxe%2FIScsiDriver.c;h=f4663d9f59c1837328ad45864f35a634cead7f23;hp=920cc945569c8233fac4361706ddffef1738a259;hb=05a300115ab80963e2a722aaaa8adbb3b6c5007c;hpb=fd627b160d0b5b91ee3e8af1aecea0d23a58332f diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c index 920cc94556..f4663d9f59 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.c @@ -1,7 +1,7 @@ /** @file The entry point of IScsi driver. -Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2013, 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 @@ -23,8 +23,43 @@ EFI_DRIVER_BINDING_PROTOCOL gIScsiDriverBinding = { NULL }; -EFI_GUID gIScsiPrivateGuid = ISCSI_PRIVATE_GUID; +/** + Tests to see if this driver supports the RemainingDevicePath. + + @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This + parameter is ignored by device drivers, and is optional for bus + drivers. For bus drivers, if this parameter is not NULL, then + the bus driver must determine if the bus controller specified + by ControllerHandle and the child controller specified + by RemainingDevicePath are both supported by this + bus driver. + + @retval EFI_SUCCESS The RemainingDevicePath is supported or NULL. + @retval EFI_UNSUPPORTED The device specified by ControllerHandle and + RemainingDevicePath is not supported by the driver specified by This. +**/ +EFI_STATUS +IScsiIsDevicePathSupported ( + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL + ) +{ + EFI_DEVICE_PATH_PROTOCOL *CurrentDevicePath; + + CurrentDevicePath = RemainingDevicePath; + if (CurrentDevicePath != NULL) { + while (!IsDevicePathEnd (CurrentDevicePath)) { + if ((CurrentDevicePath->Type == MESSAGING_DEVICE_PATH) && (CurrentDevicePath->SubType == MSG_ISCSI_DP)) { + return EFI_SUCCESS; + } + + CurrentDevicePath = NextDevicePathNode (CurrentDevicePath); + } + + return EFI_UNSUPPORTED; + } + return EFI_SUCCESS; +} /** Tests to see if this driver supports a given controller. If a child device is provided, @@ -59,11 +94,10 @@ IScsiDriverBindingSupported ( ) { EFI_STATUS Status; - EFI_DEVICE_PATH_PROTOCOL *CurrentDevicePath; Status = gBS->OpenProtocol ( ControllerHandle, - &gIScsiPrivateGuid, + &gEfiCallerIdGuid, NULL, This->DriverBindingHandle, ControllerHandle, @@ -85,17 +119,23 @@ IScsiDriverBindingSupported ( return EFI_UNSUPPORTED; } - CurrentDevicePath = RemainingDevicePath; - if (CurrentDevicePath != NULL) { - while (!IsDevicePathEnd (CurrentDevicePath)) { - if ((CurrentDevicePath->Type == MESSAGING_DEVICE_PATH) && (CurrentDevicePath->SubType == MSG_ISCSI_DP)) { - return EFI_SUCCESS; - } + Status = IScsiIsDevicePathSupported (RemainingDevicePath); + if (EFI_ERROR (Status)) { + return EFI_UNSUPPORTED; + } - CurrentDevicePath = NextDevicePathNode (CurrentDevicePath); + if (IScsiDhcpIsConfigured (ControllerHandle)) { + Status = gBS->OpenProtocol ( + ControllerHandle, + &gEfiDhcp4ServiceBindingProtocolGuid, + NULL, + This->DriverBindingHandle, + ControllerHandle, + EFI_OPEN_PROTOCOL_TEST_PROTOCOL + ); + if (EFI_ERROR (Status)) { + return EFI_UNSUPPORTED; } - - return EFI_UNSUPPORTED; } return EFI_SUCCESS; @@ -173,13 +213,13 @@ IScsiDriverBindingStart ( goto ON_ERROR; } - // + // // Always install private protocol no matter what happens later. We need to // keep the relationship between ControllerHandle and ChildHandle. // Status = gBS->InstallProtocolInterface ( &ControllerHandle, - &gIScsiPrivateGuid, + &gEfiCallerIdGuid, EFI_NATIVE_INTERFACE, &Private->IScsiIdentifier ); @@ -332,7 +372,7 @@ IScsiDriverBindingStop ( Status = gBS->OpenProtocol ( IScsiController, - &gIScsiPrivateGuid, + &gEfiCallerIdGuid, (VOID **)&IScsiIdentifier, This->DriverBindingHandle, ControllerHandle, @@ -370,7 +410,7 @@ IScsiDriverBindingStop ( // gBS->UninstallProtocolInterface ( IScsiController, - &gIScsiPrivateGuid, + &gEfiCallerIdGuid, &Private->IScsiIdentifier );