]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Sd/EmmcBlockIoPei/EmmcHcMem.h
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Bus / Sd / EmmcBlockIoPei / EmmcHcMem.h
CommitLineData
48555339
FT
1/** @file\r
2\r
85ad9a6e 3Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
48555339 4\r
9d510e61 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
48555339
FT
6\r
7**/\r
8\r
9#ifndef _EMMC_PEIM_MEM_H_\r
10#define _EMMC_PEIM_MEM_H_\r
11\r
1436aea4 12#define EMMC_PEIM_MEM_BIT(a) ((UINTN)(1 << (a)))\r
48555339
FT
13\r
14#define EMMC_PEIM_MEM_BIT_IS_SET(Data, Bit) \\r
15 ((BOOLEAN)(((Data) & EMMC_PEIM_MEM_BIT(Bit)) == EMMC_PEIM_MEM_BIT(Bit)))\r
16\r
17typedef struct _EMMC_PEIM_MEM_BLOCK EMMC_PEIM_MEM_BLOCK;\r
18\r
19struct _EMMC_PEIM_MEM_BLOCK {\r
1436aea4
MK
20 UINT8 *Bits; // Bit array to record which unit is allocated\r
21 UINTN BitsLen;\r
22 UINT8 *Buf;\r
23 UINT8 *BufHost;\r
24 UINTN BufLen; // Memory size in bytes\r
25 VOID *Mapping;\r
26 EMMC_PEIM_MEM_BLOCK *Next;\r
48555339
FT
27};\r
28\r
29typedef struct _EMMC_PEIM_MEM_POOL {\r
1436aea4 30 EMMC_PEIM_MEM_BLOCK *Head;\r
48555339
FT
31} EMMC_PEIM_MEM_POOL;\r
32\r
33//\r
34// Memory allocation unit, note that the value must meet EMMC spec alignment requirement.\r
35//\r
1436aea4 36#define EMMC_PEIM_MEM_UNIT 128\r
48555339
FT
37\r
38#define EMMC_PEIM_MEM_UNIT_MASK (EMMC_PEIM_MEM_UNIT - 1)\r
39#define EMMC_PEIM_MEM_DEFAULT_PAGES 16\r
40\r
1436aea4 41#define EMMC_PEIM_MEM_ROUND(Len) (((Len) + EMMC_PEIM_MEM_UNIT_MASK) & (~EMMC_PEIM_MEM_UNIT_MASK))\r
48555339
FT
42\r
43//\r
44// Advance the byte and bit to the next bit, adjust byte accordingly.\r
45//\r
46#define EMMC_PEIM_NEXT_BIT(Byte, Bit) \\r
47 do { \\r
48 (Bit)++; \\r
49 if ((Bit) > 7) { \\r
50 (Byte)++; \\r
51 (Bit) = 0; \\r
52 } \\r
53 } while (0)\r
54\r
55#endif\r