OpenZFS 7004 - dmu_tx_hold_zap() does dnode_hold() 7x on same object
[zfs.git] / include / sys / efi_partition.h
blobb8f33228143c768221bffba5f10e563bb0967d15
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
26 #ifndef _SYS_EFI_PARTITION_H
27 #define _SYS_EFI_PARTITION_H
29 #include <sys/uuid.h>
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
36 * GUID Partition Table Header
39 #define EFI_MIN_LABEL_SIZE 92
40 #define EFI_LABEL_SIZE 512
41 #define LEN_EFI_PAD (EFI_LABEL_SIZE - \
42 ((5 * sizeof (diskaddr_t)) + \
43 (7 * sizeof (uint_t)) + \
44 (8 * sizeof (char)) + \
45 (1 * (sizeof (struct uuid)))))
47 #define EFI_SIGNATURE 0x5452415020494645ULL
49 /* EFI Guid Partition Table Header -- little endian on-disk format */
50 typedef struct efi_gpt {
51 uint64_t efi_gpt_Signature;
52 uint_t efi_gpt_Revision;
53 uint_t efi_gpt_HeaderSize;
54 uint_t efi_gpt_HeaderCRC32;
55 uint_t efi_gpt_Reserved1;
56 diskaddr_t efi_gpt_MyLBA;
57 diskaddr_t efi_gpt_AlternateLBA;
58 diskaddr_t efi_gpt_FirstUsableLBA;
59 diskaddr_t efi_gpt_LastUsableLBA;
60 struct uuid efi_gpt_DiskGUID;
61 diskaddr_t efi_gpt_PartitionEntryLBA;
62 uint_t efi_gpt_NumberOfPartitionEntries;
63 uint_t efi_gpt_SizeOfPartitionEntry;
64 uint_t efi_gpt_PartitionEntryArrayCRC32;
65 char efi_gpt_Reserved2[LEN_EFI_PAD];
66 } efi_gpt_t;
68 /* EFI Guid Partition Entry Attributes -- little endian format */
69 typedef struct efi_gpe_Attrs {
70 uint32_t PartitionAttrs :16,
71 Reserved2 :16;
72 uint32_t Reserved1 :31,
73 RequiredPartition :1;
74 } efi_gpe_Attrs_t;
77 * 6a96237f-1dd2-11b2-99a6-080020736631 V_UNASSIGNED (not used as such)
78 * 6a82cb45-1dd2-11b2-99a6-080020736631 V_BOOT
79 * 6a85cf4d-1dd2-11b2-99a6-080020736631 V_ROOT
80 * 6a87c46f-1dd2-11b2-99a6-080020736631 V_SWAP
81 * 6a898cc3-1dd2-11b2-99a6-080020736631 V_USR
82 * 6a8b642b-1dd2-11b2-99a6-080020736631 V_BACKUP
83 * 6a8d2ac7-1dd2-11b2-99a6-080020736631 V_STAND (not used)
84 * 6a8ef2e9-1dd2-11b2-99a6-080020736631 V_VAR
85 * 6a90ba39-1dd2-11b2-99a6-080020736631 V_HOME
86 * 6a9283a5-1dd2-11b2-99a6-080020736631 V_ALTSCTR
87 * 6a945a3b-1dd2-11b2-99a6-080020736631 V_CACHE
90 #define EFI_UNUSED { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, \
91 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
92 #define EFI_RESV1 { 0x6a96237f, 0x1dd2, 0x11b2, 0x99, 0xa6, \
93 { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } }
94 #define EFI_BOOT { 0x6a82cb45, 0x1dd2, 0x11b2, 0x99, 0xa6, \
95 { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } }
96 #define EFI_ROOT { 0x6a85cf4d, 0x1dd2, 0x11b2, 0x99, 0xa6, \
97 { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } }
98 #define EFI_SWAP { 0x6a87c46f, 0x1dd2, 0x11b2, 0x99, 0xa6, \
99 { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } }
100 #define EFI_USR { 0x6a898cc3, 0x1dd2, 0x11b2, 0x99, 0xa6, \
101 { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } }
102 #define EFI_BACKUP { 0x6a8b642b, 0x1dd2, 0x11b2, 0x99, 0xa6, \
103 { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } }
104 #define EFI_RESV2 { 0x6a8d2ac7, 0x1dd2, 0x11b2, 0x99, 0xa6, \
105 { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } }
106 #define EFI_VAR { 0x6a8ef2e9, 0x1dd2, 0x11b2, 0x99, 0xa6, \
107 { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } }
108 #define EFI_HOME { 0x6a90ba39, 0x1dd2, 0x11b2, 0x99, 0xa6, \
109 { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } }
110 #define EFI_ALTSCTR { 0x6a9283a5, 0x1dd2, 0x11b2, 0x99, 0xa6, \
111 { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } }
112 #define EFI_RESERVED { 0x6a945a3b, 0x1dd2, 0x11b2, 0x99, 0xa6, \
113 { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } }
114 #define EFI_SYSTEM { 0xC12A7328, 0xF81F, 0x11d2, 0xBA, 0x4B, \
115 { 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B } }
116 #define EFI_LEGACY_MBR { 0x024DEE41, 0x33E7, 0x11d3, 0x9D, 0x69, \
117 { 0x00, 0x08, 0xC7, 0x81, 0xF3, 0x9F } }
118 #define EFI_SYMC_PUB { 0x6a9630d1, 0x1dd2, 0x11b2, 0x99, 0xa6, \
119 { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } }
120 #define EFI_SYMC_CDS { 0x6a980767, 0x1dd2, 0x11b2, 0x99, 0xa6, \
121 { 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } }
122 #define EFI_MSFT_RESV { 0xE3C9E316, 0x0B5C, 0x4DB8, 0x81, 0x7D, \
123 { 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE } }
124 #define EFI_DELL_BASIC { 0xebd0a0a2, 0xb9e5, 0x4433, 0x87, 0xc0, \
125 { 0x68, 0xb6, 0xb7, 0x26, 0x99, 0xc7 } }
126 #define EFI_DELL_RAID { 0xa19d880f, 0x05fc, 0x4d3b, 0xa0, 0x06, \
127 { 0x74, 0x3f, 0x0f, 0x84, 0x91, 0x1e } }
128 #define EFI_DELL_SWAP { 0x0657fd6d, 0xa4ab, 0x43c4, 0x84, 0xe5, \
129 { 0x09, 0x33, 0xc8, 0x4b, 0x4f, 0x4f } }
130 #define EFI_DELL_LVM { 0xe6d6d379, 0xf507, 0x44c2, 0xa2, 0x3c, \
131 { 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28 } }
132 #define EFI_DELL_RESV { 0x8da63339, 0x0007, 0x60c0, 0xc4, 0x36, \
133 { 0x08, 0x3a, 0xc8, 0x23, 0x09, 0x08 } }
134 #define EFI_AAPL_HFS { 0x48465300, 0x0000, 0x11aa, 0xaa, 0x11, \
135 { 0x00, 0x30, 0x65, 0x43, 0xec, 0xac } }
136 #define EFI_AAPL_UFS { 0x55465300, 0x0000, 0x11aa, 0xaa, 0x11, \
137 { 0x00, 0x30, 0x65, 0x43, 0xec, 0xac } }
138 #define EFI_FREEBSD_BOOT { 0x83bd6b9d, 0x7f41, 0x11dc, 0xbe, 0x0b, \
139 { 0x00, 0x15, 0x60, 0xb8, 0x4f, 0x0f } }
140 #define EFI_FREEBSD_SWAP { 0x516e7cb5, 0x6ecf, 0x11d6, 0x8f, 0xf8, \
141 { 0x00, 0x02, 0x2d, 0x09, 0x71, 0x2b } }
142 #define EFI_FREEBSD_UFS { 0x516e7cb6, 0x6ecf, 0x11d6, 0x8f, 0xf8, \
143 { 0x00, 0x02, 0x2d, 0x09, 0x71, 0x2b } }
144 #define EFI_FREEBSD_VINUM { 0x516e7cb8, 0x6ecf, 0x11d6, 0x8f, 0xf8, \
145 { 0x00, 0x02, 0x2d, 0x09, 0x71, 0x2b } }
146 #define EFI_FREEBSD_ZFS { 0x516e7cba, 0x6ecf, 0x11d6, 0x8f, 0xf8, \
147 { 0x00, 0x02, 0x2d, 0x09, 0x71, 0x2b } }
149 /* From Wikipedia */
151 #define EFI_BIOS_BOOT { 0x21686148, 0x6449, 0x6e6f, 0x74, 0x4e, \
152 { 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 } }
153 #define EFI_INTC_RS { 0xd3bfe2de, 0x3daf, 0x11df, 0xba, 0x40, \
154 { 0xe3, 0xa5, 0x56, 0xd8, 0x95, 0x93 } }
155 #define EFI_SNE_BOOT { 0xf4019732, 0x066e, 0x4e12, 0x82, 0x73, \
156 { 0x34, 0x6c, 0x56, 0x41, 0x49, 0x4f } }
157 #define EFI_LENOVO_BOOT { 0xbfbfafe7, 0xa34f, 0x448a, 0x9a, 0x5b, \
158 { 0x62, 0x13, 0xeb, 0x73, 0x6c, 0x22 } }
159 #define EFI_MSFT_LDMM { 0x5808c8aa, 0x7e8f, 0x42e0, 0x85, 0xd2, \
160 { 0xe1, 0xe9, 0x04, 0x34, 0xcf, 0xb3 } }
161 #define EFI_MSFT_LDMD { 0xaf9b60a0, 0x1431, 0x4f62, 0xbc, 0x68, \
162 { 0x33, 0x11, 0x71, 0x4a, 0x69, 0xad } }
163 #define EFI_MSFT_RE { 0xde94bba4, 0x06d1, 0x4d40, 0xa1, 0x6a, \
164 { 0xbf, 0xd5, 0x01, 0x79, 0xd6, 0xac } }
165 #define EFI_IBM_GPFS { 0x37affc90, 0xef7d, 0x4e96, 0x91, 0xc3, \
166 { 0x2d, 0x7a, 0xe0, 0x55, 0xb1, 0x74 } }
167 #define EFI_MSFT_STORAGESPACES { 0xe75caf8f, 0xf680, 0x4cee, 0xaf, 0xa3, \
168 { 0xb0, 0x01, 0xe5, 0x6e, 0xfc, 0x2d } }
169 #define EFI_HPQ_DATA { 0x75894c1e, 0x3aeb, 0x11d3, 0xb7, 0xc1, \
170 { 0x7b, 0x03, 0xa0, 0x00, 0x00, 0x00 } }
171 #define EFI_HPQ_SVC { 0xe2a1e728, 0x32e3, 0x11d6, 0xa6, 0x82, \
172 { 0x7b, 0x03, 0xa0, 0x00, 0x00, 0x00 } }
173 #define EFI_RHT_DATA { 0x0fc63daf, 0x8483, 0x4772, 0x8e, 0x79, \
174 { 0x3d, 0x69, 0xd8, 0x47, 0x7d, 0xe4 } }
175 #define EFI_RHT_HOME { 0x933ac7e1, 0x2eb4, 0x4f13, 0xb8, 0x44, \
176 { 0x0e, 0x14, 0xe2, 0xae, 0xf9, 0x15 } }
177 #define EFI_RHT_SRV { 0x3b8f8425, 0x20e0, 0x4f3b, 0x90, 0x7f, \
178 { 0x1a, 0x25, 0xa7, 0x6f, 0x98, 0xe8 } }
179 #define EFI_RHT_DMCRYPT { 0x7ffec5c9, 0x2d00, 0x49b7, 0x89, 0x41, \
180 { 0x3e, 0xa1, 0x0a, 0x55, 0x86, 0xb7 } }
181 #define EFI_RHT_LUKS { 0xca7d7ccb, 0x63ed, 0x4c53, 0x86, 0x1c, \
182 { 0x17, 0x42, 0x53, 0x60, 0x59, 0xcc } }
183 #define EFI_FREEBSD_DISKLABEL { 0x516e7cb4, 0x6ecf, 0x11d6, 0x8f, 0xf8, \
184 { 0x00, 0x02, 0x2d, 0x09, 0x71, 0x2b } }
185 #define EFI_AAPL_RAID { 0x52414944, 0x0000, 0x11aa, 0xaa, 0x11, \
186 { 0x00, 0x30, 0x65, 0x43, 0xec, 0xac } }
187 #define EFI_AAPL_RAIDOFFLINE { 0x52414944, 0x5f4f, 0x11aa, 0xaa, 0x11, \
188 { 0x00, 0x30, 0x65, 0x43, 0xec, 0xac } }
189 #define EFI_AAPL_BOOT { 0x426f6f74, 0x0000, 0x11aa, 0xaa, 0x11, \
190 { 0x00, 0x30, 0x65, 0x43, 0xec, 0xac } }
191 #define EFI_AAPL_LABEL { 0x4c616265, 0x6c00, 0x11aa, 0xaa, 0x11, \
192 { 0x00, 0x30, 0x65, 0x43, 0xec, 0xac } }
193 #define EFI_AAPL_TVRECOVERY { 0x5265636f, 0x7665, 0x11aa, 0xaa, 0x11, \
194 { 0x00, 0x30, 0x65, 0x43, 0xec, 0xac } }
195 #define EFI_AAPL_CORESTORAGE { 0x53746f72, 0x6167, 0x11aa, 0xaa, 0x11, \
196 { 0x00, 0x30, 0x65, 0x43, 0xec, 0xac } }
197 #define EFI_NETBSD_SWAP { 0x49f48d32, 0xb10e, 0x11dc, 0xb9, 0x9b, \
198 { 0x00, 0x19, 0xd1, 0x87, 0x96, 0x48 } }
199 #define EFI_NETBSD_FFS { 0x49f48d5a, 0xb10e, 0x11dc, 0xb9, 0x9b, \
200 { 0x00, 0x19, 0xd1, 0x87, 0x96, 0x48 } }
201 #define EFI_NETBSD_LFS { 0x49f48d82, 0xb10e, 0x11dc, 0xb9, 0x9b, \
202 { 0x00, 0x19, 0xd1, 0x87, 0x96, 0x48 } }
203 #define EFI_NETBSD_RAID { 0x49f48daa, 0xb10e, 0x11dc, 0xb9, 0x9b, \
204 { 0x00, 0x19, 0xd1, 0x87, 0x96, 0x48 } }
205 #define EFI_NETBSD_CAT { 0x2db519c4, 0xb10f, 0x11dc, 0xb9, 0x9b, \
206 { 0x00, 0x19, 0xd1, 0x87, 0x96, 0x48 } }
207 #define EFI_NETBSD_CRYPT { 0x2db519ec, 0xb10f, 0x11dc, 0xb9, 0x9b, \
208 { 0x00, 0x19, 0xd1, 0x87, 0x96, 0x48 } }
209 #define EFI_GOOG_KERN { 0xfe3a2a5d, 0x4f32, 0x41a7, 0xb7, 0x25, \
210 { 0xac, 0xcc, 0x32, 0x85, 0xa3, 0x09 } }
211 #define EFI_GOOG_ROOT { 0x3cb8e202, 0x3b7e, 0x47dd, 0x8a, 0x3c, \
212 { 0x7f, 0xf2, 0xa1, 0x3c, 0xfc, 0xec } }
213 #define EFI_GOOG_RESV { 0x2e0a753d, 0x9e48, 0x43b0, 0x83, 0x37, \
214 { 0xb1, 0x51, 0x92, 0xcb, 0x1b, 0x5e } }
215 #define EFI_HAIKU_BFS { 0x42465331, 0x3ba3, 0x10f1, 0x80, 0x2a, \
216 { 0x48, 0x61, 0x69, 0x6b, 0x75, 0x21 } }
217 #define EFI_MIDNIGHTBSD_BOOT { 0x85d5e45e, 0x237c, 0x11e1, 0xb4, 0xb3, \
218 { 0xe8, 0x9a, 0x8f, 0x7f, 0xc3, 0xa7 } }
219 #define EFI_MIDNIGHTBSD_DATA { 0x85d5e45a, 0x237c, 0x11e1, 0xb4, 0xb3, \
220 { 0xe8, 0x9a, 0x8f, 0x7f, 0xc3, 0xa7 } }
221 #define EFI_MIDNIGHTBSD_SWAP { 0x85d5e45b, 0x237c, 0x11e1, 0xb4, 0xb3, \
222 { 0xe8, 0x9a, 0x8f, 0x7f, 0xc3, 0xa7 } }
223 #define EFI_MIDNIGHTBSD_UFS { 0x0394ef8b, 0x237e, 0x11e1, 0xb4, 0xb3, \
224 { 0xe8, 0x9a, 0x8f, 0x7f, 0xc3, 0xa7 } }
225 #define EFI_MIDNIGHTBSD_VINUM { 0x85d5e45c, 0x237c, 0x11e1, 0xb4, 0xb3, \
226 { 0xe8, 0x9a, 0x8f, 0x7f, 0xc3, 0xa7 } }
227 #define EFI_MIDNIGHTBSD_ZFS { 0x85d5e45d, 0x237c, 0x11e1, 0xb4, 0xb3, \
228 { 0xe8, 0x9a, 0x8f, 0x7f, 0xc3, 0xa7 } }
229 #define EFI_CEPH_JOURNAL { 0x45b0969e, 0x9b03, 0x4f30, 0xb4, 0xc6, \
230 { 0xb4, 0xb8, 0x0c, 0xef, 0xf1, 0x06 } }
231 #define EFI_CEPH_DMCRYPTJOURNAL { 0x45b0969e, 0x9b03, 0x4f30, 0xb4, 0xc6, \
232 { 0x5e, 0xc0, 0x0c, 0xef, 0xf1, 0x06 } }
233 #define EFI_CEPH_OSD { 0x4fbd7e29, 0x9d25, 0x41b8, 0xaf, 0xd0, \
234 { 0x06, 0x2c, 0x0c, 0xef, 0xf0, 0x5d } }
235 #define EFI_CEPH_DMCRYPTOSD { 0x4fbd7e29, 0x9d25, 0x41b8, 0xaf, 0xd0, \
236 { 0x5e, 0xc0, 0x0c, 0xef, 0xf0, 0x5d } }
237 #define EFI_CEPH_CREATE { 0x89c57f98, 0x2fe5, 0x4dc0, 0x89, 0xc1, \
238 { 0xf3, 0xad, 0x0c, 0xef, 0xf2, 0xbe } }
239 #define EFI_CEPH_DMCRYPTCREATE { 0x89c57f98, 0x2fe5, 0x4dc0, 0x89, 0xc1, \
240 { 0x5e, 0xc0, 0x0c, 0xef, 0xf2, 0xbe } }
241 #define EFI_OPENBSD_DISKLABEL { 0x824cc7a0, 0x36a8, 0x11e3, 0x89, 0x0a, \
242 { 0x95, 0x25, 0x19, 0xad, 0x3f, 0x61 } }
243 #define EFI_BBRY_QNX { 0xcef5a9ad, 0x73bc, 0x4601, 0x89, 0xf3, \
244 { 0xcd, 0xee, 0xee, 0xe3, 0x21, 0xa1 } }
245 #define EFI_BELL_PLAN9 { 0xc91818f9, 0x8025, 0x47af, 0x89, 0xd2, \
246 { 0xf0, 0x30, 0xd7, 0x00, 0x0c, 0x2c } }
247 #define EFI_VMW_KCORE { 0x9d275380, 0x40ad, 0x11db, 0xbf, 0x97, \
248 { 0x00, 0x0c, 0x29, 0x11, 0xd1, 0xb8 } }
249 #define EFI_VMW_VMFS { 0xaa31e02a, 0x400f, 0x11db, 0x95, 0x90, \
250 { 0x00, 0x0c, 0x29, 0x11, 0xd1, 0xb8 } }
251 #define EFI_VMW_RESV { 0x9198effc, 0x31c0, 0x11db, 0x8f, 0x78, \
252 { 0x00, 0x0c, 0x29, 0x11, 0xd1, 0xb8 } }
254 /* From GPT fdisk */
256 #define EFI_RHT_ROOTX86 { 0x44479540, 0xf297, 0x41b2, 0x9a, 0xf7, \
257 { 0xd1, 0x31, 0xd5, 0xf0, 0x45, 0x8a } }
258 #define EFI_RHT_ROOTAMD64 { 0x4f68bce3, 0xe8cd, 0x4db1, 0x96, 0xe7, \
259 { 0xfb, 0xca, 0xf9, 0x84, 0xb7, 0x09 } }
260 #define EFI_RHT_ROOTARM { 0x69dad710, 0x2ce4, 0x4e3c, 0xb1, 0x6c, \
261 { 0x21, 0xa1, 0xd4, 0x9a, 0xbe, 0xd3 } }
262 #define EFI_RHT_ROOTARM64 { 0xb921b045, 0x1df0, 0x41c3, 0xaf, 0x44, \
263 { 0x4c, 0x6f, 0x28, 0x0d, 0x3f, 0xae } }
264 #define EFI_ACRONIS_SECUREZONE { 0x0311fc50, 0x01ca, 0x4725, 0xad, 0x77, \
265 { 0x9a, 0xdb, 0xb2, 0x0a, 0xce, 0x98 } }
266 #define EFI_ONIE_BOOT { 0x7412f7d5, 0xa156, 0x4b13, 0x81, 0xdc, \
267 { 0x86, 0x71, 0x74, 0x92, 0x93, 0x25 } }
268 #define EFI_ONIE_CONFIG { 0xd4e6e2cd, 0x4469, 0x46f3, 0xb5, 0xcb, \
269 { 0x1b, 0xff, 0x57, 0xaf, 0xc1, 0x49 } }
270 #define EFI_IBM_PPRPBOOT { 0x9e1a2d38, 0xc612, 0x4316, 0xaa, 0x26, \
271 { 0x8b, 0x49, 0x52, 0x1e, 0x5a, 0x8b } }
272 #define EFI_FREEDESKTOP_BOOT { 0xbc13c2ff, 0x59e6, 0x4262, 0xa3, 0x52, \
273 { 0xb2, 0x75, 0xfd, 0x6f, 0x71, 0x72 } }
275 /* minimum # of bytes for partition table entires, per EFI spec */
276 #define EFI_MIN_ARRAY_SIZE (16 * 1024)
278 #define EFI_PART_NAME_LEN 36
280 /* size of the "reserved" partition, in blocks */
281 #define EFI_MIN_RESV_SIZE (16 * 1024)
283 /* EFI Guid Partition Entry */
284 typedef struct efi_gpe {
285 struct uuid efi_gpe_PartitionTypeGUID;
286 struct uuid efi_gpe_UniquePartitionGUID;
287 diskaddr_t efi_gpe_StartingLBA;
288 diskaddr_t efi_gpe_EndingLBA;
289 efi_gpe_Attrs_t efi_gpe_Attributes;
290 ushort_t efi_gpe_PartitionName[EFI_PART_NAME_LEN];
291 } efi_gpe_t;
294 * passed to the useful (we hope) routines (efi_alloc_and_read and
295 * efi_write) that take this VTOC-like struct. These routines handle
296 * converting this struct into the EFI struct, generate UUIDs and
297 * checksums, and perform any necessary byte-swapping to the on-disk
298 * format.
300 /* Solaris library abstraction for EFI partitons */
301 typedef struct dk_part {
302 diskaddr_t p_start; /* starting LBA */
303 diskaddr_t p_size; /* size in blocks */
304 struct uuid p_guid; /* partion type GUID */
305 ushort_t p_tag; /* converted to part'n type GUID */
306 ushort_t p_flag; /* attributes */
307 char p_name[EFI_PART_NAME_LEN]; /* partition name */
308 struct uuid p_uguid; /* unique partition GUID */
309 uint_t p_resv[8]; /* future use - set to zero */
310 } dk_part_t;
312 /* Solaris library abstraction for an EFI GPT */
313 #define EFI_VERSION102 0x00010002
314 #define EFI_VERSION100 0x00010000
315 #define EFI_VERSION_CURRENT EFI_VERSION100
316 typedef struct dk_gpt {
317 uint_t efi_version; /* set to EFI_VERSION_CURRENT */
318 uint_t efi_nparts; /* number of partitions below */
319 uint_t efi_part_size; /* size of each partition entry */
320 /* efi_part_size is unused */
321 uint_t efi_lbasize; /* size of block in bytes */
322 diskaddr_t efi_last_lba; /* last block on the disk */
323 diskaddr_t efi_first_u_lba; /* first block after labels */
324 diskaddr_t efi_last_u_lba; /* last block before backup labels */
325 struct uuid efi_disk_uguid; /* unique disk GUID */
326 uint_t efi_flags;
327 uint_t efi_reserved1; /* future use - set to zero */
328 diskaddr_t efi_altern_lba; /* lba of alternate GPT header */
329 uint_t efi_reserved[12]; /* future use - set to zero */
330 struct dk_part efi_parts[1]; /* array of partitions */
331 } dk_gpt_t;
333 /* possible values for "efi_flags" */
334 #define EFI_GPT_PRIMARY_CORRUPT 0x1 /* primary label corrupt */
336 /* the private ioctl between libefi and the driver */
337 typedef struct dk_efi {
338 diskaddr_t dki_lba; /* starting block */
339 len_t dki_length; /* length in bytes */
340 union {
341 efi_gpt_t *_dki_data;
342 uint64_t _dki_data_64;
343 } dki_un;
344 #define dki_data dki_un._dki_data
345 #define dki_data_64 dki_un._dki_data_64
346 } dk_efi_t;
348 struct partition64 {
349 struct uuid p_type;
350 uint_t p_partno;
351 uint_t p_resv1;
352 diskaddr_t p_start;
353 diskaddr_t p_size;
357 * Number of EFI partitions
359 #if defined(__linux__)
360 #define EFI_NUMPAR 128 /* Expected by parted-1.8.1 */
361 #else
362 #define EFI_NUMPAR 9
363 #endif
365 #ifndef _KERNEL
366 extern int efi_alloc_and_init(int, uint32_t, struct dk_gpt **);
367 extern int efi_alloc_and_read(int, struct dk_gpt **);
368 extern int efi_write(int, struct dk_gpt *);
369 extern int efi_rescan(int);
370 extern void efi_free(struct dk_gpt *);
371 extern int efi_type(int);
372 extern void efi_err_check(struct dk_gpt *);
373 extern int efi_auto_sense(int fd, struct dk_gpt **);
374 extern int efi_use_whole_disk(int fd);
375 #endif
377 #ifdef __cplusplus
379 #endif
381 #endif /* _SYS_EFI_PARTITION_H */