~ubuntu-branches/ubuntu/lucid/grub2/lucid

« back to all changes in this revision

Viewing changes to kern/ieee1275/ieee1275.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Millan
  • Date: 2008-01-28 00:01:11 UTC
  • mto: (17.4.1 lenny) (1.10.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20080128000111-0764agvqzg601o1d
Tags: upstream-1.95+20080128
ImportĀ upstreamĀ versionĀ 1.95+20080128

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* of.c - Access the Open Firmware client interface.  */
2
2
/*
3
3
 *  GRUB  --  GRand Unified Bootloader
4
 
 *  Copyright (C) 2003,2004,2005,2007  Free Software Foundation, Inc.
 
4
 *  Copyright (C) 2003,2004,2005,2007,2008  Free Software Foundation, Inc.
5
5
 *
6
6
 *  GRUB is free software: you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
18
18
 */
19
19
 
20
20
#include <grub/ieee1275/ieee1275.h>
 
21
#include <grub/types.h>
21
22
 
22
23
#define IEEE1275_PHANDLE_INVALID  ((grub_ieee1275_phandle_t) -1)
23
24
#define IEEE1275_IHANDLE_INVALID  ((grub_ieee1275_ihandle_t) 0)
25
26
 
26
27
 
27
28
 
28
 
/* FIXME is this function needed? */
29
 
grub_uint32_t
30
 
grub_ieee1275_decode_int_4 (unsigned char *p)
31
 
{
32
 
  grub_uint32_t val = (*p++ << 8);
33
 
  val = (val + *p++) << 8;
34
 
  val = (val + *p++) << 8;
35
 
  return (val + *p);
36
 
}
37
 
 
38
29
int
39
30
grub_ieee1275_finddevice (char *name, grub_ieee1275_phandle_t *phandlep)
40
31
{
89
80
}
90
81
 
91
82
int
 
83
grub_ieee1275_get_integer_property (grub_ieee1275_phandle_t phandle,
 
84
                                    const char *property, grub_uint32_t *buf,
 
85
                                    grub_size_t size, grub_ssize_t *actual)
 
86
{
 
87
  int ret;
 
88
  ret = grub_ieee1275_get_property (phandle, property, (void *) buf, size, actual);
 
89
#ifndef GRUB_CPU_WORDS_BIGENDIAN
 
90
  /* Integer properties are always in big endian.  */
 
91
  if (ret == 0)
 
92
    {
 
93
      int i;
 
94
      size /= sizeof (grub_uint32_t);
 
95
      for (i = 0; i < size; i++)
 
96
        buf[i] = grub_be_to_cpu32 (buf[i]);
 
97
    }
 
98
#endif
 
99
  return ret;
 
100
}
 
101
 
 
102
int
92
103
grub_ieee1275_next_property (grub_ieee1275_phandle_t phandle, char *prev_prop,
93
104
                             char *prop)
94
105
{