summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/x64/x64FtwMisc.c
blob: d8e3a03fdefc776c3151862dab9813ff8f1ea70a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140

/*++

Copyright (c) 2006, Intel Corporation                                                         
All rights reserved. This program and the accompanying materials                          
are licensed and made available under the terms and conditions of the BSD License         
which accompanies this distribution.  The full text of the license may be found at        
http://opensource.org/licenses/bsd-license.php                                            
                                                                                          
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 

Module Name:

  x64FtwMisc.c
  
Abstract:
  
  X64 platform related code to support FtwLite..

Revision History

--*/


#include <FtwLite.h>

//
// MACROs for boot block update
//
#define BOOT_BLOCK_BASE

// STATIC
EFI_STATUS
GetSwapState (
  IN EFI_FTW_LITE_DEVICE    *FtwLiteDevice,
  OUT BOOLEAN               *SwapState
  )
/*++

Routine Description:

  Get swap state

Arguments:

  FtwLiteDevice - Calling context
  SwapState     - Swap state

Returns:

  EFI_SUCCESS - State successfully got

--*/
{
  return EFI_SUCCESS;
}

// STATIC
EFI_STATUS
SetSwapState (
  IN EFI_FTW_LITE_DEVICE    *FtwLiteDevice,
  IN  BOOLEAN               TopSwap
  )
/*++

Routine Description:
    Set swap state.

Arguments:
    FtwLiteDevice  - Indicates a pointer to the calling context.  
    TopSwap        - New swap state

Returns:
    EFI_SUCCESS   - The function completed successfully

Note:
    the Top-Swap bit (bit 13, D31: F0, Offset D4h). Note that
    software will not be able to clear the Top-Swap bit until the system is
    rebooted without GNT[A]# being pulled down.

--*/
{
  return EFI_SUCCESS;
}

BOOLEAN
IsBootBlock (
  EFI_FTW_LITE_DEVICE                 *FtwLiteDevice,
  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *FvBlock,
  EFI_LBA                             Lba
  )
/*++

Routine Description:

  Check whether the block is a boot block.

Arguments:

  FtwLiteDevice - Calling context
  FvBlock       - Fvb protocol instance
  Lba           - Lba value

Returns:

  Is a boot block or not

--*/
{
  return FALSE;
}

EFI_STATUS
FlushSpareBlockToBootBlock (
  EFI_FTW_LITE_DEVICE      *FtwLiteDevice
  )
/*++

Routine Description:
    Copy the content of spare block to a boot block. Size is FTW_BLOCK_SIZE.
    Spare block is accessed by FTW backup FVB protocol interface. LBA is 
    FtwLiteDevice->FtwSpareLba.
    Boot block is accessed by BootFvb protocol interface. LBA is 0.

Arguments:
    FtwLiteDevice  - The private data of FTW_LITE driver

Returns:
    EFI_SUCCESS              - Spare block content is copied to boot block
    EFI_INVALID_PARAMETER    - Input parameter error
    EFI_OUT_OF_RESOURCES     - Allocate memory error
    EFI_ABORTED              - The function could not complete successfully

Notes:

--*/
{
  return EFI_SUCCESS;
}