]> git.proxmox.com Git - grub2.git/blob - grub-core/include/grub/i386/xnu.h
merge with mainline
[grub2.git] / grub-core / 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
32 {
33 grub_uint16_t verminor;
34 grub_uint16_t vermajor;
35 /* Command line passed to xnu. */
36 grub_uint8_t cmdline[1024];
37
38 /* Later are the same as EFI's get_memory_map (). */
39 grub_xnu_ptr_t efi_mmap;
40 grub_uint32_t efi_mmap_size;
41 grub_uint32_t efi_mem_desc_size;
42 grub_uint32_t efi_mem_desc_version;
43
44 /* Later are video parameters. */
45 grub_xnu_ptr_t lfb_base;
46 #define GRUB_XNU_VIDEO_SPLASH 1
47 #define GRUB_XNU_VIDEO_TEXT_IN_VIDEO 2
48 grub_uint32_t lfb_mode;
49 grub_uint32_t lfb_line_len;
50 grub_uint32_t lfb_width;
51 grub_uint32_t lfb_height;
52 grub_uint32_t lfb_depth;
53
54 /* Pointer to device tree and its len. */
55 grub_xnu_ptr_t devtree;
56 grub_uint32_t devtreelen;
57
58 /* First used address by kernel or boot structures. */
59 grub_xnu_ptr_t heap_start;
60 /* Last used address by kernel or boot structures minus previous value. */
61 grub_uint32_t heap_size;
62
63 /* First memory page containing runtime code or data. */
64 grub_uint32_t efi_runtime_first_page;
65 /* First memory page containing runtime code or data minus previous value. */
66 grub_uint32_t efi_runtime_npages;
67 grub_uint32_t efi_system_table;
68 /* Size of grub_efi_uintn_t in bits. */
69 grub_uint8_t efi_uintnbits;
70 } __attribute__ ((packed));
71 #define GRUB_XNU_BOOTARGS_VERMINOR 5
72 #define GRUB_XNU_BOOTARGS_VERMAJOR 1
73
74 struct grub_xnu_devprop_header
75 {
76 grub_uint32_t length;
77 /* Always set to 1. Version? */
78 grub_uint32_t alwaysone;
79 grub_uint32_t num_devices;
80 };
81
82 struct grub_xnu_devprop_device_header
83 {
84 grub_uint32_t length;
85 grub_uint32_t num_values;
86 };
87
88 void grub_cpu_xnu_unload (void);
89
90 struct grub_xnu_devprop_device_descriptor;
91
92 struct grub_xnu_devprop_device_descriptor *
93 grub_xnu_devprop_add_device (struct grub_efi_device_path *path, int length);
94 grub_err_t
95 grub_xnu_devprop_remove_device (struct grub_xnu_devprop_device_descriptor *dev);
96 grub_err_t
97 grub_xnu_devprop_remove_property (struct grub_xnu_devprop_device_descriptor *dev,
98 char *name);
99 grub_err_t
100 grub_xnu_devprop_add_property_utf8 (struct grub_xnu_devprop_device_descriptor *dev,
101 char *name, void *data, int datalen);
102 grub_err_t
103 grub_xnu_devprop_add_property_utf16 (struct grub_xnu_devprop_device_descriptor *dev,
104 grub_uint16_t *name, int namelen,
105 void *data, int datalen);
106 grub_err_t
107 grub_xnu_devprop_remove_property_utf8 (struct grub_xnu_devprop_device_descriptor *dev,
108 char *name);
109 void grub_cpu_xnu_init (void);
110 void grub_cpu_xnu_fini (void);
111
112 extern grub_uint32_t grub_xnu_entry_point;
113 extern grub_uint32_t grub_xnu_stack;
114 extern grub_uint32_t grub_xnu_arg1;
115 extern char grub_xnu_cmdline[1024];
116 grub_err_t grub_xnu_boot (void);
117 grub_err_t grub_cpu_xnu_fill_devicetree (void);
118 extern grub_uint32_t grub_xnu_heap_will_be_at;
119 #endif