-/*++\r
+/** @file\r
+ The entry point of IScsi driver\r
\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
+Copyright (c) 2004 - 2008, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
IScsiDriver.c\r
\r
Abstract:\r
+ The entry point of IScsi driver\r
\r
---*/\r
+**/\r
\r
#include "IScsiImpl.h"\r
\r
\r
EFI_GUID mIScsiPrivateGuid = ISCSI_PRIVATE_GUID;\r
\r
-EFI_STATUS\r
-EFIAPI\r
-IScsiDriverBindingSupported (\r
- IN EFI_DRIVER_BINDING_PROTOCOL * This,\r
- IN EFI_HANDLE ControllerHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL\r
- )\r
-/*++\r
+/**\r
+ Test to see if IScsi driver supports the given controller. \r
\r
-Routine Description:\r
+ @param This[in] Protocol instance pointer.\r
\r
- Test to see if iSCSI driver supports the given controller. \r
+ @param ControllerHandle[in] Handle of controller to test.\r
\r
-Arguments:\r
+ @param RemainingDevicePath[in] Optional parameter use to pick a specific child device to start.\r
\r
- This - Protocol instance pointer.\r
- ControllerHandle - Handle of controller to test.\r
- RemainingDevicePath - Optional parameter use to pick a specific child device to start.\r
+ @retval EFI_SUCCES This driver supports the controller.\r
\r
-Returns:\r
+ @retval EFI_ALREADY_STARTED This driver is already running on this device.\r
\r
- EFI_SUCCES - This driver supports the controller.\r
- EFI_ALREADY_STARTED - This driver is already running on this device.\r
- EFI_UNSUPPORTED - This driver doesn't support the controller.\r
+ @retval EFI_UNSUPPORTED This driver doesn't support the controller.\r
\r
---*/\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+IScsiDriverBindingSupported (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL\r
+ )\r
{\r
EFI_STATUS Status;\r
EFI_DEVICE_PATH_PROTOCOL *CurrentDevicePath;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Start to manage the controller. \r
+\r
+ @param This[in] Protocol instance pointer.\r
+\r
+ @param ControllerHandle[in] Handle of the controller.\r
+\r
+ @param RemainingDevicePath[in] Optional parameter use to pick a specific child device to start.\r
+\r
+ @retval EFI_SUCCES This driver supports this device.\r
+\r
+ @retval EFI_ALREADY_STARTED This driver is already running on this device.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
IScsiDriverBindingStart (\r
IN EFI_HANDLE ControllerHandle,\r
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Start to manage the controller. \r
-\r
-Arguments:\r
-\r
- This - Protocol instance pointer.\r
- ControllerHandle - Handle of the controller.\r
- RemainingDevicePath - Optional parameter use to pick a specific child device to start.\r
-\r
-Returns:\r
-\r
- EFI_SUCCES - This driver supports this device.\r
- EFI_ALREADY_STARTED - This driver is already running on this device.\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
ISCSI_DRIVER_DATA *Private;\r
return Status;\r
}\r
\r
+/**\r
+ Release the control of this controller and remove the IScsi functions.\r
+\r
+ @param This[in] Protocol instance pointer.\r
+\r
+ @param ControllerHandle[in] Handle of controller to stop.\r
+\r
+ @param NumberOfChildren[in] Not used.\r
+\r
+ @param ChildHandleBuffer[in] Not used.\r
+\r
+ @retval EFI_SUCCES This driver supports this device.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
IScsiDriverBindingStop (\r
IN UINTN NumberOfChildren,\r
IN EFI_HANDLE *ChildHandleBuffer\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Release the control of this controller and remove the iSCSI functions.\r
-\r
-Arguments:\r
-\r
- This - Protocol instance pointer.\r
- ControllerHandle - Handle of controller to stop.\r
- NumberOfChildren - Not used.\r
- ChildHandleBuffer - Not used.\r
-\r
-Returns:\r
-\r
- EFI_SUCCES - This driver supports this device.\r
-\r
---*/\r
{\r
EFI_HANDLE IScsiController;\r
EFI_STATUS Status;\r
return EFI_SUCCESS;\r
}\r
\r
-EFI_STATUS\r
-EFIAPI\r
-EfiIScsiUnload (\r
- IN EFI_HANDLE ImageHandle\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
+/**\r
Unload the iSCSI driver.\r
\r
-Arguments:\r
+ @param ImageHandle[in] The handle of the driver image.\r
\r
- ImageHandle - The handle of the driver image.\r
+ @retval EFI_SUCCESS The driver is unloaded.\r
\r
-Returns:\r
+ @retval EFI_DEVICE_ERROR Some unexpected error happened.\r
\r
- EFI_SUCCESS - The driver is unloaded.\r
- EFI_DEVICE_ERROR - Some unexpected error happened.\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiIScsiUnload (\r
+ IN EFI_HANDLE ImageHandle\r
+ )\r
{\r
EFI_STATUS Status;\r
UINTN DeviceHandleCount;\r
return Status;\r
}\r
\r
+/**\r
+ Initialize the global variables publish the driver binding protocol.\r
+\r
+ @param ImageHandle[in] The handle of the driver image.\r
+\r
+ @param SystemTable[in] The EFI system table.\r
+\r
+ @retval EFI_SUCCESS The protocols are installed.\r
+\r
+ @retval EFI_DEVICE_ERROR Some unexpected error happened.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
IScsiDriverEntryPoint (\r
IN EFI_HANDLE ImageHandle,\r
IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Initialize the global variables publish the driver binding protocol.\r
-\r
-Arguments:\r
-\r
- ImageHandle - The handle of the driver image.\r
- SystemTable - The EFI system table.\r
-\r
-Returns:\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_ISCSI_INITIATOR_NAME_PROTOCOL *IScsiInitiatorName;\r
\r
- EFI_SUCCESS - The protocols are installed.\r
- EFI_DEVICE_ERROR - Some unexpected error happened.\r
+ //\r
+ // There should be only one EFI_ISCSI_INITIATOR_NAME_PROTOCOL.\r
+ //\r
+ Status = gBS->LocateProtocol (\r
+ &gEfiIScsiInitiatorNameProtocolGuid,\r
+ NULL,\r
+ (VOID**) &IScsiInitiatorName\r
+ );\r
\r
---*/\r
-{\r
- EFI_STATUS Status;\r
- //EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;\r
+ if (!EFI_ERROR (Status)) {\r
+ return EFI_ACCESS_DENIED;\r
+ }\r
\r
//\r
// Initialize the EFI Driver Library\r
&gIScsiComponentName,\r
&gIScsiComponentName2\r
);\r
- \r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
\r
if (!EFI_ERROR (Status)) {\r
+ //\r
+ // Install the iSCSI Initiator Name Protocol.\r
+ //\r
Status = gBS->InstallProtocolInterface (\r
&ImageHandle,\r
&gEfiIScsiInitiatorNameProtocolGuid,\r
&gIScsiComponentName,\r
NULL\r
);\r
+ return Status;\r
+ }\r
+ \r
+ //\r
+ // Initialize the configuration form of iSCSI.\r
+ //\r
+ Status = IScsiConfigFormInit (gIScsiDriverBinding.DriverBindingHandle);\r
+ if (EFI_ERROR (Status)) {\r
+ gBS->UninstallMultipleProtocolInterfaces (\r
+ ImageHandle,\r
+ &gEfiDriverBindingProtocolGuid,\r
+ &gIScsiDriverBinding,\r
+ &gEfiComponentName2ProtocolGuid,\r
+ &gIScsiComponentName2,\r
+ &gEfiComponentNameProtocolGuid,\r
+ &gIScsiComponentName,\r
+ &gEfiIScsiInitiatorNameProtocolGuid,\r
+ &gIScsiInitiatorName,\r
+ NULL\r
+ );\r
}\r
}\r
- //\r
- // Initialize the configuration form of iSCSI.\r
- //\r
- IScsiConfigFormInit (gIScsiDriverBinding.DriverBindingHandle);\r
-\r
return Status;\r
}\r
\r