]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c
Merge the PI enabling works from the branch
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / FwVol / FwVolAttrib.c
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 FwVolAttrib.c
15
16 Abstract:
17
18 Implements get/set firmware volume attributes
19
20 --*/
21
22 #include <DxeMain.h>
23
24 EFI_STATUS
25 EFIAPI
26 FvGetVolumeAttributes (
27 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
28 OUT EFI_FV_ATTRIBUTES *Attributes
29 )
30 /*++
31
32 Routine Description:
33 Retrieves attributes, insures positive polarity of attribute bits, returns
34 resulting attributes in output parameter
35
36 Arguments:
37 This - Calling context
38 Attributes - output buffer which contains attributes
39
40 Returns:
41 EFI_SUCCESS - Successfully got volume attributes
42
43 --*/
44 {
45 EFI_STATUS Status;
46 FV_DEVICE *FvDevice;
47 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
48 EFI_FVB_ATTRIBUTES FvbAttributes;
49
50 FvDevice = FV_DEVICE_FROM_THIS (This);
51 Fvb = FvDevice->Fvb;
52
53 if (FvDevice->CachedFv == NULL) {
54 Status = FvCheck (FvDevice);
55 if (EFI_ERROR (Status)) {
56 return Status;
57 }
58 }
59
60 //
61 // First get the Firmware Volume Block Attributes
62 //
63 Status = Fvb->GetAttributes (Fvb, &FvbAttributes);
64
65 //
66 // Mask out Fvb bits that are not defined in FV
67 //
68 FvbAttributes &= 0xfffff0ff;
69
70 *Attributes = (EFI_FV_ATTRIBUTES)FvbAttributes;
71
72 return Status;
73 }
74
75
76 EFI_STATUS
77 EFIAPI
78 FvSetVolumeAttributes (
79 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
80 IN OUT EFI_FV_ATTRIBUTES *Attributes
81 )
82 /*++
83
84 Routine Description:
85 Sets current attributes for volume
86
87 Arguments:
88 This - Calling context
89 Attributes - At input, contains attributes to be set. At output contains
90 new value of FV
91
92 Returns:
93 EFI_UNSUPPORTED - Could not be set.
94
95 --*/
96 {
97 return EFI_UNSUPPORTED;
98 }
99
100 EFI_STATUS
101 EFIAPI
102 FvGetVolumeInfo (
103 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
104 IN CONST EFI_GUID *InformationType,
105 IN OUT UINTN *BufferSize,
106 OUT VOID *Buffer
107 )
108 /*++
109
110 Routine Description:
111 Return information of type InformationType for the requested firmware
112 volume.
113
114 Arguments:
115 This - Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.
116 InformationType - InformationType for requested.
117 BufferSize - On input, size of Buffer.On output, the amount of
118 data returned in Buffer.
119 Buffer - A poniter to the data buffer to return.
120 Returns:
121 EFI_SUCCESS - Successfully got volume Information.
122
123 --*/
124 {
125 return EFI_UNSUPPORTED;
126 }
127
128
129 EFI_STATUS
130 EFIAPI
131 FvSetVolumeInfo (
132 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
133 IN CONST EFI_GUID *InformationType,
134 IN UINTN BufferSize,
135 IN CONST VOID *Buffer
136 )
137 /*++
138
139 Routine Description:
140 Set information of type InformationType for the requested firmware
141 volume.
142
143 Arguments:
144 This - Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.
145 InformationType - InformationType for requested.
146 BufferSize - On input, size of Buffer.On output, the amount of
147 data returned in Buffer.
148 Buffer - A poniter to the data buffer to return.
149 Returns:
150 EFI_SUCCESS - Successfully set volume Information.
151
152 --*/
153 {
154 return EFI_UNSUPPORTED;
155 }
156
157