merge mainline into jail

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-09-20 22:41:59 +02:00
commit 1b71d7500b
338 changed files with 36948 additions and 4504 deletions

View file

@ -19,36 +19,20 @@
#ifndef GRUB_AT_KEYBOARD_HEADER
#define GRUB_AT_KEYBOARD_HEADER 1
#define SHIFT_L 0x2a
#define SHIFT_R 0x36
#define CTRL 0x1d
#define ALT 0x38
#define CAPS_LOCK 0x3a
#define NUM_LOCK 0x45
#define SCROLL_LOCK 0x46
/* Used for sending commands to the controller. */
#define KEYBOARD_COMMAND_ISREADY(x) !((x) & 0x02)
#define KEYBOARD_COMMAND_READ 0x20
#define KEYBOARD_COMMAND_WRITE 0x60
#define KEYBOARD_COMMAND_REBOOT 0xfe
#define KEYBOARD_SCANCODE_SET1 0x40
#define KEYBOARD_AT_TRANSLATE 0x40
#define GRUB_AT_ACK 0xfa
#define GRUB_AT_NACK 0xfe
#define GRUB_AT_TRIES 5
#define KEYBOARD_ISMAKE(x) !((x) & 0x80)
#define KEYBOARD_ISREADY(x) ((x) & 0x01)
#define KEYBOARD_SCANCODE(x) ((x) & 0x7f)
#ifdef GRUB_MACHINE_IEEE1275
#define OLPC_UP GRUB_TERM_UP
#define OLPC_DOWN GRUB_TERM_DOWN
#define OLPC_LEFT GRUB_TERM_LEFT
#define OLPC_RIGHT GRUB_TERM_RIGHT
#else
#define OLPC_UP '\0'
#define OLPC_DOWN '\0'
#define OLPC_LEFT '\0'
#define OLPC_RIGHT '\0'
#endif
#endif

View file

@ -34,17 +34,6 @@ static inline grub_err_t grub_autoefi_prepare (void)
{
return GRUB_ERR_NONE;
};
# define GRUB_AUTOEFI_MEMORY_AVAILABLE GRUB_MACHINE_MEMORY_AVAILABLE
# define GRUB_AUTOEFI_MEMORY_RESERVED GRUB_MACHINE_MEMORY_RESERVED
# ifdef GRUB_MACHINE_MEMORY_ACPI
# define GRUB_AUTOEFI_MEMORY_ACPI GRUB_MACHINE_MEMORY_ACPI
# endif
# ifdef GRUB_MACHINE_MEMORY_NVS
# define GRUB_AUTOEFI_MEMORY_NVS GRUB_MACHINE_MEMORY_NVS
# endif
# ifdef GRUB_MACHINE_MEMORY_CODE
# define GRUB_AUTOEFI_MEMORY_CODE GRUB_MACHINE_MEMORY_CODE
# endif
# define SYSTEM_TABLE_SIZEOF(x) (sizeof(grub_efi_system_table->x))
# define SYSTEM_TABLE_VAR(x) ((void *)&(grub_efi_system_table->x))
# define SYSTEM_TABLE_PTR(x) ((void *)(grub_efi_system_table->x))
@ -61,11 +50,6 @@ static inline grub_err_t grub_autoefi_prepare (void)
# define grub_autoefi_mmap_iterate grub_efiemu_mmap_iterate
# define grub_autoefi_prepare grub_efiemu_prepare
# define grub_autoefi_set_virtual_address_map grub_efiemu_set_virtual_address_map
# define GRUB_AUTOEFI_MEMORY_AVAILABLE GRUB_EFIEMU_MEMORY_AVAILABLE
# define GRUB_AUTOEFI_MEMORY_RESERVED GRUB_EFIEMU_MEMORY_RESERVED
# define GRUB_AUTOEFI_MEMORY_ACPI GRUB_EFIEMU_MEMORY_ACPI
# define GRUB_AUTOEFI_MEMORY_NVS GRUB_EFIEMU_MEMORY_NVS
# define GRUB_AUTOEFI_MEMORY_CODE GRUB_EFIEMU_MEMORY_CODE
# define SYSTEM_TABLE_SIZEOF GRUB_EFIEMU_SYSTEM_TABLE_SIZEOF
# define SYSTEM_TABLE_VAR GRUB_EFIEMU_SYSTEM_TABLE_VAR
# define SYSTEM_TABLE_PTR GRUB_EFIEMU_SYSTEM_TABLE_PTR

View file

@ -176,10 +176,12 @@ extern grub_err_t (* EXPORT_VAR(grub_disk_ata_pass_through)) (grub_disk_t,
#if defined (GRUB_UTIL) || defined (GRUB_MACHINE_EMU)
void grub_lvm_init (void);
void grub_mdraid_init (void);
void grub_mdraid09_init (void);
void grub_mdraid1x_init (void);
void grub_raid_init (void);
void grub_lvm_fini (void);
void grub_mdraid_fini (void);
void grub_mdraid09_fini (void);
void grub_mdraid1x_fini (void);
void grub_raid_fini (void);
#endif

View file

@ -287,6 +287,8 @@ typedef grub_uint64_t grub_efi_uint64_t;
typedef grub_uint8_t grub_efi_char8_t;
typedef grub_uint16_t grub_efi_char16_t;
#define PRIxGRUB_EFI_UINTN_T "lx"
typedef grub_efi_intn_t grub_efi_status_t;
#define GRUB_EFI_ERROR_CODE(value) \

View file

@ -24,16 +24,6 @@
#define GRUB_MMAP_REGISTER_BY_FIRMWARE 1
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
#define GRUB_MACHINE_MEMORY_RESERVED 2
#define GRUB_MACHINE_MEMORY_ACPI 3
#define GRUB_MACHINE_MEMORY_NVS 4
#define GRUB_MACHINE_MEMORY_CODE 5
#define GRUB_MACHINE_MEMORY_MAX_TYPE 5
/* This one is special: it's used internally but is never reported
by firmware. */
#define GRUB_MACHINE_MEMORY_HOLE 6
grub_err_t grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
grub_uint64_t,
grub_uint32_t));

View file

@ -233,11 +233,6 @@ grub_efiemu_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
int grub_efiemu_sizeof_uintn_t (void);
grub_err_t
grub_efiemu_get_lower_upper_memory (grub_uint64_t *lower, grub_uint64_t *upper);
#define GRUB_EFIEMU_MEMORY_AVAILABLE 1
#define GRUB_EFIEMU_MEMORY_RESERVED 2
#define GRUB_EFIEMU_MEMORY_ACPI 3
#define GRUB_EFIEMU_MEMORY_NVS 4
#define GRUB_EFIEMU_MEMORY_CODE 5
/* efiemu main control definitions and functions*/
typedef enum {GRUB_EFIEMU_NOTLOADED,

View file

@ -19,12 +19,15 @@
#ifndef GRUB_UTIL_GETROOT_HEADER
#define GRUB_UTIL_GETROOT_HEADER 1
#include <sys/types.h>
enum grub_dev_abstraction_types {
GRUB_DEV_ABSTRACTION_NONE,
GRUB_DEV_ABSTRACTION_LVM,
GRUB_DEV_ABSTRACTION_RAID,
};
char *grub_find_device (const char *dir, dev_t dev);
char *grub_guess_root_device (const char *dir);
int grub_util_get_dev_abstraction (const char *os_dev);
char *grub_util_get_grub_dev (const char *os_dev);

View file

@ -19,6 +19,9 @@
#ifndef GRUB_EMU_MISC_H
#define GRUB_EMU_MISC_H 1
#include <config-util.h>
#include <stdarg.h>
#include <grub/symbol.h>
#include <grub/types.h>
#include <grub/util/libzfs.h>

View file

@ -67,6 +67,7 @@ void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_error_push) (void);
int EXPORT_FUNC(grub_error_pop) (void);
void EXPORT_FUNC(grub_print_error) (void);
extern int EXPORT_VAR(grub_err_printed_errors);
int grub_err_printf (const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));

View file

@ -0,0 +1,49 @@
/* memory.h - describe the memory map */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2007,2010 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_MACHINE_LBIO_HEADER
#define _GRUB_MACHINE_LBIO_HEADER 1
struct grub_linuxbios_table_header
{
char signature[4];
grub_uint32_t size;
};
typedef struct grub_linuxbios_table_header *grub_linuxbios_table_header_t;
struct grub_linuxbios_table_item
{
#define GRUB_LINUXBIOS_MEMBER_UNUSED 0x00
#define GRUB_LINUXBIOS_MEMBER_MEMORY 0x01
#define GRUB_LINUXBIOS_MEMBER_LINK 0x11
grub_uint32_t tag;
grub_uint32_t size;
};
typedef struct grub_linuxbios_table_item *grub_linuxbios_table_item_t;
struct grub_linuxbios_mem_region
{
grub_uint64_t addr;
grub_uint64_t size;
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
grub_uint32_t type;
};
typedef struct grub_linuxbios_mem_region *mem_region_t;
#endif

View file

@ -21,11 +21,11 @@
#define _GRUB_MEMORY_MACHINE_LB_HEADER 1
#include <grub/symbol.h>
#include <grub/i386/pc/memory.h>
#ifndef ASM_FILE
#include <grub/err.h>
#include <grub/types.h>
#include <grub/memory.h>
#endif
#define GRUB_MEMORY_MACHINE_LOWER_USABLE 0x9fc00 /* 640 kiB - 1 kiB */
@ -35,36 +35,21 @@
#ifndef ASM_FILE
struct grub_linuxbios_table_header
{
char signature[4];
grub_uint32_t size;
};
typedef struct grub_linuxbios_table_header *grub_linuxbios_table_header_t;
struct grub_linuxbios_table_item
{
#define GRUB_LINUXBIOS_MEMBER_UNUSED 0x00
#define GRUB_LINUXBIOS_MEMBER_MEMORY 0x01
#define GRUB_LINUXBIOS_MEMBER_LINK 0x11
grub_uint32_t tag;
grub_uint32_t size;
};
typedef struct grub_linuxbios_table_item *grub_linuxbios_table_item_t;
struct grub_linuxbios_mem_region
{
grub_uint64_t addr;
grub_uint64_t size;
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
grub_uint32_t type;
};
typedef struct grub_linuxbios_mem_region *mem_region_t;
void grub_machine_mmap_init (void);
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
static inline grub_err_t
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
grub_uint64_t size __attribute__ ((unused)),
int type __attribute__ ((unused)),
int handle __attribute__ ((unused)))
{
return GRUB_ERR_NONE;
}
static inline grub_err_t
grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
{
return GRUB_ERR_NONE;
}
#endif

View file

@ -1 +1 @@
#include <grub/i386/pc/memory.h>
#include <grub/i386/coreboot/memory.h>

View file

@ -30,6 +30,14 @@
#ifndef ASM_FILE
#define GRUB_MMAP_MALLOC_LOW 1
#include <grub/types.h>
grub_uint64_t grub_mmap_get_upper (void);
grub_uint64_t grub_mmap_get_lower (void);
grub_uint64_t grub_mmap_get_post64 (void);
typedef grub_addr_t grub_phys_addr_t;
static inline grub_phys_addr_t

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
* Copyright (C) 2010 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
@ -16,11 +16,33 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MEMORY_MACHINE_HEADER
#define GRUB_MEMORY_MACHINE_HEADER 1
#ifndef GRUB_APM_MACHINE_HEADER
#define GRUB_APM_MACHINE_HEADER 1
#include <grub/ieee1275/ieee1275.h>
#include <grub/types.h>
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
struct grub_apm_info
{
grub_uint16_t cseg;
grub_uint32_t offset;
grub_uint16_t cseg_16;
grub_uint16_t dseg;
grub_uint16_t flags;
grub_uint16_t cseg_len;
grub_uint16_t cseg_16_len;
grub_uint16_t dseg_len;
grub_uint16_t version;
};
enum
{
GRUB_APM_FLAGS_16BITPROTECTED_SUPPORTED = 1,
GRUB_APM_FLAGS_32BITPROTECTED_SUPPORTED = 2,
GRUB_APM_FLAGS_CPUIDLE_SLOWS_DOWN = 4,
GRUB_APM_FLAGS_DISABLED = 8,
GRUB_APM_FLAGS_DISENGAGED = 16,
};
int grub_apm_get_info (struct grub_apm_info *info);
#endif

View file

@ -19,19 +19,6 @@
#ifndef GRUB_CONSOLE_MACHINE_HEADER
#define GRUB_CONSOLE_MACHINE_HEADER 1
/* Define scan codes. */
#define GRUB_CONSOLE_KEY_LEFT 0x4B00
#define GRUB_CONSOLE_KEY_RIGHT 0x4D00
#define GRUB_CONSOLE_KEY_UP 0x4800
#define GRUB_CONSOLE_KEY_DOWN 0x5000
#define GRUB_CONSOLE_KEY_IC 0x5200
#define GRUB_CONSOLE_KEY_DC 0x5300
#define GRUB_CONSOLE_KEY_BACKSPACE 0x0008
#define GRUB_CONSOLE_KEY_HOME 0x4700
#define GRUB_CONSOLE_KEY_END 0x4F00
#define GRUB_CONSOLE_KEY_NPAGE 0x5100
#define GRUB_CONSOLE_KEY_PPAGE 0x4900
#ifndef ASM_FILE
#include <grub/types.h>
@ -40,7 +27,6 @@
#include <grub/i386/vga_common.h>
/* These are global to share code between C and asm. */
int grub_console_checkkey (struct grub_term_input *term);
int grub_console_getkey (struct grub_term_input *term);
grub_uint16_t grub_console_getxy (struct grub_term_output *term);
void grub_console_gotoxy (struct grub_term_output *term,

View file

@ -20,6 +20,7 @@
#define GRUB_INTERRUPT_MACHINE_HEADER 1
#include <grub/symbol.h>
#include <grub/types.h>
struct grub_bios_int_registers
{

View file

@ -88,51 +88,9 @@ struct grub_machine_bios_data_area
grub_uint8_t unused2[0xf0 - 0x18];
};
struct grub_machine_mmap_entry
{
grub_uint32_t size;
grub_uint64_t addr;
grub_uint64_t len;
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
#define GRUB_MACHINE_MEMORY_RESERVED 2
#define GRUB_MACHINE_MEMORY_ACPI 3
#define GRUB_MACHINE_MEMORY_NVS 4
#define GRUB_MACHINE_MEMORY_MAX_TYPE 4
/* This one is special: it's used internally but is never reported
by firmware. */
#define GRUB_MACHINE_MEMORY_HOLE 5
grub_uint32_t type;
} __attribute__((packed));
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
grub_uint64_t grub_mmap_get_post64 (void);
grub_uint64_t grub_mmap_get_upper (void);
grub_uint64_t grub_mmap_get_lower (void);
#define GRUB_MMAP_MALLOC_LOW 1
#ifdef GRUB_MACHINE_PCBIOS
grub_err_t grub_machine_mmap_register (grub_uint64_t start, grub_uint64_t size,
int type, int handle);
grub_err_t grub_machine_mmap_unregister (int handle);
#else
static inline grub_err_t
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
grub_uint64_t size __attribute__ ((unused)),
int type __attribute__ ((unused)),
int handle __attribute__ ((unused)))
{
return GRUB_ERR_NONE;
}
static inline grub_err_t
grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
{
return GRUB_ERR_NONE;
}
#endif
#endif

View file

@ -209,6 +209,9 @@ grub_err_t grub_vbe_set_video_mode (grub_uint32_t mode,
grub_err_t grub_vbe_get_video_mode (grub_uint32_t *mode);
grub_err_t grub_vbe_get_video_mode_info (grub_uint32_t mode,
struct grub_vbe_mode_info_block *mode_info);
grub_vbe_status_t
grub_vbe_bios_get_pm_interface (grub_uint16_t *seg, grub_uint16_t *offset,
grub_uint16_t *length);
#endif /* ! GRUB_VBE_MACHINE_HEADER */

View file

@ -0,0 +1,19 @@
#ifndef GRUB_VESA_MODE_TABLE_HEADER
#define GRUB_VESA_MODE_TABLE_HEADER 1
#include <grub/types.h>
#define GRUB_VESA_MODE_TABLE_START 0x300
#define GRUB_VESA_MODE_TABLE_END 0x373
struct grub_vesa_mode_table_entry {
grub_uint16_t width;
grub_uint16_t height;
grub_uint8_t depth;
};
extern struct grub_vesa_mode_table_entry
grub_vesa_mode_table[GRUB_VESA_MODE_TABLE_END
- GRUB_VESA_MODE_TABLE_START + 1];
#endif

View file

@ -21,7 +21,7 @@
#define _GRUB_MEMORY_MACHINE_HEADER 1
#include <grub/symbol.h>
#include <grub/i386/pc/memory.h>
#include <grub/i386/coreboot/memory.h>
#ifndef ASM_FILE
#include <grub/err.h>
@ -37,9 +37,6 @@
void grub_machine_mmap_init (void);
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
#endif
#endif /* ! _GRUB_MEMORY_MACHINE_HEADER */

View file

@ -0,0 +1,142 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2010 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_KEYBOARD_LAYOUTS_H
#define GRUB_KEYBOARD_LAYOUTS_H 1
#define GRUB_KEYBOARD_LAYOUTS_FILEMAGIC "GRUBLAYO"
#define GRUB_KEYBOARD_LAYOUTS_FILEMAGIC_SIZE (sizeof(GRUB_KEYBOARD_LAYOUTS_FILEMAGIC) - 1)
#define GRUB_KEYBOARD_LAYOUTS_VERSION 8
#define GRUB_KEYBOARD_LAYOUTS_ARRAY_SIZE 128
struct grub_keyboard_layout
{
grub_uint32_t keyboard_map[GRUB_KEYBOARD_LAYOUTS_ARRAY_SIZE];
grub_uint32_t keyboard_map_shift[GRUB_KEYBOARD_LAYOUTS_ARRAY_SIZE];
grub_uint32_t keyboard_map_l3[GRUB_KEYBOARD_LAYOUTS_ARRAY_SIZE];
grub_uint32_t keyboard_map_shift_l3[GRUB_KEYBOARD_LAYOUTS_ARRAY_SIZE];
};
typedef enum grub_keyboard_key
{
GRUB_KEYBOARD_KEY_A = 0x04,
GRUB_KEYBOARD_KEY_B = 0x05,
GRUB_KEYBOARD_KEY_C = 0x06,
GRUB_KEYBOARD_KEY_D = 0x07,
GRUB_KEYBOARD_KEY_E = 0x08,
GRUB_KEYBOARD_KEY_F = 0x09,
GRUB_KEYBOARD_KEY_G = 0x0a,
GRUB_KEYBOARD_KEY_H = 0x0b,
GRUB_KEYBOARD_KEY_I = 0x0c,
GRUB_KEYBOARD_KEY_J = 0x0d,
GRUB_KEYBOARD_KEY_K = 0x0e,
GRUB_KEYBOARD_KEY_L = 0x0f,
GRUB_KEYBOARD_KEY_M = 0x10,
GRUB_KEYBOARD_KEY_N = 0x11,
GRUB_KEYBOARD_KEY_O = 0x12,
GRUB_KEYBOARD_KEY_P = 0x13,
GRUB_KEYBOARD_KEY_Q = 0x14,
GRUB_KEYBOARD_KEY_R = 0x15,
GRUB_KEYBOARD_KEY_S = 0x16,
GRUB_KEYBOARD_KEY_T = 0x17,
GRUB_KEYBOARD_KEY_U = 0x18,
GRUB_KEYBOARD_KEY_V = 0x19,
GRUB_KEYBOARD_KEY_W = 0x1a,
GRUB_KEYBOARD_KEY_X = 0x1b,
GRUB_KEYBOARD_KEY_Y = 0x1c,
GRUB_KEYBOARD_KEY_Z = 0x1d,
GRUB_KEYBOARD_KEY_1 = 0x1e,
GRUB_KEYBOARD_KEY_2 = 0x1f,
GRUB_KEYBOARD_KEY_3 = 0x20,
GRUB_KEYBOARD_KEY_4 = 0x21,
GRUB_KEYBOARD_KEY_5 = 0x22,
GRUB_KEYBOARD_KEY_6 = 0x23,
GRUB_KEYBOARD_KEY_7 = 0x24,
GRUB_KEYBOARD_KEY_8 = 0x25,
GRUB_KEYBOARD_KEY_9 = 0x26,
GRUB_KEYBOARD_KEY_0 = 0x27,
GRUB_KEYBOARD_KEY_ENTER = 0x28,
GRUB_KEYBOARD_KEY_ESCAPE = 0x29,
GRUB_KEYBOARD_KEY_BACKSPACE = 0x2a,
GRUB_KEYBOARD_KEY_TAB = 0x2b,
GRUB_KEYBOARD_KEY_SPACE = 0x2c,
GRUB_KEYBOARD_KEY_DASH = 0x2d,
GRUB_KEYBOARD_KEY_EQUAL = 0x2e,
GRUB_KEYBOARD_KEY_LBRACKET = 0x2f,
GRUB_KEYBOARD_KEY_RBRACKET = 0x30,
GRUB_KEYBOARD_KEY_BACKSLASH = 0x32,
GRUB_KEYBOARD_KEY_SEMICOLON = 0x33,
GRUB_KEYBOARD_KEY_DQUOTE = 0x34,
GRUB_KEYBOARD_KEY_RQUOTE = 0x35,
GRUB_KEYBOARD_KEY_COMMA = 0x36,
GRUB_KEYBOARD_KEY_DOT = 0x37,
GRUB_KEYBOARD_KEY_SLASH = 0x38,
GRUB_KEYBOARD_KEY_CAPS_LOCK = 0x39,
GRUB_KEYBOARD_KEY_F1 = 0x3a,
GRUB_KEYBOARD_KEY_F2 = 0x3b,
GRUB_KEYBOARD_KEY_F3 = 0x3c,
GRUB_KEYBOARD_KEY_F4 = 0x3d,
GRUB_KEYBOARD_KEY_F5 = 0x3e,
GRUB_KEYBOARD_KEY_F6 = 0x3f,
GRUB_KEYBOARD_KEY_F7 = 0x40,
GRUB_KEYBOARD_KEY_F8 = 0x41,
GRUB_KEYBOARD_KEY_F9 = 0x42,
GRUB_KEYBOARD_KEY_F10 = 0x43,
GRUB_KEYBOARD_KEY_F11 = 0x44,
GRUB_KEYBOARD_KEY_F12 = 0x45,
GRUB_KEYBOARD_KEY_SCROLL_LOCK = 0x47,
GRUB_KEYBOARD_KEY_INSERT = 0x49,
GRUB_KEYBOARD_KEY_HOME = 0x4a,
GRUB_KEYBOARD_KEY_PPAGE = 0x4b,
GRUB_KEYBOARD_KEY_DELETE = 0x4c,
GRUB_KEYBOARD_KEY_END = 0x4d,
GRUB_KEYBOARD_KEY_NPAGE = 0x4e,
GRUB_KEYBOARD_KEY_RIGHT = 0x4f,
GRUB_KEYBOARD_KEY_LEFT = 0x50,
GRUB_KEYBOARD_KEY_DOWN = 0x51,
GRUB_KEYBOARD_KEY_UP = 0x52,
GRUB_KEYBOARD_KEY_NUM_LOCK = 0x53,
GRUB_KEYBOARD_KEY_NUMSLASH = 0x54,
GRUB_KEYBOARD_KEY_NUMMUL = 0x55,
GRUB_KEYBOARD_KEY_NUMMINUS = 0x56,
GRUB_KEYBOARD_KEY_NUMPLUS = 0x57,
GRUB_KEYBOARD_KEY_NUMENTER = 0x58,
GRUB_KEYBOARD_KEY_NUM1 = 0x59,
GRUB_KEYBOARD_KEY_NUM2 = 0x5a,
GRUB_KEYBOARD_KEY_NUM3 = 0x5b,
GRUB_KEYBOARD_KEY_NUM4 = 0x5c,
GRUB_KEYBOARD_KEY_NUM5 = 0x5d,
GRUB_KEYBOARD_KEY_NUM6 = 0x5e,
GRUB_KEYBOARD_KEY_NUM7 = 0x5f,
GRUB_KEYBOARD_KEY_NUM8 = 0x60,
GRUB_KEYBOARD_KEY_NUM9 = 0x61,
GRUB_KEYBOARD_KEY_NUM0 = 0x62,
GRUB_KEYBOARD_KEY_NUMDOT = 0x63,
GRUB_KEYBOARD_KEY_102ND = 0x64,
GRUB_KEYBOARD_KEY_LEFT_CTRL = 0xe0,
GRUB_KEYBOARD_KEY_LEFT_SHIFT = 0xe1,
GRUB_KEYBOARD_KEY_LEFT_ALT = 0xe2,
GRUB_KEYBOARD_KEY_RIGHT_CTRL = 0xe4,
GRUB_KEYBOARD_KEY_RIGHT_SHIFT = 0xe5,
GRUB_KEYBOARD_KEY_RIGHT_ALT = 0xe6,
} grub_keyboard_key_t;
unsigned EXPORT_FUNC(grub_term_map_key) (grub_keyboard_key_t code, int status);
#endif /* GRUB_KEYBOARD_LAYOUTS */

View file

@ -1,4 +1,3 @@
/* crc.h - prototypes for crc */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
@ -17,9 +16,12 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_CRC_H
#define GRUB_CRC_H 1
#ifndef GRUB_LEGACY_PARSE_HEADER
#define GRUB_LEGACY_PARSE_HEADER 1
grub_uint32_t grub_getcrc32 (grub_uint32_t crc, void *buf, int size);
#include <grub/types.h>
#endif /* ! GRUB_CRC_H */
char *grub_legacy_parse (const char *buf, char **entryname, char **suffix);
char *grub_legacy_escape (const char *in, grub_size_t len);
#endif

View file

@ -16,7 +16,8 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
/* We need to include config-util.h.in for HAVE_*. */
#include <config-util.h>
/* On x86 these functions aren't really needed. Save some space. */
#if !defined (__i386__) && !defined (__x86_64__)

View file

@ -26,16 +26,16 @@
#include <grub/types.h>
/* Check if a loader is loaded. */
int grub_loader_is_loaded (void);
int EXPORT_FUNC (grub_loader_is_loaded) (void);
/* Set loader functions. NORETURN must be set to true, if BOOT won't return
to the original state. */
void grub_loader_set (grub_err_t (*boot) (void),
grub_err_t (*unload) (void),
int noreturn);
void EXPORT_FUNC (grub_loader_set) (grub_err_t (*boot) (void),
grub_err_t (*unload) (void),
int noreturn);
/* Unset current loader, if any. */
void grub_loader_unset (void);
void EXPORT_FUNC (grub_loader_unset) (void);
/* Call the boot hook in current loader. This may or may not return,
depending on the setting by grub_loader_set. */
@ -56,7 +56,7 @@ typedef enum {
} grub_loader_preboot_hook_prio_t;
/* Register a preboot hook. */
void *grub_loader_register_preboot_hook (grub_err_t (*preboot_func) (int noret),
void *EXPORT_FUNC(grub_loader_register_preboot_hook) (grub_err_t (*preboot_func) (int noret),
grub_err_t (*preboot_rest_func) (void),
grub_loader_preboot_hook_prio_t prio);

View file

@ -22,11 +22,32 @@
#include <grub/types.h>
#include <grub/err.h>
#include <grub/machine/memory.h>
grub_err_t grub_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
grub_uint64_t,
grub_uint32_t));
typedef enum grub_memory_type
{
GRUB_MEMORY_AVAILABLE = 1,
GRUB_MEMORY_RESERVED = 2,
GRUB_MEMORY_ACPI = 3,
GRUB_MEMORY_NVS = 4,
GRUB_MEMORY_BADRAM = 5,
GRUB_MEMORY_CODE = 20,
/* This one is special: it's used internally but is never reported
by firmware. */
GRUB_MEMORY_HOLE = 21
} grub_memory_type_t;
typedef int NESTED_FUNC_ATTR (*grub_memory_hook_t) (grub_uint64_t,
grub_uint64_t,
grub_memory_type_t);
grub_err_t grub_mmap_iterate (grub_memory_hook_t hook);
#if !defined (GRUB_MACHINE_EMU) && !defined (GRUB_MACHINE_EFI)
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate) (grub_memory_hook_t hook);
#else
grub_err_t grub_machine_mmap_iterate (grub_memory_hook_t hook);
#endif
int grub_mmap_register (grub_uint64_t start, grub_uint64_t size, int type);
grub_err_t grub_mmap_unregister (int handle);
@ -42,7 +63,7 @@ struct grub_mmap_region
struct grub_mmap_region *next;
grub_uint64_t start;
grub_uint64_t end;
int type;
grub_memory_type_t type;
int handle;
};

View file

@ -28,8 +28,6 @@
#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x80f00000
#define GRUB_MACHINE_MEMORY_USABLE 0x81000000
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
#ifndef ASM_FILE
grub_err_t EXPORT_FUNC (grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));

View file

@ -31,13 +31,6 @@
#define GRUB_ARCH_LOWMEMMAXSIZE 0x10000000
#define GRUB_ARCH_HIGHMEMPSTART 0x10000000
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
#define GRUB_MACHINE_MEMORY_MAX_TYPE 1
/* This one is special: it's used internally but is never reported
by firmware. */
#define GRUB_MACHINE_MEMORY_HOLE 2
#define GRUB_MACHINE_MEMORY_RESERVED GRUB_MACHINE_MEMORY_HOLE
#ifndef ASM_FILE
typedef grub_addr_t grub_phys_addr_t;

View file

@ -270,11 +270,11 @@ void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
grub_uint32_t d, grub_uint32_t *r);
#if defined(NEED_ENABLE_EXECUTE_STACK) && !defined(GRUB_UTIL)
#if NEED_ENABLE_EXECUTE_STACK && !defined(GRUB_UTIL)
void EXPORT_FUNC(__enable_execute_stack) (void *addr);
#endif
#if defined (NEED_REGISTER_FRAME_INFO) && !defined(GRUB_UTIL)
#if NEED_REGISTER_FRAME_INFO && !defined(GRUB_UTIL)
void EXPORT_FUNC (__register_frame_info) (void);
void EXPORT_FUNC (__deregister_frame_info) (void);
#endif

View file

@ -22,6 +22,8 @@
#include <grub/symbol.h>
#include <grub/types.h>
#include <grub/err.h>
#include <grub/disk.h>
#include <grub/partition.h>
/* The signature. */
#define GRUB_PC_PARTITION_SIGNATURE 0xaa55
@ -114,4 +116,9 @@ grub_msdos_partition_is_extended (int type)
|| type == GRUB_PC_PARTITION_TYPE_LINUX_EXTENDED);
}
grub_err_t
grub_partition_msdos_iterate (grub_disk_t disk,
int (*hook) (grub_disk_t disk,
const grub_partition_t partition));
#endif /* ! GRUB_PC_PARTITION_HEADER */

View file

@ -56,8 +56,10 @@ grub_err_t grub_multiboot_set_video_mode (void);
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
#include <grub/i386/pc/vbe.h>
#define GRUB_MACHINE_HAS_VGA_TEXT 1
#define GRUB_MACHINE_HAS_VBE 1
#else
#define GRUB_MACHINE_HAS_VGA_TEXT 0
#define GRUB_MACHINE_HAS_VBE 0
#endif
#define GRUB_MULTIBOOT_CONSOLE_EGA_TEXT 1

View file

@ -110,11 +110,21 @@ void read_terminal_list (const char *prefix);
void grub_set_more (int onoff);
int grub_normal_get_char_counter (void);
void grub_normal_reset_more (void);
void grub_xputs_normal (const char *str);
extern int grub_jail_level;
grub_err_t
grub_normal_add_menu_entry (int argc, const char **args, char **classes,
const char *users, const char *hotkey,
const char *prefix, const char *sourcecode);
grub_err_t
grub_normal_set_password (const char *user, const char *password);
void grub_normal_auth_init (void);
void grub_normal_auth_fini (void);
#endif /* ! GRUB_NORMAL_HEADER */

View file

@ -150,22 +150,22 @@
rewrite grub-mkimage to generate valid ELF files. */
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_GAP 0x8000
#ifdef MACHINE
#ifdef GRUB_MACHINE
#define GRUB_OFFSETS_CONCAT_(a,b,c) a ## b ## c
#define GRUB_OFFSETS_CONCAT(a,b,c) GRUB_OFFSETS_CONCAT_(a,b,c)
#define GRUB_KERNEL_MACHINE_MOD_ALIGN GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _MOD_ALIGN)
#define GRUB_KERNEL_MACHINE_MOD_GAP GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _MOD_GAP)
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _TOTAL_MODULE_SIZE)
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _KERNEL_IMAGE_SIZE)
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _COMPRESSED_SIZE)
#define GRUB_KERNEL_MACHINE_MOD_ALIGN GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _MOD_ALIGN)
#define GRUB_KERNEL_MACHINE_MOD_GAP GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _MOD_GAP)
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _TOTAL_MODULE_SIZE)
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _KERNEL_IMAGE_SIZE)
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _COMPRESSED_SIZE)
#define GRUB_KERNEL_MACHINE_PREFIX GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _PREFIX)
#define GRUB_KERNEL_MACHINE_PREFIX_END GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _PREFIX_END)
#define GRUB_BOOT_MACHINE_KERNEL_SEG GRUB_OFFSETS_CONCAT (GRUB_BOOT_, MACHINE, _KERNEL_SEG)
#define GRUB_MEMORY_MACHINE_UPPER GRUB_OFFSETS_CONCAT (GRUB_MEMORY_, MACHINE, _UPPER)
#define GRUB_KERNEL_MACHINE_RAW_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _RAW_SIZE)
#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _INSTALL_BSD_PART)
#define GRUB_KERNEL_MACHINE_INSTALL_DOS_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _INSTALL_DOS_PART)
#define GRUB_KERNEL_MACHINE_PREFIX GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _PREFIX)
#define GRUB_KERNEL_MACHINE_PREFIX_END GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _PREFIX_END)
#define GRUB_BOOT_MACHINE_KERNEL_SEG GRUB_OFFSETS_CONCAT (GRUB_BOOT_, GRUB_MACHINE, _KERNEL_SEG)
#define GRUB_MEMORY_MACHINE_UPPER GRUB_OFFSETS_CONCAT (GRUB_MEMORY_, GRUB_MACHINE, _UPPER)
#define GRUB_KERNEL_MACHINE_RAW_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _RAW_SIZE)
#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _INSTALL_BSD_PART)
#define GRUB_KERNEL_MACHINE_INSTALL_DOS_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _INSTALL_DOS_PART)
#endif
#ifndef ASM_FILE

View file

@ -77,6 +77,10 @@ struct grub_partition
/* The type partition map. */
grub_partition_map_t partmap;
/* The type of partition whne it's on MSDOS.
Used for embedding detection. */
grub_uint8_t msdostype;
};
grub_partition_t EXPORT_FUNC(grub_partition_probe) (struct grub_disk *disk,

View file

@ -1,26 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 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_MEMORY_MACHINE_HEADER
#define GRUB_MEMORY_MACHINE_HEADER 1
#include <grub/ieee1275/ieee1275.h>
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
#endif

View file

@ -25,7 +25,7 @@
#define LOCAL(sym) L_ ## sym
/* Add an underscore to a C symbol in assembler code if needed. */
#ifdef HAVE_ASM_USCORE
#if HAVE_ASM_USCORE
# define EXT_C(sym) _ ## sym
#else
# define EXT_C(sym) sym

View file

@ -19,19 +19,45 @@
#ifndef GRUB_TERM_HEADER
#define GRUB_TERM_HEADER 1
#define GRUB_TERM_NO_KEY 0
/* Internal codes used by GRUB to represent terminal input. */
#define GRUB_TERM_LEFT 2
#define GRUB_TERM_RIGHT 6
#define GRUB_TERM_UP 16
#define GRUB_TERM_DOWN 14
#define GRUB_TERM_HOME 1
#define GRUB_TERM_END 5
#define GRUB_TERM_DC 4
#define GRUB_TERM_PPAGE 7
#define GRUB_TERM_NPAGE 3
/* Only for keys otherwise not having shifted modification. */
#define GRUB_TERM_SHIFT 0x01000000
#define GRUB_TERM_CTRL 0x02000000
#define GRUB_TERM_ALT 0x04000000
/* Keys without associated character. */
#define GRUB_TERM_EXTENDED 0x00800000
#define GRUB_TERM_KEY_MASK 0x00ffffff
#define GRUB_TERM_KEY_LEFT (GRUB_TERM_EXTENDED | 0x4b)
#define GRUB_TERM_KEY_RIGHT (GRUB_TERM_EXTENDED | 0x4d)
#define GRUB_TERM_KEY_UP (GRUB_TERM_EXTENDED | 0x48)
#define GRUB_TERM_KEY_DOWN (GRUB_TERM_EXTENDED | 0x50)
#define GRUB_TERM_KEY_HOME (GRUB_TERM_EXTENDED | 0x47)
#define GRUB_TERM_KEY_END (GRUB_TERM_EXTENDED | 0x4f)
#define GRUB_TERM_KEY_DC (GRUB_TERM_EXTENDED | 0x53)
#define GRUB_TERM_KEY_PPAGE (GRUB_TERM_EXTENDED | 0x49)
#define GRUB_TERM_KEY_NPAGE (GRUB_TERM_EXTENDED | 0x51)
#define GRUB_TERM_KEY_F1 (GRUB_TERM_EXTENDED | 0x3b)
#define GRUB_TERM_KEY_F2 (GRUB_TERM_EXTENDED | 0x3c)
#define GRUB_TERM_KEY_F3 (GRUB_TERM_EXTENDED | 0x3d)
#define GRUB_TERM_KEY_F4 (GRUB_TERM_EXTENDED | 0x3e)
#define GRUB_TERM_KEY_F5 (GRUB_TERM_EXTENDED | 0x3f)
#define GRUB_TERM_KEY_F6 (GRUB_TERM_EXTENDED | 0x40)
#define GRUB_TERM_KEY_F7 (GRUB_TERM_EXTENDED | 0x41)
#define GRUB_TERM_KEY_F8 (GRUB_TERM_EXTENDED | 0x42)
#define GRUB_TERM_KEY_F9 (GRUB_TERM_EXTENDED | 0x43)
#define GRUB_TERM_KEY_F10 (GRUB_TERM_EXTENDED | 0x44)
#define GRUB_TERM_KEY_F11 (GRUB_TERM_EXTENDED | 0x57)
#define GRUB_TERM_KEY_F12 (GRUB_TERM_EXTENDED | 0x58)
#define GRUB_TERM_KEY_INSERT (GRUB_TERM_EXTENDED | 0x52)
#define GRUB_TERM_KEY_CENTER (GRUB_TERM_EXTENDED | 0x4c)
#define GRUB_TERM_ESC '\e'
#define GRUB_TERM_TAB '\t'
#define GRUB_TERM_BACKSPACE 8
#define GRUB_TERM_BACKSPACE '\b'
#ifndef ASM_FILE
@ -86,9 +112,15 @@ grub_term_color_state;
/* Bitmasks for modifier keys returned by grub_getkeystatus. */
#define GRUB_TERM_STATUS_SHIFT (1 << 0)
#define GRUB_TERM_STATUS_CTRL (1 << 1)
#define GRUB_TERM_STATUS_ALT (1 << 2)
#define GRUB_TERM_STATUS_RSHIFT (1 << 0)
#define GRUB_TERM_STATUS_LSHIFT (1 << 1)
#define GRUB_TERM_STATUS_RCTRL (1 << 2)
#define GRUB_TERM_STATUS_RALT (1 << 3)
#define GRUB_TERM_STATUS_SCROLL (1 << 4)
#define GRUB_TERM_STATUS_NUM (1 << 5)
#define GRUB_TERM_STATUS_CAPS (1 << 6)
#define GRUB_TERM_STATUS_LCTRL (1 << 8)
#define GRUB_TERM_STATUS_LALT (1 << 9)
/* Menu-related geometrical constants. */
@ -128,10 +160,7 @@ struct grub_term_input
/* Clean up the terminal. */
grub_err_t (*fini) (struct grub_term_input *term);
/* Check if any input character is available. */
int (*checkkey) (struct grub_term_input *term);
/* Get a character. */
/* Get a character if any input character is available. Otherwise return -1 */
int (*getkey) (struct grub_term_input *term);
/* Get keyboard modifier status. */
@ -279,7 +308,6 @@ grub_term_unregister_output (grub_term_output_t term)
void grub_putcode (grub_uint32_t code, struct grub_term_output *term);
int EXPORT_FUNC(grub_getkey) (void);
int EXPORT_FUNC(grub_checkkey) (void);
int EXPORT_FUNC(grub_getkeystatus) (void);
void grub_cls (void);
void EXPORT_FUNC(grub_refresh) (void);
void grub_puts_terminal (const char *str, struct grub_term_output *term);
@ -461,8 +489,8 @@ grub_print_spaces (struct grub_term_output *term, int number_spaces)
extern void (*EXPORT_VAR (grub_term_poll_usb)) (void);
/* For convenience. */
#define GRUB_TERM_ASCII_CHAR(c) ((c) & 0xff)
#define GRUB_TERM_REPEAT_PRE_INTERVAL 400
#define GRUB_TERM_REPEAT_INTERVAL 50
#endif /* ! ASM_FILE */

View file

@ -49,6 +49,8 @@ struct grub_terminfo_output_state
char *cursor_off;
char *setcolor;
unsigned int width, height;
unsigned int xpos, ypos;
void (*put) (struct grub_term_output *term, const int c);
@ -64,11 +66,12 @@ void EXPORT_FUNC (grub_terminfo_setcolorstate) (struct grub_term_output *term,
const grub_term_color_state state);
int EXPORT_FUNC (grub_terminfo_checkkey) (struct grub_term_input *term);
grub_err_t EXPORT_FUNC (grub_terminfo_input_init) (struct grub_term_input *term);
int EXPORT_FUNC (grub_terminfo_getkey) (struct grub_term_input *term);
void EXPORT_FUNC (grub_terminfo_putchar) (struct grub_term_output *term,
const struct grub_unicode_glyph *c);
grub_uint16_t EXPORT_FUNC (grub_terminfo_getwh) (struct grub_term_output *term);
grub_err_t EXPORT_FUNC (grub_terminfo_output_register) (struct grub_term_output *term,
const char *type);

View file

@ -101,8 +101,10 @@ typedef grub_int64_t grub_ssize_t;
# if GRUB_CPU_SIZEOF_LONG == 8
# define PRIxGRUB_SIZE "lx"
# define PRIuGRUB_SIZE "lu"
# else
# define PRIxGRUB_SIZE "llx"
# define PRIuGRUB_SIZE "llu"
# endif
#else
typedef grub_uint32_t grub_addr_t;
@ -110,6 +112,7 @@ typedef grub_uint32_t grub_size_t;
typedef grub_int32_t grub_ssize_t;
# define PRIxGRUB_SIZE "x"
# define PRIuGRUB_SIZE "u"
#endif
#if GRUB_CPU_SIZEOF_LONG == 8

View file

@ -30,6 +30,7 @@ typedef struct grub_usb_controller_dev *grub_usb_controller_dev_t;
typedef enum
{
GRUB_USB_ERR_NONE,
GRUB_USB_ERR_WAIT,
GRUB_USB_ERR_INTERNAL,
GRUB_USB_ERR_STALL,
GRUB_USB_ERR_DATA,
@ -48,14 +49,6 @@ typedef enum
GRUB_USB_SPEED_HIGH
} grub_usb_speed_t;
enum
{
GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT = 0x21,
GRUB_USB_REQTYPE_VENDOR_OUT = 0x40,
GRUB_USB_REQTYPE_CLASS_INTERFACE_IN = 0xa1,
GRUB_USB_REQTYPE_VENDOR_IN = 0xc0
};
/* Call HOOK with each device, until HOOK returns non-zero. */
int grub_usb_iterate (int (*hook) (grub_usb_device_t dev));
@ -97,6 +90,7 @@ grub_usb_err_t
grub_usb_root_hub (grub_usb_controller_t controller);
/* XXX: All handled by libusb for now. */
struct grub_usb_controller_dev
{
@ -105,9 +99,15 @@ struct grub_usb_controller_dev
int (*iterate) (int (*hook) (grub_usb_controller_t dev));
grub_usb_err_t (*transfer) (grub_usb_controller_t dev,
grub_usb_transfer_t transfer,
int timeout, grub_size_t *actual);
grub_usb_err_t (*setup_transfer) (grub_usb_controller_t dev,
grub_usb_transfer_t transfer);
grub_usb_err_t (*check_transfer) (grub_usb_controller_t dev,
grub_usb_transfer_t transfer,
grub_size_t *actual);
grub_usb_err_t (*cancel_transfer) (grub_usb_controller_t dev,
grub_usb_transfer_t transfer);
int (*hubports) (grub_usb_controller_t dev);
@ -116,6 +116,9 @@ struct grub_usb_controller_dev
grub_usb_speed_t (*detect_dev) (grub_usb_controller_t dev, int port, int *changed);
/* Per controller flag - port reset pending, don't do another reset */
grub_uint64_t pending_reset;
/* The next host controller. */
struct grub_usb_controller_dev *next;
};
@ -181,11 +184,19 @@ struct grub_usb_device
/* Used by libusb wrapper. Schedulded for removal. */
void *data;
/* Hub information. */
/* Array of children for a hub. */
grub_usb_device_t *children;
/* Number of hub ports. */
unsigned nports;
grub_usb_transfer_t hub_transfer;
grub_uint32_t statuschange;
struct grub_usb_desc_endp *hub_endpoint;
};
@ -266,5 +277,12 @@ grub_usb_err_t
grub_usb_bulk_read_extended (grub_usb_device_t dev,
int endpoint, grub_size_t size, char *data,
int timeout, grub_size_t *actual);
grub_usb_transfer_t
grub_usb_bulk_read_background (grub_usb_device_t dev,
int endpoint, grub_size_t size, void *data);
grub_usb_err_t
grub_usb_check_transfer (grub_usb_transfer_t trans, grub_size_t *actual);
void
grub_usb_cancel_transfer (grub_usb_transfer_t trans);
#endif /* GRUB_USB_H */

View file

@ -56,51 +56,89 @@ struct grub_usb_transfer
grub_transaction_type_t type;
grub_transfer_type_t dir;
struct grub_usb_device *dev;
struct grub_usb_transaction *transactions;
int last_trans;
/* Index of last processed transaction in OHCI/UHCI driver. */
void *controller_data;
/* Used when finishing transfer to copy data back. */
struct grub_pci_dma_chunk *data_chunk;
void *data;
};
typedef struct grub_usb_transfer *grub_usb_transfer_t;
#define GRUB_USB_REQTYPE_IN (1 << 7)
#define GRUB_USB_REQTYPE_OUT (0 << 7)
#define GRUB_USB_REQTYPE_STANDARD (0 << 5)
#define GRUB_USB_REQTYPE_CLASS (1 << 5)
#define GRUB_USB_REQTYPE_VENDOR (2 << 5)
#define GRUB_USB_REQTYPE_TARGET_DEV (0 << 0)
#define GRUB_USB_REQTYPE_TARGET_INTERF (1 << 0)
#define GRUB_USB_REQTYPE_TARGET_ENDP (2 << 0)
#define GRUB_USB_REQTYPE_TARGET_OTHER (3 << 0)
#define GRUB_USB_REQ_GET_STATUS 0x00
#define GRUB_USB_REQ_CLEAR_FEATURE 0x01
#define GRUB_USB_REQ_SET_FEATURE 0x03
#define GRUB_USB_REQ_SET_ADDRESS 0x05
#define GRUB_USB_REQ_GET_DESCRIPTOR 0x06
#define GRUB_USB_REQ_SET_DESCRIPTOR 0x07
#define GRUB_USB_REQ_GET_CONFIGURATION 0x08
#define GRUB_USB_REQ_SET_CONFIGURATION 0x09
#define GRUB_USB_REQ_GET_INTERFACE 0x0A
#define GRUB_USB_REQ_SET_INTERFACE 0x0B
#define GRUB_USB_REQ_SYNC_FRAME 0x0C
enum
{
GRUB_USB_REQTYPE_TARGET_DEV = (0 << 0),
GRUB_USB_REQTYPE_TARGET_INTERF = (1 << 0),
GRUB_USB_REQTYPE_TARGET_ENDP = (2 << 0),
GRUB_USB_REQTYPE_TARGET_OTHER = (3 << 0),
GRUB_USB_REQTYPE_STANDARD = (0 << 5),
GRUB_USB_REQTYPE_CLASS = (1 << 5),
GRUB_USB_REQTYPE_VENDOR = (2 << 5),
GRUB_USB_REQTYPE_OUT = (0 << 7),
GRUB_USB_REQTYPE_IN = (1 << 7),
GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT = GRUB_USB_REQTYPE_TARGET_INTERF
| GRUB_USB_REQTYPE_CLASS | GRUB_USB_REQTYPE_OUT,
GRUB_USB_REQTYPE_VENDOR_OUT = GRUB_USB_REQTYPE_VENDOR | GRUB_USB_REQTYPE_OUT,
GRUB_USB_REQTYPE_CLASS_INTERFACE_IN = GRUB_USB_REQTYPE_TARGET_INTERF
| GRUB_USB_REQTYPE_CLASS | GRUB_USB_REQTYPE_IN,
GRUB_USB_REQTYPE_VENDOR_IN = GRUB_USB_REQTYPE_VENDOR | GRUB_USB_REQTYPE_IN
};
enum
{
GRUB_USB_REQ_GET_STATUS = 0x00,
GRUB_USB_REQ_CLEAR_FEATURE = 0x01,
GRUB_USB_REQ_SET_FEATURE = 0x03,
GRUB_USB_REQ_SET_ADDRESS = 0x05,
GRUB_USB_REQ_GET_DESCRIPTOR = 0x06,
GRUB_USB_REQ_SET_DESCRIPTOR = 0x07,
GRUB_USB_REQ_GET_CONFIGURATION = 0x08,
GRUB_USB_REQ_SET_CONFIGURATION = 0x09,
GRUB_USB_REQ_GET_INTERFACE = 0x0A,
GRUB_USB_REQ_SET_INTERFACE = 0x0B,
GRUB_USB_REQ_SYNC_FRAME = 0x0C
};
#define GRUB_USB_FEATURE_ENDP_HALT 0x00
#define GRUB_USB_FEATURE_DEV_REMOTE_WU 0x01
#define GRUB_USB_FEATURE_TEST_MODE 0x02
#define GRUB_USB_HUB_FEATURE_PORT_RESET 0x04
#define GRUB_USB_HUB_FEATURE_PORT_POWER 0x08
#define GRUB_USB_HUB_FEATURE_C_CONNECTED 0x10
enum
{
GRUB_USB_HUB_FEATURE_PORT_RESET = 0x04,
GRUB_USB_HUB_FEATURE_PORT_POWER = 0x08,
GRUB_USB_HUB_FEATURE_C_PORT_CONNECTED = 0x10,
GRUB_USB_HUB_FEATURE_C_PORT_ENABLED = 0x11,
GRUB_USB_HUB_FEATURE_C_PORT_SUSPEND = 0x12,
GRUB_USB_HUB_FEATURE_C_PORT_OVERCURRENT = 0x13,
GRUB_USB_HUB_FEATURE_C_PORT_RESET = 0x14
};
#define GRUB_USB_HUB_STATUS_CONNECTED (1 << 0)
#define GRUB_USB_HUB_STATUS_LOWSPEED (1 << 9)
#define GRUB_USB_HUB_STATUS_HIGHSPEED (1 << 10)
#define GRUB_USB_HUB_STATUS_C_CONNECTED (1 << 16)
#define GRUB_USB_HUB_STATUS_C_PORT_RESET (1 << 20)
enum
{
GRUB_USB_HUB_STATUS_PORT_CONNECTED = (1 << 0),
GRUB_USB_HUB_STATUS_PORT_ENABLED = (1 << 1),
GRUB_USB_HUB_STATUS_PORT_SUSPEND = (1 << 2),
GRUB_USB_HUB_STATUS_PORT_OVERCURRENT = (1 << 3),
GRUB_USB_HUB_STATUS_PORT_POWERED = (1 << 8),
GRUB_USB_HUB_STATUS_PORT_LOWSPEED = (1 << 9),
GRUB_USB_HUB_STATUS_PORT_HIGHSPEED = (1 << 10),
GRUB_USB_HUB_STATUS_C_PORT_CONNECTED = (1 << 16),
GRUB_USB_HUB_STATUS_C_PORT_ENABLED = (1 << 17),
GRUB_USB_HUB_STATUS_C_PORT_SUSPEND = (1 << 18),
GRUB_USB_HUB_STATUS_C_PORT_OVERCURRENT = (1 << 19),
GRUB_USB_HUB_STATUS_C_PORT_RESET = (1 << 20)
};
struct grub_usb_packet_setup
{

View file

@ -254,6 +254,20 @@ struct multiboot_mod_list
};
typedef struct multiboot_mod_list multiboot_module_t;
/* APM BIOS info. */
struct multiboot_apm_info
{
grub_uint16_t version;
grub_uint16_t cseg;
grub_uint32_t offset;
grub_uint16_t cseg_16;
grub_uint16_t dseg;
grub_uint16_t flags;
grub_uint16_t cseg_len;
grub_uint16_t cseg_16_len;
grub_uint16_t dseg_len;
};
#endif /* ! ASM_FILE */
#endif /* ! MULTIBOOT_HEADER */