3 /* <project_name> -- <project_description>
5 * Copyright (C) 2006 - 2007
6 * Giuseppe Coviello <cjg@cruxppc.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 /* #ifndef EXTERNAL_TOOL */
34 block_dev_desc_t
*dev_desc
;
35 disk_partition_t
*info
;
39 #define RDB_LOCATION_LIMIT 16
41 #define IDNAME_RIGIDDISK (uint32_t)0x5244534B /* 'RDSK' */
42 #define IDNAME_BADBLOCK (uint32_t)0x42414442 /* 'BADB' */
43 #define IDNAME_PARTITION (uint32_t)0x50415254 /* 'PART' */
44 #define IDNAME_FILESYSHEADER (uint32_t)0x46534844 /* 'FSHD' */
45 #define IDNAME_LOADSEG (uint32_t)0x4C534547 /* 'LSEG' */
46 #define IDNAME_BOOT (uint32_t)0x424f4f54 /* 'BOOT' */
47 #define IDNAME_FREE (uint32_t)0xffffffff
49 #define IS_FREE(blk) ((*(uint32_t *) (blk)) != IDNAME_RIGIDDISK \
50 && (*(uint32_t *) (blk)) != IDNAME_BADBLOCK \
51 && (*(uint32_t *) (blk)) != IDNAME_PARTITION \
52 && (*(uint32_t *) (blk)) != IDNAME_FILESYSHEADER \
53 && (*(uint32_t *) (blk)) != IDNAME_LOADSEG \
54 && (*(uint32_t *) (blk)) != IDNAME_BOOT)
57 uint32_t amiga_ID
; /* Identifier 32 bit word */
58 uint32_t amiga_SummedLongss
; /* Size of the structure for checksums */
59 int32_t amiga_ChkSum
; /* Checksum of the structure */
62 struct RigidDiskBlock
{
63 uint32_t rdb_ID
; /* Identifier 32 bit word : 'RDSK' */
64 uint32_t rdb_SummedLongs
; /* Size of the structure for checksums */
65 int32_t rdb_ChkSum
; /* Checksum of the structure */
66 uint32_t rdb_HostID
; /* SCSI Target ID of host, not really used */
67 uint32_t rdb_BlockBytes
; /* Size of disk blocks */
68 uint32_t rdb_Flags
; /* RDB Flags */
69 /* block list heads */
70 uint32_t rdb_BadBlockList
; /* Bad block list */
71 uint32_t rdb_PartitionList
; /* Partition list */
72 uint32_t rdb_FileSysHeaderList
; /* File system header list */
73 uint32_t rdb_DriveInit
; /* Drive specific init code */
74 uint32_t rdb_BootBlockList
; /* Amiga OS 4 Boot Blocks */
75 uint32_t rdb_Reserved1
[5]; /* Unused word, need to be set to $ffffffff */
76 /* physical drive characteristics */
77 uint32_t rdb_Cylinders
; /* Number of the cylinders of the drive */
78 uint32_t rdb_Sectors
; /* Number of sectors of the drive */
79 uint32_t rdb_Heads
; /* Number of heads of the drive */
80 uint32_t rdb_Interleave
; /* Interleave */
81 uint32_t rdb_Park
; /* Head parking cylinder */
82 uint32_t rdb_Reserved2
[3]; /* Unused word, need to be set to $ffffffff */
83 uint32_t rdb_WritePreComp
; /* Starting cylinder of write precompensation */
84 uint32_t rdb_ReducedWrite
; /* Starting cylinder of reduced write current */
85 uint32_t rdb_StepRate
; /* Step rate of the drive */
86 uint32_t rdb_Reserved3
[5]; /* Unused word, need to be set to $ffffffff */
87 /* logical drive characteristics */
88 uint32_t rdb_RDBBlocksLo
; /* low block of range reserved for hardblocks */
89 uint32_t rdb_RDBBlocksHi
; /* high block of range for these hardblocks */
90 uint32_t rdb_LoCylinder
; /* low cylinder of partitionable disk area */
91 uint32_t rdb_HiCylinder
; /* high cylinder of partitionable data area */
92 uint32_t rdb_CylBlocks
; /* number of blocks available per cylinder */
93 uint32_t rdb_AutoParkSeconds
; /* zero for no auto park */
94 uint32_t rdb_HighRDSKBlock
; /* highest block used by RDSK */
95 /* (not including replacement bad blocks) */
96 uint32_t rdb_Reserved4
;
97 /* drive identification */
98 char rdb_DiskVendor
[8];
99 char rdb_DiskProduct
[16];
100 char rdb_DiskRevision
[4];
101 char rdb_ControllerVendor
[8];
102 char rdb_ControllerProduct
[16];
103 char rdb_ControllerRevision
[4];
104 uint32_t rdb_Reserved5
[10];
107 struct BootstrapCodeBlock
{
108 uint32_t bcb_ID
; /* 4 character identifier */
109 uint32_t bcb_SummedLongs
; /* size of this checksummed structure */
110 int32_t bcb_ChkSum
; /* block checksum (longword sum to zero) */
111 uint32_t bcb_HostID
; /* SCSI Target ID of host */
112 uint32_t bcb_Next
; /* block number of the next BootstrapCodeBlock */
113 uint32_t bcb_LoadData
[123]; /* binary data of the bootstrapper */
114 /* note [123] assumes 512 byte blocks */
117 struct PartitionBlock
{
119 int32_t pb_SummedLongs
;
124 uint32_t pb_Reserved1
[2];
125 uint32_t pb_DevFlags
;
126 char pb_DriveName
[32];
127 uint32_t pb_Reserved2
[15];
128 int32_t pb_Environment
[17];
129 uint32_t pb_EReserved
[15];
132 struct AmigaPartitionGeometry
{
133 uint32_t apg_TableSize
;
134 uint32_t apg_SizeBlocks
;
135 uint32_t apg_Unused1
;
136 uint32_t apg_Surfaces
;
137 uint32_t apg_SectorPerBlock
;
138 uint32_t apg_BlockPerTrack
;
139 uint32_t apg_Reserved
;
140 uint32_t apg_Prealloc
;
141 uint32_t apg_Interleave
;
143 uint32_t apg_HighCyl
;
144 uint32_t apg_NumBuffers
;
145 uint32_t apg_BufMemType
;
146 uint32_t apg_MaxTransfer
;
148 int32_t apg_BootPriority
;
149 uint32_t apg_DosType
;
151 uint32_t apg_Control
;
152 uint32_t apg_BootBlocks
;
155 void RdbPartitionTable_init(void);
156 struct RdbPartition
*RdbPartitionTable_get(uint8_t disk
, uint8_t partition
);
157 struct RdbPartition
*RdbPartitionTable_getbyname(char *name
);
158 void RdbPartitionTable_dump(void);