merge mainline into net

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-09-01 23:28:02 +02:00
commit 975cffff74
840 changed files with 95368 additions and 37287 deletions

View file

@ -102,6 +102,7 @@ union grub_aout_header
#define AOUT_MID_I386 134 /* i386 BSD binary */
#define AOUT_MID_SPARC 138 /* sparc */
#define AOUT_MID_HP200 200 /* hp200 (68010) BSD binary */
#define AOUT_MID_SUN 0x103
#define AOUT_MID_HP300 300 /* hp300 (68020+68881) BSD binary */
#define AOUT_MID_HPUX 0x20C /* hp200/300 HP-UX binary */
#define AOUT_MID_HPUX800 0x20B /* hp800 HP-UX binary */
@ -114,10 +115,14 @@ union grub_aout_header
#define AOUT_GETMID(header) ((header).a_midmag >> 16) & 0x03ff)
#define AOUT_GETFLAG(header) ((header).a_midmag >> 26) & 0x3f)
#ifndef GRUB_UTIL
int EXPORT_FUNC(grub_aout_get_type) (union grub_aout_header *header);
grub_err_t EXPORT_FUNC(grub_aout_load) (grub_file_t file, int offset,
grub_addr_t load_addr, int load_size,
grub_addr_t bss_end_addr);
void *load_addr, int load_size,
grub_size_t bss_size);
#endif
#endif /* ! GRUB_AOUT_HEADER */

View file

@ -32,6 +32,12 @@ typedef enum
GRUB_ATA_LBA48
} grub_ata_addressing_t;
#define GRUB_ATA_CH0_PORT1 0x1f0
#define GRUB_ATA_CH1_PORT1 0x170
#define GRUB_ATA_CH0_PORT2 0x3f6
#define GRUB_ATA_CH1_PORT2 0x376
#define GRUB_ATA_REG_DATA 0
#define GRUB_ATA_REG_ERROR 1
#define GRUB_ATA_REG_FEATURES 1

View file

@ -50,6 +50,7 @@ static inline grub_err_t grub_autoefi_prepare (void)
# define SYSTEM_TABLE_PTR(x) ((void *)(grub_efi_system_table->x))
# define SIZEOF_OF_UINTN sizeof (grub_efi_uintn_t)
# define SYSTEM_TABLE(x) (grub_efi_system_table->x)
# define grub_autoefi_finish_boot_services grub_efi_finish_boot_services
# define EFI_PRESENT 1
#else
# include <grub/efiemu/efiemu.h>
@ -72,6 +73,7 @@ static inline grub_err_t grub_autoefi_prepare (void)
# define SYSTEM_TABLE GRUB_EFIEMU_SYSTEM_TABLE
# define grub_efi_allocate_pages(x,y) (x)
# define grub_efi_free_pages(x,y) GRUB_EFI_SUCCESS
# define grub_autoefi_finish_boot_services grub_efiemu_finish_boot_services
# define EFI_PRESENT 1
#endif

91
include/grub/bsdlabel.h Normal file
View file

@ -0,0 +1,91 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2004,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_BSDLABEL_PARTITION_HEADER
#define GRUB_BSDLABEL_PARTITION_HEADER 1
/* Constants for BSD disk label. */
#define GRUB_PC_PARTITION_BSD_LABEL_SECTOR 1
#define GRUB_PC_PARTITION_BSD_LABEL_MAGIC 0x82564557
/* BSD partition types. */
#define GRUB_PC_PARTITION_BSD_TYPE_UNUSED 0
#define GRUB_PC_PARTITION_BSD_TYPE_SWAP 1
#define GRUB_PC_PARTITION_BSD_TYPE_V6 2
#define GRUB_PC_PARTITION_BSD_TYPE_V7 3
#define GRUB_PC_PARTITION_BSD_TYPE_SYSV 4
#define GRUB_PC_PARTITION_BSD_TYPE_V71K 5
#define GRUB_PC_PARTITION_BSD_TYPE_V8 6
#define GRUB_PC_PARTITION_BSD_TYPE_BSDFFS 7
#define GRUB_PC_PARTITION_BSD_TYPE_MSDOS 8
#define GRUB_PC_PARTITION_BSD_TYPE_BSDLFS 9
#define GRUB_PC_PARTITION_BSD_TYPE_OTHER 10
#define GRUB_PC_PARTITION_BSD_TYPE_HPFS 11
#define GRUB_PC_PARTITION_BSD_TYPE_ISO9660 12
#define GRUB_PC_PARTITION_BSD_TYPE_BOOT 13
/* FreeBSD-specific types. */
#define GRUB_PC_PARTITION_FREEBSD_TYPE_VINUM 14
#define GRUB_PC_PARTITION_FREEBSD_TYPE_RAID 15
#define GRUB_PC_PARTITION_FREEBSD_TYPE_JFS2 21
/* NetBSD-specific types. */
#define GRUB_PC_PARTITION_NETBSD_TYPE_ADOS 14
#define GRUB_PC_PARTITION_NETBSD_TYPE_HFS 15
#define GRUB_PC_PARTITION_NETBSD_TYPE_FILECORE 16
#define GRUB_PC_PARTITION_NETBSD_TYPE_EXT2FS 17
#define GRUB_PC_PARTITION_NETBSD_TYPE_NTFS 18
#define GRUB_PC_PARTITION_NETBSD_TYPE_RAID 19
#define GRUB_PC_PARTITION_NETBSD_TYPE_CCD 20
#define GRUB_PC_PARTITION_NETBSD_TYPE_JFS2 21
#define GRUB_PC_PARTITION_NETBSD_TYPE_APPLEUFS 22
/* OpenBSD-specific types. */
#define GRUB_PC_PARTITION_OPENBSD_TYPE_ADOS 14
#define GRUB_PC_PARTITION_OPENBSD_TYPE_HFS 15
#define GRUB_PC_PARTITION_OPENBSD_TYPE_FILECORE 16
#define GRUB_PC_PARTITION_OPENBSD_TYPE_EXT2FS 17
#define GRUB_PC_PARTITION_OPENBSD_TYPE_NTFS 18
#define GRUB_PC_PARTITION_OPENBSD_TYPE_RAID 19
#define GRUB_PC_PARTITION_BSD_LABEL_WHOLE_DISK_PARTITION 2
/* The BSD partition entry. */
struct grub_partition_bsd_entry
{
grub_uint32_t size;
grub_uint32_t offset;
grub_uint32_t fragment_size;
grub_uint8_t fs_type;
grub_uint8_t fs_fragments;
grub_uint16_t fs_cylinders;
} __attribute__ ((packed));
/* The BSD disk label. Only define members useful for GRUB. */
struct grub_partition_bsd_disk_label
{
grub_uint32_t magic;
grub_uint8_t padding[128];
grub_uint32_t magic2;
grub_uint16_t checksum;
grub_uint16_t num_partitions;
grub_uint32_t boot_size;
grub_uint32_t superblock_size;
} __attribute__ ((packed));
#endif /* ! GRUB_PC_PARTITION_HEADER */

View file

@ -117,5 +117,11 @@ grub_is_valid_utf8 (const grub_uint8_t *src, grub_size_t srcsize);
int grub_utf8_to_ucs4_alloc (const char *msg, grub_uint32_t **unicode_msg,
grub_uint32_t **last_position);
void
grub_ucs4_to_utf8 (grub_uint32_t *src, grub_size_t size,
grub_uint8_t *dest, grub_size_t destsize);
grub_size_t grub_utf8_to_ucs4 (grub_uint32_t *dest, grub_size_t destsize,
const grub_uint8_t *src, grub_size_t srcsize,
const grub_uint8_t **srcend);
#endif

View file

@ -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
View 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

View file

@ -33,10 +33,17 @@ struct grub_datetime
};
/* Return date and time. */
#ifdef GRUB_MACHINE_EMU
grub_err_t EXPORT_FUNC(grub_get_datetime) (struct grub_datetime *datetime);
/* Set date and time. */
grub_err_t EXPORT_FUNC(grub_set_datetime) (struct grub_datetime *datetime);
#else
grub_err_t grub_get_datetime (struct grub_datetime *datetime);
/* Set date and time. */
grub_err_t grub_set_datetime (struct grub_datetime *datetime);
#endif
int grub_get_weekday (struct grub_datetime *datetime);
char *grub_get_weekday_name (struct grub_datetime *datetime);

View file

@ -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);

View file

@ -25,6 +25,13 @@
#include <grub/types.h>
#include <grub/elf.h>
/*
* Macros GRUB_MOD_INIT and GRUB_MOD_FINI are also used by build rules
* to collect module names, so we define them only when they are not
* defined already.
*/
#ifndef GRUB_MOD_INIT
#define GRUB_MOD_INIT(name) \
static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \
void grub_##name##_init (void); \
@ -32,7 +39,9 @@ void \
grub_##name##_init (void) { grub_mod_init (0); } \
static void \
grub_mod_init (grub_dl_t mod __attribute__ ((unused)))
#endif
#ifndef GRUB_MOD_FINI
#define GRUB_MOD_FINI(name) \
static void grub_mod_fini (void) __attribute__ ((used)); \
void grub_##name##_fini (void); \
@ -40,6 +49,7 @@ void \
grub_##name##_fini (void) { grub_mod_fini (); } \
static void \
grub_mod_fini (void)
#endif
#ifdef APPLE_CC
#define GRUB_MOD_NAME(name) \
@ -82,6 +92,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;
@ -90,25 +101,12 @@ grub_dl_t EXPORT_FUNC(grub_dl_load) (const char *name);
grub_dl_t grub_dl_load_core (void *addr, grub_size_t size);
int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod);
void grub_dl_unload_unneeded (void);
void grub_dl_unload_all (void);
#ifdef GRUB_UTIL
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);
@ -116,7 +114,7 @@ grub_err_t grub_dl_register_symbol (const char *name, void *addr,
grub_err_t grub_arch_dl_check_header (void *ehdr);
grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
#if defined (_mips) && ! defined (GRUB_UTIL)
#if defined (_mips)
#define GRUB_LINKER_HAVE_INIT 1
void grub_arch_dl_init_linker (void);
#endif

View file

@ -53,8 +53,10 @@ void EXPORT_FUNC(grub_efi_print_device_path) (grub_efi_device_path_t *dp);
char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp);
grub_efi_device_path_t *
EXPORT_FUNC(grub_efi_get_device_path) (grub_efi_handle_t handle);
int EXPORT_FUNC(grub_efi_exit_boot_services) (grub_efi_uintn_t map_key);
int EXPORT_FUNC (grub_efi_finish_boot_services) (void);
grub_err_t EXPORT_FUNC (grub_efi_finish_boot_services) (grub_efi_uintn_t *outbuf_size, void *outbuf,
grub_efi_uintn_t *map_key,
grub_efi_uintn_t *efi_desc_size,
grub_efi_uint32_t *efi_desc_version);
grub_err_t EXPORT_FUNC (grub_efi_set_virtual_address_map) (grub_efi_uintn_t memory_map_size,
grub_efi_uintn_t descriptor_size,
grub_efi_uint32_t descriptor_version,
@ -70,4 +72,6 @@ void grub_efi_set_prefix (void);
extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table);
extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle);
extern int EXPORT_VAR(grub_efi_is_finished);
#endif /* ! GRUB_EFI_EFI_HEADER */

View file

@ -34,9 +34,9 @@
by firmware. */
#define GRUB_MACHINE_MEMORY_HOLE 6
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
grub_err_t grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
grub_uint64_t,
grub_uint32_t));
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);

View file

@ -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

View file

@ -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

View file

@ -217,13 +217,20 @@ int grub_efiemu_get_memory_map (grub_efi_uintn_t *memory_map_size,
grub_efi_uintn_t *map_key,
grub_efi_uintn_t *descriptor_size,
grub_efi_uint32_t *descriptor_version);
grub_err_t
grub_efiemu_finish_boot_services (grub_efi_uintn_t *memory_map_size,
grub_efi_memory_descriptor_t *memory_map,
grub_efi_uintn_t *map_key,
grub_efi_uintn_t *descriptor_size,
grub_efi_uint32_t *descriptor_version);
grub_err_t
grub_efiemu_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
grub_uint64_t,
grub_uint32_t));
int grub_efiemu_sizeof_uintn_t (void);
int grub_efiemu_exit_boot_services (grub_efi_uintn_t map_key);
int grub_efiemu_finish_boot_services (void);
grub_err_t
grub_efiemu_get_lower_upper_memory (grub_uint64_t *lower, grub_uint64_t *upper);
#define GRUB_EFIEMU_MEMORY_AVAILABLE 1
@ -283,4 +290,6 @@ grub_efiemu_set_virtual_address_map (grub_efi_uintn_t memory_map_size,
__attribute__ ((unused)),
grub_efi_memory_descriptor_t *virtual_map);
grub_err_t grub_machine_efiemu_init_tables (void);
#endif /* ! GRUB_EFI_EMU_HEADER */

View file

@ -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 */

View file

@ -54,5 +54,13 @@ int grub_elf_is_elf64 (grub_elf_t);
grub_size_t grub_elf64_size (grub_elf_t, Elf64_Addr *);
grub_err_t grub_elf64_load (grub_elf_t, grub_elf64_load_hook_t, grub_addr_t *,
grub_size_t *);
grub_err_t
grub_elf32_phdr_iterate (grub_elf_t elf,
int NESTED_FUNC_ATTR (*hook) (grub_elf_t, Elf32_Phdr *, void *),
void *hook_arg);
grub_err_t
grub_elf64_phdr_iterate (grub_elf_t elf,
int NESTED_FUNC_ATTR (*hook) (grub_elf_t, Elf64_Phdr *, void *),
void *hook_arg);
#endif /* ! GRUB_ELFLOAD_HEADER */

View file

@ -26,9 +26,9 @@ enum grub_dev_abstraction_types {
};
char *grub_guess_root_device (const char *dir);
char *grub_get_prefix (const char *dir);
int grub_util_get_dev_abstraction (const char *os_dev);
char *grub_util_get_grub_dev (const char *os_dev);
char *grub_make_system_path_relative_to_its_root (const char *path);
const char *grub_util_check_block_device (const char *blk_dev);
const char *grub_util_check_char_device (const char *blk_dev);

View file

@ -20,8 +20,11 @@
#ifndef GRUB_BIOSDISK_MACHINE_UTIL_HEADER
#define GRUB_BIOSDISK_MACHINE_UTIL_HEADER 1
#include <grub/disk.h>
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);
#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */

80
include/grub/emu/misc.h Normal file
View file

@ -0,0 +1,80 @@
/*
* 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_EMU_MISC_H
#define GRUB_EMU_MISC_H 1
#include <grub/symbol.h>
#include <grub/types.h>
#include <grub/util/libzfs.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_emu_init (void);
void grub_init_all (void);
void grub_fini_all (void);
void grub_find_zpool_from_dir (const char *dir,
char **poolname, char **poolfs);
char *grub_make_system_path_relative_to_its_root (const char *path)
__attribute__ ((warn_unused_result));
void * EXPORT_FUNC(xmalloc) (grub_size_t size) __attribute__ ((warn_unused_result));
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) __attribute__ ((warn_unused_result));
char * EXPORT_FUNC(xstrdup) (const char *str) __attribute__ ((warn_unused_result));
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((warn_unused_result));
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
extern char * canonicalize_file_name (const char *path);
#ifdef HAVE_DEVICE_MAPPER
int grub_device_mapper_supported (void);
#endif
libzfs_handle_t *grub_get_libzfs_handle (void);
#endif /* GRUB_EMU_MISC_H */

View file

@ -22,6 +22,7 @@
#include <grub/types.h>
#include <grub/video.h>
#include <grub/file.h>
#include <grub/unicode.h>
/* Forward declaration of opaque structure grub_font.
Users only pass struct grub_font pointers to the font module functions,
@ -69,6 +70,11 @@ struct grub_font_glyph
grub_uint8_t bitmap[0];
};
/* Part of code field which is really used as such. */
#define GRUB_FONT_CODE_CHAR_MASK 0x001fffff
#define GRUB_FONT_CODE_RIGHT_JOINED 0x80000000
#define GRUB_FONT_CODE_LEFT_JOINED 0x40000000
/* Initialize the font loader.
Must be called before any fonts are loaded or used. */
void grub_font_loader_init (void);
@ -97,8 +103,7 @@ int EXPORT_FUNC (grub_font_get_leading) (grub_font_t font);
int EXPORT_FUNC (grub_font_get_height) (grub_font_t font);
int EXPORT_FUNC (grub_font_get_string_width) (grub_font_t font,
const char *str);
int EXPORT_FUNC (grub_font_get_xheight) (grub_font_t font);
struct grub_font_glyph *EXPORT_FUNC (grub_font_get_glyph) (grub_font_t font,
grub_uint32_t code);
@ -110,9 +115,11 @@ grub_err_t EXPORT_FUNC (grub_font_draw_glyph) (struct grub_font_glyph *glyph,
grub_video_color_t color,
int left_x, int baseline_y);
grub_err_t EXPORT_FUNC (grub_font_draw_string) (const char *str,
grub_font_t font,
grub_video_color_t color,
int left_x, int baseline_y);
int
EXPORT_FUNC (grub_font_get_constructed_device_width) (grub_font_t hinted_font,
const struct grub_unicode_glyph *glyph_id);
struct grub_font_glyph *
EXPORT_FUNC (grub_font_construct_glyph) (grub_font_t hinted_font,
const struct grub_unicode_glyph *glyph_id);
#endif /* ! GRUB_FONT_HEADER */

View file

@ -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,24 @@ 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);
#ifndef GRUB_LST_GENERATOR
static inline void
grub_fs_register (grub_fs_t fs)
{
grub_list_push (GRUB_AS_LIST_P (&grub_fs_list), GRUB_AS_LIST (fs));
}
#endif
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 */

View file

@ -62,6 +62,14 @@ grub_gfxmenu_print_timeout (int timeout, void *data);
void
grub_gfxmenu_set_chosen_entry (int entry, void *data);
grub_err_t grub_font_draw_string (const char *str,
grub_font_t font,
grub_video_color_t color,
int left_x, int baseline_y);
int grub_font_get_string_width (grub_font_t font,
const char *str);
/* Implementation details -- this should not be used outside of the
view itself. */

View file

@ -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

View file

@ -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 */

View file

@ -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 ENABLE_NLS
#if (defined(ENABLE_NLS) && ENABLE_NLS) || !defined (GRUB_UTIL)
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
# ifdef GRUB_UTIL
@ -34,25 +34,33 @@ extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
# endif /* GRUB_UTIL */
#else /* ! ENABLE_NLS */
#else /* ! (defined(ENABLE_NLS) && ENABLE_NLS) */
/* Disabled NLS.
The casts to 'const char *' serve the purpose of producing warnings
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 /* ENABLE_NLS */
#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

View file

@ -20,6 +20,8 @@
#define GRUB_BSD_CPU_HEADER 1
#include <grub/types.h>
#include <grub/relocator.h>
#include <grub/i386/freebsd_reboot.h>
#include <grub/i386/netbsd_reboot.h>
#include <grub/i386/openbsd_reboot.h>
@ -27,7 +29,6 @@
#include <grub/i386/netbsd_bootinfo.h>
#include <grub/i386/openbsd_bootarg.h>
enum bsd_kernel_types
{
KERNEL_TYPE_NONE,
@ -65,35 +66,55 @@ struct grub_freebsd_bootinfo
grub_uint32_t tags;
} __attribute__ ((packed));
struct grub_openbsd_bios_mmap
struct freebsd_tag_header
{
grub_uint64_t addr;
grub_uint64_t len;
#define OPENBSD_MMAP_AVAILABLE 1
#define OPENBSD_MMAP_RESERVED 2
#define OPENBSD_MMAP_ACPI 3
#define OPENBSD_MMAP_NVS 4
grub_uint32_t type;
grub_uint32_t len;
};
void grub_unix_real_boot (grub_addr_t entry, ...)
__attribute__ ((cdecl,noreturn));
grub_err_t grub_freebsd_load_elfmodule32 (grub_file_t file, int argc,
grub_err_t grub_freebsd_load_elfmodule32 (struct grub_relocator *relocator,
grub_file_t file, int argc,
char *argv[], grub_addr_t *kern_end);
grub_err_t grub_freebsd_load_elfmodule_obj64 (grub_file_t file, int argc,
grub_err_t grub_freebsd_load_elfmodule_obj64 (struct grub_relocator *relocator,
grub_file_t file, int argc,
char *argv[],
grub_addr_t *kern_end);
grub_err_t grub_freebsd_load_elf_meta32 (grub_file_t file,
grub_err_t grub_freebsd_load_elf_meta32 (struct grub_relocator *relocator,
grub_file_t file,
grub_addr_t *kern_end);
grub_err_t grub_freebsd_load_elf_meta64 (grub_file_t file,
grub_err_t grub_freebsd_load_elf_meta64 (struct grub_relocator *relocator,
grub_file_t file,
grub_addr_t *kern_end);
grub_err_t grub_freebsd_add_meta (grub_uint32_t type, void *data,
grub_uint32_t len);
grub_err_t grub_netbsd_load_elf_meta32 (struct grub_relocator *relocator,
grub_file_t file,
grub_addr_t *kern_end);
grub_err_t grub_netbsd_load_elf_meta64 (struct grub_relocator *relocator,
grub_file_t file,
grub_addr_t *kern_end);
grub_err_t grub_bsd_add_meta (grub_uint32_t type,
void *data, grub_uint32_t len);
grub_err_t grub_freebsd_add_meta_module (char *filename, char *type,
int argc, char **argv,
grub_addr_t addr, grub_uint32_t size);
struct grub_openbsd_ramdisk_descriptor
{
grub_size_t max_size;
grub_uint8_t *target;
grub_uint32_t *size;
};
grub_err_t grub_openbsd_find_ramdisk32 (grub_file_t file,
grub_addr_t kern_start,
void *kern_chunk_src,
struct grub_openbsd_ramdisk_descriptor *desc);
grub_err_t grub_openbsd_find_ramdisk64 (grub_file_t file,
grub_addr_t kern_start,
void *kern_chunk_src,
struct grub_openbsd_ramdisk_descriptor *desc);
extern grub_uint8_t grub_bsd64_trampoline_start, grub_bsd64_trampoline_end;
extern grub_uint32_t grub_bsd64_trampoline_selfjump;
extern grub_uint32_t grub_bsd64_trampoline_gdt;

View file

@ -1 +0,0 @@
#include <grub/cpu/loader.h>

View file

@ -44,8 +44,9 @@ typedef struct grub_linuxbios_table_header *grub_linuxbios_table_header_t;
struct grub_linuxbios_table_item
{
#define GRUB_LINUXBIOS_MEMBER_UNUSED 0
#define GRUB_LINUXBIOS_MEMBER_MEMORY 1
#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;
};

View file

@ -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 */

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/serial.h>

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,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,17 +16,21 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_KERNEL_MACHINE_HEADER
#define GRUB_KERNEL_MACHINE_HEADER 1
#ifndef GRUB_FLOPPY_CPU_HEADER
#define GRUB_FLOPPY_CPU_HEADER 1
#include <grub/symbol.h>
#define GRUB_FLOPPY_REG_DIGITAL_OUTPUT 0x3f2
#ifndef ASM_FILE
#include <grub/cpu/io.h>
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char grub_prefix[];
/* Stop the floppy drive from spinning, so that other software is
jumped to with a known state. */
static inline void
grub_stop_floppy (void)
{
grub_outb (0, GRUB_FLOPPY_REG_DIGITAL_OUTPUT);
}
#endif
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
#endif

View file

@ -1 +0,0 @@
#include <grub/powerpc/ieee1275/kernel.h>

View file

@ -124,7 +124,7 @@ struct linux_kernel_header
grub_uint32_t bootsect_kludge; /* obsolete */
grub_uint16_t heap_end_ptr; /* Free memory after setup end */
grub_uint16_t pad1; /* Unused */
char *cmd_line_ptr; /* Points to the kernel command line */
grub_uint32_t cmd_line_ptr; /* Points to the kernel command line */
grub_uint32_t initrd_addr_max; /* Highest address for initrd */
} __attribute__ ((packed));

View file

@ -1,37 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2004,2007,2008,2009,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_LOADER_CPU_HEADER
#define GRUB_LOADER_CPU_HEADER 1
#include <grub/types.h>
#include <grub/err.h>
#include <grub/symbol.h>
extern grub_addr_t EXPORT_VAR(grub_os_area_addr);
extern grub_size_t EXPORT_VAR(grub_os_area_size);
#ifdef GRUB_MACHINE_PCBIOS
extern grub_uint32_t EXPORT_VAR(grub_linux_prot_size);
extern char *EXPORT_VAR(grub_linux_tmp_addr);
extern char *EXPORT_VAR(grub_linux_real_addr);
extern grub_int32_t EXPORT_VAR(grub_linux_is_bzimage);
grub_err_t EXPORT_FUNC(grub_linux16_real_boot) (void);
#endif
#endif /* ! GRUB_LOADER_CPU_HEADER */

View file

@ -22,9 +22,34 @@
/* The flag for protected mode. */
#define GRUB_MEMORY_CPU_CR0_PE_ON 0x1
#define GRUB_MEMORY_CPU_CR4_PAE_ON 0x00000040
#define GRUB_MEMORY_CPU_CR4_PAE_ON 0x00000020
#define GRUB_MEMORY_CPU_CR4_PSE_ON 0x00000010
#define GRUB_MEMORY_CPU_CR0_PAGING_ON 0x80000000
#define GRUB_MEMORY_CPU_AMD64_MSR 0xc0000080
#define GRUB_MEMORY_CPU_AMD64_MSR_ON 0x00000100
#ifndef ASM_FILE
typedef grub_addr_t grub_phys_addr_t;
static inline grub_phys_addr_t
grub_vtop (void *a)
{
return (grub_phys_addr_t) a;
}
static inline void *
grub_map_memory (grub_phys_addr_t a, grub_size_t size __attribute__ ((unused)))
{
return (void *) a;
}
static inline void
grub_unmap_memory (void *a __attribute__ ((unused)),
grub_size_t size __attribute__ ((unused)))
{
}
#endif
#endif /* ! GRUB_MEMORY_CPU_HEADER */

View file

@ -19,17 +19,18 @@
#ifndef GRUB_MULTIBOOT_CPU_HEADER
#define GRUB_MULTIBOOT_CPU_HEADER 1
/* The asm part of the multiboot loader. */
void grub_multiboot_real_boot (grub_addr_t entry,
struct multiboot_info *mbi)
__attribute__ ((noreturn));
void grub_multiboot2_real_boot (grub_addr_t entry,
struct multiboot_info *mbi)
__attribute__ ((noreturn));
#define MULTIBOOT_INITIAL_STATE { .eax = MULTIBOOT_BOOTLOADER_MAGIC, \
.ecx = 0, \
.edx = 0, \
/* Set esp to some random location in low memory to avoid breaking */ \
/* non-compliant kernels. */ \
.esp = 0x7ff00 \
}
#define MULTIBOOT_ENTRY_REGISTER eip
#define MULTIBOOT_MBI_REGISTER ebx
#define MULTIBOOT_ARCHITECTURE_CURRENT MULTIBOOT_ARCHITECTURE_I386
extern grub_uint32_t grub_multiboot_payload_eip;
extern char *grub_multiboot_payload_orig;
extern grub_addr_t grub_multiboot_payload_dest;
extern grub_size_t grub_multiboot_payload_size;
#define MULTIBOOT_ELF32_MACHINE EM_386
#define MULTIBOOT_ELF64_MACHINE EM_X86_64
#endif /* ! GRUB_MULTIBOOT_CPU_HEADER */

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/boot.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/console.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/kernel.h>

View file

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

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/serial.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/time.h>

View file

@ -49,64 +49,90 @@
#include <grub/types.h>
#define NETBSD_BTINFO_BOOTPATH 0
#define NETBSD_BTINFO_ROOTDEVICE 1
#define NETBSD_BTINFO_BOOTDISK 3
#define NETBSD_BTINFO_CONSOLE 6
#define NETBSD_BTINFO_SYMTAB 8
#define NETBSD_BTINFO_MEMMAP 9
#define NETBSD_BTINFO_MODULES 11
#define NETBSD_BTINFO_FRAMEBUF 12
struct grub_netbsd_bootinfo
{
grub_uint32_t bi_count;
grub_uint32_t bi_data[0];
};
struct grub_netbsd_btinfo_common
{
int len;
int type;
};
struct grub_netbsd_btinfo_mmap_header
{
struct grub_netbsd_btinfo_common common;
grub_uint32_t count;
};
struct grub_netbsd_btinfo_mmap_entry
{
grub_uint64_t addr;
grub_uint64_t len;
#define NETBSD_MMAP_AVAILABLE 1
#define NETBSD_MMAP_RESERVED 2
#define NETBSD_MMAP_ACPI 3
#define NETBSD_MMAP_NVS 4
grub_uint32_t len;
grub_uint32_t type;
};
struct grub_netbsd_btinfo_bootpath
{
struct grub_netbsd_btinfo_common common;
char bootpath[80];
};
struct grub_netbsd_btinfo_rootdevice
{
struct grub_netbsd_btinfo_common common;
char devname[16];
};
#define GRUB_NETBSD_MAX_BOOTPATH_LEN 80
struct grub_netbsd_btinfo_bootdisk
{
struct grub_netbsd_btinfo_common common;
int labelsector; /* label valid if != -1 */
grub_uint32_t labelsector; /* label valid if != 0xffffffff */
struct
{
grub_uint16_t type, checksum;
char packname[16];
} label;
int biosdev;
int partition;
grub_uint32_t biosdev;
grub_uint32_t partition;
};
struct grub_netbsd_bootinfo
struct grub_netbsd_btinfo_symtab
{
grub_uint32_t bi_count;
void *bi_data[1];
grub_uint32_t nsyms;
grub_uint32_t ssyms;
grub_uint32_t esyms;
};
struct grub_netbsd_btinfo_serial
{
char devname[16];
grub_uint32_t addr;
grub_uint32_t speed;
};
struct grub_netbsd_btinfo_modules
{
grub_uint32_t num;
grub_uint32_t last_addr;
struct grub_netbsd_btinfo_module
{
char name[80];
#define GRUB_NETBSD_MODULE_RAW 0
#define GRUB_NETBSD_MODULE_ELF 1
grub_uint32_t type;
grub_uint32_t size;
grub_uint32_t addr;
} mods[0];
};
struct grub_netbsd_btinfo_framebuf
{
grub_uint64_t fbaddr;
grub_uint32_t flags;
grub_uint32_t width;
grub_uint32_t height;
grub_uint16_t pitch;
grub_uint8_t bpp;
grub_uint8_t red_mask_size;
grub_uint8_t green_mask_size;
grub_uint8_t blue_mask_size;
grub_uint8_t red_field_pos;
grub_uint8_t green_field_pos;
grub_uint8_t blue_field_pos;
grub_uint8_t reserved[16];
};
#define GRUB_NETBSD_MAX_ROOTDEVICE_LEN 16
#endif

View file

@ -61,12 +61,22 @@
#define OPENBSD_BOOTARG_END -1
#define OPENBSD_BOOTARG_MMAP 0
#define OPENBSD_BOOTARG_CONSOLE 5
struct grub_openbsd_bootargs
{
int ba_type;
int ba_size;
struct grub_openbsd_bootargs *ba_next;
grub_uint32_t ba_type;
grub_uint32_t ba_size;
grub_uint32_t ba_next;
} __attribute__ ((packed));
struct grub_openbsd_bootarg_console
{
grub_uint32_t device;
grub_uint32_t speed;
};
#define GRUB_OPENBSD_COM_MAJOR 8
#define GRUB_OPENBSD_VGA_MAJOR 12
#endif

View file

@ -106,21 +106,4 @@ struct grub_biosdisk_dap
grub_uint64_t block;
} __attribute__ ((packed));
int EXPORT_FUNC(grub_biosdisk_rw_int13_extensions) (int ah, int drive, void *dap);
int EXPORT_FUNC(grub_biosdisk_rw_standard) (int ah, int drive, int coff, int hoff,
int soff, int nsec, int segment);
int EXPORT_FUNC(grub_biosdisk_check_int13_extensions) (int drive);
int EXPORT_FUNC(grub_biosdisk_get_diskinfo_int13_extensions) (int drive,
void *drp);
int EXPORT_FUNC(grub_biosdisk_get_cdinfo_int13_extensions) (int drive,
void *cdrp);
int EXPORT_FUNC(grub_biosdisk_get_diskinfo_standard) (int drive,
unsigned long *cylinders,
unsigned long *heads,
unsigned long *sectors);
int EXPORT_FUNC(grub_biosdisk_get_num_floppies) (void);
void grub_biosdisk_init (void);
void grub_biosdisk_fini (void);
#endif /* ! GRUB_BIOSDISK_MACHINE_HEADER */

View file

@ -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 */

View file

@ -40,12 +40,15 @@
#include <grub/i386/vga_common.h>
/* These are global to share code between C and asm. */
int grub_console_checkkey (void);
int grub_console_getkey (void);
grub_uint16_t grub_console_getxy (void);
void grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y);
void grub_console_cls (void);
void grub_console_setcursor (int on);
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,
grub_uint8_t x, grub_uint8_t y);
void grub_console_cls (struct grub_term_output *term);
void grub_console_setcursor (struct grub_term_output *term, int on);
void grub_console_putchar (struct grub_term_output *term,
const struct grub_unicode_glyph *c);
/* Initialize the console system. */
void grub_console_init (void);

View file

@ -22,23 +22,9 @@
#include <grub/types.h>
#include <grub/symbol.h>
#include <grub/machine/memory.h>
/* Get the memory size in KB. If EXTENDED is zero, return conventional
memory, otherwise return extended memory. */
grub_uint16_t grub_get_memsize (int extended);
/* Get a packed EISA memory map. Lower 16 bits are between 1MB and 16MB
in 1KB parts, and upper 16 bits are above 16MB in 64KB parts. */
grub_uint32_t grub_get_eisa_mmap (void);
/* Get a memory map entry. Return next continuation value. Zero means
the end. */
grub_uint32_t EXPORT_FUNC(grub_get_mmap_entry) (struct grub_machine_mmap_entry *entry,
grub_uint32_t cont);
#include <grub/cpu/floppy.h>
/* Turn on/off Gate A20. */
void grub_gate_a20 (int on);
void EXPORT_FUNC(grub_stop_floppy) (void);
#endif /* ! GRUB_INIT_MACHINE_HEADER */

View file

@ -0,0 +1,52 @@
/*
* 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_INTERRUPT_MACHINE_HEADER
#define GRUB_INTERRUPT_MACHINE_HEADER 1
#include <grub/symbol.h>
struct grub_bios_int_registers
{
grub_uint32_t eax;
grub_uint16_t es;
grub_uint16_t ds;
grub_uint16_t flags;
grub_uint16_t dummy;
grub_uint32_t ebx;
grub_uint32_t ecx;
grub_uint32_t edi;
grub_uint32_t esi;
grub_uint32_t edx;
};
#define GRUB_CPU_INT_FLAGS_CARRY 0x1
#define GRUB_CPU_INT_FLAGS_PARITY 0x4
#define GRUB_CPU_INT_FLAGS_ADJUST 0x10
#define GRUB_CPU_INT_FLAGS_ZERO 0x40
#define GRUB_CPU_INT_FLAGS_SIGN 0x80
#define GRUB_CPU_INT_FLAGS_TRAP 0x100
#define GRUB_CPU_INT_FLAGS_INTERRUPT 0x200
#define GRUB_CPU_INT_FLAGS_DIRECTION 0x400
#define GRUB_CPU_INT_FLAGS_OVERFLOW 0x800
#define GRUB_CPU_INT_FLAGS_DEFAULT GRUB_CPU_INT_FLAGS_INTERRUPT
void EXPORT_FUNC (grub_bios_interrupt) (grub_uint8_t intno,
struct grub_bios_int_registers *regs);
#endif

View file

@ -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);

View file

@ -20,7 +20,6 @@
#define GRUB_LOADER_MACHINE_HEADER 1
#include <grub/symbol.h>
#include <grub/cpu/loader.h>
/* This is an asm part of the chainloader. */
void EXPORT_FUNC(grub_chainloader_real_boot) (int drive, void *part_addr) __attribute__ ((noreturn));

View file

@ -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 \

View file

@ -168,6 +168,8 @@
#ifndef ASM_FILE
#define GRUB_PXE_SIGNATURE "PXENV+"
struct grub_pxenv
{
grub_uint8_t signature[6]; /* 'PXENV+'. */
@ -302,8 +304,7 @@ struct grub_pxenv_unload_stack
grub_uint8_t reserved[10];
} __attribute__ ((packed));
struct grub_pxenv * EXPORT_FUNC(grub_pxe_scan) (void);
int EXPORT_FUNC(grub_pxe_call) (int func, void * data);
int EXPORT_FUNC(grub_pxe_call) (int func, void * data, grub_uint32_t pxe_rm_entry);
extern struct grub_pxenv *grub_pxe_pxenv;

View file

@ -169,56 +169,40 @@ struct grub_vbe_palette_data
grub_uint8_t alignment;
} __attribute__ ((packed));
/* Prototypes for kernel real mode thunks. */
/* Prototypes for helper functions. */
/* Call VESA BIOS 0x4f00 to get VBE Controller Information, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_get_controller_info) (struct grub_vbe_info_block *controller_info);
grub_vbe_status_t
grub_vbe_bios_get_controller_info (struct grub_vbe_info_block *controller_info);
/* Call VESA BIOS 0x4f01 to get VBE Mode Information, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_get_mode_info) (grub_uint32_t mode,
struct grub_vbe_mode_info_block *mode_info);
grub_vbe_status_t
grub_vbe_bios_get_mode_info (grub_uint32_t mode,
struct grub_vbe_mode_info_block *mode_info);
/* Call VESA BIOS 0x4f03 to return current VBE Mode, return status. */
grub_vbe_status_t
grub_vbe_bios_get_mode (grub_uint32_t *mode);
/* Call VESA BIOS 0x4f05 to set memory window, return status. */
grub_vbe_status_t
grub_vbe_bios_set_memory_window (grub_uint32_t window, grub_uint32_t position);
/* Call VESA BIOS 0x4f05 to return memory window, return status. */
grub_vbe_status_t
grub_vbe_bios_get_memory_window (grub_uint32_t window,
grub_uint32_t *position);
/* Call VESA BIOS 0x4f06 to set scanline length (in bytes), return status. */
grub_vbe_status_t
grub_vbe_bios_set_scanline_length (grub_uint32_t length);
/* Call VESA BIOS 0x4f06 to return scanline length (in bytes), return status. */
grub_vbe_status_t
grub_vbe_bios_get_scanline_length (grub_uint32_t *length);
/* Call VESA BIOS 0x4f07 to get display start, return status. */
grub_vbe_status_t
grub_vbe_bios_get_display_start (grub_uint32_t *x,
grub_uint32_t *y);
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_getset_dac_palette_width) (int set, int *width);
grub_vbe_status_t grub_vbe_bios_getset_dac_palette_width (int set, int *width);
#define grub_vbe_bios_get_dac_palette_width(width) grub_vbe_bios_getset_dac_palette_width(0, (width))
#define grub_vbe_bios_set_dac_palette_width(width) grub_vbe_bios_getset_dac_palette_width(1, (width))
/* Call VESA BIOS 0x4f02 to set video mode, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_set_mode) (grub_uint32_t mode,
struct grub_vbe_crtc_info_block *crtc_info);
/* Call VESA BIOS 0x4f03 to return current VBE Mode, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_get_mode) (grub_uint32_t *mode);
/* Call VESA BIOS 0x4f05 to set memory window, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_set_memory_window) (grub_uint32_t window,
grub_uint32_t position);
/* Call VESA BIOS 0x4f05 to return memory window, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_get_memory_window) (grub_uint32_t window,
grub_uint32_t *position);
/* Call VESA BIOS 0x4f06 to set scanline length (in bytes), return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_set_scanline_length) (grub_uint32_t length);
/* Call VESA BIOS 0x4f06 to return scanline length (in bytes), return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_get_scanline_length) (grub_uint32_t *length);
/* Call VESA BIOS 0x4f07 to set display start, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_set_display_start) (grub_uint32_t x,
grub_uint32_t y);
/* Call VESA BIOS 0x4f07 to get display start, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_get_display_start) (grub_uint32_t *x,
grub_uint32_t *y);
/* Call VESA BIOS 0x4f09 to set palette data, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_set_palette_data) (grub_uint32_t color_count,
grub_uint32_t start_index,
struct grub_vbe_palette_data *palette_data);
/* Prototypes for helper functions. */
grub_err_t grub_vbe_probe (struct grub_vbe_info_block *info_block);
grub_err_t grub_vbe_set_video_mode (grub_uint32_t mode,
struct grub_vbe_mode_info_block *mode_info);

View file

@ -25,10 +25,4 @@
/* The VGA (at the beginning of upper memory). */
#define GRUB_MEMORY_MACHINE_VGA_ADDR GRUB_MEMORY_MACHINE_UPPER
/* Set the video mode to MODE and return the previous mode. */
unsigned char EXPORT_FUNC(grub_vga_set_mode) (unsigned char mode);
/* Return a pointer to the ROM font table. */
unsigned char *EXPORT_FUNC(grub_vga_get_font) (void);
#endif /* ! GRUB_VGA_MACHINE_HEADER */

View file

@ -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)))
{
}

View file

@ -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

View file

@ -1 +0,0 @@
#include <grub/i386/coreboot/init.h>

View file

@ -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,9 +34,7 @@ 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[];
void grub_qemu_init_cirrus (void);
#endif /* ! ASM_FILE */

View file

@ -1 +0,0 @@
#include <grub/cpu/loader.h>

View file

@ -21,6 +21,7 @@
#include <grub/types.h>
#include <grub/err.h>
#include <grub/relocator.h>
struct grub_relocator32_state
{
@ -30,12 +31,42 @@ struct grub_relocator32_state
grub_uint32_t ecx;
grub_uint32_t edx;
grub_uint32_t eip;
grub_uint32_t esi;
};
void *grub_relocator32_alloc (grub_size_t size);
grub_err_t grub_relocator32_boot (void *relocator, grub_uint32_t dest,
struct grub_relocator16_state
{
grub_uint16_t cs;
grub_uint16_t ds;
grub_uint16_t es;
grub_uint16_t fs;
grub_uint16_t gs;
grub_uint16_t ss;
grub_uint16_t sp;
grub_uint16_t ip;
grub_uint32_t edx;
};
struct grub_relocator64_state
{
grub_uint64_t rsp;
grub_uint64_t rax;
grub_uint64_t rbx;
grub_uint64_t rcx;
grub_uint64_t rdx;
grub_uint64_t rip;
grub_uint64_t rsi;
grub_addr_t cr3;
};
grub_err_t grub_relocator16_boot (struct grub_relocator *rel,
struct grub_relocator16_state state);
grub_err_t grub_relocator32_boot (struct grub_relocator *rel,
struct grub_relocator32_state state);
void *grub_relocator32_realloc (void *relocator, grub_size_t size);
void grub_relocator32_free (void *relocator);
grub_err_t grub_relocator64_boot (struct grub_relocator *rel,
struct grub_relocator64_state state,
grub_addr_t min_addr, grub_addr_t max_addr);
#endif /* ! GRUB_RELOCATOR_CPU_HEADER */

View file

@ -25,16 +25,8 @@
extern grub_uint8_t grub_console_cur_color;
void grub_console_putchar (grub_uint32_t c);
grub_ssize_t grub_console_getcharwidth (grub_uint32_t c);
grub_uint16_t grub_console_getwh (void);
void grub_console_setcolorstate (grub_term_color_state state);
void grub_console_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color);
void grub_console_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color);
/* Implemented in both kern/i386/pc/startup.S and vga_text.c; this symbol
is not exported, so there's no collision, but vga_common.c expects this
prototype to be the same. */
void grub_console_real_putchar (int c);
grub_uint16_t grub_console_getwh (struct grub_term_output *term);
void grub_console_setcolorstate (struct grub_term_output *term,
grub_term_color_state state);
#endif /* ! GRUB_VGA_COMMON_CPU_HEADER */

View file

@ -114,8 +114,5 @@ extern grub_uint32_t grub_xnu_stack;
extern grub_uint32_t grub_xnu_arg1;
extern char grub_xnu_cmdline[1024];
grub_err_t grub_xnu_boot (void);
grub_err_t grub_xnu_set_video (struct grub_xnu_boot_params *bootparams_relloc);
grub_err_t
grub_cpu_xnu_fill_devicetree (void);
extern grub_uint32_t grub_xnu_heap_will_be_at;
grub_err_t grub_cpu_xnu_fill_devicetree (void);
#endif

View file

@ -22,7 +22,8 @@
#include <grub/symbol.h>
/* Initialize the console system. */
void grub_console_init (void);
void grub_console_init_early (void);
void grub_console_init_lately (void);
/* Finish the console system. */
void grub_console_fini (void);

View file

@ -100,6 +100,9 @@ enum grub_ieee1275_flag
/* Open Hack'Ware don't support the ANSI sequence. */
GRUB_IEEE1275_FLAG_NO_ANSI,
/* OpenFirmware hangs on qemu if one requests any memory below 1.5 MiB. */
GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM,
};
extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);
@ -180,4 +183,8 @@ EXPORT_FUNC(grub_ieee1275_map) (grub_addr_t phys, grub_addr_t virt,
char *EXPORT_FUNC(grub_ieee1275_encode_devname) (const char *path);
char *EXPORT_FUNC(grub_ieee1275_get_filename) (const char *path);
int EXPORT_FUNC(grub_ieee1275_devices_iterate) (int (*hook)
(struct grub_ieee1275_devalias *
alias));
#endif /* ! GRUB_IEEE1275_HEADER */

View file

@ -26,8 +26,7 @@ enum
{
OBJ_TYPE_ELF,
OBJ_TYPE_MEMDISK,
OBJ_TYPE_CONFIG,
OBJ_TYPE_FONT
OBJ_TYPE_CONFIG
};
/* The module header. */
@ -42,23 +41,39 @@ 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 *));
grub_addr_t grub_modules_get_end (void);
/* The start point of the C code. */
void grub_main (void);
@ -74,4 +89,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 */

View file

@ -18,21 +18,31 @@
#include <config.h>
#ifdef HAVE___ASHLDI3
/* On x86 these functions aren't really needed. Save some space. */
#if !defined (__i386__) && !defined (__x86_64__)
# ifdef HAVE___ASHLDI3
void EXPORT_FUNC (__ashldi3) (void);
#endif
#ifdef HAVE___ASHRDI3
# endif
# ifdef HAVE___ASHRDI3
void EXPORT_FUNC (__ashrdi3) (void);
#endif
#ifdef HAVE___LSHRDI3
# endif
# ifdef HAVE___LSHRDI3
void EXPORT_FUNC (__lshrdi3) (void);
# endif
# ifdef HAVE___UCMPDI2
void EXPORT_FUNC (__ucmpdi2) (void);
# endif
# ifdef HAVE___BSWAPSI2
void EXPORT_FUNC (__bswapsi2) (void);
# endif
# ifdef HAVE___BSWAPDI2
void EXPORT_FUNC (__bswapdi2) (void);
# endif
#endif
#ifdef HAVE___TRAMPOLINE_SETUP
void EXPORT_FUNC (__trampoline_setup) (void);
#endif
#ifdef HAVE___UCMPDI2
void EXPORT_FUNC (__ucmpdi2) (void);
#endif
#ifdef HAVE__RESTGPR_14_X
void EXPORT_FUNC (_restgpr_14_x) (void);

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2004,2006,2007 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,7 +16,11 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_LOADER_MACHINE_HEADER
#define GRUB_LOADER_MACHINE_HEADER 1
#endif /* ! GRUB_LOADER_MACHINE_HEADER */
void EXPORT_FUNC (pci_slot_match_iterator_create) (void);
void EXPORT_FUNC (pci_system_cleanup) (void);
void EXPORT_FUNC (pci_device_unmap_range) (void);
void EXPORT_FUNC (pci_iterator_destroy) (void);
void EXPORT_FUNC (pci_device_map_range) (void);
void EXPORT_FUNC (pci_device_cfg_read_u32) (void);
void EXPORT_FUNC (pci_device_next) (void);
void EXPORT_FUNC (pci_system_init) (void);

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,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,13 +16,14 @@
* 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 */
void EXPORT_FUNC (usb_bulk_write) (void);
void EXPORT_FUNC (usb_find_busses) (void);
void EXPORT_FUNC (usb_init) (void);
void EXPORT_FUNC (usb_find_devices) (void);
void EXPORT_FUNC (usb_open) (void);
void EXPORT_FUNC (usb_get_busses) (void);
void EXPORT_FUNC (usb_control_msg) (void);
void EXPORT_FUNC (usb_release_interface) (void);
void EXPORT_FUNC (usb_close) (void);
void EXPORT_FUNC (usb_bulk_read) (void);
void EXPORT_FUNC (usb_claim_interface) (void);

View file

@ -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)
@ -52,7 +47,7 @@ grub_bad_type_cast_real (int line, const char *file)
return 0;
}
#define grub_bad_type_cast() grub_bad_type_cast_real(__LINE__, __FILE__)
#define grub_bad_type_cast() grub_bad_type_cast_real(__LINE__, GRUB_FILE)
#define GRUB_FIELD_MATCH(ptr, type, field) \
((char *) &(ptr)->field == (char *) &((type) (ptr))->field)

View file

@ -47,6 +47,8 @@ struct grub_menu_entry
/* The sourcecode of the menu entry, used by the editor. */
const char *sourcecode;
int hotkey;
/* The next element. */
struct grub_menu_entry *next;
};

View 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

View file

@ -0,0 +1,90 @@
/*
* 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_LOONGSON_CPU_HEADER
#define GRUB_LOONGSON_CPU_HEADER 1
#ifdef ASM_FILE
#define GRUB_CPU_REGISTER_WRAP(x) x
#else
#define GRUB_CPU_REGISTER_WRAP(x) #x
#endif
#define GRUB_CPU_LOONGSON_FLASH_START 0xbfc00000
#define GRUB_CPU_LOONGSON_FLASH_TLB_REFILL 0xbfc00200
#define GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR 0xbfc00300
#define GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION 0xbfc00380
#define GRUB_CPU_LOONGSON_DDR2_BASE 0xaffffe00
#define GRUB_CPU_LOONGSON_DDR2_REG1_HI_8BANKS 0x00000001
#define GRUB_CPU_LOONGSON_DDR2_REG_SIZE 0x8
#define GRUB_CPU_LOONGSON_DDR2_REG_STEP 0x10
#define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG GRUB_CPU_REGISTER_WRAP($16)
#define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG_ILINESIZE 0x10
#define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG_DLINESIZE 0x8
#define GRUB_CPU_LOONGSON_COP0_CACHE_DSIZE_SHIFT 6
#define GRUB_CPU_LOONGSON_COP0_CACHE_ISIZE_SHIFT 9
#define GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_MASK 0x7
#define GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_OFFSET 12
#define GRUB_CPU_LOONGSON_COP0_I_INDEX_INVALIDATE 0
#define GRUB_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE 9
#define GRUB_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE 11
#define GRUB_CPU_LOONGSON_COP0_I_INDEX_BIT_OFFSET 5
#define GRUB_CPU_LOONGSON_COP0_D_INDEX_BIT_OFFSET 5
#define GRUB_CPU_LOONGSON_COP0_S_INDEX_BIT_OFFSET 5
#define GRUB_CPU_LOONGSON_CACHE_ACCELERATED 7
#define GRUB_CPU_LOONGSON_CACHE_UNCACHED 2
#define GRUB_CPU_LOONGSON_CACHE_CACHED 3
#define GRUB_CPU_LOONGSON_CACHE_TYPE_MASK 7
#define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_SMALL 4
#define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG 5
#define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_SMALL 16
#define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_BIG 32
#define GRUB_CPU_LOONGSON_I_CACHE_LOG_WAYS 2
#define GRUB_CPU_LOONGSON_D_CACHE_LOG_WAYS 2
#define GRUB_CPU_LOONGSON_S_CACHE_LOG_WAYS 2
/* FIXME: determine dynamically. */
#define GRUB_CPU_LOONGSON_SECONDARY_CACHE_LOG_SIZE 19
#define GRUB_CPU_LOONGSON_COP0_BADVADDR GRUB_CPU_REGISTER_WRAP($8)
#define GRUB_CPU_LOONGSON_COP0_TIMER_COUNT GRUB_CPU_REGISTER_WRAP($9)
#define GRUB_CPU_LOONGSON_COP0_CAUSE GRUB_CPU_REGISTER_WRAP($13)
#define GRUB_CPU_LOONGSON_COP0_EPC GRUB_CPU_REGISTER_WRAP($14)
#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGLO GRUB_CPU_REGISTER_WRAP($28)
#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGHI GRUB_CPU_REGISTER_WRAP($29)
#define GRUB_CPU_LOONGSON_LIOCFG 0xbfe00108
#define GRUB_CPU_LOONGSON_ROM_DELAY_OFFSET 2
#define GRUB_CPU_LOONGSON_ROM_DELAY_MASK 0x1f
#define GRUB_CPU_LOONGSON_CORECFG 0xbfe00180
#define GRUB_CPU_LOONGSON_CORECFG_DISABLE_DDR2_SPACE 0x100
#define GRUB_CPU_LOONGSON_CORECFG_BUFFER_CPU 0x200
#define GRUB_CPU_LOONGSON_PCI_HIT1_SEL_LO 0xbfe00150
#define GRUB_CPU_LOONGSON_PCI_HIT1_SEL_HI 0xbfe00154
#define GRUB_CPU_LOONGSON_GPIOCFG 0xbfe00120
#define GRUB_CPU_LOONGSON_SHUTDOWN_GPIO 1
#endif

View file

@ -0,0 +1 @@
#include <grub/machine/memory.h>

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007 Free Software Foundation, Inc.
* Copyright (C) 2002,2003,2004,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
@ -16,13 +16,16 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_INIT_I386_LINUXBIOS_HEADER
#define GRUB_INIT_I386_LINUXBIOS_HEADER 1
#ifndef GRUB_MULTIBOOT_CPU_HEADER
#define GRUB_MULTIBOOT_CPU_HEADER 1
#include <grub/symbol.h>
#include <grub/i386/pc/memory.h>
#define MULTIBOOT_INITIAL_STATE { .gpr[4] = MULTIBOOT_BOOTLOADER_MAGIC, \
.jumpreg = 1 }
#define MULTIBOOT_ENTRY_REGISTER gpr[1]
#define MULTIBOOT_MBI_REGISTER gpr[5]
#define MULTIBOOT_ARCHITECTURE_CURRENT MULTIBOOT_ARCHITECTURE_MIPS32
void EXPORT_FUNC(grub_stop) (void) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_stop_floppy) (void);
#define MULTIBOOT_ELF32_MACHINE EM_MIPS
#define MULTIBOOT_ELF64_MACHINE EM_MIPS
#endif
#endif /* ! GRUB_MULTIBOOT_CPU_HEADER */

View file

@ -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 */

View file

@ -21,6 +21,7 @@
#include <grub/types.h>
#include <grub/err.h>
#include <grub/relocator.h>
struct grub_relocator32_state
{
@ -30,10 +31,8 @@ struct grub_relocator32_state
int jumpreg;
};
void *grub_relocator32_alloc (grub_size_t size);
grub_err_t grub_relocator32_boot (void *relocator, grub_uint32_t dest,
struct grub_relocator32_state state);
void *grub_relocator32_realloc (void *relocator, grub_size_t size);
void grub_relocator32_free (void *relocator);
grub_err_t
grub_relocator32_boot (struct grub_relocator *rel,
struct grub_relocator32_state state);
#endif /* ! GRUB_RELOCATOR_CPU_HEADER */

View file

@ -0,0 +1,41 @@
/*
* 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_EC_MACHINE_HEADER
#define GRUB_EC_MACHINE_HEADER 1
#define GRUB_MACHINE_EC_MAGIC_PORT1 0x381
#define GRUB_MACHINE_EC_MAGIC_PORT2 0x382
#define GRUB_MACHINE_EC_DATA_PORT 0x383
#define GRUB_MACHINE_EC_MAGIC_VAL1 0xf4
#define GRUB_MACHINE_EC_MAGIC_VAL2 0xec
#define GRUB_MACHINE_EC_COMMAND_REBOOT 1
static inline void
grub_write_ec (grub_uint8_t value)
{
grub_outb (GRUB_MACHINE_EC_MAGIC_VAL1,
GRUB_MACHINE_PCI_IO_BASE + GRUB_MACHINE_EC_MAGIC_PORT1);
grub_outb (GRUB_MACHINE_EC_MAGIC_VAL2,
GRUB_MACHINE_PCI_IO_BASE + GRUB_MACHINE_EC_MAGIC_PORT2);
grub_outb (value, GRUB_MACHINE_PCI_IO_BASE + GRUB_MACHINE_EC_DATA_PORT);
}
#endif

View file

@ -20,12 +20,11 @@
#define GRUB_KERNEL_MACHINE_HEADER 1
#include <grub/symbol.h>
#include <grub/cpu/kernel.h>
#ifndef ASM_FILE
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_halt) (void);
void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
#endif

View file

@ -31,7 +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
@ -40,6 +39,27 @@
#define GRUB_MACHINE_MEMORY_RESERVED GRUB_MACHINE_MEMORY_HOLE
#ifndef ASM_FILE
typedef grub_addr_t grub_phys_addr_t;
static inline grub_phys_addr_t
grub_vtop (void *a)
{
return ((grub_phys_addr_t) a) & 0x1fffffff;
}
static inline void *
grub_map_memory (grub_phys_addr_t a, grub_size_t size __attribute__ ((unused)))
{
return (void *) (a | 0x80000000);
}
static inline void
grub_unmap_memory (void *a __attribute__ ((unused)),
grub_size_t size __attribute__ ((unused)))
{
}
grub_err_t EXPORT_FUNC (grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));

View file

@ -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 */

View file

@ -19,6 +19,12 @@
#ifndef GRUB_MACHINE_SERIAL_HEADER
#define GRUB_MACHINE_SERIAL_HEADER 1
#define GRUB_MACHINE_SERIAL_PORTS { 0xbff003f8 }
#define GRUB_MACHINE_SERIAL_DIVISOR_115200 2
#define GRUB_MACHINE_SERIAL_PORT 0xbff003f8
#ifndef ASM_FILE
#define GRUB_MACHINE_SERIAL_PORTS { GRUB_MACHINE_SERIAL_PORT }
#else
#endif
#endif

View file

@ -43,10 +43,12 @@
#define ALIGN_UP(addr, align) \
((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1))
#define ALIGN_DOWN(addr, align) \
((addr) & ~((typeof (addr)) align - 1))
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(__FILE__, __LINE__, condition, fmt, ## args)
#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(GRUB_FILE, __LINE__, condition, fmt, ## args)
/* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */
#define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n))
@ -231,13 +233,25 @@ grub_strtol (const char *str, char **end, int base)
}
}
char *EXPORT_FUNC(grub_strdup) (const char *s);
char *EXPORT_FUNC(grub_strndup) (const char *s, grub_size_t n);
char *EXPORT_FUNC(grub_strdup) (const char *s) __attribute__ ((warn_unused_result));
char *EXPORT_FUNC(grub_strndup) (const char *s, grub_size_t n) __attribute__ ((warn_unused_result));
void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n);
grub_size_t EXPORT_FUNC(grub_strlen) (const char *s);
grub_size_t EXPORT_FUNC(grub_strlen) (const char *s) __attribute__ ((warn_unused_result));
int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
int EXPORT_FUNC(grub_puts) (const char *s);
extern void (*EXPORT_VAR (grub_xputs)) (const char *str);
static inline int
grub_puts (const char *s)
{
const char nl[2] = "\n";
grub_xputs (s);
grub_xputs (nl);
return 1; /* Cannot fail. */
}
int EXPORT_FUNC(grub_puts_) (const char *s);
void EXPORT_FUNC(grub_real_dprintf) (const char *file,
const int line,
@ -249,22 +263,22 @@ int EXPORT_FUNC(grub_snprintf) (char *str, grub_size_t n, const char *fmt, ...)
int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt,
va_list args);
char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args);
__attribute__ ((format (printf, 1, 2))) __attribute__ ((warn_unused_result));
char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args) __attribute__ ((warn_unused_result));
void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
grub_size_t EXPORT_FUNC(grub_utf8_to_ucs4) (grub_uint32_t *dest,
grub_size_t destsize,
const grub_uint8_t *src,
grub_size_t srcsize,
const grub_uint8_t **srcend);
grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
grub_uint32_t d, grub_uint32_t *r);
#ifdef NEED_ENABLE_EXECUTE_STACK
#if defined(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)
void EXPORT_FUNC (__register_frame_info) (void);
void EXPORT_FUNC (__deregister_frame_info) (void);
#endif
/* Inline functions. */
static inline unsigned int
@ -276,6 +290,15 @@ grub_abs (int x)
return (unsigned int) x;
}
static inline long
grub_min (long x, long y)
{
if (x < y)
return x;
else
return y;
}
static inline long
grub_max (long x, long y)
{
@ -293,14 +316,21 @@ grub_div_roundup (unsigned int x, unsigned int y)
}
/* Reboot the machine. */
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
#ifdef GRUB_MACHINE_PCBIOS
/* Halt the system, using APM if possible. If NO_APM is true, don't
* use APM even if it is available. */
void EXPORT_FUNC (grub_halt) (int no_apm);
void grub_halt (int no_apm) __attribute__ ((noreturn));
#else
void EXPORT_FUNC (grub_halt) (void);
void grub_halt (void) __attribute__ ((noreturn));
#endif
#ifdef GRUB_MACHINE_EMU
/* Flag to control module autoloading in normal mode. */
extern int EXPORT_VAR(grub_no_autoload);
#else
#define grub_no_autoload 0
#endif
#endif /* ! GRUB_MISC_HEADER */

View file

@ -35,8 +35,11 @@ void EXPORT_FUNC(grub_free) (void *ptr);
void *EXPORT_FUNC(grub_realloc) (void *ptr, grub_size_t size);
void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size);
void grub_mm_check_real (char *file, int line);
#define GRUB_MM_CHECK grub_mm_check_real (__FILE__, __LINE__);
/* For debugging. */
#if defined(MM_DEBUG) && !defined(GRUB_UTIL)
#if defined(MM_DEBUG) && !defined(GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)
/* Set this variable to 1 when you want to trace all memory function calls. */
extern int EXPORT_VAR(grub_mm_debug);
@ -44,19 +47,19 @@ void grub_mm_dump_free (void);
void grub_mm_dump (unsigned lineno);
#define grub_malloc(size) \
grub_debug_malloc (__FILE__, __LINE__, size)
grub_debug_malloc (GRUB_FILE, __LINE__, size)
#define grub_zalloc(size) \
grub_debug_zalloc (__FILE__, __LINE__, size)
grub_debug_zalloc (GRUB_FILE, __LINE__, size)
#define grub_realloc(ptr,size) \
grub_debug_realloc (__FILE__, __LINE__, ptr, size)
grub_debug_realloc (GRUB_FILE, __LINE__, ptr, size)
#define grub_memalign(align,size) \
grub_debug_memalign (__FILE__, __LINE__, align, size)
grub_debug_memalign (GRUB_FILE, __LINE__, align, size)
#define grub_free(ptr) \
grub_debug_free (__FILE__, __LINE__, ptr)
grub_debug_free (GRUB_FILE, __LINE__, ptr)
void *EXPORT_FUNC(grub_debug_malloc) (const char *file, int line,
grub_size_t size);

64
include/grub/mm_private.h Normal file
View file

@ -0,0 +1,64 @@
/*
* 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_MM_PRIVATE_H
#define GRUB_MM_PRIVATE_H 1
#include <grub/mm.h>
/* Magic words. */
#define GRUB_MM_FREE_MAGIC 0x2d3c2808
#define GRUB_MM_ALLOC_MAGIC 0x6db08fa4
typedef struct grub_mm_header
{
struct grub_mm_header *next;
grub_size_t size;
grub_size_t magic;
#if GRUB_CPU_SIZEOF_VOID_P == 4
char padding[4];
#elif GRUB_CPU_SIZEOF_VOID_P == 8
char padding[8];
#else
# error "unknown word size"
#endif
}
*grub_mm_header_t;
#if GRUB_CPU_SIZEOF_VOID_P == 4
# define GRUB_MM_ALIGN_LOG2 4
#elif GRUB_CPU_SIZEOF_VOID_P == 8
# define GRUB_MM_ALIGN_LOG2 5
#endif
#define GRUB_MM_ALIGN (1 << GRUB_MM_ALIGN_LOG2)
typedef struct grub_mm_region
{
struct grub_mm_header *first;
struct grub_mm_region *next;
grub_size_t pre_size;
grub_size_t size;
}
*grub_mm_region_t;
#ifndef GRUB_MACHINE_EMU
extern grub_mm_region_t EXPORT_VAR (grub_mm_base);
#endif
#endif

View file

@ -53,75 +53,6 @@
#define GRUB_PC_PARTITION_TYPE_GPT_DISK 0xee
#define GRUB_PC_PARTITION_TYPE_LINUX_RAID 0xfd
/* Constants for BSD disk label. */
#define GRUB_PC_PARTITION_BSD_LABEL_SECTOR 1
#define GRUB_PC_PARTITION_BSD_LABEL_MAGIC 0x82564557
#define GRUB_PC_PARTITION_BSD_MAX_ENTRIES 8
/* BSD partition types. */
#define GRUB_PC_PARTITION_BSD_TYPE_UNUSED 0
#define GRUB_PC_PARTITION_BSD_TYPE_SWAP 1
#define GRUB_PC_PARTITION_BSD_TYPE_V6 2
#define GRUB_PC_PARTITION_BSD_TYPE_V7 3
#define GRUB_PC_PARTITION_BSD_TYPE_SYSV 4
#define GRUB_PC_PARTITION_BSD_TYPE_V71K 5
#define GRUB_PC_PARTITION_BSD_TYPE_V8 6
#define GRUB_PC_PARTITION_BSD_TYPE_BSDFFS 7
#define GRUB_PC_PARTITION_BSD_TYPE_MSDOS 8
#define GRUB_PC_PARTITION_BSD_TYPE_BSDLFS 9
#define GRUB_PC_PARTITION_BSD_TYPE_OTHER 10
#define GRUB_PC_PARTITION_BSD_TYPE_HPFS 11
#define GRUB_PC_PARTITION_BSD_TYPE_ISO9660 12
#define GRUB_PC_PARTITION_BSD_TYPE_BOOT 13
/* FreeBSD-specific types. */
#define GRUB_PC_PARTITION_FREEBSD_TYPE_VINUM 14
#define GRUB_PC_PARTITION_FREEBSD_TYPE_RAID 15
#define GRUB_PC_PARTITION_FREEBSD_TYPE_JFS2 21
/* NetBSD-specific types. */
#define GRUB_PC_PARTITION_NETBSD_TYPE_ADOS 14
#define GRUB_PC_PARTITION_NETBSD_TYPE_HFS 15
#define GRUB_PC_PARTITION_NETBSD_TYPE_FILECORE 16
#define GRUB_PC_PARTITION_NETBSD_TYPE_EXT2FS 17
#define GRUB_PC_PARTITION_NETBSD_TYPE_NTFS 18
#define GRUB_PC_PARTITION_NETBSD_TYPE_RAID 19
#define GRUB_PC_PARTITION_NETBSD_TYPE_CCD 20
#define GRUB_PC_PARTITION_NETBSD_TYPE_JFS2 21
#define GRUB_PC_PARTITION_NETBSD_TYPE_APPLEUFS 22
/* OpenBSD-specific types. */
#define GRUB_PC_PARTITION_OPENBSD_TYPE_ADOS 14
#define GRUB_PC_PARTITION_OPENBSD_TYPE_HFS 15
#define GRUB_PC_PARTITION_OPENBSD_TYPE_FILECORE 16
#define GRUB_PC_PARTITION_OPENBSD_TYPE_EXT2FS 17
#define GRUB_PC_PARTITION_OPENBSD_TYPE_NTFS 18
#define GRUB_PC_PARTITION_OPENBSD_TYPE_RAID 19
/* The BSD partition entry. */
struct grub_msdos_partition_bsd_entry
{
grub_uint32_t size;
grub_uint32_t offset;
grub_uint32_t fragment_size;
grub_uint8_t fs_type;
grub_uint8_t fs_fragments;
grub_uint16_t fs_cylinders;
} __attribute__ ((packed));
/* The BSD disk label. Only define members useful for GRUB. */
struct grub_msdos_partition_disk_label
{
grub_uint32_t magic;
grub_uint8_t padding[128];
grub_uint32_t magic2;
grub_uint16_t checksum;
grub_uint16_t num_partitions;
grub_uint32_t boot_size;
grub_uint32_t superblock_size;
struct grub_msdos_partition_bsd_entry entries[GRUB_PC_PARTITION_BSD_MAX_ENTRIES];
} __attribute__ ((packed));
/* The partition entry. */
struct grub_msdos_partition_entry
{
@ -168,23 +99,6 @@ struct grub_msdos_partition_mbr
} __attribute__ ((packed));
struct grub_msdos_partition
{
/* The DOS partition number. */
int dos_part;
/* The BSD partition number (a == 0). */
int bsd_part;
/* The DOS partition type. */
int dos_type;
/* The BSD partition type. */
int bsd_type;
/* The offset of the extended partition. */
unsigned long ext_offset;
};
static inline int
grub_msdos_partition_is_empty (int type)
@ -200,12 +114,4 @@ grub_msdos_partition_is_extended (int type)
|| type == GRUB_PC_PARTITION_TYPE_LINUX_EXTENDED);
}
static inline int
grub_msdos_partition_is_bsd (int type)
{
return (type == GRUB_PC_PARTITION_TYPE_FREEBSD
|| type == GRUB_PC_PARTITION_TYPE_OPENBSD
|| type == GRUB_PC_PARTITION_TYPE_NETBSD);
}
#endif /* ! GRUB_PC_PARTITION_HEADER */

View file

@ -20,6 +20,8 @@
#ifndef GRUB_MULTIBOOT_HEADER
#define GRUB_MULTIBOOT_HEADER 1
#include <grub/file.h>
#ifdef GRUB_USE_MULTIBOOT2
#include <multiboot2.h>
/* Same thing as far as our loader is concerned. */
@ -32,19 +34,47 @@
#include <grub/types.h>
#include <grub/err.h>
extern struct grub_relocator *grub_multiboot_relocator;
void grub_multiboot (int argc, char *argv[]);
void grub_module (int argc, char *argv[]);
void grub_multiboot_set_accepts_video (int val);
grub_size_t grub_multiboot_get_mbi_size (void);
grub_err_t grub_multiboot_make_mbi (void *orig, grub_uint32_t dest,
grub_off_t buf_off, grub_size_t bufsize);
grub_err_t grub_multiboot_make_mbi (grub_uint32_t *target);
void grub_multiboot_free_mbi (void);
grub_err_t grub_multiboot_init_mbi (int argc, char *argv[]);
grub_err_t grub_multiboot_add_module (grub_addr_t start, grub_size_t size,
int argc, char *argv[]);
void grub_multiboot_set_bootdev (void);
void
grub_multiboot_add_elfsyms (grub_size_t num, grub_size_t entsize,
unsigned shndx, void *data);
grub_uint32_t grub_get_multiboot_mmap_count (void);
grub_err_t grub_multiboot_set_video_mode (void);
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
#include <grub/i386/pc/vbe.h>
#define GRUB_MACHINE_HAS_VGA_TEXT 1
#else
#define GRUB_MACHINE_HAS_VGA_TEXT 0
#endif
#define GRUB_MULTIBOOT_CONSOLE_EGA_TEXT 1
#define GRUB_MULTIBOOT_CONSOLE_FRAMEBUFFER 2
grub_err_t
grub_multiboot_set_console (int console_type, int accepted_consoles,
int width, int height, int depth,
int console_required);
grub_err_t
grub_multiboot_load (grub_file_t file);
/* Load ELF32 or ELF64. */
grub_err_t
grub_multiboot_load_elf (grub_file_t file, void *buffer);
extern grub_size_t grub_multiboot_pure_size;
extern grub_size_t grub_multiboot_alloc_mbi;
extern grub_uint32_t grub_multiboot_payload_eip;
#endif /* ! GRUB_MULTIBOOT_HEADER */

View file

@ -73,13 +73,15 @@ grub_err_t grub_normal_print_device_info (const char *name);
/* Defined in `color.c'. */
char *grub_env_write_color_normal (struct grub_env_var *var, const char *val);
char *grub_env_write_color_highlight (struct grub_env_var *var, const char *val);
void grub_parse_color_name_pair (grub_uint8_t *ret, const char *name);
int grub_parse_color_name_pair (grub_uint8_t *ret, const char *name);
/* Defined in `menu_text.c'. */
void grub_wait_after_message (void);
void grub_print_ucs4 (const grub_uint32_t * str,
const grub_uint32_t * last_position,
struct grub_term_output *term);
void
grub_print_ucs4 (const grub_uint32_t * str,
const grub_uint32_t * last_position,
int margin_left, int margin_right,
struct grub_term_output *term);
grub_ssize_t grub_getstringwidth (grub_uint32_t * str,
const grub_uint32_t * last_position,
struct grub_term_output *term);
@ -96,21 +98,23 @@ void read_handler_list (void);
void free_handler_list (void);
/* Defined in `dyncmd.c'. */
void read_command_list (void);
void read_command_list (const char *prefix);
/* Defined in `autofs.c'. */
void read_fs_list (void);
void read_fs_list (const char *prefix);
void grub_context_init (void);
void grub_context_fini (void);
void read_crypto_list (void);
void read_crypto_list (const char *prefix);
void read_terminal_list (void);
void read_terminal_list (const char *prefix);
void grub_set_more (int onoff);
int grub_normal_get_line_counter (void);
void grub_install_newline_hook (void);
int grub_normal_get_char_counter (void);
void grub_normal_reset_more (void);
void grub_xputs_normal (const char *str);
#endif /* ! GRUB_NORMAL_HEADER */

80
include/grub/ns8250.h Normal file
View file

@ -0,0 +1,80 @@
/* serial.h - serial device interface */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2000,2001,2002,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_NS8250_HEADER
#define GRUB_NS8250_HEADER 1
/* Macros. */
/* The offsets of UART registers. */
#define UART_TX 0
#define UART_RX 0
#define UART_DLL 0
#define UART_IER 1
#define UART_DLH 1
#define UART_IIR 2
#define UART_FCR 2
#define UART_LCR 3
#define UART_MCR 4
#define UART_LSR 5
#define UART_MSR 6
#define UART_SR 7
/* For LSR bits. */
#define UART_DATA_READY 0x01
#define UART_EMPTY_TRANSMITTER 0x20
/* The type of parity. */
#define UART_NO_PARITY 0x00
#define UART_ODD_PARITY 0x08
#define UART_EVEN_PARITY 0x18
/* The type of word length. */
#define UART_5BITS_WORD 0x00
#define UART_6BITS_WORD 0x01
#define UART_7BITS_WORD 0x02
#define UART_8BITS_WORD 0x03
/* The type of the length of stop bit. */
#define UART_1_STOP_BIT 0x00
#define UART_2_STOP_BITS 0x04
/* the switch of DLAB. */
#define UART_DLAB 0x80
/* Enable the FIFO. */
#define UART_ENABLE_FIFO_TRIGGER14 0xC7
/* Enable the FIFO. */
#define UART_ENABLE_FIFO_TRIGGER1 0x07
/* Turn on DTR, RTS, and OUT2. */
#define UART_ENABLE_DTRRTS 0x03
/* Turn on DTR, RTS, and OUT2. */
#define UART_ENABLE_OUT2 0x08
#ifndef ASM_FILE
#include <grub/cpu/io.h>
grub_port_t
grub_ns8250_hw_get_port (const unsigned int unit);
#endif
#endif /* ! GRUB_SERIAL_MACHINE_HEADER */

177
include/grub/offsets.h Normal file
View file

@ -0,0 +1,177 @@
/*
* 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_MULTIBOOT_PREFIX GRUB_KERNEL_I386_COREBOOT_PREFIX
#define GRUB_KERNEL_I386_MULTIBOOT_DATA_END GRUB_KERNEL_I386_COREBOOT_DATA_END
#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
#define GRUB_KERNEL_I386_MULTIBOOT_MOD_ALIGN GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN
/* 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

View file

@ -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);
grub_err_t 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 */

View file

@ -20,6 +20,7 @@
#define GRUB_PART_HEADER 1
#include <grub/dl.h>
#include <grub/list.h>
struct grub_disk;
@ -28,6 +29,9 @@ typedef struct grub_partition *grub_partition_t;
/* Partition map type. */
struct grub_partition_map
{
/* The next partition map type. */
struct grub_partition_map *next;
/* The name of the partition map type. */
const char *name;
@ -35,23 +39,16 @@ struct grub_partition_map
grub_err_t (*iterate) (struct grub_disk *disk,
int (*hook) (struct grub_disk *disk,
const grub_partition_t partition));
/* Return the partition named STR on the disk DISK. */
grub_partition_t (*probe) (struct grub_disk *disk,
const char *str);
/* Return the name of the partition PARTITION. */
char *(*get_name) (const grub_partition_t partition);
/* The next partition map type. */
struct grub_partition_map *next;
};
typedef struct grub_partition_map *grub_partition_map_t;
/* Partition description. */
struct grub_partition
{
/* The start sector. */
/* The partition number. */
int number;
/* The start sector (relative to parent). */
grub_disk_addr_t start;
/* The length in sector units. */
@ -63,8 +60,8 @@ struct grub_partition
/* The index of this partition in the partition table. */
int index;
/* Partition map type specific data. */
void *data;
/* Parent partition (physically contains this partition). */
struct grub_partition *parent;
/* The type partition map. */
grub_partition_map_t partmap;
@ -77,17 +74,38 @@ int EXPORT_FUNC(grub_partition_iterate) (struct grub_disk *disk,
const grub_partition_t partition));
char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition);
int EXPORT_FUNC(grub_partition_map_iterate) (int (*hook) (const grub_partition_map_t partmap));
void EXPORT_FUNC(grub_partition_map_register) (grub_partition_map_t partmap);
extern grub_partition_map_t EXPORT_VAR(grub_partition_map_list);
void EXPORT_FUNC(grub_partition_map_unregister) (grub_partition_map_t partmap);
#ifndef GRUB_LST_GENERATOR
static inline void
grub_partition_map_register (grub_partition_map_t partmap)
{
grub_list_push (GRUB_AS_LIST_P (&grub_partition_map_list),
GRUB_AS_LIST (partmap));
}
#endif
static inline void
grub_partition_map_unregister (grub_partition_map_t partmap)
{
grub_list_remove (GRUB_AS_LIST_P (&grub_partition_map_list),
GRUB_AS_LIST (partmap));
}
#define FOR_PARTITION_MAPS(var) FOR_LIST_ELEMENTS((var), (grub_partition_map_list))
static inline grub_disk_addr_t
grub_partition_get_start (const grub_partition_t p)
{
return p->start;
grub_partition_t part;
grub_uint64_t part_start = 0;
for (part = p; part; part = part->parent)
part_start += part->start;
return part_start;
}
static inline grub_uint64_t

View file

@ -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,9 +68,24 @@
#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
#define GRUB_PCI_CLASS_SUBCLASS_VGA 0x0300
#ifndef ASM_FILE
typedef grub_uint32_t grub_pci_id_t;
#ifdef GRUB_UTIL
#ifdef GRUB_MACHINE_EMU
#include <grub/pciutils.h>
#else
typedef grub_uint32_t grub_pci_address_t;
@ -107,4 +124,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 */

View file

@ -1,28 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2004,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_CONSOLE_MACHINE_HEADER
#define GRUB_CONSOLE_MACHINE_HEADER 1
/* Initialize the console system. */
void grub_console_init (void);
/* Finish the console system. */
void grub_console_fini (void);
#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */

View file

@ -1,32 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2004,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_LOADER_MACHINE_HEADER
#define GRUB_LOADER_MACHINE_HEADER 1
/* The symbol shared between the normal mode and rescue mode
loader. */
void grub_rescue_cmd_linux (int argc, char *argv[]);
void grub_rescue_cmd_initrd (int argc, char *argv[]);
void grub_linux_init (void);
void grub_linux_fini (void);
void grub_linux_normal_init (void);
void grub_linux_normal_fini (void);
#endif /* ! GRUB_LOADER_MACHINE_HEADER */

View file

@ -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

Some files were not shown because too many files have changed in this diff Show more