merge with mainline
This commit is contained in:
commit
54416e9d71
260 changed files with 40663 additions and 5647 deletions
|
@ -32,6 +32,12 @@ typedef enum
|
|||
GRUB_ATA_LBA48
|
||||
} grub_ata_addressing_t;
|
||||
|
||||
#define GRUB_ATA_CH0_PORT1 0x1f0
|
||||
#define GRUB_ATA_CH1_PORT1 0x170
|
||||
|
||||
#define GRUB_ATA_CH0_PORT2 0x3f6
|
||||
#define GRUB_ATA_CH1_PORT2 0x376
|
||||
|
||||
#define GRUB_ATA_REG_DATA 0
|
||||
#define GRUB_ATA_REG_ERROR 1
|
||||
#define GRUB_ATA_REG_FEATURES 1
|
||||
|
|
|
@ -63,6 +63,8 @@
|
|||
#define GRUB_PC_PARTITION_OPENBSD_TYPE_NTFS 18
|
||||
#define GRUB_PC_PARTITION_OPENBSD_TYPE_RAID 19
|
||||
|
||||
#define GRUB_PC_PARTITION_BSD_LABEL_WHOLE_DISK_PARTITION 2
|
||||
|
||||
/* The BSD partition entry. */
|
||||
struct grub_partition_bsd_entry
|
||||
{
|
||||
|
|
|
@ -117,5 +117,11 @@ grub_is_valid_utf8 (const grub_uint8_t *src, grub_size_t srcsize);
|
|||
|
||||
int grub_utf8_to_ucs4_alloc (const char *msg, grub_uint32_t **unicode_msg,
|
||||
grub_uint32_t **last_position);
|
||||
void
|
||||
grub_ucs4_to_utf8 (grub_uint32_t *src, grub_size_t size,
|
||||
grub_uint8_t *dest, grub_size_t destsize);
|
||||
grub_size_t grub_utf8_to_ucs4 (grub_uint32_t *dest, grub_size_t destsize,
|
||||
const grub_uint8_t *src, grub_size_t srcsize,
|
||||
const grub_uint8_t **srcend);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -115,12 +115,7 @@ grub_command_execute (const char *name, int argc, char **argv)
|
|||
return (cmd) ? cmd->func (cmd, argc, argv) : GRUB_ERR_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_command_iterate (int (*func) (grub_command_t))
|
||||
{
|
||||
return grub_list_iterate (GRUB_AS_LIST (grub_command_list),
|
||||
(grub_list_hook_t) func);
|
||||
}
|
||||
#define FOR_COMMANDS(var) FOR_LIST_ELEMENTS((var), grub_command_list)
|
||||
|
||||
void grub_register_core_commands (void);
|
||||
|
||||
|
|
190
include/grub/cs5536.h
Normal file
190
include/grub/cs5536.h
Normal file
|
@ -0,0 +1,190 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_CS5536_HEADER
|
||||
#define GRUB_CS5536_HEADER 1
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#include <grub/pci.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/smbus.h>
|
||||
#endif
|
||||
|
||||
#define GRUB_CS5536_PCIID 0x208f1022
|
||||
#define GRUB_CS5536_MSR_MAILBOX_ADDR 0xf4
|
||||
#define GRUB_CS5536_MSR_MAILBOX_DATA0 0xf8
|
||||
#define GRUB_CS5536_MSR_MAILBOX_DATA1 0xfc
|
||||
#define GRUB_CS5536_MSR_IRQ_MAP_BAR 0x80000008
|
||||
#define GRUB_CS5536_MSR_SMB_BAR 0x8000000b
|
||||
|
||||
#define GRUB_CS5536_SMBUS_REGS_SIZE 8
|
||||
#define GRUB_CS5536_GPIO_REGS_SIZE 256
|
||||
#define GRUB_CS5536_MFGPT_REGS_SIZE 64
|
||||
#define GRUB_CS5536_IRQ_MAP_REGS_SIZE 32
|
||||
#define GRUB_CS5536_PM_REGS_SIZE 128
|
||||
#define GRUB_CS5536_ACPI_REGS_SIZE 32
|
||||
|
||||
#define GRUB_CS5536_USB_OPTION_REGS_SIZE 0x1c
|
||||
#define GRUB_CS5536_USB_OPTION_REG_UOCMUX 1
|
||||
#define GRUB_CS5536_USB_OPTION_REG_UOCMUX_PMUX_MASK 0x03
|
||||
#define GRUB_CS5536_USB_OPTION_REG_UOCMUX_PMUX_HC 0x02
|
||||
|
||||
#define GRUB_CS5536_DESTINATION_GLIU 0
|
||||
#define GRUB_CS5536_DESTINATION_GLPCI_SB 1
|
||||
#define GRUB_CS5536_DESTINATION_USB 2
|
||||
#define GRUB_CS5536_DESTINATION_IDE 3
|
||||
#define GRUB_CS5536_DESTINATION_DD 4
|
||||
#define GRUB_CS5536_DESTINATION_ACC 5
|
||||
#define GRUB_CS5536_DESTINATION_GLCP 7
|
||||
|
||||
#define GRUB_CS5536_P2D_DEST_SHIFT 61
|
||||
#define GRUB_CS5536_P2D_LOG_ALIGN 12
|
||||
#define GRUB_CS5536_P2D_ALIGN (1 << GRUB_CS5536_P2D_LOG_ALIGN)
|
||||
#define GRUB_CS5536_P2D_BASE_SHIFT 20
|
||||
#define GRUB_CS5536_P2D_MASK_SHIFT 0
|
||||
|
||||
#define GRUB_CS5536_MSR_GL_IOD_START 0x000100e0
|
||||
#define GRUB_CS5536_IOD_DEST_SHIFT 61
|
||||
#define GRUB_CS5536_IOD_BASE_SHIFT 20
|
||||
#define GRUB_CS5536_IOD_MASK_SHIFT 0
|
||||
#define GRUB_CS5536_IOD_ADDR_MASK 0xfffff
|
||||
|
||||
#define GRUB_CS5536_MSR_GPIO_BAR 0x8000000c
|
||||
#define GRUB_CS5536_MSR_MFGPT_BAR 0x8000000d
|
||||
#define GRUB_CS5536_MSR_ACPI_BAR 0x8000000e
|
||||
#define GRUB_CS5536_MSR_PM_BAR 0x8000000f
|
||||
#define GRUB_CS5536_MSR_DIVIL_LEG_IO 0x80000014
|
||||
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0 0x00000001
|
||||
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1 0x00000002
|
||||
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_MODE_X86 0x10000000
|
||||
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP 0x04000000
|
||||
#define GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_PRIMARY_MASK 0x80000024
|
||||
#define GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_LPC_MASK 0x80000025
|
||||
#define GRUB_CS5536_DIVIL_LPC_INTERRUPTS 0x1002
|
||||
#define GRUB_CS5536_MSR_DIVIL_LPC_SERIAL_IRQ_CONTROL 0x8000004e
|
||||
#define GRUB_CS5536_MSR_DIVIL_LPC_SERIAL_IRQ_CONTROL_ENABLE 0x80
|
||||
|
||||
#define GRUB_CS5536_MSR_USB_OHCI_BASE 0x40000008
|
||||
#define GRUB_CS5536_MSR_USB_EHCI_BASE 0x40000009
|
||||
#define GRUB_CS5536_MSR_USB_CONTROLLER_BASE 0x4000000a
|
||||
#define GRUB_CS5536_MSR_USB_OPTION_CONTROLLER_BASE 0x4000000b
|
||||
#define GRUB_CS5536_MSR_USB_BASE_ADDR_MASK 0x00ffffff00ULL
|
||||
#define GRUB_CS5536_MSR_USB_BASE_BUS_MASTER 0x0400000000ULL
|
||||
#define GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE 0x0200000000ULL
|
||||
#define GRUB_CS5536_MSR_USB_BASE_PME_ENABLED 0x0800000000ULL
|
||||
#define GRUB_CS5536_MSR_USB_BASE_PME_STATUS 0x1000000000ULL
|
||||
#define GRUB_CS5536_MSR_USB_EHCI_BASE_FLDJ_SHIFT 40
|
||||
|
||||
#define GRUB_CS5536_MSR_IDE_IO_BAR 0x60000008
|
||||
#define GRUB_CS5536_MSR_IDE_IO_BAR_UNITS 1
|
||||
#define GRUB_CS5536_MSR_IDE_IO_BAR_ADDR_MASK 0xfffffff0
|
||||
#define GRUB_CS5536_MSR_IDE_CFG 0x60000010
|
||||
#define GRUB_CS5536_MSR_IDE_CFG_CHANNEL_ENABLE 2
|
||||
#define GRUB_CS5536_MSR_IDE_TIMING 0x60000012
|
||||
#define GRUB_CS5536_MSR_IDE_TIMING_PIO0 0x98
|
||||
#define GRUB_CS5536_MSR_IDE_TIMING_DRIVE0_SHIFT 24
|
||||
#define GRUB_CS5536_MSR_IDE_TIMING_DRIVE1_SHIFT 16
|
||||
#define GRUB_CS5536_MSR_IDE_CAS_TIMING 0x60000013
|
||||
#define GRUB_CS5536_MSR_IDE_CAS_TIMING_CMD_PIO0 0x99
|
||||
#define GRUB_CS5536_MSR_IDE_CAS_TIMING_CMD_SHIFT 24
|
||||
#define GRUB_CS5536_MSR_IDE_CAS_TIMING_DRIVE0_SHIFT 6
|
||||
#define GRUB_CS5536_MSR_IDE_CAS_TIMING_DRIVE1_SHIFT 4
|
||||
#define GRUB_CS5536_MSR_IDE_CAS_TIMING_PIO0 2
|
||||
|
||||
#define GRUB_CS5536_MSR_GL_PCI_CTRL 0x00000010
|
||||
#define GRUB_CS5536_MSR_GL_PCI_CTRL_MEMORY_ENABLE 1
|
||||
#define GRUB_CS5536_MSR_GL_PCI_CTRL_IO_ENABLE 2
|
||||
#define GRUB_CS5536_MSR_GL_PCI_CTRL_LATENCY_SHIFT 35
|
||||
#define GRUB_CS5536_MSR_GL_PCI_CTRL_OUT_THR_SHIFT 60
|
||||
#define GRUB_CS5536_MSR_GL_PCI_CTRL_IN_THR_SHIFT 56
|
||||
|
||||
#define GRUB_CS5536_MSR_GL_REGIONS_START 0x00000020
|
||||
#define GRUB_CS5536_MSR_GL_REGIONS_NUM 16
|
||||
#define GRUB_CS5536_MSR_GL_REGION_ENABLE 1
|
||||
#define GRUB_CS5536_MSR_GL_REGION_IO 0x100000000ULL
|
||||
#define GRUB_CS5536_MSR_GL_REGION_BASE_MASK 0xfffff000ULL
|
||||
#define GRUB_CS5536_MSR_GL_REGION_IO_BASE_SHIFT 12
|
||||
#define GRUB_CS5536_MSR_GL_REGION_TOP_MASK 0xfffff00000000000ULL
|
||||
#define GRUB_CS5536_MSR_GL_REGION_IO_TOP_SHIFT 44
|
||||
|
||||
#define GRUB_CS5536_MSR_GL_P2D_START 0x00010020
|
||||
|
||||
#define GRUB_CS5536_SMB_REG_DATA 0x0
|
||||
#define GRUB_CS5536_SMB_REG_STATUS 0x1
|
||||
#define GRUB_CS5536_SMB_REG_STATUS_SDAST (1 << 6)
|
||||
#define GRUB_CS5536_SMB_REG_STATUS_BER (1 << 5)
|
||||
#define GRUB_CS5536_SMB_REG_STATUS_NACK (1 << 4)
|
||||
#define GRUB_CS5536_SMB_REG_CTRL1 0x3
|
||||
#define GRUB_CS5536_SMB_REG_CTRL1_START 0x01
|
||||
#define GRUB_CS5536_SMB_REG_CTRL1_STOP 0x02
|
||||
#define GRUB_CS5536_SMB_REG_CTRL1_ACK 0x10
|
||||
#define GRUB_CS5536_SMB_REG_ADDR 0x4
|
||||
#define GRUB_CS5536_SMB_REG_ADDR_MASTER 0x0
|
||||
#define GRUB_CS5536_SMB_REG_CTRL2 0x5
|
||||
#define GRUB_CS5536_SMB_REG_CTRL2_ENABLE 0x1
|
||||
#define GRUB_CS5536_SMB_REG_CTRL3 0x6
|
||||
|
||||
#ifdef ASM_FILE
|
||||
#define GRUB_ULL(x) x
|
||||
#else
|
||||
#define GRUB_ULL(x) x ## ULL
|
||||
#endif
|
||||
|
||||
#define GRUB_CS5536_LBAR_ADDR_MASK GRUB_ULL (0x000000000000fff8)
|
||||
#define GRUB_CS5536_LBAR_ENABLE GRUB_ULL (0x0000000100000000)
|
||||
#define GRUB_CS5536_LBAR_MASK_MASK GRUB_ULL (0x0000f00000000000)
|
||||
#define GRUB_CS5536_LBAR_TURN_ON (GRUB_CS5536_LBAR_ENABLE | GRUB_CS5536_LBAR_MASK_MASK)
|
||||
|
||||
/* PMON-compatible LBARs. */
|
||||
#define GRUB_CS5536_LBAR_GPIO 0xb000
|
||||
#define GRUB_CS5536_LBAR_ACC 0xb200
|
||||
#define GRUB_CS5536_LBAR_PM 0xb280
|
||||
#define GRUB_CS5536_LBAR_MFGPT 0xb300
|
||||
#define GRUB_CS5536_LBAR_ACPI 0xb340
|
||||
#define GRUB_CS5536_LBAR_IRQ_MAP 0xb360
|
||||
#define GRUB_CS5536_LBAR_IDE 0xb380
|
||||
#define GRUB_CS5536_LBAR_SMBUS 0xb390
|
||||
|
||||
#define GRUB_GPIO_SMBUS_PINS ((1 << 14) | (1 << 15))
|
||||
#define GRUB_GPIO_REG_OUT_EN 0x4
|
||||
#define GRUB_GPIO_REG_OUT_AUX1 0x10
|
||||
#define GRUB_GPIO_REG_IN_EN 0x20
|
||||
#define GRUB_GPIO_REG_IN_AUX1 0x34
|
||||
|
||||
#ifndef ASM_FILE
|
||||
int EXPORT_FUNC (grub_cs5536_find) (grub_pci_device_t *devp);
|
||||
|
||||
grub_uint64_t EXPORT_FUNC (grub_cs5536_read_msr) (grub_pci_device_t dev,
|
||||
grub_uint32_t addr);
|
||||
void EXPORT_FUNC (grub_cs5536_write_msr) (grub_pci_device_t dev,
|
||||
grub_uint32_t addr,
|
||||
grub_uint64_t val);
|
||||
grub_err_t grub_cs5536_read_spd_byte (grub_port_t smbbase, grub_uint8_t dev,
|
||||
grub_uint8_t addr, grub_uint8_t *res);
|
||||
grub_err_t EXPORT_FUNC (grub_cs5536_read_spd) (grub_port_t smbbase,
|
||||
grub_uint8_t dev,
|
||||
struct grub_smbus_spd *res);
|
||||
grub_err_t grub_cs5536_smbus_wait (grub_port_t smbbase);
|
||||
grub_err_t EXPORT_FUNC (grub_cs5536_init_smbus) (grub_pci_device_t dev,
|
||||
grub_uint16_t divisor,
|
||||
grub_port_t *smbbase);
|
||||
|
||||
void grub_cs5536_init_geode (grub_pci_device_t dev);
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -138,6 +138,9 @@ typedef struct grub_disk_memberlist *grub_disk_memberlist_t;
|
|||
#define GRUB_DISK_CACHE_SIZE 8
|
||||
#define GRUB_DISK_CACHE_BITS 3
|
||||
|
||||
/* Return value of grub_disk_get_size() in case disk size is unknown. */
|
||||
#define GRUB_DISK_SIZE_UNKNOWN 0xffffffffffffffffULL
|
||||
|
||||
/* This is called from the memory manager. */
|
||||
void grub_disk_cache_invalidate_all (void);
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ struct grub_dl
|
|||
Elf_Sym *symtab;
|
||||
void (*init) (struct grub_dl *mod);
|
||||
void (*fini) (void);
|
||||
struct grub_dl *next;
|
||||
};
|
||||
typedef struct grub_dl *grub_dl_t;
|
||||
|
||||
|
@ -98,7 +99,10 @@ void grub_dl_unload_all (void);
|
|||
#endif
|
||||
int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
|
||||
int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
|
||||
void EXPORT_FUNC(grub_dl_iterate) (int (*hook) (grub_dl_t mod));
|
||||
extern grub_dl_t EXPORT_VAR(grub_dl_head);
|
||||
|
||||
#define FOR_DL_MODULES(var) FOR_LIST_ELEMENTS ((var), (grub_dl_head))
|
||||
|
||||
grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name);
|
||||
grub_err_t grub_dl_register_symbol (const char *name, void *addr,
|
||||
grub_dl_t mod);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -46,5 +46,10 @@ 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 */
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/video.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/unicode.h>
|
||||
|
||||
/* Forward declaration of opaque structure grub_font.
|
||||
Users only pass struct grub_font pointers to the font module functions,
|
||||
|
@ -69,6 +70,11 @@ struct grub_font_glyph
|
|||
grub_uint8_t bitmap[0];
|
||||
};
|
||||
|
||||
/* Part of code field which is really used as such. */
|
||||
#define GRUB_FONT_CODE_CHAR_MASK 0x001fffff
|
||||
#define GRUB_FONT_CODE_RIGHT_JOINED 0x80000000
|
||||
#define GRUB_FONT_CODE_LEFT_JOINED 0x40000000
|
||||
|
||||
/* Initialize the font loader.
|
||||
Must be called before any fonts are loaded or used. */
|
||||
void grub_font_loader_init (void);
|
||||
|
@ -97,8 +103,7 @@ int EXPORT_FUNC (grub_font_get_leading) (grub_font_t font);
|
|||
|
||||
int EXPORT_FUNC (grub_font_get_height) (grub_font_t font);
|
||||
|
||||
int EXPORT_FUNC (grub_font_get_string_width) (grub_font_t font,
|
||||
const char *str);
|
||||
int EXPORT_FUNC (grub_font_get_xheight) (grub_font_t font);
|
||||
|
||||
struct grub_font_glyph *EXPORT_FUNC (grub_font_get_glyph) (grub_font_t font,
|
||||
grub_uint32_t code);
|
||||
|
@ -110,9 +115,11 @@ grub_err_t EXPORT_FUNC (grub_font_draw_glyph) (struct grub_font_glyph *glyph,
|
|||
grub_video_color_t color,
|
||||
int left_x, int baseline_y);
|
||||
|
||||
grub_err_t EXPORT_FUNC (grub_font_draw_string) (const char *str,
|
||||
grub_font_t font,
|
||||
grub_video_color_t color,
|
||||
int left_x, int baseline_y);
|
||||
int
|
||||
EXPORT_FUNC (grub_font_get_constructed_device_width) (grub_font_t hinted_font,
|
||||
const struct grub_unicode_glyph *glyph_id);
|
||||
struct grub_font_glyph *
|
||||
EXPORT_FUNC (grub_font_construct_glyph) (grub_font_t hinted_font,
|
||||
const struct grub_unicode_glyph *glyph_id);
|
||||
|
||||
#endif /* ! GRUB_FONT_HEADER */
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
#include <grub/list.h>
|
||||
|
||||
/* Forward declaration is required, because of mutual reference. */
|
||||
struct grub_file;
|
||||
|
||||
|
@ -38,6 +40,9 @@ struct grub_dirhook_info
|
|||
/* Filesystem descriptor. */
|
||||
struct grub_fs
|
||||
{
|
||||
/* The next filesystem. */
|
||||
struct grub_fs *next;
|
||||
|
||||
/* My name. */
|
||||
const char *name;
|
||||
|
||||
|
@ -72,9 +77,6 @@ struct grub_fs
|
|||
/* Whether this filesystem reserves first sector for DOS-style boot. */
|
||||
int reserved_first_sector;
|
||||
#endif
|
||||
|
||||
/* The next filesystem. */
|
||||
struct grub_fs *next;
|
||||
};
|
||||
typedef struct grub_fs *grub_fs_t;
|
||||
|
||||
|
@ -87,10 +89,24 @@ extern struct grub_fs grub_fs_blocklist;
|
|||
the linked list GRUB_FS_LIST through the function grub_fs_register. */
|
||||
typedef int (*grub_fs_autoload_hook_t) (void);
|
||||
extern grub_fs_autoload_hook_t EXPORT_VAR(grub_fs_autoload_hook);
|
||||
extern grub_fs_t EXPORT_VAR (grub_fs_list);
|
||||
|
||||
#ifndef GRUB_LST_GENERATOR
|
||||
static inline void
|
||||
grub_fs_register (grub_fs_t fs)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_fs_list), GRUB_AS_LIST (fs));
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
grub_fs_unregister (grub_fs_t fs)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_fs_list), GRUB_AS_LIST (fs));
|
||||
}
|
||||
|
||||
#define FOR_FILESYSTEMS(var) FOR_LIST_ELEMENTS((var), (grub_fs_list))
|
||||
|
||||
void EXPORT_FUNC(grub_fs_register) (grub_fs_t fs);
|
||||
void EXPORT_FUNC(grub_fs_unregister) (grub_fs_t fs);
|
||||
void EXPORT_FUNC(grub_fs_iterate) (int (*hook) (const grub_fs_t fs));
|
||||
grub_fs_t EXPORT_FUNC(grub_fs_probe) (grub_device_t device);
|
||||
|
||||
#endif /* ! GRUB_FS_HEADER */
|
||||
|
|
|
@ -62,6 +62,14 @@ grub_gfxmenu_print_timeout (int timeout, void *data);
|
|||
void
|
||||
grub_gfxmenu_set_chosen_entry (int entry, void *data);
|
||||
|
||||
grub_err_t grub_font_draw_string (const char *str,
|
||||
grub_font_t font,
|
||||
grub_video_color_t color,
|
||||
int left_x, int baseline_y);
|
||||
int grub_font_get_string_width (grub_font_t font,
|
||||
const char *str);
|
||||
|
||||
|
||||
/* Implementation details -- this should not be used outside of the
|
||||
view itself. */
|
||||
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
/* handler.h - header for grub handler */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_HANDLER_HEADER
|
||||
#define GRUB_HANDLER_HEADER 1
|
||||
|
||||
#include <grub/list.h>
|
||||
#include <grub/err.h>
|
||||
|
||||
struct grub_handler
|
||||
{
|
||||
struct grub_handler *next;
|
||||
const char *name;
|
||||
grub_err_t (*init) (void);
|
||||
grub_err_t (*fini) (void);
|
||||
};
|
||||
typedef struct grub_handler *grub_handler_t;
|
||||
|
||||
struct grub_handler_class
|
||||
{
|
||||
struct grub_handler_class *next;
|
||||
const char *name;
|
||||
grub_handler_t handler_list;
|
||||
grub_handler_t cur_handler;
|
||||
};
|
||||
typedef struct grub_handler_class *grub_handler_class_t;
|
||||
|
||||
extern grub_handler_class_t EXPORT_VAR(grub_handler_class_list);
|
||||
|
||||
void EXPORT_FUNC(grub_handler_register) (grub_handler_class_t class,
|
||||
grub_handler_t handler);
|
||||
void EXPORT_FUNC(grub_handler_unregister) (grub_handler_class_t class,
|
||||
grub_handler_t handler);
|
||||
grub_err_t EXPORT_FUNC(grub_handler_set_current) (grub_handler_class_t class,
|
||||
grub_handler_t handler);
|
||||
|
||||
#define GRUB_AS_HANDLER(ptr) \
|
||||
((GRUB_FIELD_MATCH (ptr, grub_handler_t, next) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_handler_t, name) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_handler_t, init) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_handler_t, fini)) ? \
|
||||
(grub_handler_t) ptr : grub_bad_type_cast ())
|
||||
|
||||
#endif /* ! GRUB_HANDLER_HEADER */
|
|
@ -22,10 +22,10 @@
|
|||
#include <config.h>
|
||||
#include <grub/symbol.h>
|
||||
|
||||
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
||||
|
||||
/* NLS can be disabled through the configure --disable-nls option. */
|
||||
#if (defined(ENABLE_NLS) && ENABLE_NLS)
|
||||
#if (defined(ENABLE_NLS) && ENABLE_NLS) || !defined (GRUB_UTIL)
|
||||
|
||||
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
||||
|
||||
# ifdef GRUB_UTIL
|
||||
|
||||
|
@ -41,19 +41,11 @@ extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
|||
for invalid uses of the value returned from these functions.
|
||||
On pre-ANSI systems without 'const', the config.h file is supposed to
|
||||
contain "#define const". */
|
||||
# ifdef GRUB_UTIL
|
||||
static inline const char * __attribute__ ((always_inline))
|
||||
gettext (const char *str)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
# else
|
||||
static inline const char * __attribute__ ((always_inline))
|
||||
grub_gettext (const char *str)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
# endif /* GRUB_UTIL */
|
||||
|
||||
#endif /* (defined(ENABLE_NLS) && ENABLE_NLS) */
|
||||
|
||||
|
|
|
@ -40,12 +40,15 @@
|
|||
#include <grub/i386/vga_common.h>
|
||||
|
||||
/* These are global to share code between C and asm. */
|
||||
int grub_console_checkkey (void);
|
||||
int grub_console_getkey (void);
|
||||
grub_uint16_t grub_console_getxy (void);
|
||||
void grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y);
|
||||
void grub_console_cls (void);
|
||||
void grub_console_setcursor (int on);
|
||||
int grub_console_checkkey (struct grub_term_input *term);
|
||||
int grub_console_getkey (struct grub_term_input *term);
|
||||
grub_uint16_t grub_console_getxy (struct grub_term_output *term);
|
||||
void grub_console_gotoxy (struct grub_term_output *term,
|
||||
grub_uint8_t x, grub_uint8_t y);
|
||||
void grub_console_cls (struct grub_term_output *term);
|
||||
void grub_console_setcursor (struct grub_term_output *term, int on);
|
||||
void grub_console_putchar (struct grub_term_output *term,
|
||||
const struct grub_unicode_glyph *c);
|
||||
|
||||
/* Initialize the console system. */
|
||||
void grub_console_init (void);
|
||||
|
|
|
@ -80,7 +80,7 @@ grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
|
|||
|
||||
static inline void
|
||||
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||
void *mem __attribute__ ((unused)),
|
||||
volatile void *mem __attribute__ ((unused)),
|
||||
grub_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ 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;
|
||||
|
||||
void grub_qemu_init_cirrus (void);
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
||||
|
|
|
@ -25,16 +25,8 @@
|
|||
|
||||
extern grub_uint8_t grub_console_cur_color;
|
||||
|
||||
void grub_console_putchar (grub_uint32_t c);
|
||||
grub_ssize_t grub_console_getcharwidth (grub_uint32_t c);
|
||||
grub_uint16_t grub_console_getwh (void);
|
||||
void grub_console_setcolorstate (grub_term_color_state state);
|
||||
void grub_console_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color);
|
||||
void grub_console_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color);
|
||||
|
||||
/* Implemented in both kern/i386/pc/startup.S and vga_text.c; this symbol
|
||||
is not exported, so there's no collision, but vga_common.c expects this
|
||||
prototype to be the same. */
|
||||
void grub_console_real_putchar (int c);
|
||||
grub_uint16_t grub_console_getwh (struct grub_term_output *term);
|
||||
void grub_console_setcolorstate (struct grub_term_output *term,
|
||||
grub_term_color_state state);
|
||||
|
||||
#endif /* ! GRUB_VGA_COMMON_CPU_HEADER */
|
||||
|
|
|
@ -114,8 +114,6 @@ extern grub_uint32_t grub_xnu_stack;
|
|||
extern grub_uint32_t grub_xnu_arg1;
|
||||
extern char grub_xnu_cmdline[1024];
|
||||
grub_err_t grub_xnu_boot (void);
|
||||
grub_err_t grub_xnu_set_video (struct grub_xnu_boot_params *bootparams_relloc);
|
||||
grub_err_t
|
||||
grub_cpu_xnu_fill_devicetree (void);
|
||||
grub_err_t grub_cpu_xnu_fill_devicetree (void);
|
||||
extern grub_uint32_t grub_xnu_heap_will_be_at;
|
||||
#endif
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
#include <grub/symbol.h>
|
||||
|
||||
/* Initialize the console system. */
|
||||
void grub_console_init (void);
|
||||
void grub_console_init_early (void);
|
||||
void grub_console_init_lately (void);
|
||||
|
||||
/* Finish the console system. */
|
||||
void grub_console_fini (void);
|
|
@ -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)
|
||||
|
|
90
include/grub/mips/loongson.h
Normal file
90
include/grub/mips/loongson.h
Normal file
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_LOONGSON_CPU_HEADER
|
||||
#define GRUB_LOONGSON_CPU_HEADER 1
|
||||
|
||||
#ifdef ASM_FILE
|
||||
#define GRUB_CPU_REGISTER_WRAP(x) x
|
||||
#else
|
||||
#define GRUB_CPU_REGISTER_WRAP(x) #x
|
||||
#endif
|
||||
|
||||
#define GRUB_CPU_LOONGSON_FLASH_START 0xbfc00000
|
||||
#define GRUB_CPU_LOONGSON_FLASH_TLB_REFILL 0xbfc00200
|
||||
#define GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR 0xbfc00300
|
||||
#define GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION 0xbfc00380
|
||||
|
||||
#define GRUB_CPU_LOONGSON_DDR2_BASE 0xaffffe00
|
||||
#define GRUB_CPU_LOONGSON_DDR2_REG1_HI_8BANKS 0x00000001
|
||||
#define GRUB_CPU_LOONGSON_DDR2_REG_SIZE 0x8
|
||||
#define GRUB_CPU_LOONGSON_DDR2_REG_STEP 0x10
|
||||
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG GRUB_CPU_REGISTER_WRAP($16)
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG_ILINESIZE 0x10
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG_DLINESIZE 0x8
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_DSIZE_SHIFT 6
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_ISIZE_SHIFT 9
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_MASK 0x7
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_OFFSET 12
|
||||
|
||||
#define GRUB_CPU_LOONGSON_COP0_I_INDEX_INVALIDATE 0
|
||||
#define GRUB_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE 9
|
||||
#define GRUB_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE 11
|
||||
|
||||
#define GRUB_CPU_LOONGSON_COP0_I_INDEX_BIT_OFFSET 5
|
||||
#define GRUB_CPU_LOONGSON_COP0_D_INDEX_BIT_OFFSET 5
|
||||
#define GRUB_CPU_LOONGSON_COP0_S_INDEX_BIT_OFFSET 5
|
||||
|
||||
#define GRUB_CPU_LOONGSON_CACHE_ACCELERATED 7
|
||||
#define GRUB_CPU_LOONGSON_CACHE_UNCACHED 2
|
||||
#define GRUB_CPU_LOONGSON_CACHE_CACHED 3
|
||||
#define GRUB_CPU_LOONGSON_CACHE_TYPE_MASK 7
|
||||
#define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_SMALL 4
|
||||
#define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG 5
|
||||
#define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_SMALL 16
|
||||
#define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_BIG 32
|
||||
|
||||
#define GRUB_CPU_LOONGSON_I_CACHE_LOG_WAYS 2
|
||||
#define GRUB_CPU_LOONGSON_D_CACHE_LOG_WAYS 2
|
||||
#define GRUB_CPU_LOONGSON_S_CACHE_LOG_WAYS 2
|
||||
|
||||
/* FIXME: determine dynamically. */
|
||||
#define GRUB_CPU_LOONGSON_SECONDARY_CACHE_LOG_SIZE 19
|
||||
|
||||
#define GRUB_CPU_LOONGSON_COP0_BADVADDR GRUB_CPU_REGISTER_WRAP($8)
|
||||
#define GRUB_CPU_LOONGSON_COP0_TIMER_COUNT GRUB_CPU_REGISTER_WRAP($9)
|
||||
#define GRUB_CPU_LOONGSON_COP0_CAUSE GRUB_CPU_REGISTER_WRAP($13)
|
||||
#define GRUB_CPU_LOONGSON_COP0_EPC GRUB_CPU_REGISTER_WRAP($14)
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGLO GRUB_CPU_REGISTER_WRAP($28)
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGHI GRUB_CPU_REGISTER_WRAP($29)
|
||||
|
||||
#define GRUB_CPU_LOONGSON_LIOCFG 0xbfe00108
|
||||
#define GRUB_CPU_LOONGSON_ROM_DELAY_OFFSET 2
|
||||
#define GRUB_CPU_LOONGSON_ROM_DELAY_MASK 0x1f
|
||||
#define GRUB_CPU_LOONGSON_CORECFG 0xbfe00180
|
||||
#define GRUB_CPU_LOONGSON_CORECFG_DISABLE_DDR2_SPACE 0x100
|
||||
#define GRUB_CPU_LOONGSON_CORECFG_BUFFER_CPU 0x200
|
||||
|
||||
#define GRUB_CPU_LOONGSON_PCI_HIT1_SEL_LO 0xbfe00150
|
||||
#define GRUB_CPU_LOONGSON_PCI_HIT1_SEL_HI 0xbfe00154
|
||||
|
||||
#define GRUB_CPU_LOONGSON_GPIOCFG 0xbfe00120
|
||||
#define GRUB_CPU_LOONGSON_SHUTDOWN_GPIO 1
|
||||
|
||||
#endif
|
41
include/grub/mips/yeeloong/ec.h
Normal file
41
include/grub/mips/yeeloong/ec.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_EC_MACHINE_HEADER
|
||||
#define GRUB_EC_MACHINE_HEADER 1
|
||||
|
||||
#define GRUB_MACHINE_EC_MAGIC_PORT1 0x381
|
||||
#define GRUB_MACHINE_EC_MAGIC_PORT2 0x382
|
||||
#define GRUB_MACHINE_EC_DATA_PORT 0x383
|
||||
|
||||
#define GRUB_MACHINE_EC_MAGIC_VAL1 0xf4
|
||||
#define GRUB_MACHINE_EC_MAGIC_VAL2 0xec
|
||||
|
||||
#define GRUB_MACHINE_EC_COMMAND_REBOOT 1
|
||||
|
||||
static inline void
|
||||
grub_write_ec (grub_uint8_t value)
|
||||
{
|
||||
grub_outb (GRUB_MACHINE_EC_MAGIC_VAL1,
|
||||
GRUB_MACHINE_PCI_IO_BASE + GRUB_MACHINE_EC_MAGIC_PORT1);
|
||||
grub_outb (GRUB_MACHINE_EC_MAGIC_VAL2,
|
||||
GRUB_MACHINE_PCI_IO_BASE + GRUB_MACHINE_EC_MAGIC_PORT2);
|
||||
grub_outb (value, GRUB_MACHINE_PCI_IO_BASE + GRUB_MACHINE_EC_DATA_PORT);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -19,16 +19,30 @@
|
|||
#ifndef GRUB_MACHINE_PCI_H
|
||||
#define GRUB_MACHINE_PCI_H 1
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#include <grub/types.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#endif
|
||||
|
||||
#define GRUB_YEELOONG_OHCI_PCIID 0x00351033
|
||||
#define GRUB_YEELOONG_EHCI_PCIID 0x00e01033
|
||||
#define GRUB_YEELOONG_OHCI_GHOST_FUNCTION 4
|
||||
#define GRUB_YEELOONG_EHCI_GHOST_FUNCTION 5
|
||||
|
||||
#define GRUB_PCI_NUM_BUS 1
|
||||
#define GRUB_PCI_NUM_DEVICES 16
|
||||
|
||||
#define GRUB_MACHINE_PCI_IO_BASE 0xbfd00000
|
||||
#define GRUB_MACHINE_PCI_CONFSPACE 0xbfe80000
|
||||
#define GRUB_MACHINE_PCI_CONF_CTRL_REG (*(volatile grub_uint32_t *) 0xbfe00118)
|
||||
#define GRUB_MACHINE_PCI_IO_BASE 0xbfd00000
|
||||
#define GRUB_MACHINE_PCI_CONFSPACE 0xbfe80000
|
||||
#define GRUB_MACHINE_PCI_CONTROLLER_HEADER 0xbfe00000
|
||||
|
||||
#define GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR 0xbfe00118
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#define GRUB_MACHINE_PCI_CONF_CTRL_REG (*(volatile grub_uint32_t *) \
|
||||
GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR)
|
||||
#define GRUB_MACHINE_PCI_IO_CTRL_REG (*(volatile grub_uint32_t *) 0xbfe00110)
|
||||
#endif
|
||||
#define GRUB_MACHINE_PCI_WIN_MASK_SIZE 6
|
||||
#define GRUB_MACHINE_PCI_WIN_MASK ((1 << GRUB_MACHINE_PCI_WIN_MASK_SIZE) - 1)
|
||||
|
||||
|
@ -46,6 +60,7 @@
|
|||
#define GRUB_MACHINE_PCI_WIN2_ADDR 0xb4000000
|
||||
#define GRUB_MACHINE_PCI_WIN3_ADDR 0xb8000000
|
||||
|
||||
#ifndef ASM_FILE
|
||||
static inline grub_uint32_t
|
||||
grub_pci_read (grub_pci_address_t addr)
|
||||
{
|
||||
|
@ -95,11 +110,12 @@ grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
|
|||
}
|
||||
|
||||
volatile void *
|
||||
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||
grub_addr_t base, grub_size_t size);
|
||||
EXPORT_FUNC (grub_pci_device_map_range) (grub_pci_device_t dev,
|
||||
grub_addr_t base, grub_size_t size);
|
||||
void
|
||||
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||
volatile void *mem,
|
||||
grub_size_t size __attribute__ ((unused)));
|
||||
EXPORT_FUNC (grub_pci_device_unmap_range) (grub_pci_device_t dev,
|
||||
volatile void *mem,
|
||||
grub_size_t size);
|
||||
#endif
|
||||
|
||||
#endif /* GRUB_MACHINE_PCI_H */
|
||||
|
|
|
@ -19,6 +19,12 @@
|
|||
#ifndef GRUB_MACHINE_SERIAL_HEADER
|
||||
#define GRUB_MACHINE_SERIAL_HEADER 1
|
||||
|
||||
#define GRUB_MACHINE_SERIAL_PORTS { 0xbff003f8 }
|
||||
#define GRUB_MACHINE_SERIAL_DIVISOR_115200 2
|
||||
#define GRUB_MACHINE_SERIAL_PORT 0xbff003f8
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#define GRUB_MACHINE_SERIAL_PORTS { GRUB_MACHINE_SERIAL_PORT }
|
||||
#else
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -237,7 +237,19 @@ void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n);
|
|||
grub_size_t EXPORT_FUNC(grub_strlen) (const char *s);
|
||||
int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
int EXPORT_FUNC(grub_puts) (const char *s);
|
||||
|
||||
extern void (*EXPORT_VAR (grub_xputs)) (const char *str);
|
||||
|
||||
static inline int
|
||||
grub_puts (const char *s)
|
||||
{
|
||||
const char nl[2] = "\n";
|
||||
grub_xputs (s);
|
||||
grub_xputs (nl);
|
||||
|
||||
return 1; /* Cannot fail. */
|
||||
}
|
||||
|
||||
int EXPORT_FUNC(grub_puts_) (const char *s);
|
||||
void EXPORT_FUNC(grub_real_dprintf) (const char *file,
|
||||
const int line,
|
||||
|
@ -253,11 +265,6 @@ char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
|
|||
char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args);
|
||||
void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
|
||||
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
|
||||
grub_size_t EXPORT_FUNC(grub_utf8_to_ucs4) (grub_uint32_t *dest,
|
||||
grub_size_t destsize,
|
||||
const grub_uint8_t *src,
|
||||
grub_size_t srcsize,
|
||||
const grub_uint8_t **srcend);
|
||||
grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
|
||||
grub_uint32_t d, grub_uint32_t *r);
|
||||
|
||||
|
@ -298,14 +305,14 @@ grub_div_roundup (unsigned int x, unsigned int y)
|
|||
}
|
||||
|
||||
/* Reboot the machine. */
|
||||
void EXPORT_FUNC (grub_reboot) (void);
|
||||
void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
/* Halt the system, using APM if possible. If NO_APM is true, don't
|
||||
* use APM even if it is available. */
|
||||
void EXPORT_FUNC (grub_halt) (int no_apm);
|
||||
void EXPORT_FUNC (grub_halt) (int no_apm) __attribute__ ((noreturn));
|
||||
#else
|
||||
void EXPORT_FUNC (grub_halt) (void);
|
||||
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_MISC_HEADER */
|
||||
|
|
|
@ -77,9 +77,11 @@ void grub_parse_color_name_pair (grub_uint8_t *ret, const char *name);
|
|||
|
||||
/* Defined in `menu_text.c'. */
|
||||
void grub_wait_after_message (void);
|
||||
void grub_print_ucs4 (const grub_uint32_t * str,
|
||||
const grub_uint32_t * last_position,
|
||||
struct grub_term_output *term);
|
||||
void
|
||||
grub_print_ucs4 (const grub_uint32_t * str,
|
||||
const grub_uint32_t * last_position,
|
||||
int margin_left, int margin_right,
|
||||
struct grub_term_output *term);
|
||||
grub_ssize_t grub_getstringwidth (grub_uint32_t * str,
|
||||
const grub_uint32_t * last_position,
|
||||
struct grub_term_output *term);
|
||||
|
@ -110,7 +112,9 @@ void read_terminal_list (const char *prefix);
|
|||
|
||||
void grub_set_more (int onoff);
|
||||
|
||||
int grub_normal_get_line_counter (void);
|
||||
void grub_install_newline_hook (void);
|
||||
int grub_normal_get_char_counter (void);
|
||||
void grub_normal_reset_more (void);
|
||||
|
||||
void grub_xputs_normal (const char *str);
|
||||
|
||||
#endif /* ! GRUB_NORMAL_HEADER */
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/handler.h>
|
||||
#include <grub/reader.h>
|
||||
|
||||
/* All the states for the command line. */
|
||||
|
@ -84,36 +83,9 @@ struct grub_parser
|
|||
};
|
||||
typedef struct grub_parser *grub_parser_t;
|
||||
|
||||
extern struct grub_handler_class EXPORT_VAR(grub_parser_class);
|
||||
grub_err_t EXPORT_FUNC(grub_parser_execute) (char *source);
|
||||
grub_err_t grub_parser_execute (char *source);
|
||||
|
||||
static inline void
|
||||
grub_parser_register (const char *name __attribute__ ((unused)),
|
||||
/* `name' is ignored here, but used by genhandlerlist.sh. */
|
||||
grub_parser_t parser)
|
||||
{
|
||||
grub_handler_register (&grub_parser_class, GRUB_AS_HANDLER (parser));
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_parser_unregister (grub_parser_t parser)
|
||||
{
|
||||
grub_handler_unregister (&grub_parser_class, GRUB_AS_HANDLER (parser));
|
||||
}
|
||||
|
||||
static inline grub_parser_t
|
||||
grub_parser_get_current (void)
|
||||
{
|
||||
return (grub_parser_t) grub_parser_class.cur_handler;
|
||||
}
|
||||
|
||||
static inline grub_err_t
|
||||
grub_parser_set_current (grub_parser_t parser)
|
||||
{
|
||||
return grub_handler_set_current (&grub_parser_class,
|
||||
GRUB_AS_HANDLER (parser));
|
||||
}
|
||||
|
||||
void grub_register_rescue_parser (void);
|
||||
grub_err_t
|
||||
grub_rescue_parse_line (char *line, grub_reader_getline_t getline);
|
||||
|
||||
#endif /* ! GRUB_PARSER_HEADER */
|
||||
|
|
|
@ -48,7 +48,7 @@ struct grub_partition
|
|||
/* The partition number. */
|
||||
int number;
|
||||
|
||||
/* The start sector. */
|
||||
/* The start sector (relative to parent). */
|
||||
grub_disk_addr_t start;
|
||||
|
||||
/* The length in sector units. */
|
||||
|
@ -60,7 +60,7 @@ struct grub_partition
|
|||
/* The index of this partition in the partition table. */
|
||||
int index;
|
||||
|
||||
/* Parent partition map. */
|
||||
/* Parent partition (physically contains this partition). */
|
||||
struct grub_partition *parent;
|
||||
|
||||
/* The type partition map. */
|
||||
|
@ -77,12 +77,14 @@ char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition);
|
|||
|
||||
extern grub_partition_map_t EXPORT_VAR(grub_partition_map_list);
|
||||
|
||||
#ifndef GRUB_LST_GENERATOR
|
||||
static inline void
|
||||
grub_partition_map_register (grub_partition_map_t partmap)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_partition_map_list),
|
||||
GRUB_AS_LIST (partmap));
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
grub_partition_map_unregister (grub_partition_map_t partmap)
|
||||
|
@ -91,7 +93,7 @@ grub_partition_map_unregister (grub_partition_map_t partmap)
|
|||
GRUB_AS_LIST (partmap));
|
||||
}
|
||||
|
||||
#define FOR_PARTITION_MAPS(var) for (var = grub_partition_map_list; var; var = var->next)
|
||||
#define FOR_PARTITION_MAPS(var) FOR_LIST_ELEMENTS((var), (grub_partition_map_list))
|
||||
|
||||
|
||||
static inline grub_disk_addr_t
|
||||
|
|
|
@ -19,8 +19,10 @@
|
|||
#ifndef GRUB_PCI_H
|
||||
#define GRUB_PCI_H 1
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
#endif
|
||||
|
||||
#define GRUB_PCI_ADDR_SPACE_MASK 0x01
|
||||
#define GRUB_PCI_ADDR_SPACE_MEMORY 0x00
|
||||
|
@ -66,6 +68,20 @@
|
|||
#define GRUB_PCI_REG_MIN_GNT 0x3e
|
||||
#define GRUB_PCI_REG_MAX_LAT 0x3f
|
||||
|
||||
#define GRUB_PCI_COMMAND_IO_ENABLED 0x0001
|
||||
#define GRUB_PCI_COMMAND_MEM_ENABLED 0x0002
|
||||
#define GRUB_PCI_COMMAND_BUS_MASTER 0x0004
|
||||
#define GRUB_PCI_COMMAND_PARITY_ERROR 0x0040
|
||||
#define GRUB_PCI_COMMAND_SERR_ENABLE 0x0100
|
||||
|
||||
#define GRUB_PCI_STATUS_CAPABILITIES 0x0010
|
||||
#define GRUB_PCI_STATUS_66MHZ_CAPABLE 0x0020
|
||||
#define GRUB_PCI_STATUS_FAST_B2B_CAPABLE 0x0080
|
||||
|
||||
#define GRUB_PCI_STATUS_DEVSEL_TIMING_SHIFT 9
|
||||
#define GRUB_PCI_STATUS_DEVSEL_TIMING_MASK 0x0600
|
||||
|
||||
#ifndef ASM_FILE
|
||||
typedef grub_uint32_t grub_pci_id_t;
|
||||
|
||||
#ifdef GRUB_MACHINE_EMU
|
||||
|
@ -107,4 +123,14 @@ grub_pci_address_t EXPORT_FUNC(grub_pci_make_address) (grub_pci_device_t dev,
|
|||
|
||||
void EXPORT_FUNC(grub_pci_iterate) (grub_pci_iteratefunc_t hook);
|
||||
|
||||
struct grub_pci_dma_chunk;
|
||||
|
||||
struct grub_pci_dma_chunk *EXPORT_FUNC(grub_memalign_dma32) (grub_size_t align,
|
||||
grub_size_t size);
|
||||
void EXPORT_FUNC(grub_dma_free) (struct grub_pci_dma_chunk *ch);
|
||||
volatile void *EXPORT_FUNC(grub_dma_get_virt) (struct grub_pci_dma_chunk *ch);
|
||||
grub_uint32_t EXPORT_FUNC(grub_dma_get_phys) (struct grub_pci_dma_chunk *ch);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* GRUB_PCI_H */
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2004,2005,2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_CONSOLE_MACHINE_HEADER
|
||||
#define GRUB_CONSOLE_MACHINE_HEADER 1
|
||||
|
||||
/* Initialize the console system. */
|
||||
void grub_console_init (void);
|
||||
|
||||
/* Finish the console system. */
|
||||
void grub_console_fini (void);
|
||||
|
||||
#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */
|
|
@ -1,7 +1,7 @@
|
|||
/* raid.h - On disk structures for RAID. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2006,2007,2008,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
|
||||
|
@ -51,6 +51,8 @@ struct grub_raid_array
|
|||
char *name; /* That will be "md<number>". */
|
||||
unsigned int nr_devs; /* The number of devices we've found so far. */
|
||||
grub_disk_t device[GRUB_RAID_MAX_DEVICES]; /* Array of total_devs devices. */
|
||||
grub_disk_addr_t start_sector[GRUB_RAID_MAX_DEVICES];
|
||||
/* Start of each device, in 512 byte sectors. */
|
||||
struct grub_raid_array *next;
|
||||
};
|
||||
|
||||
|
@ -58,7 +60,8 @@ struct grub_raid
|
|||
{
|
||||
const char *name;
|
||||
|
||||
grub_err_t (*detect) (grub_disk_t disk, struct grub_raid_array *array);
|
||||
grub_err_t (*detect) (grub_disk_t disk, struct grub_raid_array *array,
|
||||
grub_disk_addr_t *start_sector);
|
||||
|
||||
struct grub_raid *next;
|
||||
};
|
||||
|
|
|
@ -341,15 +341,22 @@ struct grub_script_function
|
|||
};
|
||||
typedef struct grub_script_function *grub_script_function_t;
|
||||
|
||||
extern grub_script_function_t grub_script_function_list;
|
||||
|
||||
#define FOR_SCRIPT_FUNCTIONS(var) for((var) = grub_script_function_list; \
|
||||
(var); (var) = (var)->next)
|
||||
|
||||
grub_script_function_t grub_script_function_create (struct grub_script_arg *functionname,
|
||||
struct grub_script *cmd);
|
||||
void grub_script_function_remove (const char *name);
|
||||
grub_script_function_t grub_script_function_find (char *functionname);
|
||||
int grub_script_function_iterate (int (*iterate) (grub_script_function_t));
|
||||
grub_err_t grub_script_function_call (grub_script_function_t func,
|
||||
int argc, char **args);
|
||||
|
||||
char **
|
||||
grub_script_execute_arglist_to_argv (struct grub_script_arglist *arglist, int *count);
|
||||
|
||||
grub_err_t
|
||||
grub_normal_parse_line (char *line, grub_reader_getline_t getline);
|
||||
|
||||
#endif /* ! GRUB_NORMAL_PARSER_HEADER */
|
||||
|
|
|
@ -26,16 +26,35 @@ void grub_scsi_dev_unregister (grub_scsi_dev_t dev);
|
|||
|
||||
struct grub_scsi;
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_SCSI_SUBSYSTEM_USBMS,
|
||||
GRUB_SCSI_SUBSYSTEM_ATAPI
|
||||
};
|
||||
|
||||
#define GRUB_SCSI_ID_SUBSYSTEM_SHIFT 24
|
||||
#define GRUB_SCSI_ID_BUS_SHIFT 8
|
||||
#define GRUB_SCSI_ID_LUN_SHIFT 0
|
||||
|
||||
static inline grub_uint32_t
|
||||
grub_make_scsi_id (int subsystem, int bus, int lun)
|
||||
{
|
||||
return (subsystem << GRUB_SCSI_ID_SUBSYSTEM_SHIFT)
|
||||
| (bus << GRUB_SCSI_ID_BUS_SHIFT) | (lun << GRUB_SCSI_ID_BUS_SHIFT);
|
||||
}
|
||||
|
||||
struct grub_scsi_dev
|
||||
{
|
||||
/* The device name. */
|
||||
const char *name;
|
||||
|
||||
grub_uint8_t id;
|
||||
|
||||
/* Call HOOK with each device name, until HOOK returns non-zero. */
|
||||
int (*iterate) (int (*hook) (const char *name, int luns));
|
||||
int (*iterate) (int (*hook) (int bus, int luns));
|
||||
|
||||
/* Open the device named NAME, and set up SCSI. */
|
||||
grub_err_t (*open) (const char *name, struct grub_scsi *scsi);
|
||||
grub_err_t (*open) (int bus, struct grub_scsi *scsi);
|
||||
|
||||
/* Close the scsi device SCSI. */
|
||||
void (*close) (struct grub_scsi *scsi);
|
||||
|
@ -56,15 +75,14 @@ struct grub_scsi_dev
|
|||
|
||||
struct grub_scsi
|
||||
{
|
||||
/* The scsi device name. */
|
||||
char *name;
|
||||
|
||||
/* The underlying scsi device. */
|
||||
grub_scsi_dev_t dev;
|
||||
|
||||
/* Type of SCSI device. XXX: Make enum. */
|
||||
grub_uint8_t devtype;
|
||||
|
||||
int bus;
|
||||
|
||||
/* Number of LUNs. */
|
||||
int luns;
|
||||
|
||||
|
|
|
@ -25,14 +25,26 @@
|
|||
#define GRUB_SCSI_REMOVABLE_BIT 7
|
||||
#define GRUB_SCSI_LUN_SHIFT 5
|
||||
|
||||
struct grub_scsi_test_unit_ready
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t lun; /* 7-5 LUN, 4-0 reserved */
|
||||
grub_uint8_t reserved1;
|
||||
grub_uint8_t reserved2;
|
||||
grub_uint8_t reserved3;
|
||||
grub_uint8_t control;
|
||||
grub_uint8_t pad[6]; /* To be ATAPI compatible */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_inquiry
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t lun;
|
||||
grub_uint16_t reserved;
|
||||
grub_uint16_t alloc_length;
|
||||
grub_uint8_t reserved2;
|
||||
grub_uint8_t pad[5];
|
||||
grub_uint8_t lun; /* 7-5 LUN, 4-1 reserved, 0 EVPD */
|
||||
grub_uint8_t page; /* page code if EVPD=1 */
|
||||
grub_uint8_t reserved;
|
||||
grub_uint8_t alloc_length;
|
||||
grub_uint8_t control;
|
||||
grub_uint8_t pad[6]; /* To be ATAPI compatible */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_inquiry_data
|
||||
|
@ -47,12 +59,42 @@ struct grub_scsi_inquiry_data
|
|||
char prodrev[4];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_request_sense
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t lun; /* 7-5 LUN, 4-0 reserved */
|
||||
grub_uint8_t reserved1;
|
||||
grub_uint8_t reserved2;
|
||||
grub_uint8_t alloc_length;
|
||||
grub_uint8_t control;
|
||||
grub_uint8_t pad[6]; /* To be ATAPI compatible */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_request_sense_data
|
||||
{
|
||||
grub_uint8_t error_code; /* 7 Valid, 6-0 Err. code */
|
||||
grub_uint8_t segment_number;
|
||||
grub_uint8_t sense_key; /*7 FileMark, 6 EndOfMedia, 5 ILI, 4-0 sense key */
|
||||
grub_uint32_t information;
|
||||
grub_uint8_t additional_sense_length;
|
||||
grub_uint32_t cmd_specific_info;
|
||||
grub_uint8_t additional_sense_code;
|
||||
grub_uint8_t additional_sense_code_qualifier;
|
||||
grub_uint8_t field_replaceable_unit_code;
|
||||
grub_uint8_t sense_key_specific[3];
|
||||
/* there can be additional sense field */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_read_capacity
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t lun;
|
||||
grub_uint8_t reserved[8];
|
||||
grub_uint8_t pad[2];
|
||||
grub_uint8_t lun; /* 7-5 LUN, 4-1 reserved, 0 reserved */
|
||||
grub_uint32_t logical_block_addr; /* only if PMI=1 */
|
||||
grub_uint8_t reserved1;
|
||||
grub_uint8_t reserved2;
|
||||
grub_uint8_t PMI;
|
||||
grub_uint8_t control;
|
||||
grub_uint16_t pad; /* To be ATAPI compatible */
|
||||
} __attribute__((packed));
|
||||
|
||||
struct grub_scsi_read_capacity_data
|
||||
|
@ -105,12 +147,14 @@ struct grub_scsi_write12
|
|||
|
||||
typedef enum
|
||||
{
|
||||
grub_scsi_cmd_test_unit_ready = 0x00,
|
||||
grub_scsi_cmd_request_sense = 0x03,
|
||||
grub_scsi_cmd_inquiry = 0x12,
|
||||
grub_scsi_cmd_read_capacity = 0x25,
|
||||
grub_scsi_cmd_read10 = 0x28,
|
||||
grub_scsi_cmd_write10 = 0x2a,
|
||||
grub_scsi_cmd_read12 = 0xa8,
|
||||
grub_scsi_cmd_write12 = 0xaa
|
||||
grub_scsi_cmd_write12 = 0xaa,
|
||||
} grub_scsi_cmd_t;
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -59,9 +59,15 @@
|
|||
#define UART_DLAB 0x80
|
||||
|
||||
/* Enable the FIFO. */
|
||||
#define UART_ENABLE_FIFO 0xC7
|
||||
#define UART_ENABLE_FIFO_TRIGGER14 0xC7
|
||||
|
||||
/* Enable the FIFO. */
|
||||
#define UART_ENABLE_FIFO_TRIGGER1 0x07
|
||||
|
||||
/* Turn on DTR, RTS, and OUT2. */
|
||||
#define UART_ENABLE_MODEM 0x0B
|
||||
#define UART_ENABLE_DTRRTS 0x03
|
||||
|
||||
/* Turn on DTR, RTS, and OUT2. */
|
||||
#define UART_ENABLE_OUT2 0x08
|
||||
|
||||
#endif /* ! GRUB_SERIAL_MACHINE_HEADER */
|
||||
|
|
70
include/grub/smbus.h
Normal file
70
include/grub/smbus.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_SMBUS_HEADER
|
||||
#define GRUB_SMBUS_HEADER 1
|
||||
|
||||
#define GRUB_SMB_RAM_START_ADDR 0x50
|
||||
#define GRUB_SMB_RAM_NUM_MAX 0x08
|
||||
|
||||
#define GRUB_SMBUS_SPD_MEMORY_TYPE_ADDR 2
|
||||
#define GRUB_SMBUS_SPD_MEMORY_TYPE_DDR2 8
|
||||
#define GRUB_SMBUS_SPD_MEMORY_NUM_BANKS_ADDR 17
|
||||
#define GRUB_SMBUS_SPD_MEMORY_NUM_ROWS_ADDR 3
|
||||
#define GRUB_SMBUS_SPD_MEMORY_NUM_COLUMNS_ADDR 4
|
||||
#define GRUB_SMBUS_SPD_MEMORY_NUM_OF_RANKS_ADDR 5
|
||||
#define GRUB_SMBUS_SPD_MEMORY_NUM_OF_RANKS_MASK 0x7
|
||||
#define GRUB_SMBUS_SPD_MEMORY_CAS_LATENCY_ADDR 18
|
||||
#define GRUB_SMBUS_SPD_MEMORY_CAS_LATENCY_MIN_VALUE 5
|
||||
#define GRUB_SMBUS_SPD_MEMORY_TRAS_ADDR 30
|
||||
#define GRUB_SMBUS_SPD_MEMORY_TRTP_ADDR 38
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
struct grub_smbus_spd
|
||||
{
|
||||
grub_uint8_t written_size;
|
||||
grub_uint8_t log_total_flash_size;
|
||||
grub_uint8_t memory_type;
|
||||
union
|
||||
{
|
||||
grub_uint8_t unknown[253];
|
||||
struct {
|
||||
grub_uint8_t num_rows;
|
||||
grub_uint8_t num_columns;
|
||||
grub_uint8_t num_of_ranks;
|
||||
grub_uint8_t unused1[12];
|
||||
grub_uint8_t num_of_banks;
|
||||
grub_uint8_t unused2[2];
|
||||
grub_uint8_t cas_latency;
|
||||
grub_uint8_t unused3[9];
|
||||
grub_uint8_t rank_capacity;
|
||||
grub_uint8_t unused4[1];
|
||||
grub_uint8_t tras;
|
||||
grub_uint8_t unused5[7];
|
||||
grub_uint8_t trtp;
|
||||
grub_uint8_t unused6[31];
|
||||
grub_uint8_t part_number[18];
|
||||
grub_uint8_t unused7[165];
|
||||
} ddr2;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2004,2005,2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_CONSOLE_MACHINE_HEADER
|
||||
#define GRUB_CONSOLE_MACHINE_HEADER 1
|
||||
|
||||
/* Initialize the console system. */
|
||||
void grub_console_init (void);
|
||||
|
||||
/* Finish the console system. */
|
||||
void grub_console_fini (void);
|
||||
|
||||
#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */
|
|
@ -38,7 +38,8 @@
|
|||
#include <grub/err.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/handler.h>
|
||||
#include <grub/unicode.h>
|
||||
#include <grub/list.h>
|
||||
|
||||
/* These are used to represent the various color states we use. */
|
||||
typedef enum
|
||||
|
@ -63,11 +64,25 @@ grub_term_color_state;
|
|||
to NULL. */
|
||||
|
||||
/* Set when input characters shouldn't be echoed back. */
|
||||
#define GRUB_TERM_NO_ECHO (1 << 0)
|
||||
#define GRUB_TERM_NO_ECHO (1 << 0)
|
||||
/* Set when the editing feature should be disabled. */
|
||||
#define GRUB_TERM_NO_EDIT (1 << 1)
|
||||
#define GRUB_TERM_NO_EDIT (1 << 1)
|
||||
/* Set when the terminal cannot do fancy things. */
|
||||
#define GRUB_TERM_DUMB (1 << 2)
|
||||
#define GRUB_TERM_DUMB (1 << 2)
|
||||
/* Which encoding does terminal expect stream to be. */
|
||||
#define GRUB_TERM_CODE_TYPE_SHIFT 3
|
||||
#define GRUB_TERM_CODE_TYPE_MASK (7 << GRUB_TERM_CODE_TYPE_SHIFT)
|
||||
/* Only ASCII characters accepted. */
|
||||
#define GRUB_TERM_CODE_TYPE_ASCII (0 << GRUB_TERM_CODE_TYPE_SHIFT)
|
||||
/* Expects CP-437 characters (ASCII + pseudographics). */
|
||||
#define GRUB_TERM_CODE_TYPE_CP437 (1 << GRUB_TERM_CODE_TYPE_SHIFT)
|
||||
/* UTF-8 stream in logical order. Usually used for terminals
|
||||
which just forward the stream to another computer. */
|
||||
#define GRUB_TERM_CODE_TYPE_UTF8_LOGICAL (2 << GRUB_TERM_CODE_TYPE_SHIFT)
|
||||
/* UTF-8 in visual order. Like UTF-8 logical but for buggy endpoints. */
|
||||
#define GRUB_TERM_CODE_TYPE_UTF8_VISUAL (3 << GRUB_TERM_CODE_TYPE_SHIFT)
|
||||
/* Glyph description in visual order. */
|
||||
#define GRUB_TERM_CODE_TYPE_VISUAL_GLYPHS (4 << GRUB_TERM_CODE_TYPE_SHIFT)
|
||||
|
||||
|
||||
/* Bitmasks for modifier keys returned by grub_getkeystatus. */
|
||||
|
@ -75,20 +90,6 @@ grub_term_color_state;
|
|||
#define GRUB_TERM_STATUS_CTRL (1 << 1)
|
||||
#define GRUB_TERM_STATUS_ALT (1 << 2)
|
||||
|
||||
|
||||
/* Unicode characters for fancy graphics. */
|
||||
#define GRUB_TERM_DISP_LEFT 0x2190
|
||||
#define GRUB_TERM_DISP_UP 0x2191
|
||||
#define GRUB_TERM_DISP_RIGHT 0x2192
|
||||
#define GRUB_TERM_DISP_DOWN 0x2193
|
||||
#define GRUB_TERM_DISP_HLINE 0x2501
|
||||
#define GRUB_TERM_DISP_VLINE 0x2503
|
||||
#define GRUB_TERM_DISP_UL 0x250F
|
||||
#define GRUB_TERM_DISP_UR 0x2513
|
||||
#define GRUB_TERM_DISP_LL 0x2517
|
||||
#define GRUB_TERM_DISP_LR 0x251B
|
||||
|
||||
|
||||
/* Menu-related geometrical constants. */
|
||||
|
||||
/* The number of lines of "GRUB version..." at the top. */
|
||||
|
@ -122,19 +123,21 @@ struct grub_term_input
|
|||
const char *name;
|
||||
|
||||
/* Initialize the terminal. */
|
||||
grub_err_t (*init) (void);
|
||||
grub_err_t (*init) (struct grub_term_input *term);
|
||||
|
||||
/* Clean up the terminal. */
|
||||
grub_err_t (*fini) (void);
|
||||
grub_err_t (*fini) (struct grub_term_input *term);
|
||||
|
||||
/* Check if any input character is available. */
|
||||
int (*checkkey) (void);
|
||||
int (*checkkey) (struct grub_term_input *term);
|
||||
|
||||
/* Get a character. */
|
||||
int (*getkey) (void);
|
||||
int (*getkey) (struct grub_term_input *term);
|
||||
|
||||
/* Get keyboard modifier status. */
|
||||
int (*getkeystatus) (void);
|
||||
int (*getkeystatus) (struct grub_term_input *term);
|
||||
|
||||
void *data;
|
||||
};
|
||||
typedef struct grub_term_input *grub_term_input_t;
|
||||
|
||||
|
@ -147,52 +150,58 @@ struct grub_term_output
|
|||
const char *name;
|
||||
|
||||
/* Initialize the terminal. */
|
||||
grub_err_t (*init) (void);
|
||||
grub_err_t (*init) (struct grub_term_output *term);
|
||||
|
||||
/* Clean up the terminal. */
|
||||
grub_err_t (*fini) (void);
|
||||
grub_err_t (*fini) (struct grub_term_output *term);
|
||||
|
||||
/* Put a character. C is encoded in Unicode. */
|
||||
void (*putchar) (grub_uint32_t c);
|
||||
void (*putchar) (struct grub_term_output *term,
|
||||
const struct grub_unicode_glyph *c);
|
||||
|
||||
/* Get the number of columns occupied by a given character C. C is
|
||||
encoded in Unicode. */
|
||||
grub_ssize_t (*getcharwidth) (grub_uint32_t c);
|
||||
grub_ssize_t (*getcharwidth) (struct grub_term_output *term,
|
||||
const struct grub_unicode_glyph *c);
|
||||
|
||||
/* Get the screen size. The return value is ((Width << 8) | Height). */
|
||||
grub_uint16_t (*getwh) (void);
|
||||
grub_uint16_t (*getwh) (struct grub_term_output *term);
|
||||
|
||||
/* Get the cursor position. The return value is ((X << 8) | Y). */
|
||||
grub_uint16_t (*getxy) (void);
|
||||
grub_uint16_t (*getxy) (struct grub_term_output *term);
|
||||
|
||||
/* Go to the position (X, Y). */
|
||||
void (*gotoxy) (grub_uint8_t x, grub_uint8_t y);
|
||||
void (*gotoxy) (struct grub_term_output *term,
|
||||
grub_uint8_t x, grub_uint8_t y);
|
||||
|
||||
/* Clear the screen. */
|
||||
void (*cls) (void);
|
||||
void (*cls) (struct grub_term_output *term);
|
||||
|
||||
/* Set the current color to be used */
|
||||
void (*setcolorstate) (grub_term_color_state state);
|
||||
|
||||
/* Set the normal color and the highlight color. The format of each
|
||||
color is VGA's. */
|
||||
void (*setcolor) (grub_uint8_t normal_color, grub_uint8_t highlight_color);
|
||||
|
||||
/* Get the normal color and the highlight color. The format of each
|
||||
color is VGA's. */
|
||||
void (*getcolor) (grub_uint8_t *normal_color, grub_uint8_t *highlight_color);
|
||||
void (*setcolorstate) (struct grub_term_output *term,
|
||||
grub_term_color_state state);
|
||||
|
||||
/* Turn on/off the cursor. */
|
||||
void (*setcursor) (int on);
|
||||
void (*setcursor) (struct grub_term_output *term, int on);
|
||||
|
||||
/* Update the screen. */
|
||||
void (*refresh) (void);
|
||||
void (*refresh) (struct grub_term_output *term);
|
||||
|
||||
/* The feature flags defined above. */
|
||||
grub_uint32_t flags;
|
||||
|
||||
/* Current color state. */
|
||||
grub_uint8_t normal_color;
|
||||
grub_uint8_t highlight_color;
|
||||
|
||||
void *data;
|
||||
};
|
||||
typedef struct grub_term_output *grub_term_output_t;
|
||||
|
||||
#define GRUB_TERM_DEFAULT_NORMAL_COLOR 0x07
|
||||
#define GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR 0x70
|
||||
#define GRUB_TERM_DEFAULT_STANDARD_COLOR 0x07
|
||||
|
||||
extern struct grub_term_output *EXPORT_VAR(grub_term_outputs_disabled);
|
||||
extern struct grub_term_input *EXPORT_VAR(grub_term_inputs_disabled);
|
||||
extern struct grub_term_output *EXPORT_VAR(grub_term_outputs);
|
||||
|
@ -208,11 +217,19 @@ grub_term_register_input (const char *name __attribute__ ((unused)),
|
|||
else
|
||||
{
|
||||
/* If this is the first terminal, enable automatically. */
|
||||
if (! term->init || term->init () == GRUB_ERR_NONE)
|
||||
if (! term->init || term->init (term) == GRUB_ERR_NONE)
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs), GRUB_AS_LIST (term));
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_register_input_active (const char *name __attribute__ ((unused)),
|
||||
grub_term_input_t term)
|
||||
{
|
||||
if (! term->init || term->init (term) == GRUB_ERR_NONE)
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs), GRUB_AS_LIST (term));
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_register_output (const char *name __attribute__ ((unused)),
|
||||
grub_term_output_t term)
|
||||
|
@ -223,12 +240,21 @@ grub_term_register_output (const char *name __attribute__ ((unused)),
|
|||
else
|
||||
{
|
||||
/* If this is the first terminal, enable automatically. */
|
||||
if (! term->init || term->init () == GRUB_ERR_NONE)
|
||||
if (! term->init || term->init (term) == GRUB_ERR_NONE)
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_register_output_active (const char *name __attribute__ ((unused)),
|
||||
grub_term_output_t term)
|
||||
{
|
||||
if (! term->init || term->init (term) == GRUB_ERR_NONE)
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
|
||||
GRUB_AS_LIST (term));
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_unregister_input (grub_term_input_t term)
|
||||
{
|
||||
|
@ -245,19 +271,16 @@ grub_term_unregister_output (grub_term_output_t term)
|
|||
GRUB_AS_LIST (term));
|
||||
}
|
||||
|
||||
#define FOR_ACTIVE_TERM_INPUTS(var) for (var = grub_term_inputs; var; var = var->next)
|
||||
#define FOR_DISABLED_TERM_INPUTS(var) for (var = grub_term_inputs_disabled; var; var = var->next)
|
||||
#define FOR_ACTIVE_TERM_OUTPUTS(var) for (var = grub_term_outputs; var; var = var->next)
|
||||
#define FOR_DISABLED_TERM_OUTPUTS(var) for (var = grub_term_outputs_disabled; var; var = var->next)
|
||||
#define FOR_ACTIVE_TERM_INPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_inputs))
|
||||
#define FOR_DISABLED_TERM_INPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_inputs_disabled))
|
||||
#define FOR_ACTIVE_TERM_OUTPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_outputs))
|
||||
#define FOR_DISABLED_TERM_OUTPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_outputs_disabled))
|
||||
|
||||
void EXPORT_FUNC(grub_putchar) (int c);
|
||||
void EXPORT_FUNC(grub_putcode) (grub_uint32_t code,
|
||||
struct grub_term_output *term);
|
||||
void grub_putcode (grub_uint32_t code, struct grub_term_output *term);
|
||||
int EXPORT_FUNC(grub_getkey) (void);
|
||||
int EXPORT_FUNC(grub_checkkey) (void);
|
||||
int EXPORT_FUNC(grub_getkeystatus) (void);
|
||||
void EXPORT_FUNC(grub_cls) (void);
|
||||
void EXPORT_FUNC(grub_setcolorstate) (grub_term_color_state state);
|
||||
void grub_cls (void);
|
||||
void EXPORT_FUNC(grub_refresh) (void);
|
||||
void grub_puts_terminal (const char *str, struct grub_term_output *term);
|
||||
grub_uint16_t *grub_term_save_pos (void);
|
||||
|
@ -265,12 +288,12 @@ void grub_term_restore_pos (grub_uint16_t *pos);
|
|||
|
||||
static inline unsigned grub_term_width (struct grub_term_output *term)
|
||||
{
|
||||
return ((term->getwh()&0xFF00)>>8);
|
||||
return ((term->getwh(term)&0xFF00)>>8);
|
||||
}
|
||||
|
||||
static inline unsigned grub_term_height (struct grub_term_output *term)
|
||||
{
|
||||
return (term->getwh()&0xFF);
|
||||
return (term->getwh(term)&0xFF);
|
||||
}
|
||||
|
||||
/* The width of the border. */
|
||||
|
@ -314,20 +337,20 @@ grub_term_cursor_x (struct grub_term_output *term)
|
|||
static inline grub_uint16_t
|
||||
grub_term_getxy (struct grub_term_output *term)
|
||||
{
|
||||
return term->getxy ();
|
||||
return term->getxy (term);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_refresh (struct grub_term_output *term)
|
||||
{
|
||||
if (term->refresh)
|
||||
term->refresh ();
|
||||
term->refresh (term);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_gotoxy (struct grub_term_output *term, grub_uint8_t x, grub_uint8_t y)
|
||||
{
|
||||
term->gotoxy (x, y);
|
||||
term->gotoxy (term, x, y);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -335,17 +358,26 @@ grub_term_setcolorstate (struct grub_term_output *term,
|
|||
grub_term_color_state state)
|
||||
{
|
||||
if (term->setcolorstate)
|
||||
term->setcolorstate (state);
|
||||
term->setcolorstate (term, state);
|
||||
}
|
||||
|
||||
/* Set the normal color and the highlight color. The format of each
|
||||
color is VGA's. */
|
||||
static inline void
|
||||
grub_setcolorstate (grub_term_color_state state)
|
||||
{
|
||||
struct grub_term_output *term;
|
||||
|
||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||
grub_term_setcolorstate (term, state);
|
||||
}
|
||||
|
||||
/* Set the normal color and the highlight color. The format of each
|
||||
color is VGA's. */
|
||||
static inline void
|
||||
grub_term_setcolor (struct grub_term_output *term,
|
||||
grub_uint8_t normal_color, grub_uint8_t highlight_color)
|
||||
{
|
||||
if (term->setcolor)
|
||||
term->setcolor (normal_color, highlight_color);
|
||||
term->normal_color = normal_color;
|
||||
term->highlight_color = highlight_color;
|
||||
}
|
||||
|
||||
/* Turn on/off the cursor. */
|
||||
|
@ -353,14 +385,14 @@ static inline void
|
|||
grub_term_setcursor (struct grub_term_output *term, int on)
|
||||
{
|
||||
if (term->setcursor)
|
||||
term->setcursor (on);
|
||||
term->setcursor (term, on);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_term_cls (struct grub_term_output *term)
|
||||
{
|
||||
if (term->cls)
|
||||
(term->cls) ();
|
||||
(term->cls) (term);
|
||||
else
|
||||
{
|
||||
grub_putcode ('\n', term);
|
||||
|
@ -368,11 +400,36 @@ grub_term_cls (struct grub_term_output *term)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_UNIFONT_WIDTHSPEC
|
||||
|
||||
grub_ssize_t
|
||||
grub_unicode_estimate_width (const struct grub_unicode_glyph *c);
|
||||
|
||||
#else
|
||||
|
||||
static inline grub_ssize_t
|
||||
grub_unicode_estimate_width (const struct grub_unicode_glyph *c __attribute__ ((unused)))
|
||||
{
|
||||
if (grub_unicode_get_comb_type (c->base))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static inline grub_ssize_t
|
||||
grub_term_getcharwidth (struct grub_term_output *term, grub_uint32_t c)
|
||||
grub_term_getcharwidth (struct grub_term_output *term,
|
||||
const struct grub_unicode_glyph *c)
|
||||
{
|
||||
if (term->getcharwidth)
|
||||
return term->getcharwidth (c);
|
||||
return term->getcharwidth (term, c);
|
||||
else if (((term->flags & GRUB_TERM_CODE_TYPE_MASK)
|
||||
== GRUB_TERM_CODE_TYPE_UTF8_LOGICAL)
|
||||
|| ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
|
||||
== GRUB_TERM_CODE_TYPE_UTF8_VISUAL)
|
||||
|| ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
|
||||
== GRUB_TERM_CODE_TYPE_VISUAL_GLYPHS))
|
||||
return grub_unicode_estimate_width (c);
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
@ -381,17 +438,10 @@ static inline void
|
|||
grub_term_getcolor (struct grub_term_output *term,
|
||||
grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
|
||||
{
|
||||
if (term->getcolor)
|
||||
term->getcolor (normal_color, highlight_color);
|
||||
else
|
||||
{
|
||||
*normal_color = 0x07;
|
||||
*highlight_color = 0x07;
|
||||
}
|
||||
*normal_color = term->normal_color;
|
||||
*highlight_color = term->highlight_color;
|
||||
}
|
||||
|
||||
extern void (*EXPORT_VAR (grub_newline_hook)) (void);
|
||||
|
||||
struct grub_term_autoload
|
||||
{
|
||||
struct grub_term_autoload *next;
|
||||
|
|
|
@ -23,15 +23,55 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/term.h>
|
||||
|
||||
char *grub_terminfo_get_current (void);
|
||||
grub_err_t grub_terminfo_set_current (const char *);
|
||||
char *EXPORT_FUNC(grub_terminfo_get_current) (struct grub_term_output *term);
|
||||
grub_err_t EXPORT_FUNC(grub_terminfo_set_current) (struct grub_term_output *term,
|
||||
const char *);
|
||||
|
||||
void grub_terminfo_gotoxy (grub_uint8_t x, grub_uint8_t y,
|
||||
grub_term_output_t oterm);
|
||||
void grub_terminfo_cls (grub_term_output_t oterm);
|
||||
void grub_terminfo_reverse_video_on (grub_term_output_t oterm);
|
||||
void grub_terminfo_reverse_video_off (grub_term_output_t oterm);
|
||||
void grub_terminfo_cursor_on (grub_term_output_t oterm);
|
||||
void grub_terminfo_cursor_off (grub_term_output_t oterm);
|
||||
#define GRUB_TERMINFO_READKEY_MAX_LEN 4
|
||||
struct grub_terminfo_input_state
|
||||
{
|
||||
int input_buf[GRUB_TERMINFO_READKEY_MAX_LEN];
|
||||
int npending;
|
||||
int (*readkey) (void);
|
||||
};
|
||||
|
||||
struct grub_terminfo_output_state
|
||||
{
|
||||
struct grub_term_output *next;
|
||||
|
||||
char *name;
|
||||
|
||||
char *gotoxy;
|
||||
char *cls;
|
||||
char *reverse_video_on;
|
||||
char *reverse_video_off;
|
||||
char *cursor_on;
|
||||
char *cursor_off;
|
||||
char *setcolor;
|
||||
|
||||
unsigned int xpos, ypos;
|
||||
|
||||
void (*put) (const int c);
|
||||
};
|
||||
|
||||
void EXPORT_FUNC(grub_terminfo_gotoxy) (grub_term_output_t term,
|
||||
grub_uint8_t x, grub_uint8_t y);
|
||||
void EXPORT_FUNC(grub_terminfo_cls) (grub_term_output_t term);
|
||||
grub_uint16_t EXPORT_FUNC (grub_terminfo_getxy) (struct grub_term_output *term);
|
||||
void EXPORT_FUNC (grub_terminfo_setcursor) (struct grub_term_output *term,
|
||||
const int on);
|
||||
void EXPORT_FUNC (grub_terminfo_setcolorstate) (struct grub_term_output *term,
|
||||
const grub_term_color_state state);
|
||||
|
||||
|
||||
int EXPORT_FUNC (grub_terminfo_checkkey) (struct grub_term_input *term);
|
||||
grub_err_t EXPORT_FUNC (grub_terminfo_input_init) (struct grub_term_input *term);
|
||||
int EXPORT_FUNC (grub_terminfo_getkey) (struct grub_term_input *term);
|
||||
void EXPORT_FUNC (grub_terminfo_putchar) (struct grub_term_output *term,
|
||||
const struct grub_unicode_glyph *c);
|
||||
|
||||
grub_err_t EXPORT_FUNC (grub_terminfo_output_register) (struct grub_term_output *term,
|
||||
const char *type);
|
||||
grub_err_t EXPORT_FUNC (grub_terminfo_output_unregister) (struct grub_term_output *term);
|
||||
|
||||
#endif /* ! GRUB_TERMINFO_HEADER */
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
typedef signed char grub_int8_t;
|
||||
typedef short grub_int16_t;
|
||||
typedef int grub_int32_t;
|
||||
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
||||
#if GRUB_CPU_SIZEOF_LONG == 8
|
||||
typedef long grub_int64_t;
|
||||
#else
|
||||
typedef long long grub_int64_t;
|
||||
|
@ -69,7 +69,7 @@ typedef long long grub_int64_t;
|
|||
typedef unsigned char grub_uint8_t;
|
||||
typedef unsigned short grub_uint16_t;
|
||||
typedef unsigned grub_uint32_t;
|
||||
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
||||
#if GRUB_CPU_SIZEOF_LONG == 8
|
||||
typedef unsigned long grub_uint64_t;
|
||||
#else
|
||||
typedef unsigned long long grub_uint64_t;
|
||||
|
@ -92,13 +92,21 @@ typedef grub_int32_t grub_target_ssize_t;
|
|||
typedef grub_uint64_t grub_addr_t;
|
||||
typedef grub_uint64_t grub_size_t;
|
||||
typedef grub_int64_t grub_ssize_t;
|
||||
|
||||
# if GRUB_CPU_SIZEOF_LONG == 8
|
||||
# define PRIxGRUB_SIZE "lx"
|
||||
# else
|
||||
# define PRIxGRUB_SIZE "llx"
|
||||
# endif
|
||||
#else
|
||||
typedef grub_uint32_t grub_addr_t;
|
||||
typedef grub_uint32_t grub_size_t;
|
||||
typedef grub_int32_t grub_ssize_t;
|
||||
|
||||
# define PRIxGRUB_SIZE "x"
|
||||
#endif
|
||||
|
||||
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
||||
#if GRUB_CPU_SIZEOF_LONG == 8
|
||||
# define GRUB_ULONG_MAX 18446744073709551615UL
|
||||
# define GRUB_LONG_MAX 9223372036854775807L
|
||||
# define GRUB_LONG_MIN (-9223372036854775807L - 1)
|
||||
|
|
272
include/grub/unicode.h
Normal file
272
include/grub/unicode.h
Normal file
|
@ -0,0 +1,272 @@
|
|||
/*
|
||||
* 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_BIDI_HEADER
|
||||
#define GRUB_BIDI_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
|
||||
struct grub_unicode_bidi_pair
|
||||
{
|
||||
grub_uint32_t key;
|
||||
grub_uint32_t replace;
|
||||
};
|
||||
|
||||
struct grub_unicode_compact_range
|
||||
{
|
||||
grub_uint32_t start:21;
|
||||
grub_uint32_t end:21;
|
||||
grub_uint8_t bidi_type:5;
|
||||
grub_uint8_t comb_type;
|
||||
grub_uint8_t bidi_mirror:1;
|
||||
grub_uint8_t join_type:3;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Old-style Arabic shaping. Used for "visual UTF-8" and
|
||||
in grub-mkfont to find variant glyphs in absence of GPOS tables. */
|
||||
struct grub_unicode_arabic_shape
|
||||
{
|
||||
grub_uint32_t code;
|
||||
grub_uint32_t isolated;
|
||||
grub_uint32_t right_linked;
|
||||
grub_uint32_t both_linked;
|
||||
grub_uint32_t left_linked;
|
||||
};
|
||||
|
||||
extern struct grub_unicode_arabic_shape grub_unicode_arabic_shapes[];
|
||||
|
||||
enum grub_bidi_type
|
||||
{
|
||||
GRUB_BIDI_TYPE_L = 0,
|
||||
GRUB_BIDI_TYPE_LRE,
|
||||
GRUB_BIDI_TYPE_LRO,
|
||||
GRUB_BIDI_TYPE_R,
|
||||
GRUB_BIDI_TYPE_AL,
|
||||
GRUB_BIDI_TYPE_RLE,
|
||||
GRUB_BIDI_TYPE_RLO,
|
||||
GRUB_BIDI_TYPE_PDF,
|
||||
GRUB_BIDI_TYPE_EN,
|
||||
GRUB_BIDI_TYPE_ES,
|
||||
GRUB_BIDI_TYPE_ET,
|
||||
GRUB_BIDI_TYPE_AN,
|
||||
GRUB_BIDI_TYPE_CS,
|
||||
GRUB_BIDI_TYPE_NSM,
|
||||
GRUB_BIDI_TYPE_BN,
|
||||
GRUB_BIDI_TYPE_B,
|
||||
GRUB_BIDI_TYPE_S,
|
||||
GRUB_BIDI_TYPE_WS,
|
||||
GRUB_BIDI_TYPE_ON
|
||||
};
|
||||
|
||||
enum grub_join_type
|
||||
{
|
||||
GRUB_JOIN_TYPE_NONJOINING = 0,
|
||||
GRUB_JOIN_TYPE_LEFT = 1,
|
||||
GRUB_JOIN_TYPE_RIGHT = 2,
|
||||
GRUB_JOIN_TYPE_DUAL = 3,
|
||||
GRUB_JOIN_TYPE_CAUSING = 4,
|
||||
GRUB_JOIN_TYPE_TRANSPARENT = 5
|
||||
};
|
||||
|
||||
enum grub_comb_type
|
||||
{
|
||||
GRUB_UNICODE_COMB_NONE = 0,
|
||||
GRUB_UNICODE_COMB_OVERLAY = 1,
|
||||
GRUB_UNICODE_COMB_HEBREW_SHEVA = 10,
|
||||
GRUB_UNICODE_COMB_HEBREW_HATAF_SEGOL = 11,
|
||||
GRUB_UNICODE_COMB_HEBREW_HATAF_PATAH = 12,
|
||||
GRUB_UNICODE_COMB_HEBREW_HATAF_QAMATS = 13,
|
||||
GRUB_UNICODE_COMB_HEBREW_HIRIQ = 14,
|
||||
GRUB_UNICODE_COMB_HEBREW_TSERE = 15,
|
||||
GRUB_UNICODE_COMB_HEBREW_SEGOL = 16,
|
||||
GRUB_UNICODE_COMB_HEBREW_PATAH = 17,
|
||||
GRUB_UNICODE_COMB_HEBREW_QAMATS = 18,
|
||||
GRUB_UNICODE_COMB_HEBREW_HOLAM = 19,
|
||||
GRUB_UNICODE_COMB_HEBREW_QUBUTS = 20,
|
||||
GRUB_UNICODE_COMB_HEBREW_DAGESH = 21,
|
||||
GRUB_UNICODE_COMB_HEBREW_METEG = 22,
|
||||
GRUB_UNICODE_COMB_HEBREW_RAFE = 23,
|
||||
GRUB_UNICODE_COMB_HEBREW_SHIN_DOT = 24,
|
||||
GRUB_UNICODE_COMB_HEBREW_SIN_DOT = 25,
|
||||
GRUB_UNICODE_COMB_HEBREW_VARIKA = 26,
|
||||
GRUB_UNICODE_COMB_ARABIC_FATHATAN = 27,
|
||||
GRUB_UNICODE_COMB_ARABIC_DAMMATAN = 28,
|
||||
GRUB_UNICODE_COMB_ARABIC_KASRATAN = 29,
|
||||
GRUB_UNICODE_COMB_ARABIC_FATHAH = 30,
|
||||
GRUB_UNICODE_COMB_ARABIC_DAMMAH = 31,
|
||||
GRUB_UNICODE_COMB_ARABIC_KASRA = 32,
|
||||
GRUB_UNICODE_COMB_ARABIC_SHADDA = 33,
|
||||
GRUB_UNICODE_COMB_ARABIC_SUKUN = 34,
|
||||
GRUB_UNICODE_COMB_ARABIC_SUPERSCRIPT_ALIF = 35,
|
||||
GRUB_UNICODE_COMB_SYRIAC_SUPERSCRIPT_ALAPH = 36,
|
||||
GRUB_UNICODE_STACK_ATTACHED_BELOW = 202,
|
||||
GRUB_UNICODE_STACK_ATTACHED_ABOVE = 214,
|
||||
GRUB_UNICODE_COMB_ATTACHED_ABOVE_RIGHT = 216,
|
||||
GRUB_UNICODE_STACK_BELOW = 220,
|
||||
GRUB_UNICODE_COMB_BELOW_RIGHT = 222,
|
||||
GRUB_UNICODE_COMB_ABOVE_LEFT = 228,
|
||||
GRUB_UNICODE_STACK_ABOVE = 230,
|
||||
GRUB_UNICODE_COMB_ABOVE_RIGHT = 232,
|
||||
GRUB_UNICODE_COMB_YPOGEGRAMMENI = 240,
|
||||
/* If combining nature is indicated only by class and
|
||||
not "combining type". */
|
||||
GRUB_UNICODE_COMB_ME = 253,
|
||||
GRUB_UNICODE_COMB_MC = 254,
|
||||
GRUB_UNICODE_COMB_MN = 255,
|
||||
};
|
||||
|
||||
/* This structure describes a glyph as opposed to character. */
|
||||
struct grub_unicode_glyph
|
||||
{
|
||||
grub_uint32_t base;
|
||||
grub_uint16_t variant:9;
|
||||
grub_uint8_t attributes:5;
|
||||
grub_size_t ncomb;
|
||||
struct grub_unicode_combining {
|
||||
grub_uint32_t code;
|
||||
enum grub_comb_type type;
|
||||
} *combining;
|
||||
/* Hint by unicode subsystem how wide this character usually is.
|
||||
Real width is determined by font. Set only in UTF-8 stream. */
|
||||
int estimated_width;
|
||||
};
|
||||
|
||||
#define GRUB_UNICODE_GLYPH_ATTRIBUTE_MIRROR 0x1
|
||||
#define GRUB_UNICODE_GLYPH_ATTRIBUTES_JOIN_LEFT_TO_RIGHT_SHIFT 1
|
||||
#define GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED 0x2
|
||||
#define GRUB_UNICODE_GLYPH_ATTRIBUTE_RIGHT_JOINED \
|
||||
(GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED \
|
||||
<< GRUB_UNICODE_GLYPH_ATTRIBUTES_JOIN_LEFT_TO_RIGHT_SHIFT)
|
||||
/* Set iff the corresponding joining flags come from ZWJ or ZWNJ. */
|
||||
#define GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED_EXPLICIT 0x8
|
||||
#define GRUB_UNICODE_GLYPH_ATTRIBUTE_RIGHT_JOINED_EXPLICIT \
|
||||
(GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED_EXPLICIT \
|
||||
<< GRUB_UNICODE_GLYPH_ATTRIBUTES_JOIN_LEFT_TO_RIGHT_SHIFT)
|
||||
#define GRUB_UNICODE_GLYPH_ATTRIBUTES_JOIN \
|
||||
(GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED \
|
||||
| GRUB_UNICODE_GLYPH_ATTRIBUTE_RIGHT_JOINED \
|
||||
| GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED_EXPLICIT \
|
||||
| GRUB_UNICODE_GLYPH_ATTRIBUTE_RIGHT_JOINED_EXPLICIT)
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_UNICODE_COMBINING_GRAPHEME_JOINER = 0x034f,
|
||||
GRUB_UNICODE_HEBREW_WAW = 0x05d5,
|
||||
GRUB_UNICODE_ARABIC_START = 0x0600,
|
||||
GRUB_UNICODE_ARABIC_END = 0x0700,
|
||||
GRUB_UNICODE_THAANA_ABAFILI = 0x07a6,
|
||||
GRUB_UNICODE_THAANA_AABAAFILI = 0x07a7,
|
||||
GRUB_UNICODE_THAANA_IBIFILI = 0x07a8,
|
||||
GRUB_UNICODE_THAANA_EEBEEFILI = 0x07a9,
|
||||
GRUB_UNICODE_THAANA_UBUFILI = 0x07aa,
|
||||
GRUB_UNICODE_THAANA_OOBOOFILI = 0x07ab,
|
||||
GRUB_UNICODE_THAANA_EBEFILI = 0x07ac,
|
||||
GRUB_UNICODE_THAANA_EYBEYFILI = 0x07ad,
|
||||
GRUB_UNICODE_THAANA_OBOFILI = 0x07ae,
|
||||
GRUB_UNICODE_THAANA_OABOAFILI = 0x07af,
|
||||
GRUB_UNICODE_THAANA_SUKUN = 0x07b0,
|
||||
GRUB_UNICODE_ZWNJ = 0x200c,
|
||||
GRUB_UNICODE_ZWJ = 0x200d,
|
||||
GRUB_UNICODE_LEFTARROW = 0x2190,
|
||||
GRUB_UNICODE_UPARROW = 0x2191,
|
||||
GRUB_UNICODE_RIGHTARROW = 0x2192,
|
||||
GRUB_UNICODE_DOWNARROW = 0x2193,
|
||||
GRUB_UNICODE_LIGHT_HLINE = 0x2500,
|
||||
GRUB_UNICODE_HLINE = 0x2501,
|
||||
GRUB_UNICODE_LIGHT_VLINE = 0x2502,
|
||||
GRUB_UNICODE_VLINE = 0x2503,
|
||||
GRUB_UNICODE_LIGHT_CORNER_UL = 0x250c,
|
||||
GRUB_UNICODE_CORNER_UL = 0x250f,
|
||||
GRUB_UNICODE_LIGHT_CORNER_UR = 0x2510,
|
||||
GRUB_UNICODE_CORNER_UR = 0x2513,
|
||||
GRUB_UNICODE_LIGHT_CORNER_LL = 0x2514,
|
||||
GRUB_UNICODE_CORNER_LL = 0x2517,
|
||||
GRUB_UNICODE_LIGHT_CORNER_LR = 0x2518,
|
||||
GRUB_UNICODE_CORNER_LR = 0x251b,
|
||||
GRUB_UNICODE_BLACK_UP_TRIANGLE = 0x25b2,
|
||||
GRUB_UNICODE_BLACK_RIGHT_TRIANGLE = 0x25ba,
|
||||
GRUB_UNICODE_BLACK_DOWN_TRIANGLE = 0x25bc,
|
||||
GRUB_UNICODE_BLACK_LEFT_TRIANGLE = 0x25c4,
|
||||
GRUB_UNICODE_VARIATION_SELECTOR_1 = 0xfe00,
|
||||
GRUB_UNICODE_VARIATION_SELECTOR_16 = 0xfe0f,
|
||||
GRUB_UNICODE_VARIATION_SELECTOR_17 = 0xe0100,
|
||||
GRUB_UNICODE_VARIATION_SELECTOR_256 = 0xe01ef
|
||||
};
|
||||
|
||||
extern struct grub_unicode_compact_range grub_unicode_compact[];
|
||||
extern struct grub_unicode_bidi_pair grub_unicode_bidi_pairs[];
|
||||
|
||||
#define GRUB_UNICODE_MAX_CACHED_CHAR 0x20000
|
||||
/* Unicode mandates an arbitrary limit. */
|
||||
#define GRUB_BIDI_MAX_EXPLICIT_LEVEL 61
|
||||
|
||||
grub_ssize_t
|
||||
grub_bidi_logical_to_visual (const grub_uint32_t *logical,
|
||||
grub_size_t logical_len,
|
||||
struct grub_unicode_glyph **visual_out,
|
||||
grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual),
|
||||
grub_size_t max_width,
|
||||
grub_size_t start_width);
|
||||
|
||||
enum grub_comb_type
|
||||
grub_unicode_get_comb_type (grub_uint32_t c);
|
||||
grub_size_t
|
||||
grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen,
|
||||
struct grub_unicode_glyph *out);
|
||||
|
||||
static inline struct grub_unicode_glyph *
|
||||
grub_unicode_glyph_dup (const struct grub_unicode_glyph *in)
|
||||
{
|
||||
struct grub_unicode_glyph *out = grub_malloc (sizeof (*out));
|
||||
if (!out)
|
||||
return NULL;
|
||||
grub_memcpy (out, in, sizeof (*in));
|
||||
if (in->combining)
|
||||
{
|
||||
out->combining = grub_malloc (in->ncomb * sizeof (*in));
|
||||
if (!out->combining)
|
||||
{
|
||||
grub_free (out);
|
||||
return NULL;
|
||||
}
|
||||
grub_memcpy (out->combining, in->combining, in->ncomb * sizeof (*in));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
static inline struct grub_unicode_glyph *
|
||||
grub_unicode_glyph_from_code (grub_uint32_t code)
|
||||
{
|
||||
struct grub_unicode_glyph *ret;
|
||||
ret = grub_zalloc (sizeof (*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->base = code;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
grub_uint32_t
|
||||
grub_unicode_mirror_code (grub_uint32_t in);
|
||||
grub_uint32_t
|
||||
grub_unicode_shape_code (grub_uint32_t in, grub_uint8_t attr);
|
||||
|
||||
#endif
|
|
@ -35,7 +35,8 @@ typedef enum
|
|||
GRUB_USB_ERR_NAK,
|
||||
GRUB_USB_ERR_BABBLE,
|
||||
GRUB_USB_ERR_TIMEOUT,
|
||||
GRUB_USB_ERR_BITSTUFF
|
||||
GRUB_USB_ERR_BITSTUFF,
|
||||
GRUB_USB_ERR_UNRECOVERABLE
|
||||
} grub_usb_err_t;
|
||||
|
||||
typedef enum
|
||||
|
@ -103,7 +104,7 @@ struct grub_usb_controller_dev
|
|||
grub_err_t (*portstatus) (grub_usb_controller_t dev, unsigned int port,
|
||||
unsigned int enable);
|
||||
|
||||
grub_usb_speed_t (*detect_dev) (grub_usb_controller_t dev, int port);
|
||||
grub_usb_speed_t (*detect_dev) (grub_usb_controller_t dev, int port, int *changed);
|
||||
|
||||
/* The next host controller. */
|
||||
struct grub_usb_controller_dev *next;
|
||||
|
@ -124,6 +125,13 @@ struct grub_usb_interface
|
|||
struct grub_usb_desc_if *descif;
|
||||
|
||||
struct grub_usb_desc_endp *descendp;
|
||||
|
||||
/* A driver is handling this interface. Do we need to support multiple drivers
|
||||
for single interface?
|
||||
*/
|
||||
int attached;
|
||||
|
||||
void (*detach_hook) (struct grub_usb_device *dev, int config, int interface);
|
||||
};
|
||||
|
||||
struct grub_usb_configuration
|
||||
|
@ -156,7 +164,7 @@ struct grub_usb_device
|
|||
int initialized;
|
||||
|
||||
/* Data toggle values (used for bulk transfers only). */
|
||||
int toggle[16];
|
||||
int toggle[256];
|
||||
|
||||
/* Device-specific data. */
|
||||
void *data;
|
||||
|
@ -184,7 +192,12 @@ typedef enum
|
|||
|
||||
typedef enum
|
||||
{
|
||||
GRUB_USBMS_SUBCLASS_BULK = 0x06
|
||||
GRUB_USBMS_SUBCLASS_BULK = 0x06,
|
||||
/* Experimental support for non-pure SCSI devices */
|
||||
GRUB_USBMS_SUBCLASS_RBC = 0x01,
|
||||
GRUB_USBMS_SUBCLASS_MMC2 = 0x02,
|
||||
GRUB_USBMS_SUBCLASS_UFI = 0x04,
|
||||
GRUB_USBMS_SUBCLASS_SFF8070 = 0x05
|
||||
} grub_usbms_subclass_t;
|
||||
|
||||
typedef enum
|
||||
|
@ -201,4 +214,21 @@ grub_usb_get_config_interface (struct grub_usb_desc_config *config)
|
|||
return interf;
|
||||
}
|
||||
|
||||
typedef int (*grub_usb_attach_hook_class) (grub_usb_device_t usbdev,
|
||||
int configno, int interfno);
|
||||
|
||||
struct grub_usb_attach_desc
|
||||
{
|
||||
struct grub_usb_attach_desc *next;
|
||||
int class;
|
||||
grub_usb_attach_hook_class hook;
|
||||
};
|
||||
|
||||
void grub_usb_register_attach_hook_class (struct grub_usb_attach_desc *desc);
|
||||
void grub_usb_unregister_attach_hook_class (struct grub_usb_attach_desc *desc);
|
||||
|
||||
void grub_usb_poll_devices (void);
|
||||
|
||||
void grub_usb_device_attach (grub_usb_device_t dev);
|
||||
|
||||
#endif /* GRUB_USB_H */
|
||||
|
|
|
@ -37,7 +37,7 @@ struct grub_usb_transaction
|
|||
int size;
|
||||
int toggle;
|
||||
grub_transfer_type_t pid;
|
||||
char *data;
|
||||
grub_uint32_t data;
|
||||
};
|
||||
typedef struct grub_usb_transaction *grub_usb_transaction_t;
|
||||
|
||||
|
@ -58,6 +58,9 @@ struct grub_usb_transfer
|
|||
struct grub_usb_device *dev;
|
||||
|
||||
struct grub_usb_transaction *transactions;
|
||||
|
||||
int last_trans;
|
||||
/* Index of last processed transaction in OHCI/UHCI driver. */
|
||||
};
|
||||
typedef struct grub_usb_transfer *grub_usb_transfer_t;
|
||||
|
||||
|
@ -84,15 +87,19 @@ typedef struct grub_usb_transfer *grub_usb_transfer_t;
|
|||
#define GRUB_USB_REQ_SET_INTERFACE 0x0B
|
||||
#define GRUB_USB_REQ_SYNC_FRAME 0x0C
|
||||
|
||||
#define GRUB_USB_REQ_HUB_GET_PORT_STATUS 0x00
|
||||
#define GRUB_USB_FEATURE_ENDP_HALT 0x00
|
||||
#define GRUB_USB_FEATURE_DEV_REMOTE_WU 0x01
|
||||
#define GRUB_USB_FEATURE_TEST_MODE 0x02
|
||||
|
||||
#define GRUB_USB_FEATURE_ENDP_HALT 0x01
|
||||
#define GRUB_USB_FEATURE_DEV_REMOTE_WU 0x02
|
||||
#define GRUB_USB_FEATURE_TEST_MODE 0x04
|
||||
#define GRUB_USB_HUB_FEATURE_PORT_RESET 0x04
|
||||
#define GRUB_USB_HUB_FEATURE_PORT_POWER 0x08
|
||||
#define GRUB_USB_HUB_FEATURE_C_CONNECTED 0x10
|
||||
|
||||
#define GRUB_USB_HUB_STATUS_CONNECTED (1 << 0)
|
||||
#define GRUB_USB_HUB_STATUS_LOWSPEED (1 << 9)
|
||||
#define GRUB_USB_HUB_STATUS_HIGHSPEED (1 << 10)
|
||||
#define GRUB_USB_HUB_STATUS_CONNECTED (1 << 0)
|
||||
#define GRUB_USB_HUB_STATUS_LOWSPEED (1 << 9)
|
||||
#define GRUB_USB_HUB_STATUS_HIGHSPEED (1 << 10)
|
||||
#define GRUB_USB_HUB_STATUS_C_CONNECTED (1 << 16)
|
||||
#define GRUB_USB_HUB_STATUS_C_PORT_RESET (1 << 20)
|
||||
|
||||
struct grub_usb_packet_setup
|
||||
{
|
||||
|
|
195
include/grub/vga.h
Normal file
195
include/grub/vga.h
Normal file
|
@ -0,0 +1,195 @@
|
|||
/*
|
||||
* 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_VGA_HEADER
|
||||
#define GRUB_VGA_HEADER 1
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_VGA_IO_ARX = 0x3c0,
|
||||
GRUB_VGA_IO_SR_INDEX = 0x3c4,
|
||||
GRUB_VGA_IO_SR_DATA = 0x3c5,
|
||||
GRUB_VGA_IO_PIXEL_MASK = 0x3c6,
|
||||
GRUB_VGA_IO_PALLETTE_READ_INDEX = 0x3c7,
|
||||
GRUB_VGA_IO_PALLETTE_WRITE_INDEX = 0x3c8,
|
||||
GRUB_VGA_IO_PALLETTE_DATA = 0x3c9,
|
||||
GRUB_VGA_IO_GR_INDEX = 0x3ce,
|
||||
GRUB_VGA_IO_GR_DATA = 0x3cf,
|
||||
GRUB_VGA_IO_CR_INDEX = 0x3d4,
|
||||
GRUB_VGA_IO_CR_DATA = 0x3d5,
|
||||
GRUB_VGA_IO_INPUT_STATUS1_REGISTER = 0x3da
|
||||
};
|
||||
|
||||
#define GRUB_VGA_IO_INPUT_STATUS1_VERTR_BIT 0x08
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_VGA_CR_WIDTH = 0x01,
|
||||
GRUB_VGA_CR_OVERFLOW = 0x07,
|
||||
GRUB_VGA_CR_CELL_HEIGHT = 0x09,
|
||||
GRUB_VGA_CR_CURSOR_START = 0x0a,
|
||||
GRUB_VGA_CR_CURSOR_END = 0x0b,
|
||||
GRUB_VGA_CR_START_ADDR_HIGH_REGISTER = 0x0c,
|
||||
GRUB_VGA_CR_START_ADDR_LOW_REGISTER = 0x0d,
|
||||
GRUB_VGA_CR_CURSOR_ADDR_HIGH = 0x0e,
|
||||
GRUB_VGA_CR_CURSOR_ADDR_LOW = 0x0f,
|
||||
GRUB_VGA_CR_VSYNC_END = 0x11,
|
||||
GRUB_VGA_CR_HEIGHT = 0x12,
|
||||
GRUB_VGA_CR_PITCH = 0x13,
|
||||
GRUB_VGA_CR_MODE = 0x17,
|
||||
GRUB_VGA_CR_LINE_COMPARE = 0x18,
|
||||
};
|
||||
|
||||
#define GRUB_VGA_CR_WIDTH_DIVISOR 8
|
||||
#define GRUB_VGA_CR_OVERFLOW_HEIGHT1_SHIFT 7
|
||||
#define GRUB_VGA_CR_OVERFLOW_HEIGHT1_MASK 0x02
|
||||
#define GRUB_VGA_CR_OVERFLOW_HEIGHT2_SHIFT 3
|
||||
#define GRUB_VGA_CR_OVERFLOW_HEIGHT2_MASK 0xc0
|
||||
#define GRUB_VGA_CR_OVERFLOW_LINE_COMPARE_SHIFT 4
|
||||
#define GRUB_VGA_CR_OVERFLOW_LINE_COMPARE_MASK 0x10
|
||||
|
||||
#define GRUB_VGA_CR_CELL_HEIGHT_LINE_COMPARE_MASK 0x40
|
||||
#define GRUB_VGA_CR_CELL_HEIGHT_LINE_COMPARE_SHIFT 3
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_VGA_CR_CURSOR_START_DISABLE = (1 << 5)
|
||||
};
|
||||
|
||||
#define GRUB_VGA_CR_PITCH_DIVISOR 8
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_VGA_CR_MODE_NO_CGA = 0x01,
|
||||
GRUB_VGA_CR_MODE_NO_HERCULES = 0x02,
|
||||
GRUB_VGA_CR_MODE_BYTE_MODE = 0x40,
|
||||
GRUB_VGA_CR_MODE_TIMING_ENABLE = 0x80
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_VGA_SR_CLOCKING_MODE = 1,
|
||||
GRUB_VGA_SR_MAP_MASK_REGISTER = 2,
|
||||
GRUB_VGA_SR_MEMORY_MODE = 4,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_VGA_SR_CLOCKING_MODE_8_DOT_CLOCK = 1
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_VGA_SR_MEMORY_MODE_NORMAL = 0,
|
||||
GRUB_VGA_SR_MEMORY_MODE_CHAIN4 = 8
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_VGA_GR_DATA_ROTATE = 3,
|
||||
GRUB_VGA_GR_READ_MAP_REGISTER = 4,
|
||||
GRUB_VGA_GR_MODE = 5,
|
||||
GRUB_VGA_GR_GR6 = 6,
|
||||
GRUB_VGA_GR_BITMASK = 8,
|
||||
GRUB_VGA_GR_MAX
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_VGA_TEXT_TEXT_PLANE = 0,
|
||||
GRUB_VGA_TEXT_ATTR_PLANE = 1,
|
||||
GRUB_VGA_TEXT_FONT_PLANE = 2
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_VGA_GR_GR6_GRAPHICS_MODE = 1,
|
||||
GRUB_VGA_GR_GR6_MMAP_CGA = (3 << 2)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_VGA_GR_MODE_READ_MODE1 = 0x08,
|
||||
GRUB_VGA_GR_MODE_ODD_EVEN = 0x10,
|
||||
GRUB_VGA_GR_MODE_256_COLOR = 0x40
|
||||
};
|
||||
|
||||
static inline void
|
||||
grub_vga_gr_write (grub_uint8_t val, grub_uint8_t addr)
|
||||
{
|
||||
grub_outb (addr, GRUB_VGA_IO_GR_INDEX);
|
||||
grub_outb (val, GRUB_VGA_IO_GR_DATA);
|
||||
}
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_vga_gr_read (grub_uint8_t addr)
|
||||
{
|
||||
grub_outb (addr, GRUB_VGA_IO_GR_INDEX);
|
||||
return grub_inb (GRUB_VGA_IO_GR_DATA);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_vga_cr_write (grub_uint8_t val, grub_uint8_t addr)
|
||||
{
|
||||
grub_outb (addr, GRUB_VGA_IO_CR_INDEX);
|
||||
grub_outb (val, GRUB_VGA_IO_CR_DATA);
|
||||
}
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_vga_cr_read (grub_uint8_t addr)
|
||||
{
|
||||
grub_outb (addr, GRUB_VGA_IO_CR_INDEX);
|
||||
return grub_inb (GRUB_VGA_IO_CR_DATA);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_vga_sr_write (grub_uint8_t val, grub_uint8_t addr)
|
||||
{
|
||||
grub_outb (addr, GRUB_VGA_IO_SR_INDEX);
|
||||
grub_outb (val, GRUB_VGA_IO_SR_DATA);
|
||||
}
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_vga_sr_read (grub_uint8_t addr)
|
||||
{
|
||||
grub_outb (addr, GRUB_VGA_IO_SR_INDEX);
|
||||
return grub_inb (GRUB_VGA_IO_SR_DATA);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_vga_palette_read (grub_uint8_t addr, grub_uint8_t *r, grub_uint8_t *g,
|
||||
grub_uint8_t *b)
|
||||
{
|
||||
grub_outb (addr, GRUB_VGA_IO_PALLETTE_READ_INDEX);
|
||||
*r = grub_inb (GRUB_VGA_IO_PALLETTE_DATA);
|
||||
*g = grub_inb (GRUB_VGA_IO_PALLETTE_DATA);
|
||||
*b = grub_inb (GRUB_VGA_IO_PALLETTE_DATA);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_vga_palette_write (grub_uint8_t addr, grub_uint8_t r, grub_uint8_t g,
|
||||
grub_uint8_t b)
|
||||
{
|
||||
grub_outb (addr, GRUB_VGA_IO_PALLETTE_WRITE_INDEX);
|
||||
grub_outb (r, GRUB_VGA_IO_PALLETTE_DATA);
|
||||
grub_outb (g, GRUB_VGA_IO_PALLETTE_DATA);
|
||||
grub_outb (b, GRUB_VGA_IO_PALLETTE_DATA);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/list.h>
|
||||
|
||||
/* Video color in hardware dependent format. Users should not assume any
|
||||
specific coding format. */
|
||||
|
@ -167,6 +168,15 @@ struct grub_video_rect
|
|||
};
|
||||
typedef struct grub_video_rect grub_video_rect_t;
|
||||
|
||||
struct grub_video_signed_rect
|
||||
{
|
||||
signed x;
|
||||
signed y;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
};
|
||||
typedef struct grub_video_signed_rect grub_video_signed_rect_t;
|
||||
|
||||
struct grub_video_palette_data
|
||||
{
|
||||
grub_uint8_t r; /* Red color value (0-255). */
|
||||
|
@ -182,15 +192,32 @@ typedef enum grub_video_driver_id
|
|||
GRUB_VIDEO_DRIVER_EFI_UGA,
|
||||
GRUB_VIDEO_DRIVER_EFI_GOP,
|
||||
GRUB_VIDEO_DRIVER_SM712,
|
||||
GRUB_VIDEO_DRIVER_VGA
|
||||
GRUB_VIDEO_DRIVER_VGA,
|
||||
GRUB_VIDEO_DRIVER_CIRRUS,
|
||||
GRUB_VIDEO_DRIVER_BOCHS,
|
||||
GRUB_VIDEO_DRIVER_SDL
|
||||
} grub_video_driver_id_t;
|
||||
|
||||
typedef enum grub_video_adapter_prio
|
||||
{
|
||||
GRUB_VIDEO_ADAPTER_PRIO_FALLBACK = 60,
|
||||
GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE_DIRTY = 70,
|
||||
GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE = 80,
|
||||
GRUB_VIDEO_ADAPTER_PRIO_NATIVE = 100
|
||||
} grub_video_adapter_prio_t;
|
||||
|
||||
|
||||
struct grub_video_adapter
|
||||
{
|
||||
/* The next video adapter. */
|
||||
struct grub_video_adapter *next;
|
||||
|
||||
/* The video adapter name. */
|
||||
const char *name;
|
||||
grub_video_driver_id_t id;
|
||||
|
||||
grub_video_adapter_prio_t prio;
|
||||
|
||||
/* Initialize the video adapter. */
|
||||
grub_err_t (*init) (void);
|
||||
|
||||
|
@ -255,15 +282,33 @@ struct grub_video_adapter
|
|||
grub_err_t (*set_active_render_target) (struct grub_video_render_target *target);
|
||||
|
||||
grub_err_t (*get_active_render_target) (struct grub_video_render_target **target);
|
||||
|
||||
/* The next video adapter. */
|
||||
struct grub_video_adapter *next;
|
||||
};
|
||||
typedef struct grub_video_adapter *grub_video_adapter_t;
|
||||
|
||||
void EXPORT_FUNC (grub_video_register) (grub_video_adapter_t adapter);
|
||||
void grub_video_unregister (grub_video_adapter_t adapter);
|
||||
void grub_video_iterate (int (*hook) (grub_video_adapter_t adapter));
|
||||
extern grub_video_adapter_t EXPORT_VAR(grub_video_adapter_list);
|
||||
|
||||
#ifndef GRUB_LST_GENERATOR
|
||||
/* Register video driver. */
|
||||
static inline void
|
||||
grub_video_register (grub_video_adapter_t adapter)
|
||||
{
|
||||
grub_video_adapter_t *p;
|
||||
for (p = &grub_video_adapter_list; *p && (*p)->prio > adapter->prio;
|
||||
p = &((*p)->next));
|
||||
adapter->next = *p;
|
||||
*p = adapter;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Unregister video driver. */
|
||||
static inline void
|
||||
grub_video_unregister (grub_video_adapter_t adapter)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_video_adapter_list),
|
||||
GRUB_AS_LIST (adapter));
|
||||
}
|
||||
|
||||
#define FOR_VIDEO_ADAPTERS(var) FOR_LIST_ELEMENTS((var), (grub_video_adapter_list))
|
||||
|
||||
grub_err_t EXPORT_FUNC (grub_video_restore) (void);
|
||||
|
||||
|
|
|
@ -89,8 +89,8 @@ grub_video_fb_blit_bitmap (struct grub_video_bitmap *bitmap,
|
|||
|
||||
grub_err_t
|
||||
grub_video_fb_blit_render_target (struct grub_video_fbrender_target *source,
|
||||
enum grub_video_blit_operators oper,
|
||||
int x, int y, int offset_x, int offset_y,
|
||||
enum grub_video_blit_operators oper,
|
||||
int x, int y, int offset_x, int offset_y,
|
||||
unsigned int width, unsigned int height);
|
||||
|
||||
grub_err_t
|
||||
|
@ -119,11 +119,18 @@ typedef grub_err_t
|
|||
(*grub_video_fb_doublebuf_update_screen_t) (struct grub_video_fbrender_target *front,
|
||||
struct grub_video_fbrender_target *back);
|
||||
|
||||
typedef grub_err_t (*grub_video_fb_set_page_t) (int page);
|
||||
|
||||
grub_err_t
|
||||
grub_video_fb_doublebuf_blit_init (struct grub_video_fbrender_target **front,
|
||||
struct grub_video_fbrender_target **back,
|
||||
grub_video_fb_doublebuf_update_screen_t *update_screen,
|
||||
struct grub_video_mode_info mode_info,
|
||||
void *framebuf);
|
||||
grub_video_fb_setup (unsigned int mode_type, unsigned int mode_mask,
|
||||
struct grub_video_mode_info *mode_info,
|
||||
volatile void *page0_ptr,
|
||||
grub_video_fb_set_page_t set_page_in,
|
||||
volatile void *page1_ptr);
|
||||
grub_err_t
|
||||
grub_video_fb_swap_buffers (void);
|
||||
grub_err_t
|
||||
grub_video_fb_get_info_and_fini (struct grub_video_mode_info *mode_info,
|
||||
void **framebuf);
|
||||
|
||||
#endif /* ! GRUB_VIDEO_FB_HEADER */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue