2 Private Header file for Usb Host Controller PEIM
4 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions
8 of the BSD License which accompanies this distribution. The
9 full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #ifndef _EFI_EHCI_MEM_H_
18 #define _EFI_EHCI_MEM_H_
21 #include <IndustryStandard/Pci22.h>
23 #define USB_HC_BIT(a) ((UINTN)(1 << (a)))
25 #define USB_HC_BIT_IS_SET(Data, Bit) \
26 ((BOOLEAN)(((Data) & USB_HC_BIT(Bit)) == USB_HC_BIT(Bit)))
28 #define USB_HC_HIGH_32BIT(Addr64) \
29 ((UINT32)(RShiftU64((UINTN)(Addr64), 32) & 0XFFFFFFFF))
31 typedef struct _USBHC_MEM_BLOCK USBHC_MEM_BLOCK
;
33 struct _USBHC_MEM_BLOCK
{
34 UINT8
*Bits
; // Bit array to record which unit is allocated
38 UINTN BufLen
; // Memory size in bytes
40 USBHC_MEM_BLOCK
*Next
;
44 // USBHC_MEM_POOL is used to manage the memory used by USB
45 // host controller. EHCI requires the control memory and transfer
46 // data to be on the same 4G memory.
48 typedef struct _USBHC_MEM_POOL
{
51 USBHC_MEM_BLOCK
*Head
;
55 // Memory allocation unit, must be 2^n, n>4
57 #define USBHC_MEM_UNIT 64
59 #define USBHC_MEM_UNIT_MASK (USBHC_MEM_UNIT - 1)
60 #define USBHC_MEM_DEFAULT_PAGES 16
62 #define USBHC_MEM_ROUND(Len) (((Len) + USBHC_MEM_UNIT_MASK) & (~USBHC_MEM_UNIT_MASK))
65 // Advance the byte and bit to the next bit, adjust byte accordingly.
67 #define NEXT_BIT(Byte, Bit) \