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
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
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.
|
||||
|
||||
2008-01-15 Bean <bean123ch@gmail.com>
|
||||
|
||||
* normal/execute.c (grub_script_exec_argument_to_string): Check for undefined variable.
|
||||
|
|
|
@ -97,6 +97,10 @@ int EXPORT_FUNC(grub_ieee1275_get_property) (grub_ieee1275_phandle_t phandle,
|
|||
const char *property, void *buf,
|
||||
grub_size_t size,
|
||||
grub_ssize_t *actual);
|
||||
int EXPORT_FUNC(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 EXPORT_FUNC(grub_ieee1275_next_property) (grub_ieee1275_phandle_t phandle,
|
||||
char *prev_prop, char *prop);
|
||||
int EXPORT_FUNC(grub_ieee1275_get_property_length)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -56,8 +56,8 @@ grub_ieee1275_find_options (void)
|
|||
int is_smartfirmware = 0;
|
||||
|
||||
grub_ieee1275_finddevice ("/options", &options);
|
||||
rc = grub_ieee1275_get_property (options, "real-mode?", &realmode,
|
||||
sizeof realmode, 0);
|
||||
rc = grub_ieee1275_get_integer_property (options, "real-mode?", &realmode,
|
||||
sizeof realmode, 0);
|
||||
if ((rc >= 0) && realmode)
|
||||
grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_REAL_MODE);
|
||||
|
||||
|
|
|
@ -148,17 +148,17 @@ grub_err_t grub_available_iterate (int (*hook) (grub_uint64_t, grub_uint64_t))
|
|||
|
||||
/* Determine the format of each entry in `available'. */
|
||||
grub_ieee1275_finddevice ("/", &root);
|
||||
grub_ieee1275_get_property (root, "#address-cells", &address_cells,
|
||||
sizeof address_cells, 0);
|
||||
grub_ieee1275_get_property (root, "#size-cells", &size_cells,
|
||||
sizeof size_cells, 0);
|
||||
grub_ieee1275_get_integer_property (root, "#address-cells", &address_cells,
|
||||
sizeof address_cells, 0);
|
||||
grub_ieee1275_get_integer_property (root, "#size-cells", &size_cells,
|
||||
sizeof size_cells, 0);
|
||||
|
||||
/* Load `/memory/available'. */
|
||||
if (grub_ieee1275_finddevice ("/memory", &memory))
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
||||
"Couldn't find /memory node");
|
||||
if (grub_ieee1275_get_property (memory, "available", available,
|
||||
sizeof available, &available_size))
|
||||
if (grub_ieee1275_get_integer_property (memory, "available", available,
|
||||
sizeof available, &available_size))
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
||||
"Couldn't examine /memory/available property");
|
||||
|
||||
|
@ -203,8 +203,8 @@ grub_map (grub_addr_t phys, grub_addr_t virt, grub_uint32_t size,
|
|||
grub_ieee1275_ihandle_t mmu;
|
||||
int len;
|
||||
|
||||
grub_ieee1275_get_property (grub_ieee1275_chosen, "mmu", &mmu, sizeof mmu,
|
||||
&len);
|
||||
grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "mmu", &mmu, sizeof mmu,
|
||||
&len);
|
||||
if (len != sizeof mmu)
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -183,8 +183,8 @@ grub_map (grub_addr_t phys, grub_addr_t virt, grub_uint32_t size,
|
|||
grub_ieee1275_ihandle_t mmu;
|
||||
grub_ssize_t len;
|
||||
|
||||
grub_ieee1275_get_property (grub_ieee1275_chosen, "mmu", &mmu, sizeof mmu,
|
||||
&len);
|
||||
grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "mmu", &mmu, sizeof mmu,
|
||||
&len);
|
||||
if (len != sizeof mmu)
|
||||
return -1;
|
||||
|
||||
|
|
Loading…
Reference in a new issue