/*
* (C) Copyright 2001
- * Hans-Joerg Frieden, Hyperion Entertainment
+ * Hans-Joerg Frieden, Hyperion Entertainment
* Hans-JoergF@hyperion-entertainment.com
*
* See file CREDITS for list of people who contributed to this
#include <common.h>
#include <command.h>
#include <ide.h>
-#include <cmd_disk.h>
#include "part_amiga.h"
-#if ((CONFIG_COMMANDS & CFG_CMD_IDE) || (CONFIG_COMMANDS & CFG_CMD_SCSI)) && defined(CONFIG_AMIGA_PARTITION)
+#if defined(CONFIG_CMD_IDE) || \
+ defined(CONFIG_CMD_MG_DISK) || \
+ defined(CONFIG_CMD_SCSI) || \
+ defined(CONFIG_CMD_USB) || \
+ defined(CONFIG_MMC) || \
+ defined(CONFIG_SYSTEMACE)
#undef AMIGA_DEBUG
int len = *string++;
char buffer[256];
int i;
-
+
i = 0;
while (len)
{
for (i = 0; i < header->summed_longs; i++)
sum += *block++;
-
+
return (sum != 0);
}
static void print_part_info(struct partition_block *p)
{
struct amiga_part_geometry *g;
-
+
g = (struct amiga_part_geometry *)&(p->environment);
bstr_print(p->drive_name);
- printf("%6d\t%6d\t",
- g->low_cyl * g->block_per_track * g->surfaces ,
+ printf("%6d\t%6d\t",
+ g->low_cyl * g->block_per_track * g->surfaces ,
(g->high_cyl - g->low_cyl + 1) * g->block_per_track * g->surfaces - 1);
print_disk_type(g->dos_type);
printf("\t%5d\n", g->boot_priority);
s = getenv("amiga_scanlimit");
if (s)
- limit = atoi(s);
+ limit = simple_strtoul(s, NULL, 10);
else
limit = AMIGA_BLOCK_LIMIT;
return NULL;
}
-/*
+/*
* Search for boot code
* Again, the first boot block must be located somewhere in the first 16 blocks, or rooted in the
* Ridgid disk block
s = getenv("amiga_scanlimit");
if (s)
- limit = atoi(s);
+ limit = simple_strtoul(s, NULL, 10);
else
limit = AMIGA_BLOCK_LIMIT;
return 0;
}
-/*
+/*
* Test if the given partition has an Amiga partition table/Rigid
* Disk block
*/
struct bootcode_block *bootcode;
PRINTF("test_part_amiga: Testing for an Amiga RDB partition\n");
-
+
rdb = get_rdisk(dev_desc);
if (rdb)
{
return 0;
}
- else
+ else
{
PRINTF("test_part_amiga: no RDB found\n");
return -1;
}
-/*
+/*
* Find partition number partnum on the given drive.
*/
static struct partition_block *find_partition(block_dev_desc_t *dev_desc, int partnum)
PRINTF("Trying to find partition block %d\n", partnum);
rdb = get_rdisk(dev_desc);
- if (!rdb)
+ if (!rdb)
{
PRINTF("find_partition: no rdb found\n");
return NULL;
}
-
+
PRINTF("find_partition: Scanning partition list\n");
block = rdb->partition_list;
if (sum_block((struct block_header *)p) == 0)
{
if (partnum == 0) break;
- else
+ else
{
partnum--;
block = p->next;
} else block = 0xFFFFFFFF;
}
- if (block == 0xFFFFFFFF)
+ if (block == 0xFFFFFFFF)
{
PRINTF("PART block not found\n");
return NULL;
return (struct partition_block *)block_buffer;
}
-/*
+/*
* Get info about a partition
*/
int get_partition_info_amiga (block_dev_desc_t *dev_desc, int part, disk_partition_t *info)
info->size = (g->high_cyl - g->low_cyl + 1) * g->block_per_track * g->surfaces - 1;
info->blksz = rdb.block_bytes;
bcpl_strcpy(info->name, p->drive_name);
-
+
disk_type = g->dos_type;
info->type[3] = '\\';
info->type[4] = (disk_type & 0x000000FF) + '0';
info->type[5] = 0;
-
+
return 0;
}
void print_part_amiga (block_dev_desc_t *dev_desc)
-{
+{
struct rigid_disk_block *rdb;
struct bootcode_block *boot;
struct partition_block *p;
int i = 1;
rdb = get_rdisk(dev_desc);
- if (!rdb)
+ if (!rdb)
{
PRINTF("print_part_amiga: no rdb found\n");
return;
}
-
+
PRINTF("print_part_amiga: Scanning partition list\n");
block = rdb->partition_list;
ulong res;
PRINTF("Trying to load block #0x%X\n", block);
-
+
res = dev_desc->block_read(dev_desc->dev, block, 1,
(ulong *)block_buffer);
if (res == 1)