2008-01-15 Robert Millan <rmh@aybabtu.com>
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_get_integer_property): New function prototype. * kern/ieee1275/ieee1275.c: Include `<grub/types.h>'. (grub_ieee1275_get_integer_property): New function. Wraps around grub_ieee1275_get_property() to handle endianess. * kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options): Replace grub_ieee1275_get_property() with grub_ieee1275_get_integer_property() where appropiate. * kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Likewise. (grub_map): Likewise. * kern/sparc64/ieee1275/openfw.c (grub_map): Likewise.
This commit is contained in:
parent
a83ccafd50
commit
66a6580720
6 changed files with 53 additions and 12 deletions
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
#define IEEE1275_PHANDLE_INVALID ((grub_ieee1275_phandle_t) -1)
|
||||
#define IEEE1275_IHANDLE_INVALID ((grub_ieee1275_ihandle_t) 0)
|
||||
|
@ -88,6 +89,26 @@ grub_ieee1275_get_property (grub_ieee1275_phandle_t phandle,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
grub_ieee1275_get_integer_property (grub_ieee1275_phandle_t phandle,
|
||||
const char *property, grub_uint32_t *buf,
|
||||
grub_size_t size, grub_ssize_t *actual)
|
||||
{
|
||||
int ret;
|
||||
ret = grub_ieee1275_get_property (phandle, property, (void *) buf, size, actual);
|
||||
#ifndef GRUB_CPU_WORDS_BIGENDIAN
|
||||
/* Integer properties are always in big endian. */
|
||||
if (ret == 0)
|
||||
{
|
||||
int i;
|
||||
size /= sizeof (grub_uint32_t);
|
||||
for (i = 0; i < size; i++)
|
||||
buf[i] = grub_be_to_cpu32 (buf[i]);
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
grub_ieee1275_next_property (grub_ieee1275_phandle_t phandle, char *prev_prop,
|
||||
char *prop)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue