\r
Routine procedures for memory allocate/free.\r
\r
-Copyright (c) 2013 - 2015, 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
-\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
+Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
Bit = ((ToFree - Block->BufHost) / USBHC_MEM_UNIT) % 8;\r
\r
//\r
- // reset associated bits in bit arry\r
+ // reset associated bits in bit array\r
//\r
for (Count = 0; Count < (AllocSize / USBHC_MEM_UNIT); Count++) {\r
ASSERT (USB_HC_BIT_IS_SET (Block->Bits[Byte], Bit));\r
return ;\r
}\r
\r
-/** \r
+/**\r
Allocates pages at a specified alignment that are suitable for an EfiPciIoOperationBusMasterCommonBuffer mapping.\r
- \r
+\r
If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
\r
@param PciIo The PciIo that can be used to access the host controller.\r
@param Pages The number of pages to allocate.\r
@param Alignment The requested alignment of the allocation. Must be a power of two.\r
@param HostAddress The system memory address to map to the PCI controller.\r
- @param DeviceAddress The resulting map address for the bus master PCI controller to \r
+ @param DeviceAddress The resulting map address for the bus master PCI controller to\r
use to access the hosts HostAddress.\r
@param Mapping A resulting value to pass to Unmap().\r
\r
@retval EFI_SUCCESS Success to allocate aligned pages.\r
@retval EFI_INVALID_PARAMETER Pages or Alignment is not valid.\r
@retval EFI_OUT_OF_RESOURCES Do not have enough resources to allocate memory.\r
- \r
+\r
\r
**/\r
EFI_STATUS\r
// Alignment must be a power of two or zero.\r
//\r
ASSERT ((Alignment & (Alignment - 1)) == 0);\r
- \r
+\r
if ((Alignment & (Alignment - 1)) != 0) {\r
return EFI_INVALID_PARAMETER;\r
}\r
- \r
+\r
if (Pages == 0) {\r
return EFI_INVALID_PARAMETER;\r
}\r
// Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.\r
//\r
ASSERT (RealPages > Pages);\r
- \r
+\r
Status = PciIo->AllocateBuffer (\r
PciIo,\r
AllocateAnyPages,\r
Pages,\r
&Memory,\r
0\r
- ); \r
+ );\r
if (EFI_ERROR (Status)) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
Status = PciIo->FreeBuffer (PciIo, Pages, (VOID *) AlignedMemory);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
- \r
+\r
*HostAddress = (VOID *) AlignedMemory;\r
\r
return EFI_SUCCESS;\r
\r
/**\r
Frees memory that was allocated with UsbHcAllocateAlignedPages().\r
- \r
+\r
@param PciIo The PciIo that can be used to access the host controller.\r
@param HostAddress The system memory address to map to the PCI controller.\r
@param Pages The number of 4 KB pages to free.\r
)\r
{\r
EFI_STATUS Status;\r
- \r
+\r
ASSERT (Pages != 0);\r
- \r
+\r
Status = PciIo->Unmap (PciIo, Mapping);\r
ASSERT_EFI_ERROR (Status);\r
\r
PciIo,\r
Pages,\r
HostAddress\r
- ); \r
+ );\r
ASSERT_EFI_ERROR (Status);\r
}\r