MdeModulePkg/ScsiBusDxe: don't produce ScsiIo for nonexistent LUNs, part 2
[mirror_edk2.git] / EmbeddedPkg / Include / Library / AndroidBootImgLib.h
CommitLineData
6e414300
JN
1/** @file\r
2\r
3 Copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>\r
4 Copyright (c) 2017, Linaro.\r
5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef __ABOOTIMG_H__\r
17#define __ABOOTIMG_H__\r
18\r
19#include <Library/BaseLib.h>\r
20#include <Library/DebugLib.h>\r
21#include <Library/MemoryAllocationLib.h>\r
22\r
23#include <Uefi/UefiBaseType.h>\r
24#include <Uefi/UefiSpec.h>\r
25\r
26#define ANDROID_BOOTIMG_KERNEL_ARGS_SIZE 512\r
27\r
28#define ANDROID_BOOT_MAGIC "ANDROID!"\r
29#define ANDROID_BOOT_MAGIC_LENGTH (sizeof (ANDROID_BOOT_MAGIC) - 1)\r
30\r
31// No documentation for this really - sizes of fields has been determined\r
32// empirically.\r
33#pragma pack(1)\r
34/* https://android.googlesource.com/platform/system/core/+/master/mkbootimg/bootimg.h */\r
35typedef struct {\r
36 UINT8 BootMagic[ANDROID_BOOT_MAGIC_LENGTH];\r
37 UINT32 KernelSize;\r
38 UINT32 KernelAddress;\r
39 UINT32 RamdiskSize;\r
40 UINT32 RamdiskAddress;\r
41 UINT32 SecondStageBootloaderSize;\r
42 UINT32 SecondStageBootloaderAddress;\r
43 UINT32 KernelTaggsAddress;\r
44 UINT32 PageSize;\r
45 UINT32 Reserved[2];\r
46 CHAR8 ProductName[16];\r
47 CHAR8 KernelArgs[ANDROID_BOOTIMG_KERNEL_ARGS_SIZE];\r
48 UINT32 Id[32];\r
49} ANDROID_BOOTIMG_HEADER;\r
50#pragma pack ()\r
51\r
52/* Check Val (unsigned) is a power of 2 (has only one bit set) */\r
53#define IS_POWER_OF_2(Val) ((Val) != 0 && (((Val) & ((Val) - 1)) == 0))\r
54/* Android boot image page size is not specified, but it should be power of 2\r
55 * and larger than boot header */\r
56#define IS_VALID_ANDROID_PAGE_SIZE(Val) \\r
57 (IS_POWER_OF_2(Val) && (Val > sizeof(ANDROID_BOOTIMG_HEADER)))\r
58#endif /* __ABOOTIMG_H__ */\r