191b48298SAxel Dörfler /* 291b48298SAxel Dörfler ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3*b6f76ebeSAugustin Cavalier ** Distributed under the terms of the MIT License. 491b48298SAxel Dörfler */ 591b48298SAxel Dörfler #ifndef AMIGA_RDB_H 691b48298SAxel Dörfler #define AMIGA_RDB_H 791b48298SAxel Dörfler 891b48298SAxel Dörfler 991b48298SAxel Dörfler #include "SupportDefs.h" 1091b48298SAxel Dörfler #include "ByteOrder.h" 1191b48298SAxel Dörfler 1291b48298SAxel Dörfler 1391b48298SAxel Dörfler struct rigid_disk_block { 1491b48298SAxel Dörfler uint32 id; 1591b48298SAxel Dörfler uint32 summed_longs; 1691b48298SAxel Dörfler int32 check_sum; 1791b48298SAxel Dörfler uint32 host_id; 1891b48298SAxel Dörfler uint32 block_size; 1991b48298SAxel Dörfler uint32 flags; 2091b48298SAxel Dörfler 2191b48298SAxel Dörfler /* block list heads */ 2291b48298SAxel Dörfler 2391b48298SAxel Dörfler uint32 bad_block_list; 2491b48298SAxel Dörfler uint32 partition_list; 2591b48298SAxel Dörfler uint32 fs_header_list; 2691b48298SAxel Dörfler uint32 drive_init; 2791b48298SAxel Dörfler 2891b48298SAxel Dörfler uint32 __reserved1[6]; 2991b48298SAxel Dörfler 3091b48298SAxel Dörfler /* physical drive characteristics */ 3191b48298SAxel Dörfler 3291b48298SAxel Dörfler uint32 cylinders; 3391b48298SAxel Dörfler uint32 sectors; 3491b48298SAxel Dörfler uint32 heads; 3591b48298SAxel Dörfler uint32 interleave; 3691b48298SAxel Dörfler uint32 park; 3791b48298SAxel Dörfler uint32 __reserved2[3]; 3891b48298SAxel Dörfler uint32 write_precompensation; 3991b48298SAxel Dörfler uint32 reduced_write; 4091b48298SAxel Dörfler uint32 step_rate; 4191b48298SAxel Dörfler uint32 __reserved3[5]; 4291b48298SAxel Dörfler 4391b48298SAxel Dörfler /* logical drive characteristics */ 4491b48298SAxel Dörfler 4591b48298SAxel Dörfler uint32 rdb_blocks_low; 4691b48298SAxel Dörfler uint32 rdb_blocks_high; 4791b48298SAxel Dörfler uint32 low_cylinder; 4891b48298SAxel Dörfler uint32 high_cylinder; 4991b48298SAxel Dörfler uint32 cylinder_blocks; 5091b48298SAxel Dörfler uint32 auto_park_seconds; 5191b48298SAxel Dörfler 5291b48298SAxel Dörfler uint32 __reserved4[2]; 5391b48298SAxel Dörfler 5491b48298SAxel Dörfler /* drive identification */ 5591b48298SAxel Dörfler 5691b48298SAxel Dörfler char disk_vendor[8]; 5791b48298SAxel Dörfler char disk_product[16]; 5891b48298SAxel Dörfler char disk_revision[4]; 5991b48298SAxel Dörfler char controller_vendor[8]; 6091b48298SAxel Dörfler char controller_product[16]; 6191b48298SAxel Dörfler char controller_revision[4]; 6291b48298SAxel Dörfler 6391b48298SAxel Dörfler uint32 __reserved5[10]; 649f34c3c7SAxel Dörfler IDrigid_disk_block6532270ffeSAxel Dörfler uint32 ID() const { return B_BENDIAN_TO_HOST_INT32(id); } SummedLongsrigid_disk_block6632270ffeSAxel Dörfler uint32 SummedLongs() const { return B_BENDIAN_TO_HOST_INT32(summed_longs); } BlockSizerigid_disk_block6732270ffeSAxel Dörfler uint32 BlockSize() const { return B_BENDIAN_TO_HOST_INT32(block_size); } FirstPartitionrigid_disk_block6832270ffeSAxel Dörfler uint32 FirstPartition() const { return B_BENDIAN_TO_HOST_INT32(partition_list); } 6991b48298SAxel Dörfler }; 7091b48298SAxel Dörfler 7191b48298SAxel Dörfler #define RDB_DISK_ID 'RDSK' 7291b48298SAxel Dörfler 7391b48298SAxel Dörfler #define RDB_LOCATION_LIMIT 16 7491b48298SAxel Dörfler 7591b48298SAxel Dörfler enum rdb_flags { 7691b48298SAxel Dörfler RDB_LAST = 0x01, 7791b48298SAxel Dörfler RDB_LAST_LUN = 0x02, 7891b48298SAxel Dörfler RDB_LAST_TID = 0x04, 7991b48298SAxel Dörfler RDB_NO_RESELECT = 0x08, 8091b48298SAxel Dörfler RDB_HAS_DISK_ID = 0x10, 8191b48298SAxel Dörfler RDB_HAS_CONTROLLER_ID = 0x20, 8291b48298SAxel Dörfler RDB_SUPPORTS_SYNCHRONOUS = 0x40, 8391b48298SAxel Dörfler }; 8491b48298SAxel Dörfler 8591b48298SAxel Dörfler 8691b48298SAxel Dörfler /************* bad blocks *************/ 8791b48298SAxel Dörfler 8891b48298SAxel Dörfler struct bad_block_entry { 8991b48298SAxel Dörfler }; 9091b48298SAxel Dörfler 9191b48298SAxel Dörfler struct bad_block_block { 9291b48298SAxel Dörfler }; 9391b48298SAxel Dörfler 9491b48298SAxel Dörfler #define RDB_BAD_BLOCK_ID 'BADB' 9591b48298SAxel Dörfler 9691b48298SAxel Dörfler 9791b48298SAxel Dörfler /************* partition block *************/ 9891b48298SAxel Dörfler 9991b48298SAxel Dörfler struct partition_block { 10091b48298SAxel Dörfler uint32 id; 10191b48298SAxel Dörfler uint32 summed_longs; 10291b48298SAxel Dörfler int32 check_sum; 10391b48298SAxel Dörfler uint32 host_id; 10491b48298SAxel Dörfler uint32 next; 10591b48298SAxel Dörfler uint32 flags; 10691b48298SAxel Dörfler uint32 __reserved1[2]; 10791b48298SAxel Dörfler uint32 open_device_flags; 10891b48298SAxel Dörfler uint8 drive_name[32]; // BSTR form (Pascal like string) 10991b48298SAxel Dörfler 11091b48298SAxel Dörfler uint32 __reserved2[15]; 11191b48298SAxel Dörfler uint32 environment[17]; 11291b48298SAxel Dörfler uint32 __reserved3[15]; 1139f34c3c7SAxel Dörfler IDpartition_block11432270ffeSAxel Dörfler uint32 ID() const { return B_BENDIAN_TO_HOST_INT32(id); } SummedLongspartition_block11532270ffeSAxel Dörfler uint32 SummedLongs() const { return B_BENDIAN_TO_HOST_INT32(summed_longs); } Nextpartition_block11632270ffeSAxel Dörfler uint32 Next() const { return B_BENDIAN_TO_HOST_INT32(next); } 11791b48298SAxel Dörfler }; 11891b48298SAxel Dörfler 11991b48298SAxel Dörfler #define RDB_PARTITION_ID 'PART' 12091b48298SAxel Dörfler 12191b48298SAxel Dörfler enum rdb_partition_flags { 12291b48298SAxel Dörfler RDB_PARTITION_BOOTABLE = 0x01, 12391b48298SAxel Dörfler RDB_PARTITION_NO_MOUNT = 0x02, 12491b48298SAxel Dörfler }; 12591b48298SAxel Dörfler 12691b48298SAxel Dörfler 12791b48298SAxel Dörfler /************* disk environment *************/ 12891b48298SAxel Dörfler 12991b48298SAxel Dörfler struct disk_environment { 13091b48298SAxel Dörfler uint32 table_size; // size of this environment 13191b48298SAxel Dörfler uint32 long_block_size; // block size in longs (128 == 512 byte) 13291b48298SAxel Dörfler uint32 sec_org; // always 0 13391b48298SAxel Dörfler uint32 surfaces; 13491b48298SAxel Dörfler uint32 sectors_per_block; 13591b48298SAxel Dörfler uint32 blocks_per_track; 13691b48298SAxel Dörfler uint32 reserved_blocks_at_start; 13791b48298SAxel Dörfler uint32 reserved_blocks_at_end; 13891b48298SAxel Dörfler uint32 interleave; 13991b48298SAxel Dörfler uint32 first_cylinder; 14091b48298SAxel Dörfler uint32 last_cylinder; 14191b48298SAxel Dörfler uint32 num_buffers; 14291b48298SAxel Dörfler uint32 buffer_mem_type; 14391b48298SAxel Dörfler uint32 max_transfer; 14491b48298SAxel Dörfler uint32 dma_mask; 14591b48298SAxel Dörfler int32 boot_priority; 14691b48298SAxel Dörfler uint32 dos_type; 14791b48298SAxel Dörfler uint32 baud_rate; 14891b48298SAxel Dörfler uint32 control; 14991b48298SAxel Dörfler uint32 boot_blocks; 15091b48298SAxel Dörfler FirstCylinderdisk_environment15132270ffeSAxel Dörfler uint32 FirstCylinder() const { return B_BENDIAN_TO_HOST_INT32(first_cylinder); } LastCylinderdisk_environment15232270ffeSAxel Dörfler uint32 LastCylinder() const { return B_BENDIAN_TO_HOST_INT32(last_cylinder); } Surfacesdisk_environment15332270ffeSAxel Dörfler uint32 Surfaces() const { return B_BENDIAN_TO_HOST_INT32(surfaces); } BlocksPerTrackdisk_environment15432270ffeSAxel Dörfler uint32 BlocksPerTrack() const { return B_BENDIAN_TO_HOST_INT32(blocks_per_track); } LongBlockSizedisk_environment15532270ffeSAxel Dörfler uint32 LongBlockSize() const { return B_BENDIAN_TO_HOST_INT32(long_block_size); } BlockSizedisk_environment15632270ffeSAxel Dörfler uint32 BlockSize() const { return LongBlockSize() << 2; } 15791b48298SAxel Dörfler Startdisk_environment15891b48298SAxel Dörfler uint64 Start() 15991b48298SAxel Dörfler { 16032270ffeSAxel Dörfler return uint64(FirstCylinder()) * BlocksPerTrack() * Surfaces() * BlockSize(); 16191b48298SAxel Dörfler } 16291b48298SAxel Dörfler Sizedisk_environment16391b48298SAxel Dörfler uint64 Size() 16491b48298SAxel Dörfler { 16591b48298SAxel Dörfler return uint64(LastCylinder() + 1 - FirstCylinder()) * BlocksPerTrack() * Surfaces() 16632270ffeSAxel Dörfler * BlockSize(); 16791b48298SAxel Dörfler } 16891b48298SAxel Dörfler }; 16991b48298SAxel Dörfler 17091b48298SAxel Dörfler 17191b48298SAxel Dörfler /************* file system header block *************/ 17291b48298SAxel Dörfler 17391b48298SAxel Dörfler struct fs_header_block { 17491b48298SAxel Dörfler }; 17591b48298SAxel Dörfler 17691b48298SAxel Dörfler #define RDB_FS_HEADER_ID 'FSHD' 17791b48298SAxel Dörfler 17891b48298SAxel Dörfler struct load_seg_block { 17991b48298SAxel Dörfler }; 18091b48298SAxel Dörfler 18191b48298SAxel Dörfler #define RDB_LOAD_SEG_ID 'LSEG' 18291b48298SAxel Dörfler 18391b48298SAxel Dörfler #endif /* AMIGA_RDB_H */ 18491b48298SAxel Dörfler 185