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