]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Sd/SdBlockIoPei/SdHcMem.h
IntelSiliconPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Bus / Sd / SdBlockIoPei / SdHcMem.h
CommitLineData
48555339
FT
1/** @file\r
2\r
77af8668 3Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
48555339
FT
4\r
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 _SD_PEIM_MEM_H_\r
17#define _SD_PEIM_MEM_H_\r
18\r
19#define SD_PEIM_MEM_BIT(a) ((UINTN)(1 << (a)))\r
20\r
21#define SD_PEIM_MEM_BIT_IS_SET(Data, Bit) \\r
22 ((BOOLEAN)(((Data) & SD_PEIM_MEM_BIT(Bit)) == SD_PEIM_MEM_BIT(Bit)))\r
23\r
24typedef struct _SD_PEIM_MEM_BLOCK SD_PEIM_MEM_BLOCK;\r
25\r
26struct _SD_PEIM_MEM_BLOCK {\r
27 UINT8 *Bits; // Bit array to record which unit is allocated\r
28 UINTN BitsLen;\r
29 UINT8 *Buf;\r
77af8668 30 UINT8 *BufHost;\r
48555339 31 UINTN BufLen; // Memory size in bytes\r
77af8668 32 VOID *Mapping;\r
48555339
FT
33 SD_PEIM_MEM_BLOCK *Next;\r
34};\r
35\r
36typedef struct _SD_PEIM_MEM_POOL {\r
37 SD_PEIM_MEM_BLOCK *Head;\r
38} SD_PEIM_MEM_POOL;\r
39\r
40//\r
41// Memory allocation unit, note that the value must meet SD spec alignment requirement.\r
42//\r
43#define SD_PEIM_MEM_UNIT 128\r
44\r
45#define SD_PEIM_MEM_UNIT_MASK (SD_PEIM_MEM_UNIT - 1)\r
46#define SD_PEIM_MEM_DEFAULT_PAGES 16\r
47\r
48#define SD_PEIM_MEM_ROUND(Len) (((Len) + SD_PEIM_MEM_UNIT_MASK) & (~SD_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 SD_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