From 6e7a315eb67cb6c113cf37e1d66c4f11a51a2b3e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 18:29:51 +0200 Subject: Adding upstream version 2.06. Signed-off-by: Daniel Baumann --- include/grub/uboot/uboot.h | 87 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 include/grub/uboot/uboot.h (limited to 'include/grub/uboot/uboot.h') diff --git a/include/grub/uboot/uboot.h b/include/grub/uboot/uboot.h new file mode 100644 index 0000000..1941303 --- /dev/null +++ b/include/grub/uboot/uboot.h @@ -0,0 +1,87 @@ +/* uboot.h - declare variables and functions for U-Boot support */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#ifndef GRUB_UBOOT_UBOOT_HEADER +#define GRUB_UBOOT_UBOOT_HEADER 1 + +#include +#include + +/* Functions. */ +void grub_uboot_mm_init (void); +void grub_uboot_init (void); +void grub_uboot_fini (void); + +void grub_uboot_return (int) __attribute__ ((noreturn)); + +grub_addr_t grub_uboot_get_real_bss_start (void); + +grub_err_t grub_uboot_probe_hardware (void); + +extern grub_addr_t EXPORT_VAR (start_of_ram); + +grub_uint32_t EXPORT_FUNC (grub_uboot_get_machine_type) (void); +grub_addr_t EXPORT_FUNC (grub_uboot_get_boot_data) (void); + + +/* + * The U-Boot API operates through a "syscall" interface, consisting of an + * entry point address and a set of syscall numbers. The location of this + * entry point is described in a structure allocated on the U-Boot heap. + * We scan through a defined region around the hint address passed to us + * from U-Boot. + */ + +#define UBOOT_API_SEARCH_LEN (3 * 1024 * 1024) +int grub_uboot_api_init (void); + +/* + * All functions below are wrappers around the uboot_syscall() function, + * implemented in grub-core/kern/uboot/uboot.c +*/ + +int grub_uboot_getc (void); +int grub_uboot_tstc (void); +void grub_uboot_putc (int c); +void grub_uboot_puts (const char *s); + +void EXPORT_FUNC (grub_uboot_reset) (void); + +struct sys_info *grub_uboot_get_sys_info (void); + +void grub_uboot_udelay (grub_uint32_t usec); +grub_uint32_t grub_uboot_get_timer (grub_uint32_t base); + +int EXPORT_FUNC (grub_uboot_dev_enum) (void); +struct device_info * EXPORT_FUNC (grub_uboot_dev_get) (int index); +int EXPORT_FUNC (grub_uboot_dev_open) (struct device_info *dev); +int EXPORT_FUNC (grub_uboot_dev_close) (struct device_info *dev); +int grub_uboot_dev_write (struct device_info *dev, const void *buf, + grub_size_t blocks, grub_uint32_t start); +int grub_uboot_dev_read (struct device_info *dev, void *buf, grub_size_t blocks, + grub_uint32_t start, grub_size_t * real_blocks); +int EXPORT_FUNC (grub_uboot_dev_recv) (struct device_info *dev, void *buf, + int size, int *real_size); +int EXPORT_FUNC (grub_uboot_dev_send) (struct device_info *dev, void *buf, + int size); + +char *grub_uboot_env_get (const char *name); +void grub_uboot_env_set (const char *name, const char *value); + +#endif /* ! GRUB_UBOOT_UBOOT_HEADER */ -- cgit v1.2.3