]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/EhciDxe/UsbHcMem.h
MdeModulePkg/PciBus: Accept Spec values as BarIndex and Alignment
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / EhciDxe / UsbHcMem.h
index 944acdc11e6e4c3d26b61d4044f034a96684ec7c..84ced8d58027b596e6ae537518a3a085de4dc1e6 100644 (file)
@@ -2,8 +2,8 @@
 \r
   This file contains the definination for host controller memory management routines.\r
 \r
-Copyright (c) 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -16,9 +16,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #ifndef _EFI_EHCI_MEM_H_\r
 #define _EFI_EHCI_MEM_H_\r
 \r
-\r
-#include <IndustryStandard/Pci22.h>\r
-\r
 #define USB_HC_BIT(a)                  ((UINTN)(1 << (a)))\r
 \r
 #define USB_HC_BIT_IS_SET(Data, Bit)   \\r
@@ -27,8 +24,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define USB_HC_HIGH_32BIT(Addr64)    \\r
           ((UINT32)(RShiftU64((UINTN)(Addr64), 32) & 0XFFFFFFFF))\r
 \r
-typedef struct _USBHC_MEM_BLOCK  USBHC_MEM_BLOCK;\r
-\r
+typedef struct _USBHC_MEM_BLOCK USBHC_MEM_BLOCK;\r
 struct _USBHC_MEM_BLOCK {\r
   UINT8                   *Bits;    // Bit array to record which unit is allocated\r
   UINTN                   BitsLen;\r
@@ -51,12 +47,13 @@ typedef struct _USBHC_MEM_POOL {
   USBHC_MEM_BLOCK         *Head;\r
 } USBHC_MEM_POOL;\r
 \r
-typedef enum {\r
-  USBHC_MEM_UNIT           = 64,     // Memory allocation unit, must be 2^n, n>4\r
+//\r
+// Memory allocation unit, must be 2^n, n>4\r
+//\r
+#define USBHC_MEM_UNIT           64\r
 \r
-  USBHC_MEM_UNIT_MASK      = USBHC_MEM_UNIT - 1,\r
-  USBHC_MEM_DEFAULT_PAGES  = 16\r
-} USBHC_MEM_UNIT_DATA;\r
+#define USBHC_MEM_UNIT_MASK      (USBHC_MEM_UNIT - 1)\r
+#define USBHC_MEM_DEFAULT_PAGES  16\r
 \r
 #define USBHC_MEM_ROUND(Len)  (((Len) + USBHC_MEM_UNIT_MASK) & (~USBHC_MEM_UNIT_MASK))\r
 \r
@@ -133,8 +130,6 @@ UsbHcAllocateMem (
   @param  Mem   The memory to free.\r
   @param  Size  The size of the memory to free.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 UsbHcFreeMem (\r
@@ -142,4 +137,21 @@ UsbHcFreeMem (
   IN VOID                 *Mem,\r
   IN UINTN                Size\r
   );\r
+\r
+/**\r
+  Calculate the corresponding pci bus address according to the Mem parameter.\r
+\r
+  @param  Pool           The memory pool of the host controller.\r
+  @param  Mem            The pointer to host memory.\r
+  @param  Size           The size of the memory region.\r
+\r
+  @return the pci memory address\r
+**/\r
+EFI_PHYSICAL_ADDRESS\r
+UsbHcGetPciAddressForHostMem (\r
+  IN USBHC_MEM_POOL       *Pool,\r
+  IN VOID                 *Mem,\r
+  IN UINTN                Size\r
+  );\r
+\r
 #endif\r