2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2009 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/>.
22 #include <grub/bitmap.h>
24 /* Header of a hibernation image. */
25 struct grub_xnu_hibernate_header
27 /* Size of the image. Notice that file containing image is usually bigger. */
28 grub_uint64_t image_size
;
29 grub_uint8_t unknown1
[8];
30 /* Where to copy launchcode? */
31 grub_uint32_t launchcode_target_page
;
32 /* How many pages of launchcode? */
33 grub_uint32_t launchcode_numpages
;
35 grub_uint32_t entry_point
;
38 grub_uint8_t unknown2
[44];
39 #define GRUB_XNU_HIBERNATE_MAGIC 0x73696d65
41 grub_uint8_t unknown3
[28];
42 /* This value is non-zero if page is encrypted. Unsupported. */
43 grub_uint64_t encoffset
;
44 grub_uint8_t unknown4
[360];
45 /* The size of additional header used to locate image without parsing FS.
48 grub_uint32_t extmapsize
;
51 /* In-memory structure for temporary keeping device tree. */
52 struct grub_xnu_devtree_key
55 int datasize
; /* -1 for not leaves. */
58 struct grub_xnu_devtree_key
*first_child
;
61 struct grub_xnu_devtree_key
*next
;
64 /* A structure used in memory-map values. */
72 /* Header describing extension in the memory. */
73 struct grub_xnu_extheader
75 grub_uint32_t infoplistaddr
;
76 grub_uint32_t infoplistsize
;
77 grub_uint32_t binaryaddr
;
78 grub_uint32_t binarysize
;
79 grub_uint32_t nameaddr
;
80 grub_uint32_t namesize
;
83 struct grub_xnu_devtree_key
*grub_xnu_create_key (struct grub_xnu_devtree_key
**parent
,
86 extern struct grub_xnu_devtree_key
*grub_xnu_devtree_root
;
88 void grub_xnu_free_devtree (struct grub_xnu_devtree_key
*cur
);
90 grub_err_t
grub_xnu_writetree_toheap (grub_addr_t
*target
, grub_size_t
*size
);
91 struct grub_xnu_devtree_key
*grub_xnu_create_value (struct grub_xnu_devtree_key
**parent
,
94 void grub_xnu_lock (void);
95 void grub_xnu_unlock (void);
96 grub_err_t
grub_xnu_resume (char *imagename
);
97 grub_err_t
grub_xnu_boot_resume (void);
98 struct grub_xnu_devtree_key
*grub_xnu_find_key (struct grub_xnu_devtree_key
*parent
,
100 grub_err_t
grub_xnu_align_heap (int align
);
101 grub_err_t
grub_xnu_scan_dir_for_kexts (char *dirname
,
102 const char *osbundlerequired
,
104 grub_err_t
grub_xnu_load_kext_from_dir (char *dirname
,
105 const char *osbundlerequired
,
107 grub_err_t
grub_xnu_heap_malloc (int size
, void **src
, grub_addr_t
*target
);
108 grub_err_t
grub_xnu_fill_devicetree (void);
109 extern struct grub_relocator
*grub_xnu_relocator
;
111 extern grub_size_t grub_xnu_heap_size
;
112 extern struct grub_video_bitmap
*grub_xnu_bitmap
;
113 typedef enum {GRUB_XNU_BITMAP_CENTER
, GRUB_XNU_BITMAP_STRETCH
}
114 grub_xnu_bitmap_mode_t
;
115 extern grub_xnu_bitmap_mode_t grub_xnu_bitmap_mode
;
116 extern int grub_xnu_is_64bit
;
117 extern grub_addr_t grub_xnu_heap_target_start
;
118 extern int grub_xnu_darwin_version
;