2N/A/*
2N/A * GRUB -- GRand Unified Bootloader
2N/A * Copyright (C) 2009 Free Software Foundation, Inc.
2N/A *
2N/A * GRUB is free software: you can redistribute it and/or modify
2N/A * it under the terms of the GNU General Public License as published by
2N/A * the Free Software Foundation, either version 3 of the License, or
2N/A * (at your option) any later version.
2N/A *
2N/A * GRUB is distributed in the hope that it will be useful,
2N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
2N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2N/A * GNU General Public License for more details.
2N/A *
2N/A * You should have received a copy of the GNU General Public License
2N/A * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
2N/A */
2N/A
2N/A#ifndef GRUB_CPU_XNU_H
2N/A#define GRUB_CPU_XNU_H 1
2N/A
2N/A#include <grub/err.h>
2N/A#include <grub/efi/api.h>
2N/A#include <grub/cpu/relocator.h>
2N/A
2N/A#define XNU_RELOCATOR(x) (grub_relocator32_ ## x)
2N/A
2N/A#define GRUB_XNU_PAGESIZE 4096
2N/Atypedef grub_uint32_t grub_xnu_ptr_t;
2N/A
2N/Astruct grub_xnu_boot_params
2N/A{
2N/A grub_uint16_t verminor;
2N/A grub_uint16_t vermajor;
2N/A /* Command line passed to xnu. */
2N/A grub_uint8_t cmdline[1024];
2N/A
2N/A /* Later are the same as EFI's get_memory_map (). */
2N/A grub_xnu_ptr_t efi_mmap;
2N/A grub_uint32_t efi_mmap_size;
2N/A grub_uint32_t efi_mem_desc_size;
2N/A grub_uint32_t efi_mem_desc_version;
2N/A
2N/A /* Later are video parameters. */
2N/A grub_xnu_ptr_t lfb_base;
2N/A#define GRUB_XNU_VIDEO_SPLASH 1
2N/A#define GRUB_XNU_VIDEO_TEXT_IN_VIDEO 2
2N/A grub_uint32_t lfb_mode;
2N/A grub_uint32_t lfb_line_len;
2N/A grub_uint32_t lfb_width;
2N/A grub_uint32_t lfb_height;
2N/A grub_uint32_t lfb_depth;
2N/A
2N/A /* Pointer to device tree and its len. */
2N/A grub_xnu_ptr_t devtree;
2N/A grub_uint32_t devtreelen;
2N/A
2N/A /* First used address by kernel or boot structures. */
2N/A grub_xnu_ptr_t heap_start;
2N/A /* Last used address by kernel or boot structures minus previous value. */
2N/A grub_uint32_t heap_size;
2N/A
2N/A /* First memory page containing runtime code or data. */
2N/A grub_uint32_t efi_runtime_first_page;
2N/A /* First memory page containing runtime code or data minus previous value. */
2N/A grub_uint32_t efi_runtime_npages;
2N/A grub_uint32_t efi_system_table;
2N/A /* Size of grub_efi_uintn_t in bits. */
2N/A grub_uint8_t efi_uintnbits;
2N/A} __attribute__ ((packed));
2N/A#define GRUB_XNU_BOOTARGS_VERMINOR 5
2N/A#define GRUB_XNU_BOOTARGS_VERMAJOR 1
2N/A
2N/Astruct grub_xnu_devprop_header
2N/A{
2N/A grub_uint32_t length;
2N/A /* Always set to 1. Version? */
2N/A grub_uint32_t alwaysone;
2N/A grub_uint32_t num_devices;
2N/A};
2N/A
2N/Astruct grub_xnu_devprop_device_header
2N/A{
2N/A grub_uint32_t length;
2N/A grub_uint32_t num_values;
2N/A};
2N/A
2N/Avoid grub_cpu_xnu_unload (void);
2N/A
2N/Astruct grub_xnu_devprop_device_descriptor;
2N/A
2N/Astruct grub_xnu_devprop_device_descriptor *
2N/Agrub_xnu_devprop_add_device (struct grub_efi_device_path *path, int length);
2N/Agrub_err_t
2N/Agrub_xnu_devprop_remove_device (struct grub_xnu_devprop_device_descriptor *dev);
2N/Agrub_err_t
2N/Agrub_xnu_devprop_remove_property (struct grub_xnu_devprop_device_descriptor *dev,
2N/A char *name);
2N/Agrub_err_t
2N/Agrub_xnu_devprop_add_property_utf8 (struct grub_xnu_devprop_device_descriptor *dev,
2N/A char *name, void *data, int datalen);
2N/Agrub_err_t
2N/Agrub_xnu_devprop_add_property_utf16 (struct grub_xnu_devprop_device_descriptor *dev,
2N/A grub_uint16_t *name, int namelen,
2N/A void *data, int datalen);
2N/Agrub_err_t
2N/Agrub_xnu_devprop_remove_property_utf8 (struct grub_xnu_devprop_device_descriptor *dev,
2N/A char *name);
2N/Avoid grub_cpu_xnu_init (void);
2N/Avoid grub_cpu_xnu_fini (void);
2N/A
2N/Aextern grub_uint32_t grub_xnu_entry_point;
2N/Aextern grub_uint32_t grub_xnu_stack;
2N/Aextern grub_uint32_t grub_xnu_arg1;
2N/Aextern char grub_xnu_cmdline[1024];
2N/Agrub_err_t grub_xnu_boot (void);
2N/Agrub_err_t grub_cpu_xnu_fill_devicetree (void);
2N/A#endif