]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteDxe/Ipf/IpfFtwMisc.c
ee9260982a7384985b2a256b6b11c6fab41ac3aa
[mirror_edk2.git] / MdeModulePkg / Universal / FirmwareVolume / FaultTolerantWriteDxe / Ipf / IpfFtwMisc.c
1 /** @file
2
3 Ipf platform related code to support FtwLite..
4
5 Copyright (c) 2006 - 2008, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16
17 #include "FtwLite.h"
18
19 //
20 // MACROs for boot block update
21 //
22 #define BOOT_BLOCK_BASE
23
24 /**
25
26 Get swap state
27 This is a internal function.
28
29 @param FtwLiteDevice Calling context
30 @param SwapState Swap state
31
32 @retval EFI_SUCCESS State successfully got
33
34 **/
35 EFI_STATUS
36 GetSwapState (
37 IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,
38 OUT BOOLEAN *SwapState
39 )
40 {
41 return EFI_SUCCESS;
42 }
43
44 /**
45 Set swap state.
46 This is a internal function.
47
48
49 @param FtwLiteDevice Indicates a pointer to the calling context.
50 @param TopSwap New swap state
51
52 @retval EFI_SUCCESS The function completed successfully
53 Note:
54 the Top-Swap bit (bit 13, D31: F0, Offset D4h). Note that
55 software will not be able to clear the Top-Swap bit until the system is
56 rebooted without GNT[A]# being pulled down.
57
58 **/
59 EFI_STATUS
60 SetSwapState (
61 IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,
62 IN BOOLEAN TopSwap
63 )
64 {
65 return EFI_SUCCESS;
66 }
67
68 /**
69
70 Check whether the block is a boot block.
71
72
73 @param FtwLiteDevice Calling context
74 @param FvBlock Fvb protocol instance
75 @param Lba Lba value
76
77 @retval FALSE This is a boot block.
78 @retval TRUE This is not a boot block.
79
80 **/
81 BOOLEAN
82 IsBootBlock (
83 EFI_FTW_LITE_DEVICE *FtwLiteDevice,
84 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,
85 EFI_LBA Lba
86 )
87 {
88 //
89 // IPF doesn't support safe bootblock update
90 // so treat bootblock as normal block
91 //
92 return FALSE;
93 }
94
95 /**
96 Copy the content of spare block to a boot block. Size is FTW_BLOCK_SIZE.
97 Spare block is accessed by FTW backup FVB protocol interface. LBA is
98 FtwLiteDevice->FtwSpareLba.
99 Boot block is accessed by BootFvb protocol interface. LBA is 0.
100
101
102 @param FtwLiteDevice The private data of FTW_LITE driver
103
104 @retval EFI_SUCCESS Spare block content is copied to boot block
105 @retval EFI_INVALID_PARAMETER Input parameter error
106 @retval EFI_OUT_OF_RESOURCES Allocate memory error
107 @retval EFI_ABORTED The function could not complete successfully
108 Notes:
109
110 **/
111 EFI_STATUS
112 FlushSpareBlockToBootBlock (
113 EFI_FTW_LITE_DEVICE *FtwLiteDevice
114 )
115 {
116 return EFI_SUCCESS;
117 }