]>
Commit | Line | Data |
---|---|---|
4b1bf81c | 1 | /** @file\r |
2 | Private Header file for Usb Host Controller PEIM\r | |
3 | \r | |
4 | Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r | |
5 | \r | |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions\r | |
8 | of the BSD License which accompanies this distribution. The\r | |
9 | full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #ifndef _EFI_EHCI_MEM_H_\r | |
18 | #define _EFI_EHCI_MEM_H_\r | |
19 | \r | |
20 | #include <Uefi.h>\r | |
21 | #include <IndustryStandard/Pci22.h>\r | |
22 | \r | |
23 | #define USB_HC_BIT(a) ((UINTN)(1 << (a)))\r | |
24 | \r | |
25 | #define USB_HC_BIT_IS_SET(Data, Bit) \\r | |
26 | ((BOOLEAN)(((Data) & USB_HC_BIT(Bit)) == USB_HC_BIT(Bit)))\r | |
27 | \r | |
28 | #define USB_HC_HIGH_32BIT(Addr64) \\r | |
29 | ((UINT32)(RShiftU64((UINTN)(Addr64), 32) & 0XFFFFFFFF))\r | |
30 | \r | |
31 | typedef struct _USBHC_MEM_BLOCK USBHC_MEM_BLOCK;\r | |
32 | \r | |
33 | struct _USBHC_MEM_BLOCK {\r | |
34 | UINT8 *Bits; // Bit array to record which unit is allocated\r | |
35 | UINTN BitsLen; \r | |
36 | UINT8 *Buf;\r | |
37 | UINT8 *BufHost;\r | |
38 | UINTN BufLen; // Memory size in bytes\r | |
39 | VOID *Mapping; \r | |
40 | USBHC_MEM_BLOCK *Next;\r | |
41 | };\r | |
42 | \r | |
43 | //\r | |
44 | // USBHC_MEM_POOL is used to manage the memory used by USB \r | |
45 | // host controller. EHCI requires the control memory and transfer\r | |
46 | // data to be on the same 4G memory. \r | |
47 | //\r | |
48 | typedef struct _USBHC_MEM_POOL {\r | |
49 | BOOLEAN Check4G; \r | |
50 | UINT32 Which4G; \r | |
51 | USBHC_MEM_BLOCK *Head;\r | |
52 | } USBHC_MEM_POOL;\r | |
53 | \r | |
54 | //\r | |
55 | // Memory allocation unit, must be 2^n, n>4\r | |
56 | //\r | |
57 | #define USBHC_MEM_UNIT 64\r | |
58 | \r | |
59 | #define USBHC_MEM_UNIT_MASK (USBHC_MEM_UNIT - 1)\r | |
60 | #define USBHC_MEM_DEFAULT_PAGES 16\r | |
61 | \r | |
62 | #define USBHC_MEM_ROUND(Len) (((Len) + USBHC_MEM_UNIT_MASK) & (~USBHC_MEM_UNIT_MASK))\r | |
63 | \r | |
64 | //\r | |
65 | // Advance the byte and bit to the next bit, adjust byte accordingly.\r | |
66 | //\r | |
67 | #define NEXT_BIT(Byte, Bit) \\r | |
68 | do { \\r | |
69 | (Bit)++; \\r | |
70 | if ((Bit) > 7) { \\r | |
71 | (Byte)++; \\r | |
72 | (Bit) = 0; \\r | |
73 | } \\r | |
74 | } while (0) \r | |
75 | \r | |
76 | \r | |
77 | #endif\r |