1
/* uboot.h - declare variables and functions for U-Boot support */
3
* GRUB -- GRand Unified Bootloader
4
* Copyright (C) 2013 Free Software Foundation, Inc.
6
* GRUB is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* GRUB is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
20
#ifndef GRUB_UBOOT_UBOOT_HEADER
21
#define GRUB_UBOOT_UBOOT_HEADER 1
23
#include <grub/types.h>
27
void grub_uboot_mm_init (void);
28
void grub_uboot_init (void);
29
void grub_uboot_fini (void);
31
void grub_uboot_return (int) __attribute__ ((noreturn));
33
grub_addr_t grub_uboot_get_real_bss_start (void);
35
grub_err_t grub_uboot_probe_hardware (void);
37
extern grub_addr_t EXPORT_VAR (start_of_ram);
39
grub_uint32_t EXPORT_FUNC (grub_uboot_get_machine_type) (void);
40
grub_addr_t EXPORT_FUNC (grub_uboot_get_boot_data) (void);
44
* The U-Boot API operates through a "syscall" interface, consisting of an
45
* entry point address and a set of syscall numbers. The location of this
46
* entry point is described in a structure allocated on the U-Boot heap.
47
* We scan through a defined region around the hint address passed to us
51
#define UBOOT_API_SEARCH_LEN (3 * 1024 * 1024)
52
int grub_uboot_api_init (void);
55
* All functions below are wrappers around the uboot_syscall() function,
56
* implemented in grub-core/kern/uboot/uboot.c
59
int grub_uboot_getc (void);
60
int grub_uboot_tstc (void);
61
void grub_uboot_putc (int c);
62
void grub_uboot_puts (const char *s);
64
void EXPORT_FUNC (grub_uboot_reset) (void);
66
struct sys_info *grub_uboot_get_sys_info (void);
68
void grub_uboot_udelay (grub_uint32_t usec);
69
grub_uint32_t grub_uboot_get_timer (grub_uint32_t base);
71
int EXPORT_FUNC (grub_uboot_dev_enum) (void);
72
struct device_info * EXPORT_FUNC (grub_uboot_dev_get) (int index);
73
int EXPORT_FUNC (grub_uboot_dev_open) (struct device_info *dev);
74
int EXPORT_FUNC (grub_uboot_dev_close) (struct device_info *dev);
75
int grub_uboot_dev_write (struct device_info *dev, void *buf, int *len);
76
int grub_uboot_dev_read (struct device_info *dev, void *buf, grub_size_t blocks,
77
grub_uint32_t start, grub_size_t * real_blocks);
78
int EXPORT_FUNC (grub_uboot_dev_recv) (struct device_info *dev, void *buf,
79
int size, int *real_size);
80
int EXPORT_FUNC (grub_uboot_dev_send) (struct device_info *dev, void *buf,
83
char *grub_uboot_env_get (const char *name);
84
void grub_uboot_env_set (const char *name, const char *value);
86
#endif /* ! GRUB_UBOOT_UBOOT_HEADER */