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