~darkmuggle-deactivatedaccount/ubuntu/quantal/grub2/fix-872244

« back to all changes in this revision

Viewing changes to include/grub/ieee1275/ieee1275.h

  • Committer: Bazaar Package Importer
  • Author(s): Otavio Salvador
  • Date: 2006-01-05 15:20:40 UTC
  • mto: (17.3.1 squeeze) (1.9.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20060105152040-b72i5pq1a82z22yi
Tags: upstream-1.92
ImportĀ upstreamĀ versionĀ 1.92

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ieee1275.h - Access the Open Firmware client interface.  */
 
2
/*
 
3
 *  GRUB  --  GRand Unified Bootloader
 
4
 *  Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; either version 2 of the License, or
 
9
 *  (at your option) any later version.
 
10
 *
 
11
 *  This program is distributed in the hope that it will be useful,
 
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *  GNU General Public License for more details.
 
15
 *
 
16
 *  You should have received a copy of the GNU General Public License
 
17
 *  along with this program; if not, write to the Free Software
 
18
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
19
 */
 
20
 
 
21
#ifndef GRUB_IEEE1275_HEADER
 
22
#define GRUB_IEEE1275_HEADER    1
 
23
 
 
24
#include <stdint.h>
 
25
#include <grub/err.h>
 
26
#include <grub/types.h>
 
27
#include <grub/machine/ieee1275.h>
 
28
 
 
29
/* Maps a device alias to a pathname.  */
 
30
struct grub_ieee1275_devalias
 
31
{
 
32
  char *name;
 
33
  char *path;
 
34
  char *type;
 
35
};
 
36
 
 
37
struct grub_ieee1275_mem_region 
 
38
{
 
39
  unsigned int start;
 
40
  unsigned int size;
 
41
};
 
42
 
 
43
#ifndef IEEE1275_CALL_ENTRY_FN
 
44
#define IEEE1275_CALL_ENTRY_FN(args) (*grub_ieee1275_entry_fn) (args)
 
45
#endif
 
46
 
 
47
/* All backcalls to the firmware is done by calling an entry function 
 
48
   which was passed to us from the bootloader.  When doing the backcall, 
 
49
   a structure is passed which specifies what the firmware should do.  
 
50
   NAME is the requested service.  NR_INS and NR_OUTS is the number of
 
51
   passed arguments and the expected number of return values, resp. */
 
52
struct grub_ieee1275_common_hdr
 
53
{
 
54
  grub_ieee1275_cell_t name;
 
55
  grub_ieee1275_cell_t nr_ins;
 
56
  grub_ieee1275_cell_t nr_outs;
 
57
};
 
58
 
 
59
#define INIT_IEEE1275_COMMON(p, xname, xins, xouts) \
 
60
  (p)->name = (grub_ieee1275_cell_t) xname; \
 
61
  (p)->nr_ins = (grub_ieee1275_cell_t) xins; \
 
62
  (p)->nr_outs = (grub_ieee1275_cell_t) xouts
 
63
 
 
64
typedef grub_ieee1275_cell_t grub_ieee1275_ihandle_t;
 
65
typedef grub_ieee1275_cell_t grub_ieee1275_phandle_t;
 
66
 
 
67
extern grub_ieee1275_phandle_t EXPORT_VAR(grub_ieee1275_chosen);
 
68
extern int (* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *);
 
69
 
 
70
enum grub_ieee1275_flag
 
71
{
 
72
  /* Old World Macintosh firmware fails seek when "dev:0" is opened.  */
 
73
  GRUB_IEEE1275_FLAG_NO_PARTITION_0,
 
74
 
 
75
  /* Apple firmware runs in translated mode and requires use of the "map"
 
76
     method.  Other firmware runs in untranslated mode and doesn't like "map"
 
77
     calls.  */
 
78
  GRUB_IEEE1275_FLAG_REAL_MODE,
 
79
 
 
80
  /* CHRP specifies partitions are numbered from 1 (partition 0 refers to the
 
81
     whole disk). However, CodeGen firmware numbers partitions from 0.  */
 
82
  GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS,
 
83
};
 
84
 
 
85
extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);
 
86
extern void EXPORT_FUNC(grub_ieee1275_set_flag) (enum grub_ieee1275_flag flag);
 
87
 
 
88
 
 
89
 
 
90
 
 
91
grub_uint32_t EXPORT_FUNC(grub_ieee1275_decode_int_4) (unsigned char *p);
 
92
int EXPORT_FUNC(grub_ieee1275_finddevice) (char *name,
 
93
                                           grub_ieee1275_phandle_t *phandlep);
 
94
int EXPORT_FUNC(grub_ieee1275_get_property) (grub_ieee1275_phandle_t phandle,
 
95
                                             const char *property, void *buf,
 
96
                                             grub_size_t size,
 
97
                                             grub_ssize_t *actual);
 
98
int EXPORT_FUNC(grub_ieee1275_next_property) (grub_ieee1275_phandle_t phandle,
 
99
                                              char *prev_prop, char *prop,
 
100
                                              grub_ieee1275_cell_t *flags);
 
101
int EXPORT_FUNC(grub_ieee1275_get_property_length) 
 
102
     (grub_ieee1275_phandle_t phandle, const char *prop, grub_ssize_t *length);
 
103
int EXPORT_FUNC(grub_ieee1275_instance_to_package) 
 
104
     (grub_ieee1275_ihandle_t ihandle, grub_ieee1275_phandle_t *phandlep);
 
105
int EXPORT_FUNC(grub_ieee1275_package_to_path) (grub_ieee1275_phandle_t phandle,
 
106
                                                char *path, grub_size_t len,
 
107
                                                grub_ssize_t *actual);
 
108
int EXPORT_FUNC(grub_ieee1275_instance_to_path) 
 
109
     (grub_ieee1275_ihandle_t ihandle, char *path, grub_size_t len,
 
110
      grub_ssize_t *actual);
 
111
int EXPORT_FUNC(grub_ieee1275_write) (grub_ieee1275_ihandle_t ihandle,
 
112
                                      void *buffer, grub_size_t len,
 
113
                                      grub_ssize_t *actualp);
 
114
int EXPORT_FUNC(grub_ieee1275_read) (grub_ieee1275_ihandle_t ihandle,
 
115
                                     void *buffer, grub_size_t len,
 
116
                                     grub_ssize_t *actualp);
 
117
int EXPORT_FUNC(grub_ieee1275_seek) (grub_ieee1275_ihandle_t ihandle,
 
118
                                     int pos_hi, int pos_lo,
 
119
                                     grub_ssize_t *result);
 
120
int EXPORT_FUNC(grub_ieee1275_peer) (grub_ieee1275_phandle_t node,
 
121
                                     grub_ieee1275_phandle_t *result);
 
122
int EXPORT_FUNC(grub_ieee1275_child) (grub_ieee1275_phandle_t node,
 
123
                                      grub_ieee1275_phandle_t *result);
 
124
int EXPORT_FUNC(grub_ieee1275_parent) (grub_ieee1275_phandle_t node,
 
125
                                       grub_ieee1275_phandle_t *result);
 
126
int EXPORT_FUNC(grub_ieee1275_interpret) (const char *command,
 
127
                                          grub_ieee1275_cell_t *catch);
 
128
int EXPORT_FUNC(grub_ieee1275_enter) (void);
 
129
void EXPORT_FUNC(grub_ieee1275_exit) (void) __attribute__ ((noreturn));
 
130
int EXPORT_FUNC(grub_ieee1275_open) (const char *node,
 
131
                                     grub_ieee1275_ihandle_t *result);
 
132
int EXPORT_FUNC(grub_ieee1275_close) (grub_ieee1275_ihandle_t ihandle);
 
133
int EXPORT_FUNC(grub_ieee1275_claim) (grub_addr_t addr, grub_size_t size,
 
134
                                      unsigned int align, grub_addr_t *result);
 
135
int EXPORT_FUNC(grub_ieee1275_release) (grub_addr_t addr, grub_size_t size);
 
136
int EXPORT_FUNC(grub_ieee1275_set_property) (grub_ieee1275_phandle_t phandle,
 
137
                                             const char *propname, void *buf,
 
138
                                             grub_size_t size,
 
139
                                             grub_ssize_t *actual);
 
140
int EXPORT_FUNC(grub_ieee1275_set_color) (grub_ieee1275_ihandle_t ihandle,
 
141
                                          int index, int r, int g, int b);
 
142
int EXPORT_FUNC(grub_ieee1275_milliseconds) (grub_uint32_t *msecs);
 
143
 
 
144
 
 
145
grub_err_t EXPORT_FUNC(grub_devalias_iterate)
 
146
     (int (*hook) (struct grub_ieee1275_devalias *alias));
 
147
grub_err_t EXPORT_FUNC(grub_children_iterate) (char *devpath,
 
148
     int (*hook) (struct grub_ieee1275_devalias *alias));
 
149
int EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size);
 
150
 
 
151
char *EXPORT_FUNC(grub_ieee1275_encode_devname) (const char *path);
 
152
char *EXPORT_FUNC(grub_ieee1275_get_filename) (const char *path);
 
153
 
 
154
#endif /* ! GRUB_IEEE1275_HEADER */