TianoCore EDK2 master
Loading...
Searching...
No Matches
UsbHcMem.c File Reference
#include "EhcPeim.h"

Go to the source code of this file.

Functions

USBHC_MEM_BLOCKUsbHcAllocMemBlock (IN PEI_USB2_HC_DEV *Ehc, IN USBHC_MEM_POOL *Pool, IN UINTN Pages)
 
VOID UsbHcFreeMemBlock (IN PEI_USB2_HC_DEV *Ehc, IN USBHC_MEM_POOL *Pool, IN USBHC_MEM_BLOCK *Block)
 
VOID * UsbHcAllocMemFromBlock (IN USBHC_MEM_BLOCK *Block, IN UINTN Units)
 
EFI_PHYSICAL_ADDRESS UsbHcGetPciAddressForHostMem (IN USBHC_MEM_POOL *Pool, IN VOID *Mem, IN UINTN Size)
 
VOID UsbHcInsertMemBlockToPool (IN USBHC_MEM_BLOCK *Head, IN USBHC_MEM_BLOCK *Block)
 
BOOLEAN UsbHcIsMemBlockEmpty (IN USBHC_MEM_BLOCK *Block)
 
USBHC_MEM_POOLUsbHcInitMemPool (IN PEI_USB2_HC_DEV *Ehc, IN BOOLEAN Check4G, IN UINT32 Which4G)
 
EFI_STATUS UsbHcFreeMemPool (IN PEI_USB2_HC_DEV *Ehc, IN USBHC_MEM_POOL *Pool)
 
VOID * UsbHcAllocateMem (IN PEI_USB2_HC_DEV *Ehc, IN USBHC_MEM_POOL *Pool, IN UINTN Size)
 
VOID UsbHcFreeMem (IN PEI_USB2_HC_DEV *Ehc, IN USBHC_MEM_POOL *Pool, IN VOID *Mem, IN UINTN Size)
 

Detailed Description

PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPpiGuid which is used to enable recovery function from USB Drivers.

Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file UsbHcMem.c.

Function Documentation

◆ UsbHcAllocateMem()

VOID * UsbHcAllocateMem ( IN PEI_USB2_HC_DEV Ehc,
IN USBHC_MEM_POOL Pool,
IN UINTN  Size 
)

Allocate some memory from the host controller's memory pool which can be used to communicate with host controller.

Parameters
EhcThe EHCI device.
PoolThe host controller's memory pool.
SizeSize of the memory to allocate.
Returns
The allocated memory or NULL.

Definition at line 383 of file UsbHcMem.c.

◆ UsbHcAllocMemBlock()

USBHC_MEM_BLOCK * UsbHcAllocMemBlock ( IN PEI_USB2_HC_DEV Ehc,
IN USBHC_MEM_POOL Pool,
IN UINTN  Pages 
)

Allocate a block of memory to be used by the buffer pool.

Parameters
EhcThe EHCI device.
PoolThe buffer pool to allocate memory for.
PagesHow many pages to allocate.
Returns
The allocated memory block or NULL if failed.

Definition at line 24 of file UsbHcMem.c.

◆ UsbHcAllocMemFromBlock()

VOID * UsbHcAllocMemFromBlock ( IN USBHC_MEM_BLOCK Block,
IN UINTN  Units 
)

Alloc some memory from the block.

Parameters
BlockThe memory block to allocate memory from.
UnitsNumber of memory units to allocate.
Returns
The pointer to the allocated memory. If couldn't allocate the needed memory, the return value is NULL.

Definition at line 137 of file UsbHcMem.c.

◆ UsbHcFreeMem()

VOID UsbHcFreeMem ( IN PEI_USB2_HC_DEV Ehc,
IN USBHC_MEM_POOL Pool,
IN VOID *  Mem,
IN UINTN  Size 
)

Free the allocated memory back to the memory pool.

Parameters
EhcThe EHCI device.
PoolThe memory pool of the host controller.
MemThe memory to free.
SizeThe size of the memory to free.

Definition at line 458 of file UsbHcMem.c.

◆ UsbHcFreeMemBlock()

VOID UsbHcFreeMemBlock ( IN PEI_USB2_HC_DEV Ehc,
IN USBHC_MEM_POOL Pool,
IN USBHC_MEM_BLOCK Block 
)

Free the memory block from the memory pool.

Parameters
EhcThe EHCI device.
PoolThe memory pool to free the block from.
BlockThe memory block to free.

Definition at line 115 of file UsbHcMem.c.

◆ UsbHcFreeMemPool()

EFI_STATUS UsbHcFreeMemPool ( IN PEI_USB2_HC_DEV Ehc,
IN USBHC_MEM_POOL Pool 
)

Release the memory management pool.

Parameters
EhcThe EHCI device.
PoolThe USB memory pool to free.
Return values
EFI_DEVICE_ERRORFail to free the memory pool.
EFI_SUCCESSThe memory pool is freed.

Definition at line 350 of file UsbHcMem.c.

◆ UsbHcGetPciAddressForHostMem()

EFI_PHYSICAL_ADDRESS UsbHcGetPciAddressForHostMem ( IN USBHC_MEM_POOL Pool,
IN VOID *  Mem,
IN UINTN  Size 
)

Calculate the corresponding pci bus address according to the Mem parameter.

Parameters
PoolThe memory pool of the host controller.
MemThe pointer to host memory.
SizeThe size of the memory region.
Returns
the pci memory address

Definition at line 208 of file UsbHcMem.c.

◆ UsbHcInitMemPool()

USBHC_MEM_POOL * UsbHcInitMemPool ( IN PEI_USB2_HC_DEV Ehc,
IN BOOLEAN  Check4G,
IN UINT32  Which4G 
)

Initialize the memory management pool for the host controller.

Parameters
EhcThe EHCI device.
Check4GWhether the host controller requires allocated memory. from one 4G address space.
Which4GThe 4G memory area each memory allocated should be from.
Return values
EFI_SUCCESSThe memory pool is initialized.
EFI_OUT_OF_RESOURCEFail to init the memory pool.

Definition at line 302 of file UsbHcMem.c.

◆ UsbHcInsertMemBlockToPool()

VOID UsbHcInsertMemBlockToPool ( IN USBHC_MEM_BLOCK Head,
IN USBHC_MEM_BLOCK Block 
)

Insert the memory block to the pool's list of the blocks.

Parameters
HeadThe head of the memory pool's block list.
BlockThe memory block to insert.

Definition at line 254 of file UsbHcMem.c.

◆ UsbHcIsMemBlockEmpty()

BOOLEAN UsbHcIsMemBlockEmpty ( IN USBHC_MEM_BLOCK Block)

Is the memory block empty?

Parameters
BlockThe memory block to check.
Return values
TRUEThe memory block is empty.
FALSEThe memory block isn't empty.

Definition at line 274 of file UsbHcMem.c.