Add DevicePathUtilities DevicePathToText DevciePathFromText USB2HostController protocols

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1037 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ljin6
2006-07-18 04:13:40 +00:00
parent 4b9fc76f7b
commit 562d28495d
30 changed files with 22444 additions and 1264 deletions

View File

@ -0,0 +1,189 @@
/*++
Copyright 2006, 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:
ComponentName.c
Abstract:
--*/
#include "Ehci.h"
//
// EFI Component Name Functions
//
EFI_STATUS
EFIAPI
EhciComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
);
EFI_STATUS
EFIAPI
EhciComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle, OPTIONAL
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
//
// EFI Component Name Protocol
//
EFI_COMPONENT_NAME_PROTOCOL gEhciComponentName = {
EhciComponentNameGetDriverName,
EhciComponentNameGetControllerName,
"eng"
};
static EFI_UNICODE_STRING_TABLE mEhciDriverNameTable[] = {
{ "eng", L"UEFI Usb Ehci Driver" },
{ NULL , NULL }
};
EFI_STATUS
EFIAPI
EhciComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
Language - A pointer to a three character ISO 639-2 language identifier.
This is the language of the driver name that 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.
DriverName - A pointer to the Unicode string to return. This Unicode string
is the name of the driver specified by This in the language
specified by Language.
Returns:
EFI_SUCCESS - The Unicode string for the Driver specified by This
and the language specified by Language was returned
in DriverName.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - DriverName is NULL.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
return LookupUnicodeString (
Language,
gEhciComponentName.SupportedLanguages,
mEhciDriverNameTable,
DriverName
);
}
EFI_STATUS
EFIAPI
EhciComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle, OPTIONAL
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle - The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
ChildHandle - The handle of the child controller to retrieve 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.
Language - A pointer to a three character ISO 639-2 language
identifier. This is the language of the controller name
that 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.
ControllerName - A pointer to the Unicode string to return. 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.
Returns:
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.
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - ControllerName is NULL.
EFI_UNSUPPORTED - The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
EFI_STATUS Status;
USB2_HC_DEV *EhciDev;
EFI_USB2_HC_PROTOCOL *Usb2Hc;
//
// This is a device driver, so ChildHandle must be NULL.
//
if (ChildHandle != NULL) {
return EFI_UNSUPPORTED;
}
//
// Get the device context
//
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiUsb2HcProtocolGuid,
(VOID **) &Usb2Hc,
gEhciDriverBinding.DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return Status;
}
EhciDev = USB2_HC_DEV_FROM_THIS (Usb2Hc);
return LookupUnicodeString (
Language,
gEhciComponentName.SupportedLanguages,
EhciDev->ControllerNameTable,
ControllerName
);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Copyright (c) 2006, 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.-->
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
<MsaHeader>
<ModuleName>Ehci</ModuleName>
<ModuleType>UEFI_DRIVER</ModuleType>
<GuidValue>BDFE430E-8F2A-4db0-9991-6F856594777E</GuidValue>
<Version>1.0</Version>
<Abstract>Component description file for Ehci module</Abstract>
<Description>This module provides USB2 Host Controller Protocol implementation for Enhanced Host Controller Interface</Description>
<Copyright>Copyright (c) 2006, Intel Corporation</Copyright>
<License>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.</License>
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
</MsaHeader>
<ModuleDefinitions>
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
<BinaryModule>false</BinaryModule>
<OutputFileBasename>Ehci</OutputFileBasename>
</ModuleDefinitions>
<LibraryClassDefinitions>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DebugLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiDriverModelLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiDriverEntryPoint</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>BaseLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>BaseMemoryLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>MemoryAllocationLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiBootServicesTableLib</Keyword>
</LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>Ehci.c</Filename>
<Filename>EhciMem.c</Filename>
<Filename>EhciReg.c</Filename>
<Filename>EhciSched.c</Filename>
<Filename>ComponentName.c</Filename>
<Filename>Ehci.h</Filename>
</SourceFiles>
<PackageDependencies>
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
</PackageDependencies>
<Protocols>
<Protocol Usage="TO_START">
<ProtocolCName>gEfiPciIoProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="BY_START">
<ProtocolCName>gEfiUsb2HcProtocolGuid</ProtocolCName>
</Protocol>
</Protocols>
<Externs>
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<Extern>
<DriverBinding>gEhciDriverBinding</DriverBinding>
</Extern>
<Extern>
<ComponentName>gEhciComponentName</ComponentName>
</Extern>
</Externs>
</ModuleSurfaceArea>

View File

@ -0,0 +1,761 @@
/*++
Copyright (c) 2006, 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:
EhciMem.c
Abstract:
Revision History
--*/
#include "Ehci.h"
EFI_STATUS
CreateMemoryBlock (
IN USB2_HC_DEV *HcDev,
OUT MEMORY_MANAGE_HEADER **MemoryHeader,
IN UINTN MemoryBlockSizeInPages
)
/*++
Routine Description:
Use PciIo->AllocateBuffer to allocate common buffer for the memory block,
and use PciIo->Map to map the common buffer for Bus Master Read/Write.
Arguments:
HcDev - USB2_HC_DEV
MemoryHeader - MEMORY_MANAGE_HEADER to output
MemoryBlockSizeInPages - MemoryBlockSizeInPages
Returns:
EFI_SUCCESS Success
EFI_OUT_OF_RESOURCES Fail for no resources
EFI_UNSUPPORTED Unsupported currently
--*/
{
EFI_STATUS Status;
VOID *CommonBuffer;
EFI_PHYSICAL_ADDRESS MappedAddress;
UINTN MemoryBlockSizeInBytes;
VOID *Mapping;
//
// Allocate memory for MemoryHeader
//
*MemoryHeader = AllocateZeroPool (sizeof (MEMORY_MANAGE_HEADER));
if (*MemoryHeader == NULL) {
return EFI_OUT_OF_RESOURCES;
}
(*MemoryHeader)->Next = NULL;
//
// set Memory block size
//
(*MemoryHeader)->MemoryBlockSizeInBytes = EFI_PAGES_TO_SIZE (MemoryBlockSizeInPages);
//
// each bit in Bit Array will manage 32 bytes memory in memory block
//
(*MemoryHeader)->BitArraySizeInBytes = ((*MemoryHeader)->MemoryBlockSizeInBytes / 32) / 8;
//
// Allocate memory for BitArray
//
(*MemoryHeader)->BitArrayPtr = AllocateZeroPool ((*MemoryHeader)->BitArraySizeInBytes);
if ((*MemoryHeader)->BitArrayPtr == NULL) {
gBS->FreePool (*MemoryHeader);
return EFI_OUT_OF_RESOURCES;
}
//
// Memory Block uses MemoryBlockSizeInPages pages,
// and it is allocated as common buffer use.
//
Status = HcDev->PciIo->AllocateBuffer (
HcDev->PciIo,
AllocateAnyPages,
EfiBootServicesData,
MemoryBlockSizeInPages,
&CommonBuffer,
0
);
if (EFI_ERROR (Status)) {
gBS->FreePool ((*MemoryHeader)->BitArrayPtr);
gBS->FreePool (*MemoryHeader);
return EFI_OUT_OF_RESOURCES;
}
MemoryBlockSizeInBytes = EFI_PAGES_TO_SIZE (MemoryBlockSizeInPages);
Status = HcDev->PciIo->Map (
HcDev->PciIo,
EfiPciIoOperationBusMasterCommonBuffer,
CommonBuffer,
&MemoryBlockSizeInBytes,
&MappedAddress,
&Mapping
);
//
// If returned Mapped size is less than the size
// we request,do not support.
//
if (EFI_ERROR (Status) || (MemoryBlockSizeInBytes != EFI_PAGES_TO_SIZE (MemoryBlockSizeInPages))) {
HcDev->PciIo->FreeBuffer (HcDev->PciIo, MemoryBlockSizeInPages, CommonBuffer);
gBS->FreePool ((*MemoryHeader)->BitArrayPtr);
gBS->FreePool (*MemoryHeader);
return EFI_UNSUPPORTED;
}
//
// Data structure involved by host controller
// should be restricted into the same 4G
//
if (HcDev->Is64BitCapable != 0) {
if (HcDev->High32BitAddr != GET_32B_TO_63B (MappedAddress)) {
HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);
HcDev->PciIo->FreeBuffer (HcDev->PciIo, MemoryBlockSizeInPages, CommonBuffer);
gBS->FreePool ((*MemoryHeader)->BitArrayPtr);
gBS->FreePool (*MemoryHeader);
return EFI_UNSUPPORTED;
}
}
//
// Set Memory block initial address
//
(*MemoryHeader)->MemoryBlockPtr = (UINT8 *) ((UINTN) MappedAddress);
(*MemoryHeader)->Mapping = Mapping;
ZeroMem (
(*MemoryHeader)->MemoryBlockPtr,
EFI_PAGES_TO_SIZE (MemoryBlockSizeInPages)
);
return EFI_SUCCESS;
}
EFI_STATUS
FreeMemoryHeader (
IN USB2_HC_DEV *HcDev,
IN MEMORY_MANAGE_HEADER *MemoryHeader
)
/*++
Routine Description:
Free Memory Header
Arguments:
HcDev - USB2_HC_DEV
MemoryHeader - MemoryHeader to be freed
Returns:
EFI_SUCCESS Success
EFI_INVALID_PARAMETER Parameter is error
--*/
{
if ((MemoryHeader == NULL) || (HcDev == NULL)) {
return EFI_INVALID_PARAMETER;
}
//
// unmap the common buffer used by the memory block
//
HcDev->PciIo->Unmap (HcDev->PciIo, MemoryHeader->Mapping);
//
// free common buffer
//
HcDev->PciIo->FreeBuffer (
HcDev->PciIo,
EFI_SIZE_TO_PAGES (MemoryHeader->MemoryBlockSizeInBytes),
MemoryHeader->MemoryBlockPtr
);
//
// free bit array
//
gBS->FreePool (MemoryHeader->BitArrayPtr);
//
// free memory header
//
gBS->FreePool (MemoryHeader);
return EFI_SUCCESS;
}
EFI_STATUS
EhciAllocatePool (
IN USB2_HC_DEV *HcDev,
OUT UINT8 **Pool,
IN UINTN AllocSize
)
/*++
Routine Description:
Ehci Allocate Pool
Arguments:
HcDev - USB2_HC_DEV
Pool - Place to store pointer to the memory buffer
AllocSize - Alloc Size
Returns:
EFI_SUCCESS Success
EFI_DEVICE_ERROR Fail
--*/
{
MEMORY_MANAGE_HEADER *MemoryHeader;
MEMORY_MANAGE_HEADER *TempHeaderPtr;
MEMORY_MANAGE_HEADER *NewMemoryHeader;
UINTN RealAllocSize;
UINTN MemoryBlockSizeInPages;
EFI_STATUS Status;
EFI_TPL OldTpl;
*Pool = NULL;
MemoryHeader = HcDev->MemoryHeader;
ASSERT (MemoryHeader != NULL);
OldTpl = gBS->RaiseTPL (EFI_TPL_NOTIFY + 1);
//
// allocate unit is 32 bytes (align on 32 byte)
//
if (AllocSize & 0x1F) {
RealAllocSize = (AllocSize / 32 + 1) * 32;
} else {
RealAllocSize = AllocSize;
}
//
// There may be linked MemoryHeaders.
// To allocate a free pool in Memory blocks,
// must search in the MemoryHeader link list
// until enough free pool is found.
//
Status = EFI_NOT_FOUND;
for (TempHeaderPtr = MemoryHeader; TempHeaderPtr != NULL; TempHeaderPtr = TempHeaderPtr->Next) {
Status = AllocMemInMemoryBlock (
TempHeaderPtr,
Pool,
RealAllocSize / 32
);
if (!EFI_ERROR (Status)) {
ZeroMem (*Pool, AllocSize);
gBS->RestoreTPL (OldTpl);
return EFI_SUCCESS;
}
}
gBS->RestoreTPL (OldTpl);
//
// There is no enough memory,
// Create a new Memory Block
//
//
// if pool size is larger than NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES,
// just allocate a large enough memory block.
//
if (RealAllocSize > EFI_PAGES_TO_SIZE (NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES)) {
MemoryBlockSizeInPages = EFI_SIZE_TO_PAGES (RealAllocSize) + 1;
} else {
MemoryBlockSizeInPages = NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES;
}
Status = CreateMemoryBlock (HcDev, &NewMemoryHeader, MemoryBlockSizeInPages);
if (EFI_ERROR (Status)) {
return Status;
}
OldTpl = gBS->RaiseTPL (EFI_TPL_NOTIFY + 1);
//
// Link the new Memory Block to the Memory Header list
//
InsertMemoryHeaderToList (MemoryHeader, NewMemoryHeader);
Status = AllocMemInMemoryBlock (
NewMemoryHeader,
Pool,
RealAllocSize / 32
);
if (!EFI_ERROR (Status)) {
ZeroMem (*Pool, AllocSize);
}
gBS->RestoreTPL (OldTpl);
return Status;
}
VOID
EhciFreePool (
IN USB2_HC_DEV *HcDev,
IN UINT8 *Pool,
IN UINTN AllocSize
)
/*++
Routine Description:
Uhci Free Pool
Arguments:
HcDev - USB_HC_DEV
Pool - Pool to free
AllocSize - Pool size
Returns:
VOID
--*/
{
MEMORY_MANAGE_HEADER *MemoryHeader;
MEMORY_MANAGE_HEADER *TempHeaderPtr;
UINTN StartBytePos;
UINTN Index;
UINT8 StartBitPos;
UINT8 Index2;
UINTN Count;
UINTN RealAllocSize;
EFI_TPL OldTpl;
OldTpl = gBS->RaiseTPL (EFI_TPL_NOTIFY + 1);
MemoryHeader = HcDev->MemoryHeader;
//
// allocate unit is 32 byte (align on 32 byte)
//
if (AllocSize & 0x1F) {
RealAllocSize = (AllocSize / 32 + 1) * 32;
} else {
RealAllocSize = AllocSize;
}
//
// scan the memory header linked list for
// the asigned memory to free.
//
for (TempHeaderPtr = MemoryHeader; TempHeaderPtr != NULL; TempHeaderPtr = TempHeaderPtr->Next) {
if ((Pool >= TempHeaderPtr->MemoryBlockPtr) &&
((Pool + RealAllocSize) <= (TempHeaderPtr->MemoryBlockPtr + TempHeaderPtr->MemoryBlockSizeInBytes))
) {
//
// Pool is in the Memory Block area,
// find the start byte and bit in the bit array
//
StartBytePos = ((Pool - TempHeaderPtr->MemoryBlockPtr) / 32) / 8;
StartBitPos = (UINT8) (((Pool - TempHeaderPtr->MemoryBlockPtr) / 32) & 0x7);
//
// reset associated bits in bit arry
//
for (Index = StartBytePos, Index2 = StartBitPos, Count = 0; Count < (RealAllocSize / 32); Count++) {
TempHeaderPtr->BitArrayPtr[Index] ^= (UINT8) (bit (Index2));
Index2++;
if (Index2 == 8) {
Index += 1;
Index2 = 0;
}
}
//
// break the loop
//
break;
}
}
//
// Release emptied memory blocks (only if the memory block is not
// the first one in the memory header list
//
for (TempHeaderPtr = MemoryHeader->Next; TempHeaderPtr != NULL;) {
ASSERT (MemoryHeader->Next != NULL);
if (IsMemoryBlockEmptied (TempHeaderPtr)) {
DelinkMemoryBlock (MemoryHeader, TempHeaderPtr);
//
// when the TempHeaderPtr is freed in FreeMemoryHeader(),
// the TempHeaderPtr is pointing to nonsense content.
//
gBS->RestoreTPL (OldTpl);
FreeMemoryHeader (HcDev, TempHeaderPtr);
OldTpl = gBS->RaiseTPL (EFI_TPL_NOTIFY + 1);
//
// reset the TempHeaderPtr, continue search for
// another empty memory block.
//
TempHeaderPtr = MemoryHeader->Next;
continue;
}
TempHeaderPtr = TempHeaderPtr->Next;
}
gBS->RestoreTPL (OldTpl);
}
VOID
InsertMemoryHeaderToList (
IN MEMORY_MANAGE_HEADER *MemoryHeader,
IN MEMORY_MANAGE_HEADER *NewMemoryHeader
)
/*++
Routine Description:
Insert Memory Header To List
Arguments:
MemoryHeader - MEMORY_MANAGE_HEADER
NewMemoryHeader - MEMORY_MANAGE_HEADER
Returns:
VOID
--*/
{
MEMORY_MANAGE_HEADER *TempHeaderPtr;
for (TempHeaderPtr = MemoryHeader; TempHeaderPtr != NULL; TempHeaderPtr = TempHeaderPtr->Next) {
if (TempHeaderPtr->Next == NULL) {
TempHeaderPtr->Next = NewMemoryHeader;
break;
}
}
}
EFI_STATUS
AllocMemInMemoryBlock (
IN MEMORY_MANAGE_HEADER *MemoryHeader,
OUT VOID **Pool,
IN UINTN NumberOfMemoryUnit
)
/*++
Routine Description:
Alloc Memory In MemoryBlock
Arguments:
MemoryHeader - MEMORY_MANAGE_HEADER
Pool - Place to store pointer to memory
NumberOfMemoryUnit - Number Of Memory Unit
Returns:
EFI_SUCCESS Success
EFI_NOT_FOUND Can't find the free memory
--*/
{
UINTN TempBytePos;
UINTN FoundBytePos;
UINT8 Index;
UINT8 FoundBitPos;
UINT8 ByteValue;
UINT8 BitValue;
UINTN NumberOfZeros;
UINTN Count;
FoundBytePos = 0;
FoundBitPos = 0;
ByteValue = MemoryHeader->BitArrayPtr[0];
NumberOfZeros = 0;
Index = 0;
for (TempBytePos = 0; TempBytePos < MemoryHeader->BitArraySizeInBytes;) {
//
// Pop out BitValue from a byte in TempBytePos.
//
BitValue = (UINT8) (ByteValue & 0x1);
//
// right shift the byte
//
ByteValue /= 2;
if (BitValue == 0) {
//
// Found a free bit, the NumberOfZeros only record the number
// of those consecutive zeros
//
NumberOfZeros++;
//
// Found enough consecutive free space, break the loop
//
if (NumberOfZeros >= NumberOfMemoryUnit) {
break;
}
} else {
//
// Encountering a '1', meant the bit is ocupied.
//
if (NumberOfZeros >= NumberOfMemoryUnit) {
//
// Found enough consecutive free space,break the loop
//
break;
} else {
//
// the NumberOfZeros only record the number of those consecutive zeros,
// so reset the NumberOfZeros to 0 when encountering '1' before finding
// enough consecutive '0's
//
NumberOfZeros = 0;
//
// reset the (FoundBytePos,FoundBitPos) to the position of '1'
//
FoundBytePos = TempBytePos;
FoundBitPos = Index;
}
}
//
// step forward a bit
//
Index++;
if (Index == 8) {
//
// step forward a byte, getting the byte value,
// and reset the bit pos.
//
TempBytePos += 1;
ByteValue = MemoryHeader->BitArrayPtr[TempBytePos];
Index = 0;
}
}
if (NumberOfZeros < NumberOfMemoryUnit) {
return EFI_NOT_FOUND;
}
//
// Found enough free space.
//
//
// The values recorded in (FoundBytePos,FoundBitPos) have two conditions:
// 1)(FoundBytePos,FoundBitPos) record the position
// of the last '1' before the consecutive '0's, it must
// be adjusted to the start position of the consecutive '0's.
// 2)the start address of the consecutive '0's is just the start of
// the bitarray. so no need to adjust the values of
// (FoundBytePos,FoundBitPos).
//
if ((MemoryHeader->BitArrayPtr[FoundBytePos] & bit (FoundBitPos)) != 0) {
FoundBitPos += 1;
}
//
// Have the (FoundBytePos,FoundBitPos) make sense.
//
if (FoundBitPos > 7) {
FoundBytePos += 1;
FoundBitPos -= 8;
}
//
// Set the memory as allocated
//
for (TempBytePos = FoundBytePos, Index = FoundBitPos, Count = 0; Count < NumberOfMemoryUnit; Count++) {
MemoryHeader->BitArrayPtr[TempBytePos] |= bit (Index);
Index++;
if (Index == 8) {
TempBytePos += 1;
Index = 0;
}
}
*Pool = MemoryHeader->MemoryBlockPtr + (FoundBytePos * 8 + FoundBitPos) * 32;
return EFI_SUCCESS;
}
BOOLEAN
IsMemoryBlockEmptied (
IN MEMORY_MANAGE_HEADER *MemoryHeaderPtr
)
/*++
Routine Description:
Is Memory Block Emptied
Arguments:
MemoryHeaderPtr - MEMORY_MANAGE_HEADER
Returns:
TRUE Empty
FALSE Not Empty
--*/
{
UINTN Index;
for (Index = 0; Index < MemoryHeaderPtr->BitArraySizeInBytes; Index++) {
if (MemoryHeaderPtr->BitArrayPtr[Index] != 0) {
return FALSE;
}
}
return TRUE;
}
VOID
DelinkMemoryBlock (
IN MEMORY_MANAGE_HEADER *FirstMemoryHeader,
IN MEMORY_MANAGE_HEADER *NeedFreeMemoryHeader
)
/*++
Routine Description:
Delink Memory Block
Arguments:
FirstMemoryHeader - MEMORY_MANAGE_HEADER
NeedFreeMemoryHeader - MEMORY_MANAGE_HEADER
Returns:
VOID
--*/
{
MEMORY_MANAGE_HEADER *TempHeaderPtr;
if ((FirstMemoryHeader == NULL) || (NeedFreeMemoryHeader == NULL)) {
return ;
}
for (TempHeaderPtr = FirstMemoryHeader; TempHeaderPtr != NULL; TempHeaderPtr = TempHeaderPtr->Next) {
if (TempHeaderPtr->Next == NeedFreeMemoryHeader) {
//
// Link the before and after
//
TempHeaderPtr->Next = NeedFreeMemoryHeader->Next;
break;
}
}
}
EFI_STATUS
InitialMemoryManagement (
IN USB2_HC_DEV *HcDev
)
/*++
Routine Description:
Initialize Memory Management
Arguments:
HcDev - USB2_HC_DEV
Returns:
EFI_SUCCESS Success
EFI_DEVICE_ERROR Fail
--*/
{
EFI_STATUS Status;
MEMORY_MANAGE_HEADER *MemoryHeader;
UINTN MemPages;
MemPages = NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES;
Status = CreateMemoryBlock (HcDev, &MemoryHeader, MemPages);
if (EFI_ERROR (Status)) {
Status = EFI_OUT_OF_RESOURCES;
goto exit;
}
HcDev->MemoryHeader = MemoryHeader;
exit:
return Status;
}
EFI_STATUS
DeinitialMemoryManagement (
IN USB2_HC_DEV *HcDev
)
/*++
Routine Description:
Deinitialize Memory Management
Arguments:
HcDev - USB2_HC_DEV
Returns:
EFI_SUCCESS Success
EFI_DEVICE_ERROR Fail
--*/
{
MEMORY_MANAGE_HEADER *TempHeaderPtr;
for (TempHeaderPtr = HcDev->MemoryHeader->Next; TempHeaderPtr != NULL;) {
DelinkMemoryBlock (HcDev->MemoryHeader, TempHeaderPtr);
//
// when the TempHeaderPtr is freed in FreeMemoryHeader(),
// the TempHeaderPtr is pointing to nonsense content.
//
FreeMemoryHeader (HcDev, TempHeaderPtr);
//
// reset the TempHeaderPtr,continue free another memory block.
//
TempHeaderPtr = HcDev->MemoryHeader->Next;
}
FreeMemoryHeader (HcDev, HcDev->MemoryHeader);
return EFI_SUCCESS;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -71,6 +71,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
<Protocol Usage="BY_START"> <Protocol Usage="BY_START">
<ProtocolCName>gEfiUsbHcProtocolGuid</ProtocolCName> <ProtocolCName>gEfiUsbHcProtocolGuid</ProtocolCName>
</Protocol> </Protocol>
<Protocol Usage="BY_START">
<ProtocolCName>gEfiUsb2HcProtocolGuid</ProtocolCName>
</Protocol>
</Protocols> </Protocols>
<Externs> <Externs>
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification> <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -710,7 +710,7 @@ BotDataPhase (
BufferPtr = (UINT8 *) DataBuffer; BufferPtr = (UINT8 *) DataBuffer;
TransferredSize = 0; TransferredSize = 0;
MaxRetry = 10; MaxRetry = 10;
PackageNum = 15; PackageNum = 128;
// //
// retrieve the the max packet length of the given endpoint // retrieve the the max packet length of the given endpoint

View File

@ -83,7 +83,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
<Protocol Usage="BY_START"> <Protocol Usage="BY_START">
<ProtocolCName>gEfiUsbIoProtocolGuid</ProtocolCName> <ProtocolCName>gEfiUsbIoProtocolGuid</ProtocolCName>
</Protocol> </Protocol>
<Protocol Usage="TO_START"> <Protocol Usage="SOMETIMES_CONSUMED">
<ProtocolCName>gEfiUsb2HcProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="SOMETIMES_CONSUMED">
<ProtocolCName>gEfiUsbHcProtocolGuid</ProtocolCName> <ProtocolCName>gEfiUsbHcProtocolGuid</ProtocolCName>
</Protocol> </Protocol>
<Protocol Usage="TO_START"> <Protocol Usage="TO_START">

File diff suppressed because it is too large Load Diff

View File

@ -30,10 +30,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "hub.h" #include "hub.h"
#include "usbutil.h" #include "usbutil.h"
//#ifdef EFI_DEBUG
extern UINTN gUSBDebugLevel; extern UINTN gUSBDebugLevel;
extern UINTN gUSBErrorLevel; extern UINTN gUSBErrorLevel;
//#endif
#define MICROSECOND 10000 #define MICROSECOND 10000
#define ONESECOND (1000 * MICROSECOND) #define ONESECOND (1000 * MICROSECOND)
@ -123,6 +121,8 @@ typedef struct usb_io_device {
UINT8 DeviceAddress; UINT8 DeviceAddress;
BOOLEAN IsConfigured; BOOLEAN IsConfigured;
BOOLEAN IsSlowDevice; BOOLEAN IsSlowDevice;
UINT8 DeviceSpeed;
EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator;
EFI_USB_DEVICE_DESCRIPTOR DeviceDescriptor; EFI_USB_DEVICE_DESCRIPTOR DeviceDescriptor;
LIST_ENTRY ConfigDescListHead; LIST_ENTRY ConfigDescListHead;
CONFIG_DESC_LIST_ENTRY *ActiveConfig; CONFIG_DESC_LIST_ENTRY *ActiveConfig;
@ -154,10 +154,12 @@ typedef struct _usb_bus_controller_device {
UINTN Signature; UINTN Signature;
EFI_USB_BUS_PROTOCOL BusIdentify; EFI_USB_BUS_PROTOCOL BusIdentify;
EFI_USB2_HC_PROTOCOL *Usb2HCInterface;
EFI_USB_HC_PROTOCOL *UsbHCInterface; EFI_USB_HC_PROTOCOL *UsbHCInterface;
EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_DEVICE_PATH_PROTOCOL *DevicePath;
UINT8 AddressPool[16]; UINT8 AddressPool[16];
USB_IO_DEVICE *Root; USB_IO_DEVICE *Root;
BOOLEAN Hc2ProtocolSupported;
} USB_BUS_CONTROLLER_DEVICE; } USB_BUS_CONTROLLER_DEVICE;
#define USB_BUS_CONTROLLER_DEVICE_FROM_THIS(a) \ #define USB_BUS_CONTROLLER_DEVICE_FROM_THIS(a) \
@ -177,28 +179,99 @@ extern EFI_GUID gUSBBusDriverGuid;
BOOLEAN BOOLEAN
IsHub ( IsHub (
IN USB_IO_CONTROLLER_DEVICE *Dev IN USB_IO_CONTROLLER_DEVICE *Dev
); )
/*++
Routine Description:
Tell if a usb controller is a hub controller.
Arguments:
Dev - UsbIoController device structure.
Returns:
TRUE/FALSE
--*/
;
EFI_STATUS EFI_STATUS
UsbGetStringtable ( UsbGetStringtable (
IN USB_IO_DEVICE *UsbIoDevice IN USB_IO_DEVICE *UsbIoDevice
); )
/*++
Routine Description:
Get the string table stored in a usb device.
Arguments:
Dev - UsbIoController device structure.
Returns:
EFI_SUCCESS
EFI_UNSUPPORTED
EFI_OUT_OF_RESOURCES
--*/
;
EFI_STATUS EFI_STATUS
UsbGetAllConfigurations ( UsbGetAllConfigurations (
IN USB_IO_DEVICE *UsbIoDevice IN USB_IO_DEVICE *UsbIoDevice
); )
/*++
Routine Description:
This function is to parse all the configuration descriptor.
Arguments:
UsbIoDevice - USB_IO_DEVICE device structure.
Returns:
EFI_SUCCESS
EFI_DEVICE_ERROR
EFI_OUT_OF_RESOURCES
--*/
;
EFI_STATUS EFI_STATUS
UsbSetConfiguration ( UsbSetConfiguration (
IN USB_IO_DEVICE *Dev, IN USB_IO_DEVICE *Dev,
IN UINTN ConfigurationValue IN UINTN ConfigurationValue
); )
/*++
Routine Description:
Set the device to a configuration value.
Arguments:
UsbIoDev - USB_IO_DEVICE to be set configuration
ConfigrationValue - The configuration value to be set to that device
Returns:
EFI_SUCCESS
EFI_DEVICE_ERROR
--*/
;
EFI_STATUS EFI_STATUS
UsbSetDefaultConfiguration ( UsbSetDefaultConfiguration (
IN USB_IO_DEVICE *Dev IN USB_IO_DEVICE *Dev
); )
/*++
Routine Description:
Set the device to a default configuration value.
Arguments:
UsbIoDev - USB_IO_DEVICE to be set configuration
Returns
EFI_SUCCESS
EFI_DEVICE_ERROR
--*/
;
// //
// Device Deconfiguration functions // Device Deconfiguration functions
@ -206,56 +279,834 @@ UsbSetDefaultConfiguration (
VOID VOID
UsbDestroyAllConfiguration ( UsbDestroyAllConfiguration (
IN USB_IO_DEVICE *UsbIoDevice IN USB_IO_DEVICE *UsbIoDevice
); )
/*++
Routine Description:
Delete all configuration data when device is not used.
Arguments:
UsbIoDevice - USB_IO_DEVICE to be set configuration
Returns:
VOID
--*/
;
EFI_STATUS EFI_STATUS
DoHubConfig ( DoHubConfig (
IN USB_IO_CONTROLLER_DEVICE *HubIoDevice IN USB_IO_CONTROLLER_DEVICE *HubIoDevice
); )
/*++
Routine Description:
Configure the hub
Arguments:
HubController - Indicating the hub controller device that
will be configured
Returns:
EFI_SUCCESS
EFI_DEVICE_ERROR
--*/
;
VOID VOID
GetDeviceEndPointMaxPacketLength ( GetDeviceEndPointMaxPacketLength (
IN EFI_USB_IO_PROTOCOL *UsbIo, IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 EndpointAddr, IN UINT8 EndpointAddr,
OUT UINT8 *MaxPacketLength OUT UINTN *MaxPacketLength
); )
/*++
Routine Description:
Get the Max Packet Length of the speified Endpoint.
Arguments:
UsbIo - Given Usb Controller device.
EndpointAddr - Given Endpoint address.
MaxPacketLength - The max packet length of that endpoint
Returns:
N/A
--*/
;
VOID VOID
GetDataToggleBit ( GetDataToggleBit (
IN EFI_USB_IO_PROTOCOL *UsbIo, IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 EndpointAddr, IN UINT8 EndpointAddr,
OUT UINT8 *DataToggle OUT UINT8 *DataToggle
); )
/*++
Routine Description:
Get the datatoggle of a specified endpoint.
Arguments:
UsbIo - Given Usb Controller device.
EndpointAddr - Given Endpoint address.
DataToggle - The current data toggle of that endpoint
Returns:
VOID
--*/
;
VOID VOID
SetDataToggleBit ( SetDataToggleBit (
IN EFI_USB_IO_PROTOCOL *UsbIo, IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 EndpointAddr, IN UINT8 EndpointAddr,
IN UINT8 DataToggle IN UINT8 DataToggle
); )
/*++
Routine Description:
Set the datatoggle of a specified endpoint
Arguments:
UsbIo - Given Usb Controller device.
EndpointAddr - Given Endpoint address.
DataToggle - The current data toggle of that endpoint to be set
Returns:
VOID
--*/
;
INTERFACE_DESC_LIST_ENTRY * INTERFACE_DESC_LIST_ENTRY *
FindInterfaceListEntry ( FindInterfaceListEntry (
IN EFI_USB_IO_PROTOCOL *This IN EFI_USB_IO_PROTOCOL *This
); )
/*++
Routine Description:
Find Interface ListEntry.
Arguments:
This - EFI_USB_IO_PROTOCOL
Returns:
INTERFACE_DESC_LIST_ENTRY pointer
--*/
;
ENDPOINT_DESC_LIST_ENTRY * ENDPOINT_DESC_LIST_ENTRY *
FindEndPointListEntry ( FindEndPointListEntry (
IN EFI_USB_IO_PROTOCOL *This, IN EFI_USB_IO_PROTOCOL *This,
IN UINT8 EndPointAddress IN UINT8 EndPointAddress
); )
/*++
Routine Description:
Find EndPoint ListEntry.
Arguments:
This - EFI_USB_IO_PROTOCOL
EndpointAddr - Endpoint address.
Returns:
ENDPOINT_DESC_LIST_ENTRY pointer
--*/
;
EFI_STATUS EFI_STATUS
IsDeviceDisconnected ( IsDeviceDisconnected (
IN USB_IO_CONTROLLER_DEVICE *UsbIoController, IN USB_IO_CONTROLLER_DEVICE *UsbIoController,
IN OUT BOOLEAN *Disconnected IN OUT BOOLEAN *Disconnected
); )
/*++
Routine Description:
Reset if the device is disconencted or not
Arguments:
UsbIoController - Indicating the Usb Controller Device.
Disconnected - Indicate whether the device is disconencted or not
Returns:
EFI_SUCCESS
EFI_DEVICE_ERROR
--*/
;
EFI_STATUS EFI_STATUS
UsbDeviceDeConfiguration ( UsbDeviceDeConfiguration (
IN USB_IO_DEVICE *UsbIoDevice IN USB_IO_DEVICE *UsbIoDevice
); )
/*++
Routine Description:
Remove Device, Device Handles, Uninstall Protocols.
Arguments:
UsbIoDevice - The device to be deconfigured.
Returns:
EFI_SUCCESS
EFI_DEVICE_ERROR
--*/
;
EFI_STATUS
EFIAPI
UsbVirtualHcGetCapability (
IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
OUT UINT8 *MaxSpeed,
OUT UINT8 *PortNumber,
OUT UINT8 *Is64BitCapable
)
/*++
Routine Description:
Virtual interface to Retrieves the capablility of root hub ports
for both Hc2 and Hc protocol.
Arguments:
UsbBusDev - A pointer to bus controller of the device.
MaxSpeed - A pointer to the number of the host controller.
PortNumber - A pointer to the number of the root hub ports.
Is64BitCapable - A pointer to the flag for whether controller supports
64-bit memory addressing.
Returns:
EFI_SUCCESS
The host controller capability were retrieved successfully.
EFI_INVALID_PARAMETER
MaxSpeed or PortNumber or Is64BitCapable is NULL.
EFI_DEVICE_ERROR
An error was encountered while attempting to retrieve the capabilities.
--*/
;
EFI_STATUS
EFIAPI
UsbVirtualHcReset (
IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
IN UINT16 Attributes
)
/*++
Routine Description:
Virtual interface to provides software reset for the USB host controller
for both Hc2 and Hc protocol.
Arguments:
UsbBusDev - A pointer to bus controller of the device.
Attributes - A bit mask of the reset operation to perform.
See below for a list of the supported bit mask values.
#define EFI_USB_HC_RESET_GLOBAL 0x0001 // Hc2 and Hc
#define EFI_USB_HC_RESET_HOST_CONTROLLER 0x0002 // Hc2 and Hc
#define EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG 0x0004 // Hc2
#define EFI_USB_HC_RESET_HOST_WITH_DEBUG 0x0008 // Hc2
EFI_USB_HC_RESET_GLOBAL
If this bit is set, a global reset signal will be sent to the USB bus.
This resets all of the USB bus logic, including the USB host
controller hardware and all the devices attached on the USB bus.
EFI_USB_HC_RESET_HOST_CONTROLLER
If this bit is set, the USB host controller hardware will be reset.
No reset signal will be sent to the USB bus.
EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG
If this bit is set, a global reset signal will be sent to the USB bus.
This resets all of the USB bus logic, including the USB host
controller hardware and all the devices attached on the USB bus.
If this is an EHCI controller and the debug port has configured, then
this is will still reset the host controller.
EFI_USB_HC_RESET_HOST_WITH_DEBUG
If this bit is set, the USB host controller hardware will be reset.
If this is an EHCI controller and the debug port has been configured,
then this will still reset the host controller.
Returns:
EFI_SUCCESS
The reset operation succeeded.
EFI_INVALID_PARAMETER
Attributes is not valid.
EFI_UNSUPPOURTED
The type of reset specified by Attributes is not currently supported by
the host controller hardware.
EFI_ACCESS_DENIED
Reset operation is rejected due to the debug port being configured and
active; only EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG or
EFI_USB_HC_RESET_HOST_WITH_DEBUG reset Atrributes can be used to
perform reset operation for this host controller.
EFI_DEVICE_ERROR
An error was encountered while attempting to perform
the reset operation.
--*/
;
EFI_STATUS
EFIAPI
UsbVirtualHcGetState (
IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
OUT EFI_USB_HC_STATE *State
)
/*++
Routine Description:
Virtual interface to retrieves current state of the USB host controller
for both Hc2 and Hc protocol.
Arguments:
UsbBusDev - A pointer to bus controller of the device.
State - A pointer to the EFI_USB_HC_STATE data structure that
indicates current state of the USB host controller.
Type EFI_USB_HC_STATE is defined below.
typedef enum {
EfiUsbHcStateHalt,
EfiUsbHcStateOperational,
EfiUsbHcStateSuspend,
EfiUsbHcStateMaximum
} EFI_USB_HC_STATE;
Returns:
EFI_SUCCESS
The state information of the host controller was returned in State.
EFI_INVALID_PARAMETER
State is NULL.
EFI_DEVICE_ERROR
An error was encountered while attempting to retrieve the
host controller's current state.
--*/
;
EFI_STATUS
EFIAPI
UsbVirtualHcSetState (
IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
IN EFI_USB_HC_STATE State
)
/*++
Routine Description:
Virtual interface to sets the USB host controller to a specific state
for both Hc2 and Hc protocol.
Arguments:
UsbBusDev - A pointer to bus controller of the device.
State - Indicates the state of the host controller that will be set.
Returns:
EFI_SUCCESS
The USB host controller was successfully placed in the state
specified by State.
EFI_INVALID_PARAMETER
State is invalid.
EFI_DEVICE_ERROR
Failed to set the state specified by State due to device error.
--*/
;
EFI_STATUS
EFIAPI
UsbVirtualHcGetRootHubPortStatus (
IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
IN UINT8 PortNumber,
OUT EFI_USB_PORT_STATUS *PortStatus
)
/*++
Routine Description:
Virtual interface to retrieves the current status of a USB root hub port
both for Hc2 and Hc protocol.
Arguments:
UsbBusDev - A pointer to bus controller of the device.
PortNumber - Specifies the root hub port from which the status
is to be retrieved. This value is zero-based. For example,
if a root hub has two ports, then the first port is numbered 0,
and the second port is numbered 1.
PortStatus - A pointer to the current port status bits and
port status change bits.
Returns:
EFI_SUCCESS The status of the USB root hub port specified by PortNumber
was returned in PortStatus.
EFI_INVALID_PARAMETER PortNumber is invalid.
EFI_DEVICE_ERROR Can't read register
--*/
;
EFI_STATUS
EFIAPI
UsbVirtualHcSetRootHubPortFeature (
IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
IN UINT8 PortNumber,
IN EFI_USB_PORT_FEATURE PortFeature
)
/*++
Routine Description:
Virual interface to sets a feature for the specified root hub port
for both Hc2 and Hc protocol.
Arguments:
UsbBusDev - A pointer to bus controller of the device.
PortNumber - Specifies the root hub port whose feature
is requested to be set.
PortFeature - Indicates the feature selector associated
with the feature set request.
Returns:
EFI_SUCCESS
The feature specified by PortFeature was set for the
USB root hub port specified by PortNumber.
EFI_INVALID_PARAMETER
PortNumber is invalid or PortFeature is invalid.
EFI_DEVICE_ERROR
Can't read register
--*/
;
EFI_STATUS
EFIAPI
UsbVirtualHcClearRootHubPortFeature (
IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
IN UINT8 PortNumber,
IN EFI_USB_PORT_FEATURE PortFeature
)
/*++
Routine Description:
Virtual interface to clears a feature for the specified root hub port
for both Hc2 and Hc protocol.
Arguments:
UsbBusDev - A pointer to bus controller of the device.
PortNumber - Specifies the root hub port whose feature
is requested to be cleared.
PortFeature - Indicates the feature selector associated with the
feature clear request.
Returns:
EFI_SUCCESS
The feature specified by PortFeature was cleared for the
USB root hub port specified by PortNumber.
EFI_INVALID_PARAMETER
PortNumber is invalid or PortFeature is invalid.
EFI_DEVICE_ERROR
Can't read register
--*/
;
EFI_STATUS
EFIAPI
UsbVirtualHcControlTransfer (
IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
IN UINT8 DeviceAddress,
IN UINT8 DeviceSpeed,
IN UINTN MaximumPacketLength,
IN EFI_USB_DEVICE_REQUEST *Request,
IN EFI_USB_DATA_DIRECTION TransferDirection,
IN OUT VOID *Data,
IN OUT UINTN *DataLength,
IN UINTN TimeOut,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
OUT UINT32 *TransferResult
)
/*++
Routine Description:
Virtual interface to submits control transfer to a target USB device
for both Hc2 and Hc protocol.
Arguments:
UsbBusDev - A pointer to bus controller of the device.
DeviceAddress - Represents the address of the target device on the USB,
which is assigned during USB enumeration.
DeviceSpeed - Indicates target device speed.
MaximumPacketLength - Indicates the maximum packet size that the
default control transfer endpoint is capable of
sending or receiving.
Request - A pointer to the USB device request that will be sent
to the USB device.
TransferDirection - Specifies the data direction for the transfer.
There are three values available, DataIn, DataOut
and NoData.
Data - A pointer to the buffer of data that will be transmitted
to USB device or received from USB device.
DataLength - Indicates the size, in bytes, of the data buffer
specified by Data.
TimeOut - Indicates the maximum time, in microseconds,
which the transfer is allowed to complete.
Translator - A pointr to the transaction translator data.
TransferResult - A pointer to the detailed result information generated
by this control transfer.
Returns:
EFI_SUCCESS
The control transfer was completed successfully.
EFI_OUT_OF_RESOURCES
The control transfer could not be completed due to a lack of resources.
EFI_INVALID_PARAMETER
Some parameters are invalid.
EFI_TIMEOUT
The control transfer failed due to timeout.
EFI_DEVICE_ERROR
The control transfer failed due to host controller or device error.
Caller should check TranferResult for detailed error information.
--*/
;
EFI_STATUS
EFIAPI
UsbVirtualHcBulkTransfer (
IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
IN UINT8 DeviceAddress,
IN UINT8 EndPointAddress,
IN UINT8 DeviceSpeed,
IN UINTN MaximumPacketLength,
IN UINT8 DataBuffersNumber,
IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
IN OUT UINTN *DataLength,
IN OUT UINT8 *DataToggle,
IN UINTN TimeOut,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
OUT UINT32 *TransferResult
)
/*++
Routine Description:
Virtual interface to submits bulk transfer to a bulk endpoint of a USB device
both for Hc2 and Hc protocol.
Arguments:
UsbBusDev - A pointer to bus controller of the device.
DeviceAddress - Represents the address of the target device on the USB,
which is assigned during USB enumeration.
EndPointAddress - The combination of an endpoint number and an
endpoint direction of the target USB device.
Each endpoint address supports data transfer in
one direction except the control endpoint
(whose default endpoint address is 0).
It is the caller's responsibility to make sure that
the EndPointAddress represents a bulk endpoint.
DeviceSpeed - Indicates device speed. The supported values are EFI_USB_SPEED_FULL
and EFI_USB_SPEED_HIGH.
MaximumPacketLength - Indicates the maximum packet size the target endpoint
is capable of sending or receiving.
DataBuffersNumber - Number of data buffers prepared for the transfer.
Data - Array of pointers to the buffers of data that will be transmitted
to USB device or received from USB device.
DataLength - When input, indicates the size, in bytes, of the data buffer
specified by Data. When output, indicates the actually
transferred data size.
DataToggle - A pointer to the data toggle value. On input, it indicates
the initial data toggle value the bulk transfer should adopt;
on output, it is updated to indicate the data toggle value
of the subsequent bulk transfer.
Translator - A pointr to the transaction translator data.
TimeOut - Indicates the maximum time, in microseconds, which the
transfer is allowed to complete.
TransferResult - A pointer to the detailed result information of the
bulk transfer.
Returns:
EFI_SUCCESS
The bulk transfer was completed successfully.
EFI_OUT_OF_RESOURCES
The bulk transfer could not be submitted due to lack of resource.
EFI_INVALID_PARAMETER
Some parameters are invalid.
EFI_TIMEOUT
The bulk transfer failed due to timeout.
EFI_DEVICE_ERROR
The bulk transfer failed due to host controller or device error.
Caller should check TranferResult for detailed error information.
--*/
;
EFI_STATUS
EFIAPI
UsbVirtualHcAsyncInterruptTransfer (
IN USB_BUS_CONTROLLER_DEVICE * UsbBusDev,
IN UINT8 DeviceAddress,
IN UINT8 EndPointAddress,
IN UINT8 DeviceSpeed,
IN UINTN MaximumPacketLength,
IN BOOLEAN IsNewTransfer,
IN OUT UINT8 *DataToggle,
IN UINTN PollingInterval,
IN UINTN DataLength,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR * Translator,
IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,
IN VOID *Context OPTIONAL
)
/*++
Routine Description:
Virtual interface to submits an asynchronous interrupt transfer to an
interrupt endpoint of a USB device for both Hc2 and Hc protocol.
Arguments:
UsbBusDev - A pointer to bus controller of the device.
DeviceAddress - Represents the address of the target device on the USB,
which is assigned during USB enumeration.
EndPointAddress - The combination of an endpoint number and an endpoint
direction of the target USB device. Each endpoint address
supports data transfer in one direction except the
control endpoint (whose default endpoint address is 0).
It is the caller's responsibility to make sure that
the EndPointAddress represents an interrupt endpoint.
DeviceSpeed - Indicates device speed.
MaximumPacketLength - Indicates the maximum packet size the target endpoint
is capable of sending or receiving.
IsNewTransfer - If TRUE, an asynchronous interrupt pipe is built between
the host and the target interrupt endpoint.
If FALSE, the specified asynchronous interrupt pipe
is canceled.
DataToggle - A pointer to the data toggle value. On input, it is valid
when IsNewTransfer is TRUE, and it indicates the initial
data toggle value the asynchronous interrupt transfer
should adopt.
On output, it is valid when IsNewTransfer is FALSE,
and it is updated to indicate the data toggle value of
the subsequent asynchronous interrupt transfer.
PollingInterval - Indicates the interval, in milliseconds, that the
asynchronous interrupt transfer is polled.
This parameter is required when IsNewTransfer is TRUE.
DataLength - Indicates the length of data to be received at the
rate specified by PollingInterval from the target
asynchronous interrupt endpoint. This parameter
is only required when IsNewTransfer is TRUE.
Translator - A pointr to the transaction translator data.
CallBackFunction - The Callback function.This function is called at the
rate specified by PollingInterval.This parameter is
only required when IsNewTransfer is TRUE.
Context - The context that is passed to the CallBackFunction.
- This is an optional parameter and may be NULL.
Returns:
EFI_SUCCESS
The asynchronous interrupt transfer request has been successfully
submitted or canceled.
EFI_INVALID_PARAMETER
Some parameters are invalid.
EFI_OUT_OF_RESOURCES
The request could not be completed due to a lack of resources.
EFI_DEVICE_ERROR
Can't read register
--*/
;
EFI_STATUS
EFIAPI
UsbVirtualHcSyncInterruptTransfer (
IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
IN UINT8 DeviceAddress,
IN UINT8 EndPointAddress,
IN UINT8 DeviceSpeed,
IN UINTN MaximumPacketLength,
IN OUT VOID *Data,
IN OUT UINTN *DataLength,
IN OUT UINT8 *DataToggle,
IN UINTN TimeOut,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
OUT UINT32 *TransferResult
)
/*++
Routine Description:
Vitual interface to submits synchronous interrupt transfer to an interrupt endpoint
of a USB device for both Hc2 and Hc protocol.
Arguments:
UsbBusDev - A pointer to bus controller of the device.
DeviceAddress - Represents the address of the target device on the USB,
which is assigned during USB enumeration.
EndPointAddress - The combination of an endpoint number and an endpoint
direction of the target USB device. Each endpoint
address supports data transfer in one direction
except the control endpoint (whose default
endpoint address is 0). It is the caller's responsibility
to make sure that the EndPointAddress represents
an interrupt endpoint.
DeviceSpeed - Indicates device speed.
MaximumPacketLength - Indicates the maximum packet size the target endpoint
is capable of sending or receiving.
Data - A pointer to the buffer of data that will be transmitted
to USB device or received from USB device.
DataLength - On input, the size, in bytes, of the data buffer specified
by Data. On output, the number of bytes transferred.
DataToggle - A pointer to the data toggle value. On input, it indicates
the initial data toggle value the synchronous interrupt
transfer should adopt;
on output, it is updated to indicate the data toggle value
of the subsequent synchronous interrupt transfer.
TimeOut - Indicates the maximum time, in microseconds, which the
transfer is allowed to complete.
Translator - A pointr to the transaction translator data.
TransferResult - A pointer to the detailed result information from
the synchronous interrupt transfer.
Returns:
EFI_SUCCESS
The synchronous interrupt transfer was completed successfully.
EFI_OUT_OF_RESOURCES
The synchronous interrupt transfer could not be submitted due
to lack of resource.
EFI_INVALID_PARAMETER
Some parameters are invalid.
EFI_TIMEOUT
The synchronous interrupt transfer failed due to timeout.
EFI_DEVICE_ERROR
The synchronous interrupt transfer failed due to host controller
or device error. Caller should check TranferResult for detailed
error information.
--*/
;
EFI_STATUS
EFIAPI
UsbVirtualHcIsochronousTransfer (
IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
IN UINT8 DeviceAddress,
IN UINT8 EndPointAddress,
IN UINT8 DeviceSpeed,
IN UINTN MaximumPacketLength,
IN UINT8 DataBuffersNumber,
IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
IN UINTN DataLength,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
OUT UINT32 *TransferResult
)
/*++
Routine Description:
Virtual interface to submits isochronous transfer to a target USB device
for both Hc2 and Hc protocol.
Arguments:
UsbBusDev - A pointer to bus controller of the device.
DeviceAddress - Represents the address of the target device on the USB,
which is assigned during USB enumeration.
EndPointAddress - End point address
DeviceSpeed - Indicates device speed.
MaximumPacketLength - Indicates the maximum packet size that the
default control transfer endpoint is capable of
sending or receiving.
DataBuffersNumber - Number of data buffers prepared for the transfer.
Data - Array of pointers to the buffers of data that will be
transmitted to USB device or received from USB device.
DataLength - Indicates the size, in bytes, of the data buffer
specified by Data.
Translator - A pointr to the transaction translator data.
TransferResult - A pointer to the detailed result information generated
by this control transfer.
Returns:
EFI_UNSUPPORTED
--*/
;
EFI_STATUS
EFIAPI
UsbVirtualHcAsyncIsochronousTransfer (
IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
IN UINT8 DeviceAddress,
IN UINT8 EndPointAddress,
IN UINT8 DeviceSpeed,
IN UINTN MaximumPacketLength,
IN UINT8 DataBuffersNumber,
IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
IN UINTN DataLength,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
IN VOID *Context
)
/*++
Routine Description:
Vitual interface to submits Async isochronous transfer to a target USB device
for both Hc2 and Hc protocol.
Arguments:
UsbBusDev - A pointer to bus controller of the device.
DeviceAddress - Represents the address of the target device on the USB,
which is assigned during USB enumeration.
EndPointAddress - End point address
DeviceSpeed - Indicates device speed.
MaximumPacketLength - Indicates the maximum packet size that the
default control transfer endpoint is capable of
sending or receiving.
DataBuffersNumber - Number of data buffers prepared for the transfer.
Data - Array of pointers to the buffers of data that will be transmitted
to USB device or received from USB device.
DataLength - Indicates the size, in bytes, of the data buffer
specified by Data.
Translator - A pointr to the transaction translator data.
IsochronousCallBack - When the transfer complete, the call back function will be called
Context - Pass to the call back function as parameter
Returns:
EFI_UNSUPPORTED
--*/
;
#endif #endif

View File

@ -233,9 +233,9 @@ UsbControlTransfer (
--*/ --*/
{ {
USB_IO_CONTROLLER_DEVICE *UsbIoController; USB_IO_CONTROLLER_DEVICE *UsbIoController;
EFI_USB_HC_PROTOCOL *UsbHCInterface;
EFI_STATUS RetStatus; EFI_STATUS RetStatus;
USB_IO_DEVICE *UsbIoDevice; USB_IO_DEVICE *UsbIoDev;
UINT8 MaxPacketLength; UINT8 MaxPacketLength;
UINT32 TransferResult; UINT32 TransferResult;
BOOLEAN Disconnected; BOOLEAN Disconnected;
@ -251,9 +251,9 @@ UsbControlTransfer (
// to perform other parameters checking // to perform other parameters checking
// //
UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This); UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
UsbIoDevice = UsbIoController->UsbDevice; UsbIoDev = UsbIoController->UsbDevice;
UsbHCInterface = UsbIoDevice->BusController->UsbHCInterface;
MaxPacketLength = UsbIoDevice->DeviceDescriptor.MaxPacketSize0; MaxPacketLength = UsbIoDev->DeviceDescriptor.MaxPacketSize0;
if (Request->Request == USB_DEV_CLEAR_FEATURE && if (Request->Request == USB_DEV_CLEAR_FEATURE &&
@ -268,24 +268,23 @@ UsbControlTransfer (
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;
} }
} }
// //
// using HostController's ControlTransfer to complete the request // using HostController's ControlTransfer to complete the request
// //
RetStatus = UsbHCInterface->ControlTransfer ( RetStatus = UsbVirtualHcControlTransfer (
UsbHCInterface, UsbIoDev->BusController,
UsbIoDevice->DeviceAddress, UsbIoDev->DeviceAddress,
UsbIoDevice->IsSlowDevice, UsbIoDev->DeviceSpeed,
MaxPacketLength, MaxPacketLength,
Request, Request,
Direction, Direction,
Data, Data,
&DataLength, &DataLength,
(UINTN) Timeout, (UINTN) Timeout,
UsbIoDev->Translator,
&TransferResult &TransferResult
); );
*Status = TransferResult; *Status = TransferResult;
if (Request->Request == USB_DEV_CLEAR_FEATURE && if (Request->Request == USB_DEV_CLEAR_FEATURE &&
@ -346,18 +345,19 @@ UsbBulkTransfer (
--*/ --*/
{ {
USB_IO_DEVICE *UsbIoDev; USB_IO_DEVICE *UsbIoDev;
UINT8 MaxPacketLength; UINTN MaxPacketLength;
UINT8 DataToggle; UINT8 DataToggle;
UINT8 OldToggle; UINT8 OldToggle;
EFI_STATUS RetStatus; EFI_STATUS RetStatus;
EFI_USB_HC_PROTOCOL *UsbHCInterface;
USB_IO_CONTROLLER_DEVICE *UsbIoController; USB_IO_CONTROLLER_DEVICE *UsbIoController;
ENDPOINT_DESC_LIST_ENTRY *EndPointListEntry; ENDPOINT_DESC_LIST_ENTRY *EndPointListEntry;
UINT32 TransferResult; UINT32 TransferResult;
UINT8 DataBuffersNumber;
DataBuffersNumber = 1;
UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This); UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
UsbIoDev = UsbIoController->UsbDevice; UsbIoDev = UsbIoController->UsbDevice;
UsbHCInterface = UsbIoDev->BusController->UsbHCInterface;
// //
// Parameters Checking // Parameters Checking
@ -408,15 +408,18 @@ UsbBulkTransfer (
// //
// using HostController's BulkTransfer to complete the request // using HostController's BulkTransfer to complete the request
// //
RetStatus = UsbHCInterface->BulkTransfer ( RetStatus = UsbVirtualHcBulkTransfer (
UsbHCInterface, UsbIoDev->BusController,
UsbIoDev->DeviceAddress, UsbIoDev->DeviceAddress,
DeviceEndpoint, DeviceEndpoint,
UsbIoDev->DeviceSpeed,
MaxPacketLength, MaxPacketLength,
Data, DataBuffersNumber,
&Data,
DataLength, DataLength,
&DataToggle, &DataToggle,
Timeout, Timeout,
UsbIoDev->Translator,
&TransferResult &TransferResult
); );
@ -475,11 +478,10 @@ UsbSyncInterruptTransfer (
--*/ --*/
{ {
USB_IO_DEVICE *UsbIoDev; USB_IO_DEVICE *UsbIoDev;
UINT8 MaxPacketLength; UINTN MaxPacketLength;
UINT8 DataToggle; UINT8 DataToggle;
UINT8 OldToggle; UINT8 OldToggle;
EFI_STATUS RetStatus; EFI_STATUS RetStatus;
EFI_USB_HC_PROTOCOL *UsbHCInterface;
USB_IO_CONTROLLER_DEVICE *UsbIoController; USB_IO_CONTROLLER_DEVICE *UsbIoController;
ENDPOINT_DESC_LIST_ENTRY *EndPointListEntry; ENDPOINT_DESC_LIST_ENTRY *EndPointListEntry;
@ -517,8 +519,6 @@ UsbSyncInterruptTransfer (
// //
UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This); UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
UsbIoDev = UsbIoController->UsbDevice; UsbIoDev = UsbIoController->UsbDevice;
UsbHCInterface = UsbIoDev->BusController->UsbHCInterface;
GetDeviceEndPointMaxPacketLength ( GetDeviceEndPointMaxPacketLength (
This, This,
DeviceEndpoint, DeviceEndpoint,
@ -535,16 +535,17 @@ UsbSyncInterruptTransfer (
// //
// using HostController's SyncInterruptTransfer to complete the request // using HostController's SyncInterruptTransfer to complete the request
// //
RetStatus = UsbHCInterface->SyncInterruptTransfer ( RetStatus = UsbVirtualHcSyncInterruptTransfer (
UsbHCInterface, UsbIoDev->BusController,
UsbIoDev->DeviceAddress, UsbIoDev->DeviceAddress,
DeviceEndpoint, DeviceEndpoint,
UsbIoDev->IsSlowDevice, UsbIoDev->DeviceSpeed,
MaxPacketLength, MaxPacketLength,
Data, Data,
DataLength, DataLength,
&DataToggle, &DataToggle,
Timeout, Timeout,
UsbIoDev->Translator,
Status Status
); );
@ -590,7 +591,7 @@ UsbAsyncInterruptTransfer (
the transfer is to be executed. the transfer is to be executed.
DataLength - Specifies the length, in bytes, of the data to be DataLength - Specifies the length, in bytes, of the data to be
received from the USB device. received from the USB device.
InterruptCallback - The Callback function. This function is called if InterruptCallBack - The Callback function. This function is called if
the asynchronous interrupt transfer is completed. the asynchronous interrupt transfer is completed.
Context - Passed to InterruptCallback Context - Passed to InterruptCallback
Returns: Returns:
@ -601,9 +602,8 @@ UsbAsyncInterruptTransfer (
--*/ --*/
{ {
USB_IO_DEVICE *UsbIoDev; USB_IO_DEVICE *UsbIoDev;
UINT8 MaxPacketLength; UINTN MaxPacketLength;
UINT8 DataToggle; UINT8 DataToggle;
EFI_USB_HC_PROTOCOL *UsbHCInterface;
EFI_STATUS RetStatus; EFI_STATUS RetStatus;
USB_IO_CONTROLLER_DEVICE *UsbIoController; USB_IO_CONTROLLER_DEVICE *UsbIoController;
ENDPOINT_DESC_LIST_ENTRY *EndpointListEntry; ENDPOINT_DESC_LIST_ENTRY *EndpointListEntry;
@ -634,22 +634,22 @@ UsbAsyncInterruptTransfer (
UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This); UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
UsbIoDev = UsbIoController->UsbDevice; UsbIoDev = UsbIoController->UsbDevice;
UsbHCInterface = UsbIoDev->BusController->UsbHCInterface;
if (!IsNewTransfer) { if (!IsNewTransfer) {
// //
// Delete this transfer // Delete this transfer
// //
UsbHCInterface->AsyncInterruptTransfer ( UsbVirtualHcAsyncInterruptTransfer (
UsbHCInterface, UsbIoDev->BusController,
UsbIoDev->DeviceAddress, UsbIoDev->DeviceAddress,
DeviceEndpoint, DeviceEndpoint,
UsbIoDev->IsSlowDevice, UsbIoDev->DeviceSpeed,
0, 0,
FALSE, FALSE,
&DataToggle, &DataToggle,
PollingInterval, PollingInterval,
DataLength, DataLength,
UsbIoDev->Translator,
NULL, NULL,
NULL NULL
); );
@ -678,16 +678,17 @@ UsbAsyncInterruptTransfer (
&DataToggle &DataToggle
); );
RetStatus = UsbHCInterface->AsyncInterruptTransfer ( RetStatus = UsbVirtualHcAsyncInterruptTransfer (
UsbHCInterface, UsbIoDev->BusController,
UsbIoDev->DeviceAddress, UsbIoDev->DeviceAddress,
DeviceEndpoint, DeviceEndpoint,
UsbIoDev->IsSlowDevice, UsbIoDev->DeviceSpeed,
MaxPacketLength, MaxPacketLength,
TRUE, TRUE,
&DataToggle, &DataToggle,
PollingInterval, PollingInterval,
DataLength, DataLength,
UsbIoDev->Translator,
InterruptCallBack, InterruptCallBack,
Context Context
); );
@ -1070,6 +1071,7 @@ UsbGetStringDescriptor (
EFI_SUCCESS EFI_SUCCESS
EFI_NOT_FOUND EFI_NOT_FOUND
EFI_OUT_OF_RESOURCES EFI_OUT_OF_RESOURCES
EFI_UNSUPPORTED
--*/ --*/
{ {

View File

@ -35,10 +35,10 @@ IsPortConnect (
Tell if there is a device connected to that port according to Tell if there is a device connected to that port according to
the Port Status. the Port Status.
Parameters: Arguments:
PortStatus - The status value of that port. PortStatus - The status value of that port.
Return Value: Returns:
TRUE TRUE
FALSE FALSE
@ -280,7 +280,6 @@ IsPortResetChange (
} }
} }
BOOLEAN BOOLEAN
IsPortSuspendChange ( IsPortSuspendChange (
IN UINT16 PortChangeStatus IN UINT16 PortChangeStatus
@ -309,7 +308,6 @@ IsPortSuspendChange (
} }
} }
INTERFACE_DESC_LIST_ENTRY * INTERFACE_DESC_LIST_ENTRY *
FindInterfaceListEntry ( FindInterfaceListEntry (
IN EFI_USB_IO_PROTOCOL *This IN EFI_USB_IO_PROTOCOL *This
@ -368,7 +366,7 @@ FindEndPointListEntry (
Arguments: Arguments:
This - EFI_USB_IO_PROTOCOL This - EFI_USB_IO_PROTOCOL
EndpointAddr - Endpoint address. EndPointAddress - Endpoint address.
Returns: Returns:
ENDPOINT_DESC_LIST_ENTRY pointer ENDPOINT_DESC_LIST_ENTRY pointer
@ -471,7 +469,7 @@ VOID
GetDeviceEndPointMaxPacketLength ( GetDeviceEndPointMaxPacketLength (
IN EFI_USB_IO_PROTOCOL *UsbIo, IN EFI_USB_IO_PROTOCOL *UsbIo,
IN UINT8 EndpointAddr, IN UINT8 EndpointAddr,
OUT UINT8 *MaxPacketLength OUT UINTN *MaxPacketLength
) )
/*++ /*++
@ -498,7 +496,7 @@ GetDeviceEndPointMaxPacketLength (
return ; return ;
} }
*MaxPacketLength = (UINT8) (EndpointListEntry->EndpointDescriptor.MaxPacketSize); *MaxPacketLength = (UINTN) (EndpointListEntry->EndpointDescriptor.MaxPacketSize);
return ; return ;
} }

View File

@ -394,6 +394,7 @@
<Filename>Bus/Pci/IdeBus/Dxe/idebus.msa</Filename> <Filename>Bus/Pci/IdeBus/Dxe/idebus.msa</Filename>
<Filename>Bus/Pci/PciBus/Dxe/PciBus.msa</Filename> <Filename>Bus/Pci/PciBus/Dxe/PciBus.msa</Filename>
<Filename>Bus/Pci/Uhci/Dxe/Uhci.msa</Filename> <Filename>Bus/Pci/Uhci/Dxe/Uhci.msa</Filename>
<Filename>Bus/Pci/Ehci/Dxe/Ehci.msa</Filename>
<Filename>Bus/Pci/Undi/RuntimeDxe/Undi.msa</Filename> <Filename>Bus/Pci/Undi/RuntimeDxe/Undi.msa</Filename>
<Filename>Bus/Scsi/ScsiBus/Dxe/ScsiBus.msa</Filename> <Filename>Bus/Scsi/ScsiBus/Dxe/ScsiBus.msa</Filename>
<Filename>Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.msa</Filename> <Filename>Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.msa</Filename>
@ -440,6 +441,7 @@
<Filename>Universal/Console/Terminal/Dxe/Terminal.msa</Filename> <Filename>Universal/Console/Terminal/Dxe/Terminal.msa</Filename>
<Filename>Universal/DataHub/DataHub/Dxe/DataHub.msa</Filename> <Filename>Universal/DataHub/DataHub/Dxe/DataHub.msa</Filename>
<Filename>Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.msa</Filename> <Filename>Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.msa</Filename>
<Filename>Universal/DevicePath/Dxe/DevicePath.msa</Filename>
<Filename>Universal/Debugger/Debugport/Dxe/DebugPort.msa</Filename> <Filename>Universal/Debugger/Debugport/Dxe/DebugPort.msa</Filename>
<Filename>Universal/DebugSupport/Dxe/DebugSupport.msa</Filename> <Filename>Universal/DebugSupport/Dxe/DebugSupport.msa</Filename>
<Filename>Universal/Disk/DiskIo/Dxe/DiskIo.msa</Filename> <Filename>Universal/Disk/DiskIo/Dxe/DiskIo.msa</Filename>

View File

@ -0,0 +1,107 @@
/*++
Copyright (c) 2006, 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:
DevicePathDriver.c
Abstract:
Device Path Driver to produce DevPathUtilities Protocol, DevPathFromText Protocol
and DevPathToText Protocol.
--*/
#include <Uefi/UefiSpec.h>
#include <Protocol/DevicePath.h>
#include "DevicePath.h"
DEVICE_PATH_DRIVER_PRIVATE_DATA mPrivateData;
EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid = DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL;
EFI_GUID mEfiDevicePathMessagingSASGuid = DEVICE_PATH_MESSAGING_SAS;
STATIC EFI_DEVICE_PATH_UTILITIES_PROTOCOL mDevicePathUtilitiesProtocol = {
GetDevicePathSize,
DuplicateDevicePath,
AppendDevicePath,
AppendDeviceNode,
AppendDevicePathInstance,
GetNextDevicePathInstance,
IsDevicePathMultiInstance,
CreateDeviceNode
};
STATIC EFI_DEVICE_PATH_TO_TEXT_PROTOCOL mDevicePathToTextProtocol = {
ConvertDeviceNodeToText,
ConvertDevicePathToText
};
STATIC EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePathFromTextProtocol = {
ConvertTextToDeviceNode,
ConvertTextToDevicePath
};
EFI_STATUS
EFIAPI
DevicePathEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
/*++
Routine Description:
Entry point for EFI drivers.
Arguments:
ImageHandle - EFI_HANDLE
SystemTable - EFI_SYSTEM_TABLE
Returns:
EFI_SUCCESS
others
--*/
{
EFI_STATUS Status;
mPrivateData.Signature = DEVICE_PATH_DRIVER_SIGNATURE;
mPrivateData.DevicePathUtilities.GetDevicePathSize = GetDevicePathSize;
mPrivateData.DevicePathUtilities.DuplicateDevicePath = DuplicateDevicePath;
mPrivateData.DevicePathUtilities.AppendDevicePath = AppendDevicePath;
mPrivateData.DevicePathUtilities.AppendDeviceNode = AppendDeviceNode;
mPrivateData.DevicePathUtilities.AppendDevicePathInstance = AppendDevicePathInstance;
mPrivateData.DevicePathUtilities.GetNextDevicePathInstance = GetNextDevicePathInstance;
mPrivateData.DevicePathUtilities.IsDevicePathMultiInstance = IsDevicePathMultiInstance;
mPrivateData.DevicePathUtilities.CreateDeviceNode = CreateDeviceNode;
mPrivateData.DevicePathToText.ConvertDeviceNodeToText = ConvertDeviceNodeToText;
mPrivateData.DevicePathToText.ConvertDevicePathToText = ConvertDevicePathToText;
mPrivateData.DevicePathFromText.ConvertTextToDeviceNode = ConvertTextToDeviceNode;
mPrivateData.DevicePathFromText.ConvertTextToDevicePath = ConvertTextToDevicePath;
mPrivateData.Handle = NULL;
Status = gBS->InstallMultipleProtocolInterfaces (
&mPrivateData.Handle,
&gEfiDevicePathUtilitiesProtocolGuid,
&mPrivateData.DevicePathUtilities,
&gEfiDevicePathToTextProtocolGuid,
&mPrivateData.DevicePathToText,
&gEfiDevicePathFromTextProtocolGuid,
&mPrivateData.DevicePathFromText,
NULL
);
return Status;
}

View File

@ -0,0 +1,422 @@
/*++
Copyright (c) 2006, 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:
DevicePathDriver.h
Abstract:
Definition for Device Path Utilities driver
--*/
#ifndef _DEVICE_PATH_DRIVER_H
#define _DEVICE_PATH_DRIVER_H
extern EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid;
extern EFI_GUID mEfiDevicePathMessagingSASGuid;
#define DEVICE_PATH_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('D', 'P', 'D', 'V')
typedef struct {
UINT32 Signature;
EFI_HANDLE Handle;
//
// Produced protocols
//
EFI_DEVICE_PATH_UTILITIES_PROTOCOL DevicePathUtilities;
EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL DevicePathFromText;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL DevicePathToText;
} DEVICE_PATH_DRIVER_PRIVATE_DATA;
#define MAX_CHAR 480
#define MIN_ALIGNMENT_SIZE sizeof(UINTN)
#define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)
#define IS_COMMA(a) ((a) == L',')
#define IS_HYPHEN(a) ((a) == L'-')
#define IS_DOT(a) ((a) == L'.')
#define IS_LEFT_PARENTH(a) ((a) == L'(')
#define IS_RIGHT_PARENTH(a) ((a) == L')')
#define IS_SLASH(a) ((a) == L'/')
#define IS_NULL(a) ((a) == L'\0')
#define DEVICE_NODE_END 1
#define DEVICE_PATH_INSTANCE_END 2
#define DEVICE_PATH_END 3
#define SetDevicePathInstanceEndNode(a) { \
(a)->Type = END_DEVICE_PATH_TYPE; \
(a)->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE; \
(a)->Length[0] = sizeof (EFI_DEVICE_PATH_PROTOCOL); \
(a)->Length[1] = 0; \
}
//
// Private Data structure
//
typedef struct {
CHAR16 *Str;
UINTN Len;
UINTN MaxLen;
} POOL_PRINT;
typedef struct {
UINT8 Type;
UINT8 SubType;
VOID (*Function) (POOL_PRINT *, VOID *, BOOLEAN, BOOLEAN);
} DEVICE_PATH_TO_TEXT_TABLE;
typedef struct {
CHAR16 *DevicePathNodeText;
EFI_DEVICE_PATH_PROTOCOL * (*Function) (CHAR16 *);
} DEVICE_PATH_FROM_TEXT_TABLE;
typedef struct {
BOOLEAN ClassExist;
UINT8 Class;
BOOLEAN SubClassExist;
UINT8 SubClass;
} USB_CLASS_TEXT;
#define USB_CLASS_AUDIO 1
#define USB_CLASS_CDCCONTROL 2
#define USB_CLASS_HID 3
#define USB_CLASS_IMAGE 6
#define USB_CLASS_PRINTER 7
#define USB_CLASS_MASS_STORAGE 8
#define USB_CLASS_HUB 9
#define USB_CLASS_CDCDATA 10
#define USB_CLASS_SMART_CARD 11
#define USB_CLASS_VIDEO 14
#define USB_CLASS_DIAGNOSTIC 220
#define USB_CLASS_WIRELESS 224
#define USB_CLASS_RESERVE 254
#define USB_SUBCLASS_FW_UPDATE 1
#define USB_SUBCLASS_IRDA_BRIDGE 2
#define USB_SUBCLASS_TEST 3
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
UINT8 VendorDefinedData[1];
} VENDOR_DEFINED_HARDWARE_DEVICE_PATH;
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
UINT8 VendorDefinedData[1];
} VENDOR_DEFINED_MESSAGING_DEVICE_PATH;
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
UINT8 VendorDefinedData[1];
} VENDOR_DEFINED_MEDIA_DEVICE_PATH;
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 HID;
UINT32 UID;
UINT32 CID;
CHAR8 HidUidCidStr[3];
} ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR;
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT16 NetworkProtocol;
UINT16 LoginOption;
UINT16 Reserved;
UINT16 TargetPortalGroupTag;
UINT64 Lun;
CHAR16 iSCSITargetName[1];
} ISCSI_DEVICE_PATH_WITH_NAME;
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
UINT8 VendorDefinedData[1];
} VENDOR_DEVICE_PATH_WITH_DATA;
CHAR16 *
ConvertDeviceNodeToText (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,
IN BOOLEAN DisplayOnly,
IN BOOLEAN AllowShortcuts
)
/*++
Routine Description:
Convert a device node to its text representation.
Arguments:
DeviceNode - Points to the device node to be converted.
DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation
of the display node is used, where applicable. If DisplayOnly
is FALSE, then the longer text representation of the display node
is used.
AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text
representation for a device node can be used, where applicable.
Returns:
A pointer - a pointer to the allocated text representation of the device node.
NULL - if DeviceNode is NULL or there was insufficient memory.
--*/
;
CHAR16 *
ConvertDevicePathToText (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,
IN BOOLEAN DisplayOnly,
IN BOOLEAN AllowShortcuts
)
/*++
Routine Description:
Convert a device path to its text representation.
Arguments:
DeviceNode - Points to the device path to be converted.
DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation
of the display node is used, where applicable. If DisplayOnly
is FALSE, then the longer text representation of the display node
is used.
AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text
representation for a device node can be used, where applicable.
Returns:
A pointer - a pointer to the allocated text representation of the device path.
NULL - if DeviceNode is NULL or there was insufficient memory.
--*/
;
EFI_DEVICE_PATH_PROTOCOL *
ConvertTextToDeviceNode (
IN CONST CHAR16 *TextDeviceNode
)
/*++
Routine Description:
Convert text to the binary representation of a device node.
Arguments:
TextDeviceNode - TextDeviceNode points to the text representation of a device
node. Conversion starts with the first character and continues
until the first non-device node character.
Returns:
A pointer - Pointer to the EFI device node.
NULL - if TextDeviceNode is NULL or there was insufficient memory.
--*/
;
EFI_DEVICE_PATH_PROTOCOL *
ConvertTextToDevicePath (
IN CONST CHAR16 *TextDevicePath
)
/*++
Routine Description:
Convert text to the binary representation of a device path.
Arguments:
TextDevicePath - TextDevicePath points to the text representation of a device
path. Conversion starts with the first character and continues
until the first non-device node character.
Returns:
A pointer - Pointer to the allocated device path.
NULL - if TextDeviceNode is NULL or there was insufficient memory.
--*/
;
UINTN
GetDevicePathSize (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
/*++
Routine Description:
Returns the size of the device path, in bytes.
Arguments:
DevicePath - Points to the start of the EFI device path.
Returns:
Size - Size of the specified device path, in bytes, including the end-of-path tag.
--*/
;
EFI_DEVICE_PATH_PROTOCOL *
DuplicateDevicePath (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
/*++
Routine Description:
Create a duplicate of the specified path.
Arguments:
DevicePath - Points to the source EFI device path.
Returns:
Pointer - A pointer to the duplicate device path.
NULL - Insufficient memory.
--*/
;
EFI_DEVICE_PATH_PROTOCOL *
AppendDevicePath (
IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,
IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2
)
/*++
Routine Description:
Create a new path by appending the second device path to the first.
Arguments:
Src1 - Points to the first device path. If NULL, then it is ignored.
Src2 - Points to the second device path. If NULL, then it is ignored.
Returns:
Pointer - A pointer to the newly created device path.
NULL - Memory could not be allocated
or either DevicePath or DeviceNode is NULL.
--*/
;
EFI_DEVICE_PATH_PROTOCOL *
AppendDeviceNode (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode
)
/*++
Routine Description:
Creates a new path by appending the device node to the device path.
Arguments:
DevicePath - Points to the device path.
DeviceNode - Points to the device node.
Returns:
Pointer - A pointer to the allocated device node.
NULL - Memory could not be allocated
or either DevicePath or DeviceNode is NULL.
--*/
;
EFI_DEVICE_PATH_PROTOCOL *
AppendDevicePathInstance (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
)
/*++
Routine Description:
Creates a new path by appending the specified device path instance to the specified device path.
Arguments:
DevicePath - Points to the device path. If NULL, then ignored.
DevicePathInstance - Points to the device path instance.
Returns:
Pointer - A pointer to the newly created device path
NULL - Memory could not be allocated or DevicePathInstance is NULL.
--*/
;
EFI_DEVICE_PATH_PROTOCOL *
GetNextDevicePathInstance (
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,
OUT UINTN *DevicePathInstanceSize
)
/*++
Routine Description:
Creates a copy of the current device path instance and returns a pointer to the next device path instance.
Arguments:
DevicePathInstance - On input, this holds the pointer to the current device path
instance. On output, this holds the pointer to the next
device path instance or NULL if there are no more device
path instances in the device path.
DevicePathInstanceSize - On output, this holds the size of the device path instance,
in bytes or zero, if DevicePathInstance is zero.
Returns:
Pointer - A pointer to the copy of the current device path instance.
NULL - DevicePathInstace was NULL on entry or there was insufficient memory.
--*/
;
BOOLEAN
IsDevicePathMultiInstance (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
/*++
Routine Description:
Returns whether a device path is multi-instance.
Arguments:
DevicePath - Points to the device path. If NULL, then ignored.
Returns:
TRUE - The device path has more than one instance
FALSE - The device path is empty or contains only a single instance.
--*/
;
EFI_DEVICE_PATH_PROTOCOL *
CreateDeviceNode (
IN UINT8 NodeType,
IN UINT8 NodeSubType,
IN UINT16 NodeLength
)
/*++
Routine Description:
Creates a device node
Arguments:
NodeType - NodeType is the device node type (EFI_DEVICE_PATH.Type) for
the new device node.
NodeSubType - NodeSubType is the device node sub-type
EFI_DEVICE_PATH.SubType) for the new device node.
NodeLength - NodeLength is the length of the device node
(EFI_DEVICE_PATH.Length) for the new device node.
Returns:
Pointer - A pointer to the newly created device node.
NULL - NodeLength is less than
the size of the header or there was insufficient memory.
--*/
;
#endif

View File

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Copyright (c) 2006, 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.-->
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
<MsaHeader>
<ModuleName>DevicePath</ModuleName>
<ModuleType>DXE_DRIVER</ModuleType>
<GuidValue>9B680FCE-AD6B-4F3A-B60B-F59899003443</GuidValue>
<Version>1.0</Version>
<Abstract>Component description file for Device Path Driver.</Abstract>
<Description>This driver is for DevicePathUtilities, DevicePahtToText and DevicePathFromText</Description>
<Copyright>Copyright (c) 2006, Intel Corporation</Copyright>
<License>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.</License>
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
</MsaHeader>
<ModuleDefinitions>
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
<BinaryModule>false</BinaryModule>
<OutputFileBasename>DevicePath</OutputFileBasename>
</ModuleDefinitions>
<LibraryClassDefinitions>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DebugLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>PrintLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiDriverEntryPoint</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>BaseLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>BaseMemoryLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>MemoryAllocationLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiBootServicesTableLib</Keyword>
</LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>DevicePath.c</Filename>
<Filename>DevicePath.h</Filename>
<Filename>DevicePathFromText.c</Filename>
<Filename>DevicePathToText.c</Filename>
<Filename>DevicePathUtilities.c</Filename>
</SourceFiles>
<PackageDependencies>
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Package PackageGuid="B6EC423C-21D2-490D-85C6-DD5864EAA674"/>
</PackageDependencies>
<Protocols>
<Protocol Usage="ALWAYS_CONSUMED">
<ProtocolCName>gEfiDebugPortProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="ALWAYS_CONSUMED">
<ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="ALWAYS_PRODUCED">
<ProtocolCName>gEfiDevicePathUtilitiesProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="ALWAYS_PRODUCED">
<ProtocolCName>gEfiDevicePathFromTextProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="ALWAYS_PRODUCED">
<ProtocolCName>gEfiDevicePathToTextProtocolGuid</ProtocolCName>
</Protocol>
</Protocols>
<Guids>
<GuidCNames Usage="ALWAYS_CONSUMED">
<GuidCName>gEfiPcAnsiGuid</GuidCName>
</GuidCNames>
<GuidCNames Usage="ALWAYS_CONSUMED">
<GuidCName>gEfiVT100PlusGuid</GuidCName>
</GuidCNames>
<GuidCNames Usage="ALWAYS_CONSUMED">
<GuidCName>gEfiVT100Guid</GuidCName>
</GuidCNames>
<GuidCNames Usage="ALWAYS_CONSUMED">
<GuidCName>gEfiVTUTF8Guid</GuidCName>
</GuidCNames>
</Guids>
<Externs>
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
<Specification>EDK_RELEASE_VERSION 0x00090000</Specification>
<Extern>
<ModuleEntryPoint>DevicePathEntryPoint</ModuleEntryPoint>
</Extern>
</Externs>
</ModuleSurfaceArea>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,421 @@
/*++
Copyright (c) 2006, 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:
DevicePathUtilities.c
Abstract:
Implementation file for Device Path Utilities Protocol
--*/
#include <protocol/DevicePathUtilities.h>
#include <protocol/DevicePath.h>
#include "DevicePath.h"
UINTN
GetDevicePathSize (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
/*++
Routine Description:
Returns the size of the device path, in bytes.
Arguments:
DevicePath - Points to the start of the EFI device path.
Returns:
Size - Size of the specified device path, in bytes, including the end-of-path tag.
--*/
{
CONST EFI_DEVICE_PATH_PROTOCOL *Start;
if (DevicePath == NULL) {
return 0;
}
//
// Search for the end of the device path structure
//
Start = (EFI_DEVICE_PATH_PROTOCOL *) DevicePath;
while (!IsDevicePathEnd (DevicePath)) {
DevicePath = NextDevicePathNode (DevicePath);
}
//
// Compute the size and add back in the size of the end device path structure
//
return ((UINTN) DevicePath - (UINTN) Start) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
}
EFI_DEVICE_PATH_PROTOCOL *
DuplicateDevicePath (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
/*++
Routine Description:
Create a duplicate of the specified path.
Arguments:
DevicePath - Points to the source EFI device path.
Returns:
Pointer - A pointer to the duplicate device path.
NULL - Insufficient memory.
--*/
{
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
UINTN Size;
if (DevicePath == NULL) {
return NULL;
}
//
// Compute the size
//
Size = GetDevicePathSize (DevicePath);
if (Size == 0) {
return NULL;
}
//
// Allocate space for duplicate device path
//
NewDevicePath = AllocateCopyPool (Size, (VOID *) DevicePath);
return NewDevicePath;
}
EFI_DEVICE_PATH_PROTOCOL *
AppendDevicePath (
IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,
IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2
)
/*++
Routine Description:
Create a new path by appending the second device path to the first.
Arguments:
Src1 - Points to the first device path. If NULL, then it is ignored.
Src2 - Points to the second device path. If NULL, then it is ignored.
Returns:
Pointer - A pointer to the newly created device path.
NULL - Memory could not be allocated
or either DevicePath or DeviceNode is NULL.
--*/
{
UINTN Size;
UINTN Size1;
UINTN Size2;
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath;
//
// If there's only 1 path, just duplicate it
//
if (Src1 == NULL) {
ASSERT (!IsDevicePathUnpacked (Src2));
return DuplicateDevicePath (Src2);
}
if (Src2 == NULL) {
ASSERT (!IsDevicePathUnpacked (Src1));
return DuplicateDevicePath (Src1);
}
//
// Allocate space for the combined device path. It only has one end node of
// length EFI_DEVICE_PATH_PROTOCOL
//
Size1 = GetDevicePathSize (Src1);
Size2 = GetDevicePathSize (Src2);
Size = Size1 + Size2 - sizeof (EFI_DEVICE_PATH_PROTOCOL);
NewDevicePath = AllocateCopyPool (Size, (VOID *) Src1);
if (NewDevicePath != NULL) {
//
// Over write Src1 EndNode and do the copy
//
SecondDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath + (Size1 - sizeof (EFI_DEVICE_PATH_PROTOCOL)));
CopyMem (SecondDevicePath, (VOID *) Src2, Size2);
}
return NewDevicePath;
}
EFI_DEVICE_PATH_PROTOCOL *
AppendDeviceNode (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode
)
/*++
Routine Description:
Creates a new path by appending the device node to the device path.
Arguments:
DevicePath - Points to the device path.
DeviceNode - Points to the device node.
Returns:
Pointer - A pointer to the allocated device node.
NULL - Memory could not be allocated
or either DevicePath or DeviceNode is NULL.
--*/
{
EFI_DEVICE_PATH_PROTOCOL *Temp;
EFI_DEVICE_PATH_PROTOCOL *NextNode;
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
UINTN NodeLength;
if ((DevicePath == NULL) || (DeviceNode == NULL)) {
return NULL;
}
//
// Build a Node that has a terminator on it
//
NodeLength = DevicePathNodeLength (DeviceNode);
Temp = AllocateCopyPool (NodeLength + sizeof (EFI_DEVICE_PATH_PROTOCOL), (VOID *) DeviceNode);
if (Temp == NULL) {
return NULL;
}
//
// Add and end device path node to convert Node to device path
//
NextNode = NextDevicePathNode (Temp);
SetDevicePathEndNode (NextNode);
//
// Append device paths
//
NewDevicePath = AppendDevicePath (DevicePath, Temp);
gBS->FreePool (Temp);
return NewDevicePath;
}
EFI_DEVICE_PATH_PROTOCOL *
AppendDevicePathInstance (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
)
/*++
Routine Description:
Creates a new path by appending the specified device path instance to the specified device path.
Arguments:
DevicePath - Points to the device path. If NULL, then ignored.
DevicePathInstance - Points to the device path instance.
Returns:
Pointer - A pointer to the newly created device path
NULL - Memory could not be allocated or DevicePathInstance is NULL.
--*/
{
UINT8 *Ptr;
EFI_DEVICE_PATH_PROTOCOL *DevPath;
UINTN SrcSize;
UINTN InstanceSize;
if (DevicePathInstance == NULL) {
return NULL;
}
if (DevicePath == NULL) {
return DuplicateDevicePath (DevicePathInstance);
}
SrcSize = GetDevicePathSize (DevicePath);
InstanceSize = GetDevicePathSize (DevicePathInstance);
Ptr = AllocateCopyPool (SrcSize + InstanceSize, (VOID *) DevicePath);
if (Ptr != NULL) {
DevPath = (EFI_DEVICE_PATH_PROTOCOL *) (Ptr + (SrcSize - sizeof (EFI_DEVICE_PATH_PROTOCOL)));
//
// Convert the End to an End Instance, since we are
// appending another instacne after this one its a good
// idea.
//
DevPath->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;
DevPath = NextDevicePathNode (DevPath);
CopyMem (DevPath, (VOID *) DevicePathInstance, InstanceSize);
}
return (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
}
EFI_DEVICE_PATH_PROTOCOL *
GetNextDevicePathInstance (
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,
OUT UINTN *DevicePathInstanceSize
)
/*++
Routine Description:
Creates a copy of the current device path instance and returns a pointer to the next device path instance.
Arguments:
DevicePathInstance - On input, this holds the pointer to the current device path
instance. On output, this holds the pointer to the next
device path instance or NULL if there are no more device
path instances in the device path.
DevicePathInstanceSize - On output, this holds the size of the device path instance,
in bytes or zero, if DevicePathInstance is zero.
Returns:
Pointer - A pointer to the copy of the current device path instance.
NULL - DevicePathInstace was NULL on entry or there was insufficient memory.
--*/
{
EFI_DEVICE_PATH_PROTOCOL *DevPath;
EFI_DEVICE_PATH_PROTOCOL *ReturnValue;
UINT8 Temp;
if (*DevicePathInstance == NULL) {
if (DevicePathInstanceSize != NULL) {
*DevicePathInstanceSize = 0;
}
return NULL;
}
//
// Find the end of the device path instance
//
DevPath = *DevicePathInstance;
while (!IsDevicePathEndType (DevPath)) {
DevPath = NextDevicePathNode (DevPath);
}
//
// Compute the size of the device path instance
//
if (DevicePathInstanceSize != NULL) {
*DevicePathInstanceSize = ((UINTN) DevPath - (UINTN) (*DevicePathInstance)) + sizeof (EFI_DEVICE_PATH_PROTOCOL);
}
//
// Make a copy and return the device path instance
//
Temp = DevPath->SubType;
DevPath->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;
ReturnValue = DuplicateDevicePath (*DevicePathInstance);
DevPath->SubType = Temp;
//
// If DevPath is the end of an entire device path, then another instance
// does not follow, so *DevicePath is set to NULL.
//
if (DevicePathSubType (DevPath) == END_ENTIRE_DEVICE_PATH_SUBTYPE) {
*DevicePathInstance = NULL;
} else {
*DevicePathInstance = NextDevicePathNode (DevPath);
}
return ReturnValue;
}
BOOLEAN
IsDevicePathMultiInstance (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
/*++
Routine Description:
Returns whether a device path is multi-instance.
Arguments:
DevicePath - Points to the device path. If NULL, then ignored.
Returns:
TRUE - The device path has more than one instance
FALSE - The device path is empty or contains only a single instance.
--*/
{
CONST EFI_DEVICE_PATH_PROTOCOL *Node;
if (DevicePath == NULL) {
return FALSE;
}
Node = DevicePath;
while (!IsDevicePathEnd (Node)) {
if (EfiIsDevicePathEndInstance (Node)) {
return TRUE;
}
Node = NextDevicePathNode (Node);
}
return FALSE;
}
EFI_DEVICE_PATH_PROTOCOL *
CreateDeviceNode (
IN UINT8 NodeType,
IN UINT8 NodeSubType,
IN UINT16 NodeLength
)
/*++
Routine Description:
Creates a device node
Arguments:
NodeType - NodeType is the device node type (EFI_DEVICE_PATH.Type) for
the new device node.
NodeSubType - NodeSubType is the device node sub-type
EFI_DEVICE_PATH.SubType) for the new device node.
NodeLength - NodeLength is the length of the device node
(EFI_DEVICE_PATH.Length) for the new device node.
Returns:
Pointer - A pointer to the newly created device node.
NULL - NodeLength is less than
the size of the header or there was insufficient memory.
--*/
{
EFI_DEVICE_PATH_PROTOCOL *Node;
if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
return NULL;
}
Node = (EFI_DEVICE_PATH_PROTOCOL *) AllocateZeroPool ((UINTN) NodeLength);
if (Node != NULL) {
Node->Type = NodeType;
Node->SubType = NodeSubType;
SetDevicePathNodeLength (Node, NodeLength);
}
return Node;
}

View File

@ -3473,6 +3473,73 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<FfsFormatKey>BS_DRIVER</FfsFormatKey> <FfsFormatKey>BS_DRIVER</FfsFormatKey>
</ModuleSaBuildOptions> </ModuleSaBuildOptions>
</ModuleSA> </ModuleSA>
<ModuleSA SupArchList="IA32" PackageGuid="B6EC423C-21D2-490D-85C6-DD5864EAA674" ModuleGuid="9B680FCE-AD6B-4F3A-B60B-F59899003443">
<Libraries>
<Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
</Libraries>
<PcdBuildDefinition>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdMaximumUnicodeStringLength</C_Name>
<Token>0x00000001</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT32</DatumType>
<MaxDatumSize>4</MaxDatumSize>
<Value>1000000</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdMaximumAsciiStringLength</C_Name>
<Token>0x00000002</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT32</DatumType>
<MaxDatumSize>4</MaxDatumSize>
<Value>1000000</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdDebugPropertyMask</C_Name>
<Token>0x00000005</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT8</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>0x0f</Value>
</PcdData>
<PcdData ItemType="PATCHABLE_IN_MODULE">
<C_Name>PcdDebugPrintErrorLevel</C_Name>
<Token>0x00000006</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT32</DatumType>
<MaxDatumSize>4</MaxDatumSize>
<Value>0x80000000</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdReportStatusCodePropertyMask</C_Name>
<Token>0x00000007</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT8</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>0x07</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdDebugClearMemoryValue</C_Name>
<Token>0x00000008</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT8</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>0xAF</Value>
</PcdData>
</PcdBuildDefinition>
<ModuleSaBuildOptions>
<FvBinding>FV_RECOVERY</FvBinding>
<FfsFormatKey>BS_DRIVER</FfsFormatKey>
</ModuleSaBuildOptions>
</ModuleSA>
<ModuleSA SupArchList="IA32" PackageGuid="B6EC423C-21D2-490D-85C6-DD5864EAA674" ModuleGuid="6B38F7B4-AD98-40e9-9093-ACA2B5A253C4"> <ModuleSA SupArchList="IA32" PackageGuid="B6EC423C-21D2-490D-85C6-DD5864EAA674" ModuleGuid="6B38F7B4-AD98-40e9-9093-ACA2B5A253C4">
<Libraries> <Libraries>
<Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/> <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
@ -4579,6 +4646,98 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<FfsFormatKey>BS_DRIVER</FfsFormatKey> <FfsFormatKey>BS_DRIVER</FfsFormatKey>
</ModuleSaBuildOptions> </ModuleSaBuildOptions>
</ModuleSA> </ModuleSA>
<ModuleSA SupArchList="IA32" PackageGuid="B6EC423C-21D2-490D-85C6-DD5864EAA674" ModuleGuid="BDFE430E-8F2A-4db0-9991-6F856594777E">
<Libraries>
<Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="B6EC423C-21D2-490D-85C6-DD5864EAA674"/>
<Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
</Libraries>
<PcdBuildDefinition>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdMaximumUnicodeStringLength</C_Name>
<Token>0x00000001</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT32</DatumType>
<MaxDatumSize>4</MaxDatumSize>
<Value>1000000</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdMaximumAsciiStringLength</C_Name>
<Token>0x00000002</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT32</DatumType>
<MaxDatumSize>4</MaxDatumSize>
<Value>1000000</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdSpinLockTimeout</C_Name>
<Token>0x00000004</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT32</DatumType>
<MaxDatumSize>4</MaxDatumSize>
<Value>10000000</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdMaximumLinkedListLength</C_Name>
<Token>0x00000003</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT32</DatumType>
<MaxDatumSize>4</MaxDatumSize>
<Value>1000000</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdReportStatusCodePropertyMask</C_Name>
<Token>0x00000007</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT8</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>0x07</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdDebugPropertyMask</C_Name>
<Token>0x00000005</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT8</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>0x0f</Value>
</PcdData>
<PcdData ItemType="PATCHABLE_IN_MODULE">
<C_Name>PcdDebugPrintErrorLevel</C_Name>
<Token>0x00000006</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT32</DatumType>
<MaxDatumSize>4</MaxDatumSize>
<Value>0x80000000</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdDebugClearMemoryValue</C_Name>
<Token>0x00000008</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT8</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>0xAF</Value>
</PcdData>
<PcdData ItemType="FIXED_AT_BUILD">
<C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
<Token>0x00000009</Token>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>UINT8</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>0</Value>
</PcdData>
</PcdBuildDefinition>
<ModuleSaBuildOptions>
<FvBinding>FV_MAIN</FvBinding>
<FfsFormatKey>BS_DRIVER</FfsFormatKey>
</ModuleSaBuildOptions>
</ModuleSA>
<ModuleSA SupArchList="IA32" PackageGuid="B6EC423C-21D2-490D-85C6-DD5864EAA674" ModuleGuid="0167CCC4-D0F7-4f21-A3EF-9E64B7CDCE8B"> <ModuleSA SupArchList="IA32" PackageGuid="B6EC423C-21D2-490D-85C6-DD5864EAA674" ModuleGuid="0167CCC4-D0F7-4f21-A3EF-9E64B7CDCE8B">
<Libraries> <Libraries>
<Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/> <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>

View File

@ -40,6 +40,16 @@
0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88 } \ 0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88 } \
} }
#define EFI_UART_DEVICE_PATH_GUID \
{ \
0x37499a9d, 0x542f, 0x4c89, {0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 } \
}
#define EFI_SAS_DEVICE_PATH_GUID \
{ \
0xb4dd87d4, 0x8b00, 0xd911, {0xaf, 0xdc, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } \
}
extern EFI_GUID gEfiPcAnsiGuid; extern EFI_GUID gEfiPcAnsiGuid;
extern EFI_GUID gEfiVT100Guid; extern EFI_GUID gEfiVT100Guid;
extern EFI_GUID gEfiVT100PlusGuid; extern EFI_GUID gEfiVT100PlusGuid;

View File

@ -255,6 +255,8 @@ typedef struct {
#define USB_PORT_STAT_RESET 0x0010 #define USB_PORT_STAT_RESET 0x0010
#define USB_PORT_STAT_POWER 0x0100 #define USB_PORT_STAT_POWER 0x0100
#define USB_PORT_STAT_LOW_SPEED 0x0200 #define USB_PORT_STAT_LOW_SPEED 0x0200
#define USB_PORT_STAT_HIGH_SPEED 0x0400
#define USB_PORT_STAT_OWNER 0x0800
#define USB_PORT_STAT_C_CONNECTION 0x0001 #define USB_PORT_STAT_C_CONNECTION 0x0001
#define USB_PORT_STAT_C_ENABLE 0x0002 #define USB_PORT_STAT_C_ENABLE 0x0002
@ -270,6 +272,7 @@ typedef enum {
EfiUsbPortSuspend = 2, EfiUsbPortSuspend = 2,
EfiUsbPortReset = 4, EfiUsbPortReset = 4,
EfiUsbPortPower = 8, EfiUsbPortPower = 8,
EfiUsbPortOwner = 13,
EfiUsbPortConnectChange = 16, EfiUsbPortConnectChange = 16,
EfiUsbPortEnableChange = 17, EfiUsbPortEnableChange = 17,
EfiUsbPortSuspendChange = 18, EfiUsbPortSuspendChange = 18,

View File

@ -64,8 +64,8 @@ EFI_DEVICE_PATH_PROTOCOL*
; ;
typedef struct { typedef struct {
EFI_DEVICE_PATH_FROM_TEXT_NODE ConvertDeviceNodeFromText; EFI_DEVICE_PATH_FROM_TEXT_NODE ConvertTextToDeviceNode;
EFI_DEVICE_PATH_FROM_TEXT_PATH ConvertDevicePathFromText; EFI_DEVICE_PATH_FROM_TEXT_PATH ConvertTextToDevicePath;
} EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL; } EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL;
extern EFI_GUID gEfiDevicePathFromTextProtocolGuid; extern EFI_GUID gEfiDevicePathFromTextProtocolGuid;

View File

@ -269,6 +269,7 @@ EFI_STATUS
IN OUT UINT8 *DataToggle, IN OUT UINT8 *DataToggle,
IN UINTN PollingInterval OPTIONAL, IN UINTN PollingInterval OPTIONAL,
IN UINTN DataLength OPTIONAL, IN UINTN DataLength OPTIONAL,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator OPTIONAL,
IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction OPTIONAL, IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction OPTIONAL,
IN VOID *Context OPTIONAL IN VOID *Context OPTIONAL
) )
@ -314,6 +315,7 @@ EFI_STATUS
IN OUT UINTN *DataLength, IN OUT UINTN *DataLength,
IN OUT UINT8 *DataToggle, IN OUT UINT8 *DataToggle,
IN UINTN TimeOut, IN UINTN TimeOut,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
OUT UINT32 *TransferResult OUT UINT32 *TransferResult
) )
; ;

View File

@ -1839,11 +1839,7 @@ typedef struct {
#define HW_CONTROLLER_DP 0x05 #define HW_CONTROLLER_DP 0x05
typedef struct { typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header; EFI_DEVICE_PATH_PROTOCOL Header;
#if EDK_RELEASE_VERSION >= 0x00020000
UINT32 ControllerNumber; UINT32 ControllerNumber;
#else
UINT32 Controller;
#endif
} CONTROLLER_DEVICE_PATH; } CONTROLLER_DEVICE_PATH;
// //
@ -1945,6 +1941,7 @@ typedef struct {
UINT8 DeviceProtocol; UINT8 DeviceProtocol;
} USB_CLASS_DEVICE_PATH; } USB_CLASS_DEVICE_PATH;
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
#define MSG_USB_WWID_DP 0x10 #define MSG_USB_WWID_DP 0x10
typedef struct { typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header; EFI_DEVICE_PATH_PROTOCOL Header;
@ -1957,8 +1954,9 @@ typedef struct {
#define MSG_DEVICE_LOGICAL_UNIT_DP 0x11 #define MSG_DEVICE_LOGICAL_UNIT_DP 0x11
typedef struct { typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header; EFI_DEVICE_PATH_PROTOCOL Header;
UINT8 LUN; UINT8 Lun;
} DEVICE_LOGICAL_UNIT_DEVICE_PATH; } DEVICE_LOGICAL_UNIT_DEVICE_PATH;
#endif
#define MSG_I2O_DP 0x06 #define MSG_I2O_DP 0x06
typedef struct { typedef struct {
@ -2030,8 +2028,27 @@ typedef struct {
#define DEVICE_PATH_MESSAGING_VT_100 EFI_VT_100_GUID #define DEVICE_PATH_MESSAGING_VT_100 EFI_VT_100_GUID
#define DEVICE_PATH_MESSAGING_VT_100_PLUS EFI_VT_100_PLUS_GUID #define DEVICE_PATH_MESSAGING_VT_100_PLUS EFI_VT_100_PLUS_GUID
#define DEVICE_PATH_MESSAGING_VT_UTF8 EFI_VT_UTF8_GUID #define DEVICE_PATH_MESSAGING_VT_UTF8 EFI_VT_UTF8_GUID
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
#define DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL EFI_UART_DEVICE_PATH_GUID
#define DEVICE_PATH_MESSAGING_SAS EFI_SAS_DEVICE_PATH_GUID #define DEVICE_PATH_MESSAGING_SAS EFI_SAS_DEVICE_PATH_GUID
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
UINT32 FlowControlMap;
} UART_FLOW_CONTROL_DEVICE_PATH;
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
UINT32 Reserved;
UINT64 SasAddress;
UINT64 Lun;
UINT16 DeviceTopology;
UINT16 RelativeTargetPort;
} SAS_DEVICE_PATH;
#define MSG_ISCSI_DP 0x13 #define MSG_ISCSI_DP 0x13
typedef struct { typedef struct {
@ -2053,6 +2070,7 @@ typedef struct {
#define ISCSI_LOGIN_OPTION_CHAP_BI 0x0000 #define ISCSI_LOGIN_OPTION_CHAP_BI 0x0000
#define ISCSI_LOGIN_OPTION_CHAP_UNI 0x2000 #define ISCSI_LOGIN_OPTION_CHAP_UNI 0x2000
#endif
// //
// Media Device Path // Media Device Path