]> git.ozlabs.org Git - yaboot.git/blob - include/gpt-part.h
Fix partitions bigger than 2TB
[yaboot.git] / include / gpt-part.h
1 /*
2  *  gpt-part.h - Structure of gpt partition table
3  *
4  *  Copyright (C) 2013 Dinar Valeev
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  */
20
21 #include <byteorder.h>
22
23 #define GPT_LINUX_NATIVE \
24 ((gpt_part_type_t){ cpu_to_le32(0x0FC63DAF), cpu_to_le16(0x8483), cpu_to_le16(0x4772),0x8E, 0x79, \
25         {0x3D, 0x69, 0xD8, 0x47, 0x7D, 0xE4}})
26 #define GPT_LINUX_RAID \
27 ((gpt_part_type_t){ cpu_to_le32(0xa19d880f), cpu_to_le16(0x05fc), cpu_to_le16(0x4d3b), 0xa0, 0x06, \
28         { 0x74, 0x3f, 0x0f, 0x84, 0x91, 0x1e }})
29 #define GPT_BASIC_DATA \
30 ((gpt_part_type_t){ cpu_to_le32 (0xebd0a0a2), cpu_to_le16 (0xb9e5), cpu_to_le16 (0x4433), 0x87, 0xc0, \
31         { 0x68, 0xb6, 0xb7, 0x26, 0x99, 0xC7 }})
32
33
34 #define GPT_HEADER_SIGNATURE 0x5452415020494645LL
35
36 typedef struct
37 {
38  u32 data1;
39  u16 data2;
40  u16 data3;
41  u8  data4;
42  u8  data5;
43  u8  data6[6];
44 } gpt_part_type_t;
45
46 struct gpt_partition {
47         gpt_part_type_t type;           /* Partition type GUID */
48         u8  guid[16];                   /* Unique partition GUID */
49         u64 start;                      /* First partition LBA */
50         u64 end;                        /* End LBA */
51         u64 flags;                      /* Attribute flags */
52         char name[72];                  /* Partition name */
53 } __attribute__ ((packed));
54
55 struct gpt_header {
56         u64 signature;
57         u32 revision;
58         u32 header_size;
59         u32 header_crc32;
60         u32 reserved;
61         u64 primary;
62         u64 backup;
63         u64 start;
64         u64 end;
65         u8  dguid[16];
66         u64 partitions;
67         u32 maxpart;
68         u32 partentry_size;
69         u32 partentry_crc32;
70 } __attribute__ ((packed));