mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
modify coding style to pass ecc tool
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5555 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
0f77dfb622
commit
cc5166ff80
@ -1,4 +1,5 @@
|
||||
/** @file
|
||||
|
||||
UEFI Component Name(2) protocol implementation.
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
@ -10,13 +11,6 @@ http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
ComponentName.c
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
@ -1,20 +1,5 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2007 - 2008, 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UsbMass.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Defination for the USB mass storage class driver. The USB mass storage
|
||||
class is specified in two layers: the bottom layer is the transportation
|
||||
protocol. The top layer is the command set. The transportation layer
|
||||
@ -23,8 +8,14 @@ Abstract:
|
||||
Control/Bulk/Interrupt transport are two transportation protocol. USB mass
|
||||
storage class adopts various industrial standard as its command set.
|
||||
|
||||
Revision History
|
||||
Copyright (c) 2007 - 2008, 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@ -52,7 +43,7 @@ Revision History
|
||||
#define USB_IS_INTERRUPT_ENDPOINT(Attribute) (((Attribute) & 0x03) == 0x03)
|
||||
#define USB_IS_ERROR(Result, Error) (((Result) & (Error)) != 0)
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
//
|
||||
// Usb mass storage class code
|
||||
//
|
||||
@ -81,7 +72,7 @@ enum {
|
||||
USB_MASS_CMD_SUCCESS = 0,
|
||||
USB_MASS_CMD_FAIL,
|
||||
USB_MASS_CMD_PERSISTENT
|
||||
};
|
||||
}USB_MASS_DEV_CLASS_AND_VALUE;
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
@ -142,10 +133,21 @@ typedef struct {
|
||||
} USB_MASS_TRANSPORT;
|
||||
|
||||
|
||||
/**
|
||||
Use the USB clear feature control transfer to clear the endpoint
|
||||
stall condition.
|
||||
|
||||
@param UsbIo The USB IO protocol to use
|
||||
@param EndpointAddr The endpoint to clear stall for
|
||||
|
||||
@retval EFI_SUCCESS The endpoint stall condtion is clear
|
||||
@retval Others Failed to clear the endpoint stall condtion
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbClearEndpointStall (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
IN UINT8 EndpointAddress
|
||||
IN UINT8 EndpointAddr
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,8 @@
|
||||
/** @file
|
||||
|
||||
This file implement the command set of "USB Mass Storage Specification
|
||||
for Bootability".
|
||||
|
||||
Copyright (c) 2007 - 2008, 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
|
||||
@ -9,42 +12,21 @@ http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UsbMassBoot.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This file implement the command set of "USB Mass Storage Specification
|
||||
for Bootability".
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "UsbMassImpl.h"
|
||||
|
||||
|
||||
/**
|
||||
Return the current TPL.
|
||||
|
||||
@return Current TPL.
|
||||
|
||||
**/
|
||||
EFI_TPL
|
||||
UsbGetCurrentTpl (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
return the current TPL, copied from the EDKII glue lib.
|
||||
|
||||
Arguments:
|
||||
|
||||
VOID
|
||||
|
||||
Returns:
|
||||
|
||||
Current TPL
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_TPL Tpl;
|
||||
|
||||
@ -57,7 +39,7 @@ Returns:
|
||||
/**
|
||||
Read an UINT32 from the buffer to avoid byte alignment problems, then
|
||||
convert that to the little endia. The USB mass storage bootability spec
|
||||
use big endia
|
||||
use big endia.
|
||||
|
||||
@param Buf The buffer contains the first byte of the UINT32
|
||||
in big endia.
|
||||
@ -65,7 +47,6 @@ Returns:
|
||||
@return The UINT32 value read from the buffer in little endia.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
UINT32
|
||||
UsbBootGetUint32 (
|
||||
IN UINT8 *Buf
|
||||
@ -82,13 +63,12 @@ UsbBootGetUint32 (
|
||||
Put an UINT32 in little endia to the buffer. The data is converted to
|
||||
big endia before writing.
|
||||
|
||||
@param Buf The buffer to write data to
|
||||
@param Buf The buffer to write data to.
|
||||
@param Data32 The data to write.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
UsbBootPutUint32 (
|
||||
IN UINT8 *Buf,
|
||||
@ -99,18 +79,16 @@ UsbBootPutUint32 (
|
||||
CopyMem (Buf, &Data32, sizeof (UINT32));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Put an UINT16 in little endia to the buffer. The data is converted to
|
||||
big endia before writing.
|
||||
|
||||
@param Buf The buffer to write data to
|
||||
@param Data16 The data to write
|
||||
@param Buf The buffer to write data to.
|
||||
@param Data16 The data to write.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
UsbBootPutUint16 (
|
||||
IN UINT8 *Buf,
|
||||
@ -121,15 +99,18 @@ UsbBootPutUint16 (
|
||||
CopyMem (Buf, &Data16, sizeof (UINT16));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Request sense information via sending Request Sense
|
||||
Packet Command.
|
||||
|
||||
@param UsbMass The device to be requested sense data
|
||||
@param UsbMass The device to be requested sense data.
|
||||
|
||||
@retval EFI_DEVICE_ERROR Hardware error
|
||||
@retval EFI_SUCCESS Success
|
||||
@retval EFI_SUCCESS The command is excuted OK.
|
||||
@retval EFI_DEVICE_ERROR Failed to request sense.
|
||||
@retval EFI_NO_RESPONSE The device media doesn't response this request.
|
||||
@retval EFI_INVALID_PARAMETER The command has some invalid parameters.
|
||||
@retval EFI_WRITE_PROTECTED The device is write protected.
|
||||
@retval EFI_MEDIA_CHANGED The device media has been changed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -257,7 +238,6 @@ UsbBootRequestSense (
|
||||
@retval EFI_MEDIA_CHANGED The device media has been changed
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
UsbBootExecCmd (
|
||||
IN USB_MASS_DEVICE *UsbMass,
|
||||
@ -311,6 +291,7 @@ UsbBootExecCmd (
|
||||
@param DataDir The direction of data transfer
|
||||
@param Data The buffer to hold the data
|
||||
@param DataLen The length of expected data
|
||||
@param Timeout The timeout used to transfer
|
||||
|
||||
@retval EFI_SUCCESS The command is excuted OK
|
||||
@retval EFI_DEVICE_ERROR Failed to request sense
|
||||
@ -319,7 +300,6 @@ UsbBootExecCmd (
|
||||
@retval EFI_MEDIA_CHANGED The device media has been changed
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
UsbBootExecCmdWithRetry (
|
||||
IN USB_MASS_DEVICE *UsbMass,
|
||||
@ -369,7 +349,6 @@ UsbBootExecCmdWithRetry (
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Use the TEST UNIT READY command to check whether it is ready.
|
||||
If it is ready, update the parameters.
|
||||
@ -471,7 +450,8 @@ UsbBootInquiry (
|
||||
|
||||
@retval EFI_SUCCESS The disk gemotric is successfully retrieved.
|
||||
@retval EFI_DEVICE_ERROR Something is inconsistent with the disk gemotric.
|
||||
|
||||
@retval Other Read capacity request fails.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbBootReadCapacity (
|
||||
@ -521,15 +501,14 @@ UsbBootReadCapacity (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieves mode sense information via sending Mode Sense
|
||||
Packet Command.
|
||||
|
||||
@param UsbMass The USB_FLOPPY_DEV instance.
|
||||
|
||||
@retval EFI_DEVICE_ERROR Hardware error
|
||||
@retval EFI_SUCCESS Success
|
||||
@retval Other Execute Request command fails.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -570,7 +549,7 @@ UsbScsiModeSense (
|
||||
// devices support this command, so have a try here.
|
||||
//
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Media->ReadOnly = (BOOLEAN) ((ModeParaHeader.DevicePara & 0x80) ? TRUE : FALSE);
|
||||
Media->ReadOnly = (BOOLEAN) (((ModeParaHeader.DevicePara & 0x80) != 0) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
return Status;
|
||||
@ -588,7 +567,7 @@ UsbScsiModeSense (
|
||||
@param UsbMass The device to retireve disk gemotric.
|
||||
|
||||
@retval EFI_SUCCESS The disk gemotric is successfully retrieved.
|
||||
@retval EFI_DEVICE_ERROR Something is inconsistent with the disk gemotric.
|
||||
@retval Other Get the parameters failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@ -646,7 +625,7 @@ UsbBootGetParams (
|
||||
@param UsbMass The device to retireve disk gemotric.
|
||||
|
||||
@retval EFI_SUCCESS The disk gemotric is successfully retrieved.
|
||||
@retval EFI_DEVICE_ERROR Something is inconsistent with the disk gemotric.
|
||||
@retval Other Decect media fails.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -26,7 +26,7 @@ Revision History
|
||||
#ifndef _EFI_USB_MASS_BOOT_H_
|
||||
#define _EFI_USB_MASS_BOOT_H_
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
//
|
||||
// The opcodes of various usb boot commands:
|
||||
// INQUIRY/REQUEST_SENSE are "No Timeout Commands" as specified
|
||||
@ -101,7 +101,7 @@ enum {
|
||||
//
|
||||
//
|
||||
USB_BOOT_GENERAL_CMD_TIMEOUT = 5 * USB_MASS_1_SECOND
|
||||
};
|
||||
}USB_BOOT_OPTCODE;
|
||||
|
||||
//
|
||||
// The required commands are INQUIRY, READ CAPACITY, TEST UNIT READY,
|
||||
@ -249,21 +249,71 @@ typedef struct {
|
||||
#define USB_BOOT_SWAP16(Data16) \
|
||||
((((Data16) & 0x00ff) << 8) | (((Data16) & 0xff00) >> 8))
|
||||
|
||||
|
||||
/**
|
||||
Get the parameters for the USB mass storage media, including
|
||||
the RemovableMedia, block size, and last block number. This
|
||||
function is used both to initialize the media during the
|
||||
DriverBindingStart and to re-initialize it when the media is
|
||||
changed. Althought the RemoveableMedia is unlikely to change,
|
||||
I include it here.
|
||||
|
||||
@param UsbMass The device to retireve disk gemotric.
|
||||
|
||||
@retval EFI_SUCCESS The disk gemotric is successfully retrieved.
|
||||
@retval Other Get the parameters failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbBootGetParams (
|
||||
IN USB_MASS_DEVICE *UsbMass
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Use the TEST UNIT READY command to check whether it is ready.
|
||||
If it is ready, update the parameters.
|
||||
|
||||
@param UsbMass The device to test
|
||||
|
||||
@retval EFI_SUCCESS The device is ready and parameters are updated.
|
||||
@retval Others Device not ready.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbBootIsUnitReady (
|
||||
IN USB_MASS_DEVICE *UsbMass
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Detect whether the removable media is present and whether it has changed.
|
||||
The Non-removable media doesn't need it.
|
||||
|
||||
@param UsbMass The device to retireve disk gemotric.
|
||||
|
||||
@retval EFI_SUCCESS The disk gemotric is successfully retrieved.
|
||||
@retval Other Decect media fails.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbBootDetectMedia (
|
||||
IN USB_MASS_DEVICE *UsbMass
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Read some blocks from the device.
|
||||
|
||||
@param UsbMass The USB mass storage device to read from
|
||||
@param Lba The start block number
|
||||
@param TotalBlock Total block number to read
|
||||
@param Buffer The buffer to read to
|
||||
|
||||
@retval EFI_SUCCESS Data are read into the buffer
|
||||
@retval Others Failed to read all the data
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbBootReadBlocks (
|
||||
IN USB_MASS_DEVICE *UsbMass,
|
||||
@ -272,6 +322,19 @@ UsbBootReadBlocks (
|
||||
OUT UINT8 *Buffer
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Write some blocks to the device.
|
||||
|
||||
@param UsbMass The USB mass storage device to write to
|
||||
@param Lba The start block number
|
||||
@param TotalBlock Total block number to write
|
||||
@param Buffer The buffer to write to
|
||||
|
||||
@retval EFI_SUCCESS Data are written into the buffer
|
||||
@retval Others Failed to write all the data
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbBootWriteBlocks (
|
||||
IN USB_MASS_DEVICE *UsbMass,
|
||||
|
@ -1,5 +1,7 @@
|
||||
/** @file
|
||||
|
||||
Implementation of the USB mass storage Bulk-Only Transport protocol.
|
||||
|
||||
Copyright (c) 2007 - 2008, 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
|
||||
@ -9,23 +11,22 @@ http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UsbMassBot.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Implementation of the USB mass storage Bulk-Only Transport protocol.
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "UsbMass.h"
|
||||
#include "UsbMassBot.h"
|
||||
|
||||
STATIC
|
||||
/**
|
||||
Reset the mass storage device by BOT protocol.
|
||||
|
||||
@param Context The context of the BOT protocol, that is,
|
||||
USB_BOT_PROTOCOL.
|
||||
@param ExtendedVerification The flag controlling the rule of reset dev.
|
||||
|
||||
@retval EFI_SUCCESS The device is reset.
|
||||
@retval Others Failed to reset the device..
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbBotResetDevice (
|
||||
IN VOID *Context,
|
||||
@ -44,9 +45,9 @@ UsbBotResetDevice (
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory
|
||||
@retval EFI_UNSUPPORTED The transport protocol doesn't support the device.
|
||||
@retval EFI_SUCCESS The device is supported and protocol initialized.
|
||||
@retval Other The UBS BOT initialization fails.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
UsbBotInit (
|
||||
IN EFI_USB_IO_PROTOCOL * UsbIo,
|
||||
@ -140,7 +141,7 @@ ON_ERROR:
|
||||
|
||||
|
||||
/**
|
||||
Send the command to the device using Bulk-Out endpoint
|
||||
Send the command to the device using Bulk-Out endpoint.
|
||||
|
||||
@param UsbBot The USB BOT device
|
||||
@param Cmd The command to transfer to device
|
||||
@ -154,7 +155,6 @@ ON_ERROR:
|
||||
@retval Others Failed to send the command to device
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
UsbBotSendCommand (
|
||||
IN USB_BOT_PROTOCOL *UsbBot,
|
||||
@ -232,7 +232,6 @@ UsbBotSendCommand (
|
||||
@retval Others Failed to transfer data
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
UsbBotDataTransfer (
|
||||
IN USB_BOT_PROTOCOL *UsbBot,
|
||||
@ -294,17 +293,15 @@ UsbBotDataTransfer (
|
||||
and return the high level command execution result in Result. So
|
||||
even it returns EFI_SUCCESS, the command may still have failed.
|
||||
|
||||
@param UsbBot The USB BOT device
|
||||
@param TransLen The expected length of the data
|
||||
@param Timeout The time to wait the command to complete
|
||||
@param UsbBot The USB BOT device.
|
||||
@param TransLen The expected length of the data.
|
||||
@param CmdStatus The result of the command execution.
|
||||
|
||||
@retval EFI_DEVICE_ERROR Failed to retrieve the command execute result
|
||||
@retval EFI_SUCCESS Command execute result is retrieved and in the
|
||||
Result.
|
||||
@retval Other Failed to get status.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
UsbBotGetStatus (
|
||||
IN USB_BOT_PROTOCOL *UsbBot,
|
||||
@ -380,7 +377,7 @@ UsbBotGetStatus (
|
||||
|
||||
/**
|
||||
Call the Usb mass storage class transport protocol to issue
|
||||
the command/data/status circle to execute the commands
|
||||
the command/data/status circle to execute the commands.
|
||||
|
||||
@param Context The context of the BOT protocol, that is,
|
||||
USB_BOT_PROTOCOL
|
||||
@ -393,11 +390,10 @@ UsbBotGetStatus (
|
||||
@param Timeout The time to wait command
|
||||
@param CmdStatus The result of high level command execution
|
||||
|
||||
@retval EFI_DEVICE_ERROR Failed to excute command
|
||||
@retval EFI_SUCCESS The command is executed OK, and result in CmdStatus
|
||||
@retval Other Failed to excute command
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
UsbBotExecCommand (
|
||||
IN VOID *Context,
|
||||
@ -455,16 +451,16 @@ UsbBotExecCommand (
|
||||
|
||||
|
||||
/**
|
||||
Reset the mass storage device by BOT protocol
|
||||
Reset the mass storage device by BOT protocol.
|
||||
|
||||
@param Context The context of the BOT protocol, that is,
|
||||
USB_BOT_PROTOCOL
|
||||
USB_BOT_PROTOCOL.
|
||||
@param ExtendedVerification The flag controlling the rule of reset dev.
|
||||
|
||||
@retval EFI_SUCCESS The device is reset
|
||||
@retval Others Failed to reset the device.
|
||||
@retval EFI_SUCCESS The device is reset.
|
||||
@retval Others Failed to reset the device..
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
UsbBotResetDevice (
|
||||
IN VOID *Context,
|
||||
@ -530,48 +526,23 @@ UsbBotResetDevice (
|
||||
return Status;
|
||||
}
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
/**
|
||||
Get the max lun of mass storage device.
|
||||
|
||||
Reset the mass storage device by BOT protocol
|
||||
@param Context The context of the BOT protocol, that is, USB_BOT_PROTOCOL
|
||||
@param MaxLun Return pointer to the max number of lun. Maxlun=1 means lun0 and
|
||||
lun1 in all.
|
||||
|
||||
Arguments:
|
||||
@retval EFI_SUCCESS Get max lun success.
|
||||
@retval Others Failed to execute this request.
|
||||
|
||||
Context - The context of the BOT protocol, that is, USB_BOT_PROTOCOL
|
||||
MaxLun - Return pointer to the max number of lun. Maxlun=1 means lun0 and
|
||||
lun1 in all.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The device is reset
|
||||
Others - Failed to reset the device.
|
||||
|
||||
--*/
|
||||
STATIC
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbBotGetMaxLun (
|
||||
IN VOID *Context,
|
||||
IN UINT8 *MaxLun
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Reset the mass storage device by BOT protocol
|
||||
|
||||
Arguments:
|
||||
|
||||
Context - The context of the BOT protocol, that is, USB_BOT_PROTOCOL
|
||||
MaxLun - Return pointer to the max number of lun. Maxlun=1 means lun0 and
|
||||
lun1 in all.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The device is reset
|
||||
Others - Failed to reset the device.
|
||||
|
||||
--*/
|
||||
{
|
||||
USB_BOT_PROTOCOL *UsbBot;
|
||||
EFI_USB_DEVICE_REQUEST Request;
|
||||
@ -612,15 +583,14 @@ Returns:
|
||||
}
|
||||
|
||||
/**
|
||||
Clean up the resource used by this BOT protocol
|
||||
Clean up the resource used by this BOT protocol.
|
||||
|
||||
@param Context The context of the BOT protocol, that is,
|
||||
USB_BOT_PROTOCOL
|
||||
USB_BOT_PROTOCOL.
|
||||
|
||||
@retval EFI_SUCCESS The resource is cleaned up.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
UsbBotFini (
|
||||
IN VOID *Context
|
||||
|
@ -1,6 +1,10 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
Defination for the USB mass storage Bulk-Only Transport protocol.
|
||||
This implementation is based on the "Universal Serial Bus Mass
|
||||
Storage Class Bulk-Only Transport" Revision 1.0, September 31, 1999.
|
||||
|
||||
Copyright (c) 2007 - 2008, 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
|
||||
@ -9,25 +13,12 @@ http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UsbMassBot.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Defination for the USB mass storage Bulk-Only Transport protocol.
|
||||
This implementation is based on the "Universal Serial Bus Mass
|
||||
Storage Class Bulk-Only Transport" Revision 1.0, September 31, 1999.
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _EFI_USBMASS_BOT_H_
|
||||
#define _EFI_USBMASS_BOT_H_
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
//
|
||||
// Usb Bulk-Only class specfic request
|
||||
//
|
||||
@ -61,7 +52,7 @@ enum {
|
||||
USB_BOT_SEND_CBW_TIMEOUT = 3 * USB_MASS_1_SECOND,
|
||||
USB_BOT_RECV_CSW_TIMEOUT = 3 * USB_MASS_1_SECOND,
|
||||
USB_BOT_RESET_DEVICE_TIMEOUT = 3 * USB_MASS_1_SECOND
|
||||
};
|
||||
}USB_BOT_SUBCLASS;
|
||||
|
||||
//
|
||||
// The CBW (Command Block Wrapper) and CSW (Command Status Wrapper)
|
||||
|
@ -1,5 +1,9 @@
|
||||
/** @file
|
||||
|
||||
Implementation of the USB mass storage Control/Bulk/Interrupt transpor.
|
||||
Notice: it is being obseleted by the standard body in favor of the BOT
|
||||
(Bulk-Only Transport).
|
||||
|
||||
Copyright (c) 2007 - 2008, 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
|
||||
@ -9,25 +13,24 @@ http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UsbMassCbi.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Implementation of the USB mass storage Control/Bulk/Interrupt transpor.
|
||||
Notice: it is being obseleted by the standard body in favor of the BOT
|
||||
(Bulk-Only Transport).
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "UsbMass.h"
|
||||
#include "UsbMassCbi.h"
|
||||
|
||||
STATIC
|
||||
/**
|
||||
Call the Usb mass storage class transport protocol to
|
||||
reset the device. The reset is defined as a Non-Data
|
||||
command. Don't use UsbCbiExecCommand to send the command
|
||||
to device because that may introduce recursive loop.
|
||||
|
||||
@param Context The USB CBI device protocol
|
||||
@param ExtendedVerification The flag controlling the rule of reset
|
||||
|
||||
@retval EFI_SUCCESS the device is reset
|
||||
@retval Others Failed to reset the device
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbCbiResetDevice (
|
||||
IN VOID *Context,
|
||||
@ -45,9 +48,9 @@ UsbCbiResetDevice (
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory
|
||||
@retval EFI_UNSUPPORTED The device isn't supported
|
||||
@retval EFI_SUCCESS The CBI protocol is initialized.
|
||||
@retval Other The Usb cbi init failed.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
UsbCbiInit (
|
||||
IN EFI_USB_IO_PROTOCOL *UsbIo,
|
||||
@ -150,7 +153,6 @@ ON_ERROR:
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Send the command to the device using class specific control transfer.
|
||||
|
||||
@ -163,7 +165,6 @@ ON_ERROR:
|
||||
@retval Others The command failed to transfer to device
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
UsbCbiSendCommand (
|
||||
IN USB_CBI_PROTOCOL *UsbCbi,
|
||||
@ -238,7 +239,6 @@ UsbCbiSendCommand (
|
||||
@retval Others Failed to transfer all the data
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
UsbCbiDataTransfer (
|
||||
IN USB_CBI_PROTOCOL *UsbCbi,
|
||||
@ -355,7 +355,6 @@ ON_EXIT:
|
||||
@retval Others Failed to retrieve the result.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
UsbCbiGetStatus (
|
||||
IN USB_CBI_PROTOCOL *UsbCbi,
|
||||
@ -403,7 +402,7 @@ UsbCbiGetStatus (
|
||||
|
||||
|
||||
/**
|
||||
Execute USB mass storage command through the CBI0/CBI1 transport protocol
|
||||
Execute USB mass storage command through the CBI0/CBI1 transport protocol.
|
||||
|
||||
@param Context The USB CBI device
|
||||
@param Cmd The command to transfer to device
|
||||
@ -416,10 +415,9 @@ UsbCbiGetStatus (
|
||||
@param CmdStatus The result of the command execution
|
||||
|
||||
@retval EFI_SUCCESS The command is executed OK and result in CmdStatus.
|
||||
@retval EFI_DEVICE_ERROR Failed to execute the command
|
||||
@retval Other Failed to execute the command
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
UsbCbiExecCommand (
|
||||
IN VOID *Context,
|
||||
@ -525,12 +523,12 @@ UsbCbiExecCommand (
|
||||
to device because that may introduce recursive loop.
|
||||
|
||||
@param Context The USB CBI device protocol
|
||||
@param ExtendedVerification The flag controlling the rule of reset
|
||||
|
||||
@retval EFI_SUCCESS the device is reset
|
||||
@retval Others Failed to reset the device
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
UsbCbiResetDevice (
|
||||
IN VOID *Context,
|
||||
@ -580,14 +578,13 @@ UsbCbiResetDevice (
|
||||
|
||||
|
||||
/**
|
||||
Clean up the CBI protocol's resource
|
||||
Clean up the CBI protocol's resource.
|
||||
|
||||
@param Context The CBI protocol
|
||||
@param Context The instance of CBI protocol.
|
||||
|
||||
@retval EFI_SUCCESS The resource is cleaned up.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
UsbCbiFini (
|
||||
IN VOID *Context
|
||||
|
@ -1,6 +1,8 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
Defination for the USB mass storage Control/Bulk/Interrupt transport.
|
||||
|
||||
Copyright (c) 2007 - 2008, 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
|
||||
@ -9,23 +11,12 @@ http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UsbMassCbi.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Defination for the USB mass storage Control/Bulk/Interrupt transpor.
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _EFI_USBMASS_CBI_H_
|
||||
#define _EFI_USBMASS_CBI_H_
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
USB_CBI_MAX_PACKET_NUM = 16,
|
||||
USB_CBI_RESET_CMD_LEN = 12,
|
||||
|
||||
@ -43,7 +34,7 @@ enum {
|
||||
// Usb Cbi transport timeout, set by experience
|
||||
//
|
||||
USB_CBI_RESET_DEVICE_TIMEOUT = 1 * USB_MASS_1_SECOND
|
||||
};
|
||||
}USB_CBI_DATA;
|
||||
|
||||
//
|
||||
// Put Interface at the first field is to make it easy to get by Context, which
|
||||
|
@ -1,5 +1,9 @@
|
||||
/** @file
|
||||
|
||||
The implementation of USB mass storage class device driver.
|
||||
The command set supported is "USB Mass Storage Specification
|
||||
for Bootability".
|
||||
|
||||
Copyright (c) 2007 - 2008, 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
|
||||
@ -9,29 +13,10 @@ http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UsbMassImpl.c
|
||||
|
||||
Abstract:
|
||||
|
||||
The implementation of USB mass storage class device driver.
|
||||
The command set supported is "USB Mass Storage Specification
|
||||
for Bootability".
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "UsbMassImpl.h"
|
||||
|
||||
//
|
||||
// The underlying transport protocol. CBI support isn't included
|
||||
// in the current build. It is being obseleted by the standard
|
||||
// body. If you want to enable it, remove the if directive here,
|
||||
// then add the UsbMassCbi.c/.h to the driver's inf file.
|
||||
//
|
||||
STATIC
|
||||
USB_MASS_TRANSPORT *mUsbMassTransport[] = {
|
||||
&mUsbCbi0Transport,
|
||||
@ -355,7 +340,19 @@ UsbMassInitMedia (
|
||||
return Status;
|
||||
}
|
||||
|
||||
STATIC
|
||||
/**
|
||||
Initilize the transport.
|
||||
|
||||
@param This The USB mass driver's driver binding.
|
||||
@param Controller The device to test.
|
||||
@param Transport The pointer to pointer to USB_MASS_TRANSPORT.
|
||||
@param Context The passing parameter.
|
||||
@param MaxLun Get the MaxLun if is BOT dev.
|
||||
|
||||
@retval EFI_SUCCESS The initilization is successful.
|
||||
@retval Others Failed to initilize dev.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbMassInitTransport (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
@ -425,7 +422,20 @@ ON_EXIT:
|
||||
return Status;
|
||||
}
|
||||
|
||||
STATIC
|
||||
/**
|
||||
Usb mass storage driver initializes multi lun.
|
||||
|
||||
@param This The USB mass driver's driver binding.
|
||||
@param Controller The device to test.
|
||||
@param Transport The pointer to USB_MASS_TRANSPORT.
|
||||
@param Context The passing parameter.
|
||||
@param DevicePath The remaining device path
|
||||
@param MaxLun The MaxLun number passed.
|
||||
|
||||
@retval EFI_SUCCESS Initialization is success.
|
||||
@retval Other Initialization fails.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbMassInitMultiLun (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
@ -576,7 +586,18 @@ ON_ERROR:
|
||||
}
|
||||
}
|
||||
|
||||
STATIC
|
||||
/**
|
||||
Initialize No/Unsupported LUN device.
|
||||
|
||||
@param This The USB mass driver's driver binding.
|
||||
@param Controller The device to test.
|
||||
@param Transport The pointer to USB_MASS_TRANSPORT.
|
||||
@param Context The passing parameter.
|
||||
|
||||
@retval EFI_SUCCESS Initialization is success.
|
||||
@retval Other Initialization fails.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbMassInitNonLun (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
@ -1006,30 +1027,23 @@ EFI_DRIVER_BINDING_PROTOCOL gUSBMassDriverBinding = {
|
||||
NULL
|
||||
};
|
||||
|
||||
/**
|
||||
The entry point for the driver, which will install the driver binding and
|
||||
component name protocol.
|
||||
|
||||
@param ImageHandle The image handle of this driver.
|
||||
@param SystemTable The system table.
|
||||
|
||||
@retval EFI_SUCCESS The protocols are installed OK.
|
||||
@retval Others Failed to install protocols.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
USBMassStorageEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
The entry point for the driver, which will install the driver binding and
|
||||
component name protocol
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - The image handle of this driver
|
||||
SystemTable - The system table
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - the protocols are installed OK
|
||||
Others - Failed to install protocols.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
/** @file
|
||||
|
||||
The implementation of USB mass storage class device driver.
|
||||
|
||||
Copyright (c) 2007 - 2008, 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
|
||||
@ -9,17 +11,6 @@ http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UsbMassImpl.h
|
||||
|
||||
Abstract:
|
||||
|
||||
The implementation of USB mass storage class device driver.
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _EFI_USBMASS_IMPL_H_
|
||||
@ -32,17 +23,17 @@ typedef struct _USB_MASS_DEVICE USB_MASS_DEVICE;
|
||||
#include "UsbMassCbi.h"
|
||||
#include "UsbMassBoot.h"
|
||||
|
||||
enum {
|
||||
//
|
||||
// MassStorage raises TPL to TPL_NOTIFY to serialize all its operations
|
||||
// to protect shared data structures.
|
||||
//
|
||||
USB_MASS_TPL = TPL_NOTIFY,
|
||||
|
||||
USB_MASS_SIGNATURE = EFI_SIGNATURE_32 ('U', 's', 'b', 'M')
|
||||
};
|
||||
|
||||
struct _USB_MASS_DEVICE {
|
||||
//
|
||||
// MassStorage raises TPL to TPL_NOTIFY to serialize all its operations
|
||||
// to protect shared data structures.
|
||||
//
|
||||
#define USB_MASS_TPL TPL_NOTIFY
|
||||
|
||||
#define USB_MASS_SIGNATURE EFI_SIGNATURE_32 ('U', 's', 'b', 'M')
|
||||
|
||||
|
||||
typedef struct _USB_MASS_DEVICE {
|
||||
UINT32 Signature;
|
||||
EFI_HANDLE Controller;
|
||||
EFI_USB_IO_PROTOCOL *UsbIo;
|
||||
@ -54,7 +45,7 @@ struct _USB_MASS_DEVICE {
|
||||
UINT8 Pdt; // Peripheral Device Type
|
||||
USB_MASS_TRANSPORT *Transport; // USB mass storage transport protocol
|
||||
VOID *Context; // Opaque storage for mass transport
|
||||
};
|
||||
}USB_MASS_DEVICE;
|
||||
|
||||
#define USB_MASS_DEVICE_FROM_BLOCKIO(a) \
|
||||
CR (a, USB_MASS_DEVICE, BlockIo, USB_MASS_SIGNATURE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user