Initial import of Leif's work
This commit is contained in:
parent
21026747df
commit
389b31cd71
65 changed files with 7311 additions and 13 deletions
26
include/grub/arm/efi/loader.h
Normal file
26
include/grub/arm/efi/loader.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_LOADER_MACHINE_HEADER
|
||||
#define GRUB_LOADER_MACHINE_HEADER 1
|
||||
|
||||
grub_err_t EXPORT_FUNC (grub_efi_prepare_platform) (void);
|
||||
void * EXPORT_FUNC (grub_efi_allocate_loader_memory) (grub_uint32_t min_offset,
|
||||
grub_uint32_t size);
|
||||
|
||||
#endif /* ! GRUB_LOADER_MACHINE_HEADER */
|
1
include/grub/arm/efi/memory.h
Normal file
1
include/grub/arm/efi/memory.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/efi/memory.h>
|
59
include/grub/arm/linux.h
Normal file
59
include/grub/arm/linux.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/* linux.h - ARM linux specific definitions */
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_LINUX_CPU_HEADER
|
||||
#define GRUB_LINUX_CPU_HEADER 1
|
||||
|
||||
#define LINUX_ZIMAGE_OFFSET 0x24
|
||||
#define LINUX_ZIMAGE_MAGIC 0x016f2818
|
||||
|
||||
#define ARM_FDT_MACHINE_TYPE 0xFFFFFFFF
|
||||
|
||||
#if defined GRUB_MACHINE_UBOOT
|
||||
# include <grub/uboot/uboot.h>
|
||||
# define LINUX_ADDRESS (start_of_ram + 0x8000)
|
||||
# define LINUX_INITRD_ADDRESS (start_of_ram + 0x02000000)
|
||||
# define LINUX_FDT_ADDRESS (LINUX_INITRD_ADDRESS - 0x10000)
|
||||
# define firmware_get_boot_data uboot_get_boot_data
|
||||
# define firmware_get_machine_type uboot_get_machine_type
|
||||
#elif defined GRUB_MACHINE_EFI
|
||||
# include <grub/efi/efi.h>
|
||||
# include <grub/machine/loader.h>
|
||||
/* On UEFI platforms - load the images at the lowest available address not
|
||||
less than *_PHYS_OFFSET from the first available memory location. */
|
||||
# define LINUX_PHYS_OFFSET (0x00008000)
|
||||
# define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)
|
||||
# define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000)
|
||||
static inline grub_addr_t
|
||||
firmware_get_boot_data (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline grub_uint32_t
|
||||
firmware_get_machine_type (void)
|
||||
{
|
||||
return ARM_FDT_MACHINE_TYPE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define FDT_ADDITIONAL_ENTRIES_SIZE 0x300
|
||||
|
||||
typedef void (*kernel_entry_t) (int, unsigned long, void *);
|
||||
|
||||
#endif /* ! GRUB_LINUX_CPU_HEADER */
|
7
include/grub/arm/system.h
Normal file
7
include/grub/arm/system.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef GRUB_SYSTEM_CPU_HEADER
|
||||
#define GRUB_SYSTEM_CPU_HEADER
|
||||
|
||||
void grub_arm_disable_caches_mmu (void);
|
||||
|
||||
#endif /* ! GRUB_SYSTEM_CPU_HEADER */
|
||||
|
29
include/grub/arm/time.h
Normal file
29
include/grub/arm/time.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KERNEL_CPU_TIME_HEADER
|
||||
#define KERNEL_CPU_TIME_HEADER 1
|
||||
|
||||
static __inline void
|
||||
grub_cpu_idle (void)
|
||||
{
|
||||
/* FIXME: this can't work until we handle interrupts. */
|
||||
/* __asm__ __volatile__ ("wfi"); */
|
||||
}
|
||||
|
||||
#endif /* ! KERNEL_CPU_TIME_HEADER */
|
34
include/grub/arm/types.h
Normal file
34
include/grub/arm/types.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_TYPES_CPU_HEADER
|
||||
#define GRUB_TYPES_CPU_HEADER 1
|
||||
|
||||
/* The size of void *. */
|
||||
#define GRUB_TARGET_SIZEOF_VOID_P 4
|
||||
|
||||
/* The size of long. */
|
||||
#define GRUB_TARGET_SIZEOF_LONG 4
|
||||
|
||||
/* currently only support little-endian. */
|
||||
#undef GRUB_TARGET_WORDS_BIGENDIAN
|
||||
|
||||
/* Unaligned accesses only supported if MMU enabled */
|
||||
//#define GRUB_HAVE_UNALIGNED_ACCESS 1
|
||||
|
||||
#endif /* ! GRUB_TYPES_CPU_HEADER */
|
32
include/grub/arm/uboot/kernel.h
Normal file
32
include/grub/arm/uboot/kernel.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_KERNEL_MACHINE_HEADER
|
||||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#define GRUB_KERNEL_MACHINE_STACK_SIZE 0x40000
|
||||
#define GRUB_KERNEL_MACHINE_HEAP_SIZE (grub_size_t) (2 * 1024 * 1024)
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
|
@ -44,6 +44,7 @@ enum grub_disk_dev_id
|
|||
GRUB_DISK_DEVICE_ARCDISK_ID,
|
||||
GRUB_DISK_DEVICE_HOSTDISK_ID,
|
||||
GRUB_DISK_DEVICE_PROCFS_ID,
|
||||
GRUB_DISK_DEVICE_UBOOTDISK_ID,
|
||||
};
|
||||
|
||||
struct grub_disk;
|
||||
|
|
|
@ -63,9 +63,10 @@ struct grub_pe32_coff_header
|
|||
grub_uint16_t characteristics;
|
||||
};
|
||||
|
||||
#define GRUB_PE32_MACHINE_I386 0x14c
|
||||
#define GRUB_PE32_MACHINE_IA64 0x200
|
||||
#define GRUB_PE32_MACHINE_X86_64 0x8664
|
||||
#define GRUB_PE32_MACHINE_I386 0x14c
|
||||
#define GRUB_PE32_MACHINE_IA64 0x200
|
||||
#define GRUB_PE32_MACHINE_X86_64 0x8664
|
||||
#define GRUB_PE32_MACHINE_ARMTHUMB_MIXED 0x01c2
|
||||
|
||||
#define GRUB_PE32_RELOCS_STRIPPED 0x0001
|
||||
#define GRUB_PE32_EXECUTABLE_IMAGE 0x0002
|
||||
|
@ -276,8 +277,10 @@ struct grub_pe32_fixup_block
|
|||
#define GRUB_PE32_REL_BASED_HIGHLOW 3
|
||||
#define GRUB_PE32_REL_BASED_HIGHADJ 4
|
||||
#define GRUB_PE32_REL_BASED_MIPS_JMPADDR 5
|
||||
#define GRUB_PE32_REL_BASED_ARM_MOV32A 5
|
||||
#define GRUB_PE32_REL_BASED_SECTION 6
|
||||
#define GRUB_PE32_REL_BASED_REL 7
|
||||
#define GRUB_PE32_REL_BASED_ARM_MOV32T 7
|
||||
#define GRUB_PE32_REL_BASED_IA64_IMM64 9
|
||||
#define GRUB_PE32_REL_BASED_DIR64 10
|
||||
#define GRUB_PE32_REL_BASED_HIGH3ADJ 11
|
||||
|
|
|
@ -78,7 +78,7 @@ struct grub_module_info64
|
|||
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) \
|
||||
|| defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) \
|
||||
|| defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_ARC) \
|
||||
|| defined (__sparc__)
|
||||
|| defined (__sparc__) || defined (GRUB_MACHINE_UBOOT)
|
||||
/* FIXME: stack is between 2 heap regions. Move it. */
|
||||
#define GRUB_KERNEL_PRELOAD_SPACE_REUSABLE 1
|
||||
#endif
|
||||
|
|
|
@ -112,3 +112,14 @@ void EXPORT_FUNC (_savegpr_29) (void);
|
|||
void EXPORT_FUNC (_savegpr_30) (void);
|
||||
void EXPORT_FUNC (_savegpr_31) (void);
|
||||
#endif
|
||||
|
||||
#if defined (__arm__)
|
||||
void EXPORT_FUNC (__aeabi_idiv) (void);
|
||||
void EXPORT_FUNC (__aeabi_idivmod) (void);
|
||||
void EXPORT_FUNC (__aeabi_lasr) (void);
|
||||
void EXPORT_FUNC (__aeabi_llsl) (void);
|
||||
void EXPORT_FUNC (__aeabi_llsr) (void);
|
||||
void EXPORT_FUNC (__aeabi_uidiv) (void);
|
||||
void EXPORT_FUNC (__aeabi_uidivmod) (void);
|
||||
void EXPORT_FUNC (__wrap___clear_cache) (void *, void *);
|
||||
#endif
|
||||
|
|
|
@ -103,6 +103,7 @@
|
|||
#define GRUB_KERNEL_I386_IEEE1275_MOD_GAP 0x0
|
||||
#define GRUB_KERNEL_I386_COREBOOT_MOD_GAP 0x0
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_MOD_GAP 0x0
|
||||
#define GRUB_KERNEL_ARM_UBOOT_MOD_GAP 0x0
|
||||
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_MOD_ALIGN 0x1
|
||||
|
@ -111,6 +112,10 @@
|
|||
#define GRUB_KERNEL_MIPS_ARC_MOD_ALIGN 0x1
|
||||
#define GRUB_KERNEL_MIPS_QEMU_MIPS_MOD_ALIGN 0x1
|
||||
|
||||
#define GRUB_KERNEL_ARM_UBOOT_MOD_ALIGN 0x8
|
||||
#define GRUB_KERNEL_ARM_UBOOT_TOTAL_MODULE_SIZE 0x4
|
||||
#define GRUB_KERNEL_ARM_UBOOT_LINK_ADDR 0x08000000
|
||||
|
||||
/* Minimal gap between _end and the start of the modules. It's a hack
|
||||
for PowerMac to prevent "CLAIM failed" error. The real fix is to
|
||||
rewrite grub-mkimage to generate valid ELF files. */
|
||||
|
|
|
@ -29,7 +29,11 @@
|
|||
|
||||
#if HAVE_ASM_USCORE
|
||||
#ifdef ASM_FILE
|
||||
# define EXT_C(sym) _ ## sym
|
||||
# ifndef (__arm__)
|
||||
# define EXT_C(sym) _ ## sym
|
||||
# else
|
||||
# define EXT_C(sym) % ## sym
|
||||
# endif
|
||||
#else
|
||||
# define EXT_C(sym) "_" sym
|
||||
#endif
|
||||
|
|
184
include/grub/uboot/api_public.h
Normal file
184
include/grub/uboot/api_public.h
Normal file
|
@ -0,0 +1,184 @@
|
|||
/*
|
||||
* (C) Copyright 2007-2008 Semihalf
|
||||
*
|
||||
* Written by: Rafal Jaworowski <raj@semihalf.com>
|
||||
*
|
||||
* This file is dual licensed; you can use it under the terms of
|
||||
* either the GPL, or the BSD license, at your option.
|
||||
*
|
||||
* I. GPL:
|
||||
*
|
||||
* This file 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 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This file 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Alternatively,
|
||||
*
|
||||
* II. BSD license:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _API_PUBLIC_H_
|
||||
#define _API_PUBLIC_H_
|
||||
|
||||
#define API_EINVAL 1 /* invalid argument(s) */
|
||||
#define API_ENODEV 2 /* no device */
|
||||
#define API_ENOMEM 3 /* no memory */
|
||||
#define API_EBUSY 4 /* busy, occupied etc. */
|
||||
#define API_EIO 5 /* I/O error */
|
||||
#define API_ESYSC 6 /* syscall error */
|
||||
|
||||
typedef int (*scp_t) (int, int *, ...);
|
||||
|
||||
typedef grub_uint16_t uint16_t;
|
||||
typedef grub_uint32_t uint32_t;
|
||||
|
||||
#define API_SIG_VERSION 1
|
||||
#define API_SIG_MAGIC "UBootAPI"
|
||||
#define API_SIG_MAGLEN 8
|
||||
|
||||
struct api_signature
|
||||
{
|
||||
char magic[API_SIG_MAGLEN]; /* magic string */
|
||||
uint16_t version; /* API version */
|
||||
uint32_t checksum; /* checksum of this sig struct */
|
||||
scp_t syscall; /* entry point to the API */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
API_RSVD = 0,
|
||||
API_GETC,
|
||||
API_PUTC,
|
||||
API_TSTC,
|
||||
API_PUTS,
|
||||
API_RESET,
|
||||
API_GET_SYS_INFO,
|
||||
API_UDELAY,
|
||||
API_GET_TIMER,
|
||||
API_DEV_ENUM,
|
||||
API_DEV_OPEN,
|
||||
API_DEV_CLOSE,
|
||||
API_DEV_READ,
|
||||
API_DEV_WRITE,
|
||||
API_ENV_ENUM,
|
||||
API_ENV_GET,
|
||||
API_ENV_SET,
|
||||
API_DISPLAY_GET_INFO,
|
||||
API_DISPLAY_DRAW_BITMAP,
|
||||
API_DISPLAY_CLEAR,
|
||||
API_MAXCALL
|
||||
};
|
||||
|
||||
#define MR_ATTR_FLASH 0x0001
|
||||
#define MR_ATTR_DRAM 0x0002
|
||||
#define MR_ATTR_SRAM 0x0003
|
||||
#define MR_ATTR_MASK 0x000f
|
||||
|
||||
struct mem_region
|
||||
{
|
||||
unsigned long start;
|
||||
unsigned long size;
|
||||
int flags;
|
||||
};
|
||||
|
||||
struct sys_info
|
||||
{
|
||||
unsigned long clk_bus;
|
||||
unsigned long clk_cpu;
|
||||
unsigned long bar;
|
||||
struct mem_region *mr;
|
||||
int mr_no; /* number of memory regions */
|
||||
};
|
||||
|
||||
#undef CONFIG_SYS_64BIT_LBA
|
||||
#ifdef CONFIG_SYS_64BIT_LBA
|
||||
typedef u_int64_t lbasize_t;
|
||||
#else
|
||||
typedef unsigned long lbasize_t;
|
||||
#endif
|
||||
typedef unsigned long lbastart_t;
|
||||
|
||||
#define DEV_TYP_NONE 0x0000
|
||||
#define DEV_TYP_NET 0x0001
|
||||
|
||||
#define DEV_TYP_STOR 0x0002
|
||||
#define DT_STOR_IDE 0x0010
|
||||
#define DT_STOR_SCSI 0x0020
|
||||
#define DT_STOR_USB 0x0040
|
||||
#define DT_STOR_MMC 0x0080
|
||||
#define DT_STOR_SATA 0x0100
|
||||
|
||||
#define DEV_STA_CLOSED 0x0000 /* invalid, closed */
|
||||
#define DEV_STA_OPEN 0x0001 /* open i.e. active */
|
||||
|
||||
struct device_info
|
||||
{
|
||||
int type;
|
||||
void *cookie;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
lbasize_t block_count; /* no of blocks */
|
||||
unsigned long block_size; /* size of one block */
|
||||
} storage;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned char hwaddr[6];
|
||||
} net;
|
||||
} info;
|
||||
#define di_stor info.storage
|
||||
#define di_net info.net
|
||||
|
||||
int state;
|
||||
};
|
||||
|
||||
#define DISPLAY_TYPE_LCD 0x0001
|
||||
#define DISPLAY_TYPE_VIDEO 0x0002
|
||||
|
||||
struct display_info
|
||||
{
|
||||
int type;
|
||||
/* screen size in pixels */
|
||||
int pixel_width;
|
||||
int pixel_height;
|
||||
/* screen size in rows and columns of text */
|
||||
int screen_rows;
|
||||
int screen_cols;
|
||||
};
|
||||
|
||||
#endif /* _API_PUBLIC_H_ */
|
29
include/grub/uboot/console.h
Normal file
29
include/grub/uboot/console.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_CONSOLE_MACHINE_HEADER
|
||||
#define GRUB_CONSOLE_MACHINE_HEADER 1
|
||||
|
||||
/* Initialize the console system. */
|
||||
void grub_console_init_early (void);
|
||||
void grub_console_init_lately (void);
|
||||
|
||||
/* Exit the console system. */
|
||||
void grub_console_fini (void);
|
||||
|
||||
#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */
|
44
include/grub/uboot/disk.h
Normal file
44
include/grub/uboot/disk.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_UBOOT_DISK_HEADER
|
||||
#define GRUB_UBOOT_DISK_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/uboot/uboot.h>
|
||||
|
||||
void grub_ubootdisk_init (void);
|
||||
void grub_ubootdisk_fini (void);
|
||||
|
||||
enum disktype
|
||||
{ cd, fd, hd };
|
||||
|
||||
struct ubootdisk_data
|
||||
{
|
||||
struct ubootdisk_data *next;
|
||||
void *cookie;
|
||||
int handle;
|
||||
int opencount;
|
||||
enum disktype type;
|
||||
grub_uint32_t block_size;
|
||||
};
|
||||
|
||||
grub_err_t grub_ubootdisk_register (struct device_info *newdev, int handle);
|
||||
|
||||
#endif /* ! GRUB_UBOOT_DISK_HEADER */
|
150
include/grub/uboot/uboot.h
Normal file
150
include/grub/uboot/uboot.h
Normal file
|
@ -0,0 +1,150 @@
|
|||
/* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_UBOOT_UBOOT_HEADER
|
||||
#define GRUB_UBOOT_UBOOT_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/dl.h>
|
||||
|
||||
/* Functions. */
|
||||
void grub_uboot_mm_init (void);
|
||||
void grub_uboot_init (void);
|
||||
void grub_uboot_fini (void);
|
||||
|
||||
void uboot_return (int) __attribute__ ((noreturn));
|
||||
|
||||
grub_addr_t 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 (uboot_get_machine_type) (void);
|
||||
grub_addr_t EXPORT_FUNC (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.
|
||||
*/
|
||||
#include <grub/uboot/api_public.h>
|
||||
|
||||
#define UBOOT_API_SEARCH_LEN (3 * 1024 * 1024)
|
||||
int uboot_api_init (void);
|
||||
|
||||
/* All functions below are wrappers around the uboot_syscall() function */
|
||||
|
||||
/*
|
||||
* int API_getc(int *c)
|
||||
*/
|
||||
int uboot_getc (void);
|
||||
|
||||
/*
|
||||
* int API_tstc(int *c)
|
||||
*/
|
||||
int uboot_tstc (void);
|
||||
|
||||
/*
|
||||
* int API_putc(char *ch)
|
||||
*/
|
||||
void uboot_putc (int c);
|
||||
|
||||
/*
|
||||
* int API_puts(const char *s)
|
||||
*/
|
||||
void uboot_puts (const char *s);
|
||||
|
||||
/*
|
||||
* int API_reset(void)
|
||||
*/
|
||||
void EXPORT_FUNC (uboot_reset) (void);
|
||||
|
||||
/*
|
||||
* int API_get_sys_info(struct sys_info *si)
|
||||
*
|
||||
* fill out the sys_info struct containing selected parameters about the
|
||||
* machine
|
||||
*/
|
||||
struct sys_info *uboot_get_sys_info (void);
|
||||
|
||||
/*
|
||||
* int API_udelay(unsigned long *udelay)
|
||||
*/
|
||||
void uboot_udelay (grub_uint32_t usec);
|
||||
|
||||
/*
|
||||
* int API_get_timer(unsigned long *current, unsigned long *base)
|
||||
*/
|
||||
grub_uint32_t uboot_get_timer (grub_uint32_t base);
|
||||
|
||||
/*
|
||||
* int API_dev_enum(struct device_info *)
|
||||
*/
|
||||
int uboot_dev_enum (void);
|
||||
|
||||
struct device_info *uboot_dev_get (int handle);
|
||||
|
||||
/*
|
||||
* int API_dev_open(struct device_info *)
|
||||
*/
|
||||
int uboot_dev_open (int handle);
|
||||
|
||||
/*
|
||||
* int API_dev_close(struct device_info *)
|
||||
*/
|
||||
int uboot_dev_close (int handle);
|
||||
|
||||
/*
|
||||
* Notice: this is for sending network packets only, as U-Boot does not
|
||||
* support writing to storage at the moment (12.2007)
|
||||
*
|
||||
* int API_dev_write(struct device_info *di, void *buf, int *len)
|
||||
*/
|
||||
int uboot_dev_write (int handle, void *buf, int *len);
|
||||
|
||||
/*
|
||||
* int API_dev_read(
|
||||
* struct device_info *di,
|
||||
* void *buf,
|
||||
* size_t *len,
|
||||
* unsigned long *start
|
||||
* size_t *act_len
|
||||
* )
|
||||
*/
|
||||
int uboot_dev_read (int handle, void *buf, lbasize_t blocks,
|
||||
lbastart_t start, lbasize_t * real_blocks);
|
||||
|
||||
int uboot_dev_recv (int handle, void *buf, int size, int *real_size);
|
||||
int uboot_dev_send (int handle, void *buf, int size);
|
||||
|
||||
/*
|
||||
* int API_env_get(const char *name, char **value)
|
||||
*/
|
||||
char *uboot_env_get (const char *name);
|
||||
|
||||
/*
|
||||
* int API_env_set(const char *name, const char *value)
|
||||
*/
|
||||
void uboot_env_set (const char *name, const char *value);
|
||||
|
||||
#endif /* ! GRUB_UBOOT_UBOOT_HEADER */
|
Loading…
Add table
Add a link
Reference in a new issue