]> git.proxmox.com Git - grub2.git/blob - include/grub/i386/xnu.h
Import grub2_2.02+dfsg1.orig.tar.xz
[grub2.git] / include / grub / i386 / xnu.h
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2009 Free Software Foundation, Inc.
4 *
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.
9 *
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.
14 *
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/>.
17 */
18
19 #ifndef GRUB_CPU_XNU_H
20 #define GRUB_CPU_XNU_H 1
21
22 #include <grub/err.h>
23 #include <grub/efi/api.h>
24 #include <grub/cpu/relocator.h>
25
26 #define XNU_RELOCATOR(x) (grub_relocator32_ ## x)
27
28 #define GRUB_XNU_PAGESIZE 4096
29 typedef grub_uint32_t grub_xnu_ptr_t;
30
31 struct grub_xnu_boot_params_common
32 {
33 /* Command line passed to xnu. */
34 grub_uint8_t cmdline[1024];
35
36 /* Later are the same as EFI's get_memory_map (). */
37 grub_xnu_ptr_t efi_mmap;
38 grub_uint32_t efi_mmap_size;
39 grub_uint32_t efi_mem_desc_size;
40 grub_uint32_t efi_mem_desc_version;
41
42 /* Later are video parameters. */
43 grub_xnu_ptr_t lfb_base;
44 #define GRUB_XNU_VIDEO_SPLASH 1
45 #define GRUB_XNU_VIDEO_TEXT_IN_VIDEO 2
46 grub_uint32_t lfb_mode;
47 grub_uint32_t lfb_line_len;
48 grub_uint32_t lfb_width;
49 grub_uint32_t lfb_height;
50 grub_uint32_t lfb_depth;
51
52 /* Pointer to device tree and its len. */
53 grub_xnu_ptr_t devtree;
54 grub_uint32_t devtreelen;
55
56 /* First used address by kernel or boot structures. */
57 grub_xnu_ptr_t heap_start;
58 /* Last used address by kernel or boot structures minus previous value. */
59 grub_uint32_t heap_size;
60 /* First memory page containing runtime code or data. */
61 grub_uint32_t efi_runtime_first_page;
62 /* First memory page containing runtime code or data minus previous value. */
63 grub_uint32_t efi_runtime_npages;
64 } GRUB_PACKED;
65
66 struct grub_xnu_boot_params_v1
67 {
68 grub_uint16_t verminor;
69 grub_uint16_t vermajor;
70 struct grub_xnu_boot_params_common common;
71
72 grub_uint32_t efi_system_table;
73 /* Size of grub_efi_uintn_t in bits. */
74 grub_uint8_t efi_uintnbits;
75 } GRUB_PACKED;
76 #define GRUB_XNU_BOOTARGSV1_VERMINOR 5
77 #define GRUB_XNU_BOOTARGSV1_VERMAJOR 1
78
79 struct grub_xnu_boot_params_v2
80 {
81 grub_uint16_t verminor;
82 grub_uint16_t vermajor;
83
84 /* Size of grub_efi_uintn_t in bits. */
85 grub_uint8_t efi_uintnbits;
86 grub_uint8_t unused[3];
87
88 struct grub_xnu_boot_params_common common;
89
90 grub_uint64_t efi_runtime_first_page_virtual;
91 grub_uint32_t efi_system_table;
92 grub_uint32_t unused2[9];
93 grub_uint64_t ram_size;
94 grub_uint64_t fsbfreq;
95 grub_uint32_t unused3[734];
96 } GRUB_PACKED;
97 #define GRUB_XNU_BOOTARGSV2_VERMINOR 0
98 #define GRUB_XNU_BOOTARGSV2_VERMAJOR 2
99
100 union grub_xnu_boot_params_any
101 {
102 struct grub_xnu_boot_params_v1 v1;
103 struct grub_xnu_boot_params_v2 v2;
104 };
105
106 struct grub_xnu_devprop_header
107 {
108 grub_uint32_t length;
109 /* Always set to 1. Version? */
110 grub_uint32_t alwaysone;
111 grub_uint32_t num_devices;
112 };
113
114 struct grub_xnu_devprop_device_header
115 {
116 grub_uint32_t length;
117 grub_uint32_t num_values;
118 };
119
120 void grub_cpu_xnu_unload (void);
121
122 struct grub_xnu_devprop_device_descriptor;
123
124 struct grub_xnu_devprop_device_descriptor *
125 grub_xnu_devprop_add_device (struct grub_efi_device_path *path, int length);
126 grub_err_t
127 grub_xnu_devprop_remove_device (struct grub_xnu_devprop_device_descriptor *dev);
128 grub_err_t
129 grub_xnu_devprop_remove_property (struct grub_xnu_devprop_device_descriptor *dev,
130 char *name);
131 grub_err_t
132 grub_xnu_devprop_add_property_utf8 (struct grub_xnu_devprop_device_descriptor *dev,
133 char *name, void *data, int datalen);
134 grub_err_t
135 grub_xnu_devprop_add_property_utf16 (struct grub_xnu_devprop_device_descriptor *dev,
136 grub_uint16_t *name, int namelen,
137 void *data, int datalen);
138 grub_err_t
139 grub_xnu_devprop_remove_property_utf8 (struct grub_xnu_devprop_device_descriptor *dev,
140 char *name);
141 void grub_cpu_xnu_init (void);
142 void grub_cpu_xnu_fini (void);
143
144 extern grub_uint32_t grub_xnu_entry_point;
145 extern grub_uint32_t grub_xnu_stack;
146 extern grub_uint32_t grub_xnu_arg1;
147 extern char grub_xnu_cmdline[1024];
148 grub_err_t grub_xnu_boot (void);
149 #endif