efi.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* Copyright Statement:
  2. *
  3. * This software/firmware and related documentation ("MediaTek Software") are
  4. * protected under relevant copyright laws. The information contained herein
  5. * is confidential and proprietary to MediaTek Inc. and/or its licensors.
  6. * Without the prior written permission of MediaTek inc. and/or its licensors,
  7. * any reproduction, modification, use or disclosure of MediaTek Software,
  8. * and information contained herein, in whole or in part, shall be strictly prohibited.
  9. */
  10. /* MediaTek Inc. (C) 2015. All rights reserved.
  11. *
  12. * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  13. * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  14. * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
  15. * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  18. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  19. * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  20. * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
  21. * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
  22. * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
  23. * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
  24. * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
  25. * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
  26. * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  27. * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  28. * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
  29. * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  30. */
  31. #ifndef __EFI_H__
  32. #define __EFI_H__
  33. typedef struct {
  34. u8 b[16];
  35. } __attribute__((packed)) efi_guid_t;
  36. typedef struct {
  37. u64 signature;
  38. u32 revision;
  39. u32 header_size;
  40. u32 header_crc32;
  41. u32 reserved;
  42. u64 my_lba;
  43. u64 alternate_lba;
  44. u64 first_usable_lba;
  45. u64 last_usable_lba;
  46. efi_guid_t disk_guid;
  47. u64 partition_entry_lba;
  48. u32 num_partition_entries;
  49. u32 sizeof_partition_entry;
  50. u32 partition_entry_array_crc32;
  51. } __attribute__((packed)) gpt_header;
  52. #define GPT_ENTRY_NAME_LEN (72 / sizeof(u16))
  53. typedef struct {
  54. efi_guid_t partition_type_guid;
  55. efi_guid_t unique_partition_guid;
  56. u64 starting_lba;
  57. u64 ending_lba;
  58. u64 attributes;
  59. u16 partition_name[GPT_ENTRY_NAME_LEN];
  60. } __attribute__((packed))gpt_entry;
  61. #define GPT_PROTECTIVE_MBR (0xEE)
  62. typedef struct {
  63. u8 boot_ind;
  64. u8 head;
  65. u8 sector;
  66. u8 cyl;
  67. u8 sys_ind;
  68. u8 end_head;
  69. u8 end_sector;
  70. u8 end_cyl;
  71. u32 start_sector;
  72. u32 nr_sects;
  73. } __attribute__((packed)) mbr_partition;
  74. typedef struct {
  75. u8 boot_code[440];
  76. u32 unique_mbr_signature;
  77. u16 unknown;
  78. mbr_partition partition_record[4];
  79. u16 signature;
  80. } __attribute__((packed)) pmbr;
  81. #define GPT_HEADER_SIGNATURE 0x5452415020494645ULL
  82. #endif