]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHcMem.h
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Bus / Ufs / UfsBlockIoPei / UfsHcMem.h
CommitLineData
0591696e
FT
1/** @file\r
2\r
d1102dba
LG
3Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>\r
4\r
0591696e
FT
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions\r
7of the BSD License which accompanies this distribution. The\r
8full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _UFS_PEIM_MEM_H_\r
17#define _UFS_PEIM_MEM_H_\r
18\r
19#define UFS_PEIM_MEM_BIT(a) ((UINTN)(1 << (a)))\r
20\r
21#define UFS_PEIM_MEM_BIT_IS_SET(Data, Bit) \\r
22 ((BOOLEAN)(((Data) & UFS_PEIM_MEM_BIT(Bit)) == UFS_PEIM_MEM_BIT(Bit)))\r
23\r
24typedef struct _UFS_PEIM_MEM_BLOCK UFS_PEIM_MEM_BLOCK;\r
25\r
26struct _UFS_PEIM_MEM_BLOCK {\r
27 UINT8 *Bits; // Bit array to record which unit is allocated\r
d1102dba 28 UINTN BitsLen;\r
0591696e 29 UINT8 *Buf;\r
44a0857e 30 UINT8 *BufHost;\r
0591696e 31 UINTN BufLen; // Memory size in bytes\r
44a0857e 32 VOID *Mapping;\r
0591696e
FT
33 UFS_PEIM_MEM_BLOCK *Next;\r
34};\r
35\r
36typedef struct _UFS_PEIM_MEM_POOL {\r
37 UFS_PEIM_MEM_BLOCK *Head;\r
38} UFS_PEIM_MEM_POOL;\r
39\r
40//\r
41// Memory allocation unit, note that the value must meet UFS spec alignment requirement.\r
42//\r
43#define UFS_PEIM_MEM_UNIT 128\r
44\r
45#define UFS_PEIM_MEM_UNIT_MASK (UFS_PEIM_MEM_UNIT - 1)\r
46#define UFS_PEIM_MEM_DEFAULT_PAGES 16\r
47\r
48#define UFS_PEIM_MEM_ROUND(Len) (((Len) + UFS_PEIM_MEM_UNIT_MASK) & (~UFS_PEIM_MEM_UNIT_MASK))\r
49\r
50//\r
51// Advance the byte and bit to the next bit, adjust byte accordingly.\r
52//\r
53#define UFS_PEIM_NEXT_BIT(Byte, Bit) \\r
54 do { \\r
55 (Bit)++; \\r
56 if ((Bit) > 7) { \\r
57 (Byte)++; \\r
58 (Bit) = 0; \\r
59 } \\r
60 } while (0)\r
61\r
62#endif\r
63\r