merge mainline

This commit is contained in:
Colin Watson 2010-06-12 12:17:28 +01:00
commit 934302d00b
545 changed files with 51148 additions and 23539 deletions

View file

@ -16,6 +16,38 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)exec.h 8.1 (Berkeley) 6/11/93
* $FreeBSD$
*/
#ifndef GRUB_AOUT_HEADER
#define GRUB_AOUT_HEADER 1
@ -70,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 */
@ -82,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);
#endif
#endif /* ! GRUB_AOUT_HEADER */

View file

@ -0,0 +1,54 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_AT_KEYBOARD_HEADER
#define GRUB_AT_KEYBOARD_HEADER 1
#define SHIFT_L 0x2a
#define SHIFT_R 0x36
#define CTRL 0x1d
#define ALT 0x38
#define CAPS_LOCK 0x3a
#define NUM_LOCK 0x45
#define SCROLL_LOCK 0x46
/* Used for sending commands to the controller. */
#define KEYBOARD_COMMAND_ISREADY(x) !((x) & 0x02)
#define KEYBOARD_COMMAND_READ 0x20
#define KEYBOARD_COMMAND_WRITE 0x60
#define KEYBOARD_COMMAND_REBOOT 0xfe
#define KEYBOARD_SCANCODE_SET1 0x40
#define KEYBOARD_ISMAKE(x) !((x) & 0x80)
#define KEYBOARD_ISREADY(x) ((x) & 0x01)
#define KEYBOARD_SCANCODE(x) ((x) & 0x7f)
#ifdef GRUB_MACHINE_IEEE1275
#define OLPC_UP GRUB_TERM_UP
#define OLPC_DOWN GRUB_TERM_DOWN
#define OLPC_LEFT GRUB_TERM_LEFT
#define OLPC_RIGHT GRUB_TERM_RIGHT
#else
#define OLPC_UP '\0'
#define OLPC_DOWN '\0'
#define OLPC_LEFT '\0'
#define OLPC_RIGHT '\0'
#endif
#endif

View file

@ -98,8 +98,8 @@ struct grub_ata_device
/* IO addresses on which the registers for this device can be
found. */
int ioaddress;
int ioaddress2;
grub_port_t ioaddress;
grub_port_t ioaddress2;
/* Two devices can be connected to a single cable. Use this field
to select device 0 (commonly known as "master") or device 1

View file

@ -47,24 +47,24 @@ struct grub_video_bitmap_reader
};
typedef struct grub_video_bitmap_reader *grub_video_bitmap_reader_t;
void grub_video_bitmap_reader_register (grub_video_bitmap_reader_t reader);
void grub_video_bitmap_reader_unregister (grub_video_bitmap_reader_t reader);
void EXPORT_FUNC (grub_video_bitmap_reader_register) (grub_video_bitmap_reader_t reader);
void EXPORT_FUNC (grub_video_bitmap_reader_unregister) (grub_video_bitmap_reader_t reader);
grub_err_t grub_video_bitmap_create (struct grub_video_bitmap **bitmap,
unsigned int width, unsigned int height,
enum grub_video_blit_format blit_format);
grub_err_t EXPORT_FUNC (grub_video_bitmap_create) (struct grub_video_bitmap **bitmap,
unsigned int width, unsigned int height,
enum grub_video_blit_format blit_format);
grub_err_t grub_video_bitmap_destroy (struct grub_video_bitmap *bitmap);
grub_err_t EXPORT_FUNC (grub_video_bitmap_destroy) (struct grub_video_bitmap *bitmap);
grub_err_t grub_video_bitmap_load (struct grub_video_bitmap **bitmap,
const char *filename);
grub_err_t EXPORT_FUNC (grub_video_bitmap_load) (struct grub_video_bitmap **bitmap,
const char *filename);
unsigned int grub_video_bitmap_get_width (struct grub_video_bitmap *bitmap);
unsigned int grub_video_bitmap_get_height (struct grub_video_bitmap *bitmap);
unsigned int EXPORT_FUNC (grub_video_bitmap_get_width) (struct grub_video_bitmap *bitmap);
unsigned int EXPORT_FUNC (grub_video_bitmap_get_height) (struct grub_video_bitmap *bitmap);
void grub_video_bitmap_get_mode_info (struct grub_video_bitmap *bitmap,
struct grub_video_mode_info *mode_info);
void EXPORT_FUNC (grub_video_bitmap_get_mode_info) (struct grub_video_bitmap *bitmap,
struct grub_video_mode_info *mode_info);
void *grub_video_bitmap_get_data (struct grub_video_bitmap *bitmap);
void *EXPORT_FUNC (grub_video_bitmap_get_data) (struct grub_video_bitmap *bitmap);
#endif /* ! GRUB_BITMAP_HEADER */

View file

@ -0,0 +1,49 @@
/* bitmap_scale.h - Bitmap scaling functions. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_BITMAP_SCALE_HEADER
#define GRUB_BITMAP_SCALE_HEADER 1
#include <grub/err.h>
#include <grub/types.h>
#include <grub/bitmap_scale.h>
enum grub_video_bitmap_scale_method
{
/* Choose the fastest interpolation algorithm. */
GRUB_VIDEO_BITMAP_SCALE_METHOD_FASTEST,
/* Choose the highest quality interpolation algorithm. */
GRUB_VIDEO_BITMAP_SCALE_METHOD_BEST,
/* Specific algorithms: */
/* Nearest neighbor interpolation. */
GRUB_VIDEO_BITMAP_SCALE_METHOD_NEAREST,
/* Bilinear interpolation. */
GRUB_VIDEO_BITMAP_SCALE_METHOD_BILINEAR
};
grub_err_t
EXPORT_FUNC (grub_video_bitmap_create_scaled) (struct grub_video_bitmap **dst,
int dst_width, int dst_height,
struct grub_video_bitmap *src,
enum
grub_video_bitmap_scale_method
scale_method);
#endif /* ! GRUB_BITMAP_SCALE_HEADER */

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

@ -0,0 +1,89 @@
/*
* 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
/* 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

@ -22,7 +22,7 @@
#include <grub/file.h>
grub_file_t grub_bufio_open (grub_file_t io, int size);
grub_file_t grub_buffile_open (const char *name, int size);
grub_file_t EXPORT_FUNC (grub_bufio_open) (grub_file_t io, int size);
grub_file_t EXPORT_FUNC (grub_buffile_open) (const char *name, int size);
#endif /* ! GRUB_BUFIO_H */

View file

@ -23,6 +23,14 @@
#include <grub/symbol.h>
#include <grub/types.h>
#if defined (__i386__) || defined (__x86_64__)
static inline void
grub_arch_sync_caches (void *address __attribute__ ((unused)),
grub_size_t len __attribute__ ((unused)))
{
}
#else
void EXPORT_FUNC(grub_arch_sync_caches) (void *address, grub_size_t len);
#endif
#endif /* ! GRUB_CACHE_HEADER */

72
include/grub/cmos.h Normal file
View file

@ -0,0 +1,72 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_CMOS_H
#define GRUB_CMOS_H 1
#include <grub/types.h>
#include <grub/cpu/io.h>
#include <grub/cpu/cmos.h>
#define GRUB_CMOS_INDEX_SECOND 0
#define GRUB_CMOS_INDEX_SECOND_ALARM 1
#define GRUB_CMOS_INDEX_MINUTE 2
#define GRUB_CMOS_INDEX_MINUTE_ALARM 3
#define GRUB_CMOS_INDEX_HOUR 4
#define GRUB_CMOS_INDEX_HOUR_ALARM 5
#define GRUB_CMOS_INDEX_DAY_OF_WEEK 6
#define GRUB_CMOS_INDEX_DAY_OF_MONTH 7
#define GRUB_CMOS_INDEX_MONTH 8
#define GRUB_CMOS_INDEX_YEAR 9
#define GRUB_CMOS_INDEX_STATUS_A 0xA
#define GRUB_CMOS_INDEX_STATUS_B 0xB
#define GRUB_CMOS_INDEX_STATUS_C 0xC
#define GRUB_CMOS_INDEX_STATUS_D 0xD
#define GRUB_CMOS_STATUS_B_DAYLIGHT 1
#define GRUB_CMOS_STATUS_B_24HOUR 2
#define GRUB_CMOS_STATUS_B_BINARY 4
static inline grub_uint8_t
grub_bcd_to_num (grub_uint8_t a)
{
return ((a >> 4) * 10 + (a & 0xF));
}
static inline grub_uint8_t
grub_num_to_bcd (grub_uint8_t a)
{
return (((a / 10) << 4) + (a % 10));
}
static inline grub_uint8_t
grub_cmos_read (grub_uint8_t index)
{
grub_outb (index, GRUB_CMOS_ADDR_REG);
return grub_inb (GRUB_CMOS_DATA_REG);
}
static inline void
grub_cmos_write (grub_uint8_t index, grub_uint8_t value)
{
grub_outb (index, GRUB_CMOS_ADDR_REG);
grub_outb (value, GRUB_CMOS_DATA_REG);
}
#endif /* GRUB_CMOS_H */

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

@ -82,6 +82,7 @@ struct grub_dl
Elf_Sym *symtab;
void (*init) (struct grub_dl *mod);
void (*fini) (void);
struct grub_dl *next;
};
typedef struct grub_dl *grub_dl_t;
@ -91,29 +92,27 @@ 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;
}
#if defined (GRUB_UTIL) || defined (GRUB_TARGET_NO_MODULES)
#define GRUB_NO_MODULES 1
#else
#define GRUB_NO_MODULES 0
#endif
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 EXPORT_FUNC(grub_dl_register_symbol) (const char *name, void *addr,
grub_dl_t mod);
grub_err_t grub_dl_register_symbol (const char *name, void *addr,
grub_dl_t mod);
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) && ! GRUB_NO_MODULES
#define GRUB_LINKER_HAVE_INIT 1
void grub_arch_dl_init_linker (void);
#endif
#endif /* ! GRUB_DL_H */

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

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

@ -46,12 +46,12 @@ grub_elf_t grub_elf_file (grub_file_t);
grub_err_t grub_elf_close (grub_elf_t);
int grub_elf_is_elf32 (grub_elf_t);
grub_size_t grub_elf32_size (grub_elf_t);
grub_size_t grub_elf32_size (grub_elf_t, Elf32_Addr *);
grub_err_t grub_elf32_load (grub_elf_t, grub_elf32_load_hook_t, grub_addr_t *,
grub_size_t *);
int grub_elf_is_elf64 (grub_elf_t);
grub_size_t grub_elf64_size (grub_elf_t);
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 *);

View file

@ -26,7 +26,6 @@ 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);
const char *grub_util_check_block_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 */

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

@ -0,0 +1,55 @@
#ifndef GRUB_EMU_MISC_H
#define GRUB_EMU_MISC_H 1
#include <grub/symbol.h>
#include <grub/types.h>
#ifdef __CYGWIN__
# include <sys/fcntl.h>
# include <sys/cygwin.h>
# include <limits.h>
# define DEV_CYGDRIVE_MAJOR 98
#endif
#ifdef __NetBSD__
/* NetBSD uses /boot for its boot block. */
# define DEFAULT_DIRECTORY "/grub"
#else
# define DEFAULT_DIRECTORY "/boot/grub"
#endif
#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
extern int verbosity;
extern const char *program_name;
void grub_init_all (void);
void grub_fini_all (void);
char *grub_make_system_path_relative_to_its_root (const char *path);
void * EXPORT_FUNC(xmalloc) (grub_size_t size);
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size);
char * EXPORT_FUNC(xstrdup) (const char *str);
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...);
void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...);
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...);
void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((noreturn));
#ifndef HAVE_VASPRINTF
int EXPORT_FUNC(vasprintf) (char **buf, const char *fmt, va_list ap);
#endif
#ifndef HAVE_ASPRINTF
int EXPORT_FUNC(asprintf) (char **buf, const char *fmt, ...);
#endif
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...);
extern char * canonicalize_file_name (const char *path);
#ifdef HAVE_DEVICE_MAPPER
int grub_device_mapper_supported (void);
#endif
#endif /* GRUB_EMU_MISC_H */

View file

@ -22,6 +22,7 @@
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
#include <grub/menu.h>
struct grub_env_var;
@ -30,18 +31,6 @@ typedef char *(*grub_env_read_hook_t) (struct grub_env_var *var,
typedef char *(*grub_env_write_hook_t) (struct grub_env_var *var,
const char *val);
enum grub_env_var_type
{
/* The default variable type which is local in current context. */
GRUB_ENV_VAR_LOCAL,
/* The exported type, which is passed to new contexts. */
GRUB_ENV_VAR_GLOBAL,
/* The data slot type, which is used to store arbitrary data. */
GRUB_ENV_VAR_DATA
};
struct grub_env_var
{
char *name;
@ -50,23 +39,24 @@ struct grub_env_var
grub_env_write_hook_t write_hook;
struct grub_env_var *next;
struct grub_env_var **prevp;
enum grub_env_var_type type;
int global;
};
grub_err_t EXPORT_FUNC(grub_env_set) (const char *name, const char *val);
char *EXPORT_FUNC(grub_env_get) (const char *name);
void EXPORT_FUNC(grub_env_unset) (const char *name);
void EXPORT_FUNC(grub_env_iterate) (int (*func) (struct grub_env_var *var));
struct grub_env_var *EXPORT_FUNC(grub_env_find) (const char *name);
grub_err_t EXPORT_FUNC(grub_register_variable_hook) (const char *name,
grub_env_read_hook_t read_hook,
grub_env_write_hook_t write_hook);
grub_err_t EXPORT_FUNC(grub_env_context_open) (int export);
grub_err_t EXPORT_FUNC(grub_env_context_close) (void);
grub_err_t EXPORT_FUNC(grub_env_export) (const char *name);
grub_err_t EXPORT_FUNC(grub_env_set_data_slot) (const char *name,
const void *ptr);
void *EXPORT_FUNC(grub_env_get_data_slot) (const char *name);
void EXPORT_FUNC(grub_env_unset_data_slot) (const char *name);
grub_err_t grub_env_context_open (int export);
grub_err_t grub_env_context_close (void);
grub_err_t grub_env_export (const char *name);
void grub_env_unset_menu (void);
grub_menu_t grub_env_get_menu (void);
void grub_env_set_menu (grub_menu_t nmenu);
#endif /* ! GRUB_ENV_HEADER */

View file

@ -0,0 +1,46 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2005,2006,2007,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_ENV_PRIVATE_HEADER
#define GRUB_ENV_PRIVATE_HEADER 1
#include <grub/env.h>
/* The size of the hash table. */
#define HASHSZ 13
/* A hashtable for quick lookup of variables. */
struct grub_env_context
{
/* A hash table for variables. */
struct grub_env_var *vars[HASHSZ];
/* One level deeper on the stack. */
struct grub_env_context *prev;
};
/* This is used for sorting only. */
struct grub_env_sorted_var
{
struct grub_env_var *var;
struct grub_env_sorted_var *next;
};
extern struct grub_env_context *EXPORT_VAR(grub_current_context);
#endif /* ! GRUB_ENV_PRIVATE_HEADER */

View file

@ -66,7 +66,7 @@ void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_error_push) (void);
int EXPORT_FUNC(grub_error_pop) (void);
void EXPORT_FUNC(grub_print_error) (void);
int EXPORT_FUNC(grub_err_printf) (const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
int grub_err_printf (const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
#endif /* ! GRUB_ERR_HEADER */

View file

@ -21,6 +21,7 @@
#include <grub/types.h>
#include <grub/video.h>
#include <grub/file.h>
/* Forward declaration of opaque structure grub_font.
Users only pass struct grub_font pointers to the font module functions,
@ -80,36 +81,38 @@ int grub_font_load (const char *filename);
"Family Name Bold Italic 14", where Bold and Italic are optional.
If no font matches the name specified, the most recently loaded font
is returned as a fallback. */
grub_font_t grub_font_get (const char *font_name);
grub_font_t EXPORT_FUNC (grub_font_get) (const char *font_name);
const char *grub_font_get_name (grub_font_t font);
const char *EXPORT_FUNC (grub_font_get_name) (grub_font_t font);
int grub_font_get_max_char_width (grub_font_t font);
int EXPORT_FUNC (grub_font_get_max_char_width) (grub_font_t font);
int grub_font_get_max_char_height (grub_font_t font);
int EXPORT_FUNC (grub_font_get_max_char_height) (grub_font_t font);
int grub_font_get_ascent (grub_font_t font);
int EXPORT_FUNC (grub_font_get_ascent) (grub_font_t font);
int grub_font_get_descent (grub_font_t font);
int EXPORT_FUNC (grub_font_get_descent) (grub_font_t font);
int grub_font_get_leading (grub_font_t font);
int EXPORT_FUNC (grub_font_get_leading) (grub_font_t font);
int grub_font_get_height (grub_font_t font);
int EXPORT_FUNC (grub_font_get_height) (grub_font_t font);
int grub_font_get_string_width (grub_font_t font, const char *str);
int EXPORT_FUNC (grub_font_get_string_width) (grub_font_t font,
const char *str);
struct grub_font_glyph *grub_font_get_glyph (grub_font_t font,
grub_uint32_t code);
struct grub_font_glyph *EXPORT_FUNC (grub_font_get_glyph) (grub_font_t font,
grub_uint32_t code);
struct grub_font_glyph *grub_font_get_glyph_with_fallback (grub_font_t font,
grub_uint32_t code);
struct grub_font_glyph *EXPORT_FUNC (grub_font_get_glyph_with_fallback) (grub_font_t font,
grub_uint32_t code);
grub_err_t 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_glyph) (struct grub_font_glyph *glyph,
grub_video_color_t color,
int left_x, int baseline_y);
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);
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);
#endif /* ! GRUB_FONT_HEADER */

38
include/grub/fontformat.h Normal file
View file

@ -0,0 +1,38 @@
/*
* 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_FONT_FORMAT_HEADER
#define GRUB_FONT_FORMAT_HEADER 1
/* FONT_FORMAT_PFF2_MAGIC use only 4 relevants bytes and the \0. */
#define FONT_FORMAT_PFF2_MAGIC "PFF2"
#define FONT_FORMAT_SECTION_NAMES_FILE "FILE"
#define FONT_FORMAT_SECTION_NAMES_FONT_NAME "NAME"
#define FONT_FORMAT_SECTION_NAMES_POINT_SIZE "PTSZ"
#define FONT_FORMAT_SECTION_NAMES_WEIGHT "WEIG"
#define FONT_FORMAT_SECTION_NAMES_MAX_CHAR_WIDTH "MAXW"
#define FONT_FORMAT_SECTION_NAMES_MAX_CHAR_HEIGHT "MAXH"
#define FONT_FORMAT_SECTION_NAMES_ASCENT "ASCE"
#define FONT_FORMAT_SECTION_NAMES_DESCENT "DESC"
#define FONT_FORMAT_SECTION_NAMES_CHAR_INDEX "CHIX"
#define FONT_FORMAT_SECTION_NAMES_DATA "DATA"
#define FONT_FORMAT_SECTION_NAMES_FAMILY "FAMI"
#define FONT_FORMAT_SECTION_NAMES_SLAN "SLAN"
#endif /* ! GRUB_FONT_FORMAT_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,22 @@ extern struct grub_fs grub_fs_blocklist;
the linked list GRUB_FS_LIST through the function grub_fs_register. */
typedef int (*grub_fs_autoload_hook_t) (void);
extern grub_fs_autoload_hook_t EXPORT_VAR(grub_fs_autoload_hook);
extern grub_fs_t EXPORT_VAR (grub_fs_list);
static inline void
grub_fs_register (grub_fs_t fs)
{
grub_list_push (GRUB_AS_LIST_P (&grub_fs_list), GRUB_AS_LIST (fs));
}
static inline void
grub_fs_unregister (grub_fs_t fs)
{
grub_list_remove (GRUB_AS_LIST_P (&grub_fs_list), GRUB_AS_LIST (fs));
}
#define FOR_FILESYSTEMS(var) FOR_LIST_ELEMENTS((var), (grub_fs_list))
void EXPORT_FUNC(grub_fs_register) (grub_fs_t fs);
void EXPORT_FUNC(grub_fs_unregister) (grub_fs_t fs);
void EXPORT_FUNC(grub_fs_iterate) (int (*hook) (const grub_fs_t fs));
grub_fs_t EXPORT_FUNC(grub_fs_probe) (grub_device_t device);
#endif /* ! GRUB_FS_HEADER */

View file

@ -0,0 +1 @@

107
include/grub/gfxmenu_view.h Normal file
View file

@ -0,0 +1,107 @@
/* gfxmenu_view.h - gfxmenu view interface. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_GFXMENU_VIEW_HEADER
#define GRUB_GFXMENU_VIEW_HEADER 1
#include <grub/types.h>
#include <grub/err.h>
#include <grub/menu.h>
#include <grub/font.h>
#include <grub/gfxwidgets.h>
struct grub_gfxmenu_view; /* Forward declaration of opaque type. */
typedef struct grub_gfxmenu_view *grub_gfxmenu_view_t;
grub_gfxmenu_view_t grub_gfxmenu_view_new (const char *theme_path,
int width, int height);
void grub_gfxmenu_view_destroy (grub_gfxmenu_view_t view);
/* Set properties on the view based on settings from the specified
theme file. */
grub_err_t grub_gfxmenu_view_load_theme (grub_gfxmenu_view_t view,
const char *theme_path);
grub_err_t grub_gui_recreate_box (grub_gfxmenu_box_t *boxptr,
const char *pattern, const char *theme_dir);
void grub_gfxmenu_view_draw (grub_gfxmenu_view_t view);
void
grub_gfxmenu_redraw_menu (grub_gfxmenu_view_t view);
void
grub_gfxmenu_redraw_timeout (grub_gfxmenu_view_t view);
void
grub_gfxmenu_view_redraw (grub_gfxmenu_view_t view,
const grub_video_rect_t *region);
void
grub_gfxmenu_clear_timeout (void *data);
void
grub_gfxmenu_print_timeout (int timeout, void *data);
void
grub_gfxmenu_set_chosen_entry (int entry, void *data);
/* Implementation details -- this should not be used outside of the
view itself. */
#include <grub/video.h>
#include <grub/bitmap.h>
#include <grub/gui.h>
#include <grub/gfxwidgets.h>
#include <grub/icon_manager.h>
/* Definition of the private representation of the view. */
struct grub_gfxmenu_view
{
grub_video_rect_t screen;
grub_font_t title_font;
grub_font_t message_font;
char *terminal_font_name;
grub_gui_color_t title_color;
grub_gui_color_t message_color;
grub_gui_color_t message_bg_color;
struct grub_video_bitmap *desktop_image;
grub_gui_color_t desktop_color;
grub_gfxmenu_box_t terminal_box;
char *title_text;
char *progress_message_text;
char *theme_path;
grub_gui_container_t canvas;
int double_repaint;
int selected;
grub_video_rect_t progress_message_frame;
grub_menu_t menu;
int nested;
int first_timeout;
};
#endif /* ! GRUB_GFXMENU_VIEW_HEADER */

44
include/grub/gfxterm.h Normal file
View file

@ -0,0 +1,44 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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_GFXTERM_HEADER
#define GRUB_GFXTERM_HEADER 1
#include <grub/err.h>
#include <grub/types.h>
#include <grub/term.h>
#include <grub/video.h>
grub_err_t
EXPORT_FUNC (grub_gfxterm_set_window) (struct grub_video_render_target *target,
int x, int y, int width, int height,
int double_repaint,
const char *font_name, int border_width);
typedef void (*grub_gfxterm_repaint_callback_t)(int x, int y,
int width, int height);
void grub_gfxterm_set_repaint_callback (grub_gfxterm_repaint_callback_t func);
void EXPORT_FUNC (grub_gfxterm_schedule_repaint) (void);
grub_err_t EXPORT_FUNC (grub_gfxterm_fullscreen) (void);
extern void (*EXPORT_VAR (grub_gfxterm_decorator_hook)) (void);
#endif /* ! GRUB_GFXTERM_HEADER */

49
include/grub/gfxwidgets.h Normal file
View file

@ -0,0 +1,49 @@
/* gfxwidgets.h - Widgets for the graphical menu (gfxmenu). */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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_GFXWIDGETS_HEADER
#define GRUB_GFXWIDGETS_HEADER 1
#include <grub/video.h>
typedef struct grub_gfxmenu_box *grub_gfxmenu_box_t;
struct grub_gfxmenu_box
{
/* The size of the content. */
int content_width;
int content_height;
struct grub_video_bitmap **raw_pixmaps;
struct grub_video_bitmap **scaled_pixmaps;
void (*draw) (grub_gfxmenu_box_t self, int x, int y);
void (*set_content_size) (grub_gfxmenu_box_t self,
int width, int height);
int (*get_left_pad) (grub_gfxmenu_box_t self);
int (*get_top_pad) (grub_gfxmenu_box_t self);
int (*get_right_pad) (grub_gfxmenu_box_t self);
int (*get_bottom_pad) (grub_gfxmenu_box_t self);
void (*destroy) (grub_gfxmenu_box_t self);
};
grub_gfxmenu_box_t grub_gfxmenu_create_box (const char *pixmaps_prefix,
const char *pixmaps_suffix);
#endif /* ! GRUB_GFXWIDGETS_HEADER */

275
include/grub/gui.h Normal file
View file

@ -0,0 +1,275 @@
/* gui.h - GUI components header file. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/types.h>
#include <grub/err.h>
#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
{
grub_uint8_t red;
grub_uint8_t green;
grub_uint8_t blue;
grub_uint8_t alpha;
} grub_gui_color_t;
typedef struct grub_gui_component *grub_gui_component_t;
typedef struct grub_gui_container *grub_gui_container_t;
typedef struct grub_gui_list *grub_gui_list_t;
typedef void (*grub_gui_component_callback) (grub_gui_component_t component,
void *userdata);
/* Component interface. */
struct grub_gui_component_ops
{
void (*destroy) (void *self);
const char * (*get_id) (void *self);
int (*is_instance) (void *self, const char *type);
void (*paint) (void *self, const grub_video_rect_t *bounds);
void (*set_parent) (void *self, grub_gui_container_t parent);
grub_gui_container_t (*get_parent) (void *self);
void (*set_bounds) (void *self, const grub_video_rect_t *bounds);
void (*get_bounds) (void *self, grub_video_rect_t *bounds);
void (*get_minimal_size) (void *self, unsigned *width, unsigned *height);
grub_err_t (*set_property) (void *self, const char *name, const char *value);
void (*repaint) (void *self, int second_pass);
};
struct grub_gui_container_ops
{
void (*add) (void *self, grub_gui_component_t comp);
void (*remove) (void *self, grub_gui_component_t comp);
void (*iterate_children) (void *self,
grub_gui_component_callback cb, void *userdata);
};
struct grub_gui_list_ops
{
void (*set_view_info) (void *self,
grub_gfxmenu_view_t view);
};
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
static inline signed
grub_fixed_sfs_divide (signed a, grub_fixed_signed_t b)
{
return (a * GRUB_FIXED_1) / b;
}
static inline grub_fixed_signed_t
grub_fixed_fsf_divide (grub_fixed_signed_t a, signed b)
{
return a / b;
}
static inline signed
grub_fixed_sfs_multiply (signed a, grub_fixed_signed_t b)
{
return (a * b) / GRUB_FIXED_1;
}
static inline signed
grub_fixed_to_signed (grub_fixed_signed_t in)
{
return in / GRUB_FIXED_1;
}
static inline grub_fixed_signed_t
grub_signed_to_fixed (signed in)
{
return in * GRUB_FIXED_1;
}
struct grub_gui_component
{
struct grub_gui_component_ops *ops;
signed x;
grub_fixed_signed_t xfrac;
signed y;
grub_fixed_signed_t yfrac;
signed w;
grub_fixed_signed_t wfrac;
signed h;
grub_fixed_signed_t hfrac;
};
struct grub_gui_progress
{
struct grub_gui_component component;
struct grub_gui_progress_ops *ops;
};
struct grub_gui_container
{
struct grub_gui_component component;
struct grub_gui_container_ops *ops;
};
struct grub_gui_list
{
struct grub_gui_component component;
struct grub_gui_list_ops *ops;
};
/* Interfaces to concrete component classes. */
grub_gui_container_t grub_gui_canvas_new (void);
grub_gui_container_t grub_gui_vbox_new (void);
grub_gui_container_t grub_gui_hbox_new (void);
grub_gui_component_t grub_gui_label_new (void);
grub_gui_component_t grub_gui_image_new (void);
grub_gui_component_t grub_gui_progress_bar_new (void);
grub_gui_component_t grub_gui_list_new (void);
grub_gui_component_t grub_gui_circular_progress_new (void);
/* Manipulation functions. */
/* Visit all components with the specified ID. */
void grub_gui_find_by_id (grub_gui_component_t root,
const char *id,
grub_gui_component_callback cb,
void *userdata);
/* Visit all components. */
void grub_gui_iterate_recursively (grub_gui_component_t root,
grub_gui_component_callback cb,
void *userdata);
/* Helper functions. */
static __inline void
grub_gui_save_viewport (grub_video_rect_t *r)
{
grub_video_get_viewport ((unsigned *) &r->x,
(unsigned *) &r->y,
(unsigned *) &r->width,
(unsigned *) &r->height);
}
static __inline void
grub_gui_restore_viewport (const grub_video_rect_t *r)
{
grub_video_set_viewport (r->x, r->y, r->width, r->height);
}
/* Set a new viewport relative the the current one, saving the current
viewport in OLD so it can be later restored. */
static __inline void
grub_gui_set_viewport (const grub_video_rect_t *r, grub_video_rect_t *old)
{
grub_gui_save_viewport (old);
grub_video_set_viewport (old->x + r->x,
old->y + r->y,
r->width,
r->height);
}
static __inline grub_gui_color_t
grub_gui_color_rgb (int r, int g, int b)
{
grub_gui_color_t c;
c.red = r;
c.green = g;
c.blue = b;
c.alpha = 255;
return c;
}
static __inline grub_video_color_t
grub_gui_map_color (grub_gui_color_t c)
{
return grub_video_map_rgba (c.red, c.green, c.blue, c.alpha);
}
static inline int
grub_video_have_common_points (const grub_video_rect_t *a,
const grub_video_rect_t *b)
{
if (!((a->x <= b->x && b->x <= a->x + a->width)
|| (b->x <= a->x && a->x <= b->x + b->width)))
return 0;
if (!((a->y <= b->y && b->y <= a->y + a->height)
|| (b->y <= a->y && a->y <= b->y + b->height)))
return 0;
return 1;
}
#endif /* ! GRUB_GUI_H */

View file

@ -0,0 +1,37 @@
/* gui_string_util.h - String utilities for the graphical menu interface. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_GUI_STRING_UTIL_HEADER
#define GRUB_GUI_STRING_UTIL_HEADER 1
#include <grub/types.h>
#include <grub/gui.h>
char *grub_new_substring (const char *buf,
grub_size_t start, grub_size_t end);
char *grub_resolve_relative_path (const char *base, const char *path);
char *grub_get_dirname (const char *file_path);
int grub_gui_get_named_color (const char *name, grub_gui_color_t *color);
grub_err_t grub_gui_parse_color (const char *s, grub_gui_color_t *color);
#endif /* GRUB_GUI_STRING_UTIL_HEADER */

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,11 +22,10 @@
#include <config.h>
#include <grub/symbol.h>
const char *EXPORT_FUNC(grub_gettext_dummy) (const char *s);
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
@ -35,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

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

View file

@ -20,6 +20,13 @@
#define GRUB_BSD_CPU_HEADER 1
#include <grub/types.h>
#include <grub/i386/freebsd_reboot.h>
#include <grub/i386/netbsd_reboot.h>
#include <grub/i386/openbsd_reboot.h>
#include <grub/i386/freebsd_linker.h>
#include <grub/i386/netbsd_bootinfo.h>
#include <grub/i386/openbsd_bootarg.h>
enum bsd_kernel_types
{
@ -31,61 +38,11 @@ enum bsd_kernel_types
#define GRUB_BSD_TEMP_BUFFER 0x80000
#define FREEBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define FREEBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define FREEBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define FREEBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define FREEBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define FREEBSD_RB_DFLTROOT (1 << 5) /* use compiled-in rootdev */
#define FREEBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define FREEBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define FREEBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define FREEBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define FREEBSD_RB_CONFIG (1 << 10) /* invoke user configuration routing */
#define FREEBSD_RB_VERBOSE (1 << 11) /* print all potentially useful info */
#define FREEBSD_RB_SERIAL (1 << 12) /* user serial port as console */
#define FREEBSD_RB_CDROM (1 << 13) /* use cdrom as root */
#define FREEBSD_RB_GDB (1 << 15) /* use GDB remote debugger instead of DDB */
#define FREEBSD_RB_MUTE (1 << 16) /* Come up with the console muted */
#define FREEBSD_RB_PAUSE (1 << 20)
#define FREEBSD_RB_QUIET (1 << 21)
#define FREEBSD_RB_NOINTR (1 << 28)
#define FREENSD_RB_MULTIPLE (1 << 29) /* Use multiple consoles */
#define FREEBSD_RB_DUAL FREENSD_RB_MULTIPLE
#define FREEBSD_RB_BOOTINFO (1 << 31) /* have `struct bootinfo *' arg */
#define FREEBSD_B_DEVMAGIC 0xa0000000
#define FREEBSD_B_SLICESHIFT 20
#define FREEBSD_B_UNITSHIFT 16
#define FREEBSD_B_PARTSHIFT 8
#define FREEBSD_B_TYPESHIFT 0
#define FREEBSD_BOOTINFO_VERSION 1
#define FREEBSD_N_BIOS_GEOM 8
#define FREEBSD_MODINFO_END 0x0000 /* End of list */
#define FREEBSD_MODINFO_NAME 0x0001 /* Name of module (string) */
#define FREEBSD_MODINFO_TYPE 0x0002 /* Type of module (string) */
#define FREEBSD_MODINFO_ADDR 0x0003 /* Loaded address */
#define FREEBSD_MODINFO_SIZE 0x0004 /* Size of module */
#define FREEBSD_MODINFO_EMPTY 0x0005 /* Has been deleted */
#define FREEBSD_MODINFO_ARGS 0x0006 /* Parameters string */
#define FREEBSD_MODINFO_METADATA 0x8000 /* Module-specfic */
#define FREEBSD_MODINFOMD_AOUTEXEC 0x0001 /* a.out exec header */
#define FREEBSD_MODINFOMD_ELFHDR 0x0002 /* ELF header */
#define FREEBSD_MODINFOMD_SSYM 0x0003 /* start of symbols */
#define FREEBSD_MODINFOMD_ESYM 0x0004 /* end of symbols */
#define FREEBSD_MODINFOMD_DYNAMIC 0x0005 /* _DYNAMIC pointer */
#define FREEBSD_MODINFOMD_ENVP 0x0006 /* envp[] */
#define FREEBSD_MODINFOMD_HOWTO 0x0007 /* boothowto */
#define FREEBSD_MODINFOMD_KERNEND 0x0008 /* kernend */
#define FREEBSD_MODINFOMD_SHDR 0x0009 /* section header table */
#define FREEBSD_MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */
#define FREEBSD_MODINFOMD_SMAP 0x1001
#define FREEBSD_MODINFOMD_DEPLIST (0x4001 | FREEBSD_MODINFOMD_NOCOPY) /* depends on */
#define FREEBSD_B_DEVMAGIC OPENBSD_B_DEVMAGIC
#define FREEBSD_B_SLICESHIFT OPENBSD_B_CTRLSHIFT
#define FREEBSD_B_UNITSHIFT OPENBSD_B_UNITSHIFT
#define FREEBSD_B_PARTSHIFT OPENBSD_B_PARTSHIFT
#define FREEBSD_B_TYPESHIFT OPENBSD_B_TYPESHIFT
#define FREEBSD_MODTYPE_KERNEL "elf kernel"
#define FREEBSD_MODTYPE_KERNEL64 "elf64 kernel"
@ -93,64 +50,21 @@ enum bsd_kernel_types
#define FREEBSD_MODTYPE_ELF_MODULE_OBJ "elf obj module"
#define FREEBSD_MODTYPE_RAW "raw"
#define FREEBSD_BOOTINFO_VERSION 1
struct grub_freebsd_bootinfo
{
grub_uint32_t bi_version;
grub_uint8_t *bi_kernelname;
struct nfs_diskless *bi_nfs_diskless;
grub_uint32_t bi_n_bios_used;
grub_uint32_t bi_bios_geom[FREEBSD_N_BIOS_GEOM];
grub_uint32_t bi_size;
grub_uint8_t bi_memsizes_valid;
grub_uint8_t bi_bios_dev;
grub_uint8_t bi_pad[2];
grub_uint32_t bi_basemem;
grub_uint32_t bi_extmem;
grub_uint32_t bi_symtab;
grub_uint32_t bi_esymtab;
grub_uint32_t bi_kernend;
grub_uint32_t bi_envp;
grub_uint32_t bi_modulep;
grub_uint32_t version;
grub_uint8_t unused1[44];
grub_uint32_t length;
grub_uint8_t unused2;
grub_uint8_t boot_device;
grub_uint8_t unused3[18];
grub_uint32_t kern_end;
grub_uint32_t environment;
grub_uint32_t tags;
} __attribute__ ((packed));
#define OPENBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define OPENBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define OPENBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define OPENBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define OPENBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define OPENBSD_RB_DFLTROOT (1 << 5) /* use compiled-in rootdev */
#define OPENBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define OPENBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define OPENBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define OPENBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define OPENBSD_RB_CONFIG (1 << 10) /* change configured devices */
#define OPENBSD_RB_TIMEBAD (1 << 11) /* don't call resettodr() in boot() */
#define OPENBSD_RB_POWERDOWN (1 << 12) /* attempt to power down machine */
#define OPENBSD_RB_SERCONS (1 << 13) /* use serial console if available */
#define OPENBSD_RB_USERREQ (1 << 14) /* boot() called at user request (e.g. ddb) */
#define OPENBSD_B_DEVMAGIC 0xa0000000
#define OPENBSD_B_ADAPTORSHIFT 24
#define OPENBSD_B_CTRLSHIFT 20
#define OPENBSD_B_UNITSHIFT 16
#define OPENBSD_B_PARTSHIFT 8
#define OPENBSD_B_TYPESHIFT 0
#define OPENBSD_BOOTARG_APIVER (OPENBSD_BAPIV_VECTOR | \
OPENBSD_BAPIV_ENV | \
OPENBSD_BAPIV_BMEMMAP)
#define OPENBSD_BAPIV_ANCIENT 0x0 /* MD old i386 bootblocks */
#define OPENBSD_BAPIV_VARS 0x1 /* MD structure w/ add info passed */
#define OPENBSD_BAPIV_VECTOR 0x2 /* MI vector of MD structures passed */
#define OPENBSD_BAPIV_ENV 0x4 /* MI environment vars vector */
#define OPENBSD_BAPIV_BMEMMAP 0x8 /* MI memory map passed is in bytes */
#define OPENBSD_BOOTARG_ENV 0x1000
#define OPENBSD_BOOTARG_END -1
#define OPENBSD_BOOTARG_MMAP 0
struct grub_openbsd_bios_mmap
{
grub_uint64_t addr;
@ -162,97 +76,6 @@ struct grub_openbsd_bios_mmap
grub_uint32_t type;
};
struct grub_openbsd_bootargs
{
int ba_type;
int ba_size;
struct grub_openbsd_bootargs *ba_next;
} __attribute__ ((packed));
#define NETBSD_RB_AUTOBOOT 0 /* flags for system auto-booting itself */
#define NETBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define NETBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define NETBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define NETBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define NETBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define NETBSD_RB_UNUSED1 (1 << 5) /* was RB_DFLTROOT, obsolete */
#define NETBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define NETBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define NETBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define NETBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define NETBSD_RB_STRING (1 << 10) /* use provided bootstr */
#define NETBSD_RB_POWERDOWN ((1 << 11) | RB_HALT) /* turn power off (or at least halt) */
#define NETBSD_RB_USERCONFIG (1 << 12) /* change configured devices */
#define NETBSD_AB_NORMAL 0 /* boot normally (default) */
#define NETBSD_AB_QUIET (1 << 16) /* boot quietly */
#define NETBSD_AB_VERBOSE (1 << 17) /* boot verbosely */
#define NETBSD_AB_SILENT (1 << 18) /* boot silently */
#define NETBSD_AB_DEBUG (1 << 19) /* boot with debug messages */
#define NETBSD_AB_NOSMP (1 << 28) /* Boot without SMP support. */
#define NETBSD_AB_NOACPI (1 << 29) /* Boot without ACPI support. */
struct grub_netbsd_bootinfo
{
grub_uint32_t bi_count;
void *bi_data[1];
};
#define NETBSD_BTINFO_BOOTPATH 0
#define NETBSD_BTINFO_ROOTDEVICE 1
#define NETBSD_BTINFO_BOOTDISK 3
#define NETBSD_BTINFO_MEMMAP 9
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 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];
};
struct grub_netbsd_btinfo_bootdisk
{
struct grub_netbsd_btinfo_common common;
int labelsector; /* label valid if != -1 */
struct
{
grub_uint16_t type, checksum;
char packname[16];
} label;
int biosdev;
int partition;
};
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,

View file

@ -20,55 +20,9 @@
#define GRUB_CPU_CMOS_H 1
#include <grub/types.h>
#include <grub/i386/io.h>
#include <grub/cpu/io.h>
#define GRUB_CMOS_ADDR_REG 0x70
#define GRUB_CMOS_DATA_REG 0x71
#define GRUB_CMOS_INDEX_SECOND 0
#define GRUB_CMOS_INDEX_SECOND_ALARM 1
#define GRUB_CMOS_INDEX_MINUTE 2
#define GRUB_CMOS_INDEX_MINUTE_ALARM 3
#define GRUB_CMOS_INDEX_HOUR 4
#define GRUB_CMOS_INDEX_HOUR_ALARM 5
#define GRUB_CMOS_INDEX_DAY_OF_WEEK 6
#define GRUB_CMOS_INDEX_DAY_OF_MONTH 7
#define GRUB_CMOS_INDEX_MONTH 8
#define GRUB_CMOS_INDEX_YEAR 9
#define GRUB_CMOS_INDEX_STATUS_A 0xA
#define GRUB_CMOS_INDEX_STATUS_B 0xB
#define GRUB_CMOS_INDEX_STATUS_C 0xC
#define GRUB_CMOS_INDEX_STATUS_D 0xD
#define GRUB_CMOS_STATUS_B_DAYLIGHT 1
#define GRUB_CMOS_STATUS_B_24HOUR 2
#define GRUB_CMOS_STATUS_B_BINARY 4
static inline grub_uint8_t
grub_bcd_to_num (grub_uint8_t a)
{
return ((a >> 4) * 10 + (a & 0xF));
}
static inline grub_uint8_t
grub_num_to_bcd (grub_uint8_t a)
{
return (((a / 10) << 4) + (a % 10));
}
static inline grub_uint8_t
grub_cmos_read (grub_uint8_t index)
{
grub_outb (index, GRUB_CMOS_ADDR_REG);
return grub_inb (GRUB_CMOS_DATA_REG);
}
static inline void
grub_cmos_write (grub_uint8_t index, grub_uint8_t value)
{
grub_outb (index, GRUB_CMOS_ADDR_REG);
grub_outb (value, GRUB_CMOS_DATA_REG);
}
#endif /* GRUB_CPU_CMOS_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 +1,24 @@
#include <grub/i386/pc/serial.h>
/*
* 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_MACHINE_SERIAL_HEADER
#define GRUB_MACHINE_SERIAL_HEADER 1
#define GRUB_MACHINE_SERIAL_PORTS { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }
#endif

View file

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

View file

@ -0,0 +1,74 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/*-
* Copyright (c) 1997-2000 Doug Rabson
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: stable/8/sys/sys/linker.h 199583 2009-11-20 15:27:52Z jhb $
*/
#ifndef GRUB_FREEBSD_LINKER_CPU_HEADER
#define GRUB_FREEBSD_LINKER_CPU_HEADER 1
#define FREEBSD_MODINFO_END 0x0000 /* End of list */
#define FREEBSD_MODINFO_NAME 0x0001 /* Name of module (string) */
#define FREEBSD_MODINFO_TYPE 0x0002 /* Type of module (string) */
#define FREEBSD_MODINFO_ADDR 0x0003 /* Loaded address */
#define FREEBSD_MODINFO_SIZE 0x0004 /* Size of module */
#define FREEBSD_MODINFO_EMPTY 0x0005 /* Has been deleted */
#define FREEBSD_MODINFO_ARGS 0x0006 /* Parameters string */
#define FREEBSD_MODINFO_METADATA 0x8000 /* Module-specfic */
#define FREEBSD_MODINFOMD_AOUTEXEC 0x0001 /* a.out exec header */
#define FREEBSD_MODINFOMD_ELFHDR 0x0002 /* ELF header */
#define FREEBSD_MODINFOMD_SSYM 0x0003 /* start of symbols */
#define FREEBSD_MODINFOMD_ESYM 0x0004 /* end of symbols */
#define FREEBSD_MODINFOMD_DYNAMIC 0x0005 /* _DYNAMIC pointer */
#define FREEBSD_MODINFOMD_ENVP 0x0006 /* envp[] */
#define FREEBSD_MODINFOMD_HOWTO 0x0007 /* boothowto */
#define FREEBSD_MODINFOMD_KERNEND 0x0008 /* kernend */
#define FREEBSD_MODINFOMD_SHDR 0x0009 /* section header table */
#define FREEBSD_MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */
#define FREEBSD_MODINFOMD_SMAP 0x1001
#define FREEBSD_MODINFOMD_DEPLIST (0x4001 | FREEBSD_MODINFOMD_NOCOPY) /* depends on */
#endif

View file

@ -0,0 +1,77 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/*-
* Copyright (c) 1982, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)reboot.h 8.3 (Berkeley) 12/13/94
* $FreeBSD: stable/8/sys/sys/reboot.h 199583 2009-11-20 15:27:52Z jhb $
*/
#ifndef GRUB_FREEBSD_REBOOT_CPU_HEADER
#define GRUB_FREEBSD_REBOOT_CPU_HEADER 1
#define FREEBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define FREEBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define FREEBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define FREEBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define FREEBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define FREEBSD_RB_DFLTROOT (1 << 5) /* use compiled-in rootdev */
#define FREEBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define FREEBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define FREEBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define FREEBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define FREEBSD_RB_CONFIG (1 << 10) /* invoke user configuration routing */
#define FREEBSD_RB_VERBOSE (1 << 11) /* print all potentially useful info */
#define FREEBSD_RB_SERIAL (1 << 12) /* user serial port as console */
#define FREEBSD_RB_CDROM (1 << 13) /* use cdrom as root */
#define FREEBSD_RB_GDB (1 << 15) /* use GDB remote debugger instead of DDB */
#define FREEBSD_RB_MUTE (1 << 16) /* Come up with the console muted */
#define FREEBSD_RB_PAUSE (1 << 20)
#define FREEBSD_RB_QUIET (1 << 21)
#define FREEBSD_RB_NOINTR (1 << 28)
#define FREENSD_RB_MULTIPLE (1 << 29) /* Use multiple consoles */
#define FREEBSD_RB_DUAL FREENSD_RB_MULTIPLE
#define FREEBSD_RB_BOOTINFO (1 << 31) /* have `struct bootinfo *' arg */
#endif

View file

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

View file

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

View file

@ -21,6 +21,8 @@
#ifndef GRUB_IO_H
#define GRUB_IO_H 1
typedef unsigned short int grub_port_t;
static __inline unsigned char
grub_inb (unsigned short int port)
{

View file

@ -79,9 +79,9 @@ struct grub_e820_mmap
grub_uint32_t type;
} __attribute__((packed));
#define GRUB_VIDEO_TYPE_TEXT 0x01
#define GRUB_VIDEO_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */
#define GRUB_VIDEO_TYPE_EFI 0x70
#define GRUB_VIDEO_LINUX_TYPE_TEXT 0x01
#define GRUB_VIDEO_LINUX_TYPE_VESA 0x23 /* VESA VGA in graphic mode. */
#define GRUB_VIDEO_LINUX_TYPE_SIMPLE 0x70 /* Linear framebuffer without any additional functions. */
/* For the Linux/i386 boot protocol version 2.03. */
struct linux_kernel_header

View file

@ -19,17 +19,23 @@
#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));
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_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
#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/init.h>

View file

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

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/loader.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

@ -0,0 +1,112 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/* $NetBSD: bootinfo.h,v 1.16 2009/08/24 02:15:46 jmcneill Exp $ */
/*
* Copyright (c) 1997
* Matthias Drochner. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRUB_NETBSD_BOOTINFO_CPU_HEADER
#define GRUB_NETBSD_BOOTINFO_CPU_HEADER 1
#include <grub/types.h>
#define NETBSD_BTINFO_BOOTPATH 0
#define NETBSD_BTINFO_ROOTDEVICE 1
#define NETBSD_BTINFO_BOOTDISK 3
#define NETBSD_BTINFO_MEMMAP 9
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 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];
};
struct grub_netbsd_btinfo_bootdisk
{
struct grub_netbsd_btinfo_common common;
int labelsector; /* label valid if != -1 */
struct
{
grub_uint16_t type, checksum;
char packname[16];
} label;
int biosdev;
int partition;
};
struct grub_netbsd_bootinfo
{
grub_uint32_t bi_count;
void *bi_data[1];
};
#endif

View file

@ -0,0 +1,81 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/* $NetBSD: reboot.h,v 1.25 2007/12/25 18:33:48 perry Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)reboot.h 8.3 (Berkeley) 12/13/94
*/
#ifndef GRUB_NETBSD_REBOOT_CPU_HEADER
#define GRUB_NETBSD_REBOOT_CPU_HEADER 1
#define NETBSD_RB_AUTOBOOT 0 /* flags for system auto-booting itself */
#define NETBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define NETBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define NETBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define NETBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define NETBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define NETBSD_RB_UNUSED1 (1 << 5) /* was RB_DFLTROOT, obsolete */
#define NETBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define NETBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define NETBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define NETBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define NETBSD_RB_STRING (1 << 10) /* use provided bootstr */
#define NETBSD_RB_POWERDOWN ((1 << 11) | RB_HALT) /* turn power off (or at least halt) */
#define NETBSD_RB_USERCONFIG (1 << 12) /* change configured devices */
#define NETBSD_AB_NORMAL 0 /* boot normally (default) */
#define NETBSD_AB_QUIET (1 << 16) /* boot quietly */
#define NETBSD_AB_VERBOSE (1 << 17) /* boot verbosely */
#define NETBSD_AB_SILENT (1 << 18) /* boot silently */
#define NETBSD_AB_DEBUG (1 << 19) /* boot with debug messages */
#define NETBSD_AB_NOSMP (1 << 28) /* Boot without SMP support. */
#define NETBSD_AB_NOACPI (1 << 29) /* Boot without ACPI support. */
#endif

View file

@ -0,0 +1,72 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/* $OpenBSD: bootarg.h,v 1.11 2003/06/02 20:20:54 mickey Exp $ */
/*
* Copyright (c) 1996-1999 Michael Shalayeff
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef GRUB_OPENBSD_BOOTARG_CPU_HEADER
#define GRUB_OPENBSD_BOOTARG_CPU_HEADER 1
#define OPENBSD_BOOTARG_APIVER (OPENBSD_BAPIV_VECTOR | \
OPENBSD_BAPIV_ENV | \
OPENBSD_BAPIV_BMEMMAP)
#define OPENBSD_BAPIV_ANCIENT 0x0 /* MD old i386 bootblocks */
#define OPENBSD_BAPIV_VARS 0x1 /* MD structure w/ add info passed */
#define OPENBSD_BAPIV_VECTOR 0x2 /* MI vector of MD structures passed */
#define OPENBSD_BAPIV_ENV 0x4 /* MI environment vars vector */
#define OPENBSD_BAPIV_BMEMMAP 0x8 /* MI memory map passed is in bytes */
#define OPENBSD_BOOTARG_ENV 0x1000
#define OPENBSD_BOOTARG_END -1
#define OPENBSD_BOOTARG_MMAP 0
struct grub_openbsd_bootargs
{
int ba_type;
int ba_size;
struct grub_openbsd_bootargs *ba_next;
} __attribute__ ((packed));
#endif

View file

@ -0,0 +1,79 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
/* $OpenBSD: reboot.h,v 1.13 2004/03/10 23:02:53 tom Exp $ */
/* $NetBSD: reboot.h,v 1.9 1996/04/22 01:23:25 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)reboot.h 8.2 (Berkeley) 7/10/94
*/
#ifndef GRUB_OPENBSD_REBOOT_CPU_HEADER
#define GRUB_OPENBSD_REBOOT_CPU_HEADER 1
#define OPENBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
#define OPENBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
#define OPENBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
#define OPENBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
#define OPENBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
#define OPENBSD_RB_DFLTROOT (1 << 5) /* use compiled-in rootdev */
#define OPENBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
#define OPENBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
#define OPENBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
#define OPENBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
#define OPENBSD_RB_CONFIG (1 << 10) /* change configured devices */
#define OPENBSD_RB_TIMEBAD (1 << 11) /* don't call resettodr() in boot() */
#define OPENBSD_RB_POWERDOWN (1 << 12) /* attempt to power down machine */
#define OPENBSD_RB_SERCONS (1 << 13) /* use serial console if available */
#define OPENBSD_RB_USERREQ (1 << 14) /* boot() called at user request (e.g. ddb) */
#define OPENBSD_B_DEVMAGIC 0xa0000000
#define OPENBSD_B_ADAPTORSHIFT 24
#define OPENBSD_B_CTRLSHIFT 20
#define OPENBSD_B_UNITSHIFT 16
#define OPENBSD_B_PARTSHIFT 8
#define OPENBSD_B_TYPESHIFT 0
#endif

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,25 +59,15 @@
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)
/* The size of a block list used in the kernel startup code. */
#define GRUB_BOOT_MACHINE_LIST_SIZE 12
#ifndef ASM_FILE
#define GRUB_BOOT_MACHINE_PXE_DL 0x7f
/* 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

@ -33,7 +33,7 @@ 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 grub_get_mmap_entry (struct grub_machine_mmap_entry *entry,
grub_uint32_t cont);
/* Turn on/off Gate A20. */

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

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

@ -19,8 +19,6 @@
#ifndef GRUB_VBE_MACHINE_HEADER
#define GRUB_VBE_MACHINE_HEADER 1
#include <grub/video_fb.h>
/* Default video mode to be used. */
#define GRUB_VBE_DEFAULT_VIDEO_MODE 0x101

View file

@ -28,7 +28,4 @@
/* 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

@ -22,8 +22,11 @@
#include <grub/types.h>
#include <grub/i386/io.h>
#define GRUB_MACHINE_PCI_IO_BASE 0
#define GRUB_PCI_ADDR_REG 0xcf8
#define GRUB_PCI_DATA_REG 0xcfc
#define GRUB_PCI_NUM_BUS 256
#define GRUB_PCI_NUM_DEVICES 32
static inline grub_uint32_t
grub_pci_read (grub_pci_address_t addr)
@ -67,17 +70,17 @@ grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
grub_outb (data, GRUB_PCI_DATA_REG + (addr & 3));
}
static inline void *
static inline volatile void *
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
grub_addr_t base,
grub_size_t size __attribute__ ((unused)))
{
return (void *) base;
return (volatile void *) base;
}
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

@ -19,17 +19,7 @@
#ifndef GRUB_KERNEL_MACHINE_HEADER
#define GRUB_KERNEL_MACHINE_HEADER 1
/* The offset of GRUB_CORE_ENTRY_ADDR. */
#define GRUB_KERNEL_MACHINE_CORE_ENTRY_ADDR 0x8
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_MACHINE_PREFIX 0x10
/* End of the data section. */
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
#include <grub/offsets.h>
#ifndef ASM_FILE
@ -44,10 +34,6 @@ extern grub_int32_t grub_kernel_image_size;
/* The total size of module images following the kernel. */
extern grub_int32_t grub_total_module_size;
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char grub_prefix[];
#endif /* ! ASM_FILE */
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */

View file

@ -0,0 +1,41 @@
/* icon_manager.h - gfxmenu icon manager. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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_ICON_MANAGER_HEADER
#define GRUB_ICON_MANAGER_HEADER 1
#include <grub/menu.h>
#include <grub/bitmap.h>
/* Forward declaration of opaque structure handle type. */
typedef struct grub_gfxmenu_icon_manager *grub_gfxmenu_icon_manager_t;
grub_gfxmenu_icon_manager_t grub_gfxmenu_icon_manager_new (void);
void grub_gfxmenu_icon_manager_destroy (grub_gfxmenu_icon_manager_t mgr);
void grub_gfxmenu_icon_manager_clear_cache (grub_gfxmenu_icon_manager_t mgr);
void grub_gfxmenu_icon_manager_set_theme_path (grub_gfxmenu_icon_manager_t mgr,
const char *path);
void grub_gfxmenu_icon_manager_set_icon_size (grub_gfxmenu_icon_manager_t mgr,
int width, int height);
struct grub_video_bitmap *
grub_gfxmenu_icon_manager_get_icon (grub_gfxmenu_icon_manager_t mgr,
grub_menu_entry_t entry);
#endif /* GRUB_ICON_MANAGER_HEADER */

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);
@ -138,7 +141,7 @@ int EXPORT_FUNC(grub_ieee1275_read) (grub_ieee1275_ihandle_t ihandle,
void *buffer, grub_size_t len,
grub_ssize_t *actualp);
int EXPORT_FUNC(grub_ieee1275_seek) (grub_ieee1275_ihandle_t ihandle,
int pos_hi, int pos_lo,
grub_disk_addr_t pos,
grub_ssize_t *result);
int EXPORT_FUNC(grub_ieee1275_peer) (grub_ieee1275_phandle_t node,
grub_ieee1275_phandle_t *result);
@ -173,7 +176,15 @@ grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
int EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size);
int
EXPORT_FUNC(grub_ieee1275_map) (grub_addr_t phys, grub_addr_t virt,
grub_size_t size, grub_uint32_t mode);
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,7 +26,8 @@ enum
{
OBJ_TYPE_ELF,
OBJ_TYPE_MEMDISK,
OBJ_TYPE_CONFIG
OBJ_TYPE_CONFIG,
OBJ_TYPE_FONT
};
/* The module header. */
@ -41,23 +42,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);
@ -73,4 +90,8 @@ void grub_machine_set_prefix (void);
/* Register all the exported symbols. This is automatically generated. */
void grub_register_exported_symbols (void);
#if ! defined (ASM_FILE) && !defined (GRUB_MACHINE_EMU)
extern char grub_prefix[];
#endif
#endif /* ! GRUB_KERNEL_HEADER */

84
include/grub/libgcc.h Normal file
View file

@ -0,0 +1,84 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2004,2007,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/>.
*/
#include <config.h>
/* 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
void EXPORT_FUNC (__ashrdi3) (void);
# 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__RESTGPR_14_X
void EXPORT_FUNC (_restgpr_14_x) (void);
void EXPORT_FUNC (_restgpr_15_x) (void);
void EXPORT_FUNC (_restgpr_16_x) (void);
void EXPORT_FUNC (_restgpr_17_x) (void);
void EXPORT_FUNC (_restgpr_18_x) (void);
void EXPORT_FUNC (_restgpr_19_x) (void);
void EXPORT_FUNC (_restgpr_20_x) (void);
void EXPORT_FUNC (_restgpr_21_x) (void);
void EXPORT_FUNC (_restgpr_22_x) (void);
void EXPORT_FUNC (_restgpr_23_x) (void);
void EXPORT_FUNC (_restgpr_24_x) (void);
void EXPORT_FUNC (_restgpr_25_x) (void);
void EXPORT_FUNC (_restgpr_26_x) (void);
void EXPORT_FUNC (_restgpr_27_x) (void);
void EXPORT_FUNC (_restgpr_28_x) (void);
void EXPORT_FUNC (_restgpr_29_x) (void);
void EXPORT_FUNC (_restgpr_30_x) (void);
void EXPORT_FUNC (_restgpr_31_x) (void);
void EXPORT_FUNC (_savegpr_14) (void);
void EXPORT_FUNC (_savegpr_15) (void);
void EXPORT_FUNC (_savegpr_16) (void);
void EXPORT_FUNC (_savegpr_17) (void);
void EXPORT_FUNC (_savegpr_18) (void);
void EXPORT_FUNC (_savegpr_19) (void);
void EXPORT_FUNC (_savegpr_20) (void);
void EXPORT_FUNC (_savegpr_21) (void);
void EXPORT_FUNC (_savegpr_22) (void);
void EXPORT_FUNC (_savegpr_23) (void);
void EXPORT_FUNC (_savegpr_24) (void);
void EXPORT_FUNC (_savegpr_25) (void);
void EXPORT_FUNC (_savegpr_26) (void);
void EXPORT_FUNC (_savegpr_27) (void);
void EXPORT_FUNC (_savegpr_28) (void);
void EXPORT_FUNC (_savegpr_29) (void);
void EXPORT_FUNC (_savegpr_30) (void);
void EXPORT_FUNC (_savegpr_31) (void);
#endif

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2004,2007,2009 Free Software Foundation, Inc.
* Copyright (C) 2010 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,20 +16,11 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#ifdef HAVE___ASHLDI3
void EXPORT_FUNC (__ashldi3) (void);
#endif
#ifdef HAVE___ASHRDI3
void EXPORT_FUNC (__ashrdi3) (void);
#endif
#ifdef HAVE___LSHRDI3
void EXPORT_FUNC (__lshrdi3) (void);
#endif
#ifdef HAVE___TRAMPOLINE_SETUP
void EXPORT_FUNC (__trampoline_setup) (void);
#endif
#ifdef HAVE___UCMPDI2
void EXPORT_FUNC (__ucmpdi2) (void);
#endif
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,2009 Free Software Foundation, Inc.
* Copyright (C) 2010 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,20 +16,14 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_KERNEL_CPU_HEADER
#define GRUB_KERNEL_CPU_HEADER 1
#ifdef GRUB_MACHINE_IEEE1275
#define GRUB_MOD_ALIGN 0x1000
#else
#define GRUB_MOD_ALIGN 0x1
#endif
/* Non-zero value is only needed for PowerMacs. */
#define GRUB_MOD_GAP 0x0
#define GRUB_KERNEL_CPU_PREFIX 0x2
#define GRUB_KERNEL_CPU_DATA_END 0x42
#endif
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;
};
@ -83,7 +85,6 @@ typedef struct grub_menu_execute_callback
}
*grub_menu_execute_callback_t;
grub_menu_entry_t grub_menu_get_entry (grub_menu_t menu, int no);
int grub_menu_get_timeout (void);
void grub_menu_set_timeout (int timeout);
@ -93,5 +94,6 @@ void grub_menu_execute_with_fallback (grub_menu_t menu,
grub_menu_execute_callback_t callback,
void *callback_data);
void grub_menu_entry_run (grub_menu_entry_t entry);
int grub_menu_get_default_entry_index (grub_menu_t menu);
#endif /* GRUB_MENU_HEADER */

View file

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

27
include/grub/mips/cache.h Normal file
View file

@ -0,0 +1,27 @@
/* cache.h - Flush the processor's cache. */
/*
* 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_CPU_CACHE_H
#define GRUB_CPU_CACHE_H 1
#include <grub/symbol.h>
#include <grub/types.h>
void EXPORT_FUNC(grub_cpu_flush_cache) (void *start, grub_size_t size, int type);
#endif

1
include/grub/mips/cmos.h Normal file
View file

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

62
include/grub/mips/io.h Normal file
View file

@ -0,0 +1,62 @@
/*
* 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_IO_H
#define GRUB_IO_H 1
#include <grub/types.h>
typedef grub_addr_t grub_port_t;
static __inline unsigned char
grub_inb (grub_port_t port)
{
return *(volatile grub_uint8_t *) port;
}
static __inline unsigned short int
grub_inw (grub_port_t port)
{
return *(volatile grub_uint16_t *) port;
}
static __inline unsigned int
grub_inl (grub_port_t port)
{
return *(volatile grub_uint32_t *) port;
}
static __inline void
grub_outb (unsigned char value, grub_port_t port)
{
*(volatile grub_uint8_t *) port = value;
}
static __inline void
grub_outw (unsigned short int value, grub_port_t port)
{
*(volatile grub_uint16_t *) port = value;
}
static __inline void
grub_outl (unsigned int value, grub_port_t port)
{
*(volatile grub_uint32_t *) port = value;
}
#endif /* _SYS_IO_H */

View file

@ -0,0 +1,36 @@
/*
* GRUB -- GRand Unified Bootloader
* 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
* 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_MULTIBOOT_CPU_HEADER
#define GRUB_MULTIBOOT_CPU_HEADER 1
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_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
#define MULTIBOOT_ELF32_MACHINE EM_MIPS
#define MULTIBOOT_ELF64_MACHINE EM_MIPS
#endif /* ! GRUB_MULTIBOOT_CPU_HEADER */

1
include/grub/mips/pci.h Normal file
View file

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

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
* Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,12 +20,12 @@
#define GRUB_KERNEL_MACHINE_HEADER 1
#include <grub/symbol.h>
#include <grub/cpu/kernel.h>
#ifndef ASM_FILE
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char grub_prefix[];
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_halt) (void);
#endif

View file

View file

@ -0,0 +1,54 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MEMORY_MACHINE_HEADER
#define GRUB_MEMORY_MACHINE_HEADER 1
#ifndef ASM_FILE
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
#endif
#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x80f00000
#define GRUB_MACHINE_MEMORY_USABLE 0x81000000
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
#ifndef ASM_FILE
grub_err_t EXPORT_FUNC (grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
static inline grub_err_t
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
grub_uint64_t size __attribute__ ((unused)),
int type __attribute__ ((unused)),
int handle __attribute__ ((unused)))
{
return GRUB_ERR_NONE;
}
static inline grub_err_t
grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
{
return GRUB_ERR_NONE;
}
#endif
#endif

View file

@ -0,0 +1,24 @@
/*
* 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_MACHINE_SERIAL_HEADER
#define GRUB_MACHINE_SERIAL_HEADER 1
#define GRUB_MACHINE_SERIAL_PORTS { 0x140003f8 }
#endif

View file

@ -0,0 +1,34 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,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 KERNEL_MACHINE_TIME_HEADER
#define KERNEL_MACHINE_TIME_HEADER 1
#include <grub/symbol.h>
#define GRUB_TICKS_PER_SECOND 1000
/* Return the real time in ticks. */
grub_uint32_t EXPORT_FUNC (grub_get_rtc) (void);
static inline void
grub_cpu_idle(void)
{
}
#endif /* ! KERNEL_MACHINE_TIME_HEADER */

View file

@ -0,0 +1,39 @@
/*
* 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_RELOCATOR_CPU_HEADER
#define GRUB_RELOCATOR_CPU_HEADER 1
#include <grub/types.h>
#include <grub/err.h>
struct grub_relocator32_state
{
/* gpr[0] is ignored since it's hardwired to 0. */
grub_uint32_t gpr[32];
/* Register holding target $pc. */
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);
#endif /* ! GRUB_RELOCATOR_CPU_HEADER */

View file

@ -0,0 +1,27 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2004,2006,2007,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_SETJMP_CPU_HEADER
#define GRUB_SETJMP_CPU_HEADER 1
typedef unsigned long grub_jmp_buf[11];
int grub_setjmp (grub_jmp_buf env) __attribute__ ((returns_twice));
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
#endif /* ! GRUB_SETJMP_CPU_HEADER */

0
include/grub/mips/time.h Normal file
View file

38
include/grub/mips/types.h Normal file
View file

@ -0,0 +1,38 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2006,2007,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_TYPES_CPU_HEADER
#define GRUB_TYPES_CPU_HEADER 1
/* The size of void *. */
#define GRUB_TARGET_SIZEOF_VOID_P 4
/* The size of long. */
#define GRUB_TARGET_SIZEOF_LONG 4
#ifdef GRUB_CPU_MIPSEL
/* mipsEL is little-endian. */
#undef GRUB_TARGET_WORDS_BIGENDIAN
#elif defined (GRUB_CPU_MIPS)
/* mips is big-endian. */
#define GRUB_TARGET_WORDS_BIGENDIAN
#elif !defined (GRUB_SYMBOL_GENERATOR)
#error Neither GRUB_CPU_MIPS nor GRUB_CPU_MIPSEL is defined
#endif
#endif /* ! GRUB_TYPES_CPU_HEADER */

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
* Copyright (C) 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,15 +16,10 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_KERNEL_CPU_HEADER
#define GRUB_KERNEL_CPU_HEADER 1
#ifndef GRUB_MACHINE_AT_KEYBOARD_HEADER
#define GRUB_MACHINE_AT_KEYBOARD_HEADER 1
#define GRUB_MOD_ALIGN 0x2000
/* Non-zero value is only needed for PowerMacs. */
#define GRUB_MOD_GAP 0x0
#define GRUB_KERNEL_CPU_PREFIX 0x2
#define GRUB_KERNEL_CPU_DATA_END 0x42
#define KEYBOARD_REG_DATA 0xbfd00060
#define KEYBOARD_REG_STATUS 0xbfd00064
#endif

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2004,2007,2009 Free Software Foundation, Inc.
* Copyright (C) 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
@ -16,14 +16,13 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#ifndef GRUB_CPU_CMOS_H
#define GRUB_CPU_CMOS_H 1
#ifdef HAVE___BSWAPSI2
typedef int SItype __attribute__ ((mode (SI)));
SItype EXPORT_FUNC (__bswapsi2) (SItype);
#endif
#include <grub/types.h>
#include <grub/cpu/io.h>
#ifdef HAVE___BSWAPDI2
typedef int DItype __attribute__ ((mode (DI)));
DItype EXPORT_FUNC (__bswapdi2) (DItype);
#endif
#define GRUB_CMOS_ADDR_REG 0xbfd00070
#define GRUB_CMOS_DATA_REG 0xbfd00071
#endif /* GRUB_CPU_CMOS_H */

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
* Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,7 +22,10 @@
#include <grub/symbol.h>
#ifndef ASM_FILE
extern char grub_prefix[];
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_halt) (void);
#endif
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */

View file

View file

@ -0,0 +1,68 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MEMORY_MACHINE_HEADER
#define GRUB_MEMORY_MACHINE_HEADER 1
#ifndef ASM_FILE
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
#endif
#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x801ffff0
#define GRUB_ARCH_LOWMEMVSTART 0x80000000
#define GRUB_ARCH_LOWMEMPSTART 0x00000000
#define GRUB_ARCH_LOWMEMMAXSIZE 0x10000000
#define GRUB_ARCH_HIGHMEMPSTART 0x10000000
#define GRUB_MACHINE_MEMORY_AVAILABLE 1
#define GRUB_MACHINE_MEMORY_MAX_TYPE 1
/* This one is special: it's used internally but is never reported
by firmware. */
#define GRUB_MACHINE_MEMORY_HOLE 2
#define GRUB_MACHINE_MEMORY_RESERVED GRUB_MACHINE_MEMORY_HOLE
#ifndef ASM_FILE
grub_err_t EXPORT_FUNC (grub_machine_mmap_iterate)
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
static inline grub_err_t
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
grub_uint64_t size __attribute__ ((unused)),
int type __attribute__ ((unused)),
int handle __attribute__ ((unused)))
{
return GRUB_ERR_NONE;
}
static inline grub_err_t
grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
{
return GRUB_ERR_NONE;
}
grub_uint64_t grub_mmap_get_lower (void);
grub_uint64_t grub_mmap_get_upper (void);
extern grub_uint32_t EXPORT_VAR (grub_arch_memsize);
extern grub_uint32_t EXPORT_VAR (grub_arch_highmemsize);
#endif
#endif

View file

@ -0,0 +1,121 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 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_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_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)
/* We have 3 PCI windows. */
#define GRUB_MACHINE_PCI_NUM_WIN 3
/* Each window is 64MiB. */
#define GRUB_MACHINE_PCI_WIN_SHIFT 26
#define GRUB_MACHINE_PCI_WIN_OFFSET_MASK ((1 << GRUB_MACHINE_PCI_WIN_SHIFT) - 1)
#define GRUB_MACHINE_PCI_WIN_SIZE 0x04000000
/* Graphical acceleration takes 1 MiB away. */
#define GRUB_MACHINE_PCI_WIN1_SIZE 0x03f00000
#define GRUB_MACHINE_PCI_WIN1_ADDR 0xb0000000
#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)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
return *(volatile grub_uint32_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff));
}
static inline grub_uint16_t
grub_pci_read_word (grub_pci_address_t addr)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
return *(volatile grub_uint16_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff));
}
static inline grub_uint8_t
grub_pci_read_byte (grub_pci_address_t addr)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
return *(volatile grub_uint8_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff));
}
static inline void
grub_pci_write (grub_pci_address_t addr, grub_uint32_t data)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
*(volatile grub_uint32_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff)) = data;
}
static inline void
grub_pci_write_word (grub_pci_address_t addr, grub_uint16_t data)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
*(volatile grub_uint16_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff)) = data;
}
static inline void
grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
{
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
*(volatile grub_uint8_t *) (GRUB_MACHINE_PCI_CONFSPACE
| (addr & 0x03ff)) = data;
}
volatile void *
EXPORT_FUNC (grub_pci_device_map_range) (grub_pci_device_t dev,
grub_addr_t base, grub_size_t size);
void
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 */

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