1/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * (C) Copyright 2000
4 * Hans-Joerg Frieden, Hyperion Entertainment
5 * Hans-JoergF@hyperion-entertainment.com
6 */
7
8#ifndef _DISK_PART_AMIGA_H
9#define _DISK_PART_AMIGA_H
10
11#if CONFIG_IS_ENABLED(ISO_PARTITION)
12/* Make the buffers bigger if ISO partition support is enabled -- CD-ROMS
13   have 2048 byte blocks */
14#define DEFAULT_SECTOR_SIZE   2048
15#else
16#define DEFAULT_SECTOR_SIZE	512
17#endif
18
19
20#define AMIGA_BLOCK_LIMIT 16
21
22/*
23 * Amiga disks have a very open structure. The head for the partition table information
24 * is stored somewhere within the first 16 blocks on disk, and is called the
25 * "RigidDiskBlock".
26 */
27
28struct rigid_disk_block
29{
30    u32 id;
31    u32 summed_longs;
32    s32 chk_sum;
33    u32 host_id;
34    u32 block_bytes;
35    u32 flags;
36    u32 bad_block_list;
37    u32 partition_list;
38    u32 file_sys_header_list;
39    u32 drive_init;
40    u32 bootcode_block;
41    u32 reserved_1[5];
42
43    /* Physical drive geometry */
44    u32 cylinders;
45    u32 sectors;
46    u32 heads;
47    u32 interleave;
48    u32 park;
49    u32 reserved_2[3];
50    u32 write_pre_comp;
51    u32 reduced_write;
52    u32 step_rate;
53    u32 reserved_3[5];
54
55    /* logical drive geometry */
56    u32 rdb_blocks_lo;
57    u32 rdb_blocks_hi;
58    u32 lo_cylinder;
59    u32 hi_cylinder;
60    u32 cyl_blocks;
61    u32 auto_park_seconds;
62    u32 high_rdsk_block;
63    u32 reserved_4;
64
65    char disk_vendor[8];
66    char disk_product[16];
67    char disk_revision[4];
68    char controller_vendor[8];
69    char controller_product[16];
70    char controller_revision[4];
71
72    u32 reserved_5[10];
73};
74
75/*
76 * Each partition on this drive is defined by such a block
77 */
78
79struct partition_block
80{
81    u32 id;
82    u32 summed_longs;
83    s32 chk_sum;
84    u32 host_id;
85    u32 next;
86    u32 flags;
87    u32 reserved_1[2];
88    u32 dev_flags;
89    char drive_name[32];
90    u32 reserved_2[15];
91    u32 environment[17];
92    u32 reserved_3[15];
93};
94
95struct bootcode_block
96{
97    u32   id;
98    u32   summed_longs;
99    s32   chk_sum;
100    u32   host_id;
101    u32   next;
102    u32   load_data[123];
103};
104
105
106#define AMIGA_ID_RDISK                  0x5244534B
107#define AMIGA_ID_PART                   0x50415254
108#define AMIGA_ID_BOOT                   0x424f4f54
109
110/*
111 * The environment array in the partition block
112 * describes the partition
113 */
114
115struct amiga_part_geometry
116{
117    u32 table_size;
118    u32 size_blocks;
119    u32 unused1;
120    u32 surfaces;
121    u32 sector_per_block;
122    u32 block_per_track;
123    u32 reserved;
124    u32 prealloc;
125    u32 interleave;
126    u32 low_cyl;
127    u32 high_cyl;
128    u32 num_buffers;
129    u32 buf_mem_type;
130    u32 max_transfer;
131    u32 mask;
132    s32 boot_priority;
133    u32 dos_type;
134    u32 baud;
135    u32 control;
136    u32 boot_blocks;
137};
138
139#endif /* _DISK_PART_AMIGA_H_ */
140