summaryrefslogtreecommitdiff
path: root/EdkCompatibilityPkg/Sample/Platform/Generic/MonoStatusCode/Library/Pei/MemoryStatusCode/MemoryStatusCode.h
blob: 11a819681202edcc6d7db08b7342cc116a9dba62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*++

Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials                          
are licensed and made available under the terms and conditions of the BSD License         
which accompanies this distribution.  The full text of the license may be found at        
http://opensource.org/licenses/bsd-license.php                                            
                                                                                          
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

Module Name:
  
  MemoryStatusCode.h
   
Abstract:

  Lib to provide status code reporting via memory.

--*/

#ifndef _PEI_MEMORY_STATUS_CODE_H_
#define _PEI_MEMORY_STATUS_CODE_H_

//
// Statements that include other files
//
#include "Tiano.h"
#include "Pei.h"
#include "SimpleCpuIoLib.h"
#include "EfiCommonLib.h"

//
// Produced PPI
//
#include EFI_PPI_PRODUCER (StatusCodeMemory)
#include EFI_PPI_PRODUCER (StatusCode)

//
// Ppi Consumed For Notification
//
#include EFI_PPI_CONSUMER (MemoryDiscovered)
#if (PI_SPECIFICATION_VERSION < 0x00010000)
#include EFI_PPI_CONSUMER (LoadFile)
#endif
//
// Private data
//
//
// Define the amount of heap to use before memory is allocated
//
#define PEI_STATUS_CODE_HEAP_LENGTH     512
#define PEI_STATUS_CODE_MAX_HEAP_ENTRY  (PEI_STATUS_CODE_HEAP_LENGTH / sizeof (EFI_STATUS_CODE_ENTRY))

//
// Define the number of 4K pages of BS memory to allocate (1MB)
//
#define PEI_STATUS_CODE_RT_PAGES      (128)
#define PEI_STATUS_CODE_RT_LENGTH     (PEI_STATUS_CODE_RT_PAGES * 1024 * 4)
#define PEI_STATUS_CODE_MAX_RT_ENTRY  (PEI_STATUS_CODE_RT_LENGTH / sizeof (EFI_STATUS_CODE_ENTRY))

//
// Define a private data structure
//
#define MEMORY_STATUS_CODE_SIGNATURE  EFI_SIGNATURE_32 ('M', 'S', 'C', 'S')

typedef struct _MEMORY_STATUS_CODE_INSTANCE {
  UINT32                              Signature;
  struct _MEMORY_STATUS_CODE_INSTANCE *This;
  EFI_FFS_FILE_HEADER                 *FfsHeader;
  EFI_PEI_PPI_DESCRIPTOR              PpiDescriptor;
  PEI_STATUS_CODE_MEMORY_PPI          StatusCodeMemoryPpi;
#if (PI_SPECIFICATION_VERSION < 0x00010000)
  EFI_PEI_NOTIFY_DESCRIPTOR           NotifyDescriptor;
#endif
} MEMORY_STATUS_CODE_INSTANCE;

#define MEMORY_STATUS_CODE_FROM_DESCRIPTOR_THIS(a) \
  PEI_CR (a, \
          MEMORY_STATUS_CODE_INSTANCE, \
          PpiDescriptor, \
          MEMORY_STATUS_CODE_SIGNATURE \
      )
#define MEMORY_STATUS_CODE_FROM_NOTIFY_THIS(a) \
  PEI_CR (a, \
          MEMORY_STATUS_CODE_INSTANCE, \
          NotifyDescriptor, \
          MEMORY_STATUS_CODE_SIGNATURE \
      )

//
// Private function declarations
//
EFI_STATUS
EFIAPI
LoadImageCallback (
  IN EFI_PEI_SERVICES           **PeiServices,
  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,
  IN VOID                       *Ppi
  );

#endif