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
>
14
#include <
IndustryStandard/Pci22.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
24
typedef
struct
_USBHC_MEM_BLOCK
USBHC_MEM_BLOCK
;
25
26
struct
_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
//
41
typedef
struct
_USBHC_MEM_POOL
{
42
BOOLEAN Check4G;
43
UINT32 Which4G;
44
USBHC_MEM_BLOCK
*Head;
45
}
USBHC_MEM_POOL
;
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
78
EFI_PHYSICAL_ADDRESS
79
UsbHcGetPciAddressForHostMem
(
80
IN
USBHC_MEM_POOL
*Pool,
81
IN
VOID *Mem,
82
IN
UINTN
Size
83
);
84
85
#endif
UINTN
UINT64 UINTN
Definition:
ProcessorBind.h:112
UsbHcGetPciAddressForHostMem
EFI_PHYSICAL_ADDRESS UsbHcGetPciAddressForHostMem(IN USBHC_MEM_POOL *Pool, IN VOID *Mem, IN UINTN Size)
Definition:
UsbHcMem.c:223
IN
#define IN
Definition:
Base.h:279
Pci22.h
Uefi.h
EFI_PHYSICAL_ADDRESS
UINT64 EFI_PHYSICAL_ADDRESS
Definition:
UefiBaseType.h:50
_USBHC_MEM_BLOCK
Definition:
UsbHcMem.h:22
_USBHC_MEM_POOL
Definition:
UsbHcMem.h:37
MdeModulePkg
Bus
Pci
EhciPei
UsbHcMem.h
Generated on Fri Nov 15 2024 18:01:08 for TianoCore EDK2 by
1.9.6