]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c
Refine code to make it more safely.
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / FwVol / FwVolAttrib.c
1 /** @file
2 Implements get/set firmware volume attributes
3
4 Copyright (c) 2006 - 2012, 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 //
45 // First get the Firmware Volume Block Attributes
46 //
47 Status = Fvb->GetAttributes (Fvb, &FvbAttributes);
48
49 //
50 // Mask out Fvb bits that are not defined in FV
51 //
52 FvbAttributes &= 0xfffff0ff;
53
54 *Attributes = (EFI_FV_ATTRIBUTES)FvbAttributes;
55
56 return Status;
57 }
58
59
60
61 /**
62 Sets current attributes for volume
63
64 @param This Calling context
65 @param Attributes At input, contains attributes to be set. At output
66 contains new value of FV
67
68 @retval EFI_UNSUPPORTED Could not be set.
69
70 **/
71 EFI_STATUS
72 EFIAPI
73 FvSetVolumeAttributes (
74 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
75 IN OUT EFI_FV_ATTRIBUTES *Attributes
76 )
77 {
78 return EFI_UNSUPPORTED;
79 }
80
81
82 /**
83 Return information of type InformationType for the requested firmware
84 volume.
85
86 @param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.
87 @param InformationType InformationType for requested.
88 @param BufferSize On input, size of Buffer.On output, the amount of data
89 returned in Buffer.
90 @param Buffer A poniter to the data buffer to return.
91
92 @retval EFI_SUCCESS Successfully got volume Information.
93
94 **/
95 EFI_STATUS
96 EFIAPI
97 FvGetVolumeInfo (
98 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
99 IN CONST EFI_GUID *InformationType,
100 IN OUT UINTN *BufferSize,
101 OUT VOID *Buffer
102 )
103 {
104 return EFI_UNSUPPORTED;
105 }
106
107
108
109 /**
110 Set information of type InformationType for the requested firmware
111 volume.
112
113 @param This Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL.
114 @param InformationType InformationType for requested.
115 @param BufferSize On input, size of Buffer.On output, the amount of data
116 returned in Buffer.
117 @param Buffer A poniter to the data buffer to return.
118
119 @retval EFI_SUCCESS Successfully set volume Information.
120
121 **/
122 EFI_STATUS
123 EFIAPI
124 FvSetVolumeInfo (
125 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,
126 IN CONST EFI_GUID *InformationType,
127 IN UINTN BufferSize,
128 IN CONST VOID *Buffer
129 )
130 {
131 return EFI_UNSUPPORTED;
132 }
133
134
135