/*1* Copyright (c) 2018 naehrwert2* Copyright (c) 2019 CTCaer3*4* This program is free software; you can redistribute it and/or modify it5* under the terms and conditions of the GNU General Public License,6* version 2, as published by the Free Software Foundation.7*8* This program is distributed in the hope it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for11* more details.12*13* You should have received a copy of the GNU General Public License14* along with this program. If not, see <http://www.gnu.org/licenses/>.15*/1617#ifndef MBR_GPT_H18#define MBR_GPT_H1920#include <utils/types.h>2122typedef struct _mbr_chs_t23{24u8 head;25u8 sector;26u8 cylinder;27} __attribute__((packed)) mbr_chs_t;2829typedef struct _mbr_part_t30{31u8 status;32mbr_chs_t start_sct_chs;33u8 type;34mbr_chs_t end_sct_chs;35u32 start_sct;36u32 size_sct;37} __attribute__((packed)) mbr_part_t;3839typedef struct _mbr_t40{41/* 0x000 */ u8 bootstrap[440];42/* 0x1B8 */ u32 signature;43/* 0x1BC */ u16 copy_protected;44/* 0x1BE */ mbr_part_t partitions[4];45/* 0x1FE */ u16 boot_signature;46} __attribute__((packed)) mbr_t;4748typedef struct _gpt_entry_t49{50/* 0x00 */ u8 type_guid[0x10];51/* 0x10 */ u8 part_guid[0x10];52/* 0x20 */ u64 lba_start;53/* 0x28 */ u64 lba_end;54/* 0x30 */ u64 attrs;55/* 0x38 */ u16 name[36];56} gpt_entry_t;5758typedef struct _gpt_header_t59{60/* 0x00 */ u64 signature; // "EFI PART"61/* 0x08 */ u32 revision;62/* 0x0C */ u32 size;63/* 0x10 */ u32 crc32;64/* 0x14 */ u32 res1;65/* 0x18 */ u64 my_lba;66/* 0x20 */ u64 alt_lba;67/* 0x28 */ u64 first_use_lba;68/* 0x30 */ u64 last_use_lba;69/* 0x38 */ u8 disk_guid[0x10];70/* 0x48 */ u64 part_ent_lba;71/* 0x50 */ u32 num_part_ents;72/* 0x54 */ u32 part_ent_size;73/* 0x58 */ u32 part_ents_crc32;74/* 0x5C */ u8 res2[420]; // Used as first 3 partition entries backup for HOS.75} gpt_header_t;7677typedef struct _gpt_t78{79gpt_header_t header;80gpt_entry_t entries[128];81} gpt_t;8283#endif848586