]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/EhciPei/UsbHcMem.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / EhciPei / UsbHcMem.h
index 586d12af96580aedcb03051e3b6d3834bf2bea77..7151dbc6e436ec714272bcd5aebbb9576d2e5dcf 100644 (file)
@@ -1,16 +1,9 @@
 /** @file\r
 Private Header file for Usb Host Controller PEIM\r
 \r
-Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
-  \r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions\r
-of the BSD License which accompanies this distribution.  The\r
-full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
 \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -20,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Uefi.h>\r
 #include <IndustryStandard/Pci22.h>\r
 \r
-#define USB_HC_BIT(a)                  ((UINTN)(1 << (a)))\r
+#define USB_HC_BIT(a)  ((UINTN)(1 << (a)))\r
 \r
 #define USB_HC_BIT_IS_SET(Data, Bit)   \\r
           ((BOOLEAN)(((Data) & USB_HC_BIT(Bit)) == USB_HC_BIT(Bit)))\r
@@ -31,30 +24,30 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 typedef struct _USBHC_MEM_BLOCK USBHC_MEM_BLOCK;\r
 \r
 struct _USBHC_MEM_BLOCK {\r
-  UINT8                   *Bits;    // Bit array to record which unit is allocated\r
-  UINTN                   BitsLen; \r
-  UINT8                   *Buf;\r
-  UINT8                   *BufHost;\r
-  UINTN                   BufLen;   // Memory size in bytes\r
-  VOID                    *Mapping;     \r
-  USBHC_MEM_BLOCK         *Next;\r
+  UINT8              *Bits;         // Bit array to record which unit is allocated\r
+  UINTN              BitsLen;\r
+  UINT8              *Buf;\r
+  UINT8              *BufHost;\r
+  UINTN              BufLen;        // Memory size in bytes\r
+  VOID               *Mapping;\r
+  USBHC_MEM_BLOCK    *Next;\r
 };\r
 \r
 //\r
-// USBHC_MEM_POOL is used to manage the memory used by USB \r
+// USBHC_MEM_POOL is used to manage the memory used by USB\r
 // host controller. EHCI requires the control memory and transfer\r
-// data to be on the same 4G memory. \r
+// data to be on the same 4G memory.\r
 //\r
 typedef struct _USBHC_MEM_POOL {\r
-  BOOLEAN                 Check4G;      \r
-  UINT32                  Which4G;      \r
-  USBHC_MEM_BLOCK         *Head;\r
+  BOOLEAN            Check4G;\r
+  UINT32             Which4G;\r
+  USBHC_MEM_BLOCK    *Head;\r
 } USBHC_MEM_POOL;\r
 \r
 //\r
 // Memory allocation unit, must be 2^n, n>4\r
 //\r
-#define USBHC_MEM_UNIT           64\r
+#define USBHC_MEM_UNIT  64\r
 \r
 #define USBHC_MEM_UNIT_MASK      (USBHC_MEM_UNIT - 1)\r
 #define USBHC_MEM_DEFAULT_PAGES  16\r
@@ -71,7 +64,22 @@ typedef struct _USBHC_MEM_POOL {
               (Byte)++;       \\r
               (Bit) = 0;      \\r
             }                 \\r
-          } while (0)       \r
+          } while (0)\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