Fix the HFSP probe function, plus also resolve an off-by-one error in the mac-parts partition code. This should fix PPC boot once again.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@794 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Mark Cave-Ayland
2010-06-15 16:31:54 +00:00
committed by Mark Cave-Ayland
parent 4cac87e606
commit fd32324336
2 changed files with 14 additions and 12 deletions

View File

@@ -294,17 +294,21 @@ volume_create_extents_tree(volume* vol)
int
volume_probe(int fd, llong offset)
{
struct hfsp_vh *vol;
UInt16 *vol;
int ret = 0;
vol = (struct hfsp_vh*)malloc(2 * 1 << HFSP_BLOCKSZ_BITS);
vol = (UInt16 *)malloc(2 * 1 << HFSP_BLOCKSZ_BITS);
os_seek_offset( fd, 2 * (1 << HFSP_BLOCKSZ_BITS) + offset );
os_read(fd, vol, 2, HFSP_BLOCKSZ_BITS);
if (__be16_to_cpu(vol->signature) != HFSP_VOLHEAD_SIG) {
free(vol);
return 0;
if (__be16_to_cpu(vol[0]) == HFS_VOLHEAD_SIG &&
__be16_to_cpu(vol[0x7c]) == HFSP_VOLHEAD_SIG) {
ret = -1;
} else if (__be16_to_cpu(vol[0]) == HFSP_VOLHEAD_SIG) {
ret = -1;
}
free(vol);
return -1;
return ret;
}