]>
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 JJ |
6 | \r |
7 | This program and the accompanying materials are licensed and made available\r | |
8 | under the terms and conditions of the BSD License which accompanies this\r | |
9 | distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
2f4dfa84 JJ |
17 | #include "FatLitePeim.h"\r |
18 | \r | |
19 | /**\r | |
20 | This function finds Eltorito partitions. Main algorithm\r | |
21 | is ported from DXE partition driver.\r | |
22 | \r | |
6aac772c CC |
23 | @param[in] PrivateData The global memory map\r |
24 | @param[in] ParentBlockDevNo The parent block device\r | |
2f4dfa84 | 25 | \r |
e38f26a2 | 26 | @retval TRUE New partitions are detected and logical block devices\r |
6aac772c CC |
27 | are added to block device array\r |
28 | @retval FALSE No new partitions are added\r | |
2f4dfa84 JJ |
29 | \r |
30 | **/\r | |
31 | BOOLEAN\r | |
32 | FatFindEltoritoPartitions (\r | |
33 | IN PEI_FAT_PRIVATE_DATA *PrivateData,\r | |
34 | IN UINTN ParentBlockDevNo\r | |
35 | );\r | |
36 | \r | |
37 | /**\r | |
38 | This function finds Mbr partitions. Main algorithm\r | |
39 | is ported from DXE partition driver.\r | |
40 | \r | |
6aac772c CC |
41 | @param[in] PrivateData The global memory map\r |
42 | @param[in] ParentBlockDevNo The parent block device\r | |
2f4dfa84 | 43 | \r |
e38f26a2 | 44 | @retval TRUE New partitions are detected and logical block devices\r |
6aac772c CC |
45 | are added to block device array\r |
46 | @retval FALSE No new partitions are added\r | |
2f4dfa84 JJ |
47 | \r |
48 | **/\r | |
49 | BOOLEAN\r | |
50 | FatFindMbrPartitions (\r | |
51 | IN PEI_FAT_PRIVATE_DATA *PrivateData,\r | |
52 | IN UINTN ParentBlockDevNo\r | |
53 | );\r | |
54 | \r | |
0d18f5db CC |
55 | /**\r |
56 | This function is used for finding GPT partition on block device.\r | |
57 | As follow UEFI spec we should check protective MBR first and then\r | |
58 | try to check both primary/backup GPT structures.\r | |
59 | \r | |
60 | @param[in] PrivateData The global memory map\r | |
61 | @param[in] ParentBlockDevNo The parent block device\r | |
62 | \r | |
63 | @retval TRUE New partitions are detected and logical block devices\r | |
64 | are added to block device array\r | |
65 | @retval FALSE No new partitions are added\r | |
66 | \r | |
67 | **/\r | |
68 | BOOLEAN\r | |
69 | FatFindGptPartitions (\r | |
70 | IN PEI_FAT_PRIVATE_DATA *PrivateData,\r | |
71 | IN UINTN ParentBlockDevNo\r | |
72 | );\r | |
73 | \r | |
2f4dfa84 JJ |
74 | /**\r |
75 | This function finds partitions (logical devices) in physical block devices.\r | |
76 | \r | |
77 | @param PrivateData Global memory map for accessing global variables.\r | |
78 | \r | |
79 | **/\r | |
80 | VOID\r | |
81 | FatFindPartitions (\r | |
82 | IN PEI_FAT_PRIVATE_DATA *PrivateData\r | |
83 | )\r | |
84 | {\r | |
85 | BOOLEAN Found;\r | |
86 | UINTN Index;\r | |
87 | \r | |
88 | do {\r | |
89 | Found = FALSE;\r | |
90 | \r | |
91 | for (Index = 0; Index < PrivateData->BlockDeviceCount; Index++) {\r | |
92 | if (!PrivateData->BlockDevice[Index].PartitionChecked) {\r | |
0d18f5db CC |
93 | if (FatFindGptPartitions (PrivateData, Index)) {\r |
94 | Found = TRUE;\r | |
95 | continue;\r | |
96 | }\r | |
97 | \r | |
98 | if (FatFindMbrPartitions (PrivateData, Index)) {\r | |
99 | Found = TRUE;\r | |
100 | continue;\r | |
101 | }\r | |
102 | \r | |
103 | if (FatFindEltoritoPartitions (PrivateData, Index)) {\r | |
104 | Found = TRUE;\r | |
105 | continue;\r | |
2f4dfa84 JJ |
106 | }\r |
107 | }\r | |
108 | }\r | |
109 | } while (Found && PrivateData->BlockDeviceCount <= PEI_FAT_MAX_BLOCK_DEVICE);\r | |
110 | }\r |