merge with mainline
This commit is contained in:
commit
20ebf73276
223 changed files with 8279 additions and 14993 deletions
|
@ -115,12 +115,7 @@ grub_command_execute (const char *name, int argc, char **argv)
|
|||
return (cmd) ? cmd->func (cmd, argc, argv) : GRUB_ERR_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_command_iterate (int (*func) (grub_command_t))
|
||||
{
|
||||
return grub_list_iterate (GRUB_AS_LIST (grub_command_list),
|
||||
(grub_list_hook_t) func);
|
||||
}
|
||||
#define FOR_COMMANDS(var) FOR_LIST_ELEMENTS((var), grub_command_list)
|
||||
|
||||
void grub_register_core_commands (void);
|
||||
|
||||
|
|
190
include/grub/cs5536.h
Normal file
190
include/grub/cs5536.h
Normal file
|
@ -0,0 +1,190 @@
|
|||
/*
|
||||
* 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_CS5536_HEADER
|
||||
#define GRUB_CS5536_HEADER 1
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#include <grub/pci.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/smbus.h>
|
||||
#endif
|
||||
|
||||
#define GRUB_CS5536_PCIID 0x208f1022
|
||||
#define GRUB_CS5536_MSR_MAILBOX_ADDR 0xf4
|
||||
#define GRUB_CS5536_MSR_MAILBOX_DATA0 0xf8
|
||||
#define GRUB_CS5536_MSR_MAILBOX_DATA1 0xfc
|
||||
#define GRUB_CS5536_MSR_IRQ_MAP_BAR 0x80000008
|
||||
#define GRUB_CS5536_MSR_SMB_BAR 0x8000000b
|
||||
|
||||
#define GRUB_CS5536_SMBUS_REGS_SIZE 8
|
||||
#define GRUB_CS5536_GPIO_REGS_SIZE 256
|
||||
#define GRUB_CS5536_MFGPT_REGS_SIZE 64
|
||||
#define GRUB_CS5536_IRQ_MAP_REGS_SIZE 32
|
||||
#define GRUB_CS5536_PM_REGS_SIZE 128
|
||||
#define GRUB_CS5536_ACPI_REGS_SIZE 32
|
||||
|
||||
#define GRUB_CS5536_USB_OPTION_REGS_SIZE 0x1c
|
||||
#define GRUB_CS5536_USB_OPTION_REG_UOCMUX 1
|
||||
#define GRUB_CS5536_USB_OPTION_REG_UOCMUX_PMUX_MASK 0x03
|
||||
#define GRUB_CS5536_USB_OPTION_REG_UOCMUX_PMUX_HC 0x02
|
||||
|
||||
#define GRUB_CS5536_DESTINATION_GLIU 0
|
||||
#define GRUB_CS5536_DESTINATION_GLPCI_SB 1
|
||||
#define GRUB_CS5536_DESTINATION_USB 2
|
||||
#define GRUB_CS5536_DESTINATION_IDE 3
|
||||
#define GRUB_CS5536_DESTINATION_DD 4
|
||||
#define GRUB_CS5536_DESTINATION_ACC 5
|
||||
#define GRUB_CS5536_DESTINATION_GLCP 7
|
||||
|
||||
#define GRUB_CS5536_P2D_DEST_SHIFT 61
|
||||
#define GRUB_CS5536_P2D_LOG_ALIGN 12
|
||||
#define GRUB_CS5536_P2D_ALIGN (1 << GRUB_CS5536_P2D_LOG_ALIGN)
|
||||
#define GRUB_CS5536_P2D_BASE_SHIFT 20
|
||||
#define GRUB_CS5536_P2D_MASK_SHIFT 0
|
||||
|
||||
#define GRUB_CS5536_MSR_GL_IOD_START 0x000100e0
|
||||
#define GRUB_CS5536_IOD_DEST_SHIFT 61
|
||||
#define GRUB_CS5536_IOD_BASE_SHIFT 20
|
||||
#define GRUB_CS5536_IOD_MASK_SHIFT 0
|
||||
#define GRUB_CS5536_IOD_ADDR_MASK 0xfffff
|
||||
|
||||
#define GRUB_CS5536_MSR_GPIO_BAR 0x8000000c
|
||||
#define GRUB_CS5536_MSR_MFGPT_BAR 0x8000000d
|
||||
#define GRUB_CS5536_MSR_ACPI_BAR 0x8000000e
|
||||
#define GRUB_CS5536_MSR_PM_BAR 0x8000000f
|
||||
#define GRUB_CS5536_MSR_DIVIL_LEG_IO 0x80000014
|
||||
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0 0x00000001
|
||||
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1 0x00000002
|
||||
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_MODE_X86 0x10000000
|
||||
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP 0x04000000
|
||||
#define GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_PRIMARY_MASK 0x80000024
|
||||
#define GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_LPC_MASK 0x80000025
|
||||
#define GRUB_CS5536_DIVIL_LPC_INTERRUPTS 0x1002
|
||||
#define GRUB_CS5536_MSR_DIVIL_LPC_SERIAL_IRQ_CONTROL 0x8000004e
|
||||
#define GRUB_CS5536_MSR_DIVIL_LPC_SERIAL_IRQ_CONTROL_ENABLE 0x80
|
||||
|
||||
#define GRUB_CS5536_MSR_USB_OHCI_BASE 0x40000008
|
||||
#define GRUB_CS5536_MSR_USB_EHCI_BASE 0x40000009
|
||||
#define GRUB_CS5536_MSR_USB_CONTROLLER_BASE 0x4000000a
|
||||
#define GRUB_CS5536_MSR_USB_OPTION_CONTROLLER_BASE 0x4000000b
|
||||
#define GRUB_CS5536_MSR_USB_BASE_ADDR_MASK 0x00ffffff00ULL
|
||||
#define GRUB_CS5536_MSR_USB_BASE_BUS_MASTER 0x0400000000ULL
|
||||
#define GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE 0x0200000000ULL
|
||||
#define GRUB_CS5536_MSR_USB_BASE_PME_ENABLED 0x0800000000ULL
|
||||
#define GRUB_CS5536_MSR_USB_BASE_PME_STATUS 0x1000000000ULL
|
||||
#define GRUB_CS5536_MSR_USB_EHCI_BASE_FLDJ_SHIFT 40
|
||||
|
||||
#define GRUB_CS5536_MSR_IDE_IO_BAR 0x60000008
|
||||
#define GRUB_CS5536_MSR_IDE_IO_BAR_UNITS 1
|
||||
#define GRUB_CS5536_MSR_IDE_IO_BAR_ADDR_MASK 0xfffffff0
|
||||
#define GRUB_CS5536_MSR_IDE_CFG 0x60000010
|
||||
#define GRUB_CS5536_MSR_IDE_CFG_CHANNEL_ENABLE 2
|
||||
#define GRUB_CS5536_MSR_IDE_TIMING 0x60000012
|
||||
#define GRUB_CS5536_MSR_IDE_TIMING_PIO0 0x98
|
||||
#define GRUB_CS5536_MSR_IDE_TIMING_DRIVE0_SHIFT 24
|
||||
#define GRUB_CS5536_MSR_IDE_TIMING_DRIVE1_SHIFT 16
|
||||
#define GRUB_CS5536_MSR_IDE_CAS_TIMING 0x60000013
|
||||
#define GRUB_CS5536_MSR_IDE_CAS_TIMING_CMD_PIO0 0x99
|
||||
#define GRUB_CS5536_MSR_IDE_CAS_TIMING_CMD_SHIFT 24
|
||||
#define GRUB_CS5536_MSR_IDE_CAS_TIMING_DRIVE0_SHIFT 6
|
||||
#define GRUB_CS5536_MSR_IDE_CAS_TIMING_DRIVE1_SHIFT 4
|
||||
#define GRUB_CS5536_MSR_IDE_CAS_TIMING_PIO0 2
|
||||
|
||||
#define GRUB_CS5536_MSR_GL_PCI_CTRL 0x00000010
|
||||
#define GRUB_CS5536_MSR_GL_PCI_CTRL_MEMORY_ENABLE 1
|
||||
#define GRUB_CS5536_MSR_GL_PCI_CTRL_IO_ENABLE 2
|
||||
#define GRUB_CS5536_MSR_GL_PCI_CTRL_LATENCY_SHIFT 35
|
||||
#define GRUB_CS5536_MSR_GL_PCI_CTRL_OUT_THR_SHIFT 60
|
||||
#define GRUB_CS5536_MSR_GL_PCI_CTRL_IN_THR_SHIFT 56
|
||||
|
||||
#define GRUB_CS5536_MSR_GL_REGIONS_START 0x00000020
|
||||
#define GRUB_CS5536_MSR_GL_REGIONS_NUM 16
|
||||
#define GRUB_CS5536_MSR_GL_REGION_ENABLE 1
|
||||
#define GRUB_CS5536_MSR_GL_REGION_IO 0x100000000ULL
|
||||
#define GRUB_CS5536_MSR_GL_REGION_BASE_MASK 0xfffff000ULL
|
||||
#define GRUB_CS5536_MSR_GL_REGION_IO_BASE_SHIFT 12
|
||||
#define GRUB_CS5536_MSR_GL_REGION_TOP_MASK 0xfffff00000000000ULL
|
||||
#define GRUB_CS5536_MSR_GL_REGION_IO_TOP_SHIFT 44
|
||||
|
||||
#define GRUB_CS5536_MSR_GL_P2D_START 0x00010020
|
||||
|
||||
#define GRUB_CS5536_SMB_REG_DATA 0x0
|
||||
#define GRUB_CS5536_SMB_REG_STATUS 0x1
|
||||
#define GRUB_CS5536_SMB_REG_STATUS_SDAST (1 << 6)
|
||||
#define GRUB_CS5536_SMB_REG_STATUS_BER (1 << 5)
|
||||
#define GRUB_CS5536_SMB_REG_STATUS_NACK (1 << 4)
|
||||
#define GRUB_CS5536_SMB_REG_CTRL1 0x3
|
||||
#define GRUB_CS5536_SMB_REG_CTRL1_START 0x01
|
||||
#define GRUB_CS5536_SMB_REG_CTRL1_STOP 0x02
|
||||
#define GRUB_CS5536_SMB_REG_CTRL1_ACK 0x10
|
||||
#define GRUB_CS5536_SMB_REG_ADDR 0x4
|
||||
#define GRUB_CS5536_SMB_REG_ADDR_MASTER 0x0
|
||||
#define GRUB_CS5536_SMB_REG_CTRL2 0x5
|
||||
#define GRUB_CS5536_SMB_REG_CTRL2_ENABLE 0x1
|
||||
#define GRUB_CS5536_SMB_REG_CTRL3 0x6
|
||||
|
||||
#ifdef ASM_FILE
|
||||
#define GRUB_ULL(x) x
|
||||
#else
|
||||
#define GRUB_ULL(x) x ## ULL
|
||||
#endif
|
||||
|
||||
#define GRUB_CS5536_LBAR_ADDR_MASK GRUB_ULL (0x000000000000fff8)
|
||||
#define GRUB_CS5536_LBAR_ENABLE GRUB_ULL (0x0000000100000000)
|
||||
#define GRUB_CS5536_LBAR_MASK_MASK GRUB_ULL (0x0000f00000000000)
|
||||
#define GRUB_CS5536_LBAR_TURN_ON (GRUB_CS5536_LBAR_ENABLE | GRUB_CS5536_LBAR_MASK_MASK)
|
||||
|
||||
/* PMON-compatible LBARs. */
|
||||
#define GRUB_CS5536_LBAR_GPIO 0xb000
|
||||
#define GRUB_CS5536_LBAR_ACC 0xb200
|
||||
#define GRUB_CS5536_LBAR_PM 0xb280
|
||||
#define GRUB_CS5536_LBAR_MFGPT 0xb300
|
||||
#define GRUB_CS5536_LBAR_ACPI 0xb340
|
||||
#define GRUB_CS5536_LBAR_IRQ_MAP 0xb360
|
||||
#define GRUB_CS5536_LBAR_IDE 0xb380
|
||||
#define GRUB_CS5536_LBAR_SMBUS 0xb390
|
||||
|
||||
#define GRUB_GPIO_SMBUS_PINS ((1 << 14) | (1 << 15))
|
||||
#define GRUB_GPIO_REG_OUT_EN 0x4
|
||||
#define GRUB_GPIO_REG_OUT_AUX1 0x10
|
||||
#define GRUB_GPIO_REG_IN_EN 0x20
|
||||
#define GRUB_GPIO_REG_IN_AUX1 0x34
|
||||
|
||||
#ifndef ASM_FILE
|
||||
int EXPORT_FUNC (grub_cs5536_find) (grub_pci_device_t *devp);
|
||||
|
||||
grub_uint64_t EXPORT_FUNC (grub_cs5536_read_msr) (grub_pci_device_t dev,
|
||||
grub_uint32_t addr);
|
||||
void EXPORT_FUNC (grub_cs5536_write_msr) (grub_pci_device_t dev,
|
||||
grub_uint32_t addr,
|
||||
grub_uint64_t val);
|
||||
grub_err_t grub_cs5536_read_spd_byte (grub_port_t smbbase, grub_uint8_t dev,
|
||||
grub_uint8_t addr, grub_uint8_t *res);
|
||||
grub_err_t EXPORT_FUNC (grub_cs5536_read_spd) (grub_port_t smbbase,
|
||||
grub_uint8_t dev,
|
||||
struct grub_smbus_spd *res);
|
||||
grub_err_t grub_cs5536_smbus_wait (grub_port_t smbbase);
|
||||
grub_err_t EXPORT_FUNC (grub_cs5536_init_smbus) (grub_pci_device_t dev,
|
||||
grub_uint16_t divisor,
|
||||
grub_port_t *smbbase);
|
||||
|
||||
void grub_cs5536_init_geode (grub_pci_device_t dev);
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -138,6 +138,9 @@ typedef struct grub_disk_memberlist *grub_disk_memberlist_t;
|
|||
#define GRUB_DISK_CACHE_SIZE 8
|
||||
#define GRUB_DISK_CACHE_BITS 3
|
||||
|
||||
/* Return value of grub_disk_get_size() in case disk size is unknown. */
|
||||
#define GRUB_DISK_SIZE_UNKNOWN 0xffffffffffffffffULL
|
||||
|
||||
/* This is called from the memory manager. */
|
||||
void grub_disk_cache_invalidate_all (void);
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ struct grub_dl
|
|||
Elf_Sym *symtab;
|
||||
void (*init) (struct grub_dl *mod);
|
||||
void (*fini) (void);
|
||||
struct grub_dl *next;
|
||||
};
|
||||
typedef struct grub_dl *grub_dl_t;
|
||||
|
||||
|
@ -96,24 +97,12 @@ void grub_dl_unload_all (void);
|
|||
#else
|
||||
#define GRUB_NO_MODULES 0
|
||||
#endif
|
||||
#if GRUB_NO_MODULES
|
||||
static inline int
|
||||
grub_dl_ref (grub_dl_t mod)
|
||||
{
|
||||
(void) mod;
|
||||
return 0;
|
||||
}
|
||||
static inline int
|
||||
grub_dl_unref (grub_dl_t mod)
|
||||
{
|
||||
(void) mod;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
|
||||
int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
|
||||
#endif
|
||||
void EXPORT_FUNC(grub_dl_iterate) (int (*hook) (grub_dl_t mod));
|
||||
extern grub_dl_t EXPORT_VAR(grub_dl_head);
|
||||
|
||||
#define FOR_DL_MODULES(var) FOR_LIST_ELEMENTS ((var), (grub_dl_head))
|
||||
|
||||
grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name);
|
||||
grub_err_t grub_dl_register_symbol (const char *name, void *addr,
|
||||
grub_dl_t mod);
|
||||
|
|
|
@ -99,12 +99,8 @@ struct grub_pe32_optional_header
|
|||
grub_uint32_t entry_addr;
|
||||
grub_uint32_t code_base;
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 4
|
||||
grub_uint32_t data_base;
|
||||
grub_uint32_t image_base;
|
||||
#else
|
||||
grub_uint64_t image_base;
|
||||
#endif
|
||||
|
||||
grub_uint32_t section_alignment;
|
||||
grub_uint32_t file_alignment;
|
||||
|
@ -121,22 +117,11 @@ struct grub_pe32_optional_header
|
|||
grub_uint16_t subsystem;
|
||||
grub_uint16_t dll_characteristics;
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 4
|
||||
|
||||
grub_uint32_t stack_reserve_size;
|
||||
grub_uint32_t stack_commit_size;
|
||||
grub_uint32_t heap_reserve_size;
|
||||
grub_uint32_t heap_commit_size;
|
||||
|
||||
#else
|
||||
|
||||
grub_uint64_t stack_reserve_size;
|
||||
grub_uint64_t stack_commit_size;
|
||||
grub_uint64_t heap_reserve_size;
|
||||
grub_uint64_t heap_commit_size;
|
||||
|
||||
#endif
|
||||
|
||||
grub_uint32_t loader_flags;
|
||||
grub_uint32_t num_data_directories;
|
||||
|
||||
|
@ -159,15 +144,63 @@ struct grub_pe32_optional_header
|
|||
struct grub_pe32_data_directory reserved_entry;
|
||||
};
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 4
|
||||
struct grub_pe64_optional_header
|
||||
{
|
||||
grub_uint16_t magic;
|
||||
grub_uint8_t major_linker_version;
|
||||
grub_uint8_t minor_linker_version;
|
||||
grub_uint32_t code_size;
|
||||
grub_uint32_t data_size;
|
||||
grub_uint32_t bss_size;
|
||||
grub_uint32_t entry_addr;
|
||||
grub_uint32_t code_base;
|
||||
|
||||
grub_uint64_t image_base;
|
||||
|
||||
grub_uint32_t section_alignment;
|
||||
grub_uint32_t file_alignment;
|
||||
grub_uint16_t major_os_version;
|
||||
grub_uint16_t minor_os_version;
|
||||
grub_uint16_t major_image_version;
|
||||
grub_uint16_t minor_image_version;
|
||||
grub_uint16_t major_subsystem_version;
|
||||
grub_uint16_t minor_subsystem_version;
|
||||
grub_uint32_t reserved;
|
||||
grub_uint32_t image_size;
|
||||
grub_uint32_t header_size;
|
||||
grub_uint32_t checksum;
|
||||
grub_uint16_t subsystem;
|
||||
grub_uint16_t dll_characteristics;
|
||||
|
||||
grub_uint64_t stack_reserve_size;
|
||||
grub_uint64_t stack_commit_size;
|
||||
grub_uint64_t heap_reserve_size;
|
||||
grub_uint64_t heap_commit_size;
|
||||
|
||||
grub_uint32_t loader_flags;
|
||||
grub_uint32_t num_data_directories;
|
||||
|
||||
/* Data directories. */
|
||||
struct grub_pe32_data_directory export_table;
|
||||
struct grub_pe32_data_directory import_table;
|
||||
struct grub_pe32_data_directory resource_table;
|
||||
struct grub_pe32_data_directory exception_table;
|
||||
struct grub_pe32_data_directory certificate_table;
|
||||
struct grub_pe32_data_directory base_relocation_table;
|
||||
struct grub_pe32_data_directory debug;
|
||||
struct grub_pe32_data_directory architecture;
|
||||
struct grub_pe32_data_directory global_ptr;
|
||||
struct grub_pe32_data_directory tls_table;
|
||||
struct grub_pe32_data_directory load_config_table;
|
||||
struct grub_pe32_data_directory bound_import;
|
||||
struct grub_pe32_data_directory iat;
|
||||
struct grub_pe32_data_directory delay_import_descriptor;
|
||||
struct grub_pe32_data_directory com_runtime_header;
|
||||
struct grub_pe32_data_directory reserved_entry;
|
||||
};
|
||||
|
||||
#define GRUB_PE32_PE32_MAGIC 0x10b
|
||||
|
||||
#else
|
||||
|
||||
#define GRUB_PE32_PE32_MAGIC 0x20b
|
||||
|
||||
#endif
|
||||
#define GRUB_PE32_PE64_MAGIC 0x20b
|
||||
|
||||
#define GRUB_PE32_SUBSYSTEM_EFI_APPLICATION 10
|
||||
|
||||
|
@ -205,6 +238,7 @@ struct grub_pe32_section_table
|
|||
#define GRUB_PE32_SCN_ALIGN_SHIFT 20
|
||||
#define GRUB_PE32_SCN_ALIGN_MASK 7
|
||||
|
||||
#define GRUB_PE32_SIGNATURE_SIZE 4
|
||||
|
||||
struct grub_pe32_header
|
||||
{
|
||||
|
@ -212,13 +246,18 @@ struct grub_pe32_header
|
|||
grub_uint8_t msdos_stub[GRUB_PE32_MSDOS_STUB_SIZE];
|
||||
|
||||
/* This is always PE\0\0. */
|
||||
char signature[4];
|
||||
char signature[GRUB_PE32_SIGNATURE_SIZE];
|
||||
|
||||
/* The COFF file header. */
|
||||
struct grub_pe32_coff_header coff_header;
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 8
|
||||
/* The Optional header. */
|
||||
struct grub_pe64_optional_header optional_header;
|
||||
#else
|
||||
/* The Optional header. */
|
||||
struct grub_pe32_optional_header optional_header;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct grub_pe32_fixup_block
|
||||
|
|
|
@ -32,7 +32,7 @@ enum grub_efi_uga_blt_operation
|
|||
GRUB_EFI_UGA_VIDEO_TO_BLT,
|
||||
GRUB_EFI_UGA_BLT_TO_VIDEO,
|
||||
GRUB_EFI_UGA_VIDEO_TO_VIDEO,
|
||||
GRUB_EFI_UGA_GLT_MAX
|
||||
GRUB_EFI_UGA_BLT_MAX
|
||||
};
|
||||
|
||||
struct grub_efi_uga_pixel
|
||||
|
|
|
@ -555,6 +555,7 @@ typedef struct
|
|||
#define PT_NUM 8 /* Number of defined types */
|
||||
#define PT_LOOS 0x60000000 /* Start of OS-specific */
|
||||
#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
|
||||
#define PT_GNU_STACK 0x6474e551 /* GCC stack segment */
|
||||
#define PT_LOSUNW 0x6ffffffa
|
||||
#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
|
||||
#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
|
||||
|
|
55
include/grub/emu/misc.h
Normal file
55
include/grub/emu/misc.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
#ifndef GRUB_EMU_MISC_H
|
||||
#define GRUB_EMU_MISC_H 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# include <sys/fcntl.h>
|
||||
# include <sys/cygwin.h>
|
||||
# include <limits.h>
|
||||
# define DEV_CYGDRIVE_MAJOR 98
|
||||
#endif
|
||||
|
||||
#ifdef __NetBSD__
|
||||
/* NetBSD uses /boot for its boot block. */
|
||||
# define DEFAULT_DIRECTORY "/grub"
|
||||
#else
|
||||
# define DEFAULT_DIRECTORY "/boot/grub"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
|
||||
|
||||
extern int verbosity;
|
||||
extern const char *program_name;
|
||||
|
||||
void grub_init_all (void);
|
||||
void grub_fini_all (void);
|
||||
|
||||
char *grub_make_system_path_relative_to_its_root (const char *path);
|
||||
|
||||
void * EXPORT_FUNC(xmalloc) (grub_size_t size);
|
||||
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size);
|
||||
char * EXPORT_FUNC(xstrdup) (const char *str);
|
||||
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...);
|
||||
|
||||
void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...);
|
||||
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...);
|
||||
void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((noreturn));
|
||||
|
||||
#ifndef HAVE_VASPRINTF
|
||||
int EXPORT_FUNC(vasprintf) (char **buf, const char *fmt, va_list ap);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ASPRINTF
|
||||
int EXPORT_FUNC(asprintf) (char **buf, const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...);
|
||||
extern char * canonicalize_file_name (const char *path);
|
||||
|
||||
#ifdef HAVE_DEVICE_MAPPER
|
||||
int grub_device_mapper_supported (void);
|
||||
#endif
|
||||
|
||||
#endif /* GRUB_EMU_MISC_H */
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
#include <grub/list.h>
|
||||
|
||||
/* Forward declaration is required, because of mutual reference. */
|
||||
struct grub_file;
|
||||
|
||||
|
@ -38,6 +40,9 @@ struct grub_dirhook_info
|
|||
/* Filesystem descriptor. */
|
||||
struct grub_fs
|
||||
{
|
||||
/* The next filesystem. */
|
||||
struct grub_fs *next;
|
||||
|
||||
/* My name. */
|
||||
const char *name;
|
||||
|
||||
|
@ -72,9 +77,6 @@ struct grub_fs
|
|||
/* Whether this filesystem reserves first sector for DOS-style boot. */
|
||||
int reserved_first_sector;
|
||||
#endif
|
||||
|
||||
/* The next filesystem. */
|
||||
struct grub_fs *next;
|
||||
};
|
||||
typedef struct grub_fs *grub_fs_t;
|
||||
|
||||
|
@ -87,10 +89,22 @@ extern struct grub_fs grub_fs_blocklist;
|
|||
the linked list GRUB_FS_LIST through the function grub_fs_register. */
|
||||
typedef int (*grub_fs_autoload_hook_t) (void);
|
||||
extern grub_fs_autoload_hook_t EXPORT_VAR(grub_fs_autoload_hook);
|
||||
extern grub_fs_t EXPORT_VAR (grub_fs_list);
|
||||
|
||||
static inline void
|
||||
grub_fs_register (grub_fs_t fs)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_fs_list), GRUB_AS_LIST (fs));
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_fs_unregister (grub_fs_t fs)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_fs_list), GRUB_AS_LIST (fs));
|
||||
}
|
||||
|
||||
#define FOR_FILESYSTEMS(var) FOR_LIST_ELEMENTS((var), (grub_fs_list))
|
||||
|
||||
void EXPORT_FUNC(grub_fs_register) (grub_fs_t fs);
|
||||
void EXPORT_FUNC(grub_fs_unregister) (grub_fs_t fs);
|
||||
void EXPORT_FUNC(grub_fs_iterate) (int (*hook) (const grub_fs_t fs));
|
||||
grub_fs_t EXPORT_FUNC(grub_fs_probe) (grub_device_t device);
|
||||
|
||||
#endif /* ! GRUB_FS_HEADER */
|
||||
|
|
|
@ -22,10 +22,15 @@
|
|||
#include <grub/video.h>
|
||||
#include <grub/bitmap.h>
|
||||
#include <grub/gfxmenu_view.h>
|
||||
#include <grub/mm.h>
|
||||
|
||||
#ifndef GRUB_GUI_H
|
||||
#define GRUB_GUI_H 1
|
||||
|
||||
/* The component ID identifying GUI components to be updated as the timeout
|
||||
status changes. */
|
||||
#define GRUB_GFXMENU_TIMEOUT_COMPONENT_ID "__timeout__"
|
||||
|
||||
/* A representation of a color. Unlike grub_video_color_t, this
|
||||
representation is independent of any video mode specifics. */
|
||||
typedef struct grub_gui_color
|
||||
|
@ -79,6 +84,46 @@ struct grub_gui_progress_ops
|
|||
void (*set_state) (void *self, int visible, int start, int current, int end);
|
||||
};
|
||||
|
||||
typedef void (*grub_gfxmenu_set_state_t) (void *self, int visible, int start,
|
||||
int current, int end);
|
||||
|
||||
struct grub_gfxmenu_timeout_notify
|
||||
{
|
||||
struct grub_gfxmenu_timeout_notify *next;
|
||||
grub_gfxmenu_set_state_t set_state;
|
||||
grub_gui_component_t self;
|
||||
};
|
||||
|
||||
extern struct grub_gfxmenu_timeout_notify *grub_gfxmenu_timeout_notifications;
|
||||
|
||||
static inline grub_err_t
|
||||
grub_gfxmenu_timeout_register (grub_gui_component_t self,
|
||||
grub_gfxmenu_set_state_t set_state)
|
||||
{
|
||||
struct grub_gfxmenu_timeout_notify *ne = grub_malloc (sizeof (*ne));
|
||||
if (!ne)
|
||||
return grub_errno;
|
||||
ne->set_state = set_state;
|
||||
ne->self = self;
|
||||
ne->next = grub_gfxmenu_timeout_notifications;
|
||||
grub_gfxmenu_timeout_notifications = ne;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_gfxmenu_timeout_unregister (grub_gui_component_t self)
|
||||
{
|
||||
struct grub_gfxmenu_timeout_notify **p, *q;
|
||||
|
||||
for (p = &grub_gfxmenu_timeout_notifications, q = *p;
|
||||
q; p = &(q->next), q = q->next)
|
||||
if (q->self == self)
|
||||
{
|
||||
*p = q->next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
typedef signed grub_fixed_signed_t;
|
||||
#define GRUB_FIXED_1 0x10000
|
||||
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
/* handler.h - header for grub handler */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_HANDLER_HEADER
|
||||
#define GRUB_HANDLER_HEADER 1
|
||||
|
||||
#include <grub/list.h>
|
||||
#include <grub/err.h>
|
||||
|
||||
struct grub_handler
|
||||
{
|
||||
struct grub_handler *next;
|
||||
const char *name;
|
||||
grub_err_t (*init) (void);
|
||||
grub_err_t (*fini) (void);
|
||||
};
|
||||
typedef struct grub_handler *grub_handler_t;
|
||||
|
||||
struct grub_handler_class
|
||||
{
|
||||
struct grub_handler_class *next;
|
||||
const char *name;
|
||||
grub_handler_t handler_list;
|
||||
grub_handler_t cur_handler;
|
||||
};
|
||||
typedef struct grub_handler_class *grub_handler_class_t;
|
||||
|
||||
extern grub_handler_class_t EXPORT_VAR(grub_handler_class_list);
|
||||
|
||||
void EXPORT_FUNC(grub_handler_register) (grub_handler_class_t class,
|
||||
grub_handler_t handler);
|
||||
void EXPORT_FUNC(grub_handler_unregister) (grub_handler_class_t class,
|
||||
grub_handler_t handler);
|
||||
grub_err_t EXPORT_FUNC(grub_handler_set_current) (grub_handler_class_t class,
|
||||
grub_handler_t handler);
|
||||
|
||||
#define GRUB_AS_HANDLER(ptr) \
|
||||
((GRUB_FIELD_MATCH (ptr, grub_handler_t, next) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_handler_t, name) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_handler_t, init) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_handler_t, fini)) ? \
|
||||
(grub_handler_t) ptr : grub_bad_type_cast ())
|
||||
|
||||
#endif /* ! GRUB_HANDLER_HEADER */
|
|
@ -22,10 +22,10 @@
|
|||
#include <config.h>
|
||||
#include <grub/symbol.h>
|
||||
|
||||
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
||||
|
||||
/* NLS can be disabled through the configure --disable-nls option. */
|
||||
#if (defined(ENABLE_NLS) && ENABLE_NLS)
|
||||
#if (defined(ENABLE_NLS) && ENABLE_NLS) || !defined (GRUB_UTIL)
|
||||
|
||||
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
||||
|
||||
# ifdef GRUB_UTIL
|
||||
|
||||
|
@ -41,18 +41,26 @@ extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
|||
for invalid uses of the value returned from these functions.
|
||||
On pre-ANSI systems without 'const', the config.h file is supposed to
|
||||
contain "#define const". */
|
||||
# ifdef GRUB_UTIL
|
||||
# define gettext(Msgid) ((const char *) (Msgid))
|
||||
# else
|
||||
# define grub_gettext(str) ((const char *) (str))
|
||||
# endif /* GRUB_UTIL */
|
||||
static inline const char * __attribute__ ((always_inline))
|
||||
gettext (const char *str)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
#endif /* (defined(ENABLE_NLS) && ENABLE_NLS) */
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
# define _(str) gettext(str)
|
||||
static inline const char * __attribute__ ((always_inline))
|
||||
_ (const char *str)
|
||||
{
|
||||
return gettext(str);
|
||||
}
|
||||
#else
|
||||
# define _(str) grub_gettext(str)
|
||||
static inline const char * __attribute__ ((always_inline))
|
||||
_ (const char *str)
|
||||
{
|
||||
return grub_gettext(str);
|
||||
}
|
||||
#endif /* GRUB_UTIL */
|
||||
|
||||
#define N_(str) str
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_KERNEL_MACHINE_HEADER
|
||||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#ifndef ASM_FILE
|
||||
extern char grub_prefix[];
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,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_MACHINE_KERNEL_HEADER
|
||||
#define GRUB_MACHINE_KERNEL_HEADER 1
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x8
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
|
||||
|
||||
#endif /* ! GRUB_MACHINE_KERNEL_HEADER */
|
||||
|
|
@ -1 +0,0 @@
|
|||
#include <grub/powerpc/ieee1275/kernel.h>
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_KERNEL_CPU_HEADER
|
||||
#define GRUB_KERNEL_CPU_HEADER 1
|
||||
|
||||
|
||||
#ifdef GRUB_MACHINE_IEEE1275
|
||||
#define GRUB_MOD_ALIGN 0x1000
|
||||
#else
|
||||
#define GRUB_MOD_ALIGN 0x1
|
||||
#endif
|
||||
|
||||
/* Non-zero value is only needed for PowerMacs. */
|
||||
#define GRUB_MOD_GAP 0x0
|
||||
|
||||
#define GRUB_KERNEL_CPU_PREFIX 0x2
|
||||
#define GRUB_KERNEL_CPU_DATA_END 0x42
|
||||
|
||||
#endif
|
|
@ -19,6 +19,8 @@
|
|||
#ifndef GRUB_BOOT_MACHINE_HEADER
|
||||
#define GRUB_BOOT_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/offsets.h>
|
||||
|
||||
/* The signature for bootloader. */
|
||||
#define GRUB_BOOT_MACHINE_SIGNATURE 0xaa55
|
||||
|
||||
|
@ -57,9 +59,6 @@
|
|||
floppy. */
|
||||
#define GRUB_BOOT_MACHINE_BIOS_HD_FLAG 0x80
|
||||
|
||||
/* The segment where the kernel is loaded. */
|
||||
#define GRUB_BOOT_MACHINE_KERNEL_SEG 0x800
|
||||
|
||||
/* The address where the kernel is loaded. */
|
||||
#define GRUB_BOOT_MACHINE_KERNEL_ADDR (GRUB_BOOT_MACHINE_KERNEL_SEG << 4)
|
||||
|
||||
|
@ -68,16 +67,7 @@
|
|||
|
||||
#define GRUB_BOOT_MACHINE_PXE_DL 0x7f
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
/* This is the blocklist used in the diskboot image. */
|
||||
struct grub_boot_blocklist
|
||||
{
|
||||
grub_uint64_t start;
|
||||
grub_uint16_t len;
|
||||
grub_uint16_t segment;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
#define grub_boot_blocklist grub_pc_bios_boot_blocklist
|
||||
|
||||
#endif /* ! BOOT_MACHINE_HEADER */
|
||||
|
|
|
@ -19,29 +19,7 @@
|
|||
#ifndef KERNEL_MACHINE_HEADER
|
||||
#define KERNEL_MACHINE_HEADER 1
|
||||
|
||||
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE 0x10
|
||||
|
||||
/* The offset of GRUB_INSTALL_DOS_PART. */
|
||||
#define GRUB_KERNEL_MACHINE_INSTALL_DOS_PART 0x14
|
||||
|
||||
/* The offset of GRUB_INSTALL_BSD_PART. */
|
||||
#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART 0x18
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x1c
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x5c
|
||||
|
||||
/* The size of the first region which won't be compressed. */
|
||||
#define GRUB_KERNEL_MACHINE_RAW_SIZE (GRUB_KERNEL_MACHINE_DATA_END + 0x5F0)
|
||||
#include <grub/offsets.h>
|
||||
|
||||
/* Enable LZMA compression */
|
||||
#define ENABLE_LZMA 1
|
||||
|
@ -63,10 +41,6 @@ extern grub_int32_t grub_install_dos_part;
|
|||
/* The BSD partition number of the installed partition. */
|
||||
extern grub_int32_t grub_install_bsd_part;
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
/* The boot BIOS drive number. */
|
||||
extern grub_uint8_t EXPORT_VAR(grub_boot_drive);
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
#include <grub/i386/memory.h>
|
||||
|
||||
#include <grub/offsets.h>
|
||||
|
||||
/* The scratch buffer used in real mode code. */
|
||||
#define GRUB_MEMORY_MACHINE_SCRATCH_ADDR 0x68000
|
||||
#define GRUB_MEMORY_MACHINE_SCRATCH_SEG (GRUB_MEMORY_MACHINE_SCRATCH_ADDR >> 4)
|
||||
|
@ -40,9 +42,6 @@
|
|||
/* The size of the protect mode stack. */
|
||||
#define GRUB_MEMORY_MACHINE_PROT_STACK_SIZE 0x8000
|
||||
|
||||
/* The upper memory area (starting at 640 kiB). */
|
||||
#define GRUB_MEMORY_MACHINE_UPPER 0xa0000
|
||||
|
||||
/* The protected mode stack. */
|
||||
#define GRUB_MEMORY_MACHINE_PROT_STACK \
|
||||
(GRUB_MEMORY_MACHINE_SCRATCH_ADDR + GRUB_MEMORY_MACHINE_SCRATCH_SIZE \
|
||||
|
|
|
@ -80,7 +80,7 @@ grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
|
|||
|
||||
static inline void
|
||||
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||
void *mem __attribute__ ((unused)),
|
||||
volatile void *mem __attribute__ ((unused)),
|
||||
grub_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -22,7 +22,4 @@
|
|||
/* The size of boot.img. */
|
||||
#define GRUB_BOOT_MACHINE_SIZE (0x100000 - GRUB_BOOT_MACHINE_LINK_ADDR)
|
||||
|
||||
/* The offset of GRUB_CORE_ENTRY_ADDR. */
|
||||
#define GRUB_BOOT_MACHINE_CORE_ENTRY_ADDR 0x4
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,17 +19,7 @@
|
|||
#ifndef GRUB_KERNEL_MACHINE_HEADER
|
||||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
/* The offset of GRUB_CORE_ENTRY_ADDR. */
|
||||
#define GRUB_KERNEL_MACHINE_CORE_ENTRY_ADDR 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x10
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
|
||||
#include <grub/offsets.h>
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
|
@ -44,10 +34,6 @@ extern grub_int32_t grub_kernel_image_size;
|
|||
/* The total size of module images following the kernel. */
|
||||
extern grub_int32_t grub_total_module_size;
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
||||
|
|
|
@ -42,19 +42,33 @@ struct grub_module_header
|
|||
/* "gmim" (GRUB Module Info Magic). */
|
||||
#define GRUB_MODULE_MAGIC 0x676d696d
|
||||
|
||||
struct grub_module_info
|
||||
struct grub_module_info32
|
||||
{
|
||||
/* Magic number so we know we have modules present. */
|
||||
grub_uint32_t magic;
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 8
|
||||
grub_uint32_t padding;
|
||||
#endif
|
||||
/* The offset of the modules. */
|
||||
grub_target_off_t offset;
|
||||
grub_uint32_t offset;
|
||||
/* The size of all modules plus this header. */
|
||||
grub_target_size_t size;
|
||||
grub_uint32_t size;
|
||||
};
|
||||
|
||||
struct grub_module_info64
|
||||
{
|
||||
/* Magic number so we know we have modules present. */
|
||||
grub_uint32_t magic;
|
||||
grub_uint32_t padding;
|
||||
/* The offset of the modules. */
|
||||
grub_uint64_t offset;
|
||||
/* The size of all modules plus this header. */
|
||||
grub_uint64_t size;
|
||||
};
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 8
|
||||
#define grub_module_info grub_module_info64
|
||||
#else
|
||||
#define grub_module_info grub_module_info32
|
||||
#endif
|
||||
|
||||
extern grub_addr_t grub_arch_modules_addr (void);
|
||||
|
||||
extern void EXPORT_FUNC(grub_module_iterate) (int (*hook) (struct grub_module_header *));
|
||||
|
@ -76,4 +90,8 @@ void grub_machine_set_prefix (void);
|
|||
/* Register all the exported symbols. This is automatically generated. */
|
||||
void grub_register_exported_symbols (void);
|
||||
|
||||
#if ! defined (ASM_FILE) && !defined (GRUB_MACHINE_EMU)
|
||||
extern char grub_prefix[];
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_KERNEL_HEADER */
|
||||
|
|
|
@ -30,15 +30,10 @@ struct grub_list
|
|||
};
|
||||
typedef struct grub_list *grub_list_t;
|
||||
|
||||
typedef int (*grub_list_hook_t) (grub_list_t item);
|
||||
typedef int (*grub_list_test_t) (grub_list_t new_item, grub_list_t item);
|
||||
|
||||
void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item);
|
||||
void * EXPORT_FUNC(grub_list_pop) (grub_list_t *head);
|
||||
void EXPORT_FUNC(grub_list_remove) (grub_list_t *head, grub_list_t item);
|
||||
int EXPORT_FUNC(grub_list_iterate) (grub_list_t head, grub_list_hook_t hook);
|
||||
void EXPORT_FUNC(grub_list_insert) (grub_list_t *head, grub_list_t item,
|
||||
grub_list_test_t test);
|
||||
|
||||
#define FOR_LIST_ELEMENTS(var, list) for ((var) = (list); (var); (var) = (var)->next)
|
||||
|
||||
static inline void *
|
||||
grub_bad_type_cast_real (int line, const char *file)
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_KERNEL_CPU_HEADER
|
||||
#define GRUB_KERNEL_CPU_HEADER 1
|
||||
|
||||
#define GRUB_MOD_ALIGN 0x1
|
||||
/* Non-zero value is only needed for PowerMacs. */
|
||||
#define GRUB_MOD_GAP 0x0
|
||||
|
||||
#define GRUB_KERNEL_MACHINE_LINK_ALIGN 32
|
||||
|
||||
#define GRUB_KERNEL_CPU_RAW_SIZE 0x200
|
||||
#define GRUB_KERNEL_CPU_COMPRESSED_SIZE 0x8
|
||||
#define GRUB_KERNEL_CPU_TOTAL_MODULE_SIZE 0xc
|
||||
#define GRUB_KERNEL_CPU_KERNEL_IMAGE_SIZE 0x10
|
||||
|
||||
#define GRUB_KERNEL_CPU_PREFIX GRUB_KERNEL_CPU_RAW_SIZE
|
||||
#define GRUB_KERNEL_CPU_DATA_END GRUB_KERNEL_CPU_RAW_SIZE + 0x48
|
||||
|
||||
#define GRUB_KERNEL_MACHINE_RAW_SIZE GRUB_KERNEL_CPU_RAW_SIZE
|
||||
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX GRUB_KERNEL_CPU_PREFIX
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END GRUB_KERNEL_CPU_DATA_END
|
||||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE GRUB_KERNEL_CPU_KERNEL_IMAGE_SIZE
|
||||
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE GRUB_KERNEL_CPU_TOTAL_MODULE_SIZE
|
||||
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE GRUB_KERNEL_CPU_COMPRESSED_SIZE
|
||||
|
||||
#define GRUB_PLATFORM_IMAGE_FORMATS "raw, elf"
|
||||
#define GRUB_PLATFORM_IMAGE_DEFAULT_FORMAT "raw"
|
||||
|
||||
#define GRUB_PLATFORM_IMAGE_DEFAULT GRUB_PLATFORM_IMAGE_RAW
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
typedef enum {
|
||||
GRUB_PLATFORM_IMAGE_RAW,
|
||||
GRUB_PLATFORM_IMAGE_ELF
|
||||
}
|
||||
grub_platform_image_format_t;
|
||||
#define GRUB_PLATFORM_IMAGE_RAW GRUB_PLATFORM_IMAGE_RAW
|
||||
#define GRUB_PLATFORM_IMAGE_ELF GRUB_PLATFORM_IMAGE_ELF
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -27,10 +27,6 @@
|
|||
void EXPORT_FUNC (grub_reboot) (void);
|
||||
void EXPORT_FUNC (grub_halt) (void);
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/cpu/kernel.h>
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
|
|
|
@ -19,16 +19,30 @@
|
|||
#ifndef GRUB_MACHINE_PCI_H
|
||||
#define GRUB_MACHINE_PCI_H 1
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#include <grub/types.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#endif
|
||||
|
||||
#define GRUB_YEELOONG_OHCI_PCIID 0x00351033
|
||||
#define GRUB_YEELOONG_EHCI_PCIID 0x00e01033
|
||||
#define GRUB_YEELOONG_OHCI_GHOST_FUNCTION 4
|
||||
#define GRUB_YEELOONG_EHCI_GHOST_FUNCTION 5
|
||||
|
||||
#define GRUB_PCI_NUM_BUS 1
|
||||
#define GRUB_PCI_NUM_DEVICES 16
|
||||
|
||||
#define GRUB_MACHINE_PCI_IO_BASE 0xbfd00000
|
||||
#define GRUB_MACHINE_PCI_CONFSPACE 0xbfe80000
|
||||
#define GRUB_MACHINE_PCI_CONF_CTRL_REG (*(volatile grub_uint32_t *) 0xbfe00118)
|
||||
#define GRUB_MACHINE_PCI_IO_BASE 0xbfd00000
|
||||
#define GRUB_MACHINE_PCI_CONFSPACE 0xbfe80000
|
||||
#define GRUB_MACHINE_PCI_CONTROLLER_HEADER 0xbfe00000
|
||||
|
||||
#define GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR 0xbfe00118
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#define GRUB_MACHINE_PCI_CONF_CTRL_REG (*(volatile grub_uint32_t *) \
|
||||
GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR)
|
||||
#define GRUB_MACHINE_PCI_IO_CTRL_REG (*(volatile grub_uint32_t *) 0xbfe00110)
|
||||
#endif
|
||||
#define GRUB_MACHINE_PCI_WIN_MASK_SIZE 6
|
||||
#define GRUB_MACHINE_PCI_WIN_MASK ((1 << GRUB_MACHINE_PCI_WIN_MASK_SIZE) - 1)
|
||||
|
||||
|
@ -46,6 +60,7 @@
|
|||
#define GRUB_MACHINE_PCI_WIN2_ADDR 0xb4000000
|
||||
#define GRUB_MACHINE_PCI_WIN3_ADDR 0xb8000000
|
||||
|
||||
#ifndef ASM_FILE
|
||||
static inline grub_uint32_t
|
||||
grub_pci_read (grub_pci_address_t addr)
|
||||
{
|
||||
|
@ -95,11 +110,12 @@ grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
|
|||
}
|
||||
|
||||
volatile void *
|
||||
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||
grub_addr_t base, grub_size_t size);
|
||||
EXPORT_FUNC (grub_pci_device_map_range) (grub_pci_device_t dev,
|
||||
grub_addr_t base, grub_size_t size);
|
||||
void
|
||||
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||
volatile void *mem,
|
||||
grub_size_t size __attribute__ ((unused)));
|
||||
EXPORT_FUNC (grub_pci_device_unmap_range) (grub_pci_device_t dev,
|
||||
volatile void *mem,
|
||||
grub_size_t size);
|
||||
#endif
|
||||
|
||||
#endif /* GRUB_MACHINE_PCI_H */
|
||||
|
|
173
include/grub/offsets.h
Normal file
173
include/grub/offsets.h
Normal file
|
@ -0,0 +1,173 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2007,2008 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 OFFSETS_HEADER
|
||||
#define OFFSETS_HEADER 1
|
||||
|
||||
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
|
||||
#define GRUB_KERNEL_I386_PC_TOTAL_MODULE_SIZE 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_I386_PC_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
||||
#define GRUB_KERNEL_I386_PC_COMPRESSED_SIZE 0x10
|
||||
|
||||
/* The offset of GRUB_INSTALL_DOS_PART. */
|
||||
#define GRUB_KERNEL_I386_PC_INSTALL_DOS_PART 0x14
|
||||
|
||||
/* The offset of GRUB_INSTALL_BSD_PART. */
|
||||
#define GRUB_KERNEL_I386_PC_INSTALL_BSD_PART 0x18
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_PC_PREFIX 0x1c
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_I386_PC_DATA_END 0x5c
|
||||
|
||||
/* The size of the first region which won't be compressed. */
|
||||
#define GRUB_KERNEL_I386_PC_RAW_SIZE (GRUB_KERNEL_I386_PC_DATA_END + 0x5F0)
|
||||
|
||||
/* The segment where the kernel is loaded. */
|
||||
#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800
|
||||
|
||||
#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x8200
|
||||
|
||||
/* The upper memory area (starting at 640 kiB). */
|
||||
#define GRUB_MEMORY_I386_PC_UPPER 0xa0000
|
||||
#define GRUB_MEMORY_I386_QEMU_UPPER GRUB_MEMORY_I386_PC_UPPER
|
||||
|
||||
/* The offset of GRUB_CORE_ENTRY_ADDR. */
|
||||
#define GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR 0x4
|
||||
|
||||
/* The offset of GRUB_CORE_ENTRY_ADDR. */
|
||||
#define GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_I386_QEMU_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_QEMU_PREFIX 0x10
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_I386_QEMU_DATA_END 0x50
|
||||
|
||||
#define GRUB_KERNEL_I386_QEMU_LINK_ADDR 0x8200
|
||||
|
||||
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_TOTAL_MODULE_SIZE 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_COMPRESSED_SIZE 0x10
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_PREFIX 0x14
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_DATA_END 0x114
|
||||
|
||||
#define GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE 12
|
||||
|
||||
#define GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS 0x4400
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_RAW_SIZE 0
|
||||
#define GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR 0x4400
|
||||
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_PREFIX 0x4
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_DATA_END 0x44
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ALIGN 4
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR 0x200000
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_LINK_ADDR 0x80200000
|
||||
|
||||
#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_PREFIX GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_DATA_END GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE + 0x48
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_I386_EFI_PREFIX 0x8
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_I386_EFI_DATA_END 0x50
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_X86_64_EFI_PREFIX 0x8
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_X86_64_EFI_DATA_END 0x50
|
||||
|
||||
#define GRUB_KERNEL_I386_COREBOOT_PREFIX 0x2
|
||||
#define GRUB_KERNEL_I386_COREBOOT_DATA_END 0x42
|
||||
#define GRUB_KERNEL_I386_COREBOOT_LINK_ADDR 0x8200
|
||||
|
||||
#define GRUB_KERNEL_I386_IEEE1275_PREFIX 0x2
|
||||
#define GRUB_KERNEL_I386_IEEE1275_DATA_END 0x42
|
||||
#define GRUB_KERNEL_I386_IEEE1275_LINK_ADDR 0x10000
|
||||
|
||||
#define GRUB_KERNEL_I386_IEEE1275_MOD_ALIGN 0x1000
|
||||
#define GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN 0x1
|
||||
|
||||
/* Non-zero value is only needed for PowerMacs. */
|
||||
#define GRUB_KERNEL_I386_IEEE1275_MOD_GAP 0x0
|
||||
#define GRUB_KERNEL_I386_COREBOOT_MOD_GAP 0x0
|
||||
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000
|
||||
|
||||
#define GRUB_KERNEL_MIPS_YEELOONG_MOD_ALIGN 0x1
|
||||
|
||||
/* Minimal gap between _end and the start of the modules. It's a hack
|
||||
for PowerMac to prevent "CLAIM failed" error. The real fix is to
|
||||
rewrite grub-mkimage to generate valid ELF files. */
|
||||
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_GAP 0x8000
|
||||
|
||||
#ifdef 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_PREFIX GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _PREFIX)
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _DATA_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)
|
||||
#endif
|
||||
|
||||
#ifndef ASM_FILE
|
||||
struct grub_pc_bios_boot_blocklist
|
||||
{
|
||||
grub_uint64_t start;
|
||||
grub_uint16_t len;
|
||||
grub_uint16_t segment;
|
||||
} __attribute__ ((packed));
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/handler.h>
|
||||
#include <grub/reader.h>
|
||||
|
||||
/* All the states for the command line. */
|
||||
|
@ -84,36 +83,9 @@ struct grub_parser
|
|||
};
|
||||
typedef struct grub_parser *grub_parser_t;
|
||||
|
||||
extern struct grub_handler_class EXPORT_VAR(grub_parser_class);
|
||||
grub_err_t EXPORT_FUNC(grub_parser_execute) (char *source);
|
||||
|
||||
static inline void
|
||||
grub_parser_register (const char *name __attribute__ ((unused)),
|
||||
/* `name' is ignored here, but used by genhandlerlist.sh. */
|
||||
grub_parser_t parser)
|
||||
{
|
||||
grub_handler_register (&grub_parser_class, GRUB_AS_HANDLER (parser));
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_parser_unregister (grub_parser_t parser)
|
||||
{
|
||||
grub_handler_unregister (&grub_parser_class, GRUB_AS_HANDLER (parser));
|
||||
}
|
||||
|
||||
static inline grub_parser_t
|
||||
grub_parser_get_current (void)
|
||||
{
|
||||
return (grub_parser_t) grub_parser_class.cur_handler;
|
||||
}
|
||||
|
||||
static inline grub_err_t
|
||||
grub_parser_set_current (grub_parser_t parser)
|
||||
{
|
||||
return grub_handler_set_current (&grub_parser_class,
|
||||
GRUB_AS_HANDLER (parser));
|
||||
}
|
||||
|
||||
void grub_register_rescue_parser (void);
|
||||
grub_err_t
|
||||
grub_rescue_parse_line (char *line, grub_reader_getline_t getline);
|
||||
|
||||
#endif /* ! GRUB_PARSER_HEADER */
|
||||
|
|
|
@ -91,7 +91,7 @@ grub_partition_map_unregister (grub_partition_map_t partmap)
|
|||
GRUB_AS_LIST (partmap));
|
||||
}
|
||||
|
||||
#define FOR_PARTITION_MAPS(var) for (var = grub_partition_map_list; var; var = var->next)
|
||||
#define FOR_PARTITION_MAPS(var) FOR_LIST_ELEMENTS((var), (grub_partition_map_list))
|
||||
|
||||
|
||||
static inline grub_disk_addr_t
|
||||
|
|
|
@ -19,8 +19,10 @@
|
|||
#ifndef GRUB_PCI_H
|
||||
#define GRUB_PCI_H 1
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
#endif
|
||||
|
||||
#define GRUB_PCI_ADDR_SPACE_MASK 0x01
|
||||
#define GRUB_PCI_ADDR_SPACE_MEMORY 0x00
|
||||
|
@ -66,6 +68,20 @@
|
|||
#define GRUB_PCI_REG_MIN_GNT 0x3e
|
||||
#define GRUB_PCI_REG_MAX_LAT 0x3f
|
||||
|
||||
#define GRUB_PCI_COMMAND_IO_ENABLED 0x0001
|
||||
#define GRUB_PCI_COMMAND_MEM_ENABLED 0x0002
|
||||
#define GRUB_PCI_COMMAND_BUS_MASTER 0x0004
|
||||
#define GRUB_PCI_COMMAND_PARITY_ERROR 0x0040
|
||||
#define GRUB_PCI_COMMAND_SERR_ENABLE 0x0100
|
||||
|
||||
#define GRUB_PCI_STATUS_CAPABILITIES 0x0010
|
||||
#define GRUB_PCI_STATUS_66MHZ_CAPABLE 0x0020
|
||||
#define GRUB_PCI_STATUS_FAST_B2B_CAPABLE 0x0080
|
||||
|
||||
#define GRUB_PCI_STATUS_DEVSEL_TIMING_SHIFT 9
|
||||
#define GRUB_PCI_STATUS_DEVSEL_TIMING_MASK 0x0600
|
||||
|
||||
#ifndef ASM_FILE
|
||||
typedef grub_uint32_t grub_pci_id_t;
|
||||
|
||||
#ifdef GRUB_MACHINE_EMU
|
||||
|
@ -107,4 +123,14 @@ grub_pci_address_t EXPORT_FUNC(grub_pci_make_address) (grub_pci_device_t dev,
|
|||
|
||||
void EXPORT_FUNC(grub_pci_iterate) (grub_pci_iteratefunc_t hook);
|
||||
|
||||
struct grub_pci_dma_chunk;
|
||||
|
||||
struct grub_pci_dma_chunk *EXPORT_FUNC(grub_memalign_dma32) (grub_size_t align,
|
||||
grub_size_t size);
|
||||
void EXPORT_FUNC(grub_dma_free) (struct grub_pci_dma_chunk *ch);
|
||||
volatile void *EXPORT_FUNC(grub_dma_get_virt) (struct grub_pci_dma_chunk *ch);
|
||||
grub_uint32_t EXPORT_FUNC(grub_dma_get_phys) (struct grub_pci_dma_chunk *ch);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* GRUB_PCI_H */
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_KERNEL_MACHINE_HEADER
|
||||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
|
@ -19,14 +19,4 @@
|
|||
#ifndef GRUB_KERNEL_CPU_HEADER
|
||||
#define GRUB_KERNEL_CPU_HEADER 1
|
||||
|
||||
#define GRUB_MOD_ALIGN 0x1000
|
||||
|
||||
/* Minimal gap between _end and the start of the modules. It's a hack
|
||||
for PowerMac to prevent "CLAIM failed" error. The real fix is to
|
||||
rewrite grub-mkimage to generate valid ELF files. */
|
||||
#define GRUB_MOD_GAP 0x8000
|
||||
|
||||
#define GRUB_KERNEL_CPU_PREFIX 0x4
|
||||
#define GRUB_KERNEL_CPU_DATA_END 0x44
|
||||
|
||||
#endif
|
||||
|
|
|
@ -223,6 +223,9 @@ struct grub_parser_param
|
|||
struct grub_lexer_param *lexerstate;
|
||||
};
|
||||
|
||||
void grub_script_init (void);
|
||||
void grub_script_fini (void);
|
||||
|
||||
void grub_script_argv_free (struct grub_script_argv *argv);
|
||||
int grub_script_argv_next (struct grub_script_argv *argv);
|
||||
int grub_script_argv_append (struct grub_script_argv *argv, const char *s);
|
||||
|
@ -340,15 +343,23 @@ struct grub_script_function
|
|||
};
|
||||
typedef struct grub_script_function *grub_script_function_t;
|
||||
|
||||
extern grub_script_function_t grub_script_function_list;
|
||||
|
||||
#define FOR_SCRIPT_FUNCTIONS(var) for((var) = grub_script_function_list; \
|
||||
(var); (var) = (var)->next)
|
||||
|
||||
grub_script_function_t grub_script_function_create (struct grub_script_arg *functionname,
|
||||
struct grub_script *cmd);
|
||||
void grub_script_function_remove (const char *name);
|
||||
grub_script_function_t grub_script_function_find (char *functionname);
|
||||
int grub_script_function_iterate (int (*iterate) (grub_script_function_t));
|
||||
|
||||
grub_err_t grub_script_function_call (grub_script_function_t func,
|
||||
int argc, char **args);
|
||||
|
||||
char **
|
||||
grub_script_execute_arglist_to_argv (struct grub_script_arglist *arglist, int *count);
|
||||
|
||||
grub_err_t
|
||||
grub_normal_parse_line (char *line, grub_reader_getline_t getline);
|
||||
|
||||
#endif /* ! GRUB_NORMAL_PARSER_HEADER */
|
||||
|
|
|
@ -25,14 +25,26 @@
|
|||
#define GRUB_SCSI_REMOVABLE_BIT 7
|
||||
#define GRUB_SCSI_LUN_SHIFT 5
|
||||
|
||||
struct grub_scsi_test_unit_ready
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t lun; /* 7-5 LUN, 4-0 reserved */
|
||||
grub_uint8_t reserved1;
|
||||
grub_uint8_t reserved2;
|
||||
grub_uint8_t reserved3;
|
||||
grub_uint8_t control;
|
||||
grub_uint8_t pad[6]; /* To be ATAPI compatible */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_inquiry
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t lun;
|
||||
grub_uint16_t reserved;
|
||||
grub_uint16_t alloc_length;
|
||||
grub_uint8_t reserved2;
|
||||
grub_uint8_t pad[5];
|
||||
grub_uint8_t lun; /* 7-5 LUN, 4-1 reserved, 0 EVPD */
|
||||
grub_uint8_t page; /* page code if EVPD=1 */
|
||||
grub_uint8_t reserved;
|
||||
grub_uint8_t alloc_length;
|
||||
grub_uint8_t control;
|
||||
grub_uint8_t pad[6]; /* To be ATAPI compatible */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_inquiry_data
|
||||
|
@ -47,12 +59,42 @@ struct grub_scsi_inquiry_data
|
|||
char prodrev[4];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_request_sense
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t lun; /* 7-5 LUN, 4-0 reserved */
|
||||
grub_uint8_t reserved1;
|
||||
grub_uint8_t reserved2;
|
||||
grub_uint8_t alloc_length;
|
||||
grub_uint8_t control;
|
||||
grub_uint8_t pad[6]; /* To be ATAPI compatible */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_request_sense_data
|
||||
{
|
||||
grub_uint8_t error_code; /* 7 Valid, 6-0 Err. code */
|
||||
grub_uint8_t segment_number;
|
||||
grub_uint8_t sense_key; /*7 FileMark, 6 EndOfMedia, 5 ILI, 4-0 sense key */
|
||||
grub_uint32_t information;
|
||||
grub_uint8_t additional_sense_length;
|
||||
grub_uint32_t cmd_specific_info;
|
||||
grub_uint8_t additional_sense_code;
|
||||
grub_uint8_t additional_sense_code_qualifier;
|
||||
grub_uint8_t field_replaceable_unit_code;
|
||||
grub_uint8_t sense_key_specific[3];
|
||||
/* there can be additional sense field */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_read_capacity
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t lun;
|
||||
grub_uint8_t reserved[8];
|
||||
grub_uint8_t pad[2];
|
||||
grub_uint8_t lun; /* 7-5 LUN, 4-1 reserved, 0 reserved */
|
||||
grub_uint32_t logical_block_addr; /* only if PMI=1 */
|
||||
grub_uint8_t reserved1;
|
||||
grub_uint8_t reserved2;
|
||||
grub_uint8_t PMI;
|
||||
grub_uint8_t control;
|
||||
grub_uint16_t pad; /* To be ATAPI compatible */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_read_capacity_data
|
||||
|
@ -105,12 +147,14 @@ struct grub_scsi_write12
|
|||
|
||||
typedef enum
|
||||
{
|
||||
grub_scsi_cmd_test_unit_ready = 0x00,
|
||||
grub_scsi_cmd_request_sense = 0x03,
|
||||
grub_scsi_cmd_inquiry = 0x12,
|
||||
grub_scsi_cmd_read_capacity = 0x25,
|
||||
grub_scsi_cmd_read10 = 0x28,
|
||||
grub_scsi_cmd_write10 = 0x2a,
|
||||
grub_scsi_cmd_read12 = 0xa8,
|
||||
grub_scsi_cmd_write12 = 0xaa
|
||||
grub_scsi_cmd_write12 = 0xaa,
|
||||
} grub_scsi_cmd_t;
|
||||
|
||||
typedef enum
|
||||
|
|
70
include/grub/smbus.h
Normal file
70
include/grub/smbus.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* 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_SMBUS_HEADER
|
||||
#define GRUB_SMBUS_HEADER 1
|
||||
|
||||
#define GRUB_SMB_RAM_START_ADDR 0x50
|
||||
#define GRUB_SMB_RAM_NUM_MAX 0x08
|
||||
|
||||
#define GRUB_SMBUS_SPD_MEMORY_TYPE_ADDR 2
|
||||
#define GRUB_SMBUS_SPD_MEMORY_TYPE_DDR2 8
|
||||
#define GRUB_SMBUS_SPD_MEMORY_NUM_BANKS_ADDR 17
|
||||
#define GRUB_SMBUS_SPD_MEMORY_NUM_ROWS_ADDR 3
|
||||
#define GRUB_SMBUS_SPD_MEMORY_NUM_COLUMNS_ADDR 4
|
||||
#define GRUB_SMBUS_SPD_MEMORY_NUM_OF_RANKS_ADDR 5
|
||||
#define GRUB_SMBUS_SPD_MEMORY_NUM_OF_RANKS_MASK 0x7
|
||||
#define GRUB_SMBUS_SPD_MEMORY_CAS_LATENCY_ADDR 18
|
||||
#define GRUB_SMBUS_SPD_MEMORY_CAS_LATENCY_MIN_VALUE 5
|
||||
#define GRUB_SMBUS_SPD_MEMORY_TRAS_ADDR 30
|
||||
#define GRUB_SMBUS_SPD_MEMORY_TRTP_ADDR 38
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
struct grub_smbus_spd
|
||||
{
|
||||
grub_uint8_t written_size;
|
||||
grub_uint8_t log_total_flash_size;
|
||||
grub_uint8_t memory_type;
|
||||
union
|
||||
{
|
||||
grub_uint8_t unknown[253];
|
||||
struct {
|
||||
grub_uint8_t num_rows;
|
||||
grub_uint8_t num_columns;
|
||||
grub_uint8_t num_of_ranks;
|
||||
grub_uint8_t unused1[12];
|
||||
grub_uint8_t num_of_banks;
|
||||
grub_uint8_t unused2[2];
|
||||
grub_uint8_t cas_latency;
|
||||
grub_uint8_t unused3[9];
|
||||
grub_uint8_t rank_capacity;
|
||||
grub_uint8_t unused4[1];
|
||||
grub_uint8_t tras;
|
||||
grub_uint8_t unused5[7];
|
||||
grub_uint8_t trtp;
|
||||
grub_uint8_t unused6[31];
|
||||
grub_uint8_t part_number[18];
|
||||
grub_uint8_t unused7[165];
|
||||
} ddr2;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -50,10 +50,6 @@
|
|||
#define GRUB_BOOT_MACHINE_CODE_END \
|
||||
(0x1fc - GRUB_BOOT_AOUT_HEADER_SIZE)
|
||||
|
||||
#define GRUB_BOOT_MACHINE_LIST_SIZE 12
|
||||
|
||||
#define GRUB_BOOT_MACHINE_IMAGE_ADDRESS 0x4400
|
||||
|
||||
#define GRUB_BOOT_MACHINE_KERNEL_ADDR 0x4200
|
||||
|
||||
#endif /* ! BOOT_MACHINE_HEADER */
|
||||
|
|
|
@ -19,44 +19,10 @@
|
|||
#ifndef GRUB_KERNEL_MACHINE_HEADER
|
||||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
#define GRUB_MOD_ALIGN 0x2000
|
||||
|
||||
/* Non-zero value is only needed for PowerMacs. */
|
||||
#define GRUB_MOD_GAP 0x0
|
||||
|
||||
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE 0x8
|
||||
|
||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc
|
||||
|
||||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE 0x10
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x14
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x114
|
||||
|
||||
#define GRUB_KERNEL_MACHINE_RAW_SIZE 0
|
||||
#define GRUB_KERNEL_MACHINE_STACK_SIZE 0x40000
|
||||
|
||||
#define GRUB_PLATFORM_IMAGE_FORMATS "raw, aout"
|
||||
#define GRUB_PLATFORM_IMAGE_DEFAULT_FORMAT "raw"
|
||||
|
||||
#define GRUB_PLATFORM_IMAGE_DEFAULT GRUB_PLATFORM_IMAGE_RAW
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
typedef enum {
|
||||
GRUB_PLATFORM_IMAGE_RAW,
|
||||
GRUB_PLATFORM_IMAGE_AOUT
|
||||
}
|
||||
grub_platform_image_format_t;
|
||||
#define GRUB_PLATFORM_IMAGE_RAW GRUB_PLATFORM_IMAGE_RAW
|
||||
#define GRUB_PLATFORM_IMAGE_AOUT GRUB_PLATFORM_IMAGE_AOUT
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
|
@ -66,10 +32,6 @@ extern grub_int32_t grub_kernel_image_size;
|
|||
/* The total size of module images following the kernel. */
|
||||
extern grub_int32_t grub_total_module_size;
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_KERNEL_CPU_HEADER
|
||||
#define GRUB_KERNEL_CPU_HEADER 1
|
||||
|
||||
#define GRUB_MOD_ALIGN 0x2000
|
||||
|
||||
/* Non-zero value is only needed for PowerMacs. */
|
||||
#define GRUB_MOD_GAP 0x0
|
||||
|
||||
#define GRUB_KERNEL_CPU_PREFIX 0x2
|
||||
#define GRUB_KERNEL_CPU_DATA_END 0x42
|
||||
|
||||
#endif
|
|
@ -38,7 +38,7 @@
|
|||
#include <grub/err.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/handler.h>
|
||||
#include <grub/list.h>
|
||||
|
||||
/* These are used to represent the various color states we use. */
|
||||
typedef enum
|
||||
|
@ -245,10 +245,10 @@ grub_term_unregister_output (grub_term_output_t term)
|
|||
GRUB_AS_LIST (term));
|
||||
}
|
||||
|
||||
#define FOR_ACTIVE_TERM_INPUTS(var) for (var = grub_term_inputs; var; var = var->next)
|
||||
#define FOR_DISABLED_TERM_INPUTS(var) for (var = grub_term_inputs_disabled; var; var = var->next)
|
||||
#define FOR_ACTIVE_TERM_OUTPUTS(var) for (var = grub_term_outputs; var; var = var->next)
|
||||
#define FOR_DISABLED_TERM_OUTPUTS(var) for (var = grub_term_outputs_disabled; var; var = var->next)
|
||||
#define FOR_ACTIVE_TERM_INPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_inputs))
|
||||
#define FOR_DISABLED_TERM_INPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_inputs_disabled))
|
||||
#define FOR_ACTIVE_TERM_OUTPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_outputs))
|
||||
#define FOR_DISABLED_TERM_OUTPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_outputs_disabled))
|
||||
|
||||
void EXPORT_FUNC(grub_putchar) (int c);
|
||||
void EXPORT_FUNC(grub_putcode) (grub_uint32_t code,
|
||||
|
|
|
@ -178,21 +178,6 @@ 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))
|
||||
# ifdef GRUB_TARGET_WORDS_BIGENDIAN
|
||||
# define grub_target_to_host16(x) ((grub_uint16_t) (x))
|
||||
# define grub_target_to_host32(x) ((grub_uint32_t) (x))
|
||||
# define grub_target_to_host64(x) ((grub_uint64_t) (x))
|
||||
# define grub_host_to_target16(x) ((grub_uint16_t) (x))
|
||||
# define grub_host_to_target32(x) ((grub_uint32_t) (x))
|
||||
# define grub_host_to_target64(x) ((grub_uint64_t) (x))
|
||||
# else /* ! GRUB_TARGET_WORDS_BIGENDIAN */
|
||||
# define grub_target_to_host16(x) grub_swap_bytes16(x)
|
||||
# define grub_target_to_host32(x) grub_swap_bytes32(x)
|
||||
# define grub_target_to_host64(x) grub_swap_bytes64(x)
|
||||
# define grub_host_to_target16(x) grub_swap_bytes16(x)
|
||||
# define grub_host_to_target32(x) grub_swap_bytes32(x)
|
||||
# define grub_host_to_target64(x) grub_swap_bytes64(x)
|
||||
# endif
|
||||
#else /* ! WORDS_BIGENDIAN */
|
||||
# define grub_cpu_to_le16(x) ((grub_uint16_t) (x))
|
||||
# define grub_cpu_to_le32(x) ((grub_uint32_t) (x))
|
||||
|
@ -206,27 +191,6 @@ 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)
|
||||
# ifdef GRUB_TARGET_WORDS_BIGENDIAN
|
||||
# define grub_target_to_host16(x) grub_swap_bytes16(x)
|
||||
# define grub_target_to_host32(x) grub_swap_bytes32(x)
|
||||
# define grub_target_to_host64(x) grub_swap_bytes64(x)
|
||||
# define grub_host_to_target16(x) grub_swap_bytes16(x)
|
||||
# define grub_host_to_target32(x) grub_swap_bytes32(x)
|
||||
# define grub_host_to_target64(x) grub_swap_bytes64(x)
|
||||
# else /* ! GRUB_TARGET_WORDS_BIGENDIAN */
|
||||
# define grub_target_to_host16(x) ((grub_uint16_t) (x))
|
||||
# define grub_target_to_host32(x) ((grub_uint32_t) (x))
|
||||
# define grub_target_to_host64(x) ((grub_uint64_t) (x))
|
||||
# define grub_host_to_target16(x) ((grub_uint16_t) (x))
|
||||
# define grub_host_to_target32(x) ((grub_uint32_t) (x))
|
||||
# define grub_host_to_target64(x) ((grub_uint64_t) (x))
|
||||
# endif
|
||||
#endif /* ! WORDS_BIGENDIAN */
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 8
|
||||
# define grub_host_to_target_addr(x) grub_host_to_target64(x)
|
||||
#else
|
||||
# define grub_host_to_target_addr(x) grub_host_to_target32(x)
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_TYPES_HEADER */
|
||||
|
|
|
@ -35,7 +35,8 @@ typedef enum
|
|||
GRUB_USB_ERR_NAK,
|
||||
GRUB_USB_ERR_BABBLE,
|
||||
GRUB_USB_ERR_TIMEOUT,
|
||||
GRUB_USB_ERR_BITSTUFF
|
||||
GRUB_USB_ERR_BITSTUFF,
|
||||
GRUB_USB_ERR_UNRECOVERABLE
|
||||
} grub_usb_err_t;
|
||||
|
||||
typedef enum
|
||||
|
@ -156,7 +157,7 @@ struct grub_usb_device
|
|||
int initialized;
|
||||
|
||||
/* Data toggle values (used for bulk transfers only). */
|
||||
int toggle[16];
|
||||
int toggle[256];
|
||||
|
||||
/* Device-specific data. */
|
||||
void *data;
|
||||
|
@ -184,7 +185,12 @@ typedef enum
|
|||
|
||||
typedef enum
|
||||
{
|
||||
GRUB_USBMS_SUBCLASS_BULK = 0x06
|
||||
GRUB_USBMS_SUBCLASS_BULK = 0x06,
|
||||
/* Experimental support for non-pure SCSI devices */
|
||||
GRUB_USBMS_SUBCLASS_RBC = 0x01,
|
||||
GRUB_USBMS_SUBCLASS_MMC2 = 0x02,
|
||||
GRUB_USBMS_SUBCLASS_UFI = 0x04,
|
||||
GRUB_USBMS_SUBCLASS_SFF8070 = 0x05
|
||||
} grub_usbms_subclass_t;
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -37,7 +37,7 @@ struct grub_usb_transaction
|
|||
int size;
|
||||
int toggle;
|
||||
grub_transfer_type_t pid;
|
||||
char *data;
|
||||
grub_uint32_t data;
|
||||
};
|
||||
typedef struct grub_usb_transaction *grub_usb_transaction_t;
|
||||
|
||||
|
@ -58,6 +58,9 @@ struct grub_usb_transfer
|
|||
struct grub_usb_device *dev;
|
||||
|
||||
struct grub_usb_transaction *transactions;
|
||||
|
||||
int last_trans;
|
||||
/* Index of last processed transaction in OHCI/UHCI driver. */
|
||||
};
|
||||
typedef struct grub_usb_transfer *grub_usb_transfer_t;
|
||||
|
||||
|
@ -86,9 +89,9 @@ typedef struct grub_usb_transfer *grub_usb_transfer_t;
|
|||
|
||||
#define GRUB_USB_REQ_HUB_GET_PORT_STATUS 0x00
|
||||
|
||||
#define GRUB_USB_FEATURE_ENDP_HALT 0x01
|
||||
#define GRUB_USB_FEATURE_DEV_REMOTE_WU 0x02
|
||||
#define GRUB_USB_FEATURE_TEST_MODE 0x04
|
||||
#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_STATUS_CONNECTED (1 << 0)
|
||||
#define GRUB_USB_HUB_STATUS_LOWSPEED (1 << 9)
|
||||
|
|
|
@ -28,26 +28,7 @@
|
|||
#include <config.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#ifdef __NetBSD__
|
||||
/* NetBSD uses /boot for its boot block. */
|
||||
# define DEFAULT_DIRECTORY "/grub"
|
||||
#else
|
||||
# define DEFAULT_DIRECTORY "/boot/grub"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
|
||||
|
||||
extern char *progname;
|
||||
extern int verbosity;
|
||||
|
||||
void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...);
|
||||
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...);
|
||||
void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((noreturn));
|
||||
|
||||
void *xmalloc (size_t size);
|
||||
void *xrealloc (void *ptr, size_t size);
|
||||
char *xstrdup (const char *str);
|
||||
#include <grub/emu/misc.h>
|
||||
|
||||
char *grub_util_get_path (const char *dir, const char *file);
|
||||
size_t grub_util_get_fp_size (FILE *fp);
|
||||
|
@ -59,20 +40,6 @@ void grub_util_write_image (const char *img, size_t size, FILE *out);
|
|||
void grub_util_write_image_at (const void *img, size_t size, off_t offset,
|
||||
FILE *out);
|
||||
|
||||
#ifndef HAVE_VASPRINTF
|
||||
|
||||
int vasprintf (char **buf, const char *fmt, va_list ap);
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ASPRINTF
|
||||
|
||||
int asprintf (char **buf, const char *fmt, ...);
|
||||
|
||||
#endif
|
||||
|
||||
char *xasprintf (const char *fmt, ...);
|
||||
|
||||
#ifdef __MINGW32__
|
||||
|
||||
#define fseeko fseeko64
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/list.h>
|
||||
|
||||
/* Video color in hardware dependent format. Users should not assume any
|
||||
specific coding format. */
|
||||
|
@ -187,6 +188,9 @@ typedef enum grub_video_driver_id
|
|||
|
||||
struct grub_video_adapter
|
||||
{
|
||||
/* The next video adapter. */
|
||||
struct grub_video_adapter *next;
|
||||
|
||||
/* The video adapter name. */
|
||||
const char *name;
|
||||
grub_video_driver_id_t id;
|
||||
|
@ -255,15 +259,28 @@ 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);
|
||||
|
||||
/* The next video adapter. */
|
||||
struct grub_video_adapter *next;
|
||||
};
|
||||
typedef struct grub_video_adapter *grub_video_adapter_t;
|
||||
|
||||
void EXPORT_FUNC (grub_video_register) (grub_video_adapter_t adapter);
|
||||
void grub_video_unregister (grub_video_adapter_t adapter);
|
||||
void grub_video_iterate (int (*hook) (grub_video_adapter_t adapter));
|
||||
extern grub_video_adapter_t EXPORT_VAR(grub_video_adapter_list);
|
||||
|
||||
/* Register video driver. */
|
||||
static inline void
|
||||
grub_video_register (grub_video_adapter_t adapter)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_video_adapter_list),
|
||||
GRUB_AS_LIST (adapter));
|
||||
}
|
||||
|
||||
/* Unregister video driver. */
|
||||
static inline void
|
||||
grub_video_unregister (grub_video_adapter_t adapter)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_video_adapter_list),
|
||||
GRUB_AS_LIST (adapter));
|
||||
}
|
||||
|
||||
#define FOR_VIDEO_ADAPTERS(var) FOR_LIST_ELEMENTS((var), (grub_video_adapter_list))
|
||||
|
||||
grub_err_t EXPORT_FUNC (grub_video_restore) (void);
|
||||
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,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_MACHINE_KERNEL_HEADER
|
||||
#define GRUB_MACHINE_KERNEL_HEADER 1
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x8
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
|
||||
|
||||
#endif /* ! GRUB_MACHINE_KERNEL_HEADER */
|
||||
|
|
@ -1 +0,0 @@
|
|||
#include <grub/i386/kernel.h>
|
Loading…
Add table
Add a link
Reference in a new issue