]>
Commit | Line | Data |
---|---|---|
2f4dfa84 | 1 | /** @file\r |
e38f26a2 | 2 | Routines supporting partition discovery and\r |
2f4dfa84 JJ |
3 | logical device reading\r |
4 | \r | |
6aac772c | 5 | Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r |
2f4dfa84 | 6 | \r |
eb6cb4ce | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
2f4dfa84 JJ |
8 | \r |
9 | **/\r | |
10 | \r | |
2f4dfa84 JJ |
11 | #include "FatLitePeim.h"\r |
12 | \r | |
13 | /**\r | |
14 | This function finds Eltorito partitions. Main algorithm\r | |
15 | is ported from DXE partition driver.\r | |
16 | \r | |
6aac772c CC |
17 | @param[in] PrivateData The global memory map\r |
18 | @param[in] ParentBlockDevNo The parent block device\r | |
2f4dfa84 | 19 | \r |
e38f26a2 | 20 | @retval TRUE New partitions are detected and logical block devices\r |
6aac772c CC |
21 | are added to block device array\r |
22 | @retval FALSE No new partitions are added\r | |
2f4dfa84 JJ |
23 | \r |
24 | **/\r | |
25 | BOOLEAN\r | |
26 | FatFindEltoritoPartitions (\r | |
27 | IN PEI_FAT_PRIVATE_DATA *PrivateData,\r | |
28 | IN UINTN ParentBlockDevNo\r | |
29 | );\r | |
30 | \r | |
31 | /**\r | |
32 | This function finds Mbr partitions. Main algorithm\r | |
33 | is ported from DXE partition driver.\r | |
34 | \r | |
6aac772c CC |
35 | @param[in] PrivateData The global memory map\r |
36 | @param[in] ParentBlockDevNo The parent block device\r | |
2f4dfa84 | 37 | \r |
e38f26a2 | 38 | @retval TRUE New partitions are detected and logical block devices\r |
6aac772c CC |
39 | are added to block device array\r |
40 | @retval FALSE No new partitions are added\r | |
2f4dfa84 JJ |
41 | \r |
42 | **/\r | |
43 | BOOLEAN\r | |
44 | FatFindMbrPartitions (\r | |
45 | IN PEI_FAT_PRIVATE_DATA *PrivateData,\r | |
46 | IN UINTN ParentBlockDevNo\r | |
47 | );\r | |
48 | \r | |
0d18f5db CC |
49 | /**\r |
50 | This function is used for finding GPT partition on block device.\r | |
51 | As follow UEFI spec we should check protective MBR first and then\r | |
52 | try to check both primary/backup GPT structures.\r | |
53 | \r | |
54 | @param[in] PrivateData The global memory map\r | |
55 | @param[in] ParentBlockDevNo The parent block device\r | |
56 | \r | |
57 | @retval TRUE New partitions are detected and logical block devices\r | |
58 | are added to block device array\r | |
59 | @retval FALSE No new partitions are added\r | |
60 | \r | |
61 | **/\r | |
62 | BOOLEAN\r | |
63 | FatFindGptPartitions (\r | |
64 | IN PEI_FAT_PRIVATE_DATA *PrivateData,\r | |
65 | IN UINTN ParentBlockDevNo\r | |
66 | );\r | |
67 | \r | |
2f4dfa84 JJ |
68 | /**\r |
69 | This function finds partitions (logical devices) in physical block devices.\r | |
70 | \r | |
71 | @param PrivateData Global memory map for accessing global variables.\r | |
72 | \r | |
73 | **/\r | |
74 | VOID\r | |
75 | FatFindPartitions (\r | |
76 | IN PEI_FAT_PRIVATE_DATA *PrivateData\r | |
77 | )\r | |
78 | {\r | |
79 | BOOLEAN Found;\r | |
80 | UINTN Index;\r | |
81 | \r | |
82 | do {\r | |
83 | Found = FALSE;\r | |
84 | \r | |
85 | for (Index = 0; Index < PrivateData->BlockDeviceCount; Index++) {\r | |
86 | if (!PrivateData->BlockDevice[Index].PartitionChecked) {\r | |
0d18f5db CC |
87 | if (FatFindGptPartitions (PrivateData, Index)) {\r |
88 | Found = TRUE;\r | |
89 | continue;\r | |
90 | }\r | |
91 | \r | |
92 | if (FatFindMbrPartitions (PrivateData, Index)) {\r | |
93 | Found = TRUE;\r | |
94 | continue;\r | |
95 | }\r | |
96 | \r | |
97 | if (FatFindEltoritoPartitions (PrivateData, Index)) {\r | |
98 | Found = TRUE;\r | |
99 | continue;\r | |
2f4dfa84 JJ |
100 | }\r |
101 | }\r | |
102 | }\r | |
103 | } while (Found && PrivateData->BlockDeviceCount <= PEI_FAT_MAX_BLOCK_DEVICE);\r | |
104 | }\r |