1/*++
2
3  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
4
5
6  This program and the accompanying materials are licensed and made available under
7
8  the terms and conditions of the BSD License that accompanies this distribution.
9
10  The full text of the license may be found at
11
12  http://opensource.org/licenses/bsd-license.php.
13
14
15
16  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17
18  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19
20
21
22
23
24**/
25
26
27#ifndef __PEI_PLATFORM_H__
28#define __PEI_PLATFORM_H__
29
30#define PEI_STALL_RESOLUTION            1
31#define STALL_PEIM_SIGNATURE   SIGNATURE_32('p','p','u','s')
32
33typedef struct {
34  UINT32                      Signature;
35  EFI_FFS_FILE_HEADER         *FfsHeader;
36  EFI_PEI_NOTIFY_DESCRIPTOR   StallNotify;
37} STALL_CALLBACK_STATE_INFORMATION;
38
39#define STALL_PEIM_FROM_THIS(a) CR (a, STALL_CALLBACK_STATE_INFORMATION, StallNotify, STALL_PEIM_SIGNATURE)
40
41#ifdef NOCS_S3_SUPPORT
42
43/**
44  Peform the boot mode determination logic
45  If the box is closed, then
46  1. If it's first time to boot, it's boot with full config .
47  2. If the ChassisIntrution is selected, force to be a boot with full config
48  3. Otherwise it's boot with no change.
49
50  @param  PeiServices General purpose services available to every PEIM.
51  @param  BootMode The detected boot mode.
52
53  @retval EFI_SUCCESS if the boot mode could be set
54**/
55EFI_STATUS
56UpdateBootMode (
57  IN CONST EFI_PEI_SERVICES     **PeiServices
58  );
59#endif
60
61/**
62  This function reset the entire platform, including all processor and devices, and
63  reboots the system.
64
65  @param  PeiServices General purpose services available to every PEIM.
66
67  @retval EFI_SUCCESS if it completed successfully.
68**/
69EFI_STATUS
70EFIAPI
71ResetSystem (
72  IN CONST EFI_PEI_SERVICES          **PeiServices
73  );
74
75/**
76  This function will be called when MRC is done.
77
78  @param  PeiServices        General purpose services available to every PEIM.
79  @param  NotifyDescriptor   Information about the notify event..
80  @param  Ppi                The notify context.
81
82  @retval EFI_SUCCESS        If the function completed successfully.
83**/
84EFI_STATUS
85EFIAPI
86MemoryDiscoveredPpiNotifyCallback (
87  IN EFI_PEI_SERVICES                     **PeiServices,
88  IN EFI_PEI_NOTIFY_DESCRIPTOR            *NotifyDescriptor,
89  IN VOID                                 *Ppi
90  );
91
92/**
93  This is the callback function notified by FvFileLoader PPI, it depends on FvFileLoader PPI to load
94  the PEIM into memory.
95
96  @param  PeiServices       General purpose services available to every PEIM.
97  @param  NotifyDescriptor  The context of notification.
98  @param  Ppi               The notify PPI.
99
100  @retval EFI_SUCCESS       if it completed successfully.
101**/
102EFI_STATUS
103EFIAPI
104FvFileLoaderPpiNotifyCallback (
105  IN EFI_PEI_SERVICES           **PeiServices,
106  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,
107  IN VOID                       *Ppi
108  );
109
110/**
111  This function provides a blocking stall for reset at least the given number of microseconds
112  stipulated in the final argument.
113
114  @param  PeiServices    General purpose services available to every PEIM.
115  @param  this Pointer   to the local data for the interface.
116  @param  Microseconds   number of microseconds for which to stall.
117
118  @retval EFI_SUCCESS    the function provided at least the required stall.
119**/
120EFI_STATUS
121EFIAPI
122Stall (
123  IN CONST EFI_PEI_SERVICES   **PeiServices,
124  IN CONST EFI_PEI_STALL_PPI  *This,
125  IN UINTN                    Microseconds
126  );
127
128/**
129  This function initialize recovery functionality by installing the recovery PPI.
130
131  @param  PeiServices  General purpose services available to every PEIM.
132
133  @retval EFI_SUCCESS  If the interface could be successfully installed.
134**/
135EFI_STATUS
136EFIAPI
137InitializeRecovery (
138  IN EFI_PEI_SERVICES     **PeiServices
139  );
140
141/**
142  This function
143    1. Calling MRC to initialize memory.
144    2. Install EFI Memory.
145    3. Capsule coalesce if capsule boot mode.
146    4. Create HOB of system memory.
147
148  @param  PeiServices Pointer to the PEI Service Table
149
150  @retval EFI_SUCCESS If it completes successfully.
151
152**/
153EFI_STATUS
154MemoryInit (
155  IN EFI_PEI_SERVICES          **PeiServices
156  );
157
158/**
159  This function provides the implementation of AtaController PPI Enable Channel function.
160
161  @param  PeiServices General purpose services available to every PEIM.
162  @param  this Pointer to the local data for the interface.
163  @param  ChannelMask This parameter is used to specify primary or slavery IDE channel.
164
165  @retval EFI_SUCCESS  Procedure returned successfully.
166**/
167EFI_STATUS
168EnableAtaChannel (
169  IN EFI_PEI_SERVICES               **PeiServices,
170  IN PEI_ATA_CONTROLLER_PPI         *This,
171  IN UINT8                          ChannelMask
172  );
173
174/**
175  This function provides the implementation of AtaController PPI Get IDE channel Register Base Address
176
177  @param  PeiServices      General purpose services available to every PEIM.
178  @param  this             Pointer to the local data for the interface.
179  @param  IdeRegsBaseAddr  Pointer to IDE_REGS_BASE_ADDR struct, which is used to record
180                           IDE Command and Control regeisters Base Address.
181
182  @retval EFI_SUCCESS  Procedure returned successfully.
183**/
184EFI_STATUS
185GetIdeRegsBaseAddr (
186  IN EFI_PEI_SERVICES               **PeiServices,
187  IN PEI_ATA_CONTROLLER_PPI         *This,
188  IN IDE_REGS_BASE_ADDR             *IdeRegsBaseAddr
189  );
190
191/**
192  This function provides the implementation to properly setup both LM & PDM functionality.
193
194  @param  PeiServices      General purpose services available to every PEIM.
195
196  @retval EFI_SUCCESS  Procedure returned successfully.
197
198**/
199EFI_STATUS
200ConfigureLM(
201  IN EFI_PEI_SERVICES **PeiServices
202  );
203
204#include <Ppi/VlvMmioPolicy.h>
205
206BOOLEAN
207EFIAPI
208IsFastBootEnabled (
209  IN CONST EFI_PEI_SERVICES **PeiServices
210  );
211
212EFI_STATUS
213PrioritizeBootMode (
214  IN OUT EFI_BOOT_MODE    *CurrentBootMode,
215  IN EFI_BOOT_MODE        NewBootMode
216  );
217
218EFI_STATUS
219EFIAPI
220CapsulePpiNotifyCallback (
221  IN EFI_PEI_SERVICES           **PeiServices,
222  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,
223  IN VOID                       *Ppi
224  );
225#endif
226