0\r
};\r
\r
+/**\r
+\r
+ Translate the first n characters of an Ascii string to\r
+ Unicode characters. The count n is indicated by parameter\r
+ Size. If Size is greater than the length of string, then\r
+ the entire string is translated.\r
+\r
+\r
+ @param a Pointer to input Ascii string.\r
+ @param Size The number of characters to translate.\r
+ @param u Pointer to output Unicode string buffer.\r
+\r
+ @return None\r
+\r
+**/\r
VOID\r
AsciiToUnicodeSize (\r
IN UINT8 *a,\r
IN UINTN Size,\r
OUT UINT16 *u\r
)\r
-/*++\r
-\r
- Routine Description:\r
-\r
- Translate the first n characters of an Ascii string to\r
- Unicode characters. The count n is indicated by parameter\r
- Size. If Size is greater than the length of string, then\r
- the entire string is translated.\r
-\r
- Arguments:\r
-\r
- a - Pointer to input Ascii string.\r
- Size - The number of characters to translate.\r
- u - Pointer to output Unicode string buffer.\r
-\r
- Returns:\r
-\r
- None\r
-\r
---*/\r
{\r
UINTN i;\r
\r
u[i] = 0;\r
}\r
\r
-UINTN\r
-UnicodeToAscii (\r
- IN CHAR16 *UStr,\r
- IN UINTN Length,\r
- OUT CHAR8 *AStr\r
- )\r
-/*++\r
-Routine Description:\r
+/**\r
\r
change a Unicode string t ASCII string\r
\r
-Arguments:\r
-\r
- UStr - Unicode string\r
- Lenght - most possible length of AStr\r
- AStr - ASCII string to pass out\r
\r
-Returns:\r
+ @param UStr Unicode string\r
+ Lenght - most possible length of AStr\r
+ @param Length The length of UStr.\r
+ @param AStr ASCII string to pass out\r
\r
- Actuall length\r
+ @return Actual length\r
\r
---*/\r
+**/\r
+UINTN\r
+UnicodeToAscii (\r
+ IN CHAR16 *UStr,\r
+ IN UINTN Length,\r
+ OUT CHAR8 *AStr\r
+ )\r
{\r
UINTN Index;\r
\r
return Index;\r
}\r
\r
+/**\r
+ EDES_TODO: Add function description.\r
+\r
+ @param CurBBSEntry EDES_TODO: Add parameter description\r
+ @param Index EDES_TODO: Add parameter description\r
+ @param BufSize EDES_TODO: Add parameter description\r
+ @param BootString EDES_TODO: Add parameter description\r
+\r
+ @return EDES_TODO: Add description for return value\r
+\r
+**/\r
VOID\r
BdsBuildLegacyDevNameString (\r
IN BBS_TABLE *CurBBSEntry,\r
}\r
}\r
\r
+/**\r
+\r
+ Create a legacy boot option for the specified entry of\r
+ BBS table, save it as variable, and append it to the boot\r
+ order list.\r
+\r
+\r
+ @param CurrentBbsEntry Pointer to current BBS table.\r
+ @param CurrentBbsDevPath Pointer to the Device Path Protocol instance of BBS\r
+ @param Index Index of the specified entry in BBS table.\r
+ @param BootOrderList On input, the original boot order list.\r
+ On output, the new boot order list attached with the\r
+ created node.\r
+ @param BootOrderListSize On input, the original size of boot order list.\r
+ - On output, the size of new boot order list.\r
+\r
+ @retval EFI_SUCCESS Boot Option successfully created.\r
+ @retval EFI_OUT_OF_RESOURCES Fail to allocate necessary memory.\r
+ @retval Other Error occurs while setting variable.\r
+\r
+**/\r
EFI_STATUS\r
BdsCreateLegacyBootOption (\r
IN BBS_TABLE *CurrentBbsEntry,\r
IN OUT UINT16 **BootOrderList,\r
IN OUT UINTN *BootOrderListSize\r
)\r
-/*++\r
-\r
- Routine Description:\r
-\r
- Create a legacy boot option for the specified entry of\r
- BBS table, save it as variable, and append it to the boot\r
- order list.\r
-\r
- Arguments:\r
-\r
- CurrentBbsEntry - Pointer to current BBS table.\r
- CurrentBbsDevPath - Pointer to the Device Path Protocol instance of BBS\r
- Index - Index of the specified entry in BBS table.\r
- BootOrderList - On input, the original boot order list.\r
- On output, the new boot order list attached with the\r
- created node.\r
- BootOrderListSize - On input, the original size of boot order list.\r
- - On output, the size of new boot order list.\r
-\r
- Returns:\r
-\r
- EFI_SUCCESS - Boot Option successfully created.\r
- EFI_OUT_OF_RESOURCES - Fail to allocate necessary memory.\r
- Other - Error occurs while setting variable.\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINT16 CurrentBootOptionNo;\r
return Status;\r
}\r
\r
+/**\r
+ EDES_TODO: Add function description.\r
+\r
+ @param BootOptionVar EDES_TODO: Add parameter description\r
+ @param BbsEntry EDES_TODO: Add parameter description\r
+ @param BbsIndex EDES_TODO: Add parameter description\r
+\r
+ @return EDES_TODO: Add description for return value\r
+\r
+**/\r
BOOLEAN\r
BdsIsLegacyBootOption (\r
IN UINT8 *BootOptionVar,\r
return Ret;\r
}\r
\r
+/**\r
+ EDES_TODO: Add function description.\r
+\r
+ @param OptionNumber EDES_TODO: Add parameter description\r
+ @param BootOrder EDES_TODO: Add parameter description\r
+ @param BootOrderSize EDES_TODO: Add parameter description\r
+\r
+ @return EDES_TODO: Add description for return value\r
+\r
+**/\r
EFI_STATUS\r
BdsDeleteBootOption (\r
IN UINTN OptionNumber,\r
\r
}\r
\r
-EFI_STATUS\r
-BdsDeleteAllInvalidLegacyBootOptions (\r
- VOID\r
- )\r
-/*++\r
-\r
- Routine Description:\r
-\r
- Delete all the invalid legacy boot options.\r
+/**\r
\r
- Arguments:\r
+ Delete all the invalid legacy boot options.\r
\r
- None.\r
\r
- Returns:\r
+ @param VOID EDES_TODO: Add parameter description\r
\r
- EFI_SUCCESS - All invalide legacy boot options are deleted.\r
- EFI_OUT_OF_RESOURCES - Fail to allocate necessary memory.\r
- EFI_NOT_FOUND - Fail to retrive variable of boot order.\r
- Other - Error occurs while setting variable or locating\r
- protocol.\r
+ @retval EFI_SUCCESS All invalide legacy boot options are deleted.\r
+ @retval EFI_OUT_OF_RESOURCES Fail to allocate necessary memory.\r
+ @retval EFI_NOT_FOUND Fail to retrive variable of boot order.\r
+ @retval Other Error occurs while setting variable or locating\r
+ protocol.\r
\r
---*/\r
+**/\r
+EFI_STATUS\r
+BdsDeleteAllInvalidLegacyBootOptions (\r
+ VOID\r
+ )\r
{\r
UINT16 *BootOrder;\r
UINT8 *BootOptionVar;\r
);\r
}\r
\r
- if (BootOrderSize) {\r
+ if (BootOrderSize != 0) {\r
Status = gRT->SetVariable (\r
L"BootOrder",\r
&gEfiGlobalVariableGuid,\r
return Status;\r
}\r
\r
+/**\r
+ EDES_TODO: Add function description.\r
+\r
+ @param BootOrder EDES_TODO: Add parameter description\r
+ @param BootOptionNum EDES_TODO: Add parameter description\r
+ @param DevType EDES_TODO: Add parameter description\r
+ @param Attribute EDES_TODO: Add parameter description\r
+ @param BbsIndex EDES_TODO: Add parameter description\r
+ @param OptionNumber EDES_TODO: Add parameter description\r
+\r
+ @return EDES_TODO: Add description for return value\r
+\r
+**/\r
BOOLEAN\r
BdsFindLegacyBootOptionByDevType (\r
IN UINT16 *BootOrder,\r
return Found;\r
}\r
\r
+/**\r
+ EDES_TODO: Add function description.\r
+\r
+ @param BbsItem EDES_TODO: Add parameter description\r
+ @param Index EDES_TODO: Add parameter description\r
+ @param BootOrderList EDES_TODO: Add parameter description\r
+ @param BootOrderListSize EDES_TODO: Add parameter description\r
+\r
+ @return EDES_TODO: Add description for return value\r
+\r
+**/\r
EFI_STATUS\r
BdsCreateOneLegacyBootOption (\r
IN BBS_TABLE *BbsItem,\r
return Status;\r
}\r
\r
-EFI_STATUS\r
-BdsAddNonExistingLegacyBootOptions (\r
- VOID\r
- )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
Add the legacy boot options from BBS table if they do not exist.\r
\r
-Arguments:\r
-\r
- None.\r
\r
-Returns:\r
+ @param VOID EDES_TODO: Add parameter description\r
\r
- EFI_SUCCESS - The boot options are added successfully or they are already in boot options.\r
- others - An error occurred when creating legacy boot options.\r
+ @retval EFI_SUCCESS The boot options are added successfully or they are already in boot options.\r
+ @retval others An error occurred when creating legacy boot options.\r
\r
---*/\r
+**/\r
+EFI_STATUS\r
+BdsAddNonExistingLegacyBootOptions (\r
+ VOID\r
+ )\r
{\r
UINT16 *BootOrder;\r
UINTN BootOrderSize;\r
return Status;\r
}\r
\r
+/**\r
+ EDES_TODO: Add function description.\r
+\r
+ @param BbsTable EDES_TODO: Add parameter description\r
+ @param BbsType EDES_TODO: Add parameter description\r
+ @param BbsCount EDES_TODO: Add parameter description\r
+ @param Buf EDES_TODO: Add parameter description\r
+\r
+ @return EDES_TODO: Add description for return value\r
+\r
+**/\r
UINT16 *\r
BdsFillDevOrderBuf (\r
IN BBS_TABLE *BbsTable,\r
return Buf;\r
}\r
\r
+/**\r
+ EDES_TODO: Add function description.\r
+\r
+ @param BbsTable EDES_TODO: Add parameter description\r
+ @param BbsCount EDES_TODO: Add parameter description\r
+\r
+ @return EDES_TODO: Add description for return value\r
+\r
+**/\r
EFI_STATUS\r
BdsCreateDevOrder (\r
IN BBS_TABLE *BbsTable,\r
Ptr += sizeof (BBS_TYPE);\r
*((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + FDCount * sizeof (UINT16));\r
Ptr += sizeof (UINT16);\r
- if (FDCount) {\r
+ if (FDCount != 0) {\r
Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_FLOPPY, BbsCount, (UINT16 *) Ptr);\r
}\r
\r
Ptr += sizeof (BBS_TYPE);\r
*((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + HDCount * sizeof (UINT16));\r
Ptr += sizeof (UINT16);\r
- if (HDCount) {\r
+ if (HDCount != 0) {\r
Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_HARDDISK, BbsCount, (UINT16 *) Ptr);\r
}\r
\r
Ptr += sizeof (BBS_TYPE);\r
*((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + CDCount * sizeof (UINT16));\r
Ptr += sizeof (UINT16);\r
- if (CDCount) {\r
+ if (CDCount != 0) {\r
Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_CDROM, BbsCount, (UINT16 *) Ptr);\r
}\r
\r
Ptr += sizeof (BBS_TYPE);\r
*((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + NETCount * sizeof (UINT16));\r
Ptr += sizeof (UINT16);\r
- if (NETCount) {\r
+ if (NETCount != 0) {\r
Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_EMBED_NETWORK, BbsCount, (UINT16 *) Ptr);\r
}\r
\r
Ptr += sizeof (BBS_TYPE);\r
*((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + BEVCount * sizeof (UINT16));\r
Ptr += sizeof (UINT16);\r
- if (BEVCount) {\r
+ if (BEVCount != 0) {\r
Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_BEV_DEVICE, BbsCount, (UINT16 *) Ptr);\r
}\r
\r
Status = gRT->SetVariable (\r
- VarLegacyDevOrder,\r
+ VAR_LEGACY_DEV_ORDER,\r
&EfiLegacyDevOrderGuid,\r
VAR_FLAG,\r
TotalSize,\r
return Status;\r
}\r
\r
+/**\r
+ EDES_TODO: Add function description.\r
+\r
+ @param VOID EDES_TODO: Add parameter description\r
+\r
+ @return EDES_TODO: Add description for return value\r
+\r
+**/\r
EFI_STATUS\r
BdsUpdateLegacyDevOrder (\r
VOID\r
)\r
-/*++\r
-Format of LegacyDevOrder variable:\r
-|-----------------------------------------------------------------------------------------------------------------\r
-| BBS_FLOPPY | Length | Index0 | Index1 | ... | BBS_HARDDISK | Length | Index0 | Index1 | ... | BBS_CDROM | Length | Index0 | ...\r
-|-----------------------------------------------------------------------------------------------------------------\r
-\r
-Length is a 16 bit integer, it indicates how many Indexes follows, including the size of itself.\r
-Index# is a 16 bit integer, the low byte of it stands for the index in BBS table\r
- the high byte of it only have two value 0 and 0xFF, 0xFF means this device has been\r
- disabled by user.\r
---*/\r
{\r
UINT8 *DevOrder;\r
UINT8 *NewDevOrder;\r
);\r
\r
DevOrder = (UINT8 *) BdsLibGetVariableAndSize (\r
- VarLegacyDevOrder,\r
+ VAR_LEGACY_DEV_ORDER,\r
&EfiLegacyDevOrderGuid,\r
&DevOrderSize\r
);\r
// at this point we have copied those valid indexes to new buffer\r
// and we should check if there is any new appeared boot device\r
//\r
- if (Idx) {\r
+ if (Idx != 0) {\r
for (Index2 = 0; Index2 < *Idx; Index2++) {\r
if ((NewDevPtr[Index2] & 0xFF) == (UINT16) Index) {\r
break;\r
}\r
}\r
\r
- if (FDCount) {\r
+ if (FDCount != 0) {\r
//\r
// Just to make sure that disabled indexes are all at the end of the array\r
//\r
}\r
}\r
\r
- if (HDCount) {\r
+ if (HDCount != 0) {\r
//\r
// Just to make sure that disabled indexes are all at the end of the array\r
//\r
}\r
}\r
\r
- if (CDCount) {\r
+ if (CDCount != 0) {\r
//\r
// Just to make sure that disabled indexes are all at the end of the array\r
//\r
}\r
}\r
\r
- if (NETCount) {\r
+ if (NETCount != 0) {\r
//\r
// Just to make sure that disabled indexes are all at the end of the array\r
//\r
}\r
}\r
\r
- if (BEVCount) {\r
+ if (BEVCount!= 0) {\r
//\r
// Just to make sure that disabled indexes are all at the end of the array\r
//\r
SafeFreePool (DevOrder);\r
\r
Status = gRT->SetVariable (\r
- VarLegacyDevOrder,\r
+ VAR_LEGACY_DEV_ORDER,\r
&EfiLegacyDevOrderGuid,\r
VAR_FLAG,\r
TotalSize,\r
return Status;\r
}\r
\r
+/**\r
+ EDES_TODO: Add function description.\r
+\r
+ @param DeviceType EDES_TODO: Add parameter description\r
+ @param LocalBbsTable EDES_TODO: Add parameter description\r
+ @param Priority EDES_TODO: Add parameter description\r
+\r
+ @return EDES_TODO: Add description for return value\r
+\r
+**/\r
EFI_STATUS\r
BdsSetBootPriority4SameTypeDev (\r
IN UINT16 DeviceType,\r
IN OUT BBS_TABLE *LocalBbsTable,\r
IN OUT UINT16 *Priority\r
)\r
-/*++\r
-DeviceType - BBS_FLOPPY, BBS_HARDDISK, BBS_CDROM and so on\r
-LocalBbsTable - BBS table instance\r
-Priority - As input arg, it is the start point of boot priority, as output arg, it is the start point of boot\r
- priority can be used next time.\r
---*/\r
{\r
UINT8 *DevOrder;\r
\r
UINTN Index;\r
\r
DevOrder = BdsLibGetVariableAndSize (\r
- VarLegacyDevOrder,\r
+ VAR_LEGACY_DEV_ORDER,\r
&EfiLegacyDevOrderGuid,\r
&DevOrderSize\r
);\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ EDES_TODO: Add function description.\r
+\r
+ @param LocalBbsTable EDES_TODO: Add parameter description\r
+\r
+ @return EDES_TODO: Add description for return value\r
+\r
+**/\r
VOID\r
PrintBbsTable (\r
IN BBS_TABLE *LocalBbsTable\r
\r
DEBUG (\r
(DEBUG_ERROR,\r
- " %02x: %04x %02x/%02x/%02x %02x/02%x %04x %04x %04x:%04x\n",\r
+ " %02x: %04x %02x/%02x/%02x %02x/%02x %04x %04x %04x:%04x\n",\r
(UINTN) Idx,\r
(UINTN) LocalBbsTable[Idx].BootPriority,\r
(UINTN) LocalBbsTable[Idx].Bus,\r
DEBUG ((DEBUG_ERROR, "\n"));\r
}\r
\r
+/**\r
+ EDES_TODO: Add function description.\r
+\r
+ @param Entry EDES_TODO: Add parameter description\r
+\r
+ @return EDES_TODO: Add description for return value\r
+\r
+**/\r
EFI_STATUS\r
BdsRefreshBbsTableForBoot (\r
IN BDS_COMMON_OPTION *Entry\r
&gEfiGlobalVariableGuid,\r
&BootOrderSize\r
);\r
- for (Index = 0; BootOrder && Index < BootOrderSize / sizeof (UINT16); Index++) {\r
+ for (Index = 0; ((BootOrder != NULL) && (Index < BootOrderSize / sizeof (UINT16))); Index++) {\r
UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);\r
BootOptionVar = BdsLibGetVariableAndSize (\r
BootOption,\r
}\r
}\r
\r
- if (BootOrder) {\r
+ if (BootOrder != NULL) {\r
SafeFreePool (BootOrder);\r
}\r
//\r