]> code.delx.au - refind/blob - refind/global.h
TianoCore build support; new use_graphics_for refind.conf token
[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 #ifdef __MAKEWITH_GNUEFI
49 #include <efi.h>
50 #include <efilib.h>
51 #else
52 #include "../include/tiano_includes.h"
53 #endif
54
55 #include "libeg.h"
56
57 #define REFIT_DEBUG (0)
58
59 // Tag classifications; used in various ways.
60 #define TAG_ABOUT (1)
61 #define TAG_REBOOT (2)
62 #define TAG_SHUTDOWN (3)
63 #define TAG_TOOL (4)
64 #define TAG_LOADER (5)
65 #define TAG_LEGACY (6)
66 #define TAG_EXIT (7)
67 #define TAG_SHELL (8)
68 #define TAG_GPTSYNC (9)
69 #define NUM_TOOLS (9)
70
71 #define NUM_SCAN_OPTIONS 10
72
73 #define DEFAULT_ICONS_DIR L"icons"
74
75 // OS bit codes; used in GlobalConfig.GraphicsOn
76 #define GRAPHICS_FOR_OSX 1
77 #define GRAPHICS_FOR_LINUX 2
78 #define GRAPHICS_FOR_ELILO 4
79 #define GRAPHICS_FOR_GRUB 8
80 #define GRAPHICS_FOR_WINDOWS 16
81
82 //
83 // global definitions
84 //
85
86 // global types
87
88 typedef struct {
89 UINT8 Flags;
90 UINT8 StartCHS1;
91 UINT8 StartCHS2;
92 UINT8 StartCHS3;
93 UINT8 Type;
94 UINT8 EndCHS1;
95 UINT8 EndCHS2;
96 UINT8 EndCHS3;
97 UINT32 StartLBA;
98 UINT32 Size;
99 } MBR_PARTITION_INFO;
100
101 typedef struct {
102 EFI_DEVICE_PATH *DevicePath;
103 EFI_HANDLE DeviceHandle;
104 EFI_FILE *RootDir;
105 CHAR16 *VolName;
106 EG_IMAGE *VolIconImage;
107 EG_IMAGE *VolBadgeImage;
108 UINTN DiskKind;
109 BOOLEAN IsAppleLegacy;
110 BOOLEAN HasBootCode;
111 CHAR16 *OSIconName;
112 CHAR16 *OSName;
113 BOOLEAN IsMbrPartition;
114 UINTN MbrPartitionIndex;
115 EFI_BLOCK_IO *BlockIO;
116 UINT64 BlockIOOffset;
117 EFI_BLOCK_IO *WholeDiskBlockIO;
118 EFI_DEVICE_PATH *WholeDiskDevicePath;
119 MBR_PARTITION_INFO *MbrPartitionTable;
120 BOOLEAN IsReadable;
121 } REFIT_VOLUME;
122
123 typedef struct _refit_menu_entry {
124 CHAR16 *Title;
125 UINTN Tag;
126 UINTN Row;
127 CHAR16 ShortcutDigit;
128 CHAR16 ShortcutLetter;
129 EG_IMAGE *Image;
130 EG_IMAGE *BadgeImage;
131 struct _refit_menu_screen *SubScreen;
132 } REFIT_MENU_ENTRY;
133
134 typedef struct _refit_menu_screen {
135 CHAR16 *Title;
136 EG_IMAGE *TitleImage;
137 UINTN InfoLineCount;
138 CHAR16 **InfoLines;
139 UINTN EntryCount; // total number of entries registered
140 REFIT_MENU_ENTRY **Entries;
141 UINTN TimeoutSeconds;
142 CHAR16 *TimeoutText;
143 } REFIT_MENU_SCREEN;
144
145 typedef struct {
146 REFIT_MENU_ENTRY me;
147 CHAR16 *Title;
148 CHAR16 *LoaderPath;
149 CHAR16 *VolName;
150 EFI_DEVICE_PATH *DevicePath;
151 BOOLEAN UseGraphicsMode;
152 BOOLEAN Enabled;
153 CHAR16 *LoadOptions;
154 CHAR16 *InitrdPath; // Linux stub loader only
155 CHAR8 OSType;
156 } LOADER_ENTRY;
157
158 typedef struct {
159 REFIT_MENU_ENTRY me;
160 REFIT_VOLUME *Volume;
161 CHAR16 *LoadOptions;
162 BOOLEAN Enabled;
163 } LEGACY_ENTRY;
164
165 typedef struct {
166 BOOLEAN TextOnly;
167 BOOLEAN ScanAllLinux;
168 UINTN RequestedScreenWidth;
169 UINTN RequestedScreenHeight;
170 UINTN Timeout;
171 UINTN HideUIFlags;
172 UINTN MaxTags; // max. number of OS entries to show simultaneously in graphics mode
173 UINTN GraphicsFor;
174 CHAR16 *BannerFileName;
175 CHAR16 *SelectionSmallFileName;
176 CHAR16 *SelectionBigFileName;
177 CHAR16 *DefaultSelection;
178 CHAR16 *AlsoScan;
179 CHAR16 *DontScan;
180 CHAR16 *DriverDirs;
181 CHAR16 *IconsDir;
182 UINTN ShowTools[NUM_TOOLS];
183 CHAR8 ScanFor[NUM_SCAN_OPTIONS]; // codes of types of loaders for which to scan
184 } REFIT_CONFIG;
185
186 // Global variables
187
188 extern EFI_HANDLE SelfImageHandle;
189 extern EFI_LOADED_IMAGE *SelfLoadedImage;
190 extern EFI_FILE *SelfRootDir;
191 extern EFI_FILE *SelfDir;
192 extern CHAR16 *SelfDirPath;
193
194 extern REFIT_VOLUME *SelfVolume;
195 extern REFIT_VOLUME **Volumes;
196 extern UINTN VolumesCount;
197
198 extern REFIT_CONFIG GlobalConfig;
199
200 LOADER_ENTRY *InitializeLoaderEntry(IN LOADER_ENTRY *Entry);
201 REFIT_MENU_SCREEN *InitializeSubScreen(IN LOADER_ENTRY *Entry);
202 VOID GenerateSubScreen(LOADER_ENTRY *Entry, IN REFIT_VOLUME *Volume);
203 LOADER_ENTRY * MakeGenericLoaderEntry(VOID);
204 LOADER_ENTRY * AddLoaderEntry(IN CHAR16 *LoaderPath, IN CHAR16 *LoaderTitle, IN REFIT_VOLUME *Volume);
205 VOID SetLoaderDefaults(LOADER_ENTRY *Entry, CHAR16 *LoaderPath, IN REFIT_VOLUME *Volume);
206 LOADER_ENTRY * AddPreparedLoaderEntry(LOADER_ENTRY *Entry);
207
208 #endif
209
210 /* EOF */