]> git.proxmox.com Git - mirror_edk2.git/blame - SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Pei.c
Add DebugCommunicationLibUsb3 for USB3.0 source level debug support.
[mirror_edk2.git] / SourceLevelDebugPkg / Library / DebugCommunicationLibUsb3 / DebugCommunicationLibUsb3Pei.c
CommitLineData
2cb6eabe
EL
1/** @file\r
2 Debug Port Library implementation based on usb3 debug port.\r
3\r
4 Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php.\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include <PiPei.h>\r
16#include <Library/PeiServicesLib.h>\r
17#include "DebugCommunicationLibUsb3Internal.h"\r
18\r
19/**\r
20 Allocate aligned memory for XHC's usage.\r
21\r
22 @param BufferSize The size, in bytes, of the Buffer.\r
23 \r
24 @return A pointer to the allocated buffer or NULL if allocation fails.\r
25\r
26**/\r
27VOID*\r
28AllocateAlignBuffer (\r
29 IN UINTN BufferSize\r
30 )\r
31{\r
32 VOID *Buf;\r
33 EFI_PHYSICAL_ADDRESS Address;\r
34 EFI_STATUS Status;\r
35 \r
36 Buf = NULL; \r
37 Status = PeiServicesAllocatePages (EfiACPIMemoryNVS, EFI_SIZE_TO_PAGES (BufferSize), &Address);\r
38 if (EFI_ERROR (Status)) {\r
39 Buf = NULL;\r
40 } else {\r
41 Buf = (VOID *)(UINTN) Address;\r
42 }\r
43 return Buf;\r
44}\r
45\r