2007-12-30 08:52:06 +00:00
|
|
|
/* openfw.c -- Open firmware support functions. */
|
2004-03-28 21:52:02 +00:00
|
|
|
/*
|
2004-04-04 13:46:03 +00:00
|
|
|
* GRUB -- GRand Unified Bootloader
|
2009-12-05 01:43:17 +00:00
|
|
|
* Copyright (C) 2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc.
|
2004-03-28 21:52:02 +00:00
|
|
|
*
|
2007-07-21 23:32:33 +00:00
|
|
|
* GRUB is free software: you can redistribute it and/or modify
|
2004-03-28 21:52:02 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2007-07-21 23:32:33 +00:00
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
2004-03-28 21:52:02 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2007-07-21 23:32:33 +00:00
|
|
|
* GRUB is distributed in the hope that it will be useful,
|
2004-03-28 21:52:02 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2007-07-21 23:32:33 +00:00
|
|
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
2004-03-28 21:52:02 +00:00
|
|
|
*/
|
|
|
|
|
2007-02-13 03:20:16 +00:00
|
|
|
#include <grub/types.h>
|
2004-04-04 13:46:03 +00:00
|
|
|
#include <grub/err.h>
|
|
|
|
#include <grub/misc.h>
|
|
|
|
#include <grub/mm.h>
|
2005-08-03 22:53:51 +00:00
|
|
|
#include <grub/ieee1275/ieee1275.h>
|
2004-03-28 21:52:02 +00:00
|
|
|
|
2005-04-22 02:32:37 +00:00
|
|
|
enum grub_ieee1275_parse_type
|
|
|
|
{
|
|
|
|
GRUB_PARSE_FILENAME,
|
|
|
|
GRUB_PARSE_PARTITION,
|
|
|
|
};
|
|
|
|
|
2004-10-13 23:43:44 +00:00
|
|
|
/* Walk children of 'devpath', calling hook for each. */
|
2009-04-24 12:05:54 +00:00
|
|
|
int
|
2004-10-13 23:43:44 +00:00
|
|
|
grub_children_iterate (char *devpath,
|
2009-04-24 12:05:54 +00:00
|
|
|
int (*hook) (struct grub_ieee1275_devalias *alias))
|
2004-10-13 23:43:44 +00:00
|
|
|
{
|
|
|
|
grub_ieee1275_phandle_t dev;
|
|
|
|
grub_ieee1275_phandle_t child;
|
2009-04-22 09:46:54 +00:00
|
|
|
char *childtype, *childpath;
|
2009-12-29 09:04:06 +00:00
|
|
|
char *childname;
|
2009-04-24 12:05:54 +00:00
|
|
|
int ret = 0;
|
2004-10-13 23:43:44 +00:00
|
|
|
|
2005-10-01 Hollis Blanchard <hollis@penguinppc.org>
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Cast `size' to long.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_next_property):
Remove `flags' argument. All callers changed.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_ROOT): Removed.
(IEEE1275_IHANDLE_INVALID): New variable.
(IEEE1275_CELL_INVALID): New variable.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_get_property_length, grub_ieee1275_instance_to_package,
grub_ieee1275_package_to_path, grub_ieee1275_instance_to_path,
grub_ieee1275_peer, grub_ieee1275_child, grub_ieee1275_open,
grub_ieee1275_claim, grub_ieee1275_set_property): Error-check return
codes from Open Firmware. All callers updated.
(grub_ieee1275_next_property): Directly return Open Firmware return
code.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options):
Standardize error checking from `grub_ieee1275_get_property'.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Rename
`devalias' to `aliases'. Correct comments. Consolidate error paths.
2006-10-01 08:30:09 +00:00
|
|
|
if (grub_ieee1275_finddevice (devpath, &dev))
|
2009-04-24 12:05:54 +00:00
|
|
|
return 0;
|
2004-10-13 23:43:44 +00:00
|
|
|
|
2005-10-01 Hollis Blanchard <hollis@penguinppc.org>
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Cast `size' to long.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_next_property):
Remove `flags' argument. All callers changed.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_ROOT): Removed.
(IEEE1275_IHANDLE_INVALID): New variable.
(IEEE1275_CELL_INVALID): New variable.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_get_property_length, grub_ieee1275_instance_to_package,
grub_ieee1275_package_to_path, grub_ieee1275_instance_to_path,
grub_ieee1275_peer, grub_ieee1275_child, grub_ieee1275_open,
grub_ieee1275_claim, grub_ieee1275_set_property): Error-check return
codes from Open Firmware. All callers updated.
(grub_ieee1275_next_property): Directly return Open Firmware return
code.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options):
Standardize error checking from `grub_ieee1275_get_property'.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Rename
`devalias' to `aliases'. Correct comments. Consolidate error paths.
2006-10-01 08:30:09 +00:00
|
|
|
if (grub_ieee1275_child (dev, &child))
|
2009-04-24 12:05:54 +00:00
|
|
|
return 0;
|
2004-10-13 23:43:44 +00:00
|
|
|
|
2009-04-22 09:46:54 +00:00
|
|
|
childtype = grub_malloc (IEEE1275_MAX_PROP_LEN);
|
|
|
|
if (!childtype)
|
2009-04-24 12:05:54 +00:00
|
|
|
return 0;
|
2009-04-22 09:46:54 +00:00
|
|
|
childpath = grub_malloc (IEEE1275_MAX_PATH_LEN);
|
|
|
|
if (!childpath)
|
|
|
|
{
|
|
|
|
grub_free (childtype);
|
2009-04-24 12:05:54 +00:00
|
|
|
return 0;
|
2009-04-22 09:46:54 +00:00
|
|
|
}
|
|
|
|
childname = grub_malloc (IEEE1275_MAX_PROP_LEN);
|
|
|
|
if (!childname)
|
|
|
|
{
|
|
|
|
grub_free (childpath);
|
|
|
|
grub_free (childtype);
|
2009-04-24 12:05:54 +00:00
|
|
|
return 0;
|
2009-04-22 09:46:54 +00:00
|
|
|
}
|
|
|
|
|
2004-10-13 23:43:44 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
struct grub_ieee1275_devalias alias;
|
2009-04-11 03:09:17 +00:00
|
|
|
grub_ssize_t actual;
|
2004-10-13 23:43:44 +00:00
|
|
|
|
2009-05-04 22:46:55 +00:00
|
|
|
if (grub_ieee1275_get_property (child, "device_type", childtype,
|
2009-07-10 20:19:08 +00:00
|
|
|
IEEE1275_MAX_PROP_LEN, &actual))
|
2010-01-31 00:57:17 +00:00
|
|
|
childtype[0] = 0;
|
2004-10-13 23:43:44 +00:00
|
|
|
|
2010-03-31 20:01:37 +00:00
|
|
|
if (dev == child)
|
|
|
|
continue;
|
|
|
|
|
2009-07-10 20:19:08 +00:00
|
|
|
if (grub_ieee1275_package_to_path (child, childpath,
|
|
|
|
IEEE1275_MAX_PATH_LEN, &actual))
|
2004-10-13 23:43:44 +00:00
|
|
|
continue;
|
|
|
|
|
2010-03-31 20:01:37 +00:00
|
|
|
if (grub_strcmp (devpath, childpath) == 0)
|
|
|
|
continue;
|
|
|
|
|
2009-05-04 22:46:55 +00:00
|
|
|
if (grub_ieee1275_get_property (child, "name", childname,
|
2009-07-11 03:59:15 +00:00
|
|
|
IEEE1275_MAX_PROP_LEN, &actual))
|
2004-10-13 23:43:44 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
alias.type = childtype;
|
|
|
|
alias.path = childpath;
|
2010-02-14 19:03:19 +00:00
|
|
|
alias.name = childname;
|
2009-04-24 12:05:54 +00:00
|
|
|
ret = hook (&alias);
|
|
|
|
if (ret)
|
|
|
|
break;
|
2004-10-13 23:43:44 +00:00
|
|
|
}
|
2010-01-31 00:57:17 +00:00
|
|
|
while (grub_ieee1275_peer (child, &child) != -1);
|
2004-10-13 23:43:44 +00:00
|
|
|
|
2009-04-22 09:46:54 +00:00
|
|
|
grub_free (childname);
|
|
|
|
grub_free (childpath);
|
|
|
|
grub_free (childtype);
|
|
|
|
|
2009-04-24 12:05:54 +00:00
|
|
|
return ret;
|
2004-10-13 23:43:44 +00:00
|
|
|
}
|
|
|
|
|
2010-01-31 00:57:17 +00:00
|
|
|
int
|
|
|
|
grub_ieee1275_devices_iterate (int (*hook) (struct grub_ieee1275_devalias *alias))
|
|
|
|
{
|
|
|
|
auto int it_through (struct grub_ieee1275_devalias *alias);
|
|
|
|
int it_through (struct grub_ieee1275_devalias *alias)
|
|
|
|
{
|
|
|
|
if (hook (alias))
|
|
|
|
return 1;
|
2010-02-14 19:03:19 +00:00
|
|
|
return grub_children_iterate (alias->path, it_through);
|
2010-01-31 00:57:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return grub_children_iterate ("/", it_through);
|
|
|
|
}
|
|
|
|
|
2005-04-22 02:32:37 +00:00
|
|
|
/* Iterate through all device aliases. This function can be used to
|
2004-03-28 21:52:02 +00:00
|
|
|
find a device of a specific type. */
|
2009-04-24 12:05:54 +00:00
|
|
|
int
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_devalias_iterate (int (*hook) (struct grub_ieee1275_devalias *alias))
|
2004-03-28 21:52:02 +00:00
|
|
|
{
|
2005-10-01 Hollis Blanchard <hollis@penguinppc.org>
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Cast `size' to long.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_next_property):
Remove `flags' argument. All callers changed.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_ROOT): Removed.
(IEEE1275_IHANDLE_INVALID): New variable.
(IEEE1275_CELL_INVALID): New variable.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_get_property_length, grub_ieee1275_instance_to_package,
grub_ieee1275_package_to_path, grub_ieee1275_instance_to_path,
grub_ieee1275_peer, grub_ieee1275_child, grub_ieee1275_open,
grub_ieee1275_claim, grub_ieee1275_set_property): Error-check return
codes from Open Firmware. All callers updated.
(grub_ieee1275_next_property): Directly return Open Firmware return
code.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options):
Standardize error checking from `grub_ieee1275_get_property'.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Rename
`devalias' to `aliases'. Correct comments. Consolidate error paths.
2006-10-01 08:30:09 +00:00
|
|
|
grub_ieee1275_phandle_t aliases;
|
2009-04-22 09:46:54 +00:00
|
|
|
char *aliasname, *devtype;
|
2009-04-11 03:09:17 +00:00
|
|
|
grub_ssize_t actual;
|
2004-04-04 13:46:03 +00:00
|
|
|
struct grub_ieee1275_devalias alias;
|
2009-04-24 12:05:54 +00:00
|
|
|
int ret = 0;
|
2004-03-28 21:52:02 +00:00
|
|
|
|
2005-10-01 Hollis Blanchard <hollis@penguinppc.org>
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Cast `size' to long.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_next_property):
Remove `flags' argument. All callers changed.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_ROOT): Removed.
(IEEE1275_IHANDLE_INVALID): New variable.
(IEEE1275_CELL_INVALID): New variable.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_get_property_length, grub_ieee1275_instance_to_package,
grub_ieee1275_package_to_path, grub_ieee1275_instance_to_path,
grub_ieee1275_peer, grub_ieee1275_child, grub_ieee1275_open,
grub_ieee1275_claim, grub_ieee1275_set_property): Error-check return
codes from Open Firmware. All callers updated.
(grub_ieee1275_next_property): Directly return Open Firmware return
code.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options):
Standardize error checking from `grub_ieee1275_get_property'.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Rename
`devalias' to `aliases'. Correct comments. Consolidate error paths.
2006-10-01 08:30:09 +00:00
|
|
|
if (grub_ieee1275_finddevice ("/aliases", &aliases))
|
2009-04-24 12:05:54 +00:00
|
|
|
return 0;
|
2004-03-28 21:52:02 +00:00
|
|
|
|
2009-04-22 09:46:54 +00:00
|
|
|
aliasname = grub_malloc (IEEE1275_MAX_PROP_LEN);
|
|
|
|
if (!aliasname)
|
2009-04-24 12:05:54 +00:00
|
|
|
return 0;
|
2009-04-22 09:46:54 +00:00
|
|
|
devtype = grub_malloc (IEEE1275_MAX_PROP_LEN);
|
|
|
|
if (!devtype)
|
|
|
|
{
|
|
|
|
grub_free (aliasname);
|
2009-04-24 12:05:54 +00:00
|
|
|
return 0;
|
2009-04-22 09:46:54 +00:00
|
|
|
}
|
|
|
|
|
2005-10-01 Hollis Blanchard <hollis@penguinppc.org>
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Cast `size' to long.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_next_property):
Remove `flags' argument. All callers changed.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_ROOT): Removed.
(IEEE1275_IHANDLE_INVALID): New variable.
(IEEE1275_CELL_INVALID): New variable.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_get_property_length, grub_ieee1275_instance_to_package,
grub_ieee1275_package_to_path, grub_ieee1275_instance_to_path,
grub_ieee1275_peer, grub_ieee1275_child, grub_ieee1275_open,
grub_ieee1275_claim, grub_ieee1275_set_property): Error-check return
codes from Open Firmware. All callers updated.
(grub_ieee1275_next_property): Directly return Open Firmware return
code.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options):
Standardize error checking from `grub_ieee1275_get_property'.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Rename
`devalias' to `aliases'. Correct comments. Consolidate error paths.
2006-10-01 08:30:09 +00:00
|
|
|
/* Find the first property. */
|
2004-03-28 21:52:02 +00:00
|
|
|
aliasname[0] = '\0';
|
|
|
|
|
2010-02-05 23:30:25 +00:00
|
|
|
while (grub_ieee1275_next_property (aliases, aliasname, aliasname) > 0)
|
2004-03-28 21:52:02 +00:00
|
|
|
{
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_ieee1275_phandle_t dev;
|
2006-09-26 03:49:41 +00:00
|
|
|
grub_ssize_t pathlen;
|
2004-03-28 21:52:02 +00:00
|
|
|
char *devpath;
|
2005-10-01 Hollis Blanchard <hollis@penguinppc.org>
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Cast `size' to long.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_next_property):
Remove `flags' argument. All callers changed.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_ROOT): Removed.
(IEEE1275_IHANDLE_INVALID): New variable.
(IEEE1275_CELL_INVALID): New variable.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_get_property_length, grub_ieee1275_instance_to_package,
grub_ieee1275_package_to_path, grub_ieee1275_instance_to_path,
grub_ieee1275_peer, grub_ieee1275_child, grub_ieee1275_open,
grub_ieee1275_claim, grub_ieee1275_set_property): Error-check return
codes from Open Firmware. All callers updated.
(grub_ieee1275_next_property): Directly return Open Firmware return
code.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options):
Standardize error checking from `grub_ieee1275_get_property'.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Rename
`devalias' to `aliases'. Correct comments. Consolidate error paths.
2006-10-01 08:30:09 +00:00
|
|
|
|
2008-01-20 17:20:48 +00:00
|
|
|
grub_dprintf ("devalias", "devalias name = %s\n", aliasname);
|
|
|
|
|
2005-10-01 Hollis Blanchard <hollis@penguinppc.org>
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Cast `size' to long.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_next_property):
Remove `flags' argument. All callers changed.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_ROOT): Removed.
(IEEE1275_IHANDLE_INVALID): New variable.
(IEEE1275_CELL_INVALID): New variable.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_get_property_length, grub_ieee1275_instance_to_package,
grub_ieee1275_package_to_path, grub_ieee1275_instance_to_path,
grub_ieee1275_peer, grub_ieee1275_child, grub_ieee1275_open,
grub_ieee1275_claim, grub_ieee1275_set_property): Error-check return
codes from Open Firmware. All callers updated.
(grub_ieee1275_next_property): Directly return Open Firmware return
code.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options):
Standardize error checking from `grub_ieee1275_get_property'.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Rename
`devalias' to `aliases'. Correct comments. Consolidate error paths.
2006-10-01 08:30:09 +00:00
|
|
|
grub_ieee1275_get_property_length (aliases, aliasname, &pathlen);
|
2004-11-16 21:59:11 +00:00
|
|
|
|
|
|
|
/* The property `name' is a special case we should skip. */
|
|
|
|
if (!grub_strcmp (aliasname, "name"))
|
2005-10-01 Hollis Blanchard <hollis@penguinppc.org>
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Cast `size' to long.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_next_property):
Remove `flags' argument. All callers changed.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_ROOT): Removed.
(IEEE1275_IHANDLE_INVALID): New variable.
(IEEE1275_CELL_INVALID): New variable.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_get_property_length, grub_ieee1275_instance_to_package,
grub_ieee1275_package_to_path, grub_ieee1275_instance_to_path,
grub_ieee1275_peer, grub_ieee1275_child, grub_ieee1275_open,
grub_ieee1275_claim, grub_ieee1275_set_property): Error-check return
codes from Open Firmware. All callers updated.
(grub_ieee1275_next_property): Directly return Open Firmware return
code.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options):
Standardize error checking from `grub_ieee1275_get_property'.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Rename
`devalias' to `aliases'. Correct comments. Consolidate error paths.
2006-10-01 08:30:09 +00:00
|
|
|
continue;
|
|
|
|
|
2009-04-22 09:46:54 +00:00
|
|
|
/* Sun's OpenBoot often doesn't zero terminate the device alias
|
|
|
|
strings, so we will add a NULL byte at the end explicitly. */
|
|
|
|
pathlen += 1;
|
|
|
|
|
2004-04-04 13:46:03 +00:00
|
|
|
devpath = grub_malloc (pathlen);
|
2004-03-28 21:52:02 +00:00
|
|
|
if (! devpath)
|
2009-04-22 09:46:54 +00:00
|
|
|
{
|
|
|
|
grub_free (devtype);
|
|
|
|
grub_free (aliasname);
|
2009-04-24 12:05:54 +00:00
|
|
|
return 0;
|
2009-04-22 09:46:54 +00:00
|
|
|
}
|
2004-03-28 21:52:02 +00:00
|
|
|
|
2005-10-01 Hollis Blanchard <hollis@penguinppc.org>
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Cast `size' to long.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_next_property):
Remove `flags' argument. All callers changed.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_ROOT): Removed.
(IEEE1275_IHANDLE_INVALID): New variable.
(IEEE1275_CELL_INVALID): New variable.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_get_property_length, grub_ieee1275_instance_to_package,
grub_ieee1275_package_to_path, grub_ieee1275_instance_to_path,
grub_ieee1275_peer, grub_ieee1275_child, grub_ieee1275_open,
grub_ieee1275_claim, grub_ieee1275_set_property): Error-check return
codes from Open Firmware. All callers updated.
(grub_ieee1275_next_property): Directly return Open Firmware return
code.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options):
Standardize error checking from `grub_ieee1275_get_property'.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Rename
`devalias' to `aliases'. Correct comments. Consolidate error paths.
2006-10-01 08:30:09 +00:00
|
|
|
if (grub_ieee1275_get_property (aliases, aliasname, devpath, pathlen,
|
2004-03-28 21:52:02 +00:00
|
|
|
&actual))
|
2008-01-20 17:20:48 +00:00
|
|
|
{
|
|
|
|
grub_dprintf ("devalias", "get_property (%s) failed\n", aliasname);
|
|
|
|
goto nextprop;
|
|
|
|
}
|
2009-04-22 09:46:54 +00:00
|
|
|
devpath [actual] = '\0';
|
2005-10-01 Hollis Blanchard <hollis@penguinppc.org>
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Cast `size' to long.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_next_property):
Remove `flags' argument. All callers changed.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_ROOT): Removed.
(IEEE1275_IHANDLE_INVALID): New variable.
(IEEE1275_CELL_INVALID): New variable.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_get_property_length, grub_ieee1275_instance_to_package,
grub_ieee1275_package_to_path, grub_ieee1275_instance_to_path,
grub_ieee1275_peer, grub_ieee1275_child, grub_ieee1275_open,
grub_ieee1275_claim, grub_ieee1275_set_property): Error-check return
codes from Open Firmware. All callers updated.
(grub_ieee1275_next_property): Directly return Open Firmware return
code.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options):
Standardize error checking from `grub_ieee1275_get_property'.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Rename
`devalias' to `aliases'. Correct comments. Consolidate error paths.
2006-10-01 08:30:09 +00:00
|
|
|
|
|
|
|
if (grub_ieee1275_finddevice (devpath, &dev))
|
2008-01-20 17:20:48 +00:00
|
|
|
{
|
|
|
|
grub_dprintf ("devalias", "finddevice (%s) failed\n", devpath);
|
|
|
|
goto nextprop;
|
|
|
|
}
|
2005-10-01 Hollis Blanchard <hollis@penguinppc.org>
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Cast `size' to long.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_next_property):
Remove `flags' argument. All callers changed.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_ROOT): Removed.
(IEEE1275_IHANDLE_INVALID): New variable.
(IEEE1275_CELL_INVALID): New variable.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_get_property_length, grub_ieee1275_instance_to_package,
grub_ieee1275_package_to_path, grub_ieee1275_instance_to_path,
grub_ieee1275_peer, grub_ieee1275_child, grub_ieee1275_open,
grub_ieee1275_claim, grub_ieee1275_set_property): Error-check return
codes from Open Firmware. All callers updated.
(grub_ieee1275_next_property): Directly return Open Firmware return
code.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options):
Standardize error checking from `grub_ieee1275_get_property'.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Rename
`devalias' to `aliases'. Correct comments. Consolidate error paths.
2006-10-01 08:30:09 +00:00
|
|
|
|
|
|
|
if (grub_ieee1275_get_property (dev, "device_type", devtype,
|
2009-07-10 20:19:08 +00:00
|
|
|
IEEE1275_MAX_PROP_LEN, &actual))
|
2008-01-20 17:20:48 +00:00
|
|
|
{
|
2008-04-25 19:41:51 +00:00
|
|
|
/* NAND device don't have device_type property. */
|
|
|
|
devtype[0] = 0;
|
2008-01-20 17:20:48 +00:00
|
|
|
}
|
2004-03-28 21:52:02 +00:00
|
|
|
|
|
|
|
alias.name = aliasname;
|
2005-10-01 Hollis Blanchard <hollis@penguinppc.org>
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Cast `size' to long.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_next_property):
Remove `flags' argument. All callers changed.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_ROOT): Removed.
(IEEE1275_IHANDLE_INVALID): New variable.
(IEEE1275_CELL_INVALID): New variable.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_get_property_length, grub_ieee1275_instance_to_package,
grub_ieee1275_package_to_path, grub_ieee1275_instance_to_path,
grub_ieee1275_peer, grub_ieee1275_child, grub_ieee1275_open,
grub_ieee1275_claim, grub_ieee1275_set_property): Error-check return
codes from Open Firmware. All callers updated.
(grub_ieee1275_next_property): Directly return Open Firmware return
code.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options):
Standardize error checking from `grub_ieee1275_get_property'.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Rename
`devalias' to `aliases'. Correct comments. Consolidate error paths.
2006-10-01 08:30:09 +00:00
|
|
|
alias.path = devpath;
|
2004-03-28 21:52:02 +00:00
|
|
|
alias.type = devtype;
|
2009-04-24 12:05:54 +00:00
|
|
|
ret = hook (&alias);
|
2005-10-01 Hollis Blanchard <hollis@penguinppc.org>
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Cast `size' to long.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_next_property):
Remove `flags' argument. All callers changed.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_ROOT): Removed.
(IEEE1275_IHANDLE_INVALID): New variable.
(IEEE1275_CELL_INVALID): New variable.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_get_property_length, grub_ieee1275_instance_to_package,
grub_ieee1275_package_to_path, grub_ieee1275_instance_to_path,
grub_ieee1275_peer, grub_ieee1275_child, grub_ieee1275_open,
grub_ieee1275_claim, grub_ieee1275_set_property): Error-check return
codes from Open Firmware. All callers updated.
(grub_ieee1275_next_property): Directly return Open Firmware return
code.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options):
Standardize error checking from `grub_ieee1275_get_property'.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Rename
`devalias' to `aliases'. Correct comments. Consolidate error paths.
2006-10-01 08:30:09 +00:00
|
|
|
|
|
|
|
nextprop:
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_free (devpath);
|
2009-04-24 12:05:54 +00:00
|
|
|
if (ret)
|
|
|
|
break;
|
2004-03-28 21:52:02 +00:00
|
|
|
}
|
|
|
|
|
2009-04-22 09:46:54 +00:00
|
|
|
grub_free (devtype);
|
|
|
|
grub_free (aliasname);
|
2009-04-24 12:05:54 +00:00
|
|
|
return ret;
|
2004-03-28 21:52:02 +00:00
|
|
|
}
|
2004-10-29 02:45:14 +00:00
|
|
|
|
|
|
|
/* Call the "map" method of /chosen/mmu. */
|
2010-02-13 15:48:22 +00:00
|
|
|
int
|
|
|
|
grub_ieee1275_map (grub_addr_t phys, grub_addr_t virt, grub_size_t size,
|
|
|
|
grub_uint32_t mode)
|
2004-10-29 02:45:14 +00:00
|
|
|
{
|
|
|
|
struct map_args {
|
|
|
|
struct grub_ieee1275_common_hdr common;
|
* disk/ieee1275/nand.c (grub_nand_open): All ieee1275 call arg
slots are of type grub_ieee1275_cell_t.
(grub_nand_read): Likewise.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_INVALID,
IEEE1275_IHANDLE_INVALID): Use grub_ieee1275_cell_t since these
macros are used to compare values in arg/ret block of the call.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_next_property, grub_ieee1275_get_property_length,
grub_ieee1275_instance_to_package, grub_ieee1275_package_to_path,
grub_ieee1275_instance_to_path, grub_ieee1275_write,
grub_ieee1275_read, grub_ieee1275_seek, grub_ieee1275_peer,
grub_ieee1275_child, grub_ieee1275_parent, grub_ieee1275_open,
grub_ieee1275_close, grub_ieee1275_set_property,
grub_ieee1275_set_color): All ieee1275 call arg slots are of type
grub_ieee1275_cell_t.
* kern/ieee1275/openfw.c (grub_map): Likewise.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_ihandle_t,
grub_ieee1275_phandle_t): Define as grub_unit32_t type.
2009-04-11 03:07:58 +00:00
|
|
|
grub_ieee1275_cell_t method;
|
|
|
|
grub_ieee1275_cell_t ihandle;
|
|
|
|
grub_ieee1275_cell_t mode;
|
|
|
|
grub_ieee1275_cell_t size;
|
|
|
|
grub_ieee1275_cell_t virt;
|
2010-02-13 15:48:22 +00:00
|
|
|
#ifdef GRUB_MACHINE_SPARC64
|
|
|
|
grub_ieee1275_cell_t phys_high;
|
|
|
|
#endif
|
|
|
|
grub_ieee1275_cell_t phys_low;
|
* disk/ieee1275/nand.c (grub_nand_open): All ieee1275 call arg
slots are of type grub_ieee1275_cell_t.
(grub_nand_read): Likewise.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_INVALID,
IEEE1275_IHANDLE_INVALID): Use grub_ieee1275_cell_t since these
macros are used to compare values in arg/ret block of the call.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_next_property, grub_ieee1275_get_property_length,
grub_ieee1275_instance_to_package, grub_ieee1275_package_to_path,
grub_ieee1275_instance_to_path, grub_ieee1275_write,
grub_ieee1275_read, grub_ieee1275_seek, grub_ieee1275_peer,
grub_ieee1275_child, grub_ieee1275_parent, grub_ieee1275_open,
grub_ieee1275_close, grub_ieee1275_set_property,
grub_ieee1275_set_color): All ieee1275 call arg slots are of type
grub_ieee1275_cell_t.
* kern/ieee1275/openfw.c (grub_map): Likewise.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_ihandle_t,
grub_ieee1275_phandle_t): Define as grub_unit32_t type.
2009-04-11 03:07:58 +00:00
|
|
|
grub_ieee1275_cell_t catch_result;
|
2004-10-29 02:45:14 +00:00
|
|
|
} args;
|
|
|
|
|
2010-02-13 15:48:22 +00:00
|
|
|
INIT_IEEE1275_COMMON (&args.common, "call-method",
|
|
|
|
#ifdef GRUB_MACHINE_SPARC64
|
|
|
|
7,
|
|
|
|
#else
|
|
|
|
6,
|
|
|
|
#endif
|
|
|
|
1);
|
* disk/ieee1275/nand.c (grub_nand_open): All ieee1275 call arg
slots are of type grub_ieee1275_cell_t.
(grub_nand_read): Likewise.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_INVALID,
IEEE1275_IHANDLE_INVALID): Use grub_ieee1275_cell_t since these
macros are used to compare values in arg/ret block of the call.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_next_property, grub_ieee1275_get_property_length,
grub_ieee1275_instance_to_package, grub_ieee1275_package_to_path,
grub_ieee1275_instance_to_path, grub_ieee1275_write,
grub_ieee1275_read, grub_ieee1275_seek, grub_ieee1275_peer,
grub_ieee1275_child, grub_ieee1275_parent, grub_ieee1275_open,
grub_ieee1275_close, grub_ieee1275_set_property,
grub_ieee1275_set_color): All ieee1275 call arg slots are of type
grub_ieee1275_cell_t.
* kern/ieee1275/openfw.c (grub_map): Likewise.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_ihandle_t,
grub_ieee1275_phandle_t): Define as grub_unit32_t type.
2009-04-11 03:07:58 +00:00
|
|
|
args.method = (grub_ieee1275_cell_t) "map";
|
2008-01-20 14:08:54 +00:00
|
|
|
args.ihandle = grub_ieee1275_mmu;
|
2010-02-13 15:48:22 +00:00
|
|
|
#ifdef GRUB_MACHINE_SPARC64
|
|
|
|
args.phys_high = 0;
|
|
|
|
#endif
|
|
|
|
args.phys_low = phys;
|
2004-10-29 02:45:14 +00:00
|
|
|
args.virt = virt;
|
|
|
|
args.size = size;
|
|
|
|
args.mode = mode; /* Format is WIMG0PP. */
|
2010-02-13 15:48:22 +00:00
|
|
|
args.catch_result = (grub_ieee1275_cell_t) -1;
|
2004-10-29 02:45:14 +00:00
|
|
|
|
|
|
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return args.catch_result;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
grub_claimmap (grub_addr_t addr, grub_size_t size)
|
|
|
|
{
|
|
|
|
if (grub_ieee1275_claim (addr, size, 0, 0))
|
|
|
|
return -1;
|
2005-01-03 17:44:25 +00:00
|
|
|
|
2005-05-01 03:45:36 +00:00
|
|
|
if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_REAL_MODE)
|
2010-02-13 15:48:22 +00:00
|
|
|
&& grub_ieee1275_map (addr, addr, size, 0x00))
|
2004-10-29 02:45:14 +00:00
|
|
|
{
|
2009-04-30 01:18:43 +00:00
|
|
|
grub_printf ("map failed: address 0x%llx, size 0x%llx\n",
|
|
|
|
(long long) addr, (long long) size);
|
2004-10-29 02:45:14 +00:00
|
|
|
grub_ieee1275_release (addr, size);
|
|
|
|
return -1;
|
|
|
|
}
|
2005-01-03 17:44:25 +00:00
|
|
|
|
2004-10-29 02:45:14 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2005-03-26 17:34:50 +00:00
|
|
|
|
2005-04-22 02:32:37 +00:00
|
|
|
/* Get the device arguments of the Open Firmware node name `path'. */
|
|
|
|
static char *
|
|
|
|
grub_ieee1275_get_devargs (const char *path)
|
|
|
|
{
|
|
|
|
char *colon = grub_strchr (path, ':');
|
|
|
|
|
|
|
|
if (! colon)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return grub_strdup (colon + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the device path of the Open Firmware node name `path'. */
|
|
|
|
static char *
|
|
|
|
grub_ieee1275_get_devname (const char *path)
|
|
|
|
{
|
|
|
|
char *colon = grub_strchr (path, ':');
|
|
|
|
char *newpath = 0;
|
|
|
|
int pathlen = grub_strlen (path);
|
|
|
|
auto int match_alias (struct grub_ieee1275_devalias *alias);
|
|
|
|
|
|
|
|
int match_alias (struct grub_ieee1275_devalias *curalias)
|
|
|
|
{
|
|
|
|
/* briQ firmware can change capitalization in /chosen/bootpath. */
|
|
|
|
if (! grub_strncasecmp (curalias->path, path, pathlen))
|
|
|
|
{
|
2005-11-04 03:18:12 +00:00
|
|
|
newpath = grub_strdup (curalias->name);
|
2005-04-22 02:32:37 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (colon)
|
|
|
|
pathlen = (int)(colon - path);
|
|
|
|
|
|
|
|
/* Try to find an alias for this device. */
|
|
|
|
grub_devalias_iterate (match_alias);
|
|
|
|
|
|
|
|
if (! newpath)
|
2005-11-04 03:18:12 +00:00
|
|
|
newpath = grub_strndup (path, pathlen);
|
2005-04-22 02:32:37 +00:00
|
|
|
|
|
|
|
return newpath;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
grub_ieee1275_parse_args (const char *path, enum grub_ieee1275_parse_type ptype)
|
|
|
|
{
|
|
|
|
char type[64]; /* XXX check size. */
|
|
|
|
char *device = grub_ieee1275_get_devname (path);
|
|
|
|
char *args = grub_ieee1275_get_devargs (path);
|
|
|
|
char *ret = 0;
|
|
|
|
grub_ieee1275_phandle_t dev;
|
|
|
|
|
|
|
|
if (!args)
|
|
|
|
/* Shouldn't happen. */
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* We need to know what type of device it is in order to parse the full
|
|
|
|
file path properly. */
|
|
|
|
if (grub_ieee1275_finddevice (device, &dev))
|
|
|
|
{
|
2009-12-24 22:53:05 +00:00
|
|
|
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "device %s not found", device);
|
2005-04-22 02:32:37 +00:00
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
if (grub_ieee1275_get_property (dev, "device_type", &type, sizeof type, 0))
|
|
|
|
{
|
|
|
|
grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
2009-12-24 22:53:05 +00:00
|
|
|
"device %s lacks a device_type property", device);
|
2005-04-22 02:32:37 +00:00
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!grub_strcmp ("block", type))
|
|
|
|
{
|
|
|
|
/* The syntax of the device arguments is defined in the CHRP and PReP
|
|
|
|
IEEE1275 bindings: "[partition][,[filename]]". */
|
|
|
|
char *comma = grub_strchr (args, ',');
|
|
|
|
|
|
|
|
if (ptype == GRUB_PARSE_FILENAME)
|
|
|
|
{
|
|
|
|
if (comma)
|
|
|
|
{
|
|
|
|
char *filepath = comma + 1;
|
|
|
|
|
|
|
|
/* Make sure filepath has leading backslash. */
|
|
|
|
if (filepath[0] != '\\')
|
2010-01-20 08:12:47 +00:00
|
|
|
ret = grub_xasprintf ("\\%s", filepath);
|
2005-04-22 02:32:37 +00:00
|
|
|
else
|
2009-12-29 09:04:06 +00:00
|
|
|
ret = grub_strdup (filepath);
|
2005-04-22 02:32:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ptype == GRUB_PARSE_PARTITION)
|
|
|
|
{
|
|
|
|
if (!comma)
|
|
|
|
ret = grub_strdup (args);
|
|
|
|
else
|
|
|
|
ret = grub_strndup (args, (grub_size_t)(comma - args));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* XXX Handle net devices by configuring & registering a grub_net_dev
|
|
|
|
here, then return its name?
|
|
|
|
Example path: "net:<server ip>,<file name>,<client ip>,<gateway
|
|
|
|
ip>,<bootp retries>,<tftp retries>". */
|
|
|
|
grub_printf ("Unsupported type %s for device %s\n", type, device);
|
|
|
|
}
|
|
|
|
|
|
|
|
fail:
|
|
|
|
grub_free (device);
|
|
|
|
grub_free (args);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *
|
|
|
|
grub_ieee1275_get_filename (const char *path)
|
|
|
|
{
|
|
|
|
return grub_ieee1275_parse_args (path, GRUB_PARSE_FILENAME);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert a device name from IEEE1275 syntax to GRUB syntax. */
|
|
|
|
char *
|
|
|
|
grub_ieee1275_encode_devname (const char *path)
|
|
|
|
{
|
|
|
|
char *device = grub_ieee1275_get_devname (path);
|
|
|
|
char *partition = grub_ieee1275_parse_args (path, GRUB_PARSE_PARTITION);
|
|
|
|
char *encoding;
|
|
|
|
|
2010-02-05 23:32:07 +00:00
|
|
|
if (partition && partition[0])
|
2005-04-22 02:32:37 +00:00
|
|
|
{
|
|
|
|
unsigned int partno = grub_strtoul (partition, 0, 0);
|
2005-05-01 03:45:36 +00:00
|
|
|
|
2006-10-26 23:11:22 +00:00
|
|
|
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS))
|
|
|
|
/* GRUB partition 1 is OF partition 0. */
|
2007-07-22 09:05:11 +00:00
|
|
|
partno++;
|
2005-04-22 02:32:37 +00:00
|
|
|
|
2010-01-20 08:12:47 +00:00
|
|
|
encoding = grub_xasprintf ("(%s,%d)", device, partno);
|
2005-04-22 02:32:37 +00:00
|
|
|
}
|
|
|
|
else
|
2010-01-20 08:12:47 +00:00
|
|
|
encoding = grub_xasprintf ("(%s)", device);
|
2005-04-22 02:32:37 +00:00
|
|
|
|
|
|
|
grub_free (partition);
|
|
|
|
grub_free (device);
|
|
|
|
|
|
|
|
return encoding;
|
|
|
|
}
|
|
|
|
|
2009-12-05 01:43:17 +00:00
|
|
|
/* On i386, a firmware-independant grub_reboot() is provided by realmode.S. */
|
|
|
|
#ifndef __i386__
|
2005-03-26 17:34:50 +00:00
|
|
|
void
|
|
|
|
grub_reboot (void)
|
|
|
|
{
|
|
|
|
grub_ieee1275_interpret ("reset-all", 0);
|
2010-07-02 12:47:14 +00:00
|
|
|
for (;;) ;
|
2005-03-26 17:34:50 +00:00
|
|
|
}
|
2009-12-05 01:43:17 +00:00
|
|
|
#endif
|
2010-09-13 17:17:29 +00:00
|
|
|
|
|
|
|
/* Resolve aliases. */
|
|
|
|
char *
|
|
|
|
grub_ieee1275_canonicalise_devname (const char *path)
|
|
|
|
{
|
|
|
|
struct canon_args
|
|
|
|
{
|
|
|
|
struct grub_ieee1275_common_hdr common;
|
|
|
|
grub_ieee1275_cell_t path;
|
|
|
|
grub_ieee1275_cell_t buf;
|
|
|
|
grub_ieee1275_cell_t inlen;
|
|
|
|
grub_ieee1275_cell_t outlen;
|
|
|
|
}
|
|
|
|
args;
|
|
|
|
char *buf = NULL;
|
|
|
|
grub_size_t bufsize = 64;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
{
|
|
|
|
grub_free (buf);
|
|
|
|
|
|
|
|
buf = grub_malloc (bufsize);
|
|
|
|
if (!buf)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
INIT_IEEE1275_COMMON (&args.common, "canon", 3, 1);
|
|
|
|
args.path = (grub_ieee1275_cell_t) path;
|
|
|
|
args.buf = (grub_ieee1275_cell_t) buf;
|
|
|
|
args.inlen = (grub_ieee1275_cell_t) (bufsize - 1);
|
|
|
|
|
|
|
|
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
|
|
|
return 0;
|
|
|
|
if (args.outlen > bufsize - 1)
|
|
|
|
{
|
|
|
|
bufsize = args.outlen + 2;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
/* Shouldn't reach here. */
|
|
|
|
grub_free (buf);
|
|
|
|
return NULL;
|
|
|
|
}
|