2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2011 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_ARC_HEADER
20 #define GRUB_ARC_HEADER 1
22 #include <grub/types.h>
23 #include <grub/symbol.h>
25 typedef unsigned grub_arc_enum_t
;
26 typedef grub_uint64_t grub_arc_ularge_t
;
27 typedef unsigned long grub_arc_ulong_t
;
28 typedef long grub_arc_long_t
;
29 typedef unsigned short grub_arc_ushort_t
;
30 typedef unsigned char grub_arc_uchar_t
;
32 typedef grub_arc_long_t grub_arc_err_t
;
33 typedef grub_arc_ulong_t grub_arc_fileno_t
;
35 struct grub_arc_memory_descriptor
38 grub_arc_ulong_t start_page
;
39 grub_arc_ulong_t num_pages
;
42 enum grub_arc_memory_type
44 GRUB_ARC_MEMORY_EXCEPTION_BLOCK
,
45 GRUB_ARC_MEMORY_SYSTEM_PARAMETER_BLOCK
,
46 #ifdef GRUB_CPU_WORDS_BIGENDIAN
47 GRUB_ARC_MEMORY_FREE_CONTIGUOUS
,
50 GRUB_ARC_MEMORY_BADRAM
,
51 GRUB_ARC_MEMORY_LOADED
, GRUB_ARC_MEMORY_FW_TEMPORARY
,
52 GRUB_ARC_MEMORY_FW_PERMANENT
,
53 #ifndef GRUB_CPU_WORDS_BIGENDIAN
54 GRUB_ARC_MEMORY_FREE_CONTIGUOUS
,
56 } grub_arc_memory_type_t
;
58 struct grub_arc_timeinfo
64 grub_arc_ushort_t min
;
69 struct grub_arc_display_status
75 grub_arc_uchar_t fgcolor
;
76 grub_arc_uchar_t bgcolor
;
77 grub_arc_uchar_t high_intensity
;
78 grub_arc_uchar_t underscored
;
79 grub_arc_uchar_t reverse_video
;
84 GRUB_ARC_COMPONENT_FLAG_OUT
= 0x40,
85 GRUB_ARC_COMPONENT_FLAG_IN
= 0x20,
88 struct grub_arc_component
90 grub_arc_enum_t
class;
92 grub_arc_enum_t flags
;
93 grub_arc_ushort_t version
;
94 grub_arc_ushort_t rev
;
96 grub_arc_ulong_t affinity
;
97 grub_arc_ulong_t configdatasize
;
98 grub_arc_ulong_t idlen
;
104 #ifdef GRUB_CPU_WORDS_BIGENDIAN
105 GRUB_ARC_COMPONENT_TYPE_ARC
= 1,
107 GRUB_ARC_COMPONENT_TYPE_ARC
,
109 GRUB_ARC_COMPONENT_TYPE_CPU
,
110 GRUB_ARC_COMPONENT_TYPE_FPU
,
111 GRUB_ARC_COMPONENT_TYPE_PRI_I_CACHE
,
112 GRUB_ARC_COMPONENT_TYPE_PRI_D_CACHE
,
113 GRUB_ARC_COMPONENT_TYPE_SEC_I_CACHE
,
114 GRUB_ARC_COMPONENT_TYPE_SEC_D_CACHE
,
115 GRUB_ARC_COMPONENT_TYPE_SEC_CACHE
,
116 GRUB_ARC_COMPONENT_TYPE_EISA
,
117 GRUB_ARC_COMPONENT_TYPE_TCA
,
118 GRUB_ARC_COMPONENT_TYPE_SCSI
,
119 GRUB_ARC_COMPONENT_TYPE_DTIA
,
120 GRUB_ARC_COMPONENT_TYPE_MULTIFUNC
,
121 GRUB_ARC_COMPONENT_TYPE_DISK_CONTROLLER
,
122 GRUB_ARC_COMPONENT_TYPE_TAPE_CONTROLLER
,
123 GRUB_ARC_COMPONENT_TYPE_CDROM_CONTROLLER
,
124 GRUB_ARC_COMPONENT_TYPE_WORM_CONTROLLER
,
125 GRUB_ARC_COMPONENT_TYPE_SERIAL_CONTROLLER
,
126 GRUB_ARC_COMPONENT_TYPE_NET_CONTROLLER
,
127 GRUB_ARC_COMPONENT_TYPE_DISPLAY_CONTROLLER
,
128 GRUB_ARC_COMPONENT_TYPE_PARALLEL_CONTROLLER
,
129 GRUB_ARC_COMPONENT_TYPE_POINTER_CONTROLLER
,
130 GRUB_ARC_COMPONENT_TYPE_KBD_CONTROLLER
,
131 GRUB_ARC_COMPONENT_TYPE_AUDIO_CONTROLLER
,
132 GRUB_ARC_COMPONENT_TYPE_OTHER_CONTROLLER
,
133 GRUB_ARC_COMPONENT_TYPE_DISK
,
134 GRUB_ARC_COMPONENT_TYPE_FLOPPY
,
135 GRUB_ARC_COMPONENT_TYPE_TAPE
,
136 GRUB_ARC_COMPONENT_TYPE_MODEM
,
137 GRUB_ARC_COMPONENT_TYPE_MONITOR
,
138 GRUB_ARC_COMPONENT_TYPE_PRINTER
,
139 GRUB_ARC_COMPONENT_TYPE_POINTER
,
140 GRUB_ARC_COMPONENT_TYPE_KBD
,
141 GRUB_ARC_COMPONENT_TYPE_TERMINAL
,
142 #ifndef GRUB_CPU_WORDS_BIGENDIAN
143 GRUB_ARC_COMPONENT_TYPE_OTHER_PERIPHERAL
,
145 GRUB_ARC_COMPONENT_TYPE_LINE
,
146 GRUB_ARC_COMPONENT_TYPE_NET
,
147 GRUB_ARC_COMPONENT_TYPE_MEMORY_UNIT
,
150 enum grub_arc_file_access
152 GRUB_ARC_FILE_ACCESS_OPEN_RO
,
153 GRUB_ARC_FILE_ACCESS_OPEN_WO
,
154 GRUB_ARC_FILE_ACCESS_OPEN_RW
,
157 struct grub_arc_fileinfo
159 grub_arc_ularge_t start
;
160 grub_arc_ularge_t end
;
161 grub_arc_ularge_t current
;
162 grub_arc_enum_t type
;
163 grub_arc_ulong_t fnamelength
;
164 grub_arc_uchar_t attr
;
168 struct grub_arc_firmware_vector
177 void (*powerdown
) (void);
178 void (*restart
) (void);
179 void (*reboot
) (void);
184 const struct grub_arc_component
* (*getpeer
) (const struct grub_arc_component
*comp
);
185 const struct grub_arc_component
* (*getchild
) (const struct grub_arc_component
*comp
);
189 void *getconfigurationdata
;
191 void *deletecomponent
;
195 void *saveconfiguration
;
197 struct grub_arc_memory_descriptor
*(*getmemorydescriptor
) (struct grub_arc_memory_descriptor
*current
);
201 struct grub_arc_timeinfo
*(*gettime
) (void);
202 void *getrelativetime
;
203 void *getdirectoryentry
;
204 grub_arc_err_t (*open
) (const char *path
, grub_arc_enum_t mode
,
205 grub_arc_fileno_t
*fileno
);
208 grub_arc_err_t (*close
) (grub_arc_fileno_t fileno
);
209 grub_arc_err_t (*read
) (grub_arc_fileno_t fileno
, void *buf
,
211 grub_arc_ulong_t
*count
);
212 grub_arc_err_t (*get_read_status
) (grub_arc_fileno_t fileno
);
213 grub_arc_err_t (*write
) (grub_arc_fileno_t fileno
, const void *buf
,
215 grub_arc_ulong_t
*count
);
218 grub_arc_err_t (*seek
) (grub_arc_fileno_t fileno
,
219 grub_arc_ularge_t
*pos
, grub_arc_enum_t mode
);
221 const char * (*getenvironmentvariable
) (const char *name
);
222 void *setenvironmentvariable
;
225 grub_arc_err_t (*getfileinformation
) (grub_arc_fileno_t fileno
,
226 struct grub_arc_fileinfo
*info
);
227 void *setfileinformation
;
228 void *flushallcaches
;
229 void *testunicodecharacter
;
232 struct grub_arc_display_status
* (*getdisplaystatus
) (grub_arc_fileno_t fileno
);
235 struct grub_arc_adapter
237 grub_arc_ulong_t adapter_type
;
238 grub_arc_ulong_t adapter_vector_length
;
239 void *adapter_vector
;
242 struct grub_arc_system_parameter_block
244 grub_arc_ulong_t signature
;
245 grub_arc_ulong_t length
;
246 grub_arc_ushort_t version
;
247 grub_arc_ushort_t revision
;
251 void *utlbmissvector
;
252 grub_arc_ulong_t firmware_vector_length
;
253 struct grub_arc_firmware_vector
*firmwarevector
;
254 grub_arc_ulong_t private_vector_length
;
255 void *private_vector
;
256 grub_arc_ulong_t adapter_count
;
257 struct grub_arc_adapter adapters
[0];
261 #define GRUB_ARC_SYSTEM_PARAMETER_BLOCK ((struct grub_arc_system_parameter_block *) 0xa0001000)
262 #define GRUB_ARC_FIRMWARE_VECTOR (GRUB_ARC_SYSTEM_PARAMETER_BLOCK->firmwarevector)
263 #define GRUB_ARC_STDIN 0
264 #define GRUB_ARC_STDOUT 1
266 typedef int (*grub_arc_iterate_devs_hook_t
)
267 (const char *name
, const struct grub_arc_component
*comp
, void *data
);
269 int EXPORT_FUNC (grub_arc_iterate_devs
) (grub_arc_iterate_devs_hook_t hook
,
273 char *EXPORT_FUNC (grub_arc_alt_name_to_norm
) (const char *name
, const char *suffix
);
275 int EXPORT_FUNC (grub_arc_is_device_serial
) (const char *name
, int alt_names
);
278 #define FOR_ARC_CHILDREN(comp, parent) for (comp = GRUB_ARC_FIRMWARE_VECTOR->getchild (parent); comp; comp = GRUB_ARC_FIRMWARE_VECTOR->getpeer (comp))
280 extern void grub_arcdisk_init (void);
281 extern void grub_arcdisk_fini (void);