#define GEN_STATUS 0xD4\r
#define TOP_SWAP_BIT (1 << 13)\r
\r
-STATIC\r
-UINT32\r
-ReadPciRegister (\r
- IN UINT32 Offset\r
- )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
Read PCI register value.\r
+ This is a internal function.\r
\r
-Arguments:\r
-\r
- Offset - Offset of the register\r
\r
-Returns:\r
+ @param Offset Offset of the register\r
\r
- The value.\r
+ @return The pci register value.\r
\r
---*/\r
+**/\r
+UINT32\r
+ReadPciRegister (\r
+ IN UINT32 Offset\r
+ )\r
{\r
EFI_STATUS Status;\r
UINT32 Value;\r
return Value;\r
}\r
\r
-STATIC\r
-EFI_STATUS\r
-GetSwapState (\r
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r
- OUT BOOLEAN *SwapState\r
- )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
Get swap state\r
\r
-Arguments:\r
+ This is a internal function.\r
\r
- FtwLiteDevice - Calling context\r
- SwapState - Swap state\r
+ @param FtwLiteDevice Calling context\r
+ @param SwapState Swap state\r
\r
-Returns:\r
+ @retval EFI_SUCCESS State successfully got\r
\r
- EFI_SUCCESS - State successfully got\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+GetSwapState (\r
+ IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r
+ OUT BOOLEAN *SwapState\r
+ )\r
{\r
//\r
// Top swap status is 13 bit\r
return EFI_SUCCESS;\r
}\r
\r
-STATIC\r
+/**\r
+ Set swap state.\r
+\r
+ This is a internal function.\r
+\r
+ @param FtwLiteDevice Indicates a pointer to the calling context.\r
+ @param TopSwap New swap state\r
+\r
+ @retval EFI_SUCCESS The function completed successfully\r
+ Note:\r
+ the Top-Swap bit (bit 13, D31: F0, Offset D4h). Note that\r
+ software will not be able to clear the Top-Swap bit until the system is\r
+ rebooted without GNT[A]# being pulled down.\r
+\r
+**/\r
EFI_STATUS\r
SetSwapState (\r
IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r
IN BOOLEAN TopSwap\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Set swap state.\r
-\r
-Arguments:\r
- FtwLiteDevice - Indicates a pointer to the calling context. \r
- TopSwap - New swap state\r
-\r
-Returns:\r
- EFI_SUCCESS - The function completed successfully\r
-\r
-Note:\r
- the Top-Swap bit (bit 13, D31: F0, Offset D4h). Note that\r
- software will not be able to clear the Top-Swap bit until the system is\r
- rebooted without GNT[A]# being pulled down.\r
-\r
---*/\r
{\r
UINT32 GenStatus;\r
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;\r
return EFI_SUCCESS;\r
}\r
\r
-BOOLEAN\r
-IsBootBlock (\r
- EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,\r
- EFI_LBA Lba\r
- )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
Check whether the block is a boot block.\r
\r
-Arguments:\r
-\r
- FtwLiteDevice - Calling context\r
- FvBlock - Fvb protocol instance\r
- Lba - Lba value\r
\r
-Returns:\r
+ @param FtwLiteDevice Calling context\r
+ @param FvBlock Fvb protocol instance\r
+ @param Lba Lba value\r
\r
- Is a boot block or not\r
+ @retval FALSE This is a boot block.\r
+ @retval TRUE This is not a boot block.\r
\r
---*/\r
+**/\r
+BOOLEAN\r
+IsBootBlock (\r
+ EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r
+ EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,\r
+ EFI_LBA Lba\r
+ )\r
{\r
EFI_STATUS Status;\r
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *BootFvb;\r
return (BOOLEAN) (FvBlock == BootFvb);\r
}\r
\r
+/**\r
+ Copy the content of spare block to a boot block. Size is FTW_BLOCK_SIZE.\r
+ Spare block is accessed by FTW backup FVB protocol interface. LBA is\r
+ FtwLiteDevice->FtwSpareLba.\r
+ Boot block is accessed by BootFvb protocol interface. LBA is 0.\r
+\r
+\r
+ @param FtwLiteDevice The private data of FTW_LITE driver\r
+\r
+ @retval EFI_SUCCESS Spare block content is copied to boot block\r
+ @retval EFI_INVALID_PARAMETER Input parameter error\r
+ @retval EFI_OUT_OF_RESOURCES Allocate memory error\r
+ @retval EFI_ABORTED The function could not complete successfully\r
+ Notes:\r
+ FTW will do extra work on boot block update.\r
+ FTW should depend on a protocol of EFI_ADDRESS_RANGE_SWAP_PROTOCOL,\r
+ which is produced by a chipset driver.\r
+ FTW updating boot block steps:\r
+ 1. Erase top swap block (0xFFFE-0xFFFEFFFF) and write data to it ready\r
+ 2. Read data from top swap block to memory buffer\r
+ 3. SetSwapState(EFI_SWAPPED)\r
+ 4. Erasing boot block (0xFFFF-0xFFFFFFFF)\r
+ 5. Programming boot block until the boot block is ok.\r
+ 6. SetSwapState(UNSWAPPED)\r
+ Notes:\r
+ 1. Since the SwapState bit is saved in CMOS, FTW can restore and continue\r
+ even in the scenario of power failure.\r
+ 2. FTW shall not allow to update boot block when battery state is error.\r
+\r
+**/\r
EFI_STATUS\r
FlushSpareBlockToBootBlock (\r
EFI_FTW_LITE_DEVICE *FtwLiteDevice\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Copy the content of spare block to a boot block. Size is FTW_BLOCK_SIZE.\r
- Spare block is accessed by FTW backup FVB protocol interface. LBA is \r
- FtwLiteDevice->FtwSpareLba.\r
- Boot block is accessed by BootFvb protocol interface. LBA is 0.\r
-\r
-Arguments:\r
- FtwLiteDevice - The private data of FTW_LITE driver\r
-\r
-Returns:\r
- EFI_SUCCESS - Spare block content is copied to boot block\r
- EFI_INVALID_PARAMETER - Input parameter error\r
- EFI_OUT_OF_RESOURCES - Allocate memory error\r
- EFI_ABORTED - The function could not complete successfully\r
-\r
-Notes:\r
- FTW will do extra work on boot block update.\r
- FTW should depend on a protocol of EFI_ADDRESS_RANGE_SWAP_PROTOCOL, \r
- which is produced by a chipset driver.\r
-\r
- FTW updating boot block steps:\r
- 1. Erase top swap block (0xFFFE-0xFFFEFFFF) and write data to it ready\r
- 2. Read data from top swap block to memory buffer\r
- 3. SetSwapState(EFI_SWAPPED)\r
- 4. Erasing boot block (0xFFFF-0xFFFFFFFF)\r
- 5. Programming boot block until the boot block is ok.\r
- 6. SetSwapState(UNSWAPPED)\r
-\r
- Notes:\r
- 1. Since the SwapState bit is saved in CMOS, FTW can restore and continue \r
- even in the scenario of power failure.\r
- 2. FTW shall not allow to update boot block when battery state is error.\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINTN Length;\r