X-Git-Url: http://git.ozlabs.org/?p=yaboot.git;a=blobdiff_plain;f=second%2Fpartition.c;h=05823092614e1b9011fe4e2d88d26f69ebe32e40;hp=399076706ddba7bdd3a77be6cc8d089b670078a8;hb=c864c0961c4405bda1179fa4dc438fad3005e119;hpb=2ad0d7649e5042cad43a16b4a03bf53f39948316 diff --git a/second/partition.c b/second/partition.c index 3990767..0582309 100644 --- a/second/partition.c +++ b/second/partition.c @@ -1,7 +1,9 @@ /* * partition.c - partition table support * - * Copyright (C) 2001 Ethan Benson + * Copyright (C) 2004 Sven Luther + * + * Copyright (C) 2001, 2002 Ethan Benson * * Copyright (C) 1999 Benjamin Herrenschmidt * @@ -31,6 +33,7 @@ #include "stdlib.h" #include "mac-part.h" #include "fdisk-part.h" +#include "amiga-part.h" #include "partition.h" #include "prom.h" #include "string.h" @@ -64,7 +67,7 @@ static unsigned char block_buffer[MAX_BLOCK_SIZE]; static void add_new_partition(struct partition_t** list, int part_number, const char *part_type, const char *part_name, unsigned long part_start, unsigned long part_size, - unsigned short part_blocksize) + unsigned short part_blocksize, int sys_ind) { struct partition_t* part; part = (struct partition_t*)malloc(sizeof(struct partition_t)); @@ -75,6 +78,7 @@ add_new_partition(struct partition_t** list, int part_number, const char *part_t part->part_start = part_start; part->part_size = part_size; part->blocksize = part_blocksize; + part->sys_ind = sys_ind; /* Tack this entry onto the list */ part->next = *list; @@ -146,7 +150,8 @@ partition_mac_lookup( const char *dev_name, prom_handle disk, part->name, /* name */ part->start_block + part->data_start, /* start */ part->data_count, /* size */ - ptable_block_size ); + ptable_block_size, + 0); } } @@ -167,14 +172,15 @@ partition_fdisk_lookup( const char *dev_name, prom_handle disk, (struct fdisk_partition *) (block_buffer + 0x1be); for (partition=1; partition <= 4 ;partition++, part++) { - if (part->sys_ind == LINUX_NATIVE) { + if (part->sys_ind == LINUX_NATIVE || part->sys_ind == LINUX_RAID) { add_new_partition( list, partition, "Linux", /* type */ '\0', /* name */ swab32(*(unsigned int *)(part->start4)), swab32(*(unsigned int *)(part->size4)), - 512 /*blksize*/ ); + 512 /*blksize*/, + part->sys_ind /* partition type */ ); } } } @@ -213,6 +219,117 @@ identify_iso_fs(ihandle device, unsigned int *iso_root_block) return 0; } +/* + * Detects and read amiga partition tables. + */ + +static int +_amiga_checksum (unsigned int blk_size) +{ + unsigned int sum; + int i, end; + unsigned int *amiga_block = (unsigned int *) block_buffer; + + sum = amiga_block[0]; + end = amiga_block[AMIGA_LENGTH]; + + if (end > blk_size) end = blk_size; + + for (i = 1; i < end; i++) sum += amiga_block[i]; + + return sum; +} + +static int +_amiga_find_rdb (const char *dev_name, prom_handle disk, unsigned int prom_blksize) +{ + int i; + unsigned int *amiga_block = (unsigned int *) block_buffer; + + for (i = 0; i