4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** @file
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The header file of IScsiDriver.c.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncCopyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncThis program and the accompanying materials
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncare licensed and made available under the terms and conditions of the BSD License
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncwhich accompanies this distribution. The full text of the license may be found at
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsynchttp://opensource.org/licenses/bsd-license.php
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#ifndef _ISCSI_DRIVER_H_
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define _ISCSI_DRIVER_H_
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Uefi.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Protocol/DevicePath.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Protocol/LoadedImage.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Protocol/HiiConfigAccess.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Protocol/HiiDatabase.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Library/UefiDriverEntryPoint.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Library/UefiBootServicesTableLib.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Library/UefiLib.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Library/DevicePathLib.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Protocol/DriverBinding.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Protocol/ScsiPassThruExt.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define ISCSI_INITIATOR_NAME_VAR_NAME L"I_NAME"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsynctypedef struct _ISCSI_PRIVATE_PROTOCOL {
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync UINT32 Reserved;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync} ISCSI_PRIVATE_PROTOCOL;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync//
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync// EFI Driver Binding Protocol for iSCSI driver.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync//
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Tests to see if this driver supports a given controller. If a child device is provided,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync it further tests to see if this driver supports creating a handle for the specified child device.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] ControllerHandle The handle of the controller to test. This handle
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync must support a protocol interface that supplies
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync an I/O abstraction to the driver.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] RemainingDevicePath A pointer to the remaining portion of a device path.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This parameter is ignored by device drivers, and is optional for bus drivers.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_SUCCESS The device specified by ControllerHandle and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync RemainingDevicePath is supported by the driver specified by This.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync RemainingDevicePath is already being managed by the driver
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specified by This.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync RemainingDevicePath is already being managed by a different
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync driver or an application that requires exclusive acces.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Currently not implemented.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync RemainingDevicePath is not supported by the driver specified by This.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFI_STATUS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncIScsiDriverBindingSupported (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN EFI_DRIVER_BINDING_PROTOCOL *This,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN EFI_HANDLE ControllerHandle,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Start this driver on ControllerHandle. The Start() function is designed to be
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync invoked from the EFI boot service ConnectController(). As a result, much of
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync the error checking on the parameters to Start() has been moved into this
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync common boot service. It is legal to call Start() from other locations,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync but the following calling restrictions must be followed or the system behavior will not be deterministic.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync 1. ControllerHandle must be a valid EFI_HANDLE.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_DEVICE_PATH_PROTOCOL.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync 3. Prior to calling Start(), the Supported() function for the driver specified by This must
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] ControllerHandle The handle of the controller to start. This handle
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync must support a protocol interface that supplies
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync an I/O abstraction to the driver.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] RemainingDevicePath A pointer to the remaining portion of a device path.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This parameter is ignored by device drivers, and is optional for bus drivers.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_SUCCESS The device was started.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_DEVICE_ERROR The device could not be started due to a device error.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Currently not implemented.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval Others The driver failded to start the device.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFI_STATUS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncIScsiDriverBindingStart (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN EFI_DRIVER_BINDING_PROTOCOL *This,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN EFI_HANDLE ControllerHandle,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Stop this driver on ControllerHandle.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Release the control of this controller and remove the IScsi functions. The Stop()
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync function is designed to be invoked from the EFI boot service DisconnectController().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync As a result, much of the error checking on the parameters to Stop() has been moved
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync into this common boot service. It is legal to call Stop() from other locations,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync but the following calling restrictions must be followed or the system behavior will not be deterministic.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync same driver's Start() function.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_HANDLE. In addition, all of these handles must have been created in this driver's
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Start() function, and the Start() function must have called OpenProtocol() on
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] ControllerHandle A handle to the device being stopped. The handle must
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync support a bus specific I/O protocol for the driver
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync to use to stop the device.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.Not used.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync if NumberOfChildren is 0.Not used.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_SUCCESS The device was stopped.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFI_STATUS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncIScsiDriverBindingStop (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN EFI_DRIVER_BINDING_PROTOCOL *This,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN EFI_HANDLE ControllerHandle,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN NumberOfChildren,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#endif