summaryrefslogtreecommitdiff
path: root/HisiPkg/D01BoardPkg/Bds
diff options
context:
space:
mode:
Diffstat (limited to 'HisiPkg/D01BoardPkg/Bds')
-rw-r--r--HisiPkg/D01BoardPkg/Bds/Bds.c32
-rw-r--r--HisiPkg/D01BoardPkg/Bds/BdsHelper.c4
-rw-r--r--HisiPkg/D01BoardPkg/Bds/BdsInternal.h20
-rw-r--r--HisiPkg/D01BoardPkg/Bds/BootMenu.c356
-rw-r--r--HisiPkg/D01BoardPkg/Bds/BootOption.c62
-rw-r--r--HisiPkg/D01BoardPkg/Bds/BootOptionSupport.c20
6 files changed, 247 insertions, 247 deletions
diff --git a/HisiPkg/D01BoardPkg/Bds/Bds.c b/HisiPkg/D01BoardPkg/Bds/Bds.c
index 8005b0924..429050653 100644
--- a/HisiPkg/D01BoardPkg/Bds/Bds.c
+++ b/HisiPkg/D01BoardPkg/Bds/Bds.c
@@ -302,10 +302,10 @@ DefineDefaultBootEntries (
ARM_BDS_LOADER_ARGUMENTS* BootArguments;
ARM_BDS_LOADER_TYPE BootType;
EFI_DEVICE_PATH* InitrdPath;
- EFI_DEVICE_PATH* FdtLocalPath;
+ EFI_DEVICE_PATH* FdtLocalPath;
UINTN CmdLineSize;
UINTN InitrdSize;
- UINTN FdtLocalSize;
+ UINTN FdtLocalSize;
//
// If Boot Order does not exist then create a default entry
@@ -337,7 +337,7 @@ DefineDefaultBootEntries (
ASSERT (StrCmp ((CHAR16*)PcdGetPtr(PcdDefaultBootDevicePath), DevicePathTxt) == 0);
if (DevicePathTxt != NULL){
- FreePool (DevicePathTxt);
+ FreePool (DevicePathTxt);
}
DEBUG_CODE_END();
@@ -345,31 +345,31 @@ DefineDefaultBootEntries (
if (BootDevicePath != NULL) {
BootType = (ARM_BDS_LOADER_TYPE)PcdGet32 (PcdDefaultBootType);
- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
+ if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
CmdLineSize = AsciiStrSize ((CHAR8*)PcdGetPtr(PcdDefaultBootArgument));
InitrdPath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootInitrdPath));
if (InitrdPath != NULL) {
- InitrdSize = GetDevicePathSize (InitrdPath);
+ InitrdSize = GetDevicePathSize (InitrdPath);
} else {
InitrdSize = 0;
}
if (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) {
FdtLocalPath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultFdtLocalDevicePath));
- FdtLocalSize = GetDevicePathSize (FdtLocalPath);
+ FdtLocalSize = GetDevicePathSize (FdtLocalPath);
} else {
FdtLocalPath = NULL;
FdtLocalSize = 0;
}
-
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize + FdtLocalSize);
+
+ BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize + FdtLocalSize);
if ( BootArguments != NULL ) {
- BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
- BootArguments->LinuxArguments.InitrdSize = InitrdSize;
- BootArguments->LinuxArguments.FdtLocalSize = FdtLocalSize;
-
- CopyMem ((VOID*)(BootArguments + 1), (CHAR8*)PcdGetPtr(PcdDefaultBootArgument), CmdLineSize);
- CopyMem ((VOID*)((UINTN)(BootArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);
- CopyMem ((VOID*)((UINTN)(BootArguments + 1) + CmdLineSize + InitrdSize), FdtLocalPath, FdtLocalSize);
+ BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
+ BootArguments->LinuxArguments.InitrdSize = InitrdSize;
+ BootArguments->LinuxArguments.FdtLocalSize = FdtLocalSize;
+
+ CopyMem ((VOID*)(BootArguments + 1), (CHAR8*)PcdGetPtr(PcdDefaultBootArgument), CmdLineSize);
+ CopyMem ((VOID*)((UINTN)(BootArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);
+ CopyMem ((VOID*)((UINTN)(BootArguments + 1) + CmdLineSize + InitrdSize), FdtLocalPath, FdtLocalSize);
}
if (FdtLocalPath != NULL ) {
FreePool (FdtLocalPath);
@@ -389,7 +389,7 @@ DefineDefaultBootEntries (
&BdsLoadOption
);
if (BdsLoadOption != NULL){
- FreePool (BdsLoadOption);
+ FreePool (BdsLoadOption);
}
if (BootDevicePath != NULL){
FreePool (BootDevicePath);
diff --git a/HisiPkg/D01BoardPkg/Bds/BdsHelper.c b/HisiPkg/D01BoardPkg/Bds/BdsHelper.c
index 733864ad0..5896baba7 100644
--- a/HisiPkg/D01BoardPkg/Bds/BdsHelper.c
+++ b/HisiPkg/D01BoardPkg/Bds/BdsHelper.c
@@ -36,7 +36,7 @@ EditHIInputStr (
Print (CmdLine);
// To prevent a buffer overflow, we only allow to enter (MaxCmdLine-1) characters
- for (CmdLineIndex = StrLen (CmdLine); CmdLineIndex < MaxCmdLine; ) {
+ for (CmdLineIndex = StrLen (CmdLine); CmdLineIndex < MaxCmdLine; ) {
Status = gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &WaitIndex);
ASSERT_EFI_ERROR (Status);
@@ -63,7 +63,7 @@ EditHIInputStr (
}
} else if ((Key.ScanCode == SCAN_ESC) || (Char == 0x1B) || (Char == 0x0)) {
return EFI_INVALID_PARAMETER;
- } else if (CmdLineIndex < (MaxCmdLine-1)) {
+ } else if (CmdLineIndex < (MaxCmdLine-1)) {
CmdLine[CmdLineIndex++] = Key.UnicodeChar;
Print (L"%c", Key.UnicodeChar);
}
diff --git a/HisiPkg/D01BoardPkg/Bds/BdsInternal.h b/HisiPkg/D01BoardPkg/Bds/BdsInternal.h
index 050aa32cf..12d904a70 100644
--- a/HisiPkg/D01BoardPkg/Bds/BdsInternal.h
+++ b/HisiPkg/D01BoardPkg/Bds/BdsInternal.h
@@ -38,11 +38,11 @@
#define BOOT_DEVICE_OPTION_MAX 300
#define BOOT_DEVICE_ADDRESS_MAX (sizeof(L"0x0000000000000000"))
-// Length of the buffer used to hold the user input for the main menu
-// This includes the NULL terminator
-// 1 chars + newline + NULL gives room for up to 9 boot device configs
-#define BOOT_OPTION_LEN 3
-
+// Length of the buffer used to hold the user input for the main menu
+// This includes the NULL terminator
+// 1 chars + newline + NULL gives room for up to 9 boot device configs
+#define BOOT_OPTION_LEN 3
+
#define ARM_BDS_OPTIONAL_DATA_SIGNATURE SIGNATURE_32('a', 'b', 'o', 'd')
#define IS_ARM_BDS_BOOTENTRY(ptr) (ReadUnaligned32 ((CONST UINT32*)&((ARM_BDS_LOADER_OPTIONAL_DATA*)((ptr)->OptionalData))->Header.Signature) == ARM_BDS_OPTIONAL_DATA_SIGNATURE)
@@ -53,20 +53,20 @@
typedef enum {
BDS_LOADER_EFI_APPLICATION = 0,
BDS_LOADER_KERNEL_LINUX_ATAG,
- BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT,
- BDS_LOADER_KERNEL_LINUX_LOCAL_FDT,
+ BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT,
+ BDS_LOADER_KERNEL_LINUX_LOCAL_FDT,
} ARM_BDS_LOADER_TYPE;
typedef struct {
UINT16 CmdLineSize;
UINT16 InitrdSize;
- UINT16 FdtLocalSize;
-
+ UINT16 FdtLocalSize;
+
// These following fields have variable length and are packed:
//CHAR8 *CmdLine;
//EFI_DEVICE_PATH_PROTOCOL *InitrdPathList;
- //EFI_DEVICE_PATH_PROTOCOL *FdtLocalPathList;
+ //EFI_DEVICE_PATH_PROTOCOL *FdtLocalPathList;
} ARM_BDS_LINUX_ARGUMENTS;
typedef union {
diff --git a/HisiPkg/D01BoardPkg/Bds/BootMenu.c b/HisiPkg/D01BoardPkg/Bds/BootMenu.c
index e265c130f..cade8296f 100644
--- a/HisiPkg/D01BoardPkg/Bds/BootMenu.c
+++ b/HisiPkg/D01BoardPkg/Bds/BootMenu.c
@@ -135,12 +135,12 @@ BootMenuAddBootOption (
EFI_DEVICE_PATH_PROTOCOL *DevicePathNodes;
EFI_DEVICE_PATH_PROTOCOL *InitrdPathNodes;
EFI_DEVICE_PATH_PROTOCOL *InitrdPath;
- EFI_DEVICE_PATH_PROTOCOL *FdtLocalPathNode;
- EFI_DEVICE_PATH_PROTOCOL *FdtLocalPath;
+ EFI_DEVICE_PATH_PROTOCOL *FdtLocalPathNode;
+ EFI_DEVICE_PATH_PROTOCOL *FdtLocalPath;
UINTN CmdLineSize;
BOOLEAN InitrdSupport;
UINTN InitrdSize;
- UINTN FdtLocalSize;
+ UINTN FdtLocalSize;
Attributes = 0;
SupportedBootDevice = NULL;
@@ -165,12 +165,12 @@ BootMenuAddBootOption (
goto EXIT;
}
- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
+ if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
Print(L"Add an initrd: ");
Status = GetHIInputBoolean (&InitrdSupport);
if (EFI_ERROR(Status)) {
Status = EFI_ABORTED;
- goto FREE_DEVICE_PATH;
+ goto FREE_DEVICE_PATH;
}
if (InitrdSupport) {
@@ -178,7 +178,7 @@ BootMenuAddBootOption (
Status = SupportedBootDevice->Support->CreateDevicePathNode (L"initrd", &InitrdPathNodes, NULL, NULL);
if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) { // EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd
Status = EFI_ABORTED;
- goto FREE_DEVICE_PATH;
+ goto FREE_DEVICE_PATH;
}
if (InitrdPathNodes != NULL) {
@@ -202,36 +202,36 @@ BootMenuAddBootOption (
goto FREE_DEVICE_PATH;
}
- if (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) {
- // Create the specific device path node
- Status = SupportedBootDevice->Support->CreateDevicePathNode (L"local FDT", &FdtLocalPathNode, NULL, NULL);
- if (EFI_ERROR(Status) || (FdtLocalPathNode == NULL)) {
- Status = EFI_ABORTED;
- goto FREE_DEVICE_PATH;
- }
-
- if (FdtLocalPathNode != NULL) {
- // Append the Device Path node to the select device path
- FdtLocalPath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)FdtLocalPathNode);
- } else {
- FdtLocalPath = NULL;
- }
- } else {
- FdtLocalPath = NULL;
- }
-
- CmdLineSize = AsciiStrSize (CmdLine);
- InitrdSize = GetDevicePathSize (InitrdPath);
- FdtLocalSize = GetDevicePathSize (FdtLocalPath);
-
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize + FdtLocalSize);
- if ( BootArguments != NULL ) {
- BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
- BootArguments->LinuxArguments.InitrdSize = InitrdSize;
- BootArguments->LinuxArguments.FdtLocalSize = FdtLocalSize;
- CopyMem ((VOID*)(&BootArguments->LinuxArguments + 1), CmdLine, CmdLineSize);
- CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);
- CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize + InitrdSize), FdtLocalPath, FdtLocalSize);
+ if (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) {
+ // Create the specific device path node
+ Status = SupportedBootDevice->Support->CreateDevicePathNode (L"local FDT", &FdtLocalPathNode, NULL, NULL);
+ if (EFI_ERROR(Status) || (FdtLocalPathNode == NULL)) {
+ Status = EFI_ABORTED;
+ goto FREE_DEVICE_PATH;
+ }
+
+ if (FdtLocalPathNode != NULL) {
+ // Append the Device Path node to the select device path
+ FdtLocalPath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)FdtLocalPathNode);
+ } else {
+ FdtLocalPath = NULL;
+ }
+ } else {
+ FdtLocalPath = NULL;
+ }
+
+ CmdLineSize = AsciiStrSize (CmdLine);
+ InitrdSize = GetDevicePathSize (InitrdPath);
+ FdtLocalSize = GetDevicePathSize (FdtLocalPath);
+
+ BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize + FdtLocalSize);
+ if ( BootArguments != NULL ) {
+ BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
+ BootArguments->LinuxArguments.InitrdSize = InitrdSize;
+ BootArguments->LinuxArguments.FdtLocalSize = FdtLocalSize;
+ CopyMem ((VOID*)(&BootArguments->LinuxArguments + 1), CmdLine, CmdLineSize);
+ CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);
+ CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize + InitrdSize), FdtLocalPath, FdtLocalSize);
}
} else {
BootArguments = NULL;
@@ -310,7 +310,7 @@ BootMenuSelectBootOption (
Print(L"\t- %s\n",DevicePathTxt);
OptionalData = BdsLoadOption->OptionalData;
LoaderType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);
- if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
+ if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
Print (L"\t- Arguments: %a\n",&OptionalData->Arguments.LinuxArguments + 1);
}
@@ -402,19 +402,19 @@ BootMenuUpdateBootOption (
CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX];
EFI_DEVICE_PATH *DevicePath;
EFI_DEVICE_PATH *TempInitrdPath;
- EFI_DEVICE_PATH *TempFdtLocalPath;
+ EFI_DEVICE_PATH *TempFdtLocalPath;
ARM_BDS_LOADER_TYPE BootType;
ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
ARM_BDS_LINUX_ARGUMENTS* LinuxArguments;
EFI_DEVICE_PATH *InitrdPathNodes;
EFI_DEVICE_PATH *InitrdPath;
UINTN InitrdSize;
- EFI_DEVICE_PATH *FdtLocalPathNode;
- EFI_DEVICE_PATH *FdtLocalPath;
- UINTN FdtLocalSize;
+ EFI_DEVICE_PATH *FdtLocalPathNode;
+ EFI_DEVICE_PATH *FdtLocalPath;
+ UINTN FdtLocalSize;
UINTN CmdLineSize;
BOOLEAN InitrdSupport;
- BOOLEAN FdtLocalSupport;
+ BOOLEAN FdtLocalSupport;
Status = BootMenuSelectBootOption (BootOptionsList, UPDATE_BOOT_ENTRY, TRUE, &BootOptionEntry);
if (EFI_ERROR(Status)) {
@@ -438,7 +438,7 @@ BootMenuUpdateBootOption (
OptionalData = BootOption->OptionalData;
BootType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((UINT32 *)(&OptionalData->Header.LoaderType));
- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
+ if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
LinuxArguments = &OptionalData->Arguments.LinuxArguments;
CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);
@@ -561,14 +561,14 @@ BootMenuUpdateBootOption (
CmdLineSize = AsciiStrSize (CmdLine);
- BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool(sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize + FdtLocalSize);
+ BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool(sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize + FdtLocalSize);
if ( BootArguments != NULL ) {
- BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
- BootArguments->LinuxArguments.InitrdSize = InitrdSize;
- BootArguments->LinuxArguments.FdtLocalSize = FdtLocalSize;
- CopyMem (&BootArguments->LinuxArguments + 1, CmdLine, CmdLineSize);
- CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);
- CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize + InitrdSize), FdtLocalPath, FdtLocalSize);
+ BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
+ BootArguments->LinuxArguments.InitrdSize = InitrdSize;
+ BootArguments->LinuxArguments.FdtLocalSize = FdtLocalSize;
+ CopyMem (&BootArguments->LinuxArguments + 1, CmdLine, CmdLineSize);
+ CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);
+ CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize + InitrdSize), FdtLocalPath, FdtLocalSize);
}
} else {
BootArguments = NULL;
@@ -711,49 +711,49 @@ BootEBL (
return Status;
}
-
-EFI_STATUS
-BootShell (
- IN LIST_ENTRY *BootOptionsList
- )
-{
- EFI_STATUS Status;
-
- // Start EFI Shell
- Status = BdsLoadApplication (mImageHandle, L"Shell", 0, NULL);
- if (Status == EFI_NOT_FOUND) {
- Print (L"Error: EFI Application not found.\n");
- } else if (EFI_ERROR(Status)) {
- Print (L"Error: Status Code: 0x%X\n",(UINT32)Status);
- }
-
- return Status;
-}
-
-EFI_STATUS
-Reboot (
- IN LIST_ENTRY *BootOptionsList
- )
-{
- gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-Shutdown (
- IN LIST_ENTRY *BootOptionsList
- )
-{
- gRT->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-BootLinuxAtagLoader (
- IN LIST_ENTRY *BootOptionsList
- )
-{
- EFI_STATUS Status;
+
+EFI_STATUS
+BootShell (
+ IN LIST_ENTRY *BootOptionsList
+ )
+{
+ EFI_STATUS Status;
+
+ // Start EFI Shell
+ Status = BdsLoadApplication (mImageHandle, L"Shell", 0, NULL);
+ if (Status == EFI_NOT_FOUND) {
+ Print (L"Error: EFI Application not found.\n");
+ } else if (EFI_ERROR(Status)) {
+ Print (L"Error: Status Code: 0x%X\n",(UINT32)Status);
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+Reboot (
+ IN LIST_ENTRY *BootOptionsList
+ )
+{
+ gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
+ return EFI_UNSUPPORTED;
+}
+
+EFI_STATUS
+Shutdown (
+ IN LIST_ENTRY *BootOptionsList
+ )
+{
+ gRT->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL);
+ return EFI_UNSUPPORTED;
+}
+
+EFI_STATUS
+BootLinuxAtagLoader (
+ IN LIST_ENTRY *BootOptionsList
+ )
+{
+ EFI_STATUS Status;
Status = BdsLoadApplication (mImageHandle, (CHAR16 *)L"LinuxAtagLoader", 0, NULL);
if (Status == EFI_NOT_FOUND) {
@@ -763,8 +763,8 @@ BootLinuxAtagLoader (
}
return Status;
-}
-
+}
+
EFI_STATUS LoadLinuxAtSecEnd()
{
LinuxEntry entry = (LinuxEntry)(0x10c00000);
@@ -779,11 +779,11 @@ EFI_STATUS LoadLinuxAtSecEnd()
return Status;
}
-EFI_STATUS
-BootGo (
- IN LIST_ENTRY *BootOptionsList
- )
-{
+EFI_STATUS
+BootGo (
+ IN LIST_ENTRY *BootOptionsList
+ )
+{
EFI_STATUS Status;
Status = ShutdownUefiBootServices ();
@@ -804,18 +804,18 @@ BootGo (
}
return Status;
-}
-
+}
+
struct BOOT_MAIN_ENTRY {
CONST CHAR16* Description;
EFI_STATUS (*Callback) (IN LIST_ENTRY *BootOptionsList);
} BootMainEntries[] = {
{ L"Boot Manager", BootMenuManager },
- { L"EBL", BootEBL },
- { L"Shell", BootShell },
- { L"Reboot", Reboot },
- { L"Shutdown", Shutdown },
- { L"GO", BootGo },
+ { L"EBL", BootEBL },
+ { L"Shell", BootShell },
+ { L"Reboot", Reboot },
+ { L"Shutdown", Shutdown },
+ { L"GO", BootGo },
};
@@ -824,21 +824,21 @@ BootMenuMain (
VOID
)
{
- LIST_ENTRY BootOptionsList;
- UINTN OptionCount;
- UINTN BootOptionCount;
- EFI_STATUS Status;
- LIST_ENTRY* Entry;
- BDS_LOAD_OPTION* BootOption;
- UINTN BootOptionSelected;
- UINTN Index;
- UINTN BootMainEntryCount;
- CHAR8 BootOptionSelectedStr[BOOT_OPTION_LEN];
- EFI_DEVICE_PATH_PROTOCOL* DefaultFdtDevicePath;
- UINTN FdtDevicePathSize;
+ LIST_ENTRY BootOptionsList;
+ UINTN OptionCount;
+ UINTN BootOptionCount;
+ EFI_STATUS Status;
+ LIST_ENTRY* Entry;
+ BDS_LOAD_OPTION* BootOption;
+ UINTN BootOptionSelected;
+ UINTN Index;
+ UINTN BootMainEntryCount;
+ CHAR8 BootOptionSelectedStr[BOOT_OPTION_LEN];
+ EFI_DEVICE_PATH_PROTOCOL* DefaultFdtDevicePath;
+ UINTN FdtDevicePathSize;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
CHAR16* DevicePathTxt;
-
+
BootOption = NULL;
BootMainEntryCount = sizeof(BootMainEntries) / sizeof(struct BOOT_MAIN_ENTRY);
@@ -859,10 +859,10 @@ BootMenuMain (
Print(L"[%d] %s\n", OptionCount, BootOption->Description);
- //DEBUG_CODE_BEGIN();
+ //DEBUG_CODE_BEGIN();
ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
UINTN CmdLineSize;
- UINTN InitrdSize;
+ UINTN InitrdSize;
ARM_BDS_LOADER_TYPE LoaderType;
Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
@@ -879,7 +879,7 @@ BootMenuMain (
if (IS_ARM_BDS_BOOTENTRY (BootOption)) {
OptionalData = BootOption->OptionalData;
LoaderType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((CONST UINT32*)&OptionalData->Header.LoaderType);
- if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
+ if ((LoaderType == BDS_LOADER_KERNEL_LINUX_ATAG) || (LoaderType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.InitrdSize) > 0) {
CmdLineSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize);
DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (
@@ -898,24 +898,24 @@ BootMenuMain (
Print(L"\t- LoaderType: Linux kernel with ATAG support\n");
break;
- case BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT:
- Print(L"\t- LoaderType: Linux kernel with global FDT support\n");
- break;
- case BDS_LOADER_KERNEL_LINUX_LOCAL_FDT:
- if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.FdtLocalSize) > 0) {
- CmdLineSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize);
- InitrdSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.InitrdSize);
- DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (
- GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(&OptionalData->Arguments.LinuxArguments + 1) + CmdLineSize + InitrdSize)), TRUE, TRUE);
- Print(L"\t- FDT: %s\n", DevicePathTxt);
- } else {
- Print(L"\t- FDT: error, local FDT not specified, using global FDT\n");
- }
- Print(L"\t- LoaderType: Linux kernel with Local FDT\n");
+ case BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT:
+ Print(L"\t- LoaderType: Linux kernel with global FDT support\n");
+ break;
+ case BDS_LOADER_KERNEL_LINUX_LOCAL_FDT:
+ if (ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.FdtLocalSize) > 0) {
+ CmdLineSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.CmdLineSize);
+ InitrdSize = ReadUnaligned16 (&OptionalData->Arguments.LinuxArguments.InitrdSize);
+ DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText (
+ GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(&OptionalData->Arguments.LinuxArguments + 1) + CmdLineSize + InitrdSize)), TRUE, TRUE);
+ Print(L"\t- FDT: %s\n", DevicePathTxt);
+ } else {
+ Print(L"\t- FDT: error, local FDT not specified, using global FDT\n");
+ }
+ Print(L"\t- LoaderType: Linux kernel with Local FDT\n");
break;
default:
Print(L"\t- LoaderType: Not recognized (%d)\n", LoaderType);
- break;
+ break;
}
}
FreePool(DevicePathTxt);
@@ -925,37 +925,37 @@ BootMenuMain (
}
BootOptionCount = OptionCount-1;
- // Display the global FDT config
- Print(L"-----------------------\n");
- {
- EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol;
- EFI_DEVICE_PATH_PROTOCOL* FdtDevicePath;
-
- // Get the default FDT device path
- Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
- ASSERT_EFI_ERROR(Status);
- DefaultFdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath));
-
- // Get the FDT device path
- FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath);
- Status = GetEnvironmentVariable ((CHAR16 *)L"Fdt", &gArmGlobalVariableGuid, DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath);
-
- // Convert FdtDevicePath to text
- if (EFI_ERROR(Status)) {
- DevicePathTxt = L"not configured";
- } else {
- Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
- DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText ( FdtDevicePath, TRUE, TRUE );
- }
- Print(L"Global FDT Config\n\t- %s\n", DevicePathTxt);
+ // Display the global FDT config
+ Print(L"-----------------------\n");
+ {
+ EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL* EfiDevicePathFromTextProtocol;
+ EFI_DEVICE_PATH_PROTOCOL* FdtDevicePath;
+
+ // Get the default FDT device path
+ Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
+ ASSERT_EFI_ERROR(Status);
+ DefaultFdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath));
+
+ // Get the FDT device path
+ FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath);
+ Status = GetEnvironmentVariable ((CHAR16 *)L"Fdt", &gArmGlobalVariableGuid, DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath);
+
+ // Convert FdtDevicePath to text
+ if (EFI_ERROR(Status)) {
+ DevicePathTxt = L"not configured";
+ } else {
+ Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
+ DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText ( FdtDevicePath, TRUE, TRUE );
+ }
+ Print(L"Global FDT Config\n\t- %s\n", DevicePathTxt);
FreePool(DevicePathTxt);
FreePool(DefaultFdtDevicePath);
- }
-
+ }
+
// Display the hardcoded Boot entries
- Print(L"-----------------------\n");
+ Print(L"-----------------------\n");
for (Index = 0; Index < BootMainEntryCount; Index++) {
- Print(L"[%c] %s\n", ('a' + Index), BootMainEntries[Index]);
+ Print(L"[%c] %s\n", ('a' + Index), BootMainEntries[Index]);
OptionCount++;
}
@@ -963,20 +963,20 @@ BootMenuMain (
BootOptionSelected = 0;
while (BootOptionSelected == 0) {
Print(L"Start: ");
- Status = GetHIInputAscii (BootOptionSelectedStr, BOOT_OPTION_LEN);
-
- if (!EFI_ERROR(Status)) {
- if ((BootOptionSelectedStr[0] - '0') < OptionCount) {
- BootOptionSelected = BootOptionSelectedStr[0] - '0';
- } else if ((BootOptionSelectedStr[0] - 'a') < BootMainEntryCount) {
- BootOptionSelected = BootOptionCount + 1 + BootOptionSelectedStr[0] - 'a';
- }
-
- if ((BootOptionSelected == 0) || (BootOptionSelected > OptionCount)) {
- Print(L"Invalid input, please choose a menu option from the list above\n");
- BootOptionSelected = 0;
+ Status = GetHIInputAscii (BootOptionSelectedStr, BOOT_OPTION_LEN);
+
+ if (!EFI_ERROR(Status)) {
+ if ((BootOptionSelectedStr[0] - '0') < OptionCount) {
+ BootOptionSelected = BootOptionSelectedStr[0] - '0';
+ } else if ((BootOptionSelectedStr[0] - 'a') < BootMainEntryCount) {
+ BootOptionSelected = BootOptionCount + 1 + BootOptionSelectedStr[0] - 'a';
+ }
+
+ if ((BootOptionSelected == 0) || (BootOptionSelected > OptionCount)) {
+ Print(L"Invalid input, please choose a menu option from the list above\n");
+ BootOptionSelected = 0;
}
- }
+ }
}
// Start the selected entry
diff --git a/HisiPkg/D01BoardPkg/Bds/BootOption.c b/HisiPkg/D01BoardPkg/Bds/BootOption.c
index d677687f7..08ba7a417 100644
--- a/HisiPkg/D01BoardPkg/Bds/BootOption.c
+++ b/HisiPkg/D01BoardPkg/Bds/BootOption.c
@@ -34,7 +34,7 @@ BootOptionStart (
UINTN CmdLineSize;
UINTN InitrdSize;
EFI_DEVICE_PATH* Initrd;
- UINTN FdtLocalSize;
+ UINTN FdtLocalSize;
UINT16 LoadOptionIndexSize;
if (IS_ARM_BDS_BOOTENTRY (BootOption)) {
@@ -61,7 +61,7 @@ BootOptionStart (
Status = BdsBootLinuxAtag (BootOption->FilePathList,
Initrd, // Initrd
(CHAR8*)(LinuxArguments + 1)); // CmdLine
- } else if ((LoaderType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
+ } else if ((LoaderType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
LinuxArguments = &(OptionalData->Arguments.LinuxArguments);
CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);
InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize);
@@ -72,27 +72,27 @@ BootOptionStart (
Initrd = NULL;
}
- if (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) {
- FdtLocalSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->FdtLocalSize);
-
- if (FdtLocalSize > 0) {
- FdtDevicePath = GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize + InitrdSize));
- } else {
- FdtDevicePath = NULL;
- }
- } else {
- // Get the default FDT device path
- Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
- ASSERT_EFI_ERROR(Status);
- DefaultFdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath));
-
- // Get the FDT device path
- FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath);
+ if (LoaderType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT) {
+ FdtLocalSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->FdtLocalSize);
+
+ if (FdtLocalSize > 0) {
+ FdtDevicePath = GetAlignedDevicePath ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize + InitrdSize));
+ } else {
+ FdtDevicePath = NULL;
+ }
+ } else {
+ // Get the default FDT device path
+ Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
+ ASSERT_EFI_ERROR(Status);
+ DefaultFdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath));
+
+ // Get the FDT device path
+ FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath);
Status = GetEnvironmentVariable ((CHAR16 *)L"Fdt", &gArmGlobalVariableGuid,
- DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath);
- ASSERT_EFI_ERROR(Status);
+ DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath);
+ ASSERT_EFI_ERROR(Status);
FreePool (DefaultFdtDevicePath);
- }
+ }
Status = BdsBootLinuxFdt (BootOption->FilePathList,
Initrd, // Initrd
(CHAR8*)(LinuxArguments + 1),
@@ -171,7 +171,7 @@ BootOptionSetFields (
UINT16 FilePathListLength;
UINT8* EfiLoadOptionPtr;
UINT8* InitrdPathListPtr;
- UINT8* FdtLocalPathListPtr;
+ UINT8* FdtLocalPathListPtr;
UINTN OptionalDataSize;
ARM_BDS_LINUX_ARGUMENTS* DestLinuxArguments;
ARM_BDS_LINUX_ARGUMENTS* SrcLinuxArguments;
@@ -183,8 +183,8 @@ BootOptionSetFields (
BootDescriptionSize = StrSize (BootDescription);
BootOptionalDataSize = sizeof(ARM_BDS_LOADER_OPTIONAL_DATA_HEADER);
- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
- BootOptionalDataSize += sizeof(ARM_BDS_LINUX_ARGUMENTS) + BootArguments->LinuxArguments.CmdLineSize + BootArguments->LinuxArguments.InitrdSize + BootArguments->LinuxArguments.FdtLocalSize;
+ if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
+ BootOptionalDataSize += sizeof(ARM_BDS_LINUX_ARGUMENTS) + BootArguments->LinuxArguments.CmdLineSize + BootArguments->LinuxArguments.InitrdSize + BootArguments->LinuxArguments.FdtLocalSize;
}
// Compute the size of the FilePath list
@@ -226,13 +226,13 @@ BootOptionSetFields (
OptionalDataSize = sizeof(ARM_BDS_LOADER_OPTIONAL_DATA_HEADER);
- if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
+ if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT) || (BootType == BDS_LOADER_KERNEL_LINUX_LOCAL_FDT)) {
SrcLinuxArguments = &(BootArguments->LinuxArguments);
DestLinuxArguments = &((ARM_BDS_LOADER_OPTIONAL_DATA*)EfiLoadOptionPtr)->Arguments.LinuxArguments;
WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->CmdLineSize), SrcLinuxArguments->CmdLineSize);
WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->InitrdSize), SrcLinuxArguments->InitrdSize);
- WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->FdtLocalSize), SrcLinuxArguments->FdtLocalSize);
+ WriteUnaligned16 ((UINT16 *)&(DestLinuxArguments->FdtLocalSize), SrcLinuxArguments->FdtLocalSize);
OptionalDataSize += sizeof (ARM_BDS_LINUX_ARGUMENTS);
if (SrcLinuxArguments->CmdLineSize > 0) {
@@ -244,11 +244,11 @@ BootOptionSetFields (
InitrdPathListPtr = (UINT8*)((UINTN)(DestLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize);
CopyMem (InitrdPathListPtr, (VOID*)((UINTN)(SrcLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize), SrcLinuxArguments->InitrdSize);
}
-
- if (SrcLinuxArguments->FdtLocalSize > 0) {
- FdtLocalPathListPtr = (UINT8*)((UINTN)(DestLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize + SrcLinuxArguments->InitrdSize);
- CopyMem (FdtLocalPathListPtr, (VOID*)((UINTN)(SrcLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize + SrcLinuxArguments->InitrdSize), SrcLinuxArguments->FdtLocalSize);
- }
+
+ if (SrcLinuxArguments->FdtLocalSize > 0) {
+ FdtLocalPathListPtr = (UINT8*)((UINTN)(DestLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize + SrcLinuxArguments->InitrdSize);
+ CopyMem (FdtLocalPathListPtr, (VOID*)((UINTN)(SrcLinuxArguments + 1) + SrcLinuxArguments->CmdLineSize + SrcLinuxArguments->InitrdSize), SrcLinuxArguments->FdtLocalSize);
+ }
}
BootOption->OptionalDataSize = OptionalDataSize;
diff --git a/HisiPkg/D01BoardPkg/Bds/BootOptionSupport.c b/HisiPkg/D01BoardPkg/Bds/BootOptionSupport.c
index 7c1ca13b1..d5463c6fc 100644
--- a/HisiPkg/D01BoardPkg/Bds/BootOptionSupport.c
+++ b/HisiPkg/D01BoardPkg/Bds/BootOptionSupport.c
@@ -235,7 +235,7 @@ BootDeviceGetType (
EFI_STATUS Status;
BOOLEAN IsEfiApp;
BOOLEAN IsBootLoader;
- CHAR16 FDTType[ LOCAL_FDT_RESPONSE_LEN ];
+ CHAR16 FDTType[ LOCAL_FDT_RESPONSE_LEN ];
if (FileName == NULL) {
Print(L"Is an EFI Application? ");
@@ -260,19 +260,19 @@ BootDeviceGetType (
}
*BootType = BDS_LOADER_EFI_APPLICATION;
} else {
- Print(L"Boot Type: [a] ATAGS, [g] Global FDT or [l] Local FDT? [a/g/l] ");
- Status = GetHIInputStr (FDTType, LOCAL_FDT_RESPONSE_LEN );
+ Print(L"Boot Type: [a] ATAGS, [g] Global FDT or [l] Local FDT? [a/g/l] ");
+ Status = GetHIInputStr (FDTType, LOCAL_FDT_RESPONSE_LEN );
if (EFI_ERROR(Status)) {
return EFI_ABORTED;
}
- if (StrCmp(FDTType, L"g") == 0) {
- *BootType = BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT;
- } else if (StrCmp(FDTType, L"l") == 0) {
- *BootType = BDS_LOADER_KERNEL_LINUX_LOCAL_FDT;
- } else if (StrCmp(FDTType, L"a") == 0) {
+ if (StrCmp(FDTType, L"g") == 0) {
+ *BootType = BDS_LOADER_KERNEL_LINUX_GLOBAL_FDT;
+ } else if (StrCmp(FDTType, L"l") == 0) {
+ *BootType = BDS_LOADER_KERNEL_LINUX_LOCAL_FDT;
+ } else if (StrCmp(FDTType, L"a") == 0) {
*BootType = BDS_LOADER_KERNEL_LINUX_ATAG;
- } else {
- return EFI_ABORTED;
+ } else {
+ return EFI_ABORTED;
}
}