summaryrefslogtreecommitdiff
path: root/Include/Protocol/LegacyRegion2.h
blob: 17ee599b36b140d7da6dfe19657f374d88f14dda (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.         **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**           5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093      **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//**********************************************************************

//**********************************************************************
// $Header: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/Intel SystemAgent NB Chipset/LegacyRegion/LegacyRegion Protocols/LegacyRegion2.h 1     4/02/13 6:28a Ireneyang $
//
// $Revision: 1 $
//
// $Date: 4/02/13 6:28a $
//**********************************************************************
// Revision History
// ----------------
// $Log: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/Intel SystemAgent NB Chipset/LegacyRegion/LegacyRegion Protocols/LegacyRegion2.h $
// 
// 1     4/02/13 6:28a Ireneyang
// 
// 1     12/20/12 12:40p Olegi
// 
// 2     5/24/11 2:04p Olegi
// Header/footer updated.
// 
// 6     1/13/10 2:13p Felixp
// 
//**********************************************************************
//<AMI_FHDR_START>
//
// Name:  LegacyRegion2.h
//
// Description:	LegacyRegion2 protocol definition (PI 1.2, Volume 5)
//
//<AMI_FHDR_END>
//**********************************************************************
#ifndef __LEGACY_REGION2_PROTOCOL_H__
#define __LEGACY_REGION2_PROTOCOL_H__
#ifdef __cplusplus
extern "C" {
#endif

#include <Efi.h>

#define EFI_LEGACY_REGION2_PROTOCOL_GUID \
    { 0x70101eaf, 0x85, 0x440c, 0xb3, 0x56, 0x8e, 0xe3, 0x6f, 0xef, 0x24, 0xf0 }

GUID_VARIABLE_DECLARATION(gEfiLegacyRegion2ProtocolGuid,EFI_LEGACY_REGION2_PROTOCOL_GUID);

typedef struct _EFI_LEGACY_REGION2_PROTOCOL EFI_LEGACY_REGION2_PROTOCOL;

typedef EFI_STATUS (EFIAPI *EFI_LEGACY_REGION2_DECODE)(
    IN  EFI_LEGACY_REGION2_PROTOCOL  *This,
    IN  UINT32                       Start,
    IN  UINT32                       Length,
    OUT UINT32                       *Granularity,
    IN  BOOLEAN                      *On
);

typedef EFI_STATUS (EFIAPI *EFI_LEGACY_REGION2_LOCK)(
    IN  EFI_LEGACY_REGION2_PROTOCOL   *This,
    IN  UINT32                        Start,
    IN  UINT32                        Length,
    OUT UINT32                        *Granularity
);

typedef EFI_STATUS (EFIAPI *EFI_LEGACY_REGION2_BOOT_LOCK)(
    IN  EFI_LEGACY_REGION2_PROTOCOL         *This,
    IN  UINT32                              Start,
    IN  UINT32                              Length,
    OUT UINT32                              *Granularity OPTIONAL
);

typedef EFI_STATUS (EFIAPI *EFI_LEGACY_REGION2_UNLOCK)(
    IN  EFI_LEGACY_REGION2_PROTOCOL  *This,
    IN  UINT32                       Start,
    IN  UINT32                       Length,
    OUT UINT32                       *Granularity
);

typedef enum {
    LegacyRegionDecoded,       ///< This region is currently set to allow reads.
    LegacyRegionNotDecoded,    ///< This region is currently set to not allow reads.
    LegacyRegionWriteEnabled,  ///< This region is currently set to allow writes.
    LegacyRegionWriteDisabled, ///< This region is currently set to write protected.
    LegacyRegionBootLocked,    ///< This region's attributes are locked, cannot be modified until
                               ///< after a power cycle.
    LegacyRegionNotLocked      ///< This region's attributes are not locked.
} EFI_LEGACY_REGION_ATTRIBUTE;

typedef struct {
  /// The beginning of the physical address of this
  /// region.
  UINT32                      Start;
  /// The number of bytes in this region.
  UINT32                      Length;
  /// Attribute of the Legacy Region Descriptor that
  /// describes the capabilities for that memory region.
  EFI_LEGACY_REGION_ATTRIBUTE Attribute;
  /// Describes the byte length programmability
  /// associated with the Start address and the specified
  /// Attribute setting.
  UINT32                      Granularity;
} EFI_LEGACY_REGION_DESCRIPTOR;

typedef EFI_STATUS (EFIAPI *EFI_LEGACY_REGION_GET_INFO)(
    IN  EFI_LEGACY_REGION2_PROTOCOL   *This,
    OUT UINT32                        *DescriptorCount,
    OUT EFI_LEGACY_REGION_DESCRIPTOR  **Descriptor
);

/// The EFI_LEGACY_REGION2_PROTOCOL is used to abstract the hardware control of the memory 
/// attributes of the Option ROM shadowing region, 0xC0000 to 0xFFFFF.
/// There are three memory attributes that can be modified through this protocol: read, write and
/// boot-lock. These protocols may be set in any combination.
struct _EFI_LEGACY_REGION2_PROTOCOL {
    EFI_LEGACY_REGION2_DECODE     Decode;
    EFI_LEGACY_REGION2_LOCK       Lock;
    EFI_LEGACY_REGION2_BOOT_LOCK  BootLock;
    EFI_LEGACY_REGION2_UNLOCK     UnLock;
    EFI_LEGACY_REGION_GET_INFO    GetInfo;
};

/****** DO NOT WRITE BELOW THIS LINE *******/
#ifdef __cplusplus
}
#endif
#endif
//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.         **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093        **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//**********************************************************************