merge mainline to ia64
This commit is contained in:
commit
0f35c665e6
595 changed files with 62746 additions and 9109 deletions
|
@ -19,8 +19,10 @@
|
|||
#ifndef GRUB_ACPI_HEADER
|
||||
#define GRUB_ACPI_HEADER 1
|
||||
|
||||
#ifndef GRUB_DSDT_TEST
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#endif
|
||||
|
||||
struct grub_acpi_rsdp_v10
|
||||
{
|
||||
|
@ -60,10 +62,12 @@ struct grub_acpi_fadt
|
|||
struct grub_acpi_table_header hdr;
|
||||
grub_uint32_t facs_addr;
|
||||
grub_uint32_t dsdt_addr;
|
||||
grub_uint8_t somefields1[88];
|
||||
grub_uint8_t somefields1[20];
|
||||
grub_uint32_t pm1a;
|
||||
grub_uint8_t somefields2[64];
|
||||
grub_uint64_t facs_xaddr;
|
||||
grub_uint64_t dsdt_xaddr;
|
||||
grub_uint8_t somefields2[96];
|
||||
grub_uint8_t somefields3[96];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define GRUB_ACPI_MADT_SIGNATURE "APIC"
|
||||
|
@ -137,6 +141,7 @@ enum
|
|||
GRUB_ACPI_MADT_ENTRY_SAPIC_FLAGS_ENABLED = 1
|
||||
};
|
||||
|
||||
#ifndef GRUB_DSDT_TEST
|
||||
struct grub_acpi_rsdp_v10 *grub_acpi_get_rsdpv1 (void);
|
||||
struct grub_acpi_rsdp_v20 *grub_acpi_get_rsdpv2 (void);
|
||||
struct grub_acpi_rsdp_v10 *grub_machine_acpi_get_rsdpv1 (void);
|
||||
|
@ -145,4 +150,27 @@ grub_uint8_t grub_byte_checksum (void *base, grub_size_t size);
|
|||
|
||||
grub_err_t grub_acpi_create_ebda (void);
|
||||
|
||||
void grub_acpi_halt (void);
|
||||
#endif
|
||||
|
||||
#define GRUB_ACPI_SLP_EN (1 << 13)
|
||||
#define GRUB_ACPI_SLP_TYP_OFFSET 10
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_ACPI_OPCODE_ZERO = 0, GRUB_ACPI_OPCODE_ONE = 1,
|
||||
GRUB_ACPI_OPCODE_NAME = 8, GRUB_ACPI_OPCODE_BYTE_CONST = 0x0a,
|
||||
GRUB_ACPI_OPCODE_WORD_CONST = 0x0b, GRUB_ACPI_OPCODE_DWORD_CONST = 0x0c,
|
||||
GRUB_ACPI_OPCODE_SCOPE = 0x10, GRUB_ACPI_OPCODE_PACKAGE = 0x12,
|
||||
GRUB_ACPI_OPCODE_METHOD = 0x14, GRUB_ACPI_OPCODE_EXTOP = 0x5b,
|
||||
GRUB_ACPI_OPCODE_IF = 0xa0, GRUB_ACPI_OPCODE_ONES = 0xff
|
||||
};
|
||||
enum
|
||||
{
|
||||
GRUB_ACPI_EXTOPCODE_MUTEX = 0x01,
|
||||
GRUB_ACPI_EXTOPCODE_OPERATION_REGION = 0x80,
|
||||
GRUB_ACPI_EXTOPCODE_FIELD_OP = 0x81,
|
||||
GRUB_ACPI_EXTOPCODE_INDEX_FIELD_OP = 0x86,
|
||||
};
|
||||
|
||||
#endif /* ! GRUB_ACPI_HEADER */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
#ifdef _mips
|
||||
#include <grub/mips/cache.h>
|
||||
#endif
|
||||
|
||||
#if defined (__i386__) || defined (__x86_64__)
|
||||
static inline void
|
||||
grub_arch_sync_caches (void *address __attribute__ ((unused)),
|
||||
|
|
|
@ -97,12 +97,19 @@ grub_utf16_to_utf8 (grub_uint8_t *dest, grub_uint16_t *src,
|
|||
/* Error... */
|
||||
*dest++ = '?';
|
||||
}
|
||||
else
|
||||
else if (code < 0x10000)
|
||||
{
|
||||
*dest++ = (code >> 12) | 0xE0;
|
||||
*dest++ = ((code >> 6) & 0x3F) | 0x80;
|
||||
*dest++ = (code & 0x3F) | 0x80;
|
||||
}
|
||||
else
|
||||
{
|
||||
*dest++ = (code >> 18) | 0xF0;
|
||||
*dest++ = ((code >> 12) & 0x3F) | 0x80;
|
||||
*dest++ = ((code >> 6) & 0x3F) | 0x80;
|
||||
*dest++ = (code & 0x3F) | 0x80;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,20 +23,21 @@
|
|||
#include <grub/err.h>
|
||||
#include <grub/list.h>
|
||||
|
||||
/* Can be run in the command-line. */
|
||||
#define GRUB_COMMAND_FLAG_CMDLINE 0x1
|
||||
/* Can be run in the menu. */
|
||||
#define GRUB_COMMAND_FLAG_MENU 0x2
|
||||
/* Can be run in both interfaces. */
|
||||
#define GRUB_COMMAND_FLAG_BOTH 0x3
|
||||
/* Only for the command title. */
|
||||
#define GRUB_COMMAND_FLAG_TITLE 0x4
|
||||
/* Don't print the command on booting. */
|
||||
#define GRUB_COMMAND_FLAG_NO_ECHO 0x8
|
||||
/* This is an extended command. */
|
||||
#define GRUB_COMMAND_FLAG_EXTCMD 0x10
|
||||
/* This is an dynamic command. */
|
||||
#define GRUB_COMMAND_FLAG_DYNCMD 0x20
|
||||
typedef enum grub_command_flags
|
||||
{
|
||||
/* This is an extended command. */
|
||||
GRUB_COMMAND_FLAG_EXTCMD = 0x10,
|
||||
/* This is an dynamic command. */
|
||||
GRUB_COMMAND_FLAG_DYNCMD = 0x20,
|
||||
/* This command accepts block arguments. */
|
||||
GRUB_COMMAND_FLAG_BLOCKS = 0x40,
|
||||
/* This command accepts unknown arguments as direct parameters. */
|
||||
GRUB_COMMAND_ACCEPT_DASH = 0x80,
|
||||
/* This command accepts only options preceding direct arguments. */
|
||||
GRUB_COMMAND_OPTIONS_AT_START = 0x100,
|
||||
/* Can be executed in an entries extractor. */
|
||||
GRUB_COMMAND_FLAG_EXTRACTOR = 0x200
|
||||
} grub_command_flags_t;
|
||||
|
||||
struct grub_command;
|
||||
|
||||
|
@ -59,7 +60,7 @@ struct grub_command
|
|||
grub_command_func_t func;
|
||||
|
||||
/* The flags. */
|
||||
unsigned flags;
|
||||
grub_command_flags_t flags;
|
||||
|
||||
/* The summary of the command usage. */
|
||||
const char *summary;
|
||||
|
|
|
@ -243,10 +243,12 @@ extern gcry_md_spec_t _gcry_digest_spec_md5;
|
|||
extern gcry_md_spec_t _gcry_digest_spec_sha1;
|
||||
extern gcry_md_spec_t _gcry_digest_spec_sha256;
|
||||
extern gcry_md_spec_t _gcry_digest_spec_sha512;
|
||||
extern gcry_md_spec_t _gcry_digest_spec_crc32;
|
||||
#define GRUB_MD_MD5 ((const gcry_md_spec_t *) &_gcry_digest_spec_md5)
|
||||
#define GRUB_MD_SHA1 ((const gcry_md_spec_t *) &_gcry_digest_spec_sha1)
|
||||
#define GRUB_MD_SHA256 ((const gcry_md_spec_t *) &_gcry_digest_spec_sha256)
|
||||
#define GRUB_MD_SHA512 ((const gcry_md_spec_t *) &_gcry_digest_spec_sha512)
|
||||
#define GRUB_MD_CRC32 ((const gcry_md_spec_t *) &_gcry_digest_spec_crc32)
|
||||
|
||||
/* Implement PKCS#5 PBKDF2 as per RFC 2898. The PRF to use is HMAC variant
|
||||
of digest supplied by MD. Inputs are the password P of length PLEN,
|
||||
|
|
|
@ -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,19 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MEMORY_MACHINE_HEADER
|
||||
#define GRUB_MEMORY_MACHINE_HEADER 1
|
||||
#ifndef GRUB_DECOMPRESSOR_HEADER
|
||||
#define GRUB_DECOMPRESSOR_HEADER 1
|
||||
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
void
|
||||
grub_decompress_core (void *src, void *dst, unsigned long srcsize,
|
||||
unsigned long dstsize);
|
||||
|
||||
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
|
||||
void
|
||||
find_scratch (void *src, void *dst, unsigned long srcsize,
|
||||
unsigned long dstsize);
|
||||
|
||||
#define GRUB_DECOMPRESSOR_DICT_SIZE (1 << 16)
|
||||
|
||||
extern void *grub_decompressor_scratch;
|
||||
|
||||
#endif
|
|
@ -78,6 +78,7 @@ struct grub_disk_dev
|
|||
|
||||
#ifdef GRUB_UTIL
|
||||
struct grub_disk_memberlist *(*memberlist) (struct grub_disk *disk);
|
||||
const char * (*raidname) (struct grub_disk *disk);
|
||||
#endif
|
||||
|
||||
/* The next disk device. */
|
||||
|
@ -99,9 +100,6 @@ struct grub_disk
|
|||
/* The total number of sectors. */
|
||||
grub_uint64_t total_sectors;
|
||||
|
||||
/* If partitions can be stored. */
|
||||
int has_partitions;
|
||||
|
||||
/* The id used by the disk cache manager. */
|
||||
unsigned long id;
|
||||
|
||||
|
@ -177,4 +175,15 @@ struct grub_disk_ata_pass_through_parms
|
|||
extern grub_err_t (* EXPORT_VAR(grub_disk_ata_pass_through)) (grub_disk_t,
|
||||
struct grub_disk_ata_pass_through_parms *);
|
||||
|
||||
#if defined (GRUB_UTIL) || defined (GRUB_MACHINE_EMU)
|
||||
void grub_lvm_init (void);
|
||||
void grub_mdraid09_init (void);
|
||||
void grub_mdraid1x_init (void);
|
||||
void grub_raid_init (void);
|
||||
void grub_lvm_fini (void);
|
||||
void grub_mdraid09_fini (void);
|
||||
void grub_mdraid1x_fini (void);
|
||||
void grub_raid_fini (void);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_DISK_HEADER */
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -46,12 +46,12 @@ grub_elf_t grub_elf_file (grub_file_t);
|
|||
grub_err_t grub_elf_close (grub_elf_t);
|
||||
|
||||
int grub_elf_is_elf32 (grub_elf_t);
|
||||
grub_size_t grub_elf32_size (grub_elf_t, Elf32_Addr *);
|
||||
grub_size_t grub_elf32_size (grub_elf_t, Elf32_Addr *, grub_uint32_t *);
|
||||
grub_err_t grub_elf32_load (grub_elf_t, grub_elf32_load_hook_t, grub_addr_t *,
|
||||
grub_size_t *);
|
||||
|
||||
int grub_elf_is_elf64 (grub_elf_t);
|
||||
grub_size_t grub_elf64_size (grub_elf_t, Elf64_Addr *);
|
||||
grub_size_t grub_elf64_size (grub_elf_t, Elf64_Addr *, grub_uint64_t *);
|
||||
grub_err_t grub_elf64_load (grub_elf_t, grub_elf64_load_hook_t, grub_addr_t *,
|
||||
grub_size_t *);
|
||||
grub_err_t
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -26,5 +26,7 @@ void grub_util_biosdisk_init (const char *dev_map);
|
|||
void grub_util_biosdisk_fini (void);
|
||||
char *grub_util_biosdisk_get_grub_dev (const char *os_dev);
|
||||
const char *grub_util_biosdisk_get_osdev (grub_disk_t disk);
|
||||
int grub_util_biosdisk_is_present (const char *name);
|
||||
int grub_util_biosdisk_is_floppy (grub_disk_t disk);
|
||||
|
||||
#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */
|
||||
|
|
|
@ -19,9 +19,11 @@
|
|||
#ifndef GRUB_EMU_MISC_H
|
||||
#define GRUB_EMU_MISC_H 1
|
||||
|
||||
#include <config.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/util/libzfs.h>
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# include <sys/fcntl.h>
|
||||
|
@ -32,9 +34,9 @@
|
|||
|
||||
#ifdef __NetBSD__
|
||||
/* NetBSD uses /boot for its boot block. */
|
||||
# define DEFAULT_DIRECTORY "/grub"
|
||||
# define DEFAULT_DIRECTORY "/"GRUB_DIR_NAME
|
||||
#else
|
||||
# define DEFAULT_DIRECTORY "/boot/grub"
|
||||
# define DEFAULT_DIRECTORY "/"GRUB_BOOT_DIR_NAME"/"GRUB_DIR_NAME
|
||||
#endif
|
||||
|
||||
#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
|
||||
|
@ -45,6 +47,7 @@ extern const char *program_name;
|
|||
void grub_emu_init (void);
|
||||
void grub_init_all (void);
|
||||
void grub_fini_all (void);
|
||||
void grub_emu_post_init (void);
|
||||
|
||||
void grub_find_zpool_from_dir (const char *dir,
|
||||
char **poolname, char **poolfs);
|
||||
|
@ -75,6 +78,4 @@ extern char * canonicalize_file_name (const char *path);
|
|||
int grub_device_mapper_supported (void);
|
||||
#endif
|
||||
|
||||
libzfs_handle_t *grub_get_libzfs_handle (void);
|
||||
|
||||
#endif /* GRUB_EMU_MISC_H */
|
||||
|
|
|
@ -51,7 +51,7 @@ grub_err_t EXPORT_FUNC(grub_register_variable_hook) (const char *name,
|
|||
grub_env_read_hook_t read_hook,
|
||||
grub_env_write_hook_t write_hook);
|
||||
|
||||
grub_err_t grub_env_context_open (int export);
|
||||
grub_err_t grub_env_context_open (void);
|
||||
grub_err_t grub_env_context_close (void);
|
||||
grub_err_t grub_env_export (const char *name);
|
||||
|
||||
|
@ -59,4 +59,11 @@ void grub_env_unset_menu (void);
|
|||
grub_menu_t grub_env_get_menu (void);
|
||||
void grub_env_set_menu (grub_menu_t nmenu);
|
||||
|
||||
grub_err_t
|
||||
grub_env_extractor_open (int source);
|
||||
|
||||
grub_err_t
|
||||
grub_env_extractor_close (int source);
|
||||
|
||||
|
||||
#endif /* ! GRUB_ENV_HEADER */
|
||||
|
|
|
@ -50,11 +50,12 @@ typedef enum
|
|||
GRUB_ERR_BAD_FONT,
|
||||
GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
GRUB_ERR_SYMLINK_LOOP,
|
||||
GRUB_ERR_BAD_GZIP_DATA,
|
||||
GRUB_ERR_BAD_COMPRESSED_DATA,
|
||||
GRUB_ERR_MENU,
|
||||
GRUB_ERR_TIMEOUT,
|
||||
GRUB_ERR_IO,
|
||||
GRUB_ERR_ACCESS_DENIED
|
||||
GRUB_ERR_ACCESS_DENIED,
|
||||
GRUB_ERR_EXTRACTOR
|
||||
}
|
||||
grub_err_t;
|
||||
|
||||
|
@ -66,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)));
|
||||
|
||||
|
|
|
@ -21,10 +21,12 @@
|
|||
|
||||
#include <grub/lib/arg.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/script_sh.h>
|
||||
|
||||
struct grub_extcmd;
|
||||
struct grub_extcmd_context;
|
||||
|
||||
typedef grub_err_t (*grub_extcmd_func_t) (struct grub_extcmd *cmd,
|
||||
typedef grub_err_t (*grub_extcmd_func_t) (struct grub_extcmd_context *ctxt,
|
||||
int argc, char **args);
|
||||
|
||||
/* The argcmd description. */
|
||||
|
@ -38,18 +40,40 @@ struct grub_extcmd
|
|||
const struct grub_arg_option *options;
|
||||
|
||||
void *data;
|
||||
|
||||
struct grub_arg_list *state;
|
||||
};
|
||||
typedef struct grub_extcmd *grub_extcmd_t;
|
||||
|
||||
grub_extcmd_t grub_register_extcmd (const char *name,
|
||||
grub_extcmd_func_t func,
|
||||
unsigned flags,
|
||||
const char *summary,
|
||||
const char *description,
|
||||
const struct grub_arg_option *parser);
|
||||
/* Command context for each instance of execution. */
|
||||
struct grub_extcmd_context
|
||||
{
|
||||
struct grub_extcmd *extcmd;
|
||||
|
||||
void grub_unregister_extcmd (grub_extcmd_t cmd);
|
||||
struct grub_arg_list *state;
|
||||
|
||||
/* Script parameter, if any. */
|
||||
struct grub_script *script;
|
||||
};
|
||||
typedef struct grub_extcmd_context *grub_extcmd_context_t;
|
||||
|
||||
grub_extcmd_t EXPORT_FUNC(grub_register_extcmd) (const char *name,
|
||||
grub_extcmd_func_t func,
|
||||
grub_command_flags_t flags,
|
||||
const char *summary,
|
||||
const char *description,
|
||||
const struct grub_arg_option *parser);
|
||||
|
||||
grub_extcmd_t EXPORT_FUNC(grub_register_extcmd_prio) (const char *name,
|
||||
grub_extcmd_func_t func,
|
||||
grub_command_flags_t flags,
|
||||
const char *summary,
|
||||
const char *description,
|
||||
const struct grub_arg_option *parser,
|
||||
int prio);
|
||||
|
||||
void EXPORT_FUNC(grub_unregister_extcmd) (grub_extcmd_t cmd);
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_extcmd_dispatcher) (struct grub_command *cmd,
|
||||
int argc, char **args,
|
||||
struct grub_script *script);
|
||||
|
||||
#endif /* ! GRUB_EXTCMD_HEADER */
|
||||
|
|
|
@ -39,6 +39,9 @@ struct grub_file
|
|||
/* The file size. */
|
||||
grub_off_t size;
|
||||
|
||||
/* If file is not easly seekable. Should be set by underlying layer. */
|
||||
int not_easly_seekable;
|
||||
|
||||
/* Filesystem-specific data. */
|
||||
void *data;
|
||||
|
||||
|
@ -48,6 +51,51 @@ struct grub_file
|
|||
};
|
||||
typedef struct grub_file *grub_file_t;
|
||||
|
||||
/* Filters with lower ID are executed first. */
|
||||
typedef enum grub_file_filter_id
|
||||
{
|
||||
GRUB_FILE_FILTER_GZIO,
|
||||
GRUB_FILE_FILTER_XZIO,
|
||||
GRUB_FILE_FILTER_MAX,
|
||||
GRUB_FILE_FILTER_COMPRESSION_FIRST = GRUB_FILE_FILTER_GZIO,
|
||||
GRUB_FILE_FILTER_COMPRESSION_LAST = GRUB_FILE_FILTER_XZIO,
|
||||
} grub_file_filter_id_t;
|
||||
|
||||
typedef grub_file_t (*grub_file_filter_t) (grub_file_t in);
|
||||
|
||||
extern grub_file_filter_t EXPORT_VAR(grub_file_filters_all)[GRUB_FILE_FILTER_MAX];
|
||||
extern grub_file_filter_t EXPORT_VAR(grub_file_filters_enabled)[GRUB_FILE_FILTER_MAX];
|
||||
|
||||
static inline void
|
||||
grub_file_filter_register (grub_file_filter_id_t id, grub_file_filter_t filter)
|
||||
{
|
||||
grub_file_filters_all[id] = filter;
|
||||
grub_file_filters_enabled[id] = filter;
|
||||
};
|
||||
|
||||
static inline void
|
||||
grub_file_filter_unregister (grub_file_filter_id_t id)
|
||||
{
|
||||
grub_file_filters_all[id] = 0;
|
||||
grub_file_filters_enabled[id] = 0;
|
||||
};
|
||||
|
||||
static inline void
|
||||
grub_file_filter_disable (grub_file_filter_id_t id)
|
||||
{
|
||||
grub_file_filters_enabled[id] = 0;
|
||||
};
|
||||
|
||||
static inline void
|
||||
grub_file_filter_disable_compression (void)
|
||||
{
|
||||
grub_file_filter_id_t id;
|
||||
|
||||
for (id = GRUB_FILE_FILTER_COMPRESSION_FIRST;
|
||||
id <= GRUB_FILE_FILTER_COMPRESSION_LAST; id++)
|
||||
grub_file_filters_enabled[id] = 0;
|
||||
};
|
||||
|
||||
/* Get a device name from NAME. */
|
||||
char *EXPORT_FUNC(grub_file_get_device_name) (const char *name);
|
||||
|
||||
|
@ -57,6 +105,9 @@ grub_ssize_t EXPORT_FUNC(grub_file_read) (grub_file_t file, void *buf,
|
|||
grub_off_t EXPORT_FUNC(grub_file_seek) (grub_file_t file, grub_off_t offset);
|
||||
grub_err_t EXPORT_FUNC(grub_file_close) (grub_file_t file);
|
||||
|
||||
/* Return value of grub_file_size() in case file size is unknown. */
|
||||
#define GRUB_FILE_SIZE_UNKNOWN 0xffffffffffffffffULL
|
||||
|
||||
static inline grub_off_t
|
||||
grub_file_size (const grub_file_t file)
|
||||
{
|
||||
|
@ -69,4 +120,10 @@ grub_file_tell (const grub_file_t file)
|
|||
return file->offset;
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_file_seekable (const grub_file_t file)
|
||||
{
|
||||
return !file->not_easly_seekable;
|
||||
}
|
||||
|
||||
#endif /* ! GRUB_FILE_HEADER */
|
||||
|
|
|
@ -36,7 +36,7 @@ typedef struct grub_gpt_part_type grub_gpt_part_type_t;
|
|||
}
|
||||
|
||||
#define GRUB_GPT_PARTITION_TYPE_BIOS_BOOT \
|
||||
{ grub_cpu_to_le32 (0x21686148), grub_cpu_to_le16 (0x6449), grub_cpu_to_le16 (0x6e6f), \
|
||||
{ grub_cpu_to_le32_compile_time (0x21686148), grub_cpu_to_le16_compile_time (0x6449), grub_cpu_to_le16_compile_time (0x6e6f), \
|
||||
{ 0x74, 0x4e, 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 } \
|
||||
}
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
/* gzio.h - prototypes for gzio */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005,2007 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_GZIO_H
|
||||
#define GRUB_GZIO_H 1
|
||||
|
||||
#include <grub/file.h>
|
||||
|
||||
grub_file_t grub_gzio_open (grub_file_t io, int transparent);
|
||||
grub_file_t grub_gzfile_open (const char *name, int transparent);
|
||||
|
||||
#endif /* ! GRUB_GZIO_H */
|
49
include/grub/i386/coreboot/lbio.h
Normal file
49
include/grub/i386/coreboot/lbio.h
Normal 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
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
#include <grub/i386/pc/memory.h>
|
||||
#include <grub/i386/coreboot/memory.h>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2004,2005,2007,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,15 +16,33 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_INIT_MACHINE_HEADER
|
||||
#define GRUB_INIT_MACHINE_HEADER 1
|
||||
#ifndef GRUB_APM_MACHINE_HEADER
|
||||
#define GRUB_APM_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/cpu/floppy.h>
|
||||
|
||||
/* Turn on/off Gate A20. */
|
||||
void grub_gate_a20 (int on);
|
||||
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;
|
||||
};
|
||||
|
||||
#endif /* ! GRUB_INIT_MACHINE_HEADER */
|
||||
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
|
|
@ -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,
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#define GRUB_INTERRUPT_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
struct grub_bios_int_registers
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
19
include/grub/i386/pc/vesa_modes_table.h
Normal file
19
include/grub/i386/pc/vesa_modes_table.h
Normal 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
|
|
@ -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 */
|
||||
|
|
|
@ -103,6 +103,9 @@ enum grub_ieee1275_flag
|
|||
|
||||
/* OpenFirmware hangs on qemu if one requests any memory below 1.5 MiB. */
|
||||
GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM,
|
||||
|
||||
/* OLPC / XO firmware has the cursor ON/OFF routines. */
|
||||
GRUB_IEEE1275_FLAG_HAS_CURSORONOFF,
|
||||
};
|
||||
|
||||
extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);
|
||||
|
@ -187,4 +190,6 @@ int EXPORT_FUNC(grub_ieee1275_devices_iterate) (int (*hook)
|
|||
(struct grub_ieee1275_devalias *
|
||||
alias));
|
||||
|
||||
char *EXPORT_FUNC(grub_ieee1275_canonicalise_devname) (const char *path);
|
||||
|
||||
#endif /* ! GRUB_IEEE1275_HEADER */
|
||||
|
|
142
include/grub/keyboard_layouts.h
Normal file
142
include/grub/keyboard_layouts.h
Normal 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 */
|
|
@ -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
|
|
@ -38,6 +38,8 @@ typedef enum grub_arg_type grub_arg_type_t;
|
|||
|
||||
/* Flags for the option field op grub_arg_option. */
|
||||
#define GRUB_ARG_OPTION_OPTIONAL (1 << 1)
|
||||
/* Flags for an option that can appear multiple times. */
|
||||
#define GRUB_ARG_OPTION_REPEATABLE (1 << 2)
|
||||
|
||||
enum grub_key_type
|
||||
{
|
||||
|
@ -59,7 +61,10 @@ struct grub_arg_option
|
|||
struct grub_arg_list
|
||||
{
|
||||
int set;
|
||||
char *arg;
|
||||
union {
|
||||
char *arg;
|
||||
char **args;
|
||||
};
|
||||
};
|
||||
|
||||
struct grub_extcmd;
|
||||
|
@ -67,6 +72,8 @@ struct grub_extcmd;
|
|||
int grub_arg_parse (struct grub_extcmd *cmd, int argc, char **argv,
|
||||
struct grub_arg_list *usr, char ***args, int *argnum);
|
||||
|
||||
void grub_arg_show_help (struct grub_extcmd *cmd);
|
||||
void EXPORT_FUNC(grub_arg_show_help) (struct grub_extcmd *cmd);
|
||||
struct grub_arg_list* grub_arg_list_alloc (struct grub_extcmd *cmd,
|
||||
int argc, char *argv[]);
|
||||
|
||||
#endif /* ! GRUB_ARG_HEADER */
|
||||
|
|
|
@ -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__)
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -47,8 +47,14 @@ struct grub_menu_entry
|
|||
/* The sourcecode of the menu entry, used by the editor. */
|
||||
const char *sourcecode;
|
||||
|
||||
/* Parameters to be passed to menu definition. */
|
||||
int argc;
|
||||
char **args;
|
||||
|
||||
int hotkey;
|
||||
|
||||
int submenu;
|
||||
|
||||
/* The next element. */
|
||||
struct grub_menu_entry *next;
|
||||
};
|
||||
|
@ -96,4 +102,7 @@ void grub_menu_execute_with_fallback (grub_menu_t menu,
|
|||
void grub_menu_entry_run (grub_menu_entry_t entry);
|
||||
int grub_menu_get_default_entry_index (grub_menu_t menu);
|
||||
|
||||
void grub_menu_init (void);
|
||||
void grub_menu_fini (void);
|
||||
|
||||
#endif /* GRUB_MENU_HEADER */
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
#ifdef GRUB_MACHINE_EMU
|
||||
static inline void
|
||||
grub_cpu_idle(void)
|
||||
{
|
||||
}
|
||||
#endif
|
|
@ -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;
|
||||
|
|
|
@ -193,6 +193,26 @@ grub_strncasecmp (const char *s1, const char *s2, grub_size_t n)
|
|||
return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
|
||||
}
|
||||
|
||||
/* Replace all `ch' characters of `input' with `with' and copy the
|
||||
result into `output'; return EOS address of `output'. */
|
||||
static inline char *
|
||||
grub_strchrsub (char *output, const char *input, char ch, const char *with)
|
||||
{
|
||||
grub_size_t grub_strlen (const char *s);
|
||||
while (*input)
|
||||
{
|
||||
if (*input == ch)
|
||||
{
|
||||
grub_strcpy (output, with);
|
||||
output += grub_strlen (with);
|
||||
input++;
|
||||
continue;
|
||||
}
|
||||
*output++ = *input++;
|
||||
}
|
||||
*output = '\0';
|
||||
return output;
|
||||
}
|
||||
|
||||
unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, char **end, int base);
|
||||
unsigned long long EXPORT_FUNC(grub_strtoull) (const char *str, char **end, int base);
|
||||
|
@ -270,11 +290,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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -53,13 +53,25 @@ grub_multiboot_add_elfsyms (grub_size_t num, grub_size_t entsize,
|
|||
grub_uint32_t grub_get_multiboot_mmap_count (void);
|
||||
grub_err_t grub_multiboot_set_video_mode (void);
|
||||
|
||||
/* FIXME: support coreboot as well. */
|
||||
#if defined (GRUB_MACHINE_PCBIOS)
|
||||
#define GRUB_MACHINE_HAS_VBE 1
|
||||
#else
|
||||
#define GRUB_MACHINE_HAS_VBE 0
|
||||
#endif
|
||||
|
||||
#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
|
||||
#else
|
||||
#define GRUB_MACHINE_HAS_VGA_TEXT 0
|
||||
#endif
|
||||
|
||||
#if defined (GRUB_MACHINE_EFI) || defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT)
|
||||
#define GRUB_MACHINE_HAS_ACPI 1
|
||||
#else
|
||||
#define GRUB_MACHINE_HAS_ACPI 0
|
||||
#endif
|
||||
|
||||
#define GRUB_MULTIBOOT_CONSOLE_EGA_TEXT 1
|
||||
#define GRUB_MULTIBOOT_CONSOLE_FRAMEBUFFER 2
|
||||
|
||||
|
|
|
@ -54,8 +54,6 @@ void grub_normal_execute (const char *config, int nested, int batch);
|
|||
void grub_menu_init_page (int nested, int edit,
|
||||
struct grub_term_output *term);
|
||||
void grub_normal_init_page (struct grub_term_output *term);
|
||||
grub_err_t grub_normal_add_menu_entry (int argc, const char **args,
|
||||
const char *sourcecode);
|
||||
char *grub_file_getline (grub_file_t file);
|
||||
void grub_cmdline_run (int nested);
|
||||
|
||||
|
@ -112,9 +110,24 @@ 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_extractor_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,
|
||||
int submenu);
|
||||
|
||||
grub_err_t
|
||||
grub_normal_set_password (const char *user, const char *password);
|
||||
|
||||
void grub_normal_free_menu (grub_menu_t menu);
|
||||
|
||||
void grub_normal_auth_init (void);
|
||||
void grub_normal_auth_fini (void);
|
||||
|
||||
#endif /* ! GRUB_NORMAL_HEADER */
|
||||
|
|
|
@ -34,11 +34,13 @@
|
|||
/* The offset of GRUB_INSTALL_BSD_PART. */
|
||||
#define GRUB_KERNEL_I386_PC_INSTALL_BSD_PART 0x18
|
||||
|
||||
/* The offset of multiboot signature. */
|
||||
#define GRUB_KERNEL_I386_PC_MULTIBOOT_SIGNATURE 0x1c
|
||||
/* Offset of reed_solomon_redundancy. */
|
||||
#define GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY 0x1c
|
||||
|
||||
/* The size of the first region which won't be compressed. */
|
||||
#define GRUB_KERNEL_I386_PC_RAW_SIZE 0x5D8
|
||||
#define GRUB_KERNEL_I386_PC_RAW_SIZE 0xca4
|
||||
|
||||
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x70c
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_PC_PREFIX GRUB_KERNEL_I386_PC_RAW_SIZE
|
||||
|
@ -102,13 +104,12 @@
|
|||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_LINK_ALIGN 32
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE 0x200
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE 0xc
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_KERNEL_IMAGE_SIZE 0x10
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_UNCOMPRESSED_SIZE 0xc
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE + 0x48
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE 0x08
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX 0x0c
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX_END 0x54
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_EFI_PREFIX 0x8
|
||||
|
@ -150,22 +151,23 @@
|
|||
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_UNCOMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, GRUB_MACHINE, _UNCOMPRESSED_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
|
||||
|
|
|
@ -26,6 +26,13 @@ struct grub_disk;
|
|||
|
||||
typedef struct grub_partition *grub_partition_t;
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
typedef enum
|
||||
{
|
||||
GRUB_EMBED_PCBIOS
|
||||
} grub_embed_type_t;
|
||||
#endif
|
||||
|
||||
/* Partition map type. */
|
||||
struct grub_partition_map
|
||||
{
|
||||
|
@ -39,6 +46,12 @@ struct grub_partition_map
|
|||
grub_err_t (*iterate) (struct grub_disk *disk,
|
||||
int (*hook) (struct grub_disk *disk,
|
||||
const grub_partition_t partition));
|
||||
#ifdef GRUB_UTIL
|
||||
/* Determine sectors available for embedding. */
|
||||
grub_err_t (*embed) (struct grub_disk *disk, unsigned int *nsectors,
|
||||
grub_embed_type_t embed_type,
|
||||
grub_disk_addr_t **sectors);
|
||||
#endif
|
||||
};
|
||||
typedef struct grub_partition_map *grub_partition_map_t;
|
||||
|
||||
|
@ -65,6 +78,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,
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
|
||||
#include <grub/types.h>
|
||||
|
||||
#define GRUB_RAID_MAX_DEVICES 32
|
||||
|
||||
#define GRUB_RAID_LAYOUT_LEFT_ASYMMETRIC 0
|
||||
#define GRUB_RAID_LAYOUT_RIGHT_ASYMMETRIC 1
|
||||
#define GRUB_RAID_LAYOUT_LEFT_SYMMETRIC 2
|
||||
|
@ -32,6 +30,13 @@
|
|||
#define GRUB_RAID_LAYOUT_RIGHT_MASK 1
|
||||
#define GRUB_RAID_LAYOUT_SYMMETRIC_MASK 2
|
||||
|
||||
struct grub_raid_member
|
||||
{
|
||||
grub_disk_t device; /* Array of total_devs devices. */
|
||||
grub_disk_addr_t start_sector;
|
||||
/* Start of each device, in 512 byte sectors. */
|
||||
};
|
||||
|
||||
struct grub_raid_array
|
||||
{
|
||||
int number; /* The device number, taken from md_minor so we
|
||||
|
@ -43,17 +48,20 @@ struct grub_raid_array
|
|||
grub_size_t chunk_size; /* The size of a chunk, in 512 byte sectors. */
|
||||
grub_uint64_t disk_size; /* Size of an individual disk, in 512 byte
|
||||
sectors. */
|
||||
int index; /* Index of current device. */
|
||||
unsigned int index; /* Index of current device. */
|
||||
int uuid_len; /* The length of uuid. */
|
||||
char *uuid; /* The UUID of the device. */
|
||||
|
||||
/* The following field is setup by the caller. */
|
||||
char *name; /* That will be "md<number>". */
|
||||
unsigned int nr_devs; /* The number of devices we've found so far. */
|
||||
grub_disk_t device[GRUB_RAID_MAX_DEVICES]; /* Array of total_devs devices. */
|
||||
grub_disk_addr_t start_sector[GRUB_RAID_MAX_DEVICES];
|
||||
/* Start of each device, in 512 byte sectors. */
|
||||
unsigned int allocated_devs;
|
||||
struct grub_raid_member *members;
|
||||
struct grub_raid_array *next;
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
struct grub_raid *driver;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct grub_raid
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 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,15 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MEMORY_MACHINE_HEADER
|
||||
#define GRUB_MEMORY_MACHINE_HEADER 1
|
||||
#ifndef GRUB_REED_SOLOMON_HEADER
|
||||
#define GRUB_REED_SOLOMON_HEADER 1
|
||||
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
void
|
||||
grub_reed_solomon_add_redundancy (void *buffer, grub_size_t data_size,
|
||||
grub_size_t redundancy);
|
||||
|
||||
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
|
||||
void
|
||||
grub_reed_solomon_recover (void *buffer, grub_size_t data_size,
|
||||
grub_size_t redundancy);
|
||||
|
||||
#endif
|
|
@ -40,8 +40,13 @@ struct grub_script_cmd
|
|||
|
||||
struct grub_script
|
||||
{
|
||||
unsigned refcnt;
|
||||
struct grub_script_mem *mem;
|
||||
struct grub_script_cmd *cmd;
|
||||
|
||||
/* grub_scripts from block arguments. */
|
||||
struct grub_script *next_siblings;
|
||||
struct grub_script *children;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
|
@ -50,7 +55,8 @@ typedef enum
|
|||
GRUB_SCRIPT_ARG_TYPE_TEXT,
|
||||
GRUB_SCRIPT_ARG_TYPE_DQVAR,
|
||||
GRUB_SCRIPT_ARG_TYPE_DQSTR,
|
||||
GRUB_SCRIPT_ARG_TYPE_SQSTR
|
||||
GRUB_SCRIPT_ARG_TYPE_SQSTR,
|
||||
GRUB_SCRIPT_ARG_TYPE_BLOCK
|
||||
} grub_script_arg_type_t;
|
||||
|
||||
/* A part of an argument. */
|
||||
|
@ -60,6 +66,9 @@ struct grub_script_arg
|
|||
|
||||
char *str;
|
||||
|
||||
/* Parsed block argument. */
|
||||
struct grub_script *script;
|
||||
|
||||
/* Next argument part. */
|
||||
struct grub_script_arg *next;
|
||||
};
|
||||
|
@ -69,8 +78,19 @@ struct grub_script_argv
|
|||
{
|
||||
unsigned argc;
|
||||
char **args;
|
||||
struct grub_script *script;
|
||||
};
|
||||
|
||||
/* Pluggable wildcard translator. */
|
||||
struct grub_script_wildcard_translator
|
||||
{
|
||||
char *(*escape) (const char *str);
|
||||
char *(*unescape) (const char *str);
|
||||
grub_err_t (*expand) (const char *str, char ***expansions);
|
||||
};
|
||||
extern struct grub_script_wildcard_translator *grub_wildcard_translator;
|
||||
extern struct grub_script_wildcard_translator grub_filename_translator;
|
||||
|
||||
/* A complete argument. It consists of a list of one or more `struct
|
||||
grub_script_arg's. */
|
||||
struct grub_script_arglist
|
||||
|
@ -135,21 +155,6 @@ struct grub_script_cmdwhile
|
|||
int until;
|
||||
};
|
||||
|
||||
/* A menu entry generate statement. */
|
||||
struct grub_script_cmd_menuentry
|
||||
{
|
||||
struct grub_script_cmd cmd;
|
||||
|
||||
/* The arguments for this menu entry. */
|
||||
struct grub_script_arglist *arglist;
|
||||
|
||||
/* The sourcecode the entry will be generated from. */
|
||||
const char *sourcecode;
|
||||
|
||||
/* Options. XXX: Not used yet. */
|
||||
int options;
|
||||
};
|
||||
|
||||
/* State of the lexer as passed to the lexer. */
|
||||
struct grub_lexer_param
|
||||
{
|
||||
|
@ -194,6 +199,12 @@ struct grub_lexer_param
|
|||
/* Type of text. */
|
||||
grub_script_arg_type_t type;
|
||||
|
||||
/* Flag to indicate resplit in progres. */
|
||||
unsigned resplit;
|
||||
|
||||
/* Text that is unput. */
|
||||
char *prefix;
|
||||
|
||||
/* Flex scanner. */
|
||||
void *yyscanner;
|
||||
|
||||
|
@ -217,6 +228,9 @@ struct grub_parser_param
|
|||
/* The memory that was used while parsing and scanning. */
|
||||
struct grub_script_mem *memused;
|
||||
|
||||
/* The block argument scripts. */
|
||||
struct grub_script *scripts;
|
||||
|
||||
/* The result of the parser. */
|
||||
struct grub_script_cmd *parsed;
|
||||
|
||||
|
@ -226,7 +240,10 @@ struct grub_parser_param
|
|||
void grub_script_init (void);
|
||||
void grub_script_fini (void);
|
||||
|
||||
void grub_script_mem_free (struct grub_script_mem *mem);
|
||||
|
||||
void grub_script_argv_free (struct grub_script_argv *argv);
|
||||
int grub_script_argv_make (struct grub_script_argv *argv, int argc, char **args);
|
||||
int grub_script_argv_next (struct grub_script_argv *argv);
|
||||
int grub_script_argv_append (struct grub_script_argv *argv, const char *s);
|
||||
int grub_script_argv_split_append (struct grub_script_argv *argv, char *s);
|
||||
|
@ -260,12 +277,6 @@ grub_script_create_cmdwhile (struct grub_parser_param *state,
|
|||
struct grub_script_cmd *list,
|
||||
int is_an_until_loop);
|
||||
|
||||
struct grub_script_cmd *
|
||||
grub_script_create_cmdmenu (struct grub_parser_param *state,
|
||||
struct grub_script_arglist *arglist,
|
||||
char *sourcecode,
|
||||
int options);
|
||||
|
||||
struct grub_script_cmd *
|
||||
grub_script_append_cmd (struct grub_parser_param *state,
|
||||
struct grub_script_cmd *list,
|
||||
|
@ -287,9 +298,9 @@ struct grub_lexer_param *grub_script_lexer_init (struct grub_parser_param *parse
|
|||
void grub_script_lexer_fini (struct grub_lexer_param *);
|
||||
void grub_script_lexer_ref (struct grub_lexer_param *);
|
||||
void grub_script_lexer_deref (struct grub_lexer_param *);
|
||||
void grub_script_lexer_record_start (struct grub_parser_param *);
|
||||
char *grub_script_lexer_record_stop (struct grub_parser_param *);
|
||||
int grub_script_lexer_yywrap (struct grub_parser_param *);
|
||||
unsigned grub_script_lexer_record_start (struct grub_parser_param *);
|
||||
char *grub_script_lexer_record_stop (struct grub_parser_param *, unsigned);
|
||||
int grub_script_lexer_yywrap (struct grub_parser_param *, const char *input);
|
||||
void grub_script_lexer_record (struct grub_parser_param *, char *);
|
||||
|
||||
/* Functions to track allocated memory. */
|
||||
|
@ -310,10 +321,10 @@ grub_err_t grub_script_execute_cmdlist (struct grub_script_cmd *cmd);
|
|||
grub_err_t grub_script_execute_cmdif (struct grub_script_cmd *cmd);
|
||||
grub_err_t grub_script_execute_cmdfor (struct grub_script_cmd *cmd);
|
||||
grub_err_t grub_script_execute_cmdwhile (struct grub_script_cmd *cmd);
|
||||
grub_err_t grub_script_execute_menuentry (struct grub_script_cmd *cmd);
|
||||
|
||||
/* Execute any GRUB pre-parsed command or script. */
|
||||
grub_err_t grub_script_execute (struct grub_script *script);
|
||||
grub_err_t grub_script_execute_sourcecode (const char *source, int argc, char **args);
|
||||
|
||||
/* Break command for loops. */
|
||||
grub_err_t grub_script_break (grub_command_t cmd, int argc, char *argv[]);
|
||||
|
@ -321,6 +332,12 @@ grub_err_t grub_script_break (grub_command_t cmd, int argc, char *argv[]);
|
|||
/* SHIFT command for GRUB script. */
|
||||
grub_err_t grub_script_shift (grub_command_t cmd, int argc, char *argv[]);
|
||||
|
||||
/* SETPARAMS command for GRUB script functions. */
|
||||
grub_err_t grub_script_setparams (grub_command_t cmd, int argc, char *argv[]);
|
||||
|
||||
/* RETURN command for functions. */
|
||||
grub_err_t grub_script_return (grub_command_t cmd, int argc, char *argv[]);
|
||||
|
||||
/* This variable points to the parsed command. This is used to
|
||||
communicate with the bison code. */
|
||||
extern struct grub_script_cmd *grub_script_parsed;
|
||||
|
@ -365,4 +382,24 @@ grub_script_execute_arglist_to_argv (struct grub_script_arglist *arglist, int *c
|
|||
grub_err_t
|
||||
grub_normal_parse_line (char *line, grub_reader_getline_t getline);
|
||||
|
||||
static inline struct grub_script *
|
||||
grub_script_ref (struct grub_script *script)
|
||||
{
|
||||
if (script)
|
||||
script->refcnt++;
|
||||
return script;
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_script_unref (struct grub_script *script)
|
||||
{
|
||||
if (! script)
|
||||
return;
|
||||
|
||||
if (script->refcnt == 0)
|
||||
grub_script_free (script);
|
||||
else
|
||||
script->refcnt--;
|
||||
}
|
||||
|
||||
#endif /* ! GRUB_NORMAL_PARSER_HEADER */
|
||||
|
|
|
@ -40,7 +40,7 @@ static inline grub_uint32_t
|
|||
grub_make_scsi_id (int subsystem, int bus, int lun)
|
||||
{
|
||||
return (subsystem << GRUB_SCSI_ID_SUBSYSTEM_SHIFT)
|
||||
| (bus << GRUB_SCSI_ID_BUS_SHIFT) | (lun << GRUB_SCSI_ID_BUS_SHIFT);
|
||||
| (bus << GRUB_SCSI_ID_BUS_SHIFT) | (lun << GRUB_SCSI_ID_LUN_SHIFT);
|
||||
}
|
||||
|
||||
struct grub_scsi_dev
|
||||
|
|
|
@ -19,8 +19,11 @@
|
|||
#ifndef GRUB_SEARCH_HEADER
|
||||
#define GRUB_SEARCH_HEADER 1
|
||||
|
||||
void grub_search_fs_file (const char *key, const char *var, int no_floppy);
|
||||
void grub_search_fs_uuid (const char *key, const char *var, int no_floppy);
|
||||
void grub_search_label (const char *key, const char *var, int no_floppy);
|
||||
void grub_search_fs_file (const char *key, const char *var, int no_floppy,
|
||||
char **hints, unsigned nhints);
|
||||
void grub_search_fs_uuid (const char *key, const char *var, int no_floppy,
|
||||
char **hints, unsigned nhints);
|
||||
void grub_search_label (const char *key, const char *var, int no_floppy,
|
||||
char **hints, unsigned nhints);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -72,7 +72,11 @@ struct grub_serial_port
|
|||
*/
|
||||
union
|
||||
{
|
||||
grub_port_t port;
|
||||
struct
|
||||
{
|
||||
grub_port_t port;
|
||||
int broken;
|
||||
};
|
||||
struct
|
||||
{
|
||||
grub_usb_device_t usbdev;
|
||||
|
|
|
@ -52,4 +52,13 @@
|
|||
|
||||
#define GRUB_BOOT_MACHINE_KERNEL_ADDR 0x4200
|
||||
|
||||
#ifndef ASM_FILE
|
||||
/* This is the blocklist used in the diskboot image. */
|
||||
struct grub_boot_blocklist
|
||||
{
|
||||
grub_uint64_t start;
|
||||
grub_uint32_t len;
|
||||
} __attribute__ ((packed));
|
||||
#endif
|
||||
|
||||
#endif /* ! BOOT_MACHINE_HEADER */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -84,12 +84,10 @@ typedef unsigned long long grub_uint64_t;
|
|||
/* Misc types. */
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 8
|
||||
typedef grub_uint64_t grub_target_addr_t;
|
||||
typedef grub_uint64_t grub_target_off_t;
|
||||
typedef grub_uint64_t grub_target_size_t;
|
||||
typedef grub_int64_t grub_target_ssize_t;
|
||||
#else
|
||||
typedef grub_uint32_t grub_target_addr_t;
|
||||
typedef grub_uint32_t grub_target_off_t;
|
||||
typedef grub_uint32_t grub_target_size_t;
|
||||
typedef grub_int32_t grub_target_ssize_t;
|
||||
#endif
|
||||
|
@ -102,9 +100,11 @@ typedef grub_int64_t grub_ssize_t;
|
|||
# if GRUB_CPU_SIZEOF_LONG == 8
|
||||
# define PRIxGRUB_SIZE "lx"
|
||||
# define PRIxGRUB_ADDR "lx"
|
||||
# define PRIuGRUB_SIZE "lu"
|
||||
# else
|
||||
# define PRIxGRUB_SIZE "llx"
|
||||
# define PRIxGRUB_ADDR "llx"
|
||||
# define PRIuGRUB_SIZE "llu"
|
||||
# endif
|
||||
#else
|
||||
typedef grub_uint32_t grub_addr_t;
|
||||
|
@ -113,6 +113,7 @@ typedef grub_int32_t grub_ssize_t;
|
|||
|
||||
# define PRIxGRUB_SIZE "x"
|
||||
# define PRIxGRUB_ADDR "x"
|
||||
# define PRIuGRUB_SIZE "u"
|
||||
#endif
|
||||
|
||||
#if GRUB_CPU_SIZEOF_LONG == 8
|
||||
|
@ -148,6 +149,9 @@ typedef grub_uint64_t grub_disk_addr_t;
|
|||
(grub_uint16_t) ((_x << 8) | (_x >> 8)); \
|
||||
})
|
||||
|
||||
#define grub_swap_bytes16_compile_time(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8))
|
||||
#define grub_swap_bytes32_compile_time(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) | (((x) & 0xff0000) >> 8) | (((x) & 0xff000000UL) >> 24))
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3)
|
||||
static inline grub_uint32_t grub_swap_bytes32(grub_uint32_t x)
|
||||
{
|
||||
|
@ -195,6 +199,8 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
|
|||
# define grub_be_to_cpu16(x) ((grub_uint16_t) (x))
|
||||
# define grub_be_to_cpu32(x) ((grub_uint32_t) (x))
|
||||
# define grub_be_to_cpu64(x) ((grub_uint64_t) (x))
|
||||
# define grub_cpu_to_le32_compile_time(x) grub_swap_bytes32_compile_time(x)
|
||||
# define grub_cpu_to_le16_compile_time(x) grub_swap_bytes16_compile_time(x)
|
||||
#else /* ! WORDS_BIGENDIAN */
|
||||
# define grub_cpu_to_le16(x) ((grub_uint16_t) (x))
|
||||
# define grub_cpu_to_le32(x) ((grub_uint32_t) (x))
|
||||
|
@ -208,6 +214,8 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
|
|||
# define grub_be_to_cpu16(x) grub_swap_bytes16(x)
|
||||
# define grub_be_to_cpu32(x) grub_swap_bytes32(x)
|
||||
# define grub_be_to_cpu64(x) grub_swap_bytes64(x)
|
||||
# define grub_cpu_to_le16_compile_time(x) ((grub_uint16_t) (x))
|
||||
# define grub_cpu_to_le32_compile_time(x) ((grub_uint32_t) (x))
|
||||
#endif /* ! WORDS_BIGENDIAN */
|
||||
|
||||
#endif /* ! GRUB_TYPES_HEADER */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -42,4 +42,6 @@ extern nvlist_t *zpool_get_config (zpool_handle_t *, nvlist_t **);
|
|||
|
||||
#endif /* ! HAVE_LIBZFS_H */
|
||||
|
||||
libzfs_handle_t *grub_get_libzfs_handle (void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -38,20 +38,33 @@ struct grub_video_bitmap;
|
|||
/* If following is set render target contains currenly displayed image
|
||||
after swapping buffers (otherwise it contains previously displayed image).
|
||||
*/
|
||||
#define GRUB_VIDEO_MODE_TYPE_UPDATING_SWAP 0x00000080
|
||||
#define GRUB_VIDEO_MODE_TYPE_PURE_TEXT 0x00000040
|
||||
#define GRUB_VIDEO_MODE_TYPE_ALPHA 0x00000020
|
||||
#define GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED 0x00000010
|
||||
#define GRUB_VIDEO_MODE_TYPE_1BIT_BITMAP 0x00000004
|
||||
#define GRUB_VIDEO_MODE_TYPE_INDEX_COLOR 0x00000002
|
||||
#define GRUB_VIDEO_MODE_TYPE_RGB 0x00000001
|
||||
typedef enum grub_video_mode_type
|
||||
{
|
||||
GRUB_VIDEO_MODE_TYPE_RGB = 0x00000001,
|
||||
GRUB_VIDEO_MODE_TYPE_INDEX_COLOR = 0x00000002,
|
||||
GRUB_VIDEO_MODE_TYPE_1BIT_BITMAP = 0x00000004,
|
||||
GRUB_VIDEO_MODE_TYPE_YUV = 0x00000008,
|
||||
|
||||
/* Defines used to mask flags. */
|
||||
#define GRUB_VIDEO_MODE_TYPE_COLOR_MASK 0x0000000F
|
||||
/* Defines used to mask flags. */
|
||||
GRUB_VIDEO_MODE_TYPE_COLOR_MASK = 0x0000000F,
|
||||
|
||||
/* Defines used to specify requested bit depth. */
|
||||
#define GRUB_VIDEO_MODE_TYPE_DEPTH_MASK 0x0000ff00
|
||||
#define GRUB_VIDEO_MODE_TYPE_DEPTH_POS 8
|
||||
GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED = 0x00000010,
|
||||
GRUB_VIDEO_MODE_TYPE_ALPHA = 0x00000020,
|
||||
GRUB_VIDEO_MODE_TYPE_PURE_TEXT = 0x00000040,
|
||||
GRUB_VIDEO_MODE_TYPE_UPDATING_SWAP = 0x00000080,
|
||||
GRUB_VIDEO_MODE_TYPE_OPERATIONAL_MASK = 0x000000F0,
|
||||
|
||||
/* Defines used to specify requested bit depth. */
|
||||
GRUB_VIDEO_MODE_TYPE_DEPTH_MASK = 0x0000FF00,
|
||||
#define GRUB_VIDEO_MODE_TYPE_DEPTH_POS 8
|
||||
|
||||
GRUB_VIDEO_MODE_TYPE_UNKNOWN = 0x00010000,
|
||||
GRUB_VIDEO_MODE_TYPE_HERCULES = 0x00020000,
|
||||
GRUB_VIDEO_MODE_TYPE_PLANAR = 0x00040000,
|
||||
GRUB_VIDEO_MODE_TYPE_NONCHAIN4 = 0x00080000,
|
||||
GRUB_VIDEO_MODE_TYPE_CGA = 0x00100000,
|
||||
GRUB_VIDEO_MODE_TYPE_INFO_MASK = 0x00FF0000,
|
||||
} grub_video_mode_type_t;
|
||||
|
||||
/* The basic render target representing the whole display. This always
|
||||
renders to the back buffer when double-buffering is in use. */
|
||||
|
@ -103,7 +116,7 @@ struct grub_video_mode_info
|
|||
|
||||
/* Mode type bitmask. Contains information like is it Index color or
|
||||
RGB mode. */
|
||||
unsigned int mode_type;
|
||||
grub_video_mode_type_t mode_type;
|
||||
|
||||
/* Bits per pixel. */
|
||||
unsigned int bpp;
|
||||
|
@ -117,6 +130,9 @@ struct grub_video_mode_info
|
|||
/* In index color mode, number of colors. In RGB mode this is 256. */
|
||||
unsigned int number_of_colors;
|
||||
|
||||
unsigned int mode_number;
|
||||
#define GRUB_VIDEO_MODE_NUMBER_INVALID 0xffffffff
|
||||
|
||||
/* Optimization hint how binary data is coded. */
|
||||
enum grub_video_blit_format blit_format;
|
||||
|
||||
|
@ -225,7 +241,8 @@ struct grub_video_adapter
|
|||
grub_err_t (*fini) (void);
|
||||
|
||||
grub_err_t (*setup) (unsigned int width, unsigned int height,
|
||||
unsigned int mode_type, unsigned int mode_mask);
|
||||
grub_video_mode_type_t mode_type,
|
||||
grub_video_mode_type_t mode_mask);
|
||||
|
||||
grub_err_t (*get_info) (struct grub_video_mode_info *mode_info);
|
||||
|
||||
|
@ -282,6 +299,10 @@ struct grub_video_adapter
|
|||
grub_err_t (*set_active_render_target) (struct grub_video_render_target *target);
|
||||
|
||||
grub_err_t (*get_active_render_target) (struct grub_video_render_target **target);
|
||||
|
||||
int (*iterate) (int (*hook) (const struct grub_video_mode_info *info));
|
||||
|
||||
void (*print_adapter_specific_info) (void);
|
||||
};
|
||||
typedef struct grub_video_adapter *grub_video_adapter_t;
|
||||
|
||||
|
@ -398,8 +419,9 @@ grub_err_t EXPORT_FUNC (grub_video_set_mode) (const char *modestring,
|
|||
unsigned int modevalue);
|
||||
|
||||
static inline int
|
||||
grub_video_check_mode_flag (unsigned int flags, unsigned int mask,
|
||||
unsigned int flag, int def)
|
||||
grub_video_check_mode_flag (grub_video_mode_type_t flags,
|
||||
grub_video_mode_type_t mask,
|
||||
grub_video_mode_type_t flag, int def)
|
||||
{
|
||||
return (flag & mask) ? !! (flags & flag) : def;
|
||||
}
|
||||
|
|
119
include/grub/zfs/dmu.h
Normal file
119
include/grub/zfs/dmu.h
Normal file
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_DMU_H
|
||||
#define _SYS_DMU_H
|
||||
|
||||
/*
|
||||
* This file describes the interface that the DMU provides for its
|
||||
* consumers.
|
||||
*
|
||||
* The DMU also interacts with the SPA. That interface is described in
|
||||
* dmu_spa.h.
|
||||
*/
|
||||
typedef enum dmu_object_type {
|
||||
DMU_OT_NONE,
|
||||
/* general: */
|
||||
DMU_OT_OBJECT_DIRECTORY, /* ZAP */
|
||||
DMU_OT_OBJECT_ARRAY, /* UINT64 */
|
||||
DMU_OT_PACKED_NVLIST, /* UINT8 (XDR by nvlist_pack/unpack) */
|
||||
DMU_OT_PACKED_NVLIST_SIZE, /* UINT64 */
|
||||
DMU_OT_BPLIST, /* UINT64 */
|
||||
DMU_OT_BPLIST_HDR, /* UINT64 */
|
||||
/* spa: */
|
||||
DMU_OT_SPACE_MAP_HEADER, /* UINT64 */
|
||||
DMU_OT_SPACE_MAP, /* UINT64 */
|
||||
/* zil: */
|
||||
DMU_OT_INTENT_LOG, /* UINT64 */
|
||||
/* dmu: */
|
||||
DMU_OT_DNODE, /* DNODE */
|
||||
DMU_OT_OBJSET, /* OBJSET */
|
||||
/* dsl: */
|
||||
DMU_OT_DSL_DIR, /* UINT64 */
|
||||
DMU_OT_DSL_DIR_CHILD_MAP, /* ZAP */
|
||||
DMU_OT_DSL_DS_SNAP_MAP, /* ZAP */
|
||||
DMU_OT_DSL_PROPS, /* ZAP */
|
||||
DMU_OT_DSL_DATASET, /* UINT64 */
|
||||
/* zpl: */
|
||||
DMU_OT_ZNODE, /* ZNODE */
|
||||
DMU_OT_OLDACL, /* OLD ACL */
|
||||
DMU_OT_PLAIN_FILE_CONTENTS, /* UINT8 */
|
||||
DMU_OT_DIRECTORY_CONTENTS, /* ZAP */
|
||||
DMU_OT_MASTER_NODE, /* ZAP */
|
||||
DMU_OT_UNLINKED_SET, /* ZAP */
|
||||
/* zvol: */
|
||||
DMU_OT_ZVOL, /* UINT8 */
|
||||
DMU_OT_ZVOL_PROP, /* ZAP */
|
||||
/* other; for testing only! */
|
||||
DMU_OT_PLAIN_OTHER, /* UINT8 */
|
||||
DMU_OT_UINT64_OTHER, /* UINT64 */
|
||||
DMU_OT_ZAP_OTHER, /* ZAP */
|
||||
/* new object types: */
|
||||
DMU_OT_ERROR_LOG, /* ZAP */
|
||||
DMU_OT_SPA_HISTORY, /* UINT8 */
|
||||
DMU_OT_SPA_HISTORY_OFFSETS, /* spa_his_phys_t */
|
||||
DMU_OT_POOL_PROPS, /* ZAP */
|
||||
DMU_OT_DSL_PERMS, /* ZAP */
|
||||
DMU_OT_ACL, /* ACL */
|
||||
DMU_OT_SYSACL, /* SYSACL */
|
||||
DMU_OT_FUID, /* FUID table (Packed NVLIST UINT8) */
|
||||
DMU_OT_FUID_SIZE, /* FUID table size UINT64 */
|
||||
DMU_OT_NEXT_CLONES, /* ZAP */
|
||||
DMU_OT_SCRUB_QUEUE, /* ZAP */
|
||||
DMU_OT_USERGROUP_USED, /* ZAP */
|
||||
DMU_OT_USERGROUP_QUOTA, /* ZAP */
|
||||
DMU_OT_USERREFS, /* ZAP */
|
||||
DMU_OT_DDT_ZAP, /* ZAP */
|
||||
DMU_OT_DDT_STATS, /* ZAP */
|
||||
DMU_OT_SA, /* System attr */
|
||||
DMU_OT_SA_MASTER_NODE, /* ZAP */
|
||||
DMU_OT_SA_ATTR_REGISTRATION, /* ZAP */
|
||||
DMU_OT_SA_ATTR_LAYOUTS, /* ZAP */
|
||||
DMU_OT_NUMTYPES
|
||||
} dmu_object_type_t;
|
||||
|
||||
typedef enum dmu_objset_type {
|
||||
DMU_OST_NONE,
|
||||
DMU_OST_META,
|
||||
DMU_OST_ZFS,
|
||||
DMU_OST_ZVOL,
|
||||
DMU_OST_OTHER, /* For testing only! */
|
||||
DMU_OST_ANY, /* Be careful! */
|
||||
DMU_OST_NUMTYPES
|
||||
} dmu_objset_type_t;
|
||||
|
||||
/*
|
||||
* The names of zap entries in the DIRECTORY_OBJECT of the MOS.
|
||||
*/
|
||||
#define DMU_POOL_DIRECTORY_OBJECT 1
|
||||
#define DMU_POOL_CONFIG "config"
|
||||
#define DMU_POOL_ROOT_DATASET "root_dataset"
|
||||
#define DMU_POOL_SYNC_BPLIST "sync_bplist"
|
||||
#define DMU_POOL_ERRLOG_SCRUB "errlog_scrub"
|
||||
#define DMU_POOL_ERRLOG_LAST "errlog_last"
|
||||
#define DMU_POOL_SPARES "spares"
|
||||
#define DMU_POOL_DEFLATE "deflate"
|
||||
#define DMU_POOL_HISTORY "history"
|
||||
#define DMU_POOL_PROPS "pool_props"
|
||||
#define DMU_POOL_L2CACHE "l2cache"
|
||||
|
||||
#endif /* _SYS_DMU_H */
|
43
include/grub/zfs/dmu_objset.h
Normal file
43
include/grub/zfs/dmu_objset.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2010 Robert Millan <rmh@gnu.org>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_DMU_OBJSET_H
|
||||
#define _SYS_DMU_OBJSET_H
|
||||
|
||||
#include <grub/zfs/zil.h>
|
||||
|
||||
#define OBJSET_PHYS_SIZE 2048
|
||||
#define OBJSET_PHYS_SIZE_V14 1024
|
||||
|
||||
typedef struct objset_phys {
|
||||
dnode_phys_t os_meta_dnode;
|
||||
zil_header_t os_zil_header;
|
||||
grub_uint64_t os_type;
|
||||
grub_uint64_t os_flags;
|
||||
char os_pad[OBJSET_PHYS_SIZE - sizeof (dnode_phys_t)*3 -
|
||||
sizeof (zil_header_t) - sizeof (grub_uint64_t)*2];
|
||||
dnode_phys_t os_userused_dnode;
|
||||
dnode_phys_t os_groupused_dnode;
|
||||
} objset_phys_t;
|
||||
|
||||
#endif /* _SYS_DMU_OBJSET_H */
|
80
include/grub/zfs/dnode.h
Normal file
80
include/grub/zfs/dnode.h
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_DNODE_H
|
||||
#define _SYS_DNODE_H
|
||||
|
||||
#include <grub/zfs/spa.h>
|
||||
|
||||
/*
|
||||
* Fixed constants.
|
||||
*/
|
||||
#define DNODE_SHIFT 9 /* 512 bytes */
|
||||
#define DN_MIN_INDBLKSHIFT 10 /* 1k */
|
||||
#define DN_MAX_INDBLKSHIFT 14 /* 16k */
|
||||
#define DNODE_BLOCK_SHIFT 14 /* 16k */
|
||||
#define DNODE_CORE_SIZE 64 /* 64 bytes for dnode sans blkptrs */
|
||||
#define DN_MAX_OBJECT_SHIFT 48 /* 256 trillion (zfs_fid_t limit) */
|
||||
#define DN_MAX_OFFSET_SHIFT 64 /* 2^64 bytes in a dnode */
|
||||
|
||||
/*
|
||||
* Derived constants.
|
||||
*/
|
||||
#define DNODE_SIZE (1 << DNODE_SHIFT)
|
||||
#define DN_MAX_NBLKPTR ((DNODE_SIZE - DNODE_CORE_SIZE) >> SPA_BLKPTRSHIFT)
|
||||
#define DN_MAX_BONUSLEN (DNODE_SIZE - DNODE_CORE_SIZE - (1 << SPA_BLKPTRSHIFT))
|
||||
#define DN_MAX_OBJECT (1ULL << DN_MAX_OBJECT_SHIFT)
|
||||
|
||||
#define DNODES_PER_BLOCK_SHIFT (DNODE_BLOCK_SHIFT - DNODE_SHIFT)
|
||||
#define DNODES_PER_BLOCK (1ULL << DNODES_PER_BLOCK_SHIFT)
|
||||
#define DNODES_PER_LEVEL_SHIFT (DN_MAX_INDBLKSHIFT - SPA_BLKPTRSHIFT)
|
||||
|
||||
#define DNODE_FLAG_SPILL_BLKPTR (1<<2)
|
||||
|
||||
#define DN_BONUS(dnp) ((void*)((dnp)->dn_bonus + \
|
||||
(((dnp)->dn_nblkptr - 1) * sizeof (blkptr_t))))
|
||||
|
||||
typedef struct dnode_phys {
|
||||
grub_uint8_t dn_type; /* dmu_object_type_t */
|
||||
grub_uint8_t dn_indblkshift; /* ln2(indirect block size) */
|
||||
grub_uint8_t dn_nlevels; /* 1=dn_blkptr->data blocks */
|
||||
grub_uint8_t dn_nblkptr; /* length of dn_blkptr */
|
||||
grub_uint8_t dn_bonustype; /* type of data in bonus buffer */
|
||||
grub_uint8_t dn_checksum; /* ZIO_CHECKSUM type */
|
||||
grub_uint8_t dn_compress; /* ZIO_COMPRESS type */
|
||||
grub_uint8_t dn_flags; /* DNODE_FLAG_* */
|
||||
grub_uint16_t dn_datablkszsec; /* data block size in 512b sectors */
|
||||
grub_uint16_t dn_bonuslen; /* length of dn_bonus */
|
||||
grub_uint8_t dn_pad2[4];
|
||||
|
||||
/* accounting is protected by dn_dirty_mtx */
|
||||
grub_uint64_t dn_maxblkid; /* largest allocated block ID */
|
||||
grub_uint64_t dn_used; /* bytes (or sectors) of disk space */
|
||||
|
||||
grub_uint64_t dn_pad3[4];
|
||||
|
||||
blkptr_t dn_blkptr[1];
|
||||
grub_uint8_t dn_bonus[DN_MAX_BONUSLEN - sizeof (blkptr_t)];
|
||||
blkptr_t dn_spill;
|
||||
} dnode_phys_t;
|
||||
|
||||
#endif /* _SYS_DNODE_H */
|
52
include/grub/zfs/dsl_dataset.h
Normal file
52
include/grub/zfs/dsl_dataset.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_DSL_DATASET_H
|
||||
#define _SYS_DSL_DATASET_H
|
||||
|
||||
typedef struct dsl_dataset_phys {
|
||||
grub_uint64_t ds_dir_obj;
|
||||
grub_uint64_t ds_prev_snap_obj;
|
||||
grub_uint64_t ds_prev_snap_txg;
|
||||
grub_uint64_t ds_next_snap_obj;
|
||||
grub_uint64_t ds_snapnames_zapobj; /* zap obj of snaps; ==0 for snaps */
|
||||
grub_uint64_t ds_num_children; /* clone/snap children; ==0 for head */
|
||||
grub_uint64_t ds_creation_time; /* seconds since 1970 */
|
||||
grub_uint64_t ds_creation_txg;
|
||||
grub_uint64_t ds_deadlist_obj;
|
||||
grub_uint64_t ds_used_bytes;
|
||||
grub_uint64_t ds_compressed_bytes;
|
||||
grub_uint64_t ds_uncompressed_bytes;
|
||||
grub_uint64_t ds_unique_bytes; /* only relevant to snapshots */
|
||||
/*
|
||||
* The ds_fsid_guid is a 56-bit ID that can change to avoid
|
||||
* collisions. The ds_guid is a 64-bit ID that will never
|
||||
* change, so there is a small probability that it will collide.
|
||||
*/
|
||||
grub_uint64_t ds_fsid_guid;
|
||||
grub_uint64_t ds_guid;
|
||||
grub_uint64_t ds_flags;
|
||||
blkptr_t ds_bp;
|
||||
grub_uint64_t ds_pad[8]; /* pad out to 320 bytes for good measure */
|
||||
} dsl_dataset_phys_t;
|
||||
|
||||
#endif /* _SYS_DSL_DATASET_H */
|
48
include/grub/zfs/dsl_dir.h
Normal file
48
include/grub/zfs/dsl_dir.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_DSL_DIR_H
|
||||
#define _SYS_DSL_DIR_H
|
||||
|
||||
typedef struct dsl_dir_phys {
|
||||
grub_uint64_t dd_creation_time; /* not actually used */
|
||||
grub_uint64_t dd_head_dataset_obj;
|
||||
grub_uint64_t dd_parent_obj;
|
||||
grub_uint64_t dd_clone_parent_obj;
|
||||
grub_uint64_t dd_child_dir_zapobj;
|
||||
/*
|
||||
* how much space our children are accounting for; for leaf
|
||||
* datasets, == physical space used by fs + snaps
|
||||
*/
|
||||
grub_uint64_t dd_used_bytes;
|
||||
grub_uint64_t dd_compressed_bytes;
|
||||
grub_uint64_t dd_uncompressed_bytes;
|
||||
/* Administrative quota setting */
|
||||
grub_uint64_t dd_quota;
|
||||
/* Administrative reservation setting */
|
||||
grub_uint64_t dd_reserved;
|
||||
grub_uint64_t dd_props_zapobj;
|
||||
grub_uint64_t dd_deleg_zapobj; /* dataset permissions */
|
||||
grub_uint64_t dd_pad[20]; /* pad out to 256 bytes for good measure */
|
||||
} dsl_dir_phys_t;
|
||||
|
||||
#endif /* _SYS_DSL_DIR_H */
|
34
include/grub/zfs/sa_impl.h
Normal file
34
include/grub/zfs/sa_impl.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
#ifndef _SYS_SA_IMPL_H
|
||||
#define _SYS_SA_IMPL_H
|
||||
|
||||
typedef struct sa_hdr_phys {
|
||||
grub_uint32_t sa_magic;
|
||||
grub_uint16_t sa_layout_info;
|
||||
grub_uint16_t sa_lengths[1];
|
||||
} sa_hdr_phys_t;
|
||||
|
||||
#define SA_HDR_SIZE(hdr) BF32_GET_SB(hdr->sa_layout_info, 10, 16, 3, 0)
|
||||
#define SA_SIZE_OFFSET 0x8
|
||||
|
||||
#endif /* _SYS_SA_IMPL_H */
|
310
include/grub/zfs/spa.h
Normal file
310
include/grub/zfs/spa.h
Normal file
|
@ -0,0 +1,310 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2009 Free Software Foundation, Inc.
|
||||
* Copyright 2010 Sun Microsystems, 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_ZFS_SPA_HEADER
|
||||
#define GRUB_ZFS_SPA_HEADER 1
|
||||
|
||||
typedef enum grub_zfs_endian
|
||||
{
|
||||
UNKNOWN_ENDIAN = -2,
|
||||
LITTLE_ENDIAN = -1,
|
||||
BIG_ENDIAN = 0
|
||||
} grub_zfs_endian_t;
|
||||
|
||||
#define grub_zfs_to_cpu16(x,a) (((a) == BIG_ENDIAN) ? grub_be_to_cpu16(x) \
|
||||
: grub_le_to_cpu16(x))
|
||||
#define grub_cpu_to_zfs16(x,a) (((a) == BIG_ENDIAN) ? grub_cpu_to_be16(x) \
|
||||
: grub_cpu_to_le16(x))
|
||||
|
||||
#define grub_zfs_to_cpu32(x,a) (((a) == BIG_ENDIAN) ? grub_be_to_cpu32(x) \
|
||||
: grub_le_to_cpu32(x))
|
||||
#define grub_cpu_to_zfs32(x,a) (((a) == BIG_ENDIAN) ? grub_cpu_to_be32(x) \
|
||||
: grub_cpu_to_le32(x))
|
||||
|
||||
#define grub_zfs_to_cpu64(x,a) (((a) == BIG_ENDIAN) ? grub_be_to_cpu64(x) \
|
||||
: grub_le_to_cpu64(x))
|
||||
#define grub_cpu_to_zfs64(x,a) (((a) == BIG_ENDIAN) ? grub_cpu_to_be64(x) \
|
||||
: grub_cpu_to_le64(x))
|
||||
|
||||
/*
|
||||
* General-purpose 32-bit and 64-bit bitfield encodings.
|
||||
*/
|
||||
#define BF32_DECODE(x, low, len) P2PHASE((x) >> (low), 1U << (len))
|
||||
#define BF64_DECODE(x, low, len) P2PHASE((x) >> (low), 1ULL << (len))
|
||||
#define BF32_ENCODE(x, low, len) (P2PHASE((x), 1U << (len)) << (low))
|
||||
#define BF64_ENCODE(x, low, len) (P2PHASE((x), 1ULL << (len)) << (low))
|
||||
|
||||
#define BF32_GET(x, low, len) BF32_DECODE(x, low, len)
|
||||
#define BF64_GET(x, low, len) BF64_DECODE(x, low, len)
|
||||
|
||||
#define BF32_SET(x, low, len, val) \
|
||||
((x) ^= BF32_ENCODE((x >> low) ^ (val), low, len))
|
||||
#define BF64_SET(x, low, len, val) \
|
||||
((x) ^= BF64_ENCODE((x >> low) ^ (val), low, len))
|
||||
|
||||
#define BF32_GET_SB(x, low, len, shift, bias) \
|
||||
((BF32_GET(x, low, len) + (bias)) << (shift))
|
||||
#define BF64_GET_SB(x, low, len, shift, bias) \
|
||||
((BF64_GET(x, low, len) + (bias)) << (shift))
|
||||
|
||||
#define BF32_SET_SB(x, low, len, shift, bias, val) \
|
||||
BF32_SET(x, low, len, ((val) >> (shift)) - (bias))
|
||||
#define BF64_SET_SB(x, low, len, shift, bias, val) \
|
||||
BF64_SET(x, low, len, ((val) >> (shift)) - (bias))
|
||||
|
||||
/*
|
||||
* We currently support nine block sizes, from 512 bytes to 128K.
|
||||
* We could go higher, but the benefits are near-zero and the cost
|
||||
* of COWing a giant block to modify one byte would become excessive.
|
||||
*/
|
||||
#define SPA_MINBLOCKSHIFT 9
|
||||
#define SPA_MAXBLOCKSHIFT 17
|
||||
#define SPA_MINBLOCKSIZE (1ULL << SPA_MINBLOCKSHIFT)
|
||||
#define SPA_MAXBLOCKSIZE (1ULL << SPA_MAXBLOCKSHIFT)
|
||||
|
||||
#define SPA_BLOCKSIZES (SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1)
|
||||
|
||||
/*
|
||||
* Size of block to hold the configuration data (a packed nvlist)
|
||||
*/
|
||||
#define SPA_CONFIG_BLOCKSIZE (1 << 14)
|
||||
|
||||
/*
|
||||
* The DVA size encodings for LSIZE and PSIZE support blocks up to 32MB.
|
||||
* The ASIZE encoding should be at least 64 times larger (6 more bits)
|
||||
* to support up to 4-way RAID-Z mirror mode with worst-case gang block
|
||||
* overhead, three DVAs per bp, plus one more bit in case we do anything
|
||||
* else that expands the ASIZE.
|
||||
*/
|
||||
#define SPA_LSIZEBITS 16 /* LSIZE up to 32M (2^16 * 512) */
|
||||
#define SPA_PSIZEBITS 16 /* PSIZE up to 32M (2^16 * 512) */
|
||||
#define SPA_ASIZEBITS 24 /* ASIZE up to 64 times larger */
|
||||
|
||||
/*
|
||||
* All SPA data is represented by 128-bit data virtual addresses (DVAs).
|
||||
* The members of the dva_t should be considered opaque outside the SPA.
|
||||
*/
|
||||
typedef struct dva {
|
||||
grub_uint64_t dva_word[2];
|
||||
} dva_t;
|
||||
|
||||
/*
|
||||
* Each block has a 256-bit checksum -- strong enough for cryptographic hashes.
|
||||
*/
|
||||
typedef struct zio_cksum {
|
||||
grub_uint64_t zc_word[4];
|
||||
} zio_cksum_t;
|
||||
|
||||
/*
|
||||
* Each block is described by its DVAs, time of birth, checksum, etc.
|
||||
* The word-by-word, bit-by-bit layout of the blkptr is as follows:
|
||||
*
|
||||
* 64 56 48 40 32 24 16 8 0
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* 0 | vdev1 | GRID | ASIZE |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* 1 |G| offset1 |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* 2 | vdev2 | GRID | ASIZE |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* 3 |G| offset2 |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* 4 | vdev3 | GRID | ASIZE |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* 5 |G| offset3 |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* 6 |BDX|lvl| type | cksum | comp | PSIZE | LSIZE |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* 7 | padding |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* 8 | padding |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* 9 | physical birth txg |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* a | logical birth txg |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* b | fill count |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* c | checksum[0] |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* d | checksum[1] |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* e | checksum[2] |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
* f | checksum[3] |
|
||||
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
*
|
||||
* Legend:
|
||||
*
|
||||
* vdev virtual device ID
|
||||
* offset offset into virtual device
|
||||
* LSIZE logical size
|
||||
* PSIZE physical size (after compression)
|
||||
* ASIZE allocated size (including RAID-Z parity and gang block headers)
|
||||
* GRID RAID-Z layout information (reserved for future use)
|
||||
* cksum checksum function
|
||||
* comp compression function
|
||||
* G gang block indicator
|
||||
* B byteorder (endianness)
|
||||
* D dedup
|
||||
* X unused
|
||||
* lvl level of indirection
|
||||
* type DMU object type
|
||||
* phys birth txg of block allocation; zero if same as logical birth txg
|
||||
* log. birth transaction group in which the block was logically born
|
||||
* fill count number of non-zero blocks under this bp
|
||||
* checksum[4] 256-bit checksum of the data this bp describes
|
||||
*/
|
||||
#define SPA_BLKPTRSHIFT 7 /* blkptr_t is 128 bytes */
|
||||
#define SPA_DVAS_PER_BP 3 /* Number of DVAs in a bp */
|
||||
|
||||
typedef struct blkptr {
|
||||
dva_t blk_dva[SPA_DVAS_PER_BP]; /* Data Virtual Addresses */
|
||||
grub_uint64_t blk_prop; /* size, compression, type, etc */
|
||||
grub_uint64_t blk_pad[2]; /* Extra space for the future */
|
||||
grub_uint64_t blk_phys_birth; /* txg when block was allocated */
|
||||
grub_uint64_t blk_birth; /* transaction group at birth */
|
||||
grub_uint64_t blk_fill; /* fill count */
|
||||
zio_cksum_t blk_cksum; /* 256-bit checksum */
|
||||
} blkptr_t;
|
||||
|
||||
/*
|
||||
* Macros to get and set fields in a bp or DVA.
|
||||
*/
|
||||
#define DVA_GET_ASIZE(dva) \
|
||||
BF64_GET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0)
|
||||
#define DVA_SET_ASIZE(dva, x) \
|
||||
BF64_SET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0, x)
|
||||
|
||||
#define DVA_GET_GRID(dva) BF64_GET((dva)->dva_word[0], 24, 8)
|
||||
#define DVA_SET_GRID(dva, x) BF64_SET((dva)->dva_word[0], 24, 8, x)
|
||||
|
||||
#define DVA_GET_VDEV(dva) BF64_GET((dva)->dva_word[0], 32, 32)
|
||||
#define DVA_SET_VDEV(dva, x) BF64_SET((dva)->dva_word[0], 32, 32, x)
|
||||
|
||||
#define DVA_GET_GANG(dva) BF64_GET((dva)->dva_word[1], 63, 1)
|
||||
#define DVA_SET_GANG(dva, x) BF64_SET((dva)->dva_word[1], 63, 1, x)
|
||||
|
||||
#define BP_GET_LSIZE(bp) \
|
||||
BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1)
|
||||
#define BP_SET_LSIZE(bp, x) \
|
||||
BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x)
|
||||
|
||||
#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 8)
|
||||
#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 8, x)
|
||||
|
||||
#define BP_GET_CHECKSUM(bp) BF64_GET((bp)->blk_prop, 40, 8)
|
||||
#define BP_SET_CHECKSUM(bp, x) BF64_SET((bp)->blk_prop, 40, 8, x)
|
||||
|
||||
#define BP_GET_TYPE(bp) BF64_GET((bp)->blk_prop, 48, 8)
|
||||
#define BP_SET_TYPE(bp, x) BF64_SET((bp)->blk_prop, 48, 8, x)
|
||||
|
||||
#define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5)
|
||||
#define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x)
|
||||
|
||||
#define BP_GET_PROP_BIT_61(bp) BF64_GET((bp)->blk_prop, 61, 1)
|
||||
#define BP_SET_PROP_BIT_61(bp, x) BF64_SET((bp)->blk_prop, 61, 1, x)
|
||||
|
||||
#define BP_GET_DEDUP(bp) BF64_GET((bp)->blk_prop, 62, 1)
|
||||
#define BP_SET_DEDUP(bp, x) BF64_SET((bp)->blk_prop, 62, 1, x)
|
||||
|
||||
#define BP_GET_BYTEORDER(bp) (0 - BF64_GET((bp)->blk_prop, 63, 1))
|
||||
#define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x)
|
||||
|
||||
#define BP_PHYSICAL_BIRTH(bp) \
|
||||
((bp)->blk_phys_birth ? (bp)->blk_phys_birth : (bp)->blk_birth)
|
||||
|
||||
#define BP_SET_BIRTH(bp, logical, physical) \
|
||||
{ \
|
||||
(bp)->blk_birth = (logical); \
|
||||
(bp)->blk_phys_birth = ((logical) == (physical) ? 0 : (physical)); \
|
||||
}
|
||||
|
||||
#define BP_GET_ASIZE(bp) \
|
||||
(DVA_GET_ASIZE(&(bp)->blk_dva[0]) + DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
|
||||
DVA_GET_ASIZE(&(bp)->blk_dva[2]))
|
||||
|
||||
#define BP_GET_UCSIZE(bp) \
|
||||
((BP_GET_LEVEL(bp) > 0 || dmu_ot[BP_GET_TYPE(bp)].ot_metadata) ? \
|
||||
BP_GET_PSIZE(bp) : BP_GET_LSIZE(bp));
|
||||
|
||||
#define BP_GET_NDVAS(bp) \
|
||||
(!!DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \
|
||||
!!DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \
|
||||
!!DVA_GET_ASIZE(&(bp)->blk_dva[2]))
|
||||
|
||||
#define BP_COUNT_GANG(bp) \
|
||||
(DVA_GET_GANG(&(bp)->blk_dva[0]) + \
|
||||
DVA_GET_GANG(&(bp)->blk_dva[1]) + \
|
||||
DVA_GET_GANG(&(bp)->blk_dva[2]))
|
||||
|
||||
#define DVA_EQUAL(dva1, dva2) \
|
||||
((dva1)->dva_word[1] == (dva2)->dva_word[1] && \
|
||||
(dva1)->dva_word[0] == (dva2)->dva_word[0])
|
||||
|
||||
#define BP_EQUAL(bp1, bp2) \
|
||||
(BP_PHYSICAL_BIRTH(bp1) == BP_PHYSICAL_BIRTH(bp2) && \
|
||||
DVA_EQUAL(&(bp1)->blk_dva[0], &(bp2)->blk_dva[0]) && \
|
||||
DVA_EQUAL(&(bp1)->blk_dva[1], &(bp2)->blk_dva[1]) && \
|
||||
DVA_EQUAL(&(bp1)->blk_dva[2], &(bp2)->blk_dva[2]))
|
||||
|
||||
#define ZIO_CHECKSUM_EQUAL(zc1, zc2) \
|
||||
(0 == (((zc1).zc_word[0] - (zc2).zc_word[0]) | \
|
||||
((zc1).zc_word[1] - (zc2).zc_word[1]) | \
|
||||
((zc1).zc_word[2] - (zc2).zc_word[2]) | \
|
||||
((zc1).zc_word[3] - (zc2).zc_word[3])))
|
||||
|
||||
#define DVA_IS_VALID(dva) (DVA_GET_ASIZE(dva) != 0)
|
||||
|
||||
#define ZIO_SET_CHECKSUM(zcp, w0, w1, w2, w3) \
|
||||
{ \
|
||||
(zcp)->zc_word[0] = w0; \
|
||||
(zcp)->zc_word[1] = w1; \
|
||||
(zcp)->zc_word[2] = w2; \
|
||||
(zcp)->zc_word[3] = w3; \
|
||||
}
|
||||
|
||||
#define BP_IDENTITY(bp) (&(bp)->blk_dva[0])
|
||||
#define BP_IS_GANG(bp) DVA_GET_GANG(BP_IDENTITY(bp))
|
||||
#define BP_IS_HOLE(bp) ((bp)->blk_birth == 0)
|
||||
|
||||
/* BP_IS_RAIDZ(bp) assumes no block compression */
|
||||
#define BP_IS_RAIDZ(bp) (DVA_GET_ASIZE(&(bp)->blk_dva[0]) > \
|
||||
BP_GET_PSIZE(bp))
|
||||
|
||||
#define BP_ZERO(bp) \
|
||||
{ \
|
||||
(bp)->blk_dva[0].dva_word[0] = 0; \
|
||||
(bp)->blk_dva[0].dva_word[1] = 0; \
|
||||
(bp)->blk_dva[1].dva_word[0] = 0; \
|
||||
(bp)->blk_dva[1].dva_word[1] = 0; \
|
||||
(bp)->blk_dva[2].dva_word[0] = 0; \
|
||||
(bp)->blk_dva[2].dva_word[1] = 0; \
|
||||
(bp)->blk_prop = 0; \
|
||||
(bp)->blk_pad[0] = 0; \
|
||||
(bp)->blk_pad[1] = 0; \
|
||||
(bp)->blk_phys_birth = 0; \
|
||||
(bp)->blk_birth = 0; \
|
||||
(bp)->blk_fill = 0; \
|
||||
ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \
|
||||
}
|
||||
|
||||
#define BP_SPRINTF_LEN 320
|
||||
|
||||
#endif /* ! GRUB_ZFS_SPA_HEADER */
|
60
include/grub/zfs/uberblock_impl.h
Normal file
60
include/grub/zfs/uberblock_impl.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_UBERBLOCK_IMPL_H
|
||||
#define _SYS_UBERBLOCK_IMPL_H
|
||||
|
||||
/*
|
||||
* The uberblock version is incremented whenever an incompatible on-disk
|
||||
* format change is made to the SPA, DMU, or ZAP.
|
||||
*
|
||||
* Note: the first two fields should never be moved. When a storage pool
|
||||
* is opened, the uberblock must be read off the disk before the version
|
||||
* can be checked. If the ub_version field is moved, we may not detect
|
||||
* version mismatch. If the ub_magic field is moved, applications that
|
||||
* expect the magic number in the first word won't work.
|
||||
*/
|
||||
#define UBERBLOCK_MAGIC 0x00bab10c /* oo-ba-bloc! */
|
||||
#define UBERBLOCK_SHIFT 10 /* up to 1K */
|
||||
|
||||
typedef struct uberblock {
|
||||
grub_uint64_t ub_magic; /* UBERBLOCK_MAGIC */
|
||||
grub_uint64_t ub_version; /* ZFS_VERSION */
|
||||
grub_uint64_t ub_txg; /* txg of last sync */
|
||||
grub_uint64_t ub_guid_sum; /* sum of all vdev guids */
|
||||
grub_uint64_t ub_timestamp; /* UTC time of last sync */
|
||||
blkptr_t ub_rootbp; /* MOS objset_phys_t */
|
||||
} uberblock_t;
|
||||
|
||||
#define UBERBLOCK_SIZE (1ULL << UBERBLOCK_SHIFT)
|
||||
#define VDEV_UBERBLOCK_SHIFT UBERBLOCK_SHIFT
|
||||
|
||||
/* XXX Uberblock_phys_t is no longer in the kernel zfs */
|
||||
typedef struct uberblock_phys {
|
||||
uberblock_t ubp_uberblock;
|
||||
char ubp_pad[UBERBLOCK_SIZE - sizeof (uberblock_t) -
|
||||
sizeof (zio_eck_t)];
|
||||
zio_eck_t ubp_zec;
|
||||
} uberblock_phys_t;
|
||||
|
||||
|
||||
#endif /* _SYS_UBERBLOCK_IMPL_H */
|
69
include/grub/zfs/vdev_impl.h
Normal file
69
include/grub/zfs/vdev_impl.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_VDEV_IMPL_H
|
||||
#define _SYS_VDEV_IMPL_H
|
||||
|
||||
#define VDEV_SKIP_SIZE (8 << 10)
|
||||
#define VDEV_BOOT_HEADER_SIZE (8 << 10)
|
||||
#define VDEV_PHYS_SIZE (112 << 10)
|
||||
#define VDEV_UBERBLOCK_RING (128 << 10)
|
||||
|
||||
/* ZFS boot block */
|
||||
#define VDEV_BOOT_MAGIC 0x2f5b007b10cULL
|
||||
#define VDEV_BOOT_VERSION 1 /* version number */
|
||||
|
||||
typedef struct vdev_boot_header {
|
||||
grub_uint64_t vb_magic; /* VDEV_BOOT_MAGIC */
|
||||
grub_uint64_t vb_version; /* VDEV_BOOT_VERSION */
|
||||
grub_uint64_t vb_offset; /* start offset (bytes) */
|
||||
grub_uint64_t vb_size; /* size (bytes) */
|
||||
char vb_pad[VDEV_BOOT_HEADER_SIZE - 4 * sizeof (grub_uint64_t)];
|
||||
} vdev_boot_header_t;
|
||||
|
||||
typedef struct vdev_phys {
|
||||
char vp_nvlist[VDEV_PHYS_SIZE - sizeof (zio_eck_t)];
|
||||
zio_eck_t vp_zbt;
|
||||
} vdev_phys_t;
|
||||
|
||||
typedef struct vdev_label {
|
||||
char vl_pad[VDEV_SKIP_SIZE]; /* 8K */
|
||||
vdev_boot_header_t vl_boot_header; /* 8K */
|
||||
vdev_phys_t vl_vdev_phys; /* 112K */
|
||||
char vl_uberblock[VDEV_UBERBLOCK_RING]; /* 128K */
|
||||
} vdev_label_t; /* 256K total */
|
||||
|
||||
/*
|
||||
* Size and offset of embedded boot loader region on each label.
|
||||
* The total size of the first two labels plus the boot area is 4MB.
|
||||
*/
|
||||
#define VDEV_BOOT_OFFSET (2 * sizeof (vdev_label_t))
|
||||
#define VDEV_BOOT_SIZE (7ULL << 19) /* 3.5M */
|
||||
|
||||
/*
|
||||
* Size of label regions at the start and end of each leaf device.
|
||||
*/
|
||||
#define VDEV_LABEL_START_SIZE (2 * sizeof (vdev_label_t) + VDEV_BOOT_SIZE)
|
||||
#define VDEV_LABEL_END_SIZE (2 * sizeof (vdev_label_t))
|
||||
#define VDEV_LABELS 4
|
||||
|
||||
#endif /* _SYS_VDEV_IMPL_H */
|
111
include/grub/zfs/zap_impl.h
Normal file
111
include/grub/zfs/zap_impl.h
Normal file
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ZAP_IMPL_H
|
||||
#define _SYS_ZAP_IMPL_H
|
||||
|
||||
#define ZAP_MAGIC 0x2F52AB2ABULL
|
||||
|
||||
#define ZAP_HASHBITS 28
|
||||
#define MZAP_ENT_LEN 64
|
||||
#define MZAP_NAME_LEN (MZAP_ENT_LEN - 8 - 4 - 2)
|
||||
#define MZAP_MAX_BLKSHIFT SPA_MAXBLOCKSHIFT
|
||||
#define MZAP_MAX_BLKSZ (1 << MZAP_MAX_BLKSHIFT)
|
||||
|
||||
typedef struct mzap_ent_phys {
|
||||
grub_uint64_t mze_value;
|
||||
grub_uint32_t mze_cd;
|
||||
grub_uint16_t mze_pad; /* in case we want to chain them someday */
|
||||
char mze_name[MZAP_NAME_LEN];
|
||||
} mzap_ent_phys_t;
|
||||
|
||||
typedef struct mzap_phys {
|
||||
grub_uint64_t mz_block_type; /* ZBT_MICRO */
|
||||
grub_uint64_t mz_salt;
|
||||
grub_uint64_t mz_pad[6];
|
||||
mzap_ent_phys_t mz_chunk[1];
|
||||
/* actually variable size depending on block size */
|
||||
} mzap_phys_t;
|
||||
|
||||
/*
|
||||
* The (fat) zap is stored in one object. It is an array of
|
||||
* 1<<FZAP_BLOCK_SHIFT byte blocks. The layout looks like one of:
|
||||
*
|
||||
* ptrtbl fits in first block:
|
||||
* [zap_phys_t zap_ptrtbl_shift < 6] [zap_leaf_t] ...
|
||||
*
|
||||
* ptrtbl too big for first block:
|
||||
* [zap_phys_t zap_ptrtbl_shift >= 6] [zap_leaf_t] [ptrtbl] ...
|
||||
*
|
||||
*/
|
||||
|
||||
#define ZBT_LEAF ((1ULL << 63) + 0)
|
||||
#define ZBT_HEADER ((1ULL << 63) + 1)
|
||||
#define ZBT_MICRO ((1ULL << 63) + 3)
|
||||
/* any other values are ptrtbl blocks */
|
||||
|
||||
/*
|
||||
* the embedded pointer table takes up half a block:
|
||||
* block size / entry size (2^3) / 2
|
||||
*/
|
||||
#define ZAP_EMBEDDED_PTRTBL_SHIFT(zap) (FZAP_BLOCK_SHIFT(zap) - 3 - 1)
|
||||
|
||||
/*
|
||||
* The embedded pointer table starts half-way through the block. Since
|
||||
* the pointer table itself is half the block, it starts at (64-bit)
|
||||
* word number (1<<ZAP_EMBEDDED_PTRTBL_SHIFT(zap)).
|
||||
*/
|
||||
#define ZAP_EMBEDDED_PTRTBL_ENT(zap, idx) \
|
||||
((grub_uint64_t *)(zap)->zap_f.zap_phys) \
|
||||
[(idx) + (1<<ZAP_EMBEDDED_PTRTBL_SHIFT(zap))]
|
||||
|
||||
/*
|
||||
* TAKE NOTE:
|
||||
* If zap_phys_t is modified, zap_byteswap() must be modified.
|
||||
*/
|
||||
typedef struct zap_phys {
|
||||
grub_uint64_t zap_block_type; /* ZBT_HEADER */
|
||||
grub_uint64_t zap_magic; /* ZAP_MAGIC */
|
||||
|
||||
struct zap_table_phys {
|
||||
grub_uint64_t zt_blk; /* starting block number */
|
||||
grub_uint64_t zt_numblks; /* number of blocks */
|
||||
grub_uint64_t zt_shift; /* bits to index it */
|
||||
grub_uint64_t zt_nextblk; /* next (larger) copy start block */
|
||||
grub_uint64_t zt_blks_copied; /* number source blocks copied */
|
||||
} zap_ptrtbl;
|
||||
|
||||
grub_uint64_t zap_freeblk; /* the next free block */
|
||||
grub_uint64_t zap_num_leafs; /* number of leafs */
|
||||
grub_uint64_t zap_num_entries; /* number of entries */
|
||||
grub_uint64_t zap_salt; /* salt to stir into hash function */
|
||||
grub_uint64_t zap_normflags; /* flags for u8_textprep_str() */
|
||||
grub_uint64_t zap_flags; /* zap_flag_t */
|
||||
/*
|
||||
* This structure is followed by padding, and then the embedded
|
||||
* pointer table. The embedded pointer table takes up second
|
||||
* half of the block. It is accessed using the
|
||||
* ZAP_EMBEDDED_PTRTBL_ENT() macro.
|
||||
*/
|
||||
} zap_phys_t;
|
||||
|
||||
#endif /* _SYS_ZAP_IMPL_H */
|
103
include/grub/zfs/zap_leaf.h
Normal file
103
include/grub/zfs/zap_leaf.h
Normal file
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ZAP_LEAF_H
|
||||
#define _SYS_ZAP_LEAF_H
|
||||
|
||||
#define ZAP_LEAF_MAGIC 0x2AB1EAF
|
||||
|
||||
/* chunk size = 24 bytes */
|
||||
#define ZAP_LEAF_CHUNKSIZE 24
|
||||
|
||||
/*
|
||||
* The amount of space within the chunk available for the array is:
|
||||
* chunk size - space for type (1) - space for next pointer (2)
|
||||
*/
|
||||
#define ZAP_LEAF_ARRAY_BYTES (ZAP_LEAF_CHUNKSIZE - 3)
|
||||
|
||||
typedef enum zap_chunk_type {
|
||||
ZAP_CHUNK_FREE = 253,
|
||||
ZAP_CHUNK_ENTRY = 252,
|
||||
ZAP_CHUNK_ARRAY = 251,
|
||||
ZAP_CHUNK_TYPE_MAX = 250
|
||||
} zap_chunk_type_t;
|
||||
|
||||
/*
|
||||
* TAKE NOTE:
|
||||
* If zap_leaf_phys_t is modified, zap_leaf_byteswap() must be modified.
|
||||
*/
|
||||
typedef struct zap_leaf_phys {
|
||||
struct zap_leaf_header {
|
||||
grub_uint64_t lh_block_type; /* ZBT_LEAF */
|
||||
grub_uint64_t lh_pad1;
|
||||
grub_uint64_t lh_prefix; /* hash prefix of this leaf */
|
||||
grub_uint32_t lh_magic; /* ZAP_LEAF_MAGIC */
|
||||
grub_uint16_t lh_nfree; /* number free chunks */
|
||||
grub_uint16_t lh_nentries; /* number of entries */
|
||||
grub_uint16_t lh_prefix_len; /* num bits used to id this */
|
||||
|
||||
/* above is accessable to zap, below is zap_leaf private */
|
||||
|
||||
grub_uint16_t lh_freelist; /* chunk head of free list */
|
||||
grub_uint8_t lh_pad2[12];
|
||||
} l_hdr; /* 2 24-byte chunks */
|
||||
|
||||
/*
|
||||
* The header is followed by a hash table with
|
||||
* ZAP_LEAF_HASH_NUMENTRIES(zap) entries. The hash table is
|
||||
* followed by an array of ZAP_LEAF_NUMCHUNKS(zap)
|
||||
* zap_leaf_chunk structures. These structures are accessed
|
||||
* with the ZAP_LEAF_CHUNK() macro.
|
||||
*/
|
||||
|
||||
grub_uint16_t l_hash[1];
|
||||
} zap_leaf_phys_t;
|
||||
|
||||
typedef union zap_leaf_chunk {
|
||||
struct zap_leaf_entry {
|
||||
grub_uint8_t le_type; /* always ZAP_CHUNK_ENTRY */
|
||||
grub_uint8_t le_int_size; /* size of ints */
|
||||
grub_uint16_t le_next; /* next entry in hash chain */
|
||||
grub_uint16_t le_name_chunk; /* first chunk of the name */
|
||||
grub_uint16_t le_name_length; /* bytes in name, incl null */
|
||||
grub_uint16_t le_value_chunk; /* first chunk of the value */
|
||||
grub_uint16_t le_value_length; /* value length in ints */
|
||||
grub_uint32_t le_cd; /* collision differentiator */
|
||||
grub_uint64_t le_hash; /* hash value of the name */
|
||||
} l_entry;
|
||||
struct zap_leaf_array {
|
||||
grub_uint8_t la_type; /* always ZAP_CHUNK_ARRAY */
|
||||
union
|
||||
{
|
||||
grub_uint8_t la_array[ZAP_LEAF_ARRAY_BYTES];
|
||||
grub_uint64_t la_array64;
|
||||
};
|
||||
grub_uint16_t la_next; /* next blk or CHAIN_END */
|
||||
} l_array;
|
||||
struct zap_leaf_free {
|
||||
grub_uint8_t lf_type; /* always ZAP_CHUNK_FREE */
|
||||
grub_uint8_t lf_pad[ZAP_LEAF_ARRAY_BYTES];
|
||||
grub_uint16_t lf_next; /* next in free list, or CHAIN_END */
|
||||
} l_free;
|
||||
} zap_leaf_chunk_t;
|
||||
|
||||
#endif /* _SYS_ZAP_LEAF_H */
|
123
include/grub/zfs/zfs.h
Normal file
123
include/grub/zfs/zfs.h
Normal file
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_ZFS_HEADER
|
||||
#define GRUB_ZFS_HEADER 1
|
||||
|
||||
#include <grub/err.h>
|
||||
#include <grub/disk.h>
|
||||
|
||||
/*
|
||||
* On-disk version number.
|
||||
*/
|
||||
#define SPA_VERSION 28ULL
|
||||
|
||||
/*
|
||||
* The following are configuration names used in the nvlist describing a pool's
|
||||
* configuration.
|
||||
*/
|
||||
#define ZPOOL_CONFIG_VERSION "version"
|
||||
#define ZPOOL_CONFIG_POOL_NAME "name"
|
||||
#define ZPOOL_CONFIG_POOL_STATE "state"
|
||||
#define ZPOOL_CONFIG_POOL_TXG "txg"
|
||||
#define ZPOOL_CONFIG_POOL_GUID "pool_guid"
|
||||
#define ZPOOL_CONFIG_CREATE_TXG "create_txg"
|
||||
#define ZPOOL_CONFIG_TOP_GUID "top_guid"
|
||||
#define ZPOOL_CONFIG_VDEV_TREE "vdev_tree"
|
||||
#define ZPOOL_CONFIG_TYPE "type"
|
||||
#define ZPOOL_CONFIG_CHILDREN "children"
|
||||
#define ZPOOL_CONFIG_ID "id"
|
||||
#define ZPOOL_CONFIG_GUID "guid"
|
||||
#define ZPOOL_CONFIG_PATH "path"
|
||||
#define ZPOOL_CONFIG_DEVID "devid"
|
||||
#define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array"
|
||||
#define ZPOOL_CONFIG_METASLAB_SHIFT "metaslab_shift"
|
||||
#define ZPOOL_CONFIG_ASHIFT "ashift"
|
||||
#define ZPOOL_CONFIG_ASIZE "asize"
|
||||
#define ZPOOL_CONFIG_DTL "DTL"
|
||||
#define ZPOOL_CONFIG_STATS "stats"
|
||||
#define ZPOOL_CONFIG_WHOLE_DISK "whole_disk"
|
||||
#define ZPOOL_CONFIG_ERRCOUNT "error_count"
|
||||
#define ZPOOL_CONFIG_NOT_PRESENT "not_present"
|
||||
#define ZPOOL_CONFIG_SPARES "spares"
|
||||
#define ZPOOL_CONFIG_IS_SPARE "is_spare"
|
||||
#define ZPOOL_CONFIG_NPARITY "nparity"
|
||||
#define ZPOOL_CONFIG_PHYS_PATH "phys_path"
|
||||
#define ZPOOL_CONFIG_L2CACHE "l2cache"
|
||||
#define ZPOOL_CONFIG_HOLE_ARRAY "hole_array"
|
||||
#define ZPOOL_CONFIG_VDEV_CHILDREN "vdev_children"
|
||||
#define ZPOOL_CONFIG_IS_HOLE "is_hole"
|
||||
#define ZPOOL_CONFIG_DDT_HISTOGRAM "ddt_histogram"
|
||||
#define ZPOOL_CONFIG_DDT_OBJ_STATS "ddt_object_stats"
|
||||
#define ZPOOL_CONFIG_DDT_STATS "ddt_stats"
|
||||
/*
|
||||
* The persistent vdev state is stored as separate values rather than a single
|
||||
* 'vdev_state' entry. This is because a device can be in multiple states, such
|
||||
* as offline and degraded.
|
||||
*/
|
||||
#define ZPOOL_CONFIG_OFFLINE "offline"
|
||||
#define ZPOOL_CONFIG_FAULTED "faulted"
|
||||
#define ZPOOL_CONFIG_DEGRADED "degraded"
|
||||
#define ZPOOL_CONFIG_REMOVED "removed"
|
||||
|
||||
#define VDEV_TYPE_ROOT "root"
|
||||
#define VDEV_TYPE_MIRROR "mirror"
|
||||
#define VDEV_TYPE_REPLACING "replacing"
|
||||
#define VDEV_TYPE_RAIDZ "raidz"
|
||||
#define VDEV_TYPE_DISK "disk"
|
||||
#define VDEV_TYPE_FILE "file"
|
||||
#define VDEV_TYPE_MISSING "missing"
|
||||
#define VDEV_TYPE_HOLE "hole"
|
||||
#define VDEV_TYPE_SPARE "spare"
|
||||
#define VDEV_TYPE_L2CACHE "l2cache"
|
||||
|
||||
/*
|
||||
* pool state. The following states are written to disk as part of the normal
|
||||
* SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining
|
||||
* states are software abstractions used at various levels to communicate pool
|
||||
* state.
|
||||
*/
|
||||
typedef enum pool_state {
|
||||
POOL_STATE_ACTIVE = 0, /* In active use */
|
||||
POOL_STATE_EXPORTED, /* Explicitly exported */
|
||||
POOL_STATE_DESTROYED, /* Explicitly destroyed */
|
||||
POOL_STATE_SPARE, /* Reserved for hot spare use */
|
||||
POOL_STATE_L2CACHE, /* Level 2 ARC device */
|
||||
POOL_STATE_UNINITIALIZED, /* Internal spa_t state */
|
||||
POOL_STATE_UNAVAIL, /* Internal libzfs state */
|
||||
POOL_STATE_POTENTIALLY_ACTIVE /* Internal libzfs state */
|
||||
} pool_state_t;
|
||||
|
||||
struct grub_zfs_data;
|
||||
|
||||
grub_err_t grub_zfs_fetch_nvlist (grub_device_t dev, char **nvlist);
|
||||
grub_err_t grub_zfs_getmdnobj (grub_device_t dev, const char *fsfilename,
|
||||
grub_uint64_t *mdnobj);
|
||||
|
||||
char *grub_zfs_nvlist_lookup_string (char *nvlist, char *name);
|
||||
char *grub_zfs_nvlist_lookup_nvlist (char *nvlist, char *name);
|
||||
int grub_zfs_nvlist_lookup_uint64 (char *nvlist, char *name,
|
||||
grub_uint64_t *out);
|
||||
char *grub_zfs_nvlist_lookup_nvlist_array (char *nvlist, char *name,
|
||||
grub_size_t index);
|
||||
int grub_zfs_nvlist_lookup_nvlist_array_get_nelm (char *nvlist, char *name);
|
||||
|
||||
#endif /* ! GRUB_ZFS_HEADER */
|
59
include/grub/zfs/zfs_acl.h
Normal file
59
include/grub/zfs/zfs_acl.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_FS_ZFS_ACL_H
|
||||
#define _SYS_FS_ZFS_ACL_H
|
||||
|
||||
#ifndef _UID_T
|
||||
#define _UID_T
|
||||
typedef unsigned int uid_t; /* UID type */
|
||||
#endif /* _UID_T */
|
||||
|
||||
typedef struct zfs_oldace {
|
||||
grub_uint32_t z_fuid; /* "who" */
|
||||
grub_uint32_t z_access_mask; /* access mask */
|
||||
grub_uint16_t z_flags; /* flags, i.e inheritance */
|
||||
grub_uint16_t z_type; /* type of entry allow/deny */
|
||||
} zfs_oldace_t;
|
||||
|
||||
#define ACE_SLOT_CNT 6
|
||||
|
||||
typedef struct zfs_znode_acl_v0 {
|
||||
grub_uint64_t z_acl_extern_obj; /* ext acl pieces */
|
||||
grub_uint32_t z_acl_count; /* Number of ACEs */
|
||||
grub_uint16_t z_acl_version; /* acl version */
|
||||
grub_uint16_t z_acl_pad; /* pad */
|
||||
zfs_oldace_t z_ace_data[ACE_SLOT_CNT]; /* 6 standard ACEs */
|
||||
} zfs_znode_acl_v0_t;
|
||||
|
||||
#define ZFS_ACE_SPACE (sizeof (zfs_oldace_t) * ACE_SLOT_CNT)
|
||||
|
||||
typedef struct zfs_znode_acl {
|
||||
grub_uint64_t z_acl_extern_obj; /* ext acl pieces */
|
||||
grub_uint32_t z_acl_size; /* Number of bytes in ACL */
|
||||
grub_uint16_t z_acl_version; /* acl version */
|
||||
grub_uint16_t z_acl_count; /* ace count */
|
||||
grub_uint8_t z_ace_data[ZFS_ACE_SPACE]; /* space for embedded ACEs */
|
||||
} zfs_znode_acl_t;
|
||||
|
||||
|
||||
#endif /* _SYS_FS_ZFS_ACL_H */
|
70
include/grub/zfs/zfs_znode.h
Normal file
70
include/grub/zfs/zfs_znode.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_FS_ZFS_ZNODE_H
|
||||
#define _SYS_FS_ZFS_ZNODE_H
|
||||
|
||||
#include <grub/zfs/zfs_acl.h>
|
||||
|
||||
#define MASTER_NODE_OBJ 1
|
||||
#define ZFS_ROOT_OBJ "ROOT"
|
||||
#define ZPL_VERSION_STR "VERSION"
|
||||
#define ZFS_SA_ATTRS "SA_ATTRS"
|
||||
|
||||
#define ZPL_VERSION 5ULL
|
||||
|
||||
#define ZFS_DIRENT_OBJ(de) BF64_GET(de, 0, 48)
|
||||
|
||||
/*
|
||||
* This is the persistent portion of the znode. It is stored
|
||||
* in the "bonus buffer" of the file. Short symbolic links
|
||||
* are also stored in the bonus buffer.
|
||||
*/
|
||||
typedef struct znode_phys {
|
||||
grub_uint64_t zp_atime[2]; /* 0 - last file access time */
|
||||
grub_uint64_t zp_mtime[2]; /* 16 - last file modification time */
|
||||
grub_uint64_t zp_ctime[2]; /* 32 - last file change time */
|
||||
grub_uint64_t zp_crtime[2]; /* 48 - creation time */
|
||||
grub_uint64_t zp_gen; /* 64 - generation (txg of creation) */
|
||||
grub_uint64_t zp_mode; /* 72 - file mode bits */
|
||||
grub_uint64_t zp_size; /* 80 - size of file */
|
||||
grub_uint64_t zp_parent; /* 88 - directory parent (`..') */
|
||||
grub_uint64_t zp_links; /* 96 - number of links to file */
|
||||
grub_uint64_t zp_xattr; /* 104 - DMU object for xattrs */
|
||||
grub_uint64_t zp_rdev; /* 112 - dev_t for VBLK & VCHR files */
|
||||
grub_uint64_t zp_flags; /* 120 - persistent flags */
|
||||
grub_uint64_t zp_uid; /* 128 - file owner */
|
||||
grub_uint64_t zp_gid; /* 136 - owning group */
|
||||
grub_uint64_t zp_pad[4]; /* 144 - future */
|
||||
zfs_znode_acl_t zp_acl; /* 176 - 263 ACL */
|
||||
/*
|
||||
* Data may pad out any remaining bytes in the znode buffer, eg:
|
||||
*
|
||||
* |<---------------------- dnode_phys (512) ------------------------>|
|
||||
* |<-- dnode (192) --->|<----------- "bonus" buffer (320) ---------->|
|
||||
* |<---- znode (264) ---->|<---- data (56) ---->|
|
||||
*
|
||||
* At present, we only use this space to store symbolic links.
|
||||
*/
|
||||
} znode_phys_t;
|
||||
|
||||
#endif /* _SYS_FS_ZFS_ZNODE_H */
|
56
include/grub/zfs/zil.h
Normal file
56
include/grub/zfs/zil.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ZIL_H
|
||||
#define _SYS_ZIL_H
|
||||
|
||||
/*
|
||||
* Intent log format:
|
||||
*
|
||||
* Each objset has its own intent log. The log header (zil_header_t)
|
||||
* for objset N's intent log is kept in the Nth object of the SPA's
|
||||
* intent_log objset. The log header points to a chain of log blocks,
|
||||
* each of which contains log records (i.e., transactions) followed by
|
||||
* a log block trailer (zil_trailer_t). The format of a log record
|
||||
* depends on the record (or transaction) type, but all records begin
|
||||
* with a common structure that defines the type, length, and txg.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Intent log header - this on disk structure holds fields to manage
|
||||
* the log. All fields are 64 bit to easily handle cross architectures.
|
||||
*/
|
||||
typedef struct zil_header {
|
||||
grub_uint64_t zh_claim_txg; /* txg in which log blocks were claimed */
|
||||
grub_uint64_t zh_replay_seq; /* highest replayed sequence number */
|
||||
blkptr_t zh_log; /* log chain */
|
||||
grub_uint64_t zh_claim_seq; /* highest claimed sequence number */
|
||||
grub_uint64_t zh_flags; /* header flags */
|
||||
grub_uint64_t zh_pad[4];
|
||||
} zil_header_t;
|
||||
|
||||
/*
|
||||
* zh_flags bit settings
|
||||
*/
|
||||
#define ZIL_REPLAY_NEEDED 0x1 /* replay needed - internal only */
|
||||
|
||||
#endif /* _SYS_ZIL_H */
|
84
include/grub/zfs/zio.h
Normal file
84
include/grub/zfs/zio.h
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _ZIO_H
|
||||
#define _ZIO_H
|
||||
|
||||
#include <grub/zfs/spa.h>
|
||||
|
||||
#define ZEC_MAGIC 0x210da7ab10c7a11ULL /* zio data bloc tail */
|
||||
|
||||
typedef struct zio_eck {
|
||||
grub_uint64_t zec_magic; /* for validation, endianness */
|
||||
zio_cksum_t zec_cksum; /* 256-bit checksum */
|
||||
} zio_eck_t;
|
||||
|
||||
/*
|
||||
* Gang block headers are self-checksumming and contain an array
|
||||
* of block pointers.
|
||||
*/
|
||||
#define SPA_GANGBLOCKSIZE SPA_MINBLOCKSIZE
|
||||
#define SPA_GBH_NBLKPTRS ((SPA_GANGBLOCKSIZE - \
|
||||
sizeof (zio_eck_t)) / sizeof (blkptr_t))
|
||||
#define SPA_GBH_FILLER ((SPA_GANGBLOCKSIZE - \
|
||||
sizeof (zio_eck_t) - \
|
||||
(SPA_GBH_NBLKPTRS * sizeof (blkptr_t))) /\
|
||||
sizeof (grub_uint64_t))
|
||||
|
||||
#define ZIO_GET_IOSIZE(zio) \
|
||||
(BP_IS_GANG((zio)->io_bp) ? \
|
||||
SPA_GANGBLOCKSIZE : BP_GET_PSIZE((zio)->io_bp))
|
||||
|
||||
typedef struct zio_gbh {
|
||||
blkptr_t zg_blkptr[SPA_GBH_NBLKPTRS];
|
||||
grub_uint64_t zg_filler[SPA_GBH_FILLER];
|
||||
zio_eck_t zg_tail;
|
||||
} zio_gbh_phys_t;
|
||||
|
||||
enum zio_checksum {
|
||||
ZIO_CHECKSUM_INHERIT = 0,
|
||||
ZIO_CHECKSUM_ON,
|
||||
ZIO_CHECKSUM_OFF,
|
||||
ZIO_CHECKSUM_LABEL,
|
||||
ZIO_CHECKSUM_GANG_HEADER,
|
||||
ZIO_CHECKSUM_ZILOG,
|
||||
ZIO_CHECKSUM_FLETCHER_2,
|
||||
ZIO_CHECKSUM_FLETCHER_4,
|
||||
ZIO_CHECKSUM_SHA256,
|
||||
ZIO_CHECKSUM_ZILOG2,
|
||||
ZIO_CHECKSUM_FUNCTIONS
|
||||
};
|
||||
|
||||
#define ZIO_CHECKSUM_ON_VALUE ZIO_CHECKSUM_FLETCHER_2
|
||||
#define ZIO_CHECKSUM_DEFAULT ZIO_CHECKSUM_ON
|
||||
|
||||
enum zio_compress {
|
||||
ZIO_COMPRESS_INHERIT = 0,
|
||||
ZIO_COMPRESS_ON,
|
||||
ZIO_COMPRESS_OFF,
|
||||
ZIO_COMPRESS_LZJB,
|
||||
ZIO_COMPRESS_EMPTY,
|
||||
ZIO_COMPRESS_GZIP,
|
||||
ZIO_COMPRESS_FUNCTIONS
|
||||
};
|
||||
|
||||
#endif /* _ZIO_H */
|
49
include/grub/zfs/zio_checksum.h
Normal file
49
include/grub/zfs/zio_checksum.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004 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/>.
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ZIO_CHECKSUM_H
|
||||
#define _SYS_ZIO_CHECKSUM_H
|
||||
|
||||
/*
|
||||
* Signature for checksum functions.
|
||||
*/
|
||||
typedef void zio_checksum_t(const void *data, grub_uint64_t size,
|
||||
grub_zfs_endian_t endian, zio_cksum_t *zcp);
|
||||
|
||||
/*
|
||||
* Information about each checksum function.
|
||||
*/
|
||||
typedef struct zio_checksum_info {
|
||||
zio_checksum_t *ci_func; /* checksum function for each byteorder */
|
||||
int ci_correctable; /* number of correctable bits */
|
||||
int ci_eck; /* uses zio embedded checksum? */
|
||||
char *ci_name; /* descriptive name */
|
||||
} zio_checksum_info_t;
|
||||
|
||||
extern void zio_checksum_SHA256 (const void *, grub_uint64_t,
|
||||
grub_zfs_endian_t endian, zio_cksum_t *);
|
||||
extern void fletcher_2 (const void *, grub_uint64_t, grub_zfs_endian_t endian,
|
||||
zio_cksum_t *);
|
||||
extern void fletcher_4 (const void *, grub_uint64_t, grub_zfs_endian_t endian,
|
||||
zio_cksum_t *);
|
||||
|
||||
#endif /* _SYS_ZIO_CHECKSUM_H */
|
|
@ -1,5 +1,5 @@
|
|||
/* multiboot.h - Multiboot header file. */
|
||||
/* Copyright (C) 1999,2003,2007,2008,2009 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1999,2003,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -236,6 +236,7 @@ struct multiboot_mmap_entry
|
|||
#define MULTIBOOT_MEMORY_RESERVED 2
|
||||
#define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
|
||||
#define MULTIBOOT_MEMORY_NVS 4
|
||||
#define MULTIBOOT_MEMORY_BADRAM 5
|
||||
multiboot_uint32_t type;
|
||||
} __attribute__((packed));
|
||||
typedef struct multiboot_mmap_entry multiboot_memory_map_t;
|
||||
|
@ -254,6 +255,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 */
|
||||
|
|
|
@ -52,6 +52,12 @@
|
|||
#define MULTIBOOT_TAG_TYPE_FRAMEBUFFER 8
|
||||
#define MULTIBOOT_TAG_TYPE_ELF_SECTIONS 9
|
||||
#define MULTIBOOT_TAG_TYPE_APM 10
|
||||
#define MULTIBOOT_TAG_TYPE_EFI32 11
|
||||
#define MULTIBOOT_TAG_TYPE_EFI64 12
|
||||
#define MULTIBOOT_TAG_TYPE_SMBIOS 13
|
||||
#define MULTIBOOT_TAG_TYPE_ACPI_OLD 14
|
||||
#define MULTIBOOT_TAG_TYPE_ACPI_NEW 15
|
||||
#define MULTIBOOT_TAG_TYPE_NETWORK 16
|
||||
|
||||
#define MULTIBOOT_HEADER_TAG_END 0
|
||||
#define MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST 1
|
||||
|
@ -167,6 +173,7 @@ struct multiboot_mmap_entry
|
|||
#define MULTIBOOT_MEMORY_RESERVED 2
|
||||
#define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
|
||||
#define MULTIBOOT_MEMORY_NVS 4
|
||||
#define MULTIBOOT_MEMORY_BADRAM 5
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t zero;
|
||||
} __attribute__((packed));
|
||||
|
@ -309,6 +316,51 @@ struct multiboot_tag_apm
|
|||
multiboot_uint16_t dseg_len;
|
||||
};
|
||||
|
||||
struct multiboot_tag_efi32
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint32_t pointer;
|
||||
};
|
||||
|
||||
struct multiboot_tag_efi64
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint64_t pointer;
|
||||
};
|
||||
|
||||
struct multiboot_tag_smbios
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint8_t major;
|
||||
multiboot_uint8_t minor;
|
||||
multiboot_uint8_t reserved[6];
|
||||
multiboot_uint8_t tables[0];
|
||||
};
|
||||
|
||||
struct multiboot_tag_old_acpi
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint8_t rsdp[0];
|
||||
};
|
||||
|
||||
struct multiboot_tag_new_acpi
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint8_t rsdp[0];
|
||||
};
|
||||
|
||||
struct multiboot_tag_network
|
||||
{
|
||||
multiboot_uint32_t type;
|
||||
multiboot_uint32_t size;
|
||||
multiboot_uint8_t dhcpack[0];
|
||||
};
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#endif /* ! MULTIBOOT_HEADER */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue