TianoCore EDK2 master
Loading...
Searching...
No Matches
UsbHcMem.h
Go to the documentation of this file.
1
10#ifndef _EFI_EHCI_MEM_H_
11#define _EFI_EHCI_MEM_H_
12
13#include <Uefi.h>
15
16#define USB_HC_BIT(a) ((UINTN)(1 << (a)))
17
18#define USB_HC_BIT_IS_SET(Data, Bit) \
19 ((BOOLEAN)(((Data) & USB_HC_BIT(Bit)) == USB_HC_BIT(Bit)))
20
21#define USB_HC_HIGH_32BIT(Addr64) \
22 ((UINT32)(RShiftU64((UINTN)(Addr64), 32) & 0XFFFFFFFF))
23
25
26struct _USBHC_MEM_BLOCK {
27 UINT8 *Bits; // Bit array to record which unit is allocated
28 UINTN BitsLen;
29 UINT8 *Buf;
30 UINT8 *BufHost;
31 UINTN BufLen; // Memory size in bytes
32 VOID *Mapping;
33 USBHC_MEM_BLOCK *Next;
34};
35
36//
37// USBHC_MEM_POOL is used to manage the memory used by USB
38// host controller. EHCI requires the control memory and transfer
39// data to be on the same 4G memory.
40//
41typedef struct _USBHC_MEM_POOL {
42 BOOLEAN Check4G;
43 UINT32 Which4G;
44 USBHC_MEM_BLOCK *Head;
46
47//
48// Memory allocation unit, must be 2^n, n>4
49//
50#define USBHC_MEM_UNIT 64
51
52#define USBHC_MEM_UNIT_MASK (USBHC_MEM_UNIT - 1)
53#define USBHC_MEM_DEFAULT_PAGES 16
54
55#define USBHC_MEM_ROUND(Len) (((Len) + USBHC_MEM_UNIT_MASK) & (~USBHC_MEM_UNIT_MASK))
56
57//
58// Advance the byte and bit to the next bit, adjust byte accordingly.
59//
60#define NEXT_BIT(Byte, Bit) \
61 do { \
62 (Bit)++; \
63 if ((Bit) > 7) { \
64 (Byte)++; \
65 (Bit) = 0; \
66 } \
67 } while (0)
68
80 IN USBHC_MEM_POOL *Pool,
81 IN VOID *Mem,
82 IN UINTN Size
83 );
84
85#endif
UINT64 UINTN
EFI_PHYSICAL_ADDRESS UsbHcGetPciAddressForHostMem(IN USBHC_MEM_POOL *Pool, IN VOID *Mem, IN UINTN Size)
Definition: UsbHcMem.c:223
#define IN
Definition: Base.h:279
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50