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/>.
19 #ifndef GRUB_CPU_XNU_H
20 #define GRUB_CPU_XNU_H 1
23 #include <grub/efi/api.h>
24 #include <grub/cpu/relocator.h>
26 #define XNU_RELOCATOR(x) (grub_relocator32_ ## x)
28 #define GRUB_XNU_PAGESIZE 4096
29 typedef grub_uint32_t grub_xnu_ptr_t
;
31 struct grub_xnu_boot_params
33 grub_uint16_t verminor
;
34 grub_uint16_t vermajor
;
35 /* Command line passed to xnu. */
36 grub_uint8_t cmdline
[1024];
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
;
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
;
54 /* Pointer to device tree and its len. */
55 grub_xnu_ptr_t devtree
;
56 grub_uint32_t devtreelen
;
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
;
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
74 struct grub_xnu_devprop_header
77 /* Always set to 1. Version? */
78 grub_uint32_t alwaysone
;
79 grub_uint32_t num_devices
;
82 struct grub_xnu_devprop_device_header
85 grub_uint32_t num_values
;
88 void grub_cpu_xnu_unload (void);
90 struct grub_xnu_devprop_device_descriptor
;
92 struct grub_xnu_devprop_device_descriptor
*
93 grub_xnu_devprop_add_device (struct grub_efi_device_path
*path
, int length
);
95 grub_xnu_devprop_remove_device (struct grub_xnu_devprop_device_descriptor
*dev
);
97 grub_xnu_devprop_remove_property (struct grub_xnu_devprop_device_descriptor
*dev
,
100 grub_xnu_devprop_add_property_utf8 (struct grub_xnu_devprop_device_descriptor
*dev
,
101 char *name
, void *data
, int datalen
);
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
);
107 grub_xnu_devprop_remove_property_utf8 (struct grub_xnu_devprop_device_descriptor
*dev
,
109 void grub_cpu_xnu_init (void);
110 void grub_cpu_xnu_fini (void);
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
;