]> git.proxmox.com Git - mirror_edk2.git/blame - FatPkg/FatPei/Part.c
FatPkg: Break down Part.c file.
[mirror_edk2.git] / FatPkg / FatPei / Part.c
CommitLineData
2f4dfa84 1/** @file\r
e38f26a2 2 Routines supporting partition discovery and\r
2f4dfa84
JJ
3 logical device reading\r
4\r
6aac772c 5Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
2f4dfa84
JJ
6\r
7This program and the accompanying materials are licensed and made available\r
8under the terms and conditions of the BSD License which accompanies this\r
9distribution. The full text of the license may be found at\r
10http://opensource.org/licenses/bsd-license.php\r
11\r
12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13WITHOUT 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
31BOOLEAN\r
32FatFindEltoritoPartitions (\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
49BOOLEAN\r
50FatFindMbrPartitions (\r
51 IN PEI_FAT_PRIVATE_DATA *PrivateData,\r
52 IN UINTN ParentBlockDevNo\r
53 );\r
54\r
2f4dfa84
JJ
55/**\r
56 This function finds partitions (logical devices) in physical block devices.\r
57\r
58 @param PrivateData Global memory map for accessing global variables.\r
59\r
60**/\r
61VOID\r
62FatFindPartitions (\r
63 IN PEI_FAT_PRIVATE_DATA *PrivateData\r
64 )\r
65{\r
66 BOOLEAN Found;\r
67 UINTN Index;\r
68\r
69 do {\r
70 Found = FALSE;\r
71\r
72 for (Index = 0; Index < PrivateData->BlockDeviceCount; Index++) {\r
73 if (!PrivateData->BlockDevice[Index].PartitionChecked) {\r
74 Found = FatFindMbrPartitions (PrivateData, Index);\r
75 if (!Found) {\r
76 Found = FatFindEltoritoPartitions (PrivateData, Index);\r
77 }\r
78 }\r
79 }\r
80 } while (Found && PrivateData->BlockDeviceCount <= PEI_FAT_MAX_BLOCK_DEVICE);\r
81}\r
82\r