mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
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:
committed by
Mark Cave-Ayland
parent
4cac87e606
commit
fd32324336
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,13 +127,12 @@ macparts_open( macparts_info_t *di )
|
||||
/* search a bootable partition */
|
||||
/* see PowerPC Microprocessor CHRP bindings */
|
||||
|
||||
parnum = 1;
|
||||
while (parnum <= __be32_to_cpu(par.pmMapBlkCnt)) {
|
||||
SEEK( (bs * parnum) );
|
||||
for (parnum = 0; parnum <= __be32_to_cpu(par.pmMapBlkCnt); parnum++) {
|
||||
SEEK( (bs * (parnum + 1)) );
|
||||
READ( &par, sizeof(par) );
|
||||
if( __be16_to_cpu(par.pmSig) != DESC_PART_SIGNATURE ||
|
||||
!__be16_to_cpu(par.pmPartBlkCnt) )
|
||||
goto out;
|
||||
break;
|
||||
|
||||
DPRINTF("found partition type: %s\n", par.pmPartType);
|
||||
|
||||
@@ -169,7 +168,6 @@ macparts_open( macparts_info_t *di )
|
||||
goto out;
|
||||
}
|
||||
|
||||
parnum++;
|
||||
}
|
||||
/* not found */
|
||||
if (firstHFS != -1) {
|
||||
@@ -199,7 +197,7 @@ macparts_open( macparts_info_t *di )
|
||||
goto out;
|
||||
|
||||
found:
|
||||
SEEK( (bs * parnum) );
|
||||
SEEK( (bs * (parnum + 1)) );
|
||||
READ( &par, sizeof(par) );
|
||||
if( __be16_to_cpu(par.pmSig) != DESC_PART_SIGNATURE || !__be32_to_cpu(par.pmPartBlkCnt) )
|
||||
goto out;
|
||||
|
||||
Reference in New Issue
Block a user