]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Routines supporting partition discovery and\r | |
3 | logical device reading\r | |
4 | \r | |
5 | Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r | |
6 | \r | |
7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
8 | \r | |
9 | **/\r | |
10 | \r | |
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 | |
17 | @param[in] PrivateData The global memory map\r | |
18 | @param[in] ParentBlockDevNo The parent block device\r | |
19 | \r | |
20 | @retval TRUE New partitions are detected and logical block devices\r | |
21 | are added to block device array\r | |
22 | @retval FALSE No new partitions are added\r | |
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 | |
35 | @param[in] PrivateData The global memory map\r | |
36 | @param[in] ParentBlockDevNo The parent block device\r | |
37 | \r | |
38 | @retval TRUE New partitions are detected and logical block devices\r | |
39 | are added to block device array\r | |
40 | @retval FALSE No new partitions are added\r | |
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 | |
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 | |
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 | |
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 | |
100 | }\r | |
101 | }\r | |
102 | }\r | |
103 | } while (Found && PrivateData->BlockDeviceCount <= PEI_FAT_MAX_BLOCK_DEVICE);\r | |
104 | }\r |