2008-04-09 07:34:50 +02:00
|
|
|
/** @file
|
|
|
|
Header file for SCSI Disk Driver.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2011-07-06 05:55:36 +02:00
|
|
|
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
2010-04-24 11:49:11 +02:00
|
|
|
This program and the accompanying materials
|
2008-04-09 07:34:50 +02:00
|
|
|
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
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-04-09 07:34:50 +02:00
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-04-09 07:34:50 +02:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
#ifndef _SCSI_DISK_H_
|
|
|
|
#define _SCSI_DISK_H_
|
2007-06-29 05:44:58 +02:00
|
|
|
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
#include <Uefi.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include <Protocol/ScsiIo.h>
|
|
|
|
#include <Protocol/ComponentName.h>
|
|
|
|
#include <Protocol/BlockIo.h>
|
|
|
|
#include <Protocol/DriverBinding.h>
|
|
|
|
#include <Protocol/ScsiPassThruExt.h>
|
2009-06-29 07:58:14 +02:00
|
|
|
#include <Protocol/ScsiPassThru.h>
|
2009-12-22 08:31:18 +01:00
|
|
|
#include <Protocol/DiskInfo.h>
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
|
|
|
|
#include <Library/DebugLib.h>
|
|
|
|
#include <Library/UefiDriverEntryPoint.h>
|
|
|
|
#include <Library/UefiLib.h>
|
|
|
|
#include <Library/BaseMemoryLib.h>
|
2008-12-18 06:30:57 +01:00
|
|
|
#include <Library/MemoryAllocationLib.h>
|
2008-11-13 10:18:40 +01:00
|
|
|
#include <Library/UefiScsiLib.h>
|
2008-11-12 02:30:58 +01:00
|
|
|
#include <Library/UefiBootServicesTableLib.h>
|
2009-12-22 08:31:18 +01:00
|
|
|
#include <Library/DevicePathLib.h>
|
2008-11-12 02:30:58 +01:00
|
|
|
|
2008-03-11 20:38:08 +01:00
|
|
|
#include <IndustryStandard/Scsi.h>
|
2009-12-22 08:31:18 +01:00
|
|
|
#include <IndustryStandard/Atapi.h>
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
#define IS_DEVICE_FIXED(a) (a)->FixedDevice ? 1 : 0
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-12-16 16:34:21 +01:00
|
|
|
#define SCSI_DISK_DEV_SIGNATURE SIGNATURE_32 ('s', 'c', 'd', 'k')
|
2007-06-29 05:44:58 +02:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
UINT32 Signature;
|
|
|
|
|
|
|
|
EFI_HANDLE Handle;
|
|
|
|
|
|
|
|
EFI_BLOCK_IO_PROTOCOL BlkIo;
|
|
|
|
EFI_BLOCK_IO_MEDIA BlkIoMedia;
|
|
|
|
EFI_SCSI_IO_PROTOCOL *ScsiIo;
|
|
|
|
UINT8 DeviceType;
|
|
|
|
BOOLEAN FixedDevice;
|
|
|
|
UINT16 Reserved;
|
|
|
|
|
|
|
|
EFI_SCSI_SENSE_DATA *SenseData;
|
|
|
|
UINTN SenseDataNumber;
|
|
|
|
EFI_SCSI_INQUIRY_DATA InquiryData;
|
|
|
|
|
|
|
|
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
|
|
|
|
2009-12-22 08:31:18 +01:00
|
|
|
EFI_DISK_INFO_PROTOCOL DiskInfo;
|
|
|
|
|
|
|
|
//
|
|
|
|
// The following fields are only valid for ATAPI/SATA device
|
|
|
|
//
|
|
|
|
UINT32 Channel;
|
|
|
|
UINT32 Device;
|
|
|
|
ATAPI_IDENTIFY_DATA IdentifyData;
|
2010-08-23 12:05:44 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// The flag indicates if 16-byte command can be used
|
|
|
|
//
|
|
|
|
BOOLEAN Cdb16Byte;
|
2007-06-29 05:44:58 +02:00
|
|
|
} SCSI_DISK_DEV;
|
|
|
|
|
|
|
|
#define SCSI_DISK_DEV_FROM_THIS(a) CR (a, SCSI_DISK_DEV, BlkIo, SCSI_DISK_DEV_SIGNATURE)
|
|
|
|
|
2009-12-22 08:31:18 +01:00
|
|
|
#define SCSI_DISK_DEV_FROM_DISKINFO(a) CR (a, SCSI_DISK_DEV, DiskInfo, SCSI_DISK_DEV_SIGNATURE)
|
|
|
|
|
2007-06-29 05:44:58 +02:00
|
|
|
//
|
|
|
|
// Global Variables
|
|
|
|
//
|
2007-09-30 04:45:18 +02:00
|
|
|
extern EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding;
|
|
|
|
extern EFI_COMPONENT_NAME_PROTOCOL gScsiDiskComponentName;
|
|
|
|
extern EFI_COMPONENT_NAME2_PROTOCOL gScsiDiskComponentName2;
|
2007-06-29 05:44:58 +02:00
|
|
|
//
|
|
|
|
// action code used in detect media process
|
|
|
|
//
|
|
|
|
#define ACTION_NO_ACTION 0x00
|
|
|
|
#define ACTION_READ_CAPACITY 0x01
|
|
|
|
#define ACTION_RETRY_COMMAND_LATER 0x02
|
|
|
|
|
2009-04-01 10:25:36 +02:00
|
|
|
#define SCSI_COMMAND_VERSION_1 0x01
|
|
|
|
#define SCSI_COMMAND_VERSION_2 0x02
|
|
|
|
#define SCSI_COMMAND_VERSION_3 0x03
|
|
|
|
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Test to see if this driver supports ControllerHandle.
|
|
|
|
|
|
|
|
This service is called by the EFI boot service ConnectController(). In order
|
|
|
|
to make drivers as small as possible, there are a few calling restrictions for
|
|
|
|
this service. ConnectController() must follow these calling restrictions.
|
|
|
|
If any other agent wishes to call Supported() it must also follow these
|
|
|
|
calling restrictions.
|
|
|
|
|
|
|
|
@param This Protocol instance pointer.
|
|
|
|
@param ControllerHandle Handle of device to test
|
|
|
|
@param RemainingDevicePath Optional parameter use to pick a specific child
|
|
|
|
device to start.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS This driver supports this device
|
|
|
|
@retval EFI_ALREADY_STARTED This driver is already running on this device
|
|
|
|
@retval other This driver does not support this device
|
|
|
|
|
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ScsiDiskDriverBindingSupported (
|
|
|
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE Controller,
|
2008-11-12 02:30:58 +01:00
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
2007-06-29 05:44:58 +02:00
|
|
|
);
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Start this driver on ControllerHandle.
|
|
|
|
|
|
|
|
This service is called by the EFI boot service ConnectController(). In order
|
|
|
|
to make drivers as small as possible, there are a few calling restrictions for
|
|
|
|
this service. ConnectController() must follow these calling restrictions. If
|
|
|
|
any other agent wishes to call Start() it must also follow these calling
|
|
|
|
restrictions.
|
|
|
|
|
|
|
|
@param This Protocol instance pointer.
|
|
|
|
@param ControllerHandle Handle of device to bind driver to
|
|
|
|
@param RemainingDevicePath Optional parameter use to pick a specific child
|
|
|
|
device to start.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS This driver is added to ControllerHandle
|
|
|
|
@retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
|
|
|
|
@retval other This driver does not support this device
|
|
|
|
|
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ScsiDiskDriverBindingStart (
|
|
|
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE Controller,
|
2008-11-12 02:30:58 +01:00
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
2007-06-29 05:44:58 +02:00
|
|
|
);
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Stop this driver on ControllerHandle.
|
|
|
|
|
|
|
|
This service is called by the EFI boot service DisconnectController().
|
|
|
|
In order to make drivers as small as possible, there are a few calling
|
|
|
|
restrictions for this service. DisconnectController() must follow these
|
|
|
|
calling restrictions. If any other agent wishes to call Stop() it must
|
|
|
|
also follow these calling restrictions.
|
|
|
|
|
|
|
|
@param This Protocol instance pointer.
|
|
|
|
@param ControllerHandle Handle of device to stop driver on
|
|
|
|
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
|
|
|
|
children is zero stop the entire bus driver.
|
|
|
|
@param ChildHandleBuffer List of Child Handles to Stop.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS This driver is removed ControllerHandle
|
|
|
|
@retval other This driver was not removed from this device
|
|
|
|
|
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ScsiDiskDriverBindingStop (
|
|
|
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE Controller,
|
|
|
|
IN UINTN NumberOfChildren,
|
2008-11-12 02:30:58 +01:00
|
|
|
IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
|
2007-06-29 05:44:58 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// EFI Component Name Functions
|
|
|
|
//
|
2007-09-30 04:45:18 +02:00
|
|
|
/**
|
|
|
|
Retrieves a Unicode string that is the user readable name of the driver.
|
|
|
|
|
|
|
|
This function retrieves the user readable name of a driver in the form of a
|
|
|
|
Unicode string. If the driver specified by This has a user readable name in
|
|
|
|
the language specified by Language, then a pointer to the driver name is
|
|
|
|
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
|
|
|
by This does not support the language specified by Language,
|
|
|
|
then EFI_UNSUPPORTED is returned.
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
2007-09-30 04:45:18 +02:00
|
|
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param Language A pointer to a Null-terminated ASCII string
|
2007-09-30 04:45:18 +02:00
|
|
|
array indicating the language. This is the
|
|
|
|
language of the driver name that the caller is
|
|
|
|
requesting, and it must match one of the
|
|
|
|
languages specified in SupportedLanguages. The
|
|
|
|
number of languages supported by a driver is up
|
|
|
|
to the driver writer. Language is specified
|
2009-04-30 07:32:11 +02:00
|
|
|
in RFC 4646 or ISO 639-2 language code format.
|
2007-09-30 04:45:18 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param DriverName A pointer to the Unicode string to return.
|
2007-09-30 04:45:18 +02:00
|
|
|
This Unicode string is the name of the
|
|
|
|
driver specified by This in the language
|
|
|
|
specified by Language.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
|
|
|
This and the language specified by Language was
|
|
|
|
returned in DriverName.
|
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER Language is NULL.
|
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
|
|
|
|
|
|
|
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
|
|
|
the language specified by Language.
|
|
|
|
|
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ScsiDiskComponentNameGetDriverName (
|
|
|
|
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
|
|
|
IN CHAR8 *Language,
|
|
|
|
OUT CHAR16 **DriverName
|
|
|
|
);
|
|
|
|
|
2007-09-30 04:45:18 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
Retrieves a Unicode string that is the user readable name of the controller
|
|
|
|
that is being managed by a driver.
|
|
|
|
|
|
|
|
This function retrieves the user readable name of the controller specified by
|
|
|
|
ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
|
|
|
driver specified by This has a user readable name in the language specified by
|
|
|
|
Language, then a pointer to the controller name is returned in ControllerName,
|
|
|
|
and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
|
|
|
managing the controller specified by ControllerHandle and ChildHandle,
|
|
|
|
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
|
|
|
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
2007-09-30 04:45:18 +02:00
|
|
|
EFI_COMPONENT_NAME_PROTOCOL instance.
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param ControllerHandle The handle of a controller that the driver
|
2007-09-30 04:45:18 +02:00
|
|
|
specified by This is managing. This handle
|
|
|
|
specifies the controller whose name is to be
|
|
|
|
returned.
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param ChildHandle The handle of the child controller to retrieve
|
2007-09-30 04:45:18 +02:00
|
|
|
the name of. This is an optional parameter that
|
|
|
|
may be NULL. It will be NULL for device
|
|
|
|
drivers. It will also be NULL for a bus drivers
|
|
|
|
that wish to retrieve the name of the bus
|
|
|
|
controller. It will not be NULL for a bus
|
|
|
|
driver that wishes to retrieve the name of a
|
|
|
|
child controller.
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param Language A pointer to a Null-terminated ASCII string
|
2007-09-30 04:45:18 +02:00
|
|
|
array indicating the language. This is the
|
|
|
|
language of the driver name that the caller is
|
|
|
|
requesting, and it must match one of the
|
|
|
|
languages specified in SupportedLanguages. The
|
|
|
|
number of languages supported by a driver is up
|
|
|
|
to the driver writer. Language is specified in
|
2009-04-30 07:32:11 +02:00
|
|
|
RFC 4646 or ISO 639-2 language code format.
|
2007-09-30 04:45:18 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param ControllerName A pointer to the Unicode string to return.
|
2007-09-30 04:45:18 +02:00
|
|
|
This Unicode string is the name of the
|
|
|
|
controller specified by ControllerHandle and
|
|
|
|
ChildHandle in the language specified by
|
|
|
|
Language from the point of view of the driver
|
|
|
|
specified by This.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
|
|
|
the language specified by Language for the
|
|
|
|
driver specified by This was returned in
|
|
|
|
DriverName.
|
|
|
|
|
2011-07-06 05:55:36 +02:00
|
|
|
@retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
|
2007-09-30 04:45:18 +02:00
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
|
|
|
EFI_HANDLE.
|
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER Language is NULL.
|
|
|
|
|
|
|
|
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
|
|
|
|
|
|
|
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
|
|
|
managing the controller specified by
|
|
|
|
ControllerHandle and ChildHandle.
|
|
|
|
|
|
|
|
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
|
|
|
the language specified by Language.
|
|
|
|
|
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ScsiDiskComponentNameGetControllerName (
|
|
|
|
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE ControllerHandle,
|
|
|
|
IN EFI_HANDLE ChildHandle OPTIONAL,
|
|
|
|
IN CHAR8 *Language,
|
|
|
|
OUT CHAR16 **ControllerName
|
|
|
|
);
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Reset SCSI Disk.
|
|
|
|
|
|
|
|
|
|
|
|
@param This The pointer of EFI_BLOCK_IO_PROTOCOL
|
|
|
|
@param ExtendedVerification The flag about if extend verificate
|
2007-09-30 04:45:18 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval EFI_SUCCESS The device was reset.
|
|
|
|
@retval EFI_DEVICE_ERROR The device is not functioning properly and could
|
|
|
|
not be reset.
|
|
|
|
@return EFI_STATUS is retured from EFI_SCSI_IO_PROTOCOL.ResetDevice().
|
|
|
|
|
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ScsiDiskReset (
|
|
|
|
IN EFI_BLOCK_IO_PROTOCOL *This,
|
|
|
|
IN BOOLEAN ExtendedVerification
|
2008-11-12 02:30:58 +01:00
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
The function is to Read Block from SCSI Disk.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param This The pointer of EFI_BLOCK_IO_PROTOCOL.
|
|
|
|
@param MediaId The Id of Media detected
|
|
|
|
@param Lba The logic block address
|
|
|
|
@param BufferSize The size of Buffer
|
|
|
|
@param Buffer The buffer to fill the read out data
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval EFI_SUCCESS Successfully to read out block.
|
|
|
|
@retval EFI_DEVICE_ERROR Fail to detect media.
|
|
|
|
@retval EFI_NO_MEDIA Media is not present.
|
|
|
|
@retval EFI_MEDIA_CHANGED Media has changed.
|
|
|
|
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
|
|
|
@retval EFI_INVALID_PARAMETER Invalid parameter passed in.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ScsiDiskReadBlocks (
|
|
|
|
IN EFI_BLOCK_IO_PROTOCOL *This,
|
|
|
|
IN UINT32 MediaId,
|
2008-11-12 02:30:58 +01:00
|
|
|
IN EFI_LBA Lba,
|
2007-06-29 05:44:58 +02:00
|
|
|
IN UINTN BufferSize,
|
|
|
|
OUT VOID *Buffer
|
2008-11-12 02:30:58 +01:00
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
The function is to Write Block to SCSI Disk.
|
|
|
|
|
|
|
|
@param This The pointer of EFI_BLOCK_IO_PROTOCOL
|
|
|
|
@param MediaId The Id of Media detected
|
|
|
|
@param Lba The logic block address
|
|
|
|
@param BufferSize The size of Buffer
|
|
|
|
@param Buffer The buffer to fill the read out data
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS Successfully to read out block.
|
|
|
|
@retval EFI_WRITE_PROTECTED The device can not be written to.
|
|
|
|
@retval EFI_DEVICE_ERROR Fail to detect media.
|
|
|
|
@retval EFI_NO_MEDIA Media is not present.
|
|
|
|
@retval EFI_MEDIA_CHNAGED Media has changed.
|
|
|
|
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
|
|
|
@retval EFI_INVALID_PARAMETER Invalid parameter passed in.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ScsiDiskWriteBlocks (
|
|
|
|
IN EFI_BLOCK_IO_PROTOCOL *This,
|
|
|
|
IN UINT32 MediaId,
|
2008-11-12 02:30:58 +01:00
|
|
|
IN EFI_LBA Lba,
|
2007-06-29 05:44:58 +02:00
|
|
|
IN UINTN BufferSize,
|
|
|
|
IN VOID *Buffer
|
2008-11-12 02:30:58 +01:00
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Flush Block to Disk.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
EFI_SUCCESS is returned directly.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param This The pointer of EFI_BLOCK_IO_PROTOCOL
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval EFI_SUCCESS All outstanding data was written to the device
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ScsiDiskFlushBlocks (
|
|
|
|
IN EFI_BLOCK_IO_PROTOCOL *This
|
2008-11-12 02:30:58 +01:00
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2009-12-22 08:31:18 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
Provides inquiry information for the controller type.
|
|
|
|
|
|
|
|
This function is used by the IDE bus driver to get inquiry data. Data format
|
|
|
|
of Identify data is defined by the Interface GUID.
|
|
|
|
|
2010-02-11 03:33:16 +01:00
|
|
|
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
|
|
|
|
@param[in, out] InquiryData Pointer to a buffer for the inquiry data.
|
|
|
|
@param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.
|
2009-12-22 08:31:18 +01:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS The command was accepted without any errors.
|
|
|
|
@retval EFI_NOT_FOUND Device does not support this data class
|
|
|
|
@retval EFI_DEVICE_ERROR Error reading InquiryData from device
|
|
|
|
@retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ScsiDiskInfoInquiry (
|
|
|
|
IN EFI_DISK_INFO_PROTOCOL *This,
|
|
|
|
IN OUT VOID *InquiryData,
|
|
|
|
IN OUT UINT32 *InquiryDataSize
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Provides identify information for the controller type.
|
|
|
|
|
|
|
|
This function is used by the IDE bus driver to get identify data. Data format
|
|
|
|
of Identify data is defined by the Interface GUID.
|
|
|
|
|
|
|
|
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL
|
|
|
|
instance.
|
2010-02-11 03:33:16 +01:00
|
|
|
@param[in, out] IdentifyData Pointer to a buffer for the identify data.
|
|
|
|
@param[in, out] IdentifyDataSize Pointer to the value for the identify data
|
2009-12-22 08:31:18 +01:00
|
|
|
size.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The command was accepted without any errors.
|
|
|
|
@retval EFI_NOT_FOUND Device does not support this data class
|
|
|
|
@retval EFI_DEVICE_ERROR Error reading IdentifyData from device
|
|
|
|
@retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ScsiDiskInfoIdentify (
|
|
|
|
IN EFI_DISK_INFO_PROTOCOL *This,
|
|
|
|
IN OUT VOID *IdentifyData,
|
|
|
|
IN OUT UINT32 *IdentifyDataSize
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Provides sense data information for the controller type.
|
|
|
|
|
|
|
|
This function is used by the IDE bus driver to get sense data.
|
|
|
|
Data format of Sense data is defined by the Interface GUID.
|
|
|
|
|
2010-02-11 03:33:16 +01:00
|
|
|
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
|
|
|
|
@param[in, out] SenseData Pointer to the SenseData.
|
|
|
|
@param[in, out] SenseDataSize Size of SenseData in bytes.
|
|
|
|
@param[out] SenseDataNumber Pointer to the value for the sense data size.
|
2009-12-22 08:31:18 +01:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS The command was accepted without any errors.
|
|
|
|
@retval EFI_NOT_FOUND Device does not support this data class.
|
|
|
|
@retval EFI_DEVICE_ERROR Error reading SenseData from device.
|
|
|
|
@retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ScsiDiskInfoSenseData (
|
|
|
|
IN EFI_DISK_INFO_PROTOCOL *This,
|
|
|
|
IN OUT VOID *SenseData,
|
|
|
|
IN OUT UINT32 *SenseDataSize,
|
|
|
|
OUT UINT8 *SenseDataNumber
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
This function is used by the IDE bus driver to get controller information.
|
|
|
|
|
|
|
|
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
|
|
|
|
@param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.
|
|
|
|
@param[out] IdeDevice Pointer to the Ide Device number. Master or slave.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS IdeChannel and IdeDevice are valid.
|
|
|
|
@retval EFI_UNSUPPORTED This is not an IDE device.
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ScsiDiskInfoWhichIde (
|
|
|
|
IN EFI_DISK_INFO_PROTOCOL *This,
|
|
|
|
OUT UINT32 *IdeChannel,
|
|
|
|
OUT UINT32 *IdeDevice
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
2009-12-22 08:31:18 +01:00
|
|
|
Detect Device and read out capacity ,if error occurs, parse the sense key.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param ScsiDiskDevice The pointer of SCSI_DISK_DEV
|
|
|
|
@param MustReadCapacity The flag about reading device capacity
|
|
|
|
@param MediaChange The pointer of flag indicates if media has changed
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval EFI_DEVICE_ERROR Indicates that error occurs
|
|
|
|
@retval EFI_SUCCESS Successfully to detect media
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
ScsiDiskDetectMedia (
|
2008-11-12 02:30:58 +01:00
|
|
|
IN SCSI_DISK_DEV *ScsiDiskDevice,
|
|
|
|
IN BOOLEAN MustReadCapacity,
|
|
|
|
OUT BOOLEAN *MediaChange
|
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
2009-12-22 08:31:18 +01:00
|
|
|
To test device.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense;
|
|
|
|
When Test Unit Ready command encounters any error caused by host adapter or
|
|
|
|
target, return error without retrieving Sense Keys.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param ScsiDiskDevice The pointer of SCSI_DISK_DEV
|
|
|
|
@param NeedRetry The pointer of flag indicates try again
|
|
|
|
@param SenseDataArray The pointer of an array of sense data
|
|
|
|
@param NumberOfSenseKeys The pointer of the number of sense data array
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval EFI_DEVICE_ERROR Indicates that error occurs
|
|
|
|
@retval EFI_SUCCESS Successfully to test unit
|
2007-09-20 12:06:50 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
ScsiDiskTestUnitReady (
|
2008-11-12 02:30:58 +01:00
|
|
|
IN SCSI_DISK_DEV *ScsiDiskDevice,
|
|
|
|
OUT BOOLEAN *NeedRetry,
|
|
|
|
OUT EFI_SCSI_SENSE_DATA **SenseDataArray,
|
|
|
|
OUT UINTN *NumberOfSenseKeys
|
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Parsing Sense Keys which got from request sense command.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param ScsiDiskDevice The pointer of SCSI_DISK_DEV
|
|
|
|
@param SenseData The pointer of EFI_SCSI_SENSE_DATA
|
|
|
|
@param NumberOfSenseKeys The number of sense key
|
|
|
|
@param Action The pointer of action which indicates what is need to do next
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval EFI_DEVICE_ERROR Indicates that error occurs
|
|
|
|
@retval EFI_SUCCESS Successfully to complete the parsing
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
DetectMediaParsingSenseKeys (
|
2008-11-12 02:30:58 +01:00
|
|
|
OUT SCSI_DISK_DEV *ScsiDiskDevice,
|
|
|
|
IN EFI_SCSI_SENSE_DATA *SenseData,
|
|
|
|
IN UINTN NumberOfSenseKeys,
|
|
|
|
OUT UINTN *Action
|
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Send read capacity command to device and get the device parameter.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param ScsiDiskDevice The pointer of SCSI_DISK_DEV
|
|
|
|
@param NeedRetry The pointer of flag indicates if need a retry
|
|
|
|
@param SenseDataArray The pointer of an array of sense data
|
|
|
|
@param NumberOfSenseKeys The number of sense key
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval EFI_DEVICE_ERROR Indicates that error occurs
|
|
|
|
@retval EFI_SUCCESS Successfully to read capacity
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
ScsiDiskReadCapacity (
|
2008-11-12 02:30:58 +01:00
|
|
|
IN OUT SCSI_DISK_DEV *ScsiDiskDevice,
|
|
|
|
OUT BOOLEAN *NeedRetry,
|
|
|
|
OUT EFI_SCSI_SENSE_DATA **SenseDataArray,
|
|
|
|
OUT UINTN *NumberOfSenseKeys
|
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Check the HostAdapter status and re-interpret it in EFI_STATUS.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param HostAdapterStatus Host Adapter status
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval EFI_SUCCESS Host adapter is OK.
|
|
|
|
@retval EFI_TIMEOUT Timeout.
|
|
|
|
@retval EFI_NOT_READY Adapter NOT ready.
|
|
|
|
@retval EFI_DEVICE_ERROR Adapter device error.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
CheckHostAdapterStatus (
|
2008-11-12 02:30:58 +01:00
|
|
|
IN UINT8 HostAdapterStatus
|
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Check the target status and re-interpret it in EFI_STATUS.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param TargetStatus Target status
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval EFI_NOT_READY Device is NOT ready.
|
|
|
|
@retval EFI_DEVICE_ERROR
|
|
|
|
@retval EFI_SUCCESS
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
CheckTargetStatus (
|
2008-11-12 02:30:58 +01:00
|
|
|
IN UINT8 TargetStatus
|
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Retrieve all sense keys from the device.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
When encountering error during the process, if retrieve sense keys before
|
2009-12-22 08:31:18 +01:00
|
|
|
error encountered, it returns the sense keys with return status set to EFI_SUCCESS,
|
2008-11-12 02:30:58 +01:00
|
|
|
and NeedRetry set to FALSE; otherwize, return the proper return status.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param ScsiDiskDevice The pointer of SCSI_DISK_DEV
|
|
|
|
@param NeedRetry The pointer of flag indicates if need a retry
|
|
|
|
@param SenseDataArray The pointer of an array of sense data
|
|
|
|
@param NumberOfSenseKeys The number of sense key
|
|
|
|
@param AskResetIfError The flag indicates if need reset when error occurs
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval EFI_DEVICE_ERROR Indicates that error occurs
|
|
|
|
@retval EFI_SUCCESS Successfully to request sense key
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
ScsiDiskRequestSenseKeys (
|
2008-11-12 02:30:58 +01:00
|
|
|
IN OUT SCSI_DISK_DEV *ScsiDiskDevice,
|
|
|
|
OUT BOOLEAN *NeedRetry,
|
|
|
|
OUT EFI_SCSI_SENSE_DATA **SenseDataArray,
|
|
|
|
OUT UINTN *NumberOfSenseKeys,
|
|
|
|
IN BOOLEAN AskResetIfError
|
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Send out Inquiry command to Device.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param ScsiDiskDevice The pointer of SCSI_DISK_DEV
|
|
|
|
@param NeedRetry Indicates if needs try again when error happens
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval EFI_DEVICE_ERROR Indicates that error occurs
|
|
|
|
@retval EFI_SUCCESS Successfully to detect media
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
ScsiDiskInquiryDevice (
|
2008-11-12 02:30:58 +01:00
|
|
|
IN OUT SCSI_DISK_DEV *ScsiDiskDevice,
|
|
|
|
OUT BOOLEAN *NeedRetry
|
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Parse Inquiry data.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param ScsiDiskDevice The pointer of SCSI_DISK_DEV
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
VOID
|
|
|
|
ParseInquiryData (
|
2008-11-12 02:30:58 +01:00
|
|
|
IN OUT SCSI_DISK_DEV *ScsiDiskDevice
|
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Read sector from SCSI Disk.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2009-12-22 08:31:18 +01:00
|
|
|
@param ScsiDiskDevice The pointer of SCSI_DISK_DEV
|
2008-11-12 02:30:58 +01:00
|
|
|
@param Buffer The buffer to fill in the read out data
|
|
|
|
@param Lba Logic block address
|
|
|
|
@param NumberOfBlocks The number of blocks to read
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval EFI_DEVICE_ERROR Indicates a device error.
|
|
|
|
@retval EFI_SUCCESS Operation is successful.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
ScsiDiskReadSectors (
|
2008-11-12 02:30:58 +01:00
|
|
|
IN SCSI_DISK_DEV *ScsiDiskDevice,
|
|
|
|
OUT VOID *Buffer,
|
|
|
|
IN EFI_LBA Lba,
|
|
|
|
IN UINTN NumberOfBlocks
|
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Write sector to SCSI Disk.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2009-12-22 08:31:18 +01:00
|
|
|
@param ScsiDiskDevice The pointer of SCSI_DISK_DEV
|
2008-11-12 02:30:58 +01:00
|
|
|
@param Buffer The buffer of data to be written into SCSI Disk
|
|
|
|
@param Lba Logic block address
|
|
|
|
@param NumberOfBlocks The number of blocks to read
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval EFI_DEVICE_ERROR Indicates a device error.
|
|
|
|
@retval EFI_SUCCESS Operation is successful.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
ScsiDiskWriteSectors (
|
2008-11-12 02:30:58 +01:00
|
|
|
IN SCSI_DISK_DEV *ScsiDiskDevice,
|
|
|
|
IN VOID *Buffer,
|
|
|
|
IN EFI_LBA Lba,
|
|
|
|
IN UINTN NumberOfBlocks
|
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
2009-12-22 08:31:18 +01:00
|
|
|
Submit Read command.
|
2008-11-12 02:30:58 +01:00
|
|
|
|
|
|
|
@param ScsiDiskDevice The pointer of ScsiDiskDevice
|
|
|
|
@param NeedRetry The pointer of flag indicates if needs retry if error happens
|
|
|
|
@param SenseDataArray NOT used yet in this function
|
|
|
|
@param NumberOfSenseKeys The number of sense key
|
|
|
|
@param Timeout The time to complete the command
|
|
|
|
@param DataBuffer The buffer to fill with the read out data
|
|
|
|
@param DataLength The length of buffer
|
|
|
|
@param StartLba The start logic block address
|
|
|
|
@param SectorSize The size of sector
|
|
|
|
|
|
|
|
@return EFI_STATUS is returned by calling ScsiRead10Command().
|
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
ScsiDiskRead10 (
|
2008-11-12 02:30:58 +01:00
|
|
|
IN SCSI_DISK_DEV *ScsiDiskDevice,
|
|
|
|
OUT BOOLEAN *NeedRetry,
|
|
|
|
OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL
|
|
|
|
OUT UINTN *NumberOfSenseKeys,
|
|
|
|
IN UINT64 Timeout,
|
|
|
|
OUT UINT8 *DataBuffer,
|
|
|
|
IN OUT UINT32 *DataLength,
|
|
|
|
IN UINT32 StartLba,
|
|
|
|
IN UINT32 SectorSize
|
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Submit Write Command.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param ScsiDiskDevice The pointer of ScsiDiskDevice
|
|
|
|
@param NeedRetry The pointer of flag indicates if needs retry if error happens
|
|
|
|
@param SenseDataArray NOT used yet in this function
|
|
|
|
@param NumberOfSenseKeys The number of sense key
|
|
|
|
@param Timeout The time to complete the command
|
|
|
|
@param DataBuffer The buffer to fill with the read out data
|
|
|
|
@param DataLength The length of buffer
|
|
|
|
@param StartLba The start logic block address
|
|
|
|
@param SectorSize The size of sector
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@return EFI_STATUS is returned by calling ScsiWrite10Command().
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
EFI_STATUS
|
|
|
|
ScsiDiskWrite10 (
|
2008-11-12 02:30:58 +01:00
|
|
|
IN SCSI_DISK_DEV *ScsiDiskDevice,
|
|
|
|
OUT BOOLEAN *NeedRetry,
|
|
|
|
OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL
|
|
|
|
OUT UINTN *NumberOfSenseKeys,
|
|
|
|
IN UINT64 Timeout,
|
|
|
|
IN UINT8 *DataBuffer,
|
|
|
|
IN OUT UINT32 *DataLength,
|
|
|
|
IN UINT32 StartLba,
|
|
|
|
IN UINT32 SectorSize
|
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2010-05-28 08:58:59 +02:00
|
|
|
/**
|
|
|
|
Submit Read(16) command.
|
|
|
|
|
|
|
|
@param ScsiDiskDevice The pointer of ScsiDiskDevice
|
|
|
|
@param NeedRetry The pointer of flag indicates if needs retry if error happens
|
|
|
|
@param SenseDataArray NOT used yet in this function
|
|
|
|
@param NumberOfSenseKeys The number of sense key
|
|
|
|
@param Timeout The time to complete the command
|
|
|
|
@param DataBuffer The buffer to fill with the read out data
|
|
|
|
@param DataLength The length of buffer
|
|
|
|
@param StartLba The start logic block address
|
|
|
|
@param SectorSize The size of sector
|
|
|
|
|
|
|
|
@return EFI_STATUS is returned by calling ScsiRead10Command().
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
ScsiDiskRead16 (
|
|
|
|
IN SCSI_DISK_DEV *ScsiDiskDevice,
|
|
|
|
OUT BOOLEAN *NeedRetry,
|
|
|
|
OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL
|
|
|
|
OUT UINTN *NumberOfSenseKeys,
|
|
|
|
IN UINT64 Timeout,
|
|
|
|
OUT UINT8 *DataBuffer,
|
|
|
|
IN OUT UINT32 *DataLength,
|
|
|
|
IN UINT64 StartLba,
|
|
|
|
IN UINT32 SectorSize
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Submit Write(16) Command.
|
|
|
|
|
|
|
|
@param ScsiDiskDevice The pointer of ScsiDiskDevice
|
|
|
|
@param NeedRetry The pointer of flag indicates if needs retry if error happens
|
|
|
|
@param SenseDataArray NOT used yet in this function
|
|
|
|
@param NumberOfSenseKeys The number of sense key
|
|
|
|
@param Timeout The time to complete the command
|
|
|
|
@param DataBuffer The buffer to fill with the read out data
|
|
|
|
@param DataLength The length of buffer
|
|
|
|
@param StartLba The start logic block address
|
|
|
|
@param SectorSize The size of sector
|
|
|
|
|
|
|
|
@return EFI_STATUS is returned by calling ScsiWrite10Command().
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
ScsiDiskWrite16 (
|
|
|
|
IN SCSI_DISK_DEV *ScsiDiskDevice,
|
|
|
|
OUT BOOLEAN *NeedRetry,
|
|
|
|
OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL
|
|
|
|
OUT UINTN *NumberOfSenseKeys,
|
|
|
|
IN UINT64 Timeout,
|
|
|
|
IN UINT8 *DataBuffer,
|
|
|
|
IN OUT UINT32 *DataLength,
|
|
|
|
IN UINT64 StartLba,
|
|
|
|
IN UINT32 SectorSize
|
|
|
|
);
|
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Get information from media read capacity command.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param ScsiDiskDevice The pointer of SCSI_DISK_DEV
|
2009-04-01 10:25:36 +02:00
|
|
|
@param Capacity10 The pointer of EFI_SCSI_DISK_CAPACITY_DATA
|
|
|
|
@param Capacity16 The pointer of EFI_SCSI_DISK_CAPACITY_DATA16
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
VOID
|
|
|
|
GetMediaInfo (
|
2010-01-15 09:03:23 +01:00
|
|
|
IN OUT SCSI_DISK_DEV *ScsiDiskDevice,
|
|
|
|
IN EFI_SCSI_DISK_CAPACITY_DATA *Capacity10,
|
|
|
|
IN EFI_SCSI_DISK_CAPACITY_DATA16 *Capacity16
|
2008-11-12 02:30:58 +01:00
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Check sense key to find if media presents.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param SenseData The pointer of EFI_SCSI_SENSE_DATA
|
|
|
|
@param SenseCounts The number of sense key
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval TRUE NOT any media
|
|
|
|
@retval FALSE Media presents
|
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
BOOLEAN
|
|
|
|
ScsiDiskIsNoMedia (
|
|
|
|
IN EFI_SCSI_SENSE_DATA *SenseData,
|
|
|
|
IN UINTN SenseCounts
|
2008-11-12 02:30:58 +01:00
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Parse sense key.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param SenseData The pointer of EFI_SCSI_SENSE_DATA
|
|
|
|
@param SenseCounts The number of sense key
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval TRUE Error
|
|
|
|
@retval FALSE NOT error
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
BOOLEAN
|
|
|
|
ScsiDiskIsMediaError (
|
|
|
|
IN EFI_SCSI_SENSE_DATA *SenseData,
|
|
|
|
IN UINTN SenseCounts
|
2008-11-12 02:30:58 +01:00
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Check sense key to find if hardware error happens.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param SenseData The pointer of EFI_SCSI_SENSE_DATA
|
|
|
|
@param SenseCounts The number of sense key
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval TRUE Hardware error exits.
|
|
|
|
@retval FALSE NO error.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
BOOLEAN
|
|
|
|
ScsiDiskIsHardwareError (
|
|
|
|
IN EFI_SCSI_SENSE_DATA *SenseData,
|
|
|
|
IN UINTN SenseCounts
|
2008-11-12 02:30:58 +01:00
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Check sense key to find if media has changed.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param SenseData The pointer of EFI_SCSI_SENSE_DATA
|
|
|
|
@param SenseCounts The number of sense key
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval TRUE Media is changed.
|
|
|
|
@retval FALSE Medit is NOT changed.
|
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
BOOLEAN
|
|
|
|
ScsiDiskIsMediaChange (
|
|
|
|
IN EFI_SCSI_SENSE_DATA *SenseData,
|
|
|
|
IN UINTN SenseCounts
|
2008-11-12 02:30:58 +01:00
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Check sense key to find if reset happens.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param SenseData The pointer of EFI_SCSI_SENSE_DATA
|
|
|
|
@param SenseCounts The number of sense key
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval TRUE It is reset before.
|
|
|
|
@retval FALSE It is NOT reset before.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
BOOLEAN
|
|
|
|
ScsiDiskIsResetBefore (
|
|
|
|
IN EFI_SCSI_SENSE_DATA *SenseData,
|
|
|
|
IN UINTN SenseCounts
|
2008-11-12 02:30:58 +01:00
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Check sense key to find if the drive is ready.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param SenseData The pointer of EFI_SCSI_SENSE_DATA
|
|
|
|
@param SenseCounts The number of sense key
|
|
|
|
@param RetryLater The flag means if need a retry
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval TRUE Drive is ready.
|
|
|
|
@retval FALSE Drive is NOT ready.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
BOOLEAN
|
|
|
|
ScsiDiskIsDriveReady (
|
|
|
|
IN EFI_SCSI_SENSE_DATA *SenseData,
|
|
|
|
IN UINTN SenseCounts,
|
2008-11-12 02:30:58 +01:00
|
|
|
OUT BOOLEAN *RetryLater
|
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Check sense key to find if it has sense key.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param SenseData - The pointer of EFI_SCSI_SENSE_DATA
|
|
|
|
@param SenseCounts - The number of sense key
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@retval TRUE It has sense key.
|
|
|
|
@retval FALSE It has NOT any sense key.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
BOOLEAN
|
|
|
|
ScsiDiskHaveSenseKey (
|
|
|
|
IN EFI_SCSI_SENSE_DATA *SenseData,
|
|
|
|
IN UINTN SenseCounts
|
2008-11-12 02:30:58 +01:00
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
/**
|
|
|
|
Release resource about disk device.
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
@param ScsiDiskDevice The pointer of SCSI_DISK_DEV
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2008-11-12 02:30:58 +01:00
|
|
|
**/
|
2007-06-29 05:44:58 +02:00
|
|
|
VOID
|
|
|
|
ReleaseScsiDiskDeviceResources (
|
|
|
|
IN SCSI_DISK_DEV *ScsiDiskDevice
|
2008-11-12 02:30:58 +01:00
|
|
|
);
|
2007-06-29 05:44:58 +02:00
|
|
|
|
2009-06-29 07:58:14 +02:00
|
|
|
/**
|
|
|
|
Determine if Block Io should be produced.
|
|
|
|
|
|
|
|
|
2009-12-22 08:31:18 +01:00
|
|
|
@param ChildHandle Child Handle to retrieve Parent information.
|
2009-06-29 07:58:14 +02:00
|
|
|
|
|
|
|
@retval TRUE Should produce Block Io.
|
|
|
|
@retval FALSE Should not produce Block Io.
|
|
|
|
|
|
|
|
**/
|
|
|
|
BOOLEAN
|
|
|
|
DetermineInstallBlockIo (
|
|
|
|
IN EFI_HANDLE ChildHandle
|
|
|
|
);
|
|
|
|
|
2009-12-22 08:31:18 +01:00
|
|
|
/**
|
|
|
|
Initialize the installation of DiskInfo protocol.
|
|
|
|
|
|
|
|
This function prepares for the installation of DiskInfo protocol on the child handle.
|
|
|
|
By default, it installs DiskInfo protocol with SCSI interface GUID. If it further
|
|
|
|
detects that the physical device is an ATAPI/AHCI device, it then updates interface GUID
|
|
|
|
to be IDE/AHCI interface GUID.
|
|
|
|
|
|
|
|
@param ScsiDiskDevice The pointer of SCSI_DISK_DEV.
|
|
|
|
@param ChildHandle Child handle to install DiskInfo protocol.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
InitializeInstallDiskInfo (
|
|
|
|
IN SCSI_DISK_DEV *ScsiDiskDevice,
|
|
|
|
IN EFI_HANDLE ChildHandle
|
|
|
|
);
|
|
|
|
|
2009-06-29 07:58:14 +02:00
|
|
|
/**
|
|
|
|
Search protocol database and check to see if the protocol
|
|
|
|
specified by ProtocolGuid is present on a ControllerHandle and opened by
|
|
|
|
ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
|
|
|
|
If the ControllerHandle is found, then the protocol specified by ProtocolGuid
|
|
|
|
will be opened on it.
|
|
|
|
|
|
|
|
|
|
|
|
@param ProtocolGuid ProtocolGuid pointer.
|
|
|
|
@param ChildHandle Child Handle to retrieve Parent information.
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID *
|
|
|
|
EFIAPI
|
|
|
|
GetParentProtocol (
|
|
|
|
IN EFI_GUID *ProtocolGuid,
|
|
|
|
IN EFI_HANDLE ChildHandle
|
|
|
|
);
|
|
|
|
|
2007-06-29 05:44:58 +02:00
|
|
|
#endif
|