1 /** @file
2   Platform BDS library definition. A platform can implement
3   instances to support platform-specific behavior.
4 
5 Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials are licensed and made available under
7 the terms and conditions of the BSD License that accompanies this distribution.
8 The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
10 
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 #ifndef __PLATFORM_BDS_LIB_H_
17 #define __PLATFORM_BDS_LIB_H_
18 
19 #include <Protocol/GenericMemoryTest.h>
20 #include <Library/GenericBdsLib.h>
21 
22 /**
23   Perform the memory test base on the memory test intensive level,
24   and update the memory resource.
25 
26   @param  Level         The memory test intensive level.
27 
28   @retval EFI_STATUS    Successfully test all the system memory, and update
29                         the memory resource
30 
31 **/
32 typedef
33 EFI_STATUS
34 (EFIAPI *BASEM_MEMORY_TEST)(
35   IN EXTENDMEM_COVERAGE_LEVEL Level
36   );
37 
38 /**
39   This routine is called to see if there are any capsules we need to process.
40   If the boot mode is not UPDATE, then we do nothing. Otherwise, find the
41   capsule HOBS and produce firmware volumes for them via the DXE service.
42   Then call the dispatcher to dispatch drivers from them. Finally, check
43   the status of the updates.
44 
45   This function should be called by BDS in case we need to do some
46   sort of processing even if there is no capsule to process. We
47   need to do this if an earlier update went away and we need to
48   clear the capsule variable so on the next reset PEI does not see it and
49   think there is a capsule available.
50 
51   @param BootMode                 The current boot mode
52 
53   @retval EFI_INVALID_PARAMETER   The boot mode is not correct for an update.
54   @retval EFI_SUCCESS             There is no error when processing a capsule.
55 
56 **/
57 typedef
58 EFI_STATUS
59 (EFIAPI *PROCESS_CAPSULES)(
60   IN EFI_BOOT_MODE BootMode
61   );
62 
63 /**
64   Platform Bds initialization. Includes the platform firmware vendor, revision
65   and so crc check.
66 
67 **/
68 VOID
69 EFIAPI
70 PlatformBdsInit (
71   VOID
72   );
73 
74 /**
75   The function will excute with as the platform policy, current policy
76   is driven by boot mode. IBV/OEM can customize this code for their specific
77   policy action.
78 
79   @param  DriverOptionList        The header of the driver option link list
80   @param  BootOptionList          The header of the boot option link list
81   @param  ProcessCapsules         A pointer to ProcessCapsules()
82   @param  BaseMemoryTest          A pointer to BaseMemoryTest()
83 
84 **/
85 VOID
86 EFIAPI
87 PlatformBdsPolicyBehavior (
88   IN LIST_ENTRY                      *DriverOptionList,
89   IN LIST_ENTRY                      *BootOptionList,
90   IN PROCESS_CAPSULES                ProcessCapsules,
91   IN BASEM_MEMORY_TEST               BaseMemoryTest
92   );
93 
94 /**
95   Hook point for a user-provided function, for after a boot attempt fails.
96 
97   @param  Option                  A pointer to Boot Option that failed to boot.
98   @param  Status                  The status returned from failed boot.
99   @param  ExitData                The exit data returned from failed boot.
100   @param  ExitDataSize            The exit data size returned from failed boot.
101 
102 **/
103 VOID
104 EFIAPI
105 PlatformBdsBootFail (
106   IN  BDS_COMMON_OPTION  *Option,
107   IN  EFI_STATUS         Status,
108   IN  CHAR16             *ExitData,
109   IN  UINTN              ExitDataSize
110   );
111 
112 /**
113   Hook point after a boot attempt succeeds. We don't expect a boot option to
114   return, so the UEFI 2.0 specification defines that you will default to an
115   interactive mode and stop processing the BootOrder list in this case. This
116   is also a platform implementation, and can be customized by an IBV/OEM.
117 
118   @param  Option                  A pointer to the Boot Option that successfully booted.
119 
120 **/
121 VOID
122 EFIAPI
123 PlatformBdsBootSuccess (
124   IN  BDS_COMMON_OPTION  *Option
125   );
126 
127 
128 /**
129   This function locks platform flash that is not allowed to be updated during normal boot path.
130   The flash layout is platform specific.
131 
132   **/
133 VOID
134 EFIAPI
135 PlatformBdsLockNonUpdatableFlash (
136   VOID
137   );
138 
139 /**
140   Lock the ConsoleIn device in system table. All key
141   presses will be ignored until the Password is typed in. The only way to
142   disable the password is to type it in to a ConIn device.
143 
144   @param  Password        The password used to lock ConIn device.
145 
146   @retval EFI_SUCCESS     Lock the Console In Spliter virtual handle successfully.
147   @retval EFI_UNSUPPORTED Password not found.
148 
149 **/
150 EFI_STATUS
151 EFIAPI
152 LockKeyboards (
153   IN  CHAR16    *Password
154   );
155 
156 #endif
157