]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Core/Dxe/FwVol/FwVolAttrib.c
Initial import.
[mirror_edk2.git] / EdkModulePkg / 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 EFI_FIRMWARE_VOLUME_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->GetVolumeAttributes (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 EFI_FIRMWARE_VOLUME_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