mirror of https://github.com/acidanthera/audk.git
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:
parent
4b9fc76f7b
commit
562d28495d
|
@ -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
|
@ -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>
|
|
@ -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
|
@ -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>
|
||||||
|
|
|
@ -49,13 +49,13 @@ Returns:
|
||||||
// Perform 16bit Read in PCI IO Space
|
// Perform 16bit Read in PCI IO Space
|
||||||
//
|
//
|
||||||
return PciIo->Io.Read (
|
return PciIo->Io.Read (
|
||||||
PciIo,
|
PciIo,
|
||||||
EfiPciIoWidthUint16,
|
EfiPciIoWidthUint16,
|
||||||
USB_BAR_INDEX,
|
USB_BAR_INDEX,
|
||||||
(UINT64) PortOffset,
|
(UINT64) PortOffset,
|
||||||
1,
|
1,
|
||||||
Data
|
Data
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -86,13 +86,13 @@ Returns:
|
||||||
// Perform 32bit Read in PCI IO Space
|
// Perform 32bit Read in PCI IO Space
|
||||||
//
|
//
|
||||||
return PciIo->Io.Read (
|
return PciIo->Io.Read (
|
||||||
PciIo,
|
PciIo,
|
||||||
EfiPciIoWidthUint32,
|
EfiPciIoWidthUint32,
|
||||||
USB_BAR_INDEX,
|
USB_BAR_INDEX,
|
||||||
(UINT64) PortOffset,
|
(UINT64) PortOffset,
|
||||||
1,
|
1,
|
||||||
Data
|
Data
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -123,13 +123,13 @@ Returns:
|
||||||
// Perform 16bit Write in PCI IO Space
|
// Perform 16bit Write in PCI IO Space
|
||||||
//
|
//
|
||||||
return PciIo->Io.Write (
|
return PciIo->Io.Write (
|
||||||
PciIo,
|
PciIo,
|
||||||
EfiPciIoWidthUint16,
|
EfiPciIoWidthUint16,
|
||||||
USB_BAR_INDEX,
|
USB_BAR_INDEX,
|
||||||
(UINT64) PortOffset,
|
(UINT64) PortOffset,
|
||||||
1,
|
1,
|
||||||
&Data
|
&Data
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -160,13 +160,13 @@ Returns:
|
||||||
// Perform 32bit Write in PCI IO Space
|
// Perform 32bit Write in PCI IO Space
|
||||||
//
|
//
|
||||||
return PciIo->Io.Write (
|
return PciIo->Io.Write (
|
||||||
PciIo,
|
PciIo,
|
||||||
EfiPciIoWidthUint32,
|
EfiPciIoWidthUint32,
|
||||||
USB_BAR_INDEX,
|
USB_BAR_INDEX,
|
||||||
(UINT64) PortOffset,
|
(UINT64) PortOffset,
|
||||||
1,
|
1,
|
||||||
&Data
|
&Data
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// USB register-base helper functions
|
// USB register-base helper functions
|
||||||
|
@ -657,10 +657,10 @@ Returns:
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
Status = ReadUHCCommandReg (
|
Status = ReadUHCCommandReg (
|
||||||
HcDev->PciIo,
|
HcDev->PciIo,
|
||||||
(UINT32) (USBCMD),
|
(UINT32) (USBCMD),
|
||||||
&CommandContent
|
&CommandContent
|
||||||
);
|
);
|
||||||
|
|
||||||
if ((CommandContent & USBCMD_MAXP) != USBCMD_MAXP) {
|
if ((CommandContent & USBCMD_MAXP) != USBCMD_MAXP) {
|
||||||
CommandContent |= USBCMD_MAXP;
|
CommandContent |= USBCMD_MAXP;
|
||||||
|
@ -715,25 +715,25 @@ Returns:
|
||||||
BufferSizeInBytes = 4096;
|
BufferSizeInBytes = 4096;
|
||||||
BufferSizeInPages = EFI_SIZE_TO_PAGES (BufferSizeInBytes);
|
BufferSizeInPages = EFI_SIZE_TO_PAGES (BufferSizeInBytes);
|
||||||
Status = HcDev->PciIo->AllocateBuffer (
|
Status = HcDev->PciIo->AllocateBuffer (
|
||||||
HcDev->PciIo,
|
HcDev->PciIo,
|
||||||
AllocateAnyPages,
|
AllocateAnyPages,
|
||||||
EfiBootServicesData,
|
EfiBootServicesData,
|
||||||
BufferSizeInPages,
|
BufferSizeInPages,
|
||||||
&CommonBuffer,
|
&CommonBuffer,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = HcDev->PciIo->Map (
|
Status = HcDev->PciIo->Map (
|
||||||
HcDev->PciIo,
|
HcDev->PciIo,
|
||||||
EfiPciIoOperationBusMasterCommonBuffer,
|
EfiPciIoOperationBusMasterCommonBuffer,
|
||||||
CommonBuffer,
|
CommonBuffer,
|
||||||
&BufferSizeInBytes,
|
&BufferSizeInBytes,
|
||||||
&MappedAddress,
|
&MappedAddress,
|
||||||
&Mapping
|
&Mapping
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) || (BufferSizeInBytes != 4096)) {
|
if (EFI_ERROR (Status) || (BufferSizeInBytes != 4096)) {
|
||||||
HcDev->PciIo->FreeBuffer (HcDev->PciIo, BufferSizeInPages, CommonBuffer);
|
HcDev->PciIo->FreeBuffer (HcDev->PciIo, BufferSizeInPages, CommonBuffer);
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
|
@ -3589,13 +3589,13 @@ Returns:
|
||||||
// and it is allocated as common buffer use.
|
// and it is allocated as common buffer use.
|
||||||
//
|
//
|
||||||
Status = HcDev->PciIo->AllocateBuffer (
|
Status = HcDev->PciIo->AllocateBuffer (
|
||||||
HcDev->PciIo,
|
HcDev->PciIo,
|
||||||
AllocateAnyPages,
|
AllocateAnyPages,
|
||||||
EfiBootServicesData,
|
EfiBootServicesData,
|
||||||
MemoryBlockSizeInPages,
|
MemoryBlockSizeInPages,
|
||||||
&CommonBuffer,
|
&CommonBuffer,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
gBS->FreePool ((*MemoryHeader)->BitArrayPtr);
|
gBS->FreePool ((*MemoryHeader)->BitArrayPtr);
|
||||||
gBS->FreePool (*MemoryHeader);
|
gBS->FreePool (*MemoryHeader);
|
||||||
|
@ -3604,13 +3604,13 @@ Returns:
|
||||||
|
|
||||||
MemoryBlockSizeInBytes = EFI_PAGES_TO_SIZE (MemoryBlockSizeInPages);
|
MemoryBlockSizeInBytes = EFI_PAGES_TO_SIZE (MemoryBlockSizeInPages);
|
||||||
Status = HcDev->PciIo->Map (
|
Status = HcDev->PciIo->Map (
|
||||||
HcDev->PciIo,
|
HcDev->PciIo,
|
||||||
EfiPciIoOperationBusMasterCommonBuffer,
|
EfiPciIoOperationBusMasterCommonBuffer,
|
||||||
CommonBuffer,
|
CommonBuffer,
|
||||||
&MemoryBlockSizeInBytes,
|
&MemoryBlockSizeInBytes,
|
||||||
&MappedAddress,
|
&MappedAddress,
|
||||||
&Mapping
|
&Mapping
|
||||||
);
|
);
|
||||||
//
|
//
|
||||||
// if returned Mapped size is less than the size we request,do not support.
|
// if returned Mapped size is less than the size we request,do not support.
|
||||||
//
|
//
|
||||||
|
@ -3741,10 +3741,10 @@ Returns:
|
||||||
TempHeaderPtr = TempHeaderPtr->Next) {
|
TempHeaderPtr = TempHeaderPtr->Next) {
|
||||||
|
|
||||||
Status = AllocMemInMemoryBlock (
|
Status = AllocMemInMemoryBlock (
|
||||||
TempHeaderPtr,
|
TempHeaderPtr,
|
||||||
(VOID **) Pool,
|
(VOID **) Pool,
|
||||||
RealAllocSize / 32
|
RealAllocSize / 32
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
ZeroMem (*Pool, AllocSize);
|
ZeroMem (*Pool, AllocSize);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
@ -3777,10 +3777,10 @@ Returns:
|
||||||
InsertMemoryHeaderToList (MemoryHeader, NewMemoryHeader);
|
InsertMemoryHeaderToList (MemoryHeader, NewMemoryHeader);
|
||||||
|
|
||||||
Status = AllocMemInMemoryBlock (
|
Status = AllocMemInMemoryBlock (
|
||||||
NewMemoryHeader,
|
NewMemoryHeader,
|
||||||
(VOID **) Pool,
|
(VOID **) Pool,
|
||||||
RealAllocSize / 32
|
RealAllocSize / 32
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
ZeroMem (*Pool, AllocSize);
|
ZeroMem (*Pool, AllocSize);
|
||||||
|
@ -4226,12 +4226,12 @@ TurnOffUSBEmulation (
|
||||||
//
|
//
|
||||||
Command = 0;
|
Command = 0;
|
||||||
PciIo->Pci.Write (
|
PciIo->Pci.Write (
|
||||||
PciIo,
|
PciIo,
|
||||||
EfiPciIoWidthUint16,
|
EfiPciIoWidthUint16,
|
||||||
USB_EMULATION,
|
USB_EMULATION,
|
||||||
1,
|
1,
|
||||||
&Command
|
&Command
|
||||||
);
|
);
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -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
|
||||||
|
|
|
@ -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
File diff suppressed because it is too large
Load Diff
|
@ -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,
|
||||||
&TransferResult
|
UsbIoDev->Translator,
|
||||||
);
|
&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;
|
||||||
UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
|
|
||||||
UsbIoDev = UsbIoController->UsbDevice;
|
DataBuffersNumber = 1;
|
||||||
UsbHCInterface = UsbIoDev->BusController->UsbHCInterface;
|
UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
|
||||||
|
UsbIoDev = UsbIoController->UsbDevice;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Parameters Checking
|
// Parameters Checking
|
||||||
|
@ -408,17 +408,20 @@ 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,
|
||||||
MaxPacketLength,
|
UsbIoDev->DeviceSpeed,
|
||||||
Data,
|
MaxPacketLength,
|
||||||
DataLength,
|
DataBuffersNumber,
|
||||||
&DataToggle,
|
&Data,
|
||||||
Timeout,
|
DataLength,
|
||||||
&TransferResult
|
&DataToggle,
|
||||||
);
|
Timeout,
|
||||||
|
UsbIoDev->Translator,
|
||||||
|
&TransferResult
|
||||||
|
);
|
||||||
|
|
||||||
if (OldToggle != DataToggle) {
|
if (OldToggle != DataToggle) {
|
||||||
//
|
//
|
||||||
|
@ -474,14 +477,13 @@ 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;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Parameters Checking
|
// Parameters Checking
|
||||||
|
@ -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,18 +535,19 @@ 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,
|
||||||
Status
|
UsbIoDev->Translator,
|
||||||
);
|
Status
|
||||||
|
);
|
||||||
|
|
||||||
if (OldToggle != DataToggle) {
|
if (OldToggle != DataToggle) {
|
||||||
//
|
//
|
||||||
|
@ -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:
|
||||||
|
@ -600,13 +601,12 @@ 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;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check endpoint
|
// Check endpoint
|
||||||
|
@ -634,25 +634,25 @@ 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,
|
||||||
NULL,
|
UsbIoDev->Translator,
|
||||||
NULL
|
NULL,
|
||||||
);
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// We need to store the toggle value
|
// We need to store the toggle value
|
||||||
|
@ -678,19 +678,20 @@ 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,
|
||||||
InterruptCallBack,
|
UsbIoDev->Translator,
|
||||||
Context
|
InterruptCallBack,
|
||||||
);
|
Context
|
||||||
|
);
|
||||||
|
|
||||||
return RetStatus;
|
return RetStatus;
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
|
|
|
@ -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,8 +308,7 @@ IsPortSuspendChange (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INTERFACE_DESC_LIST_ENTRY *
|
||||||
INTERFACE_DESC_LIST_ENTRY*
|
|
||||||
FindInterfaceListEntry (
|
FindInterfaceListEntry (
|
||||||
IN EFI_USB_IO_PROTOCOL *This
|
IN EFI_USB_IO_PROTOCOL *This
|
||||||
)
|
)
|
||||||
|
@ -329,7 +327,7 @@ FindInterfaceListEntry (
|
||||||
{
|
{
|
||||||
USB_IO_CONTROLLER_DEVICE *UsbIoController;
|
USB_IO_CONTROLLER_DEVICE *UsbIoController;
|
||||||
USB_IO_DEVICE *UsbIoDev;
|
USB_IO_DEVICE *UsbIoDev;
|
||||||
LIST_ENTRY *InterfaceListHead;
|
LIST_ENTRY *InterfaceListHead;
|
||||||
INTERFACE_DESC_LIST_ENTRY *InterfaceListEntry;
|
INTERFACE_DESC_LIST_ENTRY *InterfaceListEntry;
|
||||||
|
|
||||||
UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
|
UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
|
||||||
|
@ -367,8 +365,8 @@ FindEndPointListEntry (
|
||||||
Find EndPoint ListEntry.
|
Find EndPoint ListEntry.
|
||||||
|
|
||||||
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 ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -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
|
|
@ -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
|
@ -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;
|
||||||
|
}
|
|
@ -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"/>
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
)
|
)
|
||||||
|
@ -305,16 +306,17 @@ EFI_STATUS
|
||||||
typedef
|
typedef
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
(EFIAPI *EFI_USB2_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER) (
|
(EFIAPI *EFI_USB2_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER) (
|
||||||
IN EFI_USB2_HC_PROTOCOL *This,
|
IN EFI_USB2_HC_PROTOCOL *This,
|
||||||
IN UINT8 DeviceAddress,
|
IN UINT8 DeviceAddress,
|
||||||
IN UINT8 EndPointAddress,
|
IN UINT8 EndPointAddress,
|
||||||
IN UINT8 DeviceSpeed,
|
IN UINT8 DeviceSpeed,
|
||||||
IN UINTN MaximumPacketLength,
|
IN UINTN MaximumPacketLength,
|
||||||
IN OUT VOID *Data,
|
IN OUT VOID *Data,
|
||||||
IN OUT UINTN *DataLength,
|
IN OUT UINTN *DataLength,
|
||||||
IN OUT UINT8 *DataToggle,
|
IN OUT UINT8 *DataToggle,
|
||||||
IN UINTN TimeOut,
|
IN UINTN TimeOut,
|
||||||
OUT UINT32 *TransferResult
|
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
|
||||||
|
OUT UINT32 *TransferResult
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
#define DEVICE_PATH_MESSAGING_SAS EFI_SAS_DEVICE_PATH_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
|
||||||
|
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in New Issue