xref: /freebsd/sys/geom/raid/md_ddf.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
100f32ecbSAlexander Motin /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
33728855aSPedro F. Giffuni  *
400f32ecbSAlexander Motin  * Copyright (c) 2012 Alexander Motin <mav@FreeBSD.org>
500f32ecbSAlexander Motin  * Copyright (c) 2008 Scott Long
600f32ecbSAlexander Motin  * All rights reserved.
700f32ecbSAlexander Motin  *
800f32ecbSAlexander Motin  * Redistribution and use in source and binary forms, with or without
900f32ecbSAlexander Motin  * modification, are permitted provided that the following conditions
1000f32ecbSAlexander Motin  * are met:
1100f32ecbSAlexander Motin  * 1. Redistributions of source code must retain the above copyright
1200f32ecbSAlexander Motin  *    notice, this list of conditions and the following disclaimer,
1300f32ecbSAlexander Motin  *    without modification, immediately at the beginning of the file.
1400f32ecbSAlexander Motin  * 2. Redistributions in binary form must reproduce the above copyright
1500f32ecbSAlexander Motin  *    notice, this list of conditions and the following disclaimer in the
1600f32ecbSAlexander Motin  *    documentation and/or other materials provided with the distribution.
1700f32ecbSAlexander Motin  *
1800f32ecbSAlexander Motin  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1900f32ecbSAlexander Motin  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2000f32ecbSAlexander Motin  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2100f32ecbSAlexander Motin  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2200f32ecbSAlexander Motin  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2300f32ecbSAlexander Motin  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2400f32ecbSAlexander Motin  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2500f32ecbSAlexander Motin  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2600f32ecbSAlexander Motin  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2700f32ecbSAlexander Motin  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2800f32ecbSAlexander Motin  */
2900f32ecbSAlexander Motin 
3000f32ecbSAlexander Motin #ifndef MD_DDF_H
3100f32ecbSAlexander Motin #define MD_DDF_H
3200f32ecbSAlexander Motin 
3300f32ecbSAlexander Motin /* Definitions from the SNIA DDF spec, rev 1.2/2.0 */
3400f32ecbSAlexander Motin 
3500f32ecbSAlexander Motin #define	DDF_HEADER_LENGTH		512
3600f32ecbSAlexander Motin struct ddf_header {
3700f32ecbSAlexander Motin 	uint32_t	Signature;
3800f32ecbSAlexander Motin #define	DDF_HEADER_SIGNATURE	0xde11de11
3900f32ecbSAlexander Motin 	uint32_t	CRC;
4000f32ecbSAlexander Motin 	uint8_t		DDF_Header_GUID[24];
4100f32ecbSAlexander Motin 	uint8_t		DDF_rev[8];
4200f32ecbSAlexander Motin 	uint32_t	Sequence_Number;
4300f32ecbSAlexander Motin 	uint32_t	TimeStamp;
4400f32ecbSAlexander Motin 	uint8_t		Open_Flag;
4500f32ecbSAlexander Motin #define	DDF_HEADER_CLOSED	0x00
4600f32ecbSAlexander Motin #define	DDF_HEADER_OPENED_MASK	0x0f
4700f32ecbSAlexander Motin #define	DDF_HEADER_OPEN_ANCHOR	0xff
4800f32ecbSAlexander Motin 	uint8_t		Foreign_Flag;
4900f32ecbSAlexander Motin 	uint8_t		Diskgrouping;
5000f32ecbSAlexander Motin 	uint8_t		pad1[13];
5100f32ecbSAlexander Motin 	uint8_t		Header_ext[32];
5200f32ecbSAlexander Motin 	uint64_t	Primary_Header_LBA;
5300f32ecbSAlexander Motin 	uint64_t	Secondary_Header_LBA;
5400f32ecbSAlexander Motin 	uint8_t		Header_Type;
5500f32ecbSAlexander Motin #define	DDF_HEADER_ANCHOR	0x00
5600f32ecbSAlexander Motin #define	DDF_HEADER_PRIMARY	0x01
5700f32ecbSAlexander Motin #define	DDF_HEADER_SECONDARY	0x02
5800f32ecbSAlexander Motin 	uint8_t		pad2[3];
5900f32ecbSAlexander Motin 	uint32_t	WorkSpace_Length;
6000f32ecbSAlexander Motin 	uint64_t	WorkSpace_LBA;
6100f32ecbSAlexander Motin 	uint16_t	Max_PD_Entries;
6200f32ecbSAlexander Motin 	uint16_t	Max_VD_Entries;
6300f32ecbSAlexander Motin 	uint16_t	Max_Partitions;
6400f32ecbSAlexander Motin 	uint16_t	Configuration_Record_Length;
6500f32ecbSAlexander Motin 	uint16_t	Max_Primary_Element_Entries;
6600f32ecbSAlexander Motin 	uint32_t	Max_Mapped_Block_Entries; /* DDF 2.0 */
6700f32ecbSAlexander Motin 	uint8_t		pad3[50];
6800f32ecbSAlexander Motin 	uint32_t	cd_section;	/* Controller_Data_Section */
6900f32ecbSAlexander Motin 	uint32_t	cd_length;	/* Controller_Data_Section_Length */
7000f32ecbSAlexander Motin 	uint32_t	pdr_section;	/* Physical_Drive_Records_Section */
7100f32ecbSAlexander Motin 	uint32_t	pdr_length;	/* Physical_Drive_Records_Length */
7200f32ecbSAlexander Motin 	uint32_t	vdr_section;	/* Virtual_Drive_Records_Section */
7300f32ecbSAlexander Motin 	uint32_t	vdr_length;	/* Virtual_Drive_Records_Length */
7400f32ecbSAlexander Motin 	uint32_t	cr_section;	/* Configuration_Records_Section */
7500f32ecbSAlexander Motin 	uint32_t	cr_length;	/* Configuration_Records_Length */
7600f32ecbSAlexander Motin 	uint32_t	pdd_section;	/* Physical_Drive_Data_Section */
7700f32ecbSAlexander Motin 	uint32_t	pdd_length;	/* Physical_Drive_Data_Length */
7800f32ecbSAlexander Motin 	uint32_t	bbmlog_section;	/* BBM_Log_Section */
7900f32ecbSAlexander Motin 	uint32_t	bbmlog_length;	/* BBM_Log_Section_Length */
8000f32ecbSAlexander Motin 	uint32_t	Diagnostic_Space;
8100f32ecbSAlexander Motin 	uint32_t	Diagnostic_Space_Length;
8200f32ecbSAlexander Motin 	uint32_t	Vendor_Specific_Logs;
8300f32ecbSAlexander Motin 	uint32_t	Vendor_Specific_Logs_Length;
8400f32ecbSAlexander Motin 	uint8_t		pad4[256];
8500f32ecbSAlexander Motin } __packed;
8600f32ecbSAlexander Motin 
8700f32ecbSAlexander Motin struct ddf_cd_record {
8800f32ecbSAlexander Motin 	uint32_t	Signature;
8900f32ecbSAlexander Motin #define	DDF_CONTROLLER_DATA_SIGNATURE	0xad111111
9000f32ecbSAlexander Motin 	uint32_t	CRC;
9100f32ecbSAlexander Motin 	uint8_t		Controller_GUID[24];
9200f32ecbSAlexander Motin 	struct {
9300f32ecbSAlexander Motin 		uint16_t	Vendor_ID;
9400f32ecbSAlexander Motin 		uint16_t	Device_ID;
9500f32ecbSAlexander Motin 		uint16_t	SubVendor_ID;
9600f32ecbSAlexander Motin 		uint16_t	SubDevice_ID;
9700f32ecbSAlexander Motin 	} Controller_Type __packed;
9800f32ecbSAlexander Motin 	uint8_t		Product_ID[16];
9900f32ecbSAlexander Motin 	uint8_t		pad1[8];
10000f32ecbSAlexander Motin 	uint8_t		Controller_Data[448];
10100f32ecbSAlexander Motin } __packed;
10200f32ecbSAlexander Motin 
10300f32ecbSAlexander Motin struct ddf_device_scsi {
10400f32ecbSAlexander Motin 	uint8_t		Lun;
10500f32ecbSAlexander Motin 	uint8_t		Id;
10600f32ecbSAlexander Motin 	uint8_t		Channel;
10700f32ecbSAlexander Motin 	uint8_t		Path_Flags;
10800f32ecbSAlexander Motin #define DDF_DEVICE_SCSI_FLAG_BROKEN	(1 << 7)
10900f32ecbSAlexander Motin } __packed;
11000f32ecbSAlexander Motin 
11100f32ecbSAlexander Motin struct ddf_device_sas {
11200f32ecbSAlexander Motin 	uint64_t	Initiator_Path;
11300f32ecbSAlexander Motin } __packed;
11400f32ecbSAlexander Motin 
11500f32ecbSAlexander Motin union ddf_pathinfo {
11600f32ecbSAlexander Motin 	struct {
11700f32ecbSAlexander Motin 		struct ddf_device_scsi	Path0;
11800f32ecbSAlexander Motin 		struct ddf_device_scsi	Path1;
11900f32ecbSAlexander Motin 		uint8_t			pad[10];
12000f32ecbSAlexander Motin 	} __packed scsi;
12100f32ecbSAlexander Motin 	struct {
12200f32ecbSAlexander Motin 		struct ddf_device_sas	Path0;
12300f32ecbSAlexander Motin 		struct ddf_device_sas	Path1;
12400f32ecbSAlexander Motin 		uint8_t			Path0_Flags;
12500f32ecbSAlexander Motin 		uint8_t			Path1_Flags;
12600f32ecbSAlexander Motin #define DDF_DEVICE_SAS_PHY_ID		0x7f
12700f32ecbSAlexander Motin #define DDF_DEVICE_SAS_FLAG_BROKEN	(1 << 7)
12800f32ecbSAlexander Motin 	} __packed sas;
12900f32ecbSAlexander Motin } __packed;
13000f32ecbSAlexander Motin 
13100f32ecbSAlexander Motin struct ddf_pd_entry {
13200f32ecbSAlexander Motin 	uint8_t			PD_GUID[24];
13300f32ecbSAlexander Motin 	uint32_t		PD_Reference;
13400f32ecbSAlexander Motin 	uint16_t		PD_Type;
13500f32ecbSAlexander Motin #define	DDF_PDE_GUID_FORCE	(1 << 0)
13600f32ecbSAlexander Motin #define	DDF_PDE_PARTICIPATING	(1 << 1)
13700f32ecbSAlexander Motin #define	DDF_PDE_GLOBAL_SPARE	(1 << 2)
13800f32ecbSAlexander Motin #define	DDF_PDE_CONFIG_SPARE	(1 << 3)
13900f32ecbSAlexander Motin #define	DDF_PDE_FOREIGN		(1 << 4)
14000f32ecbSAlexander Motin #define	DDF_PDE_LEGACY		(1 << 5)
14100f32ecbSAlexander Motin #define DDF_PDE_TYPE_MASK	(0x0f << 12)
14200f32ecbSAlexander Motin #define DDF_PDE_UNKNOWN		(0x00 << 12)
14300f32ecbSAlexander Motin #define DDF_PDE_SCSI		(0x01 << 12)
14400f32ecbSAlexander Motin #define DDF_PDE_SAS		(0x02 << 12)
14500f32ecbSAlexander Motin #define DDF_PDE_SATA		(0x03 << 12)
14600f32ecbSAlexander Motin #define DDF_PDE_FC		(0x04 << 12)
14700f32ecbSAlexander Motin 	uint16_t		PD_State;
14800f32ecbSAlexander Motin #define	DDF_PDE_ONLINE		(1 << 0)
14900f32ecbSAlexander Motin #define	DDF_PDE_FAILED		(1 << 1)
15000f32ecbSAlexander Motin #define	DDF_PDE_REBUILD		(1 << 2)
15100f32ecbSAlexander Motin #define	DDF_PDE_TRANSITION	(1 << 3)
15200f32ecbSAlexander Motin #define	DDF_PDE_PFA		(1 << 4)
15300f32ecbSAlexander Motin #define	DDF_PDE_UNRECOVERED	(1 << 5)
15400f32ecbSAlexander Motin #define	DDF_PDE_MISSING		(1 << 6)
15500f32ecbSAlexander Motin 	uint64_t		Configured_Size;
15600f32ecbSAlexander Motin 	union ddf_pathinfo	Path_Information;
15700f32ecbSAlexander Motin 	uint16_t		Block_Size;	/* DDF 2.0 */
15800f32ecbSAlexander Motin 	uint8_t			pad1[4];
15900f32ecbSAlexander Motin } __packed;
16000f32ecbSAlexander Motin 
16100f32ecbSAlexander Motin struct ddf_pd_record {
16200f32ecbSAlexander Motin 	uint32_t		Signature;
16300f32ecbSAlexander Motin #define	DDF_PDR_SIGNATURE	0x22222222
16400f32ecbSAlexander Motin 	uint32_t		CRC;
16500f32ecbSAlexander Motin 	uint16_t		Populated_PDEs;
16600f32ecbSAlexander Motin 	uint16_t		Max_PDE_Supported;
16700f32ecbSAlexander Motin 	uint8_t			pad1[52];
16800f32ecbSAlexander Motin 	struct ddf_pd_entry	entry[0];
16900f32ecbSAlexander Motin } __packed;
17000f32ecbSAlexander Motin 
17100f32ecbSAlexander Motin struct ddf_vd_entry {
17200f32ecbSAlexander Motin 	uint8_t			VD_GUID[24];
17300f32ecbSAlexander Motin 	uint16_t		VD_Number;
17400f32ecbSAlexander Motin 	uint8_t			pad1[2];
17500f32ecbSAlexander Motin 	uint16_t		VD_Type;
17600f32ecbSAlexander Motin #define DDF_VDE_SHARED		(1 << 0)
17700f32ecbSAlexander Motin #define	DDF_VDE_ENFORCE_GROUP	(1 << 1)
17800f32ecbSAlexander Motin #define	DDF_VDE_UNICODE_NAME	(1 << 2)
17900f32ecbSAlexander Motin #define	DDF_VDE_OWNER_ID_VALID	(1 << 3)
18000f32ecbSAlexander Motin 	uint16_t		Controller_GUID_CRC;
18100f32ecbSAlexander Motin 	uint8_t			VD_State;
18200f32ecbSAlexander Motin #define	DDF_VDE_OPTIMAL		0x00
18300f32ecbSAlexander Motin #define	DDF_VDE_DEGRADED	0x01
18400f32ecbSAlexander Motin #define	DDF_VDE_DELETED		0x02
18500f32ecbSAlexander Motin #define	DDF_VDE_MISSING		0x03
18600f32ecbSAlexander Motin #define	DDF_VDE_FAILED		0x04
18700f32ecbSAlexander Motin #define DDF_VDE_PARTIAL		0x05
18800f32ecbSAlexander Motin #define DDF_VDE_OFFLINE		0x06
18900f32ecbSAlexander Motin #define	DDF_VDE_STATE_MASK	0x07
19000f32ecbSAlexander Motin #define	DDF_VDE_MORPH		(1 << 3)
19100f32ecbSAlexander Motin #define	DDF_VDE_DIRTY		(1 << 4)
19200f32ecbSAlexander Motin 	uint8_t			Init_State;
19300f32ecbSAlexander Motin #define	DDF_VDE_UNINTIALIZED	0x00
19400f32ecbSAlexander Motin #define	DDF_VDE_INIT_QUICK	0x01
19500f32ecbSAlexander Motin #define	DDF_VDE_INIT_FULL	0x02
19600f32ecbSAlexander Motin #define	DDF_VDE_INIT_MASK	0x03
19700f32ecbSAlexander Motin #define	DDF_VDE_UACCESS_RW	0x00
19800f32ecbSAlexander Motin #define	DDF_VDE_UACCESS_RO	0x80
19900f32ecbSAlexander Motin #define	DDF_VDE_UACCESS_BLOCKED	0xc0
20000f32ecbSAlexander Motin #define	DDF_VDE_UACCESS_MASK	0xc0
20100f32ecbSAlexander Motin 	uint8_t			Drive_Failures_Remaining;	/* DDF 2.0 */
20200f32ecbSAlexander Motin 	uint8_t			pad2[13];
20300f32ecbSAlexander Motin 	uint8_t			VD_Name[16];
20400f32ecbSAlexander Motin } __packed;
20500f32ecbSAlexander Motin 
20600f32ecbSAlexander Motin struct ddf_vd_record {
20700f32ecbSAlexander Motin 	uint32_t		Signature;
20800f32ecbSAlexander Motin #define	DDF_VD_RECORD_SIGNATURE	0xdddddddd
20900f32ecbSAlexander Motin 	uint32_t		CRC;
21000f32ecbSAlexander Motin 	uint16_t		Populated_VDEs;
21100f32ecbSAlexander Motin 	uint16_t		Max_VDE_Supported;
21200f32ecbSAlexander Motin 	uint8_t			pad1[52];
21300f32ecbSAlexander Motin 	struct ddf_vd_entry	entry[0];
21400f32ecbSAlexander Motin } __packed;
21500f32ecbSAlexander Motin 
21600f32ecbSAlexander Motin #define DDF_CR_INVALID		0xffffffff
21700f32ecbSAlexander Motin 
21800f32ecbSAlexander Motin struct ddf_vdc_record {
21900f32ecbSAlexander Motin 	uint32_t	Signature;
22000f32ecbSAlexander Motin #define	DDF_VDCR_SIGNATURE	0xeeeeeeee
22100f32ecbSAlexander Motin 	uint32_t	CRC;
22200f32ecbSAlexander Motin 	uint8_t		VD_GUID[24];
22300f32ecbSAlexander Motin 	uint32_t	Timestamp;
22400f32ecbSAlexander Motin 	uint32_t	Sequence_Number;
22500f32ecbSAlexander Motin 	uint8_t		pad1[24];
22600f32ecbSAlexander Motin 	uint16_t	Primary_Element_Count;
22700f32ecbSAlexander Motin 	uint8_t		Stripe_Size;
22800f32ecbSAlexander Motin 	uint8_t		Primary_RAID_Level;
22900f32ecbSAlexander Motin #define DDF_VDCR_RAID0		0x00
23000f32ecbSAlexander Motin #define DDF_VDCR_RAID1		0x01
23100f32ecbSAlexander Motin #define DDF_VDCR_RAID3		0x03
23200f32ecbSAlexander Motin #define DDF_VDCR_RAID4		0x04
23300f32ecbSAlexander Motin #define DDF_VDCR_RAID5		0x05
23400f32ecbSAlexander Motin #define DDF_VDCR_RAID6		0x06
23500f32ecbSAlexander Motin #define DDF_VDCR_RAID1E		0x11
23600f32ecbSAlexander Motin #define DDF_VDCR_SINGLE		0x0f
23700f32ecbSAlexander Motin #define DDF_VDCR_CONCAT		0x1f
23800f32ecbSAlexander Motin #define DDF_VDCR_RAID5E		0x15
23900f32ecbSAlexander Motin #define DDF_VDCR_RAID5EE	0x25
24000f32ecbSAlexander Motin 	uint8_t		RLQ;
24100f32ecbSAlexander Motin 	uint8_t		Secondary_Element_Count;
24200f32ecbSAlexander Motin 	uint8_t		Secondary_Element_Seq;
24300f32ecbSAlexander Motin 	uint8_t		Secondary_RAID_Level;
24400f32ecbSAlexander Motin 	uint64_t	Block_Count;
24500f32ecbSAlexander Motin 	uint64_t	VD_Size;
24600f32ecbSAlexander Motin 	uint16_t	Block_Size;			/* DDF 2.0 */
24700f32ecbSAlexander Motin 	uint8_t		Rotate_Parity_count;		/* DDF 2.0 */
24800f32ecbSAlexander Motin 	uint8_t		pad2[5];
24900f32ecbSAlexander Motin 	uint32_t	Associated_Spares[8];
25000f32ecbSAlexander Motin 	uint64_t	Cache_Flags;
25100f32ecbSAlexander Motin #define DDF_VDCR_CACHE_WB		(1 << 0)
25200f32ecbSAlexander Motin #define	DDF_VDCR_CACHE_WB_ADAPTIVE	(1 << 1)
25300f32ecbSAlexander Motin #define	DDF_VDCR_CACHE_RA		(1 << 2)
25400f32ecbSAlexander Motin #define	DDF_VDCR_CACHE_RA_ADAPTIVE	(1 << 3)
25500f32ecbSAlexander Motin #define	DDF_VDCR_CACHE_WCACHE_NOBATTERY	(1 << 4)
25600f32ecbSAlexander Motin #define	DDF_VDCR_CACHE_WCACHE_ALLOW	(1 << 5)
25700f32ecbSAlexander Motin #define	DDF_VDCR_CACHE_RCACHE_ALLOW	(1 << 6)
25800f32ecbSAlexander Motin #define	DDF_VDCR_CACHE_VENDOR		(1 << 7)
25900f32ecbSAlexander Motin 	uint8_t		BG_Rate;
26000f32ecbSAlexander Motin 	uint8_t		pad3[3];
26100f32ecbSAlexander Motin 	uint8_t		MDF_Parity_Disks;		/* DDF 2.0 */
26200f32ecbSAlexander Motin 	uint16_t	MDF_Parity_Generator_Polynomial; /* DDF 2.0 */
26300f32ecbSAlexander Motin 	uint8_t		pad4;
26400f32ecbSAlexander Motin 	uint8_t		MDF_Constant_Generation_Method; /* DDF 2.0 */
26500f32ecbSAlexander Motin 	uint8_t		pad5[47];
26600f32ecbSAlexander Motin 	uint8_t		pad6[192];
26700f32ecbSAlexander Motin 	uint8_t		V0[32];
26800f32ecbSAlexander Motin 	uint8_t		V1[32];
26900f32ecbSAlexander Motin 	uint8_t		V2[16];
27000f32ecbSAlexander Motin 	uint8_t		V3[16];
27100f32ecbSAlexander Motin 	uint8_t		Vendor_Scratch[32];
27200f32ecbSAlexander Motin 	uint32_t	Physical_Disk_Sequence[0];
27300f32ecbSAlexander Motin } __packed;
27400f32ecbSAlexander Motin 
27500f32ecbSAlexander Motin struct ddf_vuc_record {
27600f32ecbSAlexander Motin 	uint32_t	Signature;
27700f32ecbSAlexander Motin #define	DDF_VUCR_SIGNATURE	0x88888888
27800f32ecbSAlexander Motin 	uint32_t	CRC;
27900f32ecbSAlexander Motin 	uint8_t		VD_GUID[24];
28000f32ecbSAlexander Motin } __packed;
28100f32ecbSAlexander Motin 
28200f32ecbSAlexander Motin struct ddf_sa_entry {
28300f32ecbSAlexander Motin 	uint8_t		VD_GUID[24];
28400f32ecbSAlexander Motin 	uint16_t	Secondary_Element;
28500f32ecbSAlexander Motin 	uint8_t		rsrvd2[6];
28600f32ecbSAlexander Motin } __packed;
28700f32ecbSAlexander Motin 
28800f32ecbSAlexander Motin struct ddf_sa_record {
28900f32ecbSAlexander Motin 	uint32_t	Signature;
29000f32ecbSAlexander Motin #define	DDF_SA_SIGNATURE	0x55555555
29100f32ecbSAlexander Motin 	uint32_t	CRC;
29200f32ecbSAlexander Motin 	uint32_t	Timestamp;
29300f32ecbSAlexander Motin 	uint8_t		pad1[7];
29400f32ecbSAlexander Motin 	uint8_t		Spare_Type;
29500f32ecbSAlexander Motin #define	DDF_SAR_TYPE_DEDICATED		(1 << 0)
29600f32ecbSAlexander Motin #define	DDF_SAR_TYPE_REVERTIBLE		(1 << 1)
29700f32ecbSAlexander Motin #define	DDF_SAR_TYPE_ACTIVE		(1 << 2)
29800f32ecbSAlexander Motin #define	DDF_SAR_TYPE_ENCL_AFFINITY	(1 << 3)
29900f32ecbSAlexander Motin 	uint16_t	Populated_SAEs;
30000f32ecbSAlexander Motin 	uint16_t	MAX_SAE_Supported;
30100f32ecbSAlexander Motin 	uint8_t		pad2[8];
30200f32ecbSAlexander Motin 	struct ddf_sa_entry	entry[0];
30300f32ecbSAlexander Motin } __packed;
30400f32ecbSAlexander Motin 
30500f32ecbSAlexander Motin struct ddf_pdd_record {
30600f32ecbSAlexander Motin 	uint32_t	Signature;
30700f32ecbSAlexander Motin #define	DDF_PDD_SIGNATURE	0x33333333
30800f32ecbSAlexander Motin 	uint32_t	CRC;
30900f32ecbSAlexander Motin 	uint8_t		PD_GUID[24];
31000f32ecbSAlexander Motin 	uint32_t	PD_Reference;
31100f32ecbSAlexander Motin 	uint8_t		Forced_Ref_Flag;
31200f32ecbSAlexander Motin #define	DDF_PDD_FORCED_REF	0x01
31300f32ecbSAlexander Motin 	uint8_t		Forced_PD_GUID_Flag;
31400f32ecbSAlexander Motin #define	DDF_PDD_FORCED_GUID	0x01
31500f32ecbSAlexander Motin 	uint8_t		Vendor_Scratch[32];
31600f32ecbSAlexander Motin 	uint8_t		pad2[442];
31700f32ecbSAlexander Motin } __packed;
31800f32ecbSAlexander Motin 
31900f32ecbSAlexander Motin struct ddf_bbm_entry {
32000f32ecbSAlexander Motin 	uint64_t	Defective_Block_Start;
32100f32ecbSAlexander Motin 	uint32_t	Spare_Block_Offset;
32200f32ecbSAlexander Motin 	uint16_t	Remapped_Count;
32300f32ecbSAlexander Motin 	uint8_t	pad[2];
32400f32ecbSAlexander Motin };
32500f32ecbSAlexander Motin 
32600f32ecbSAlexander Motin struct ddf_bbm_log {
32700f32ecbSAlexander Motin 	uint32_t	Signature;
32800f32ecbSAlexander Motin #define	DDF_BBML_SIGNATURE	0xabadb10c
32900f32ecbSAlexander Motin 	uint32_t	CRC;
33000f32ecbSAlexander Motin 	uint32_t	Entry_Count;
33100f32ecbSAlexander Motin 	uint32_t	Spare_Block_Count;
33200f32ecbSAlexander Motin 	uint8_t		pad1[8];
33300f32ecbSAlexander Motin 	uint64_t	First_Spare_LBA;
33400f32ecbSAlexander Motin 	uint64_t	Mapped_Block_Entry[0];
33500f32ecbSAlexander Motin } __packed;
33600f32ecbSAlexander Motin 
33700f32ecbSAlexander Motin struct ddf_vendor_log {
33800f32ecbSAlexander Motin 	uint32_t	Signature;
33900f32ecbSAlexander Motin #define	DDF_VENDOR_LOG_SIGNATURE	0x01dbeef0
34000f32ecbSAlexander Motin 	uint32_t	CRC;
34100f32ecbSAlexander Motin 	uint64_t	Log_Owner;
34200f32ecbSAlexander Motin 	uint8_t		pad1[16];
34300f32ecbSAlexander Motin } __packed;
34400f32ecbSAlexander Motin 
34500f32ecbSAlexander Motin #endif
346