[BOOTMGFW]
[reactos.git] / reactos / boot / environ / lib / bootlib.c
1 /*
2 * COPYRIGHT: See COPYING.ARM in the top level directory
3 * PROJECT: ReactOS UEFI Boot Library
4 * FILE: boot/environ/lib/bootlib.c
5 * PURPOSE: Boot Library Initialization
6 * PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9 /* INCLUDES ******************************************************************/
10
11 #include "bl.h"
12
13 /* DATA VARIABLES ************************************************************/
14
15 BL_LIBRARY_PARAMETERS BlpLibraryParameters;
16
17 /* FUNCTIONS *****************************************************************/
18
19 /*++
20 * @name InitializeLibrary
21 *
22 * The InitializeLibrary function initializes the Boot Library.
23 *
24 * @param BootParameters
25 * Pointer to the Boot Application Parameter Block.
26 *
27 * @param LibraryParameters
28 * Pointer to the Boot Library Parameters.
29 *
30 * @return NT_SUCCESS if the boot library was loaded correctly, relevant error
31 * otherwise.
32 *
33 *--*/
34 NTSTATUS
35 InitializeLibrary (
36 _In_ PBOOT_APPLICATION_PARAMETER_BLOCK BootAppParameters,
37 _In_ PBL_LIBRARY_PARAMETERS LibraryParameters
38 )
39 {
40 DBG_UNREFERENCED_PARAMETER(BootAppParameters);
41 DBG_UNREFERENCED_PARAMETER(LibraryParameters);
42
43 return STATUS_NOT_IMPLEMENTED;
44 }
45
46 /*++
47 * @name BlInitializeLibrary
48 *
49 * The BlInitializeLibrary function initializes, or re-initializes, the
50 * Boot Library.
51 *
52 * @param BootParameters
53 * Pointer to the Boot Application Parameter Block.
54 *
55 * @param LibraryParameters
56 * Pointer to the Boot Library Parameters.
57 *
58 * @return NT_SUCCESS if the boot library was loaded correctly, relevant error
59 * otherwise.
60 *
61 *--*/
62 NTSTATUS
63 BlInitializeLibrary(
64 _In_ PBOOT_APPLICATION_PARAMETER_BLOCK BootAppParameters,
65 _In_ PBL_LIBRARY_PARAMETERS LibraryParameters
66 )
67 {
68 NTSTATUS Status;
69
70 /* Are we re-initializing the library? */
71 if (LibraryParameters->LibraryFlags & 2)
72 {
73 /* From scratch? */
74 BlpLibraryParameters = *LibraryParameters;
75 if (LibraryParameters->LibraryFlags & 4)
76 {
77 #if 0
78 /* Initialize all the core modules again */
79 BlpSiInitialize(1);
80 BlBdInitialize();
81 BlMmRemoveBadMemory();
82 BlpMmInitializeConstraints();
83
84 /* Redraw the graphics console as needed */
85 BlpDisplayInitialize(LibraryParameters->LibraryFlags);
86 BlpResourceInitialize();
87 #endif
88 }
89
90 /* Nothing to do, we're done */
91 Status = STATUS_SUCCESS;
92 }
93 else
94 {
95 /* Nope, this is first time initialization */
96 Status = InitializeLibrary(BootAppParameters, LibraryParameters);
97 }
98
99 /* Return initialization status */
100 return Status;
101 }
102