]> code.delx.au - refind/blob - refind/global.h
Version 0.3.0 (beta) release. Adds "resolution" option to refind.conf.
[refind] / refind / global.h
1 /*
2 * refit/global.h
3 * Global header file
4 *
5 * Copyright (c) 2006-2009 Christoph Pfisterer
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the
18 * distribution.
19 *
20 * * Neither the name of Christoph Pfisterer nor the names of the
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36 /*
37 * Modifications copyright (c) 2012 Roderick W. Smith
38 *
39 * Modifications distributed under the terms of the GNU General Public
40 * License (GPL) version 3 (GPLv3), a copy of which must be distributed
41 * with this source code or binaries made from it.
42 *
43 */
44
45 #ifndef __GLOBAL_H_
46 #define __GLOBAL_H_
47
48 #include "efi.h"
49 #include "efilib.h"
50
51 #include "libeg.h"
52
53 #define REFIT_DEBUG (0)
54
55 // Tag classifications; used in various ways.
56 #define TAG_ABOUT (1)
57 #define TAG_REBOOT (2)
58 #define TAG_SHUTDOWN (3)
59 #define TAG_TOOL (4)
60 #define TAG_LOADER (5)
61 #define TAG_LEGACY (6)
62 #define TAG_EXIT (7)
63 #define TAG_SHELL (8)
64 #define TAG_GPTSYNC (9)
65 #define NUM_TOOLS (9)
66
67 #define NUM_SCAN_OPTIONS 10
68
69
70 //
71 // global definitions
72 //
73
74 // global types
75
76 typedef struct {
77 UINT8 Flags;
78 UINT8 StartCHS1;
79 UINT8 StartCHS2;
80 UINT8 StartCHS3;
81 UINT8 Type;
82 UINT8 EndCHS1;
83 UINT8 EndCHS2;
84 UINT8 EndCHS3;
85 UINT32 StartLBA;
86 UINT32 Size;
87 } MBR_PARTITION_INFO;
88
89 typedef struct {
90 EFI_DEVICE_PATH *DevicePath;
91 EFI_HANDLE DeviceHandle;
92 EFI_FILE *RootDir;
93 CHAR16 *VolName;
94 EG_IMAGE *VolIconImage;
95 EG_IMAGE *VolBadgeImage;
96 UINTN DiskKind;
97 BOOLEAN IsAppleLegacy;
98 BOOLEAN HasBootCode;
99 CHAR16 *OSIconName;
100 CHAR16 *OSName;
101 BOOLEAN IsMbrPartition;
102 UINTN MbrPartitionIndex;
103 EFI_BLOCK_IO *BlockIO;
104 UINT64 BlockIOOffset;
105 EFI_BLOCK_IO *WholeDiskBlockIO;
106 EFI_DEVICE_PATH *WholeDiskDevicePath;
107 MBR_PARTITION_INFO *MbrPartitionTable;
108 BOOLEAN IsReadable;
109 } REFIT_VOLUME;
110
111 typedef struct _refit_menu_entry {
112 CHAR16 *Title;
113 UINTN Tag;
114 UINTN Row;
115 CHAR16 ShortcutDigit;
116 CHAR16 ShortcutLetter;
117 EG_IMAGE *Image;
118 EG_IMAGE *BadgeImage;
119 struct _refit_menu_screen *SubScreen;
120 } REFIT_MENU_ENTRY;
121
122 typedef struct _refit_menu_screen {
123 CHAR16 *Title;
124 EG_IMAGE *TitleImage;
125 UINTN InfoLineCount;
126 CHAR16 **InfoLines;
127 UINTN EntryCount; // total number of entries registered
128 REFIT_MENU_ENTRY **Entries;
129 UINTN TimeoutSeconds;
130 CHAR16 *TimeoutText;
131 } REFIT_MENU_SCREEN;
132
133 typedef struct {
134 REFIT_MENU_ENTRY me;
135 CHAR16 *Title;
136 CHAR16 *LoaderPath;
137 CHAR16 *VolName;
138 EFI_DEVICE_PATH *DevicePath;
139 BOOLEAN UseGraphicsMode;
140 BOOLEAN Enabled;
141 CHAR16 *LoadOptions;
142 CHAR16 *InitrdPath; // Linux stub loader only
143 CHAR8 OSType;
144 } LOADER_ENTRY;
145
146 typedef struct {
147 REFIT_MENU_ENTRY me;
148 REFIT_VOLUME *Volume;
149 CHAR16 *LoadOptions;
150 BOOLEAN Enabled;
151 } LEGACY_ENTRY;
152
153 typedef struct {
154 BOOLEAN TextOnly;
155 BOOLEAN ScanAllLinux;
156 UINTN RequestedScreenWidth;
157 UINTN RequestedScreenHeight;
158 UINTN Timeout;
159 UINTN HideUIFlags;
160 UINTN MaxTags; // max. number of OS entries to show simultaneously in graphics mode
161 CHAR16 *BannerFileName;
162 CHAR16 *SelectionSmallFileName;
163 CHAR16 *SelectionBigFileName;
164 CHAR16 *DefaultSelection;
165 CHAR16 *AlsoScan;
166 CHAR16 *DriverDirs;
167 UINTN ShowTools[NUM_TOOLS];
168 CHAR8 ScanFor[NUM_SCAN_OPTIONS]; // codes of types of loaders for which to scan
169 } REFIT_CONFIG;
170
171 // Global variables
172
173 extern EFI_HANDLE SelfImageHandle;
174 extern EFI_LOADED_IMAGE *SelfLoadedImage;
175 extern EFI_FILE *SelfRootDir;
176 extern EFI_FILE *SelfDir;
177 extern CHAR16 *SelfDirPath;
178
179 extern REFIT_VOLUME *SelfVolume;
180 extern REFIT_VOLUME **Volumes;
181 extern UINTN VolumesCount;
182
183 extern REFIT_CONFIG GlobalConfig;
184
185 LOADER_ENTRY *InitializeLoaderEntry(IN LOADER_ENTRY *Entry);
186 REFIT_MENU_SCREEN *InitializeSubScreen(IN LOADER_ENTRY *Entry);
187 VOID GenerateSubScreen(LOADER_ENTRY *Entry, IN REFIT_VOLUME *Volume);
188 LOADER_ENTRY * MakeGenericLoaderEntry(VOID);
189 LOADER_ENTRY * AddLoaderEntry(IN CHAR16 *LoaderPath, IN CHAR16 *LoaderTitle, IN REFIT_VOLUME *Volume);
190 VOID SetLoaderDefaults(LOADER_ENTRY *Entry, CHAR16 *LoaderPath, IN REFIT_VOLUME *Volume);
191 LOADER_ENTRY * AddPreparedLoaderEntry(LOADER_ENTRY *Entry);
192
193 #endif
194
195 /* EOF */