/*- * Copyright (c) 2007 Norikatsu Shigemura * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _DDF1_H_ #define _DDF1_H_ #include /* DDF Header */ struct ddf1_ddf_header { uint32_t Signature; #define DDF1_DDF_HEADER_SIGNATURE 0xDE11DE11 uint32_t CRC; uint8_t DDF_Header_GUID[24]; uint8_t DDF_rev[8]; uint32_t Sequence_Number; uint32_t Timestamp; uint8_t Open_Flag; #define DDF_OPEN_FLAG_DDF_CLOSED 0x00 #define DDF_OPEN_FLAG_DDF_OPENED 0x01-0x0F #define DDF_OPEN_FLAG_RESERVED 0x10-0xFE #define DDF_OPEN_FLAG_NOT_TRACKING 0xff uint8_t Foreign_Flag; #define DDF1_FOREIGN_FLAG_NOT_FOREIGN 0x00 #define DDF1_FOREIGN_FLAG_FOREIGN 0x01 uint8_t Disk_Grouping; #define DDF1_DISK_GROUPING_NOT_ENFORCED 0x00 #define DDF1_DISK_GROUPING_ENFORCED 0x01 uint8_t Reserved1[13]; uint8_t Header_Ext[32]; uint64_t Primary_Header_LBA; uint64_t Secondary_Header_LBA; uint8_t Header_Type; #define DDF1_HEADER_TYPE_ANCHOR_DDF_HEADER 0x00 #define DDF1_HEADER_TYPE_PRIMARY_DDF_HEADER 0x01 #define DDF1_HEADER_TYPE_SECONDARY_DDF_HEADER 0x02 uint8_t Reserved2[3]; uint32_t Workspace_Length; uint64_t Workspace_LBA; uint16_t Max_PD_Entries; uint16_t Max_VD_Entries; uint16_t Max_Partitions; uint16_t Configuration_Record_Length; uint16_t Max_Primary_Element_Entries; uint8_t Reserved3[54]; uint32_t Controller_Data_Section; uint32_t Controller_Data_Length; uint32_t Physical_Disk_Records_Section; uint32_t Physical_Disk_Records_Length; uint32_t Virtual_Disk_Records_Section; uint32_t Virtual_Disk_Records_Length; uint32_t Configuration_Records_Section; uint32_t Configuration_Records_Length; uint32_t Physical_Disk_Data_Section; uint32_t Physical_Disk_Data_Length; uint32_t BBM_Log_Section; uint32_t BBM_Log_Length; uint32_t Diagnostic_Space; uint32_t Diagnostic_Space_Length; uint32_t Vendor_Specific_Logs_Section; uint32_t Vendor_Specific_Logs_Section_Length; uint8_t Reserved4[256]; } __packed; /* Controller Data */ struct ddf1_controller_data { uint32_t Signature; #define DDF1_CONTROLLER_DATA_SIGNATURE 0xAD111111 uint32_t CRC; uint8_t Controller_GUID[24]; uint16_t Controller_Type_Vendor_ID; uint16_t Controller_Type_Device_ID; uint16_t Controller_Type_Sub_Vendor_ID; uint16_t Controller_Type_Sub_Device_ID; uint8_t NID[24]; uint8_t Controller_Data[448]; } __packed; /* Physical Disk Records */ struct ddf1_phsical_disk_records { uint32_t Signature; #define DDF1_PHYSICAL_DISK_RECORDS_SIGNATURE 0x22222222 uint32_t CRC; uint16_t Populated_PDEs; uint16_t Max_PDE_Supported; uint8_t Reserved[52]; uint8_t Physical_Disk_Entries[0/*Variable*/]; } __packed; /* Physical Disk Entries (PDEs) */ struct ddf1_physical_disk_entries { uint8_t PD_GUID[24]; uint32_t PD_Reference; uint16_t PD_Type; uint16_t PD_State; uint64_t Configured_Size; uint8_t Path_Information[18]; uint8_t Reserved[6]; } __packed; /* Virtual Disk Records */ struct ddf1_virtual_disk_records { uint32_t Signature; #define DDF1_VIRTUAL_DISK_RECORDS_SIGNATURE 0xDDDDDDDD uint32_t CRC; uint16_t Populated_VDEs; uint16_t Max_VDE_Supported; uint8_t Reserved[52]; uint8_t Virtual_Disk_Entries[0/*Variable*/]; } __packed; /* Virtual Disk Entries (VDEs) */ struct ddf1_virtual_disk_entries { uint8_t VD_GUID[24]; uint16_t VD_Number; uint8_t Reserved1[2]; uint32_t VD_Type; uint8_t VD_State; uint8_t Init_State; uint8_t Reserved2[14]; uint8_t VD_Name[16]; } __packed; /* Virtual Disk Configuration Record */ struct ddf1_virtual_disk_configuration_record { uint32_t Signature; #define DDF1_VD_CONFIGURATION_RECORD_SIGNATURE 0xEEEEEEEE uint32_t CRC; uint8_t VD_GUID[24]; uint32_t Timestamp; uint32_t Sequence_Number; uint8_t Reserved1[24]; uint16_t Primary_Element_Count; uint8_t Strip_Size; /* XXX: typo of Stripe */ uint8_t Primary_RAID_Level; uint8_t RAID_Level_Qualifier; uint8_t Secondary_Element_Count; uint8_t Secondary_Element_Seq; uint8_t Secondary_RAID_Level; uint64_t Block_Count; uint64_t Size; uint8_t Reserved2[8]; uint32_t Associated_Spares[8]; uint64_t Cache_Policies_And_Parameters; uint8_t BG_Rate; uint8_t Reserved3[3]; uint8_t Reserved4[52]; uint8_t Reserved5[192]; uint8_t V0[32]; uint8_t V1[32]; uint8_t V2[16]; uint8_t V3[16]; uint8_t Vendor_Specific_Scratch_Space[32]; uint32_t Physical_Disk_Sequence[0/*Variable*/]; uint64_t Starting_Block[0/*Variable*/]; } __packed; /* Vendor Unique Configuration Record */ struct ddf1_vendor_unique_configuration_record { uint32_t Signeture; #define DDF1_VU_CONFIGURATION_RECORD_SIGNATURE 0x88888888 uint32_t CRC; uint8_t VD_GUID[24]; } __packed; /* Spare Assignment Record */ struct ddf1_spare_assignment_record { uint32_t Signature; #define DDF1_SPARE_ASSIGNMENT_RECORD_SIGNATURE 0x55555555 uint32_t CRC; uint32_t Timestamp; uint8_t Reserved1[7]; uint8_t Spare_Type; uint16_t Populated_SAEs; uint16_t Max_SAE_Supported; uint8_t Reserved2[8]; uint8_t Spare_Assignment_Entries[0/*Variable*/]; } __packed; /* Spare Assignment Entry(SAE) */ struct ddf1_spare_assinment_entry { uint8_t VD_GUID[24]; uint16_t Secondary_Element; uint8_t Reserved[6]; } __packed; /* Physical Disk Data */ struct ddf1_physical_disk_data { uint32_t Signature; #define DDF1_PHYSICAL_DISK_DATA_SIGNATURE 0x33333333 uint32_t CRC; uint8_t PD_GUID[24]; uint32_t PD_Reference; uint8_t Forced_Ref_Flag; #define DDF1_PHYSICAL_DISK_DATA_FORCED_REF_FLAG_NO 0x00 #define DDF1_PHYSICAL_DISK_DATA_FORCED_REF_FLAG_YES 0x01 uint8_t Forced_PD_GUID_Flag; uint8_t Vendor_Specific_Scratch_Space[32]; uint8_t Reserved[442]; } __packed; /* Bad Block Management Log */ struct ddf1_bad_block_management_log { uint32_t Signature; #define DDF1_BAD_BLOCK_MANAGEMENT_LOG_SIGNATURE 0xABADB10C uint32_t CRC; uint16_t Entry_Count; uint32_t Reserved_Spare_Block_Count; uint8_t Reserved[10]; uint64_t First_Spare_LBA; uint8_t Mapped_Block_Entries[16*254]; } __packed; /* Mapped Block Entry */ struct ddf1_mapped_block_entry { uint64_t Defective_Block_Start; uint32_t CRC; uint16_t Remapped_Count; uint8_t Reserved[2]; } __packed; /* Vendor Specific Logs */ struct ddf1_vendor_specific_logs { uint32_t Signature; #define DDF1_VENDOR_SPECIFIC_LOGS_SIGNATURE 0x01DBEEF0 uint32_t CRC; uint64_t Log_Owner; uint8_t Reserved[16]; } __packed; #endif /* !_DDF1_H_ */