22ValidateAndroidMediaDevicePath (
28 NextNode = DevicePath;
29 while (NextNode !=
NULL) {
31 if ((Node->
Type == MEDIA_DEVICE_PATH) &&
40 return EFI_INVALID_PARAMETER;
45AndroidBootAppEntryPoint (
55 UINT32 MediaId, BlockSize;
60 BootPathStr = (CHAR16 *)
PcdGetPtr (PcdAndroidBootDevicePath);
61 ASSERT (BootPathStr !=
NULL);
62 Status =
gBS->LocateProtocol (
63 &gEfiDevicePathFromTextProtocolGuid,
65 (VOID **)&EfiDevicePathFromTextProtocol
68 DevicePath = (
EFI_DEVICE_PATH *)EfiDevicePathFromTextProtocol->ConvertTextToDevicePath (BootPathStr);
69 ASSERT (DevicePath !=
NULL);
71 Status = ValidateAndroidMediaDevicePath (DevicePath);
72 if (EFI_ERROR (Status)) {
76 Status =
gBS->LocateDevicePath (
77 &gEfiDevicePathProtocolGuid,
81 if (EFI_ERROR (Status)) {
85 Status =
gBS->OpenProtocol (
87 &gEfiBlockIoProtocolGuid,
91 EFI_OPEN_PROTOCOL_GET_PROTOCOL
93 if (EFI_ERROR (Status)) {
94 DEBUG ((DEBUG_ERROR,
"Failed to get BlockIo: %r\n", Status));
98 MediaId = BlockIo->Media->MediaId;
99 BlockSize = BlockIo->Media->BlockSize;
101 if (Buffer ==
NULL) {
102 return EFI_BUFFER_TOO_SMALL;
106 Status = BlockIo->ReadBlocks (
113 Status = AndroidBootImgGetImgSize (Buffer, &BootImgSize);
114 if (EFI_ERROR (Status)) {
115 DEBUG ((DEBUG_ERROR,
"Failed to get AndroidBootImg Size: %r\n", Status));
119 BootImgSize =
ALIGN_VALUE (BootImgSize, BlockSize);
124 if (Buffer ==
NULL) {
125 return EFI_BUFFER_TOO_SMALL;
129 Status = BlockIo->ReadBlocks (
136 if (EFI_ERROR (Status)) {
137 DEBUG ((DEBUG_ERROR,
"Failed to read blocks: %r\n", Status));
141 Status = AndroidBootImgBoot (Buffer, BootImgSize);
#define MEDIA_HARDDRIVE_DP
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages)
#define ALIGN_VALUE(Value, Alignment)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
#define PcdGetPtr(TokenName)
VOID *EFIAPI AllocatePages(IN UINTN Pages)
#define EFI_SIZE_TO_PAGES(Size)