merge mainline into cbi
This commit is contained in:
commit
d68538e928
699 changed files with 77518 additions and 15443 deletions
|
@ -19,8 +19,10 @@
|
|||
#ifndef GRUB_ACPI_HEADER
|
||||
#define GRUB_ACPI_HEADER 1
|
||||
|
||||
#ifndef GRUB_DSDT_TEST
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#endif
|
||||
|
||||
struct grub_acpi_rsdp_v10
|
||||
{
|
||||
|
@ -139,6 +141,7 @@ enum
|
|||
GRUB_ACPI_MADT_ENTRY_SAPIC_FLAGS_ENABLED = 1
|
||||
};
|
||||
|
||||
#ifndef GRUB_DSDT_TEST
|
||||
struct grub_acpi_rsdp_v10 *grub_acpi_get_rsdpv1 (void);
|
||||
struct grub_acpi_rsdp_v20 *grub_acpi_get_rsdpv2 (void);
|
||||
struct grub_acpi_rsdp_v10 *grub_machine_acpi_get_rsdpv1 (void);
|
||||
|
@ -148,6 +151,7 @@ grub_uint8_t grub_byte_checksum (void *base, grub_size_t size);
|
|||
grub_err_t grub_acpi_create_ebda (void);
|
||||
|
||||
void grub_acpi_halt (void);
|
||||
#endif
|
||||
|
||||
#define GRUB_ACPI_SLP_EN (1 << 13)
|
||||
#define GRUB_ACPI_SLP_TYP_OFFSET 10
|
||||
|
@ -165,7 +169,8 @@ enum
|
|||
{
|
||||
GRUB_ACPI_EXTOPCODE_MUTEX = 0x01,
|
||||
GRUB_ACPI_EXTOPCODE_OPERATION_REGION = 0x80,
|
||||
GRUB_ACPI_EXTOPCODE_FIELD_OP = 0x81
|
||||
GRUB_ACPI_EXTOPCODE_FIELD_OP = 0x81,
|
||||
GRUB_ACPI_EXTOPCODE_INDEX_FIELD_OP = 0x86,
|
||||
};
|
||||
|
||||
#endif /* ! GRUB_ACPI_HEADER */
|
||||
|
|
266
include/grub/arc/arc.h
Normal file
266
include/grub/arc/arc.h
Normal file
|
@ -0,0 +1,266 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2011 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_ARC_HEADER
|
||||
#define GRUB_ARC_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
|
||||
typedef unsigned grub_arc_enum_t;
|
||||
typedef grub_uint64_t grub_arc_ularge_t;
|
||||
typedef unsigned long grub_arc_ulong_t;
|
||||
typedef long grub_arc_long_t;
|
||||
typedef unsigned short grub_arc_ushort_t;
|
||||
typedef unsigned char grub_arc_uchar_t;
|
||||
|
||||
typedef grub_arc_long_t grub_arc_err_t;
|
||||
typedef grub_arc_ulong_t grub_arc_fileno_t;
|
||||
|
||||
struct grub_arc_memory_descriptor
|
||||
{
|
||||
grub_arc_enum_t type;
|
||||
grub_arc_ulong_t start_page;
|
||||
grub_arc_ulong_t num_pages;
|
||||
};
|
||||
|
||||
enum grub_arc_memory_type
|
||||
{
|
||||
GRUB_ARC_MEMORY_EXCEPTION_BLOCK,
|
||||
GRUB_ARC_MEMORY_SYSTEM_PARAMETER_BLOCK,
|
||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||
GRUB_ARC_MEMORY_FREE_CONTIGUOUS,
|
||||
#endif
|
||||
GRUB_ARC_MEMORY_FREE,
|
||||
GRUB_ARC_MEMORY_BADRAM,
|
||||
GRUB_ARC_MEMORY_LOADED, GRUB_ARC_MEMORY_FW_TEMPORARY,
|
||||
GRUB_ARC_MEMORY_FW_PERMANENT,
|
||||
#ifndef GRUB_CPU_WORDS_BIGENDIAN
|
||||
GRUB_ARC_MEMORY_FREE_CONTIGUOUS,
|
||||
#endif
|
||||
} grub_arc_memory_type_t;
|
||||
|
||||
struct grub_arc_timeinfo
|
||||
{
|
||||
grub_arc_ushort_t y;
|
||||
grub_arc_ushort_t m;
|
||||
grub_arc_ushort_t d;
|
||||
grub_arc_ushort_t h;
|
||||
grub_arc_ushort_t min;
|
||||
grub_arc_ushort_t s;
|
||||
grub_arc_ushort_t ms;
|
||||
};
|
||||
|
||||
struct grub_arc_display_status
|
||||
{
|
||||
grub_arc_ushort_t x;
|
||||
grub_arc_ushort_t y;
|
||||
grub_arc_ushort_t w;
|
||||
grub_arc_ushort_t h;
|
||||
grub_arc_uchar_t fgcolor;
|
||||
grub_arc_uchar_t bgcolor;
|
||||
grub_arc_uchar_t high_intensity;
|
||||
grub_arc_uchar_t underscored;
|
||||
grub_arc_uchar_t reverse_video;
|
||||
};
|
||||
|
||||
struct grub_arc_component
|
||||
{
|
||||
grub_arc_enum_t class;
|
||||
grub_arc_enum_t type;
|
||||
grub_arc_enum_t flags;
|
||||
grub_arc_ushort_t version;
|
||||
grub_arc_ushort_t rev;
|
||||
grub_arc_ulong_t key;
|
||||
grub_arc_ulong_t affinity;
|
||||
grub_arc_ulong_t configdatasize;
|
||||
grub_arc_ulong_t idlen;
|
||||
const char *idstr;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||
GRUB_ARC_COMPONENT_TYPE_ARC = 1,
|
||||
#else
|
||||
GRUB_ARC_COMPONENT_TYPE_ARC,
|
||||
#endif
|
||||
GRUB_ARC_COMPONENT_TYPE_CPU,
|
||||
GRUB_ARC_COMPONENT_TYPE_FPU,
|
||||
GRUB_ARC_COMPONENT_TYPE_PRI_I_CACHE,
|
||||
GRUB_ARC_COMPONENT_TYPE_PRI_D_CACHE,
|
||||
GRUB_ARC_COMPONENT_TYPE_SEC_I_CACHE,
|
||||
GRUB_ARC_COMPONENT_TYPE_SEC_D_CACHE,
|
||||
GRUB_ARC_COMPONENT_TYPE_SEC_CACHE,
|
||||
GRUB_ARC_COMPONENT_TYPE_EISA,
|
||||
GRUB_ARC_COMPONENT_TYPE_TCA,
|
||||
GRUB_ARC_COMPONENT_TYPE_SCSI,
|
||||
GRUB_ARC_COMPONENT_TYPE_DTIA,
|
||||
GRUB_ARC_COMPONENT_TYPE_MULTIFUNC,
|
||||
GRUB_ARC_COMPONENT_TYPE_DISK_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_TAPE_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_CDROM_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_WORM_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_SERIAL_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_NET_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_DISPLAY_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_PARALLEL_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_POINTER_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_KBD_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_AUDIO_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_OTHER_CONTROLLER,
|
||||
GRUB_ARC_COMPONENT_TYPE_DISK,
|
||||
GRUB_ARC_COMPONENT_TYPE_FLOPPY,
|
||||
GRUB_ARC_COMPONENT_TYPE_TAPE,
|
||||
GRUB_ARC_COMPONENT_TYPE_MODEM,
|
||||
GRUB_ARC_COMPONENT_TYPE_MONITOR,
|
||||
GRUB_ARC_COMPONENT_TYPE_PRINTER,
|
||||
GRUB_ARC_COMPONENT_TYPE_POINTER,
|
||||
GRUB_ARC_COMPONENT_TYPE_KBD,
|
||||
GRUB_ARC_COMPONENT_TYPE_TERMINAL,
|
||||
GRUB_ARC_COMPONENT_TYPE_OTHER_PERIPHERAL,
|
||||
GRUB_ARC_COMPONENT_TYPE_LINE,
|
||||
GRUB_ARC_COMPONENT_TYPE_NET,
|
||||
GRUB_ARC_COMPONENT_TYPE_MEMORY_UNIT,
|
||||
};
|
||||
|
||||
enum grub_arc_file_access
|
||||
{
|
||||
GRUB_ARC_FILE_ACCESS_OPEN_RO,
|
||||
GRUB_ARC_FILE_ACCESS_OPEN_WO,
|
||||
GRUB_ARC_FILE_ACCESS_OPEN_RW,
|
||||
};
|
||||
|
||||
struct grub_arc_fileinfo
|
||||
{
|
||||
grub_arc_ularge_t start;
|
||||
grub_arc_ularge_t end;
|
||||
grub_arc_ularge_t current;
|
||||
grub_arc_enum_t type;
|
||||
grub_arc_ulong_t fnamelength;
|
||||
grub_arc_uchar_t attr;
|
||||
char filename[32];
|
||||
};
|
||||
|
||||
struct grub_arc_firmware_vector
|
||||
{
|
||||
/* 0x00. */
|
||||
void *load;
|
||||
void *invoke;
|
||||
void *execute;
|
||||
void *halt;
|
||||
|
||||
/* 0x10. */
|
||||
void (*powerdown) (void);
|
||||
void (*restart) (void);
|
||||
void (*reboot) (void);
|
||||
void (*exit) (void);
|
||||
|
||||
/* 0x20. */
|
||||
void *reserved1;
|
||||
const struct grub_arc_component * (*getpeer) (const struct grub_arc_component *comp);
|
||||
const struct grub_arc_component * (*getchild) (const struct grub_arc_component *comp);
|
||||
void *getparent;
|
||||
|
||||
/* 0x30. */
|
||||
void *getconfigurationdata;
|
||||
void *addchild;
|
||||
void *deletecomponent;
|
||||
void *getcomponent;
|
||||
|
||||
/* 0x40. */
|
||||
void *saveconfiguration;
|
||||
void *getsystemid;
|
||||
struct grub_arc_memory_descriptor *(*getmemorydescriptor) (struct grub_arc_memory_descriptor *current);
|
||||
void *reserved2;
|
||||
|
||||
/* 0x50. */
|
||||
struct grub_arc_timeinfo *(*gettime) (void);
|
||||
void *getrelativetime;
|
||||
void *getdirectoryentry;
|
||||
grub_arc_err_t (*open) (const char *path, grub_arc_enum_t mode,
|
||||
grub_arc_fileno_t *fileno);
|
||||
|
||||
/* 0x60. */
|
||||
grub_arc_err_t (*close) (grub_arc_fileno_t fileno);
|
||||
grub_arc_err_t (*read) (grub_arc_fileno_t fileno, void *buf,
|
||||
grub_arc_ulong_t n,
|
||||
grub_arc_ulong_t *count);
|
||||
grub_arc_err_t (*get_read_status) (grub_arc_fileno_t fileno);
|
||||
grub_arc_err_t (*write) (grub_arc_fileno_t fileno, const void *buf,
|
||||
grub_arc_ulong_t n,
|
||||
grub_arc_ulong_t *count);
|
||||
|
||||
/* 0x70. */
|
||||
grub_arc_err_t (*seek) (grub_arc_fileno_t fileno,
|
||||
grub_arc_ularge_t *pos, grub_arc_enum_t mode);
|
||||
void *mount;
|
||||
void *getenvironmentvariable;
|
||||
void *setenvironmentvariable;
|
||||
|
||||
/* 0x80. */
|
||||
grub_arc_err_t (*getfileinformation) (grub_arc_fileno_t fileno,
|
||||
struct grub_arc_fileinfo *info);
|
||||
void *setfileinformation;
|
||||
void *flushallcaches;
|
||||
void *testunicodecharacter;
|
||||
|
||||
/* 0x90. */
|
||||
struct grub_arc_display_status * (*getdisplaystatus) (grub_arc_fileno_t fileno);
|
||||
};
|
||||
|
||||
struct grub_arc_adapter
|
||||
{
|
||||
grub_arc_ulong_t adapter_type;
|
||||
grub_arc_ulong_t adapter_vector_length;
|
||||
void *adapter_vector;
|
||||
};
|
||||
|
||||
struct grub_arc_system_parameter_block
|
||||
{
|
||||
grub_arc_ulong_t signature;
|
||||
grub_arc_ulong_t length;
|
||||
grub_arc_ushort_t version;
|
||||
grub_arc_ushort_t revision;
|
||||
void *restartblock;
|
||||
void *debugblock;
|
||||
void *gevector;
|
||||
void *utlbmissvector;
|
||||
grub_arc_ulong_t firmware_vector_length;
|
||||
struct grub_arc_firmware_vector *firmwarevector;
|
||||
grub_arc_ulong_t private_vector_length;
|
||||
void *private_vector;
|
||||
grub_arc_ulong_t adapter_count;
|
||||
struct grub_arc_adapter adapters[0];
|
||||
};
|
||||
|
||||
|
||||
#define GRUB_ARC_SYSTEM_PARAMETER_BLOCK ((struct grub_arc_system_parameter_block *) 0xa0001000)
|
||||
#define GRUB_ARC_FIRMWARE_VECTOR (GRUB_ARC_SYSTEM_PARAMETER_BLOCK->firmwarevector)
|
||||
#define GRUB_ARC_STDIN 0
|
||||
#define GRUB_ARC_STDOUT 1
|
||||
|
||||
int EXPORT_FUNC (grub_arc_iterate_devs) (int (*hook) (const char *name, const struct grub_arc_component *comp), int alt_names);
|
||||
|
||||
#define FOR_ARC_CHILDREN(comp, parent) for (comp = GRUB_ARC_FIRMWARE_VECTOR->getchild (parent); comp; comp = GRUB_ARC_FIRMWARE_VECTOR->getpeer (comp))
|
||||
|
||||
extern void grub_arcdisk_init (void);
|
||||
extern void grub_arcdisk_fini (void);
|
||||
|
||||
|
||||
#endif
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2007,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,13 +16,16 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_VGA_MACHINE_HEADER
|
||||
#define GRUB_VGA_MACHINE_HEADER 1
|
||||
#ifndef GRUB_CONSOLE_MACHINE_HEADER
|
||||
#define GRUB_CONSOLE_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/machine/memory.h>
|
||||
|
||||
/* The VGA (at the beginning of upper memory). */
|
||||
#define GRUB_MEMORY_MACHINE_VGA_ADDR GRUB_MEMORY_MACHINE_UPPER
|
||||
/* Initialize the console system. */
|
||||
void grub_console_init_early (void);
|
||||
void grub_console_init_lately (void);
|
||||
|
||||
#endif /* ! GRUB_VGA_MACHINE_HEADER */
|
||||
/* Finish the console system. */
|
||||
void grub_console_fini (void);
|
||||
|
||||
#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <grub/misc.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/disk.h>
|
||||
/* XXX: For now this only works on i386. */
|
||||
#include <grub/cpu/io.h>
|
||||
|
||||
|
@ -82,6 +83,9 @@ enum grub_ata_commands
|
|||
GRUB_ATA_CMD_PACKET = 0xa0,
|
||||
GRUB_ATA_CMD_READ_SECTORS = 0x20,
|
||||
GRUB_ATA_CMD_READ_SECTORS_EXT = 0x24,
|
||||
GRUB_ATA_CMD_READ_SECTORS_DMA = 0xc8,
|
||||
GRUB_ATA_CMD_READ_SECTORS_DMA_EXT = 0x25,
|
||||
|
||||
GRUB_ATA_CMD_SECURITY_FREEZE_LOCK = 0xf5,
|
||||
GRUB_ATA_CMD_SET_FEATURES = 0xef,
|
||||
GRUB_ATA_CMD_SLEEP = 0xe6,
|
||||
|
@ -89,29 +93,76 @@ enum grub_ata_commands
|
|||
GRUB_ATA_CMD_STANDBY_IMMEDIATE = 0xe0,
|
||||
GRUB_ATA_CMD_WRITE_SECTORS = 0x30,
|
||||
GRUB_ATA_CMD_WRITE_SECTORS_EXT = 0x34,
|
||||
GRUB_ATA_CMD_WRITE_SECTORS_DMA_EXT = 0x35,
|
||||
GRUB_ATA_CMD_WRITE_SECTORS_DMA = 0xca,
|
||||
};
|
||||
|
||||
enum grub_ata_timeout_milliseconds
|
||||
{
|
||||
GRUB_ATA_TOUT_STD = 1000, /* 1s standard timeout. */
|
||||
GRUB_ATA_TOUT_DATA = 10000 /* 10s DATA I/O timeout. */
|
||||
GRUB_ATA_TOUT_DATA = 10000, /* 10s DATA I/O timeout. */
|
||||
GRUB_ATA_TOUT_SPINUP = 10000, /* Give the device 10s on first try to spinon. */
|
||||
};
|
||||
|
||||
struct grub_ata_device
|
||||
typedef union
|
||||
{
|
||||
/* IDE port to use. */
|
||||
int port;
|
||||
grub_uint8_t raw[11];
|
||||
struct
|
||||
{
|
||||
union
|
||||
{
|
||||
grub_uint8_t features;
|
||||
grub_uint8_t error;
|
||||
};
|
||||
union
|
||||
{
|
||||
grub_uint8_t sectors;
|
||||
grub_uint8_t atapi_ireason;
|
||||
};
|
||||
union
|
||||
{
|
||||
grub_uint8_t lba_low;
|
||||
grub_uint8_t sectnum;
|
||||
};
|
||||
union
|
||||
{
|
||||
grub_uint8_t lba_mid;
|
||||
grub_uint8_t cyllsb;
|
||||
grub_uint8_t atapi_cntlow;
|
||||
};
|
||||
union
|
||||
{
|
||||
grub_uint8_t lba_high;
|
||||
grub_uint8_t cylmsb;
|
||||
grub_uint8_t atapi_cnthigh;
|
||||
};
|
||||
grub_uint8_t disk;
|
||||
union
|
||||
{
|
||||
grub_uint8_t cmd;
|
||||
grub_uint8_t status;
|
||||
};
|
||||
grub_uint8_t sectors48;
|
||||
grub_uint8_t lba48_low;
|
||||
grub_uint8_t lba48_mid;
|
||||
grub_uint8_t lba48_high;
|
||||
};
|
||||
} grub_ata_regs_t;
|
||||
|
||||
/* IO addresses on which the registers for this device can be
|
||||
found. */
|
||||
grub_port_t ioaddress;
|
||||
grub_port_t ioaddress2;
|
||||
|
||||
/* Two devices can be connected to a single cable. Use this field
|
||||
to select device 0 (commonly known as "master") or device 1
|
||||
(commonly known as "slave"). */
|
||||
int device;
|
||||
/* ATA pass through parameters and function. */
|
||||
struct grub_disk_ata_pass_through_parms
|
||||
{
|
||||
grub_ata_regs_t taskfile;
|
||||
void * buffer;
|
||||
grub_size_t size;
|
||||
int write;
|
||||
void *cmd;
|
||||
int cmdsize;
|
||||
int dma;
|
||||
};
|
||||
|
||||
struct grub_ata
|
||||
{
|
||||
/* Addressing methods available for accessing this device. If CHS
|
||||
is only available, use that. Otherwise use LBA, except for the
|
||||
high sectors. In that case use LBA48. */
|
||||
|
@ -119,6 +170,7 @@ struct grub_ata_device
|
|||
|
||||
/* Sector count. */
|
||||
grub_uint64_t size;
|
||||
grub_uint32_t log_sector_size;
|
||||
|
||||
/* CHS maximums. */
|
||||
grub_uint16_t cylinders;
|
||||
|
@ -128,47 +180,44 @@ struct grub_ata_device
|
|||
/* Set to 0 for ATA, set to 1 for ATAPI. */
|
||||
int atapi;
|
||||
|
||||
struct grub_ata_device *next;
|
||||
int dma;
|
||||
|
||||
grub_size_t maxbuffer;
|
||||
|
||||
int *present;
|
||||
|
||||
void *data;
|
||||
|
||||
struct grub_ata_dev *dev;
|
||||
};
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_ata_wait_not_busy) (struct grub_ata_device *dev,
|
||||
int milliseconds);
|
||||
grub_err_t EXPORT_FUNC(grub_ata_wait_drq) (struct grub_ata_device *dev,
|
||||
int rw, int milliseconds);
|
||||
void EXPORT_FUNC(grub_ata_pio_read) (struct grub_ata_device *dev,
|
||||
char *buf, grub_size_t size);
|
||||
typedef struct grub_ata *grub_ata_t;
|
||||
|
||||
static inline void
|
||||
grub_ata_regset (struct grub_ata_device *dev, int reg, int val)
|
||||
struct grub_ata_dev
|
||||
{
|
||||
grub_outb (val, dev->ioaddress + reg);
|
||||
}
|
||||
/* Call HOOK with each device name, until HOOK returns non-zero. */
|
||||
int (*iterate) (int (*hook) (int id, int bus),
|
||||
grub_disk_pull_t pull);
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_ata_regget (struct grub_ata_device *dev, int reg)
|
||||
{
|
||||
return grub_inb (dev->ioaddress + reg);
|
||||
}
|
||||
/* Open the device named NAME, and set up SCSI. */
|
||||
grub_err_t (*open) (int id, int bus, struct grub_ata *scsi);
|
||||
|
||||
static inline void
|
||||
grub_ata_regset2 (struct grub_ata_device *dev, int reg, int val)
|
||||
{
|
||||
grub_outb (val, dev->ioaddress2 + reg);
|
||||
}
|
||||
/* Close the scsi device SCSI. */
|
||||
void (*close) (struct grub_ata *ata);
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_ata_regget2 (struct grub_ata_device *dev, int reg)
|
||||
{
|
||||
return grub_inb (dev->ioaddress2 + reg);
|
||||
}
|
||||
/* Read SIZE bytes from the device SCSI into BUF after sending the
|
||||
command CMD of size CMDSIZE. */
|
||||
grub_err_t (*readwrite) (struct grub_ata *ata,
|
||||
struct grub_disk_ata_pass_through_parms *parms,
|
||||
int spinup);
|
||||
|
||||
static inline grub_err_t
|
||||
grub_ata_check_ready (struct grub_ata_device *dev)
|
||||
{
|
||||
if (grub_ata_regget (dev, GRUB_ATA_REG_STATUS) & GRUB_ATA_STATUS_BUSY)
|
||||
return grub_ata_wait_not_busy (dev, GRUB_ATA_TOUT_STD);
|
||||
/* The next scsi device. */
|
||||
struct grub_ata_dev *next;
|
||||
};
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
typedef struct grub_ata_dev *grub_ata_dev_t;
|
||||
|
||||
void grub_ata_dev_register (grub_ata_dev_t dev);
|
||||
void grub_ata_dev_unregister (grub_ata_dev_t dev);
|
||||
|
||||
#endif /* ! GRUB_ATA_HEADER */
|
||||
|
|
|
@ -80,7 +80,10 @@ struct grub_partition_bsd_entry
|
|||
struct grub_partition_bsd_disk_label
|
||||
{
|
||||
grub_uint32_t magic;
|
||||
grub_uint8_t padding[128];
|
||||
grub_uint16_t type;
|
||||
grub_uint8_t unused1[18];
|
||||
grub_uint8_t packname[16];
|
||||
grub_uint8_t unused2[92];
|
||||
grub_uint32_t magic2;
|
||||
grub_uint16_t checksum;
|
||||
grub_uint16_t num_partitions;
|
||||
|
|
|
@ -37,4 +37,14 @@ grub_arch_sync_caches (void *address __attribute__ ((unused)),
|
|||
void EXPORT_FUNC(grub_arch_sync_caches) (void *address, grub_size_t len);
|
||||
#endif
|
||||
|
||||
#ifdef _mips
|
||||
void EXPORT_FUNC(grub_arch_sync_dma_caches) (void *address, grub_size_t len);
|
||||
#else
|
||||
static inline void
|
||||
grub_arch_sync_dma_caches (void *address __attribute__ ((unused)),
|
||||
grub_size_t len __attribute__ ((unused)))
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_CACHE_HEADER */
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#define GRUB_UINT8_5_TRAILINGBITS 0x1f
|
||||
#define GRUB_UINT8_6_TRAILINGBITS 0x3f
|
||||
|
||||
#define GRUB_MAX_UTF8_PER_UTF16 4
|
||||
|
||||
#define GRUB_UCS2_LIMIT 0x10000
|
||||
#define GRUB_UTF16_UPPER_SURROGATE(code) \
|
||||
(0xD800 + ((((code) - GRUB_UCS2_LIMIT) >> 12) & 0xfff))
|
||||
|
@ -47,9 +49,35 @@ grub_utf8_to_utf16 (grub_uint16_t *dest, grub_size_t destsize,
|
|||
const grub_uint8_t *src, grub_size_t srcsize,
|
||||
const grub_uint8_t **srcend);
|
||||
|
||||
/* Determine the last position where the UTF-8 string [beg, end) can
|
||||
be safely cut. */
|
||||
static inline grub_size_t
|
||||
grub_getend (const char *beg, const char *end)
|
||||
{
|
||||
const char *ptr;
|
||||
for (ptr = end - 1; ptr >= beg; ptr--)
|
||||
if ((*ptr & GRUB_UINT8_2_LEADINGBITS) != GRUB_UINT8_1_LEADINGBIT)
|
||||
break;
|
||||
if (ptr < beg)
|
||||
return 0;
|
||||
if ((*ptr & GRUB_UINT8_1_LEADINGBIT) == 0)
|
||||
return ptr + 1 - beg;
|
||||
if ((*ptr & GRUB_UINT8_3_LEADINGBITS) == GRUB_UINT8_2_LEADINGBITS
|
||||
&& ptr + 2 <= end)
|
||||
return ptr + 2 - beg;
|
||||
if ((*ptr & GRUB_UINT8_4_LEADINGBITS) == GRUB_UINT8_3_LEADINGBITS
|
||||
&& ptr + 3 <= end)
|
||||
return ptr + 3 - beg;
|
||||
if ((*ptr & GRUB_UINT8_5_LEADINGBITS) == GRUB_UINT8_4_LEADINGBITS
|
||||
&& ptr + 4 <= end)
|
||||
return ptr + 4 - beg;
|
||||
/* Invalid character or incomplete. Cut before it. */
|
||||
return ptr - beg;
|
||||
}
|
||||
|
||||
/* Convert UTF-16 to UTF-8. */
|
||||
static inline grub_uint8_t *
|
||||
grub_utf16_to_utf8 (grub_uint8_t *dest, grub_uint16_t *src,
|
||||
grub_utf16_to_utf8 (grub_uint8_t *dest, const grub_uint16_t *src,
|
||||
grub_size_t size)
|
||||
{
|
||||
grub_uint32_t code_high = 0;
|
||||
|
@ -74,6 +102,8 @@ grub_utf16_to_utf8 (grub_uint8_t *dest, grub_uint16_t *src,
|
|||
{
|
||||
/* Error... */
|
||||
*dest++ = '?';
|
||||
/* *src may be valid. Don't eat it. */
|
||||
src--;
|
||||
}
|
||||
|
||||
code_high = 0;
|
||||
|
@ -97,31 +127,71 @@ grub_utf16_to_utf8 (grub_uint8_t *dest, grub_uint16_t *src,
|
|||
/* Error... */
|
||||
*dest++ = '?';
|
||||
}
|
||||
else
|
||||
else if (code < 0x10000)
|
||||
{
|
||||
*dest++ = (code >> 12) | 0xE0;
|
||||
*dest++ = ((code >> 6) & 0x3F) | 0x80;
|
||||
*dest++ = (code & 0x3F) | 0x80;
|
||||
}
|
||||
else
|
||||
{
|
||||
*dest++ = (code >> 18) | 0xF0;
|
||||
*dest++ = ((code >> 12) & 0x3F) | 0x80;
|
||||
*dest++ = ((code >> 6) & 0x3F) | 0x80;
|
||||
*dest++ = (code & 0x3F) | 0x80;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define GRUB_MAX_UTF8_PER_LATIN1 2
|
||||
|
||||
/* Convert Latin1 to UTF-8. */
|
||||
static inline grub_uint8_t *
|
||||
grub_latin1_to_utf8 (grub_uint8_t *dest, const grub_uint8_t *src,
|
||||
grub_size_t size)
|
||||
{
|
||||
while (size--)
|
||||
{
|
||||
if (!(*src & 0x80))
|
||||
*dest++ = *src;
|
||||
else
|
||||
{
|
||||
*dest++ = (*src >> 6) | 0xC0;
|
||||
*dest++ = (*src & 0x3F) | 0x80;
|
||||
}
|
||||
src++;
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* Convert UCS-4 to UTF-8. */
|
||||
char *grub_ucs4_to_utf8_alloc (grub_uint32_t *src, grub_size_t size);
|
||||
char *grub_ucs4_to_utf8_alloc (const grub_uint32_t *src, grub_size_t size);
|
||||
|
||||
int
|
||||
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);
|
||||
|
||||
/* Process one character from UTF8 sequence.
|
||||
At beginning set *code = 0, *count = 0. Returns 0 on failure and
|
||||
1 on success. *count holds the number of trailing bytes. */
|
||||
int
|
||||
grub_utf8_process (grub_uint8_t c, grub_uint32_t *code, int *count);
|
||||
|
||||
void
|
||||
grub_ucs4_to_utf8 (grub_uint32_t *src, grub_size_t size,
|
||||
grub_ucs4_to_utf8 (const 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);
|
||||
/* Returns -2 if not enough space, -1 on invalid character. */
|
||||
grub_ssize_t
|
||||
grub_encode_utf8_character (grub_uint8_t *dest, grub_uint8_t *destend,
|
||||
grub_uint32_t code);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
#define GRUB_CMOS_H 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#if !defined (__powerpc__) && !defined (__sparc__)
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/cpu/cmos.h>
|
||||
#endif
|
||||
|
||||
#define GRUB_CMOS_INDEX_SECOND 0
|
||||
#define GRUB_CMOS_INDEX_SECOND_ALARM 1
|
||||
|
@ -55,18 +57,56 @@ grub_num_to_bcd (grub_uint8_t a)
|
|||
return (((a / 10) << 4) + (a % 10));
|
||||
}
|
||||
|
||||
static inline grub_uint8_t
|
||||
grub_cmos_read (grub_uint8_t index)
|
||||
#if !defined (__powerpc__) && !defined (__sparc__)
|
||||
static inline grub_err_t
|
||||
grub_cmos_read (grub_uint8_t index, grub_uint8_t *val)
|
||||
{
|
||||
grub_outb (index, GRUB_CMOS_ADDR_REG);
|
||||
return grub_inb (GRUB_CMOS_DATA_REG);
|
||||
*val = grub_inb (GRUB_CMOS_DATA_REG);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static inline void
|
||||
static inline grub_err_t
|
||||
grub_cmos_write (grub_uint8_t index, grub_uint8_t value)
|
||||
{
|
||||
grub_outb (index, GRUB_CMOS_ADDR_REG);
|
||||
grub_outb (value, GRUB_CMOS_DATA_REG);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
#else
|
||||
grub_err_t grub_cmos_find_port (void);
|
||||
extern volatile grub_uint8_t *grub_cmos_port;
|
||||
|
||||
static inline grub_err_t
|
||||
grub_cmos_read (grub_uint8_t index, grub_uint8_t *val)
|
||||
{
|
||||
if (!grub_cmos_port)
|
||||
{
|
||||
grub_err_t err;
|
||||
err = grub_cmos_find_port ();
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
grub_cmos_port[0] = index;
|
||||
*val = grub_cmos_port[1];
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static inline grub_err_t
|
||||
grub_cmos_write (grub_uint8_t index, grub_uint8_t val)
|
||||
{
|
||||
if (!grub_cmos_port)
|
||||
{
|
||||
grub_err_t err;
|
||||
err = grub_cmos_find_port ();
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
grub_cmos_port[0] = index;
|
||||
grub_cmos_port[1] = val;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* GRUB_CMOS_H */
|
||||
|
|
|
@ -49,6 +49,7 @@ struct grub_command
|
|||
{
|
||||
/* The next element. */
|
||||
struct grub_command *next;
|
||||
struct grub_command **prev;
|
||||
|
||||
/* The name. */
|
||||
const char *name;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/mm.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -126,6 +127,9 @@ typedef struct gcry_cipher_spec
|
|||
gcry_cipher_decrypt_t decrypt;
|
||||
gcry_cipher_stencrypt_t stencrypt;
|
||||
gcry_cipher_stdecrypt_t stdecrypt;
|
||||
#ifdef GRUB_UTIL
|
||||
const char *modname;
|
||||
#endif
|
||||
struct gcry_cipher_spec *next;
|
||||
} gcry_cipher_spec_t;
|
||||
|
||||
|
@ -161,6 +165,9 @@ typedef struct gcry_md_spec
|
|||
grub_size_t contextsize; /* allocate this amount of context */
|
||||
/* Block size, needed for HMAC. */
|
||||
grub_size_t blocksize;
|
||||
#ifdef GRUB_UTIL
|
||||
const char *modname;
|
||||
#endif
|
||||
struct gcry_md_spec *next;
|
||||
} gcry_md_spec_t;
|
||||
|
||||
|
@ -185,26 +192,61 @@ grub_crypto_cipher_set_key (grub_crypto_cipher_handle_t cipher,
|
|||
const unsigned char *key,
|
||||
unsigned keylen);
|
||||
|
||||
void
|
||||
grub_crypto_cipher_close (grub_crypto_cipher_handle_t cipher);
|
||||
static inline void
|
||||
grub_crypto_cipher_close (grub_crypto_cipher_handle_t cipher)
|
||||
{
|
||||
grub_free (cipher);
|
||||
}
|
||||
|
||||
void
|
||||
grub_crypto_xor (void *out, const void *in1, const void *in2, grub_size_t size);
|
||||
static inline void
|
||||
grub_crypto_xor (void *out, const void *in1, const void *in2, grub_size_t size)
|
||||
{
|
||||
const grub_uint8_t *in1ptr = in1, *in2ptr = in2;
|
||||
grub_uint8_t *outptr = out;
|
||||
while (size && (((grub_addr_t) in1ptr & (sizeof (grub_uint64_t) - 1))
|
||||
|| ((grub_addr_t) in2ptr & (sizeof (grub_uint64_t) - 1))
|
||||
|| ((grub_addr_t) outptr & (sizeof (grub_uint64_t) - 1))))
|
||||
{
|
||||
*outptr = *in1ptr ^ *in2ptr;
|
||||
in1ptr++;
|
||||
in2ptr++;
|
||||
outptr++;
|
||||
size--;
|
||||
}
|
||||
while (size >= sizeof (grub_uint64_t))
|
||||
{
|
||||
*(grub_uint64_t *) (void *) outptr
|
||||
= (*(grub_uint64_t *) (void *) in1ptr
|
||||
^ *(grub_uint64_t *) (void *) in2ptr);
|
||||
in1ptr += sizeof (grub_uint64_t);
|
||||
in2ptr += sizeof (grub_uint64_t);
|
||||
outptr += sizeof (grub_uint64_t);
|
||||
size -= sizeof (grub_uint64_t);
|
||||
}
|
||||
while (size)
|
||||
{
|
||||
*outptr = *in1ptr ^ *in2ptr;
|
||||
in1ptr++;
|
||||
in2ptr++;
|
||||
outptr++;
|
||||
size--;
|
||||
}
|
||||
}
|
||||
|
||||
gcry_err_code_t
|
||||
grub_crypto_ecb_decrypt (grub_crypto_cipher_handle_t cipher,
|
||||
void *out, void *in, grub_size_t size);
|
||||
void *out, const void *in, grub_size_t size);
|
||||
|
||||
gcry_err_code_t
|
||||
grub_crypto_ecb_encrypt (grub_crypto_cipher_handle_t cipher,
|
||||
void *out, void *in, grub_size_t size);
|
||||
void *out, const void *in, grub_size_t size);
|
||||
gcry_err_code_t
|
||||
grub_crypto_cbc_encrypt (grub_crypto_cipher_handle_t cipher,
|
||||
void *out, void *in, grub_size_t size,
|
||||
void *iv_in);
|
||||
gcry_err_code_t
|
||||
grub_crypto_cbc_decrypt (grub_crypto_cipher_handle_t cipher,
|
||||
void *out, void *in, grub_size_t size,
|
||||
void *out, const void *in, grub_size_t size,
|
||||
void *iv);
|
||||
void
|
||||
grub_cipher_register (gcry_cipher_spec_t *cipher);
|
||||
|
@ -229,7 +271,8 @@ struct grub_crypto_hmac_handle *
|
|||
grub_crypto_hmac_init (const struct gcry_md_spec *md,
|
||||
const void *key, grub_size_t keylen);
|
||||
void
|
||||
grub_crypto_hmac_write (struct grub_crypto_hmac_handle *hnd, void *data,
|
||||
grub_crypto_hmac_write (struct grub_crypto_hmac_handle *hnd,
|
||||
const void *data,
|
||||
grub_size_t datalen);
|
||||
gcry_err_code_t
|
||||
grub_crypto_hmac_fini (struct grub_crypto_hmac_handle *hnd, void *out);
|
||||
|
@ -237,18 +280,20 @@ grub_crypto_hmac_fini (struct grub_crypto_hmac_handle *hnd, void *out);
|
|||
gcry_err_code_t
|
||||
grub_crypto_hmac_buffer (const struct gcry_md_spec *md,
|
||||
const void *key, grub_size_t keylen,
|
||||
void *data, grub_size_t datalen, void *out);
|
||||
const void *data, grub_size_t datalen, void *out);
|
||||
|
||||
extern gcry_md_spec_t _gcry_digest_spec_md5;
|
||||
extern gcry_md_spec_t _gcry_digest_spec_sha1;
|
||||
extern gcry_md_spec_t _gcry_digest_spec_sha256;
|
||||
extern gcry_md_spec_t _gcry_digest_spec_sha512;
|
||||
extern gcry_md_spec_t _gcry_digest_spec_crc32;
|
||||
extern gcry_cipher_spec_t _gcry_cipher_spec_aes;
|
||||
#define GRUB_MD_MD5 ((const gcry_md_spec_t *) &_gcry_digest_spec_md5)
|
||||
#define GRUB_MD_SHA1 ((const gcry_md_spec_t *) &_gcry_digest_spec_sha1)
|
||||
#define GRUB_MD_SHA256 ((const gcry_md_spec_t *) &_gcry_digest_spec_sha256)
|
||||
#define GRUB_MD_SHA512 ((const gcry_md_spec_t *) &_gcry_digest_spec_sha512)
|
||||
#define GRUB_MD_CRC32 ((const gcry_md_spec_t *) &_gcry_digest_spec_crc32)
|
||||
#define GRUB_CIPHER_AES ((const gcry_cipher_spec_t *) &_gcry_cipher_spec_aes)
|
||||
|
||||
/* Implement PKCS#5 PBKDF2 as per RFC 2898. The PRF to use is HMAC variant
|
||||
of digest supplied by MD. Inputs are the password P of length PLEN,
|
||||
|
@ -274,4 +319,10 @@ grub_password_get (char buf[], unsigned buf_size);
|
|||
|
||||
extern void (*grub_crypto_autoload_hook) (const char *name);
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
void grub_gcry_init_all (void);
|
||||
void grub_gcry_fini_all (void);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
149
include/grub/cryptodisk.h
Normal file
149
include/grub/cryptodisk.h
Normal file
|
@ -0,0 +1,149 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_CRYPTODISK_HEADER
|
||||
#define GRUB_CRYPTODISK_HEADER 1
|
||||
|
||||
#include <grub/disk.h>
|
||||
#include <grub/crypto.h>
|
||||
#include <grub/list.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GRUB_CRYPTODISK_MODE_ECB,
|
||||
GRUB_CRYPTODISK_MODE_CBC,
|
||||
GRUB_CRYPTODISK_MODE_PCBC,
|
||||
GRUB_CRYPTODISK_MODE_XTS,
|
||||
GRUB_CRYPTODISK_MODE_LRW
|
||||
} grub_cryptodisk_mode_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GRUB_CRYPTODISK_MODE_IV_NULL,
|
||||
GRUB_CRYPTODISK_MODE_IV_PLAIN,
|
||||
GRUB_CRYPTODISK_MODE_IV_PLAIN64,
|
||||
GRUB_CRYPTODISK_MODE_IV_ESSIV,
|
||||
GRUB_CRYPTODISK_MODE_IV_BENBI,
|
||||
GRUB_CRYPTODISK_MODE_IV_BYTECOUNT64,
|
||||
GRUB_CRYPTODISK_MODE_IV_BYTECOUNT64_HASH
|
||||
} grub_cryptodisk_mode_iv_t;
|
||||
|
||||
#define GRUB_CRYPTODISK_MAX_UUID_LENGTH 71
|
||||
|
||||
#define GRUB_CRYPTODISK_GF_LOG_SIZE 7
|
||||
#define GRUB_CRYPTODISK_GF_SIZE (1U << GRUB_CRYPTODISK_GF_LOG_SIZE)
|
||||
#define GRUB_CRYPTODISK_GF_LOG_BYTES (GRUB_CRYPTODISK_GF_LOG_SIZE - 3)
|
||||
#define GRUB_CRYPTODISK_GF_BYTES (1U << GRUB_CRYPTODISK_GF_LOG_BYTES)
|
||||
|
||||
struct grub_cryptodisk;
|
||||
|
||||
typedef gcry_err_code_t
|
||||
(*grub_cryptodisk_rekey_func_t) (struct grub_cryptodisk *dev,
|
||||
grub_uint64_t zoneno);
|
||||
|
||||
struct grub_cryptodisk
|
||||
{
|
||||
struct grub_cryptodisk *next;
|
||||
struct grub_cryptodisk **prev;
|
||||
|
||||
char *source;
|
||||
grub_disk_addr_t offset;
|
||||
grub_disk_addr_t total_length;
|
||||
grub_disk_t source_disk;
|
||||
int ref;
|
||||
grub_crypto_cipher_handle_t cipher;
|
||||
grub_crypto_cipher_handle_t secondary_cipher;
|
||||
grub_crypto_cipher_handle_t essiv_cipher;
|
||||
const gcry_md_spec_t *essiv_hash, *hash, *iv_hash;
|
||||
grub_cryptodisk_mode_t mode;
|
||||
grub_cryptodisk_mode_iv_t mode_iv;
|
||||
int benbi_log;
|
||||
unsigned long id, source_id;
|
||||
enum grub_disk_dev_id source_dev_id;
|
||||
char uuid[GRUB_CRYPTODISK_MAX_UUID_LENGTH + 1];
|
||||
grub_uint8_t lrw_key[GRUB_CRYPTODISK_GF_BYTES];
|
||||
grub_uint8_t *lrw_precalc;
|
||||
grub_uint8_t iv_prefix[64];
|
||||
grub_size_t iv_prefix_len;
|
||||
#ifdef GRUB_UTIL
|
||||
char *cheat;
|
||||
const char *modname;
|
||||
int cheat_fd;
|
||||
#endif
|
||||
int log_sector_size;
|
||||
grub_cryptodisk_rekey_func_t rekey;
|
||||
int rekey_shift;
|
||||
grub_uint8_t rekey_key[64];
|
||||
grub_uint64_t last_rekey;
|
||||
int rekey_derived_size;
|
||||
};
|
||||
typedef struct grub_cryptodisk *grub_cryptodisk_t;
|
||||
|
||||
struct grub_cryptodisk_dev
|
||||
{
|
||||
struct grub_cryptodisk_dev *next;
|
||||
struct grub_cryptodisk_dev **prev;
|
||||
|
||||
grub_cryptodisk_t (*scan) (grub_disk_t disk, const char *check_uuid,
|
||||
int boot_only);
|
||||
grub_err_t (*recover_key) (grub_disk_t disk, grub_cryptodisk_t dev);
|
||||
};
|
||||
typedef struct grub_cryptodisk_dev *grub_cryptodisk_dev_t;
|
||||
|
||||
extern grub_cryptodisk_dev_t EXPORT_VAR (grub_cryptodisk_list);
|
||||
|
||||
#ifndef GRUB_LST_GENERATOR
|
||||
static inline void
|
||||
grub_cryptodisk_dev_register (grub_cryptodisk_dev_t cr)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_cryptodisk_list), GRUB_AS_LIST (cr));
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
grub_cryptodisk_dev_unregister (grub_cryptodisk_dev_t cr)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST (cr));
|
||||
}
|
||||
|
||||
#define FOR_CRYPTODISK_DEVS(var) FOR_LIST_ELEMENTS((var), (grub_cryptodisk_list))
|
||||
|
||||
gcry_err_code_t
|
||||
grub_cryptodisk_setkey (grub_cryptodisk_t dev,
|
||||
grub_uint8_t *key, grub_size_t keysize);
|
||||
gcry_err_code_t
|
||||
grub_cryptodisk_decrypt (struct grub_cryptodisk *dev,
|
||||
grub_uint8_t * data, grub_size_t len,
|
||||
grub_disk_addr_t sector);
|
||||
grub_err_t
|
||||
grub_cryptodisk_insert (grub_cryptodisk_t newdev, const char *name,
|
||||
grub_disk_t source);
|
||||
#ifdef GRUB_UTIL
|
||||
grub_err_t
|
||||
grub_cryptodisk_cheat_insert (grub_cryptodisk_t newdev, const char *name,
|
||||
grub_disk_t source, const char *cheat);
|
||||
void
|
||||
grub_util_cryptodisk_print_abstraction (grub_disk_t disk);
|
||||
char *
|
||||
grub_util_get_geli_uuid (const char *dev);
|
||||
#endif
|
||||
|
||||
grub_cryptodisk_t grub_cryptodisk_get_by_uuid (const char *uuid);
|
||||
grub_cryptodisk_t grub_cryptodisk_get_by_source_disk (grub_disk_t disk);
|
||||
|
||||
#endif
|
|
@ -26,9 +26,11 @@
|
|||
#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_MAILBOX_CONFIG_ENABLED 0x1
|
||||
#define GRUB_CS5536_MSR_MAILBOX_CONFIG 0xf0
|
||||
#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
|
||||
|
||||
|
@ -73,17 +75,23 @@
|
|||
#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_LEG_IO_UART1_COM1 0x00070000
|
||||
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3 0x00500000
|
||||
#define GRUB_CS5536_MSR_DIVIL_RESET 0x80000017
|
||||
#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_DIVIL_UART1_CONF 0x8000003a
|
||||
#define GRUB_CS5536_MSR_DIVIL_UART2_CONF 0x8000003e
|
||||
|
||||
#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_SMI_ENABLE 0x3f000000000000ULL
|
||||
#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
|
||||
|
|
|
@ -46,10 +46,90 @@ grub_err_t grub_set_datetime (struct grub_datetime *datetime);
|
|||
#endif
|
||||
|
||||
int grub_get_weekday (struct grub_datetime *datetime);
|
||||
char *grub_get_weekday_name (struct grub_datetime *datetime);
|
||||
const char *grub_get_weekday_name (struct grub_datetime *datetime);
|
||||
|
||||
void grub_unixtime2datetime (grub_int32_t nix,
|
||||
struct grub_datetime *datetime);
|
||||
|
||||
static inline int
|
||||
grub_datetime2unixtime (const struct grub_datetime *datetime, grub_int32_t *nix)
|
||||
{
|
||||
grub_int32_t ret;
|
||||
int y4, ay;
|
||||
const grub_uint16_t monthssum[12]
|
||||
= { 0,
|
||||
31,
|
||||
31 + 28,
|
||||
31 + 28 + 31,
|
||||
31 + 28 + 31 + 30,
|
||||
31 + 28 + 31 + 30 + 31,
|
||||
31 + 28 + 31 + 30 + 31 + 30,
|
||||
31 + 28 + 31 + 30 + 31 + 30 + 31,
|
||||
31 + 28 + 31 + 30 + 31 + 30 + 31 + 31,
|
||||
31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30,
|
||||
31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31,
|
||||
31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30};
|
||||
const grub_uint8_t months[12] = {31, 28, 31, 30, 31, 30,
|
||||
31, 31, 30, 31, 30, 31};
|
||||
const int SECPERMIN = 60;
|
||||
const int SECPERHOUR = 60 * SECPERMIN;
|
||||
const int SECPERDAY = 24 * SECPERHOUR;
|
||||
const int SECPERYEAR = 365 * SECPERDAY;
|
||||
const int SECPER4YEARS = 4 * SECPERYEAR + SECPERDAY;
|
||||
|
||||
if (datetime->year > 2038 || datetime->year < 1901)
|
||||
return 0;
|
||||
if (datetime->month > 12 || datetime->month < 1)
|
||||
return 0;
|
||||
|
||||
/* In the period of validity of unixtime all years divisible by 4
|
||||
are bissextile*/
|
||||
/* Convenience: let's have 3 consecutive non-bissextile years
|
||||
at the beginning of the epoch. So count from 1973 instead of 1970 */
|
||||
ret = 3 * SECPERYEAR + SECPERDAY;
|
||||
|
||||
/* Transform C divisions and modulos to mathematical ones */
|
||||
y4 = (datetime->year - 1973) / 4;
|
||||
if (datetime->year < 1973)
|
||||
y4--;
|
||||
ay = datetime->year - 1973 - 4 * y4;
|
||||
ret += y4 * SECPER4YEARS;
|
||||
ret += ay * SECPERYEAR;
|
||||
|
||||
ret += monthssum[datetime->month - 1] * SECPERDAY;
|
||||
if (ay == 0 && datetime->month >= 3)
|
||||
ret += SECPERDAY;
|
||||
|
||||
ret += (datetime->day - 1) * SECPERDAY;
|
||||
if ((datetime->day > months[datetime->month - 1]
|
||||
&& (!ay || datetime->month != 2 || datetime->day != 29))
|
||||
|| datetime->day < 1)
|
||||
return 0;
|
||||
|
||||
ret += datetime->hour * SECPERHOUR;
|
||||
if (datetime->hour > 23)
|
||||
return 0;
|
||||
ret += datetime->minute * 60;
|
||||
if (datetime->minute > 59)
|
||||
return 0;
|
||||
|
||||
ret += datetime->second;
|
||||
/* Accept leap seconds. */
|
||||
if (datetime->second > 60)
|
||||
return 0;
|
||||
|
||||
if ((datetime->year > 1980 && ret < 0)
|
||||
|| (datetime->year < 1960 && ret > 0))
|
||||
return 0;
|
||||
*nix = ret;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if (defined (__powerpc__) || defined (__sparc__)) && !defined (GRUB_UTIL)
|
||||
grub_err_t
|
||||
grub_get_datetime_cmos (struct grub_datetime *datetime);
|
||||
grub_err_t
|
||||
grub_set_datetime_cmos (struct grub_datetime *datetime);
|
||||
#endif
|
||||
|
||||
#endif /* ! KERNEL_DATETIME_HEADER */
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/* raid.h - RAID support for GRUB utils. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2006,2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,11 +16,11 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_RAID_UTIL_HEADER
|
||||
#define GRUB_RAID_UTIL_HEADER 1
|
||||
#ifndef GRUB_DEFLATE_HEADER
|
||||
#define GRUB_DEFLATE_HEADER 1
|
||||
|
||||
grub_ssize_t
|
||||
grub_zlib_decompress (char *inbuf, grub_size_t insize, grub_off_t off,
|
||||
char *outbuf, grub_size_t outsize);
|
||||
|
||||
#ifdef __linux__
|
||||
char** grub_util_raid_getmembers (char *name);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_RAID_UTIL_HEADER */
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
struct grub_disk;
|
||||
struct grub_net;
|
||||
struct grub_fs;
|
||||
|
||||
struct grub_device
|
||||
{
|
||||
|
|
|
@ -32,17 +32,15 @@ enum grub_disk_dev_id
|
|||
GRUB_DISK_DEVICE_OFDISK_ID,
|
||||
GRUB_DISK_DEVICE_LOOPBACK_ID,
|
||||
GRUB_DISK_DEVICE_EFIDISK_ID,
|
||||
GRUB_DISK_DEVICE_RAID_ID,
|
||||
GRUB_DISK_DEVICE_LVM_ID,
|
||||
GRUB_DISK_DEVICE_DISKFILTER_ID,
|
||||
GRUB_DISK_DEVICE_HOST_ID,
|
||||
GRUB_DISK_DEVICE_ATA_ID,
|
||||
GRUB_DISK_DEVICE_MEMDISK_ID,
|
||||
GRUB_DISK_DEVICE_NAND_ID,
|
||||
GRUB_DISK_DEVICE_UUID_ID,
|
||||
GRUB_DISK_DEVICE_PXE_ID,
|
||||
GRUB_DISK_DEVICE_SCSI_ID,
|
||||
GRUB_DISK_DEVICE_FILE_ID,
|
||||
GRUB_DISK_DEVICE_LUKS_ID
|
||||
GRUB_DISK_DEVICE_CRYPTODISK_ID,
|
||||
GRUB_DISK_DEVICE_ARCDISK_ID,
|
||||
GRUB_DISK_DEVICE_HOSTDISK_ID,
|
||||
};
|
||||
|
||||
struct grub_disk;
|
||||
|
@ -50,6 +48,14 @@ struct grub_disk;
|
|||
struct grub_disk_memberlist;
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GRUB_DISK_PULL_NONE,
|
||||
GRUB_DISK_PULL_REMOVABLE,
|
||||
GRUB_DISK_PULL_RESCAN,
|
||||
GRUB_DISK_PULL_MAX
|
||||
} grub_disk_pull_t;
|
||||
|
||||
/* Disk device. */
|
||||
struct grub_disk_dev
|
||||
{
|
||||
|
@ -60,7 +66,8 @@ struct grub_disk_dev
|
|||
enum grub_disk_dev_id id;
|
||||
|
||||
/* Call HOOK with each device name, until HOOK returns non-zero. */
|
||||
int (*iterate) (int (*hook) (const char *name));
|
||||
int (*iterate) (int (*hook) (const char *name),
|
||||
grub_disk_pull_t pull);
|
||||
|
||||
/* Open the device named NAME, and set up DISK. */
|
||||
grub_err_t (*open) (const char *name, struct grub_disk *disk);
|
||||
|
@ -78,6 +85,7 @@ struct grub_disk_dev
|
|||
|
||||
#ifdef GRUB_UTIL
|
||||
struct grub_disk_memberlist *(*memberlist) (struct grub_disk *disk);
|
||||
const char * (*raidname) (struct grub_disk *disk);
|
||||
#endif
|
||||
|
||||
/* The next disk device. */
|
||||
|
@ -85,6 +93,8 @@ struct grub_disk_dev
|
|||
};
|
||||
typedef struct grub_disk_dev *grub_disk_dev_t;
|
||||
|
||||
extern grub_disk_dev_t EXPORT_VAR (grub_disk_dev_list);
|
||||
|
||||
struct grub_partition;
|
||||
|
||||
/* Disk. */
|
||||
|
@ -99,6 +109,9 @@ struct grub_disk
|
|||
/* The total number of sectors. */
|
||||
grub_uint64_t total_sectors;
|
||||
|
||||
/* Logarithm of sector size. */
|
||||
unsigned int log_sector_size;
|
||||
|
||||
/* The id used by the disk cache manager. */
|
||||
unsigned long id;
|
||||
|
||||
|
@ -131,9 +144,10 @@ typedef struct grub_disk_memberlist *grub_disk_memberlist_t;
|
|||
/* The maximum number of disk caches. */
|
||||
#define GRUB_DISK_CACHE_NUM 1021
|
||||
|
||||
/* The size of a disk cache in sector units. */
|
||||
#define GRUB_DISK_CACHE_SIZE 8
|
||||
#define GRUB_DISK_CACHE_BITS 3
|
||||
/* The size of a disk cache in 512B units. Must be at least as big as the
|
||||
largest supported sector size, currently 16K. */
|
||||
#define GRUB_DISK_CACHE_BITS 6
|
||||
#define GRUB_DISK_CACHE_SIZE (1 << GRUB_DISK_CACHE_BITS)
|
||||
|
||||
/* Return value of grub_disk_get_size() in case disk size is unknown. */
|
||||
#define GRUB_DISK_SIZE_UNKNOWN 0xffffffffffffffffULL
|
||||
|
@ -143,7 +157,19 @@ void grub_disk_cache_invalidate_all (void);
|
|||
|
||||
void EXPORT_FUNC(grub_disk_dev_register) (grub_disk_dev_t dev);
|
||||
void EXPORT_FUNC(grub_disk_dev_unregister) (grub_disk_dev_t dev);
|
||||
int EXPORT_FUNC(grub_disk_dev_iterate) (int (*hook) (const char *name));
|
||||
static inline int
|
||||
grub_disk_dev_iterate (int (*hook) (const char *name))
|
||||
{
|
||||
grub_disk_dev_t p;
|
||||
grub_disk_pull_t pull;
|
||||
|
||||
for (pull = 0; pull < GRUB_DISK_PULL_MAX; pull++)
|
||||
for (p = grub_disk_dev_list; p; p = p->next)
|
||||
if (p->iterate && (p->iterate) (hook, pull))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_disk_t EXPORT_FUNC(grub_disk_open) (const char *name);
|
||||
void EXPORT_FUNC(grub_disk_close) (grub_disk_t disk);
|
||||
|
@ -160,29 +186,25 @@ grub_err_t EXPORT_FUNC(grub_disk_write) (grub_disk_t disk,
|
|||
|
||||
grub_uint64_t EXPORT_FUNC(grub_disk_get_size) (grub_disk_t disk);
|
||||
|
||||
#if DISK_CACHE_STATS
|
||||
void
|
||||
EXPORT_FUNC(grub_disk_cache_get_performance) (unsigned long *hits, unsigned long *misses);
|
||||
#endif
|
||||
|
||||
extern void (* EXPORT_VAR(grub_disk_firmware_fini)) (void);
|
||||
extern int EXPORT_VAR(grub_disk_firmware_is_tainted);
|
||||
|
||||
/* ATA pass through parameters and function. */
|
||||
struct grub_disk_ata_pass_through_parms
|
||||
{
|
||||
grub_uint8_t taskfile[8];
|
||||
void * buffer;
|
||||
int size;
|
||||
};
|
||||
|
||||
extern grub_err_t (* EXPORT_VAR(grub_disk_ata_pass_through)) (grub_disk_t,
|
||||
struct grub_disk_ata_pass_through_parms *);
|
||||
|
||||
#if defined (GRUB_UTIL) || defined (GRUB_MACHINE_EMU)
|
||||
void grub_lvm_init (void);
|
||||
void grub_ldm_init (void);
|
||||
void grub_mdraid09_init (void);
|
||||
void grub_mdraid1x_init (void);
|
||||
void grub_raid_init (void);
|
||||
void grub_diskfilter_init (void);
|
||||
void grub_lvm_fini (void);
|
||||
void grub_ldm_fini (void);
|
||||
void grub_mdraid09_fini (void);
|
||||
void grub_mdraid1x_fini (void);
|
||||
void grub_raid_fini (void);
|
||||
void grub_diskfilter_fini (void);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_DISK_HEADER */
|
||||
|
|
191
include/grub/diskfilter.h
Normal file
191
include/grub/diskfilter.h
Normal file
|
@ -0,0 +1,191 @@
|
|||
/* diskfilter.h - On disk structures for RAID. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* 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
|
||||
* 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_DISKFILTER_H
|
||||
#define GRUB_DISKFILTER_H 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/list.h>
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_RAID_LAYOUT_RIGHT_MASK = 1,
|
||||
GRUB_RAID_LAYOUT_SYMMETRIC_MASK = 2,
|
||||
GRUB_RAID_LAYOUT_MUL_FROM_POS = 4,
|
||||
|
||||
GRUB_RAID_LAYOUT_LEFT_ASYMMETRIC = 0,
|
||||
GRUB_RAID_LAYOUT_RIGHT_ASYMMETRIC = GRUB_RAID_LAYOUT_RIGHT_MASK,
|
||||
GRUB_RAID_LAYOUT_LEFT_SYMMETRIC = GRUB_RAID_LAYOUT_SYMMETRIC_MASK,
|
||||
GRUB_RAID_LAYOUT_RIGHT_SYMMETRIC = (GRUB_RAID_LAYOUT_RIGHT_MASK
|
||||
| GRUB_RAID_LAYOUT_SYMMETRIC_MASK)
|
||||
};
|
||||
|
||||
|
||||
struct grub_diskfilter_vg {
|
||||
char *uuid;
|
||||
grub_size_t uuid_len;
|
||||
/* Optional. */
|
||||
char *name;
|
||||
int extent_size;
|
||||
struct grub_diskfilter_pv *pvs;
|
||||
struct grub_diskfilter_lv *lvs;
|
||||
struct grub_diskfilter_vg *next;
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
struct grub_diskfilter *driver;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct grub_diskfilter_pv_id {
|
||||
union
|
||||
{
|
||||
char *uuid;
|
||||
int id;
|
||||
};
|
||||
grub_size_t uuidlen;
|
||||
};
|
||||
|
||||
struct grub_diskfilter_pv {
|
||||
struct grub_diskfilter_pv_id id;
|
||||
/* Optional. */
|
||||
char *name;
|
||||
grub_disk_t disk;
|
||||
grub_disk_addr_t part_start;
|
||||
grub_disk_addr_t part_size;
|
||||
grub_disk_addr_t start_sector; /* Sector number where the data area starts. */
|
||||
struct grub_diskfilter_pv *next;
|
||||
/* Optional. */
|
||||
grub_uint8_t *internal_id;
|
||||
};
|
||||
|
||||
struct grub_diskfilter_lv {
|
||||
/* Name used for disk. */
|
||||
char *fullname;
|
||||
/* Optional. */
|
||||
char *name;
|
||||
int number;
|
||||
unsigned int segment_count;
|
||||
grub_size_t segment_alloc;
|
||||
grub_uint64_t size;
|
||||
int became_readable_at;
|
||||
|
||||
int visible;
|
||||
|
||||
/* Pointer to segment_count segments. */
|
||||
struct grub_diskfilter_segment *segments;
|
||||
struct grub_diskfilter_vg *vg;
|
||||
struct grub_diskfilter_lv *next;
|
||||
|
||||
/* Optional. */
|
||||
char *internal_id;
|
||||
};
|
||||
|
||||
struct grub_diskfilter_segment {
|
||||
unsigned int start_extent;
|
||||
unsigned int extent_count;
|
||||
enum
|
||||
{
|
||||
GRUB_DISKFILTER_STRIPED = 0,
|
||||
GRUB_DISKFILTER_MIRROR = 1,
|
||||
GRUB_DISKFILTER_RAID4 = 4,
|
||||
GRUB_DISKFILTER_RAID5 = 5,
|
||||
GRUB_DISKFILTER_RAID6 = 6,
|
||||
GRUB_DISKFILTER_RAID10 = 10,
|
||||
} type;
|
||||
int layout;
|
||||
/* valid only for raid10. */
|
||||
grub_uint64_t raid_member_size;
|
||||
|
||||
unsigned int node_count;
|
||||
unsigned int node_alloc;
|
||||
struct grub_diskfilter_node *nodes;
|
||||
|
||||
unsigned int stripe_size;
|
||||
};
|
||||
|
||||
struct grub_diskfilter_node {
|
||||
grub_disk_addr_t start;
|
||||
/* Optional. */
|
||||
char *name;
|
||||
struct grub_diskfilter_pv *pv;
|
||||
struct grub_diskfilter_lv *lv;
|
||||
};
|
||||
|
||||
struct grub_diskfilter_vg *
|
||||
grub_diskfilter_get_vg_by_uuid (grub_size_t uuidlen, char *uuid);
|
||||
|
||||
struct grub_diskfilter
|
||||
{
|
||||
struct grub_diskfilter *next;
|
||||
struct grub_diskfilter **prev;
|
||||
|
||||
const char *name;
|
||||
|
||||
struct grub_diskfilter_vg * (*detect) (grub_disk_t disk,
|
||||
struct grub_diskfilter_pv_id *id,
|
||||
grub_disk_addr_t *start_sector);
|
||||
};
|
||||
typedef struct grub_diskfilter *grub_diskfilter_t;
|
||||
|
||||
extern grub_diskfilter_t grub_diskfilter_list;
|
||||
static inline void
|
||||
grub_diskfilter_register (grub_diskfilter_t diskfilter)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_diskfilter_list),
|
||||
GRUB_AS_LIST (diskfilter));
|
||||
}
|
||||
static inline void
|
||||
grub_diskfilter_unregister (grub_diskfilter_t diskfilter)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST (diskfilter));
|
||||
}
|
||||
|
||||
struct grub_diskfilter_vg *
|
||||
grub_diskfilter_make_raid (grub_size_t uuidlen, char *uuid, int nmemb,
|
||||
char *name, grub_uint64_t disk_size,
|
||||
grub_uint64_t stripe_size,
|
||||
int layout, int level);
|
||||
|
||||
typedef grub_err_t (*grub_raid5_recover_func_t) (struct grub_diskfilter_segment *array,
|
||||
int disknr, char *buf,
|
||||
grub_disk_addr_t sector,
|
||||
int size);
|
||||
|
||||
typedef grub_err_t (*grub_raid6_recover_func_t) (struct grub_diskfilter_segment *array,
|
||||
int disknr, int p, char *buf,
|
||||
grub_disk_addr_t sector,
|
||||
int size);
|
||||
|
||||
extern grub_raid5_recover_func_t grub_raid5_recover_func;
|
||||
extern grub_raid6_recover_func_t grub_raid6_recover_func;
|
||||
|
||||
grub_err_t grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg);
|
||||
|
||||
grub_err_t
|
||||
grub_diskfilter_read_node (const struct grub_diskfilter_node *node,
|
||||
grub_disk_addr_t sector,
|
||||
grub_size_t size, char *buf);
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
struct grub_diskfilter_pv *
|
||||
grub_diskfilter_get_pv_from_disk (grub_disk_t disk,
|
||||
struct grub_diskfilter_vg **vg);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_RAID_H */
|
|
@ -21,15 +21,18 @@
|
|||
#define GRUB_DL_H 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#ifndef ASM_FILE
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/elf.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros GRUB_MOD_INIT and GRUB_MOD_FINI are also used by build rules
|
||||
* to collect module names, so we define them only when they are not
|
||||
* defined already.
|
||||
*/
|
||||
#ifndef ASM_FILE
|
||||
|
||||
#ifndef GRUB_MOD_INIT
|
||||
#define GRUB_MOD_INIT(name) \
|
||||
|
@ -51,20 +54,61 @@ static void \
|
|||
grub_mod_fini (void)
|
||||
#endif
|
||||
|
||||
#ifdef APPLE_CC
|
||||
#define GRUB_MOD_NAME(name) \
|
||||
static char grub_modname[] __attribute__ ((section ("_modname, _modname"), used)) = #name;
|
||||
|
||||
#define GRUB_MOD_DEP(name) \
|
||||
__asm__ (".section _moddeps, _moddeps\n.asciz \"" #name "\"\n")
|
||||
#else
|
||||
#define GRUB_MOD_NAME(name) \
|
||||
__asm__ (".section .modname\n.asciz \"" #name "\"\n")
|
||||
|
||||
#define GRUB_MOD_DEP(name) \
|
||||
__asm__ (".section .moddeps\n.asciz \"" #name "\"\n")
|
||||
#endif
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#ifdef APPLE_CC
|
||||
#define GRUB_MOD_SECTION(x) "_" #x ", _" #x ""
|
||||
#else
|
||||
#define GRUB_MOD_SECTION(x) "." #x
|
||||
#endif
|
||||
#else
|
||||
#ifdef APPLE_CC
|
||||
#define GRUB_MOD_SECTION(x) _ ## x , _ ##x
|
||||
#else
|
||||
#define GRUB_MOD_SECTION(x) . ## x
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#define GRUB_MOD_DEP(name) \
|
||||
static const char grub_module_depend_##name[] \
|
||||
__attribute__((section(GRUB_MOD_SECTION(moddeps)), __used__)) = #name
|
||||
#define GRUB_MOD_NAME(name) \
|
||||
static const char grub_module_name_##name[] \
|
||||
__attribute__((section(GRUB_MOD_SECTION(modname)), __used__)) = #name
|
||||
#endif
|
||||
|
||||
/* Me, Vladimir Serbinenko, hereby I add this module check as per new
|
||||
GNU module policy. Note that this license check is informative only.
|
||||
Modules have to be licensed under GPLv3 or GPLv3+ (optionally
|
||||
multi-licensed under other licences as well) independently of the
|
||||
presence of this check and solely by linking (module loading in GRUB
|
||||
constitutes linking) and GRUB core being licensed under GPLv3+.
|
||||
Be sure to understand your license obligations.
|
||||
*/
|
||||
#ifndef ASM_FILE
|
||||
#define GRUB_MOD_LICENSE(license) \
|
||||
static char grub_module_license[] __attribute__ ((section (GRUB_MOD_SECTION (module_license)), used)) = "LICENSE=" license;
|
||||
#define GRUB_MOD_DEP(name) \
|
||||
static const char grub_module_depend_##name[] \
|
||||
__attribute__((section(GRUB_MOD_SECTION(moddeps)), __used__)) = #name
|
||||
#else
|
||||
#define GRUB_MOD_LICENSE(license) \
|
||||
.section GRUB_MOD_SECTION(module_license), "a"; \
|
||||
.ascii "LICENSE="; \
|
||||
.ascii license; \
|
||||
.byte 0
|
||||
#endif
|
||||
|
||||
/* Under GPL license obligations you have to distribute your module
|
||||
under GPLv3(+). However, you can also distribute the same code under
|
||||
another license as long as GPLv3(+) version is provided.
|
||||
*/
|
||||
#define GRUB_MOD_DUAL_LICENSE(x)
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
struct grub_dl_segment
|
||||
{
|
||||
struct grub_dl_segment *next;
|
||||
|
@ -92,6 +136,12 @@ struct grub_dl
|
|||
Elf_Sym *symtab;
|
||||
void (*init) (struct grub_dl *mod);
|
||||
void (*fini) (void);
|
||||
#if defined (__ia64__) || defined (__powerpc__)
|
||||
void *got;
|
||||
void *tramp;
|
||||
#endif
|
||||
void *base;
|
||||
grub_size_t sz;
|
||||
struct grub_dl *next;
|
||||
};
|
||||
typedef struct grub_dl *grub_dl_t;
|
||||
|
@ -109,7 +159,7 @@ extern grub_dl_t EXPORT_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);
|
||||
int isfunc, grub_dl_t mod);
|
||||
|
||||
grub_err_t grub_arch_dl_check_header (void *ehdr);
|
||||
grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
|
||||
|
@ -119,4 +169,31 @@ grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr);
|
|||
void grub_arch_dl_init_linker (void);
|
||||
#endif
|
||||
|
||||
#define GRUB_IA64_DL_TRAMP_ALIGN 16
|
||||
#define GRUB_IA64_DL_TRAMP_SIZE 48
|
||||
#define GRUB_IA64_DL_GOT_ALIGN 16
|
||||
|
||||
void
|
||||
grub_ia64_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
||||
grub_size_t *got);
|
||||
|
||||
#if defined (__ia64__)
|
||||
#define GRUB_ARCH_DL_TRAMP_ALIGN GRUB_IA64_DL_TRAMP_ALIGN
|
||||
#define GRUB_ARCH_DL_GOT_ALIGN GRUB_IA64_DL_GOT_ALIGN
|
||||
#define GRUB_ARCH_DL_TRAMP_SIZE GRUB_IA64_DL_TRAMP_SIZE
|
||||
#define grub_arch_dl_get_tramp_got_size grub_ia64_dl_get_tramp_got_size
|
||||
#else
|
||||
void
|
||||
grub_arch_dl_get_tramp_got_size (const void *ehdr, grub_size_t *tramp,
|
||||
grub_size_t *got);
|
||||
#endif
|
||||
|
||||
#ifdef __powerpc__
|
||||
#define GRUB_ARCH_DL_TRAMP_SIZE 16
|
||||
#define GRUB_ARCH_DL_TRAMP_ALIGN 4
|
||||
#define GRUB_ARCH_DL_GOT_ALIGN 4
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_DL_H */
|
||||
|
|
|
@ -84,6 +84,16 @@
|
|||
{ 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
|
||||
}
|
||||
|
||||
#define GRUB_EFI_SIMPLE_NETWORK_GUID \
|
||||
{ 0xa19832b9, 0xac25, 0x11d3, \
|
||||
{ 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
|
||||
}
|
||||
|
||||
#define GRUB_EFI_PXE_GUID \
|
||||
{ 0x03c4e603, 0xac28, 0x11d3, \
|
||||
{ 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
|
||||
}
|
||||
|
||||
#define GRUB_EFI_DEVICE_PATH_GUID \
|
||||
{ 0x09576e91, 0x6d3f, 0x11d2, \
|
||||
{ 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
|
||||
|
@ -361,7 +371,7 @@ struct grub_efi_memory_descriptor
|
|||
grub_efi_virtual_address_t virtual_start;
|
||||
grub_efi_uint64_t num_pages;
|
||||
grub_efi_uint64_t attribute;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_memory_descriptor grub_efi_memory_descriptor_t;
|
||||
|
||||
/* Device Path definitions. */
|
||||
|
@ -406,7 +416,7 @@ struct grub_efi_pci_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_uint8_t function;
|
||||
grub_efi_uint8_t device;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_pci_device_path grub_efi_pci_device_path_t;
|
||||
|
||||
#define GRUB_EFI_PCCARD_DEVICE_PATH_SUBTYPE 2
|
||||
|
@ -415,7 +425,7 @@ struct grub_efi_pccard_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_uint8_t function;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_pccard_device_path grub_efi_pccard_device_path_t;
|
||||
|
||||
#define GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE 3
|
||||
|
@ -423,10 +433,10 @@ typedef struct grub_efi_pccard_device_path grub_efi_pccard_device_path_t;
|
|||
struct grub_efi_memory_mapped_device_path
|
||||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_memory_type_t memory_type;
|
||||
grub_efi_uint32_t memory_type;
|
||||
grub_efi_physical_address_t start_address;
|
||||
grub_efi_physical_address_t end_address;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_memory_mapped_device_path grub_efi_memory_mapped_device_path_t;
|
||||
|
||||
#define GRUB_EFI_VENDOR_DEVICE_PATH_SUBTYPE 4
|
||||
|
@ -436,7 +446,7 @@ struct grub_efi_vendor_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_guid_t vendor_guid;
|
||||
grub_efi_uint8_t vendor_defined_data[0];
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_vendor_device_path grub_efi_vendor_device_path_t;
|
||||
|
||||
#define GRUB_EFI_CONTROLLER_DEVICE_PATH_SUBTYPE 5
|
||||
|
@ -445,7 +455,7 @@ struct grub_efi_controller_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_uint32_t controller_number;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_controller_device_path grub_efi_controller_device_path_t;
|
||||
|
||||
/* ACPI Device Path. */
|
||||
|
@ -458,7 +468,7 @@ struct grub_efi_acpi_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_uint32_t hid;
|
||||
grub_efi_uint32_t uid;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_acpi_device_path grub_efi_acpi_device_path_t;
|
||||
|
||||
#define GRUB_EFI_EXPANDED_ACPI_DEVICE_PATH_SUBTYPE 2
|
||||
|
@ -469,8 +479,8 @@ struct grub_efi_expanded_acpi_device_path
|
|||
grub_efi_uint32_t hid;
|
||||
grub_efi_uint32_t uid;
|
||||
grub_efi_uint32_t cid;
|
||||
char hidstr[1];
|
||||
};
|
||||
char hidstr[0];
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_expanded_acpi_device_path grub_efi_expanded_acpi_device_path_t;
|
||||
|
||||
#define GRUB_EFI_EXPANDED_ACPI_HIDSTR(dp) \
|
||||
|
@ -493,7 +503,7 @@ struct grub_efi_atapi_device_path
|
|||
grub_efi_uint8_t primary_secondary;
|
||||
grub_efi_uint8_t slave_master;
|
||||
grub_efi_uint16_t lun;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_atapi_device_path grub_efi_atapi_device_path_t;
|
||||
|
||||
#define GRUB_EFI_SCSI_DEVICE_PATH_SUBTYPE 2
|
||||
|
@ -503,7 +513,7 @@ struct grub_efi_scsi_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_uint16_t pun;
|
||||
grub_efi_uint16_t lun;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_scsi_device_path grub_efi_scsi_device_path_t;
|
||||
|
||||
#define GRUB_EFI_FIBRE_CHANNEL_DEVICE_PATH_SUBTYPE 3
|
||||
|
@ -514,7 +524,7 @@ struct grub_efi_fibre_channel_device_path
|
|||
grub_efi_uint32_t reserved;
|
||||
grub_efi_uint64_t wwn;
|
||||
grub_efi_uint64_t lun;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_fibre_channel_device_path grub_efi_fibre_channel_device_path_t;
|
||||
|
||||
#define GRUB_EFI_1394_DEVICE_PATH_SUBTYPE 4
|
||||
|
@ -524,7 +534,7 @@ struct grub_efi_1394_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_uint32_t reserved;
|
||||
grub_efi_uint64_t guid;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_1394_device_path grub_efi_1394_device_path_t;
|
||||
|
||||
#define GRUB_EFI_USB_DEVICE_PATH_SUBTYPE 5
|
||||
|
@ -534,7 +544,7 @@ struct grub_efi_usb_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_uint8_t parent_port_number;
|
||||
grub_efi_uint8_t interface;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_usb_device_path grub_efi_usb_device_path_t;
|
||||
|
||||
#define GRUB_EFI_USB_CLASS_DEVICE_PATH_SUBTYPE 15
|
||||
|
@ -547,7 +557,7 @@ struct grub_efi_usb_class_device_path
|
|||
grub_efi_uint8_t device_class;
|
||||
grub_efi_uint8_t device_subclass;
|
||||
grub_efi_uint8_t device_protocol;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_usb_class_device_path grub_efi_usb_class_device_path_t;
|
||||
|
||||
#define GRUB_EFI_I2O_DEVICE_PATH_SUBTYPE 6
|
||||
|
@ -556,7 +566,7 @@ struct grub_efi_i2o_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_uint32_t tid;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_i2o_device_path grub_efi_i2o_device_path_t;
|
||||
|
||||
#define GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE 11
|
||||
|
@ -566,7 +576,7 @@ struct grub_efi_mac_address_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_mac_address_t mac_address;
|
||||
grub_efi_uint8_t if_type;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_mac_address_device_path grub_efi_mac_address_device_path_t;
|
||||
|
||||
#define GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE 12
|
||||
|
@ -580,7 +590,7 @@ struct grub_efi_ipv4_device_path
|
|||
grub_efi_uint16_t remote_port;
|
||||
grub_efi_uint16_t protocol;
|
||||
grub_efi_uint8_t static_ip_address;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t;
|
||||
|
||||
#define GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE 13
|
||||
|
@ -594,7 +604,7 @@ struct grub_efi_ipv6_device_path
|
|||
grub_efi_uint16_t remote_port;
|
||||
grub_efi_uint16_t protocol;
|
||||
grub_efi_uint8_t static_ip_address;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_ipv6_device_path grub_efi_ipv6_device_path_t;
|
||||
|
||||
#define GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE 9
|
||||
|
@ -607,7 +617,7 @@ struct grub_efi_infiniband_device_path
|
|||
grub_efi_uint64_t remote_id;
|
||||
grub_efi_uint64_t target_port_id;
|
||||
grub_efi_uint64_t device_id;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_infiniband_device_path grub_efi_infiniband_device_path_t;
|
||||
|
||||
#define GRUB_EFI_UART_DEVICE_PATH_SUBTYPE 14
|
||||
|
@ -620,7 +630,7 @@ struct grub_efi_uart_device_path
|
|||
grub_efi_uint8_t data_bits;
|
||||
grub_efi_uint8_t parity;
|
||||
grub_efi_uint8_t stop_bits;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_uart_device_path grub_efi_uart_device_path_t;
|
||||
|
||||
#define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10
|
||||
|
@ -630,7 +640,7 @@ struct grub_efi_vendor_messaging_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_guid_t vendor_guid;
|
||||
grub_efi_uint8_t vendor_defined_data[0];
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_vendor_messaging_device_path grub_efi_vendor_messaging_device_path_t;
|
||||
|
||||
/* Media Device Path. */
|
||||
|
@ -647,7 +657,7 @@ struct grub_efi_hard_drive_device_path
|
|||
grub_efi_uint8_t partition_signature[8];
|
||||
grub_efi_uint8_t mbr_type;
|
||||
grub_efi_uint8_t signature_type;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_hard_drive_device_path grub_efi_hard_drive_device_path_t;
|
||||
|
||||
#define GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE 2
|
||||
|
@ -658,7 +668,7 @@ struct grub_efi_cdrom_device_path
|
|||
grub_efi_uint32_t boot_entry;
|
||||
grub_efi_lba_t partition_start;
|
||||
grub_efi_lba_t partition_size;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_cdrom_device_path grub_efi_cdrom_device_path_t;
|
||||
|
||||
#define GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE 3
|
||||
|
@ -668,7 +678,7 @@ struct grub_efi_vendor_media_device_path
|
|||
grub_efi_device_path_t header;
|
||||
grub_efi_guid_t vendor_guid;
|
||||
grub_efi_uint8_t vendor_defined_data[0];
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_vendor_media_device_path grub_efi_vendor_media_device_path_t;
|
||||
|
||||
#define GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE 4
|
||||
|
@ -677,7 +687,7 @@ struct grub_efi_file_path_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_char16_t path_name[0];
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_file_path_device_path grub_efi_file_path_device_path_t;
|
||||
|
||||
#define GRUB_EFI_PROTOCOL_DEVICE_PATH_SUBTYPE 5
|
||||
|
@ -686,7 +696,7 @@ struct grub_efi_protocol_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_guid_t guid;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_protocol_device_path grub_efi_protocol_device_path_t;
|
||||
|
||||
#define GRUB_EFI_PIWG_DEVICE_PATH_SUBTYPE 6
|
||||
|
@ -695,7 +705,7 @@ struct grub_efi_piwg_device_path
|
|||
{
|
||||
grub_efi_device_path_t header;
|
||||
grub_efi_guid_t guid __attribute__ ((packed));
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_piwg_device_path grub_efi_piwg_device_path_t;
|
||||
|
||||
|
||||
|
@ -710,7 +720,7 @@ struct grub_efi_bios_device_path
|
|||
grub_efi_uint16_t device_type;
|
||||
grub_efi_uint16_t status_flags;
|
||||
char description[0];
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t;
|
||||
|
||||
struct grub_efi_open_protocol_information_entry
|
||||
|
@ -1113,6 +1123,36 @@ struct grub_efi_simple_text_output_interface
|
|||
};
|
||||
typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output_interface_t;
|
||||
|
||||
typedef grub_uint8_t grub_efi_pxe_packet_t[1472];
|
||||
|
||||
typedef struct grub_efi_pxe_mode
|
||||
{
|
||||
grub_uint8_t unused[52];
|
||||
grub_efi_pxe_packet_t dhcp_discover;
|
||||
grub_efi_pxe_packet_t dhcp_ack;
|
||||
grub_efi_pxe_packet_t proxy_offer;
|
||||
grub_efi_pxe_packet_t pxe_discover;
|
||||
grub_efi_pxe_packet_t pxe_reply;
|
||||
} grub_efi_pxe_mode_t;
|
||||
|
||||
typedef struct grub_efi_pxe
|
||||
{
|
||||
grub_uint64_t rev;
|
||||
void (*start) (void);
|
||||
void (*stop) (void);
|
||||
void (*dhcp) (void);
|
||||
void (*discover) (void);
|
||||
void (*mftp) (void);
|
||||
void (*udpwrite) (void);
|
||||
void (*udpread) (void);
|
||||
void (*setipfilter) (void);
|
||||
void (*arp) (void);
|
||||
void (*setparams) (void);
|
||||
void (*setstationip) (void);
|
||||
void (*setpackets) (void);
|
||||
struct grub_efi_pxe_mode *mode;
|
||||
} grub_efi_pxe_t;
|
||||
|
||||
#define GRUB_EFI_BLACK 0x00
|
||||
#define GRUB_EFI_BLUE 0x01
|
||||
#define GRUB_EFI_GREEN 0x02
|
||||
|
@ -1214,6 +1254,76 @@ struct grub_efi_block_io_media
|
|||
};
|
||||
typedef struct grub_efi_block_io_media grub_efi_block_io_media_t;
|
||||
|
||||
typedef grub_uint8_t grub_efi_mac_t[32];
|
||||
|
||||
struct grub_efi_simple_network_mode
|
||||
{
|
||||
grub_uint32_t state;
|
||||
grub_uint32_t hwaddr_size;
|
||||
grub_uint32_t media_header_size;
|
||||
grub_uint32_t max_packet_size;
|
||||
grub_uint32_t nvram_size;
|
||||
grub_uint32_t nvram_access_size;
|
||||
grub_uint32_t receive_filter_mask;
|
||||
grub_uint32_t receive_filter_setting;
|
||||
grub_uint32_t max_mcast_filter_count;
|
||||
grub_uint32_t mcast_filter_count;
|
||||
grub_efi_mac_t mcast_filter[16];
|
||||
grub_efi_mac_t current_address;
|
||||
grub_efi_mac_t broadcast_address;
|
||||
grub_efi_mac_t permanent_address;
|
||||
grub_uint8_t if_type;
|
||||
grub_uint8_t mac_changeable;
|
||||
grub_uint8_t multitx_supported;
|
||||
grub_uint8_t media_present_supported;
|
||||
grub_uint8_t media_present;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_EFI_NETWORK_STOPPED,
|
||||
GRUB_EFI_NETWORK_STARTED,
|
||||
GRUB_EFI_NETWORK_INITIALIZED,
|
||||
};
|
||||
|
||||
struct grub_efi_simple_network
|
||||
{
|
||||
grub_uint64_t revision;
|
||||
grub_efi_status_t (*start) (struct grub_efi_simple_network *this);
|
||||
void (*stop) (void);
|
||||
grub_efi_status_t (*initialize) (struct grub_efi_simple_network *this,
|
||||
grub_efi_uintn_t extra_rx,
|
||||
grub_efi_uintn_t extra_tx);
|
||||
void (*reset) (void);
|
||||
void (*shutdown) (void);
|
||||
void (*receive_filters) (void);
|
||||
void (*station_address) (void);
|
||||
void (*statistics) (void);
|
||||
void (*mcastiptomac) (void);
|
||||
void (*nvdata) (void);
|
||||
grub_efi_status_t (*get_status) (struct grub_efi_simple_network *this,
|
||||
grub_uint32_t *int_status,
|
||||
void **txbuf);
|
||||
grub_efi_status_t (*transmit) (struct grub_efi_simple_network *this,
|
||||
grub_efi_uintn_t header_size,
|
||||
grub_efi_uintn_t buffer_size,
|
||||
void *buffer,
|
||||
grub_efi_mac_t *src_addr,
|
||||
grub_efi_mac_t *dest_addr,
|
||||
grub_efi_uint16_t *protocol);
|
||||
grub_efi_status_t (*receive) (struct grub_efi_simple_network *this,
|
||||
grub_efi_uintn_t *header_size,
|
||||
grub_efi_uintn_t *buffer_size,
|
||||
void *buffer,
|
||||
grub_efi_mac_t *src_addr,
|
||||
grub_efi_mac_t *dest_addr,
|
||||
grub_uint16_t *protocol);
|
||||
void (*waitforpacket) (void);
|
||||
struct grub_efi_simple_network_mode *mode;
|
||||
};
|
||||
typedef struct grub_efi_simple_network grub_efi_simple_network_t;
|
||||
|
||||
|
||||
struct grub_efi_block_io
|
||||
{
|
||||
grub_efi_uint64_t revision;
|
||||
|
@ -1234,7 +1344,7 @@ struct grub_efi_block_io
|
|||
};
|
||||
typedef struct grub_efi_block_io grub_efi_block_io_t;
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 4
|
||||
#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__)
|
||||
|
||||
#define efi_call_0(func) func()
|
||||
#define efi_call_1(func, a) func(a)
|
||||
|
@ -1243,6 +1353,7 @@ typedef struct grub_efi_block_io grub_efi_block_io_t;
|
|||
#define efi_call_4(func, a, b, c, d) func(a, b, c, d)
|
||||
#define efi_call_5(func, a, b, c, d, e) func(a, b, c, d, e)
|
||||
#define efi_call_6(func, a, b, c, d, e, f) func(a, b, c, d, e, f)
|
||||
#define efi_call_7(func, a, b, c, d, e, f, g) func(a, b, c, d, e, f, g)
|
||||
#define efi_call_10(func, a, b, c, d, e, f, g, h, i, j) func(a, b, c, d, e, f, g, h, i, j)
|
||||
|
||||
#else
|
||||
|
@ -1250,24 +1361,31 @@ typedef struct grub_efi_block_io grub_efi_block_io_t;
|
|||
#define efi_call_0(func) \
|
||||
efi_wrap_0(func)
|
||||
#define efi_call_1(func, a) \
|
||||
efi_wrap_1(func, (grub_uint64_t) a)
|
||||
efi_wrap_1(func, (grub_uint64_t) (a))
|
||||
#define efi_call_2(func, a, b) \
|
||||
efi_wrap_2(func, (grub_uint64_t) a, (grub_uint64_t) b)
|
||||
efi_wrap_2(func, (grub_uint64_t) (a), (grub_uint64_t) (b))
|
||||
#define efi_call_3(func, a, b, c) \
|
||||
efi_wrap_3(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c)
|
||||
efi_wrap_3(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
|
||||
(grub_uint64_t) (c))
|
||||
#define efi_call_4(func, a, b, c, d) \
|
||||
efi_wrap_4(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, \
|
||||
(grub_uint64_t) d)
|
||||
efi_wrap_4(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
|
||||
(grub_uint64_t) (c), (grub_uint64_t) (d))
|
||||
#define efi_call_5(func, a, b, c, d, e) \
|
||||
efi_wrap_5(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, \
|
||||
(grub_uint64_t) d, (grub_uint64_t) e)
|
||||
efi_wrap_5(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
|
||||
(grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e))
|
||||
#define efi_call_6(func, a, b, c, d, e, f) \
|
||||
efi_wrap_6(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, \
|
||||
(grub_uint64_t) d, (grub_uint64_t) e, (grub_uint64_t) f)
|
||||
efi_wrap_6(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
|
||||
(grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e), \
|
||||
(grub_uint64_t) (f))
|
||||
#define efi_call_7(func, a, b, c, d, e, f, g) \
|
||||
efi_wrap_7(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
|
||||
(grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e), \
|
||||
(grub_uint64_t) (f), (grub_uint64_t) (g))
|
||||
#define efi_call_10(func, a, b, c, d, e, f, g, h, i, j) \
|
||||
efi_wrap_10(func, (grub_uint64_t) a, (grub_uint64_t) b, (grub_uint64_t) c, \
|
||||
(grub_uint64_t) d, (grub_uint64_t) e, (grub_uint64_t) f, (grub_uint64_t) g, \
|
||||
(grub_uint64_t) h, (grub_uint64_t) i, (grub_uint64_t) j)
|
||||
efi_wrap_10(func, (grub_uint64_t) (a), (grub_uint64_t) (b), \
|
||||
(grub_uint64_t) (c), (grub_uint64_t) (d), (grub_uint64_t) (e), \
|
||||
(grub_uint64_t) (f), (grub_uint64_t) (g), (grub_uint64_t) (h), \
|
||||
(grub_uint64_t) (i), (grub_uint64_t) (j))
|
||||
|
||||
grub_uint64_t EXPORT_FUNC(efi_wrap_0) (void *func);
|
||||
grub_uint64_t EXPORT_FUNC(efi_wrap_1) (void *func, grub_uint64_t arg1);
|
||||
|
@ -1285,6 +1403,10 @@ grub_uint64_t EXPORT_FUNC(efi_wrap_6) (void *func, grub_uint64_t arg1,
|
|||
grub_uint64_t arg2, grub_uint64_t arg3,
|
||||
grub_uint64_t arg4, grub_uint64_t arg5,
|
||||
grub_uint64_t arg6);
|
||||
grub_uint64_t EXPORT_FUNC(efi_wrap_7) (void *func, grub_uint64_t arg1,
|
||||
grub_uint64_t arg2, grub_uint64_t arg3,
|
||||
grub_uint64_t arg4, grub_uint64_t arg5,
|
||||
grub_uint64_t arg6, grub_uint64_t arg7);
|
||||
grub_uint64_t EXPORT_FUNC(efi_wrap_10) (void *func, grub_uint64_t arg1,
|
||||
grub_uint64_t arg2, grub_uint64_t arg3,
|
||||
grub_uint64_t arg4, grub_uint64_t arg5,
|
||||
|
|
|
@ -62,6 +62,16 @@ grub_err_t EXPORT_FUNC (grub_efi_set_virtual_address_map) (grub_efi_uintn_t memo
|
|||
grub_efi_uint32_t descriptor_version,
|
||||
grub_efi_memory_descriptor_t *virtual_map);
|
||||
|
||||
int
|
||||
EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1,
|
||||
const grub_efi_device_path_t *dp2);
|
||||
|
||||
extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,
|
||||
char **device,
|
||||
char **path);
|
||||
|
||||
grub_addr_t grub_efi_modules_addr (void);
|
||||
|
||||
void grub_efi_mm_init (void);
|
||||
void grub_efi_mm_fini (void);
|
||||
void grub_efi_init (void);
|
||||
|
|
|
@ -24,15 +24,8 @@
|
|||
|
||||
#define GRUB_MMAP_REGISTER_BY_FIRMWARE 1
|
||||
|
||||
grub_err_t grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
|
||||
grub_uint64_t,
|
||||
grub_uint32_t));
|
||||
grub_err_t grub_machine_mmap_register (grub_uint64_t start, grub_uint64_t size,
|
||||
int type, int handle);
|
||||
grub_err_t grub_machine_mmap_unregister (int handle);
|
||||
|
||||
grub_uint64_t grub_mmap_get_post64 (void);
|
||||
grub_uint64_t grub_mmap_get_upper (void);
|
||||
grub_uint64_t grub_mmap_get_lower (void);
|
||||
|
||||
#endif /* ! GRUB_MEMORY_MACHINE_HEADER */
|
||||
|
|
|
@ -64,6 +64,7 @@ struct grub_pe32_coff_header
|
|||
};
|
||||
|
||||
#define GRUB_PE32_MACHINE_I386 0x14c
|
||||
#define GRUB_PE32_MACHINE_IA64 0x200
|
||||
#define GRUB_PE32_MACHINE_X86_64 0x8664
|
||||
|
||||
#define GRUB_PE32_RELOCS_STRIPPED 0x0001
|
||||
|
|
|
@ -21,8 +21,7 @@
|
|||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
/* This is destined to overflow when one hour passes by. */
|
||||
#define GRUB_TICKS_PER_SECOND ((1UL << 31) / 60 / 60 * 2)
|
||||
#define GRUB_TICKS_PER_SECOND 1000
|
||||
|
||||
/* Return the real time in ticks. */
|
||||
grub_uint32_t EXPORT_FUNC (grub_get_rtc) (void);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <grub/efi/api.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/memory.h>
|
||||
|
||||
#define GRUB_EFIEMU_PAGESIZE 4096
|
||||
|
||||
|
@ -113,9 +114,9 @@ extern grub_efi_system_table64_t *grub_efiemu_system_table64;
|
|||
: (grub_efiemu_system_table32->x \
|
||||
= (y)))
|
||||
#define GRUB_EFIEMU_SYSTEM_TABLE_PTR(x) ((grub_efiemu_sizeof_uintn_t () == 8)\
|
||||
? UINT_TO_PTR \
|
||||
? (void *) (grub_addr_t) \
|
||||
(grub_efiemu_system_table64->x) \
|
||||
: UINT_TO_PTR \
|
||||
: (void *) (grub_addr_t) \
|
||||
(grub_efiemu_system_table32->x))
|
||||
#define GRUB_EFIEMU_SYSTEM_TABLE_VAR(x) ((grub_efiemu_sizeof_uintn_t () == 8) \
|
||||
? (void *) \
|
||||
|
@ -199,15 +200,9 @@ grub_efiemu_register_configuration_table (grub_efi_guid_t guid,
|
|||
int grub_efiemu_request_memalign (grub_size_t align, grub_size_t size,
|
||||
grub_efi_memory_type_t type);
|
||||
void *grub_efiemu_mm_obtain_request (int handle);
|
||||
int grub_efiemu_get_memory_map (grub_efi_uintn_t *memory_map_size,
|
||||
grub_efi_memory_descriptor_t *memory_map,
|
||||
grub_efi_uintn_t *map_key,
|
||||
grub_efi_uintn_t *descriptor_size,
|
||||
grub_efi_uint32_t *descriptor_version);
|
||||
grub_err_t grub_efiemu_mm_unload (void);
|
||||
grub_err_t grub_efiemu_mm_do_alloc (void);
|
||||
grub_err_t grub_efiemu_mm_init (void);
|
||||
void *grub_efiemu_mm_obtain_request (int handle);
|
||||
void grub_efiemu_mm_return_request (int handle);
|
||||
grub_efi_memory_type_t grub_efiemu_mm_get_type (int handle);
|
||||
|
||||
|
@ -227,9 +222,7 @@ grub_efiemu_finish_boot_services (grub_efi_uintn_t *memory_map_size,
|
|||
grub_efi_uint32_t *descriptor_version);
|
||||
|
||||
grub_err_t
|
||||
grub_efiemu_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t,
|
||||
grub_uint64_t,
|
||||
grub_uint32_t));
|
||||
grub_efiemu_mmap_iterate (grub_memory_hook_t hook);
|
||||
int grub_efiemu_sizeof_uintn_t (void);
|
||||
grub_err_t
|
||||
grub_efiemu_get_lower_upper_memory (grub_uint64_t *lower, grub_uint64_t *upper);
|
||||
|
@ -272,8 +265,7 @@ grub_err_t grub_efiemu_write_value (void * addr, grub_uint32_t value,
|
|||
int minus_handle, int ptv_needed, int size);
|
||||
grub_err_t grub_efiemu_write_sym_markers (void);
|
||||
grub_err_t grub_efiemu_pnvram (void);
|
||||
grub_err_t grub_efiemu_prepare (void);
|
||||
char *grub_efiemu_get_default_core_name (void);
|
||||
const char *grub_efiemu_get_default_core_name (void);
|
||||
void grub_efiemu_pnvram_cmd_unregister (void);
|
||||
grub_err_t grub_efiemu_autocore (void);
|
||||
grub_err_t grub_efiemu_crc32 (void);
|
||||
|
|
|
@ -2348,6 +2348,8 @@ typedef Elf32_Xword Elf_Xword;
|
|||
|
||||
#define ELF_ST_BIND(val) ELF32_ST_BIND(val)
|
||||
#define ELF_ST_TYPE(val) ELF32_ST_TYPE(val)
|
||||
#define ELF_ST_INFO(a,b) ELF32_ST_INFO(a,b)
|
||||
|
||||
#define ELF_R_SYM(val) ELF32_R_SYM(val)
|
||||
#define ELF_R_TYPE(val) ELF32_R_TYPE(val)
|
||||
#define ELF_R_INFO(sym, type) ELF32_R_INFO(sym, type)
|
||||
|
@ -2369,6 +2371,7 @@ typedef Elf64_Xword Elf_Xword;
|
|||
|
||||
#define ELF_ST_BIND(val) ELF64_ST_BIND (val)
|
||||
#define ELF_ST_TYPE(val) ELF64_ST_TYPE (val)
|
||||
#define ELF_ST_INFO(a,b) ELF64_ST_INFO(a,b)
|
||||
#define ELF_R_SYM(val) ELF64_R_SYM(val)
|
||||
#define ELF_R_TYPE(val) ELF64_R_TYPE(val)
|
||||
#define ELF_R_INFO(sym, type) ELF64_R_INFO(sym, type)
|
||||
|
|
|
@ -46,12 +46,12 @@ grub_elf_t grub_elf_file (grub_file_t);
|
|||
grub_err_t grub_elf_close (grub_elf_t);
|
||||
|
||||
int grub_elf_is_elf32 (grub_elf_t);
|
||||
grub_size_t grub_elf32_size (grub_elf_t, Elf32_Addr *);
|
||||
grub_size_t grub_elf32_size (grub_elf_t, Elf32_Addr *, grub_uint32_t *);
|
||||
grub_err_t grub_elf32_load (grub_elf_t, grub_elf32_load_hook_t, grub_addr_t *,
|
||||
grub_size_t *);
|
||||
|
||||
int grub_elf_is_elf64 (grub_elf_t);
|
||||
grub_size_t grub_elf64_size (grub_elf_t, Elf64_Addr *);
|
||||
grub_size_t grub_elf64_size (grub_elf_t, Elf64_Addr *, grub_uint64_t *);
|
||||
grub_err_t grub_elf64_load (grub_elf_t, grub_elf64_load_hook_t, grub_addr_t *,
|
||||
grub_size_t *);
|
||||
grub_err_t
|
||||
|
|
6
include/grub/emu/export.h
Normal file
6
include/grub/emu/export.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
void EXPORT_FUNC (open64) (void);
|
||||
void EXPORT_FUNC (close) (void);
|
||||
void EXPORT_FUNC (read) (void);
|
||||
void EXPORT_FUNC (write) (void);
|
||||
void EXPORT_FUNC (ioctl) (void);
|
||||
|
|
@ -25,6 +25,8 @@ enum grub_dev_abstraction_types {
|
|||
GRUB_DEV_ABSTRACTION_NONE,
|
||||
GRUB_DEV_ABSTRACTION_LVM,
|
||||
GRUB_DEV_ABSTRACTION_RAID,
|
||||
GRUB_DEV_ABSTRACTION_LUKS,
|
||||
GRUB_DEV_ABSTRACTION_GELI,
|
||||
};
|
||||
|
||||
char *grub_find_device (const char *dir, dev_t dev);
|
||||
|
@ -34,5 +36,12 @@ char *grub_util_get_grub_dev (const char *os_dev);
|
|||
char *grub_make_system_path_relative_to_its_root (const char *path);
|
||||
const char *grub_util_check_block_device (const char *blk_dev);
|
||||
const char *grub_util_check_char_device (const char *blk_dev);
|
||||
#ifdef __linux__
|
||||
char **grub_util_raid_getmembers (const char *name, int bootable);
|
||||
#endif
|
||||
#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
void grub_util_follow_gpart_up (const char *name, grub_disk_addr_t *off_out,
|
||||
char **name_out);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_UTIL_GETROOT_HEADER */
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#define GRUB_BIOSDISK_MACHINE_UTIL_HEADER 1
|
||||
|
||||
#include <grub/disk.h>
|
||||
#include <grub/partition.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
void grub_util_biosdisk_init (const char *dev_map);
|
||||
void grub_util_biosdisk_fini (void);
|
||||
|
@ -28,5 +30,35 @@ char *grub_util_biosdisk_get_grub_dev (const char *os_dev);
|
|||
const char *grub_util_biosdisk_get_osdev (grub_disk_t disk);
|
||||
int grub_util_biosdisk_is_present (const char *name);
|
||||
int grub_util_biosdisk_is_floppy (grub_disk_t disk);
|
||||
const char *
|
||||
grub_util_biosdisk_get_compatibility_hint (grub_disk_t disk);
|
||||
grub_err_t grub_util_biosdisk_flush (struct grub_disk *disk);
|
||||
void grub_util_pull_device (const char *osname);
|
||||
grub_err_t
|
||||
grub_util_fd_seek (int fd, const char *name, grub_uint64_t sector);
|
||||
ssize_t grub_util_fd_read (int fd, char *buf, size_t len);
|
||||
ssize_t grub_util_fd_write (int fd, const char *buf, size_t len);
|
||||
grub_err_t
|
||||
grub_cryptodisk_cheat_mount (const char *sourcedev, const char *cheat);
|
||||
void grub_util_cryptodisk_print_uuid (grub_disk_t disk);
|
||||
char *
|
||||
grub_util_get_ldm (grub_disk_t disk, grub_disk_addr_t start);
|
||||
int
|
||||
grub_util_is_ldm (grub_disk_t disk);
|
||||
#ifdef GRUB_UTIL
|
||||
grub_err_t
|
||||
grub_util_ldm_embed (struct grub_disk *disk, unsigned int *nsectors,
|
||||
grub_embed_type_t embed_type,
|
||||
grub_disk_addr_t **sectors);
|
||||
#endif
|
||||
grub_disk_addr_t
|
||||
grub_hostdisk_find_partition_start (const char *dev);
|
||||
const char *
|
||||
grub_hostdisk_os_dev_to_grub_drive (const char *os_dev, int add);
|
||||
|
||||
#if !defined(__MINGW32__)
|
||||
grub_uint64_t
|
||||
grub_util_get_fd_sectors (int fd, unsigned *log_secsize);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/util/libzfs.h>
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# include <sys/fcntl.h>
|
||||
|
@ -55,11 +54,13 @@ void grub_find_zpool_from_dir (const char *dir,
|
|||
|
||||
char *grub_make_system_path_relative_to_its_root (const char *path)
|
||||
__attribute__ ((warn_unused_result));
|
||||
int
|
||||
grub_util_device_is_mapped (const char *dev);
|
||||
|
||||
void * EXPORT_FUNC(xmalloc) (grub_size_t size) __attribute__ ((warn_unused_result));
|
||||
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) __attribute__ ((warn_unused_result));
|
||||
char * EXPORT_FUNC(xstrdup) (const char *str) __attribute__ ((warn_unused_result));
|
||||
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((warn_unused_result));
|
||||
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))) __attribute__ ((warn_unused_result));
|
||||
|
||||
void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...);
|
||||
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...);
|
||||
|
@ -79,6 +80,6 @@ extern char * canonicalize_file_name (const char *path);
|
|||
int grub_device_mapper_supported (void);
|
||||
#endif
|
||||
|
||||
libzfs_handle_t *grub_get_libzfs_handle (void);
|
||||
char *grub_find_root_device_from_mountinfo (const char *dir, char **relroot);
|
||||
|
||||
#endif /* GRUB_EMU_MISC_H */
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
struct grub_env_var;
|
||||
|
||||
typedef char *(*grub_env_read_hook_t) (struct grub_env_var *var,
|
||||
const char *val);
|
||||
typedef const char *(*grub_env_read_hook_t) (struct grub_env_var *var,
|
||||
const char *val);
|
||||
typedef char *(*grub_env_write_hook_t) (struct grub_env_var *var,
|
||||
const char *val);
|
||||
|
||||
|
@ -43,7 +43,7 @@ struct grub_env_var
|
|||
};
|
||||
|
||||
grub_err_t EXPORT_FUNC(grub_env_set) (const char *name, const char *val);
|
||||
char *EXPORT_FUNC(grub_env_get) (const char *name);
|
||||
const char *EXPORT_FUNC(grub_env_get) (const char *name);
|
||||
void EXPORT_FUNC(grub_env_unset) (const char *name);
|
||||
void EXPORT_FUNC(grub_env_iterate) (int (*func) (struct grub_env_var *var));
|
||||
struct grub_env_var *EXPORT_FUNC(grub_env_find) (const char *name);
|
||||
|
@ -53,7 +53,7 @@ grub_err_t EXPORT_FUNC(grub_register_variable_hook) (const char *name,
|
|||
|
||||
grub_err_t grub_env_context_open (void);
|
||||
grub_err_t grub_env_context_close (void);
|
||||
grub_err_t grub_env_export (const char *name);
|
||||
grub_err_t EXPORT_FUNC(grub_env_export) (const char *name);
|
||||
|
||||
void grub_env_unset_menu (void);
|
||||
grub_menu_t grub_env_get_menu (void);
|
||||
|
|
|
@ -55,7 +55,18 @@ typedef enum
|
|||
GRUB_ERR_TIMEOUT,
|
||||
GRUB_ERR_IO,
|
||||
GRUB_ERR_ACCESS_DENIED,
|
||||
GRUB_ERR_EXTRACTOR
|
||||
GRUB_ERR_EXTRACTOR,
|
||||
GRUB_ERR_NET_BAD_ADDRESS,
|
||||
GRUB_ERR_NET_ROUTE_LOOP,
|
||||
GRUB_ERR_NET_NO_ROUTE,
|
||||
GRUB_ERR_NET_NO_ANSWER,
|
||||
GRUB_ERR_WAIT,
|
||||
GRUB_ERR_BUG,
|
||||
GRUB_ERR_NET_PORT_CLOSED,
|
||||
GRUB_ERR_NET_INVALID_RESPONSE,
|
||||
GRUB_ERR_NET_UNKNOWN_ERROR,
|
||||
GRUB_ERR_NET_PACKET_TOO_BIG,
|
||||
GRUB_ERR_NET_NO_DOMAIN
|
||||
}
|
||||
grub_err_t;
|
||||
|
||||
|
|
70
include/grub/fat.h
Normal file
70
include/grub/fat.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_FAT_H
|
||||
#define GRUB_FAT_H 1
|
||||
|
||||
#include <grub/types.h>
|
||||
|
||||
struct grub_fat_bpb
|
||||
{
|
||||
grub_uint8_t jmp_boot[3];
|
||||
grub_uint8_t oem_name[8];
|
||||
grub_uint16_t bytes_per_sector;
|
||||
grub_uint8_t sectors_per_cluster;
|
||||
grub_uint16_t num_reserved_sectors;
|
||||
grub_uint8_t num_fats;
|
||||
grub_uint16_t num_root_entries;
|
||||
grub_uint16_t num_total_sectors_16;
|
||||
grub_uint8_t media;
|
||||
grub_uint16_t sectors_per_fat_16;
|
||||
grub_uint16_t sectors_per_track;
|
||||
grub_uint16_t num_heads;
|
||||
grub_uint32_t num_hidden_sectors;
|
||||
grub_uint32_t num_total_sectors_32;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
grub_uint8_t num_ph_drive;
|
||||
grub_uint8_t reserved;
|
||||
grub_uint8_t boot_sig;
|
||||
grub_uint32_t num_serial;
|
||||
grub_uint8_t label[11];
|
||||
grub_uint8_t fstype[8];
|
||||
} __attribute__ ((packed)) fat12_or_fat16;
|
||||
struct
|
||||
{
|
||||
grub_uint32_t sectors_per_fat_32;
|
||||
grub_uint16_t extended_flags;
|
||||
grub_uint16_t fs_version;
|
||||
grub_uint32_t root_cluster;
|
||||
grub_uint16_t fs_info;
|
||||
grub_uint16_t backup_boot_sector;
|
||||
grub_uint8_t reserved[12];
|
||||
grub_uint8_t num_ph_drive;
|
||||
grub_uint8_t reserved1;
|
||||
grub_uint8_t boot_sig;
|
||||
grub_uint32_t num_serial;
|
||||
grub_uint8_t label[11];
|
||||
grub_uint8_t fstype[8];
|
||||
} __attribute__ ((packed)) fat32;
|
||||
} __attribute__ ((packed)) version_specific;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#endif
|
|
@ -31,8 +31,17 @@ struct grub_video_fbblit_info
|
|||
grub_uint8_t *data;
|
||||
};
|
||||
|
||||
grub_uint8_t *grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y);
|
||||
void *grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y);
|
||||
|
||||
/* Advance pointer by VAL bytes. If there is no unaligned access available,
|
||||
VAL has to be divisible by size of pointed type.
|
||||
*/
|
||||
#ifdef GRUB_HAVE_UNALIGNED_ACCESS
|
||||
#define GRUB_VIDEO_FB_ADVANCE_POINTER(ptr, val) ((ptr) = (typeof (ptr)) ((char *) ptr + val))
|
||||
#else
|
||||
#define GRUB_VIDEO_FB_ADVANCE_POINTER(ptr, val) ((ptr) += (val) / sizeof (*(ptr)))
|
||||
#endif
|
||||
|
||||
grub_video_color_t get_pixel (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y);
|
||||
|
|
|
@ -39,8 +39,8 @@ struct grub_file
|
|||
/* The file size. */
|
||||
grub_off_t size;
|
||||
|
||||
/* If file is not easly seekable. Should be set by underlying layer. */
|
||||
int not_easly_seekable;
|
||||
/* If file is not easily seekable. Should be set by underlying layer. */
|
||||
int not_easily_seekable;
|
||||
|
||||
/* Filesystem-specific data. */
|
||||
void *data;
|
||||
|
@ -56,9 +56,10 @@ typedef enum grub_file_filter_id
|
|||
{
|
||||
GRUB_FILE_FILTER_GZIO,
|
||||
GRUB_FILE_FILTER_XZIO,
|
||||
GRUB_FILE_FILTER_LZOPIO,
|
||||
GRUB_FILE_FILTER_MAX,
|
||||
GRUB_FILE_FILTER_COMPRESSION_FIRST = GRUB_FILE_FILTER_GZIO,
|
||||
GRUB_FILE_FILTER_COMPRESSION_LAST = GRUB_FILE_FILTER_XZIO,
|
||||
GRUB_FILE_FILTER_COMPRESSION_LAST = GRUB_FILE_FILTER_LZOPIO,
|
||||
} grub_file_filter_id_t;
|
||||
|
||||
typedef grub_file_t (*grub_file_filter_t) (grub_file_t in);
|
||||
|
@ -123,7 +124,7 @@ grub_file_tell (const grub_file_t file)
|
|||
static inline int
|
||||
grub_file_seekable (const grub_file_t file)
|
||||
{
|
||||
return !file->not_easly_seekable;
|
||||
return !file->not_easily_seekable;
|
||||
}
|
||||
|
||||
#endif /* ! GRUB_FILE_HEADER */
|
||||
|
|
|
@ -25,15 +25,19 @@
|
|||
#include <grub/types.h>
|
||||
|
||||
#include <grub/list.h>
|
||||
/* For embedding types. */
|
||||
#ifdef GRUB_UTIL
|
||||
#include <grub/partition.h>
|
||||
#endif
|
||||
|
||||
/* Forward declaration is required, because of mutual reference. */
|
||||
struct grub_file;
|
||||
|
||||
struct grub_dirhook_info
|
||||
{
|
||||
int dir:1;
|
||||
int mtimeset:1;
|
||||
int case_insensitive:1;
|
||||
unsigned dir:1;
|
||||
unsigned mtimeset:1;
|
||||
unsigned case_insensitive:1;
|
||||
grub_int32_t mtime;
|
||||
};
|
||||
|
||||
|
@ -42,6 +46,7 @@ struct grub_fs
|
|||
{
|
||||
/* The next filesystem. */
|
||||
struct grub_fs *next;
|
||||
struct grub_fs **prev;
|
||||
|
||||
/* My name. */
|
||||
const char *name;
|
||||
|
@ -74,6 +79,11 @@ struct grub_fs
|
|||
grub_err_t (*mtime) (grub_device_t device, grub_int32_t *timebuf);
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
/* Determine sectors available for embedding. */
|
||||
grub_err_t (*embed) (grub_device_t device, unsigned int *nsectors,
|
||||
grub_embed_type_t embed_type,
|
||||
grub_disk_addr_t **sectors);
|
||||
|
||||
/* Whether this filesystem reserves first sector for DOS-style boot. */
|
||||
int reserved_first_sector;
|
||||
#endif
|
||||
|
@ -102,7 +112,7 @@ grub_fs_register (grub_fs_t fs)
|
|||
static inline void
|
||||
grub_fs_unregister (grub_fs_t fs)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_fs_list), GRUB_AS_LIST (fs));
|
||||
grub_list_remove (GRUB_AS_LIST (fs));
|
||||
}
|
||||
|
||||
#define FOR_FILESYSTEMS(var) FOR_LIST_ELEMENTS((var), (grub_fs_list))
|
||||
|
|
|
@ -87,11 +87,11 @@ struct grub_gfxmenu_view
|
|||
grub_font_t title_font;
|
||||
grub_font_t message_font;
|
||||
char *terminal_font_name;
|
||||
grub_gui_color_t title_color;
|
||||
grub_gui_color_t message_color;
|
||||
grub_gui_color_t message_bg_color;
|
||||
grub_video_rgba_color_t title_color;
|
||||
grub_video_rgba_color_t message_color;
|
||||
grub_video_rgba_color_t message_bg_color;
|
||||
struct grub_video_bitmap *desktop_image;
|
||||
grub_gui_color_t desktop_color;
|
||||
grub_video_rgba_color_t desktop_color;
|
||||
grub_gfxmenu_box_t terminal_box;
|
||||
char *title_text;
|
||||
char *progress_message_text;
|
||||
|
|
|
@ -36,6 +36,7 @@ struct grub_gfxmenu_box
|
|||
void (*draw) (grub_gfxmenu_box_t self, int x, int y);
|
||||
void (*set_content_size) (grub_gfxmenu_box_t self,
|
||||
int width, int height);
|
||||
int (*get_border_width) (grub_gfxmenu_box_t self);
|
||||
int (*get_left_pad) (grub_gfxmenu_box_t self);
|
||||
int (*get_top_pad) (grub_gfxmenu_box_t self);
|
||||
int (*get_right_pad) (grub_gfxmenu_box_t self);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#define GRUB_GPT_PARTITION_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/partition.h>
|
||||
|
||||
struct grub_gpt_part_type
|
||||
{
|
||||
|
@ -36,10 +37,19 @@ typedef struct grub_gpt_part_type grub_gpt_part_type_t;
|
|||
}
|
||||
|
||||
#define GRUB_GPT_PARTITION_TYPE_BIOS_BOOT \
|
||||
{ grub_cpu_to_le32 (0x21686148), grub_cpu_to_le16 (0x6449), grub_cpu_to_le16 (0x6e6f), \
|
||||
{ grub_cpu_to_le32_compile_time (0x21686148), \
|
||||
grub_cpu_to_le16_compile_time (0x6449), \
|
||||
grub_cpu_to_le16_compile_time (0x6e6f), \
|
||||
{ 0x74, 0x4e, 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 } \
|
||||
}
|
||||
|
||||
#define GRUB_GPT_PARTITION_TYPE_LDM \
|
||||
{ grub_cpu_to_le32_compile_time (0x5808C8AAU),\
|
||||
grub_cpu_to_le16_compile_time (0x7E8F), \
|
||||
grub_cpu_to_le16_compile_time (0x42E0), \
|
||||
{ 0x85, 0xD2, 0xE1, 0xE9, 0x04, 0x34, 0xCF, 0xB3 } \
|
||||
}
|
||||
|
||||
struct grub_gpt_header
|
||||
{
|
||||
grub_uint8_t magic[8];
|
||||
|
@ -68,4 +78,10 @@ struct grub_gpt_partentry
|
|||
char name[72];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
grub_err_t
|
||||
grub_gpt_partition_map_iterate (grub_disk_t disk,
|
||||
int (*hook) (grub_disk_t disk,
|
||||
const grub_partition_t partition));
|
||||
|
||||
|
||||
#endif /* ! GRUB_GPT_PARTITION_HEADER */
|
||||
|
|
|
@ -31,16 +31,6 @@
|
|||
status changes. */
|
||||
#define GRUB_GFXMENU_TIMEOUT_COMPONENT_ID "__timeout__"
|
||||
|
||||
/* A representation of a color. Unlike grub_video_color_t, this
|
||||
representation is independent of any video mode specifics. */
|
||||
typedef struct grub_gui_color
|
||||
{
|
||||
grub_uint8_t red;
|
||||
grub_uint8_t green;
|
||||
grub_uint8_t blue;
|
||||
grub_uint8_t alpha;
|
||||
} grub_gui_color_t;
|
||||
|
||||
typedef struct grub_gui_component *grub_gui_component_t;
|
||||
typedef struct grub_gui_container *grub_gui_container_t;
|
||||
typedef struct grub_gui_list *grub_gui_list_t;
|
||||
|
@ -242,23 +232,6 @@ grub_gui_set_viewport (const grub_video_rect_t *r, grub_video_rect_t *old)
|
|||
r->height);
|
||||
}
|
||||
|
||||
static __inline grub_gui_color_t
|
||||
grub_gui_color_rgb (int r, int g, int b)
|
||||
{
|
||||
grub_gui_color_t c;
|
||||
c.red = r;
|
||||
c.green = g;
|
||||
c.blue = b;
|
||||
c.alpha = 255;
|
||||
return c;
|
||||
}
|
||||
|
||||
static __inline grub_video_color_t
|
||||
grub_gui_map_color (grub_gui_color_t c)
|
||||
{
|
||||
return grub_video_map_rgba (c.red, c.green, c.blue, c.alpha);
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_video_have_common_points (const grub_video_rect_t *a,
|
||||
const grub_video_rect_t *b)
|
||||
|
|
|
@ -30,8 +30,4 @@ char *grub_resolve_relative_path (const char *base, const char *path);
|
|||
|
||||
char *grub_get_dirname (const char *file_path);
|
||||
|
||||
int grub_gui_get_named_color (const char *name, grub_gui_color_t *color);
|
||||
|
||||
grub_err_t grub_gui_parse_color (const char *s, grub_gui_color_t *color);
|
||||
|
||||
#endif /* GRUB_GUI_STRING_UTIL_HEADER */
|
||||
|
|
|
@ -39,7 +39,9 @@ typedef struct grub_hfs_extent grub_hfs_datarecord_t[3];
|
|||
struct grub_hfs_sblock
|
||||
{
|
||||
grub_uint16_t magic;
|
||||
grub_uint8_t unused[18];
|
||||
grub_uint32_t ctime;
|
||||
grub_uint32_t mtime;
|
||||
grub_uint8_t unused[10];
|
||||
grub_uint32_t blksz;
|
||||
grub_uint8_t unused2[4];
|
||||
grub_uint16_t first_block;
|
||||
|
|
|
@ -94,8 +94,8 @@ grub_err_t grub_netbsd_load_elf_meta64 (struct grub_relocator *relocator,
|
|||
grub_addr_t *kern_end);
|
||||
|
||||
grub_err_t grub_bsd_add_meta (grub_uint32_t type,
|
||||
void *data, grub_uint32_t len);
|
||||
grub_err_t grub_freebsd_add_meta_module (char *filename, char *type,
|
||||
const void *data, grub_uint32_t len);
|
||||
grub_err_t grub_freebsd_add_meta_module (const char *filename, const char *type,
|
||||
int argc, char **argv,
|
||||
grub_addr_t addr, grub_uint32_t size);
|
||||
|
||||
|
|
|
@ -28,6 +28,10 @@
|
|||
#include <grub/memory.h>
|
||||
#endif
|
||||
|
||||
#define GRUB_MEMORY_MACHINE_SCRATCH_ADDR 0x68000
|
||||
#define GRUB_MEMORY_MACHINE_SCRATCH_SEG (GRUB_MEMORY_MACHINE_SCRATCH_ADDR >> 4)
|
||||
#define GRUB_MEMORY_MACHINE_SCRATCH_SIZE 0x10000
|
||||
|
||||
#define GRUB_MEMORY_MACHINE_LOWER_USABLE 0x9fc00 /* 640 kiB - 1 kiB */
|
||||
|
||||
#define GRUB_MEMORY_MACHINE_UPPER_START 0x100000 /* 1 MiB */
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#define GRUB_LINUX_VID_MODE_ASK 0xFFFD
|
||||
#define GRUB_LINUX_VID_MODE_VESA_START 0x0300
|
||||
|
||||
#define GRUB_LINUX_SETUP_MOVE_SIZE 0x9100
|
||||
#define GRUB_LINUX_CL_MAGIC 0xA33F
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
@ -68,7 +67,7 @@
|
|||
#define GRUB_E820_RESERVED 2
|
||||
#define GRUB_E820_ACPI 3
|
||||
#define GRUB_E820_NVS 4
|
||||
#define GRUB_E820_EXEC_CODE 5
|
||||
#define GRUB_E820_BADRAM 5
|
||||
|
||||
#define GRUB_E820_MAX_ENTRY 128
|
||||
|
||||
|
@ -79,9 +78,13 @@ struct grub_e820_mmap
|
|||
grub_uint32_t type;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define GRUB_VIDEO_LINUX_TYPE_TEXT 0x01
|
||||
#define GRUB_VIDEO_LINUX_TYPE_VESA 0x23 /* VESA VGA in graphic mode. */
|
||||
#define GRUB_VIDEO_LINUX_TYPE_SIMPLE 0x70 /* Linear framebuffer without any additional functions. */
|
||||
enum
|
||||
{
|
||||
GRUB_VIDEO_LINUX_TYPE_TEXT = 0x01,
|
||||
GRUB_VIDEO_LINUX_TYPE_VESA = 0x23, /* VESA VGA in graphic mode. */
|
||||
GRUB_VIDEO_LINUX_TYPE_EFIFB = 0x70, /* EFI Framebuffer. */
|
||||
GRUB_VIDEO_LINUX_TYPE_SIMPLE = 0x70 /* Linear framebuffer without any additional functions. */
|
||||
};
|
||||
|
||||
/* For the Linux/i386 boot protocol version 2.03. */
|
||||
struct linux_kernel_header
|
||||
|
@ -126,6 +129,10 @@ struct linux_kernel_header
|
|||
grub_uint16_t pad1; /* Unused */
|
||||
grub_uint32_t cmd_line_ptr; /* Points to the kernel command line */
|
||||
grub_uint32_t initrd_addr_max; /* Highest address for initrd */
|
||||
grub_uint32_t kernel_alignment;
|
||||
grub_uint8_t relocatable;
|
||||
grub_uint8_t pad[3];
|
||||
grub_uint32_t cmdline_size;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Boot parameters for Linux based on 2.6.12. This is used by the setup
|
||||
|
|
|
@ -51,9 +51,11 @@
|
|||
|
||||
#define NETBSD_BTINFO_BOOTPATH 0
|
||||
#define NETBSD_BTINFO_ROOTDEVICE 1
|
||||
#define NETBSD_BTINFO_BOOTDISK 3
|
||||
#define NETBSD_BTINFO_CONSOLE 6
|
||||
#define NETBSD_BTINFO_SYMTAB 8
|
||||
#define NETBSD_BTINFO_MEMMAP 9
|
||||
#define NETBSD_BTINFO_BOOTWEDGE 10
|
||||
#define NETBSD_BTINFO_MODULES 11
|
||||
#define NETBSD_BTINFO_FRAMEBUF 12
|
||||
|
||||
|
@ -83,6 +85,15 @@ struct grub_netbsd_btinfo_bootdisk
|
|||
grub_uint32_t partition;
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_bootwedge {
|
||||
grub_uint32_t biosdev;
|
||||
grub_disk_addr_t startblk;
|
||||
grub_uint64_t nblks;
|
||||
grub_disk_addr_t matchblk;
|
||||
grub_uint64_t matchnblks;
|
||||
grub_uint8_t matchhash[16]; /* MD5 hash */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_netbsd_btinfo_symtab
|
||||
{
|
||||
grub_uint32_t nsyms;
|
||||
|
|
|
@ -21,10 +21,7 @@
|
|||
|
||||
#include <grub/dl.h>
|
||||
|
||||
/* Common function for normal and rescue mode commands. */
|
||||
typedef enum
|
||||
{
|
||||
GRUB_CHAINLOADER_FORCE = 0x1
|
||||
} grub_chainloader_flags_t;
|
||||
void
|
||||
grub_chainloader_patch_bpb (void *bs, grub_device_t dev, grub_uint8_t dl);
|
||||
|
||||
#endif /* GRUB_CHAINLOADER_MACHINE_HEADER */
|
||||
|
|
|
@ -26,16 +26,6 @@
|
|||
#include <grub/term.h>
|
||||
#include <grub/i386/vga_common.h>
|
||||
|
||||
/* These are global to share code between C and asm. */
|
||||
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);
|
||||
|
||||
|
|
|
@ -45,7 +45,12 @@ struct grub_bios_int_registers
|
|||
#define GRUB_CPU_INT_FLAGS_INTERRUPT 0x200
|
||||
#define GRUB_CPU_INT_FLAGS_DIRECTION 0x400
|
||||
#define GRUB_CPU_INT_FLAGS_OVERFLOW 0x800
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
#define GRUB_CPU_INT_FLAGS_DEFAULT GRUB_CPU_INT_FLAGS_INTERRUPT
|
||||
#else
|
||||
#define GRUB_CPU_INT_FLAGS_DEFAULT 0
|
||||
#endif
|
||||
|
||||
|
||||
void EXPORT_FUNC (grub_bios_interrupt) (grub_uint8_t intno,
|
||||
struct grub_bios_int_registers *regs);
|
||||
|
|
|
@ -29,20 +29,12 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
/* The size of kernel image. */
|
||||
extern grub_int32_t grub_kernel_image_size;
|
||||
|
||||
/* The total size of module images following the kernel. */
|
||||
extern grub_int32_t grub_total_module_size;
|
||||
|
||||
/* The DOS partition number of the installed partition. */
|
||||
extern grub_int32_t grub_install_dos_part;
|
||||
extern grub_uint32_t EXPORT_VAR(grub_boot_device);
|
||||
|
||||
/* The BSD partition number of the installed partition. */
|
||||
extern grub_int32_t grub_install_bsd_part;
|
||||
|
||||
/* The boot BIOS drive number. */
|
||||
extern grub_uint8_t EXPORT_VAR(grub_boot_drive);
|
||||
extern void (*EXPORT_VAR(grub_pc_net_config)) (char **device, char **path);
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_LOADER_MACHINE_HEADER
|
||||
#define GRUB_LOADER_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
/* This is an asm part of the chainloader. */
|
||||
void EXPORT_FUNC(grub_chainloader_real_boot) (int drive, void *part_addr) __attribute__ ((noreturn));
|
||||
|
||||
#endif /* ! GRUB_LOADER_MACHINE_HEADER */
|
|
@ -152,18 +152,13 @@
|
|||
#define GRUB_PXE_BOOTP_BCAST 0x8000
|
||||
|
||||
#if 1
|
||||
#define GRUB_PXE_BOOTP_DHCPVEND 1024 /* DHCP extended vendor field size. */
|
||||
#define GRUB_PXE_BOOTP_SIZE (1024 + 236) /* DHCP extended vendor field size. */
|
||||
#else
|
||||
#define GRUB_PXE_BOOTP_DHCPVEND 312 /* DHCP standard vendor field size. */
|
||||
#define GRUB_PXE_BOOTP_SIZE (312 + 236) /* DHCP standard vendor field size. */
|
||||
#endif
|
||||
|
||||
#define GRUB_PXE_MIN_BLKSIZE 512
|
||||
#define GRUB_PXE_MAX_BLKSIZE 1432
|
||||
|
||||
#define GRUB_PXE_TFTP_PORT 69
|
||||
|
||||
#define GRUB_PXE_VM_RFC1048 0x63825363L
|
||||
|
||||
#define GRUB_PXE_ERR_LEN 0xFFFFFFFF
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
@ -214,38 +209,6 @@ struct grub_pxenv_get_cached_info
|
|||
grub_uint16_t buffer_limit;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define GRUB_PXE_MAC_ADDR_LEN 16
|
||||
|
||||
typedef grub_uint8_t grub_pxe_mac_addr_t[GRUB_PXE_MAC_ADDR_LEN];
|
||||
|
||||
struct grub_pxenv_boot_player
|
||||
{
|
||||
grub_uint8_t opcode;
|
||||
grub_uint8_t hw_type; /* hardware type. */
|
||||
grub_uint8_t hw_len; /* hardware addr len. */
|
||||
grub_uint8_t gate_hops; /* zero it. */
|
||||
grub_uint32_t ident; /* random number chosen by client. */
|
||||
grub_uint16_t seconds; /* seconds since did initial bootstrap. */
|
||||
grub_uint16_t flags;
|
||||
grub_uint32_t client_ip;
|
||||
grub_uint32_t your_ip;
|
||||
grub_uint32_t server_ip;
|
||||
grub_uint32_t gateway_ip;
|
||||
grub_pxe_mac_addr_t mac_addr;
|
||||
grub_uint8_t server_name[64];
|
||||
grub_uint8_t boot_file[128];
|
||||
union
|
||||
{
|
||||
grub_uint8_t d[GRUB_PXE_BOOTP_DHCPVEND]; /* raw array of vendor/dhcp options. */
|
||||
struct
|
||||
{
|
||||
grub_uint32_t magic; /* DHCP magic cookie. */
|
||||
grub_uint32_t flags; /* bootp flags/opcodes. */
|
||||
grub_uint8_t padding[56];
|
||||
} v;
|
||||
} vendor;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_pxenv_tftp_open
|
||||
{
|
||||
grub_uint16_t status;
|
||||
|
@ -321,8 +284,6 @@ int EXPORT_FUNC(grub_pxe_call) (int func, void * data, grub_uint32_t pxe_rm_entr
|
|||
|
||||
extern struct grub_pxe_bangpxe *grub_pxe_pxenv;
|
||||
|
||||
void grub_pxe_unload (void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* GRUB_CPU_PXE_H */
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#ifndef GRUB_VBE_MACHINE_HEADER
|
||||
#define GRUB_VBE_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/video.h>
|
||||
|
||||
/* Default video mode to be used. */
|
||||
#define GRUB_VBE_DEFAULT_VIDEO_MODE 0x101
|
||||
|
||||
|
@ -169,6 +171,21 @@ struct grub_vbe_palette_data
|
|||
grub_uint8_t alignment;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_vbe_flat_panel_info
|
||||
{
|
||||
grub_uint16_t horizontal_size;
|
||||
grub_uint16_t vertical_size;
|
||||
grub_uint16_t panel_type;
|
||||
grub_uint8_t red_bpp;
|
||||
grub_uint8_t green_bpp;
|
||||
grub_uint8_t blue_bpp;
|
||||
grub_uint8_t reserved_bpp;
|
||||
grub_uint32_t reserved_offscreen_mem_size;
|
||||
grub_vbe_farptr_t reserved_offscreen_mem_ptr;
|
||||
|
||||
grub_uint8_t reserved[14];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Prototypes for helper functions. */
|
||||
/* Call VESA BIOS 0x4f00 to get VBE Controller Information, return status. */
|
||||
grub_vbe_status_t
|
||||
|
|
|
@ -28,12 +28,6 @@
|
|||
|
||||
extern grub_addr_t grub_core_entry_addr;
|
||||
|
||||
/* The size of kernel image. */
|
||||
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 */
|
||||
|
|
|
@ -33,10 +33,4 @@
|
|||
#define GRUB_MEMORY_MACHINE_UPPER_START 0x100000 /* 1 MiB */
|
||||
#define GRUB_MEMORY_MACHINE_LOWER_SIZE GRUB_MEMORY_MACHINE_UPPER_START
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
void grub_machine_mmap_init (void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ! _GRUB_MEMORY_MACHINE_HEADER */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,15 +16,13 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MACHINE_SERIAL_HEADER
|
||||
#define GRUB_MACHINE_SERIAL_HEADER 1
|
||||
|
||||
#define GRUB_MACHINE_SERIAL_DIVISOR_115200 2
|
||||
#define GRUB_MACHINE_SERIAL_PORT 0xbff003f8
|
||||
#ifndef GRUB_REBOOT_H
|
||||
#define GRUB_REBOOT_H 1
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#define GRUB_MACHINE_SERIAL_PORTS { GRUB_MACHINE_SERIAL_PORT }
|
||||
#else
|
||||
|
||||
extern grub_uint8_t grub_reboot_end[], grub_reboot_start[];
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -46,7 +46,10 @@ struct grub_relocator16_state
|
|||
grub_uint16_t ss;
|
||||
grub_uint16_t sp;
|
||||
grub_uint16_t ip;
|
||||
grub_uint32_t ebx;
|
||||
grub_uint32_t edx;
|
||||
grub_uint32_t esi;
|
||||
int a20;
|
||||
};
|
||||
|
||||
struct grub_relocator64_state
|
||||
|
|
|
@ -28,4 +28,6 @@
|
|||
/* i386 is little-endian. */
|
||||
#undef GRUB_TARGET_WORDS_BIGENDIAN
|
||||
|
||||
#define GRUB_HAVE_UNALIGNED_ACCESS 1
|
||||
|
||||
#endif /* ! GRUB_TYPES_CPU_HEADER */
|
||||
|
|
1
include/grub/ia64/efi/memory.h
Normal file
1
include/grub/ia64/efi/memory.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <grub/efi/memory.h>
|
23
include/grub/ia64/efi/time.h
Normal file
23
include/grub/ia64/efi/time.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef GRUB_MACHINE_TIME_HEADER
|
||||
#define GRUB_MACHINE_TIME_HEADER 1
|
||||
|
||||
#include <grub/efi/time.h>
|
||||
|
||||
#endif /* ! GRUB_MACHINE_TIME_HEADER */
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,12 +16,10 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_BOOT_HEADER
|
||||
#define GRUB_BOOT_HEADER 1
|
||||
#ifndef GRUB_CPU_KERNEL_HEADER
|
||||
#define GRUB_CPU_KERNEL_HEADER 1
|
||||
|
||||
#define GRUB_BOOT_VERSION_MAJOR 4
|
||||
#define GRUB_BOOT_VERSION_MINOR 0
|
||||
#define GRUB_BOOT_VERSION ((GRUB_BOOT_VERSION_MINOR << 8) \
|
||||
| GRUB_BOOT_VERSION_MAJOR)
|
||||
#define GRUB_MOD_ALIGN 0x1
|
||||
#define GRUB_MOD_GAP 0x0
|
||||
|
||||
#endif /* ! GRUB_BOOT_HEADER */
|
||||
#endif /* ! GRUB_CPU_KERNEL_HEADER */
|
28
include/grub/ia64/setjmp.h
Normal file
28
include/grub/ia64/setjmp.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* Define the machine-dependent type `jmp_buf'. Linux/IA-64 version.
|
||||
Copyright (C) 1999, 2000, 2008 Free Software Foundation, Inc.
|
||||
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* User code must not depend on the internal representation of jmp_buf. */
|
||||
|
||||
#define _JBLEN 70
|
||||
|
||||
/* the __jmp_buf element type should be __float80 per ABI... */
|
||||
typedef long grub_jmp_buf[_JBLEN] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */
|
||||
|
||||
int grub_setjmp (grub_jmp_buf env);
|
||||
void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
|
28
include/grub/ia64/time.h
Normal file
28
include/grub/ia64/time.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2007, 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KERNEL_CPU_TIME_HEADER
|
||||
#define KERNEL_CPU_TIME_HEADER 1
|
||||
|
||||
static __inline void
|
||||
grub_cpu_idle (void)
|
||||
{
|
||||
/* FIXME: not implemented */
|
||||
}
|
||||
|
||||
#endif /* ! KERNEL_CPU_TIME_HEADER */
|
32
include/grub/ia64/types.h
Normal file
32
include/grub/ia64/types.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_TYPES_CPU_HEADER
|
||||
#define GRUB_TYPES_CPU_HEADER 1
|
||||
|
||||
/* The size of void *. */
|
||||
#define GRUB_TARGET_SIZEOF_VOID_P 8
|
||||
|
||||
/* The size of long. */
|
||||
#define GRUB_TARGET_SIZEOF_LONG 8
|
||||
|
||||
/* ia64 is little-endian (usually). */
|
||||
#undef GRUB_TARGET_WORDS_BIGENDIAN
|
||||
|
||||
|
||||
#endif /* ! GRUB_TYPES_CPU_HEADER */
|
|
@ -24,7 +24,6 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/machine/ieee1275.h>
|
||||
|
||||
/* Maps a device alias to a pathname. */
|
||||
struct grub_ieee1275_devalias
|
||||
{
|
||||
char *name;
|
||||
|
@ -65,6 +64,11 @@ struct grub_ieee1275_common_hdr
|
|||
typedef grub_uint32_t grub_ieee1275_ihandle_t;
|
||||
typedef grub_uint32_t grub_ieee1275_phandle_t;
|
||||
|
||||
extern void (*EXPORT_VAR(grub_ieee1275_net_config)) (const char *dev,
|
||||
char **device,
|
||||
char **path);
|
||||
|
||||
/* Maps a device alias to a pathname. */
|
||||
extern grub_ieee1275_phandle_t EXPORT_VAR(grub_ieee1275_chosen);
|
||||
extern grub_ieee1275_ihandle_t EXPORT_VAR(grub_ieee1275_mmu);
|
||||
extern int (* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *);
|
||||
|
@ -106,6 +110,12 @@ enum grub_ieee1275_flag
|
|||
|
||||
/* OLPC / XO firmware has the cursor ON/OFF routines. */
|
||||
GRUB_IEEE1275_FLAG_HAS_CURSORONOFF,
|
||||
|
||||
/* Some PowerMacs claim to use 2 address cells but in fact use only 1.
|
||||
Other PowerMacs claim to use only 1 and really do so. Always assume
|
||||
1 address cell is used on PowerMacs.
|
||||
*/
|
||||
GRUB_IEEE1275_FLAG_BROKEN_ADDRESS_CELLS,
|
||||
};
|
||||
|
||||
extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);
|
||||
|
@ -115,7 +125,7 @@ extern void EXPORT_FUNC(grub_ieee1275_set_flag) (enum grub_ieee1275_flag flag);
|
|||
|
||||
|
||||
void EXPORT_FUNC(grub_ieee1275_init) (void);
|
||||
int EXPORT_FUNC(grub_ieee1275_finddevice) (char *name,
|
||||
int EXPORT_FUNC(grub_ieee1275_finddevice) (const char *name,
|
||||
grub_ieee1275_phandle_t *phandlep);
|
||||
int EXPORT_FUNC(grub_ieee1275_get_property) (grub_ieee1275_phandle_t phandle,
|
||||
const char *property, void *buf,
|
||||
|
@ -138,7 +148,7 @@ int EXPORT_FUNC(grub_ieee1275_instance_to_path)
|
|||
(grub_ieee1275_ihandle_t ihandle, char *path, grub_size_t len,
|
||||
grub_ssize_t *actual);
|
||||
int EXPORT_FUNC(grub_ieee1275_write) (grub_ieee1275_ihandle_t ihandle,
|
||||
void *buffer, grub_size_t len,
|
||||
const void *buffer, grub_size_t len,
|
||||
grub_ssize_t *actualp);
|
||||
int EXPORT_FUNC(grub_ieee1275_read) (grub_ieee1275_ihandle_t ihandle,
|
||||
void *buffer, grub_size_t len,
|
||||
|
@ -163,7 +173,8 @@ int EXPORT_FUNC(grub_ieee1275_claim) (grub_addr_t addr, grub_size_t size,
|
|||
unsigned int align, grub_addr_t *result);
|
||||
int EXPORT_FUNC(grub_ieee1275_release) (grub_addr_t addr, grub_size_t size);
|
||||
int EXPORT_FUNC(grub_ieee1275_set_property) (grub_ieee1275_phandle_t phandle,
|
||||
const char *propname, void *buf,
|
||||
const char *propname,
|
||||
const void *buf,
|
||||
grub_size_t size,
|
||||
grub_ssize_t *actual);
|
||||
int EXPORT_FUNC(grub_ieee1275_set_color) (grub_ieee1275_ihandle_t ihandle,
|
||||
|
@ -173,10 +184,8 @@ int EXPORT_FUNC(grub_ieee1275_milliseconds) (grub_uint32_t *msecs);
|
|||
|
||||
int EXPORT_FUNC(grub_devalias_iterate)
|
||||
(int (*hook) (struct grub_ieee1275_devalias *alias));
|
||||
int EXPORT_FUNC(grub_children_iterate) (char *devpath,
|
||||
int EXPORT_FUNC(grub_children_iterate) (const char *devpath,
|
||||
int (*hook) (struct grub_ieee1275_devalias *alias));
|
||||
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
|
||||
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
|
||||
int EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size);
|
||||
|
||||
int
|
||||
|
@ -185,11 +194,11 @@ EXPORT_FUNC(grub_ieee1275_map) (grub_addr_t phys, grub_addr_t virt,
|
|||
|
||||
char *EXPORT_FUNC(grub_ieee1275_encode_devname) (const char *path);
|
||||
char *EXPORT_FUNC(grub_ieee1275_get_filename) (const char *path);
|
||||
|
||||
int EXPORT_FUNC(grub_ieee1275_devices_iterate) (int (*hook)
|
||||
(struct grub_ieee1275_devalias *
|
||||
alias));
|
||||
|
||||
char *EXPORT_FUNC(grub_ieee1275_get_aliasdevname) (const char *path);
|
||||
char *EXPORT_FUNC(grub_ieee1275_canonicalise_devname) (const char *path);
|
||||
char *EXPORT_FUNC(grub_ieee1275_get_device_type) (const char *path);
|
||||
|
||||
#endif /* ! GRUB_IEEE1275_HEADER */
|
||||
|
|
|
@ -26,14 +26,15 @@ enum
|
|||
{
|
||||
OBJ_TYPE_ELF,
|
||||
OBJ_TYPE_MEMDISK,
|
||||
OBJ_TYPE_CONFIG
|
||||
OBJ_TYPE_CONFIG,
|
||||
OBJ_TYPE_PREFIX
|
||||
};
|
||||
|
||||
/* The module header. */
|
||||
struct grub_module_header
|
||||
{
|
||||
/* The type of object. */
|
||||
grub_uint8_t type;
|
||||
grub_uint32_t type;
|
||||
/* The size of object (including this header). */
|
||||
grub_uint32_t size;
|
||||
};
|
||||
|
@ -68,14 +69,20 @@ struct grub_module_info64
|
|||
#define grub_module_info grub_module_info32
|
||||
#endif
|
||||
|
||||
extern grub_addr_t grub_arch_modules_addr (void);
|
||||
extern grub_addr_t EXPORT_VAR (grub_modbase);
|
||||
|
||||
extern void EXPORT_FUNC(grub_module_iterate) (int (*hook) (struct grub_module_header *));
|
||||
#define FOR_MODULES(var) for (\
|
||||
var = grub_modbase ? (struct grub_module_header *) \
|
||||
(grub_modbase + (((struct grub_module_info *) grub_modbase)->offset)) : 0;\
|
||||
var && (grub_addr_t) var \
|
||||
< (grub_modbase + (((struct grub_module_info *) grub_modbase)->size)); \
|
||||
var = (struct grub_module_header *) \
|
||||
((grub_uint32_t *) var + ((struct grub_module_header *) var)->size / 4))
|
||||
|
||||
grub_addr_t grub_modules_get_end (void);
|
||||
|
||||
/* The start point of the C code. */
|
||||
void grub_main (void);
|
||||
void grub_main (void) __attribute__ ((noreturn));
|
||||
|
||||
/* The machine-specific initialization. This must initialize memory. */
|
||||
void grub_machine_init (void);
|
||||
|
@ -84,13 +91,12 @@ void grub_machine_init (void);
|
|||
void EXPORT_FUNC(grub_machine_fini) (void);
|
||||
|
||||
/* The machine-specific prefix initialization. */
|
||||
void grub_machine_set_prefix (void);
|
||||
void
|
||||
grub_machine_get_bootlocation (char **device, char **path);
|
||||
|
||||
/* Register all the exported symbols. This is automatically generated. */
|
||||
void grub_register_exported_symbols (void);
|
||||
|
||||
#if ! defined (ASM_FILE) && !defined (GRUB_MACHINE_EMU)
|
||||
extern char grub_prefix[];
|
||||
#endif
|
||||
extern void (*EXPORT_VAR(grub_net_poll_cards_idle)) (void);
|
||||
|
||||
#endif /* ! GRUB_KERNEL_HEADER */
|
||||
|
|
|
@ -53,8 +53,8 @@ struct grub_arg_option
|
|||
const char *longarg;
|
||||
int shortarg;
|
||||
int flags;
|
||||
char *doc;
|
||||
char *arg;
|
||||
const char *doc;
|
||||
const char *arg;
|
||||
grub_arg_type_t type;
|
||||
};
|
||||
|
||||
|
|
31
include/grub/lib/cmdline.h
Normal file
31
include/grub/lib/cmdline.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* cmdline.h - linux command line handling */
|
||||
/*
|
||||
* 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_CMDLINE_HEADER
|
||||
#define GRUB_CMDLINE_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
|
||||
#define LINUX_IMAGE "BOOT_IMAGE="
|
||||
|
||||
unsigned int grub_loader_cmdline_size (int argc, char *argv[]);
|
||||
int grub_create_loader_cmdline (int argc, char *argv[], char *buf,
|
||||
grub_size_t size);
|
||||
|
||||
#endif /* ! GRUB_CMDLINE_HEADER */
|
25
include/grub/lib/crc.h
Normal file
25
include/grub/lib/crc.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* crc.h - prototypes for crc */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_CRC_H
|
||||
#define GRUB_CRC_H 1
|
||||
|
||||
grub_uint32_t grub_getcrc32c (grub_uint32_t crc, const void *buf, int size);
|
||||
|
||||
#endif /* ! GRUB_CRC_H */
|
|
@ -39,8 +39,42 @@ void EXPORT_FUNC (__bswapsi2) (void);
|
|||
# ifdef HAVE___BSWAPDI2
|
||||
void EXPORT_FUNC (__bswapdi2) (void);
|
||||
# endif
|
||||
# ifdef HAVE___UDIVSI3
|
||||
void EXPORT_FUNC (__udivsi3) (void);
|
||||
# endif
|
||||
# ifdef HAVE___UMODSI3
|
||||
void EXPORT_FUNC (__umodsi3) (void);
|
||||
# endif
|
||||
# ifdef HAVE___UMODDI3
|
||||
void EXPORT_FUNC (__umoddi3) (void);
|
||||
# endif
|
||||
# ifdef HAVE___UDIVDI3
|
||||
void EXPORT_FUNC (__udivdi3) (void);
|
||||
# endif
|
||||
# ifdef HAVE___MODDI3
|
||||
void EXPORT_FUNC (__moddi3) (void);
|
||||
# endif
|
||||
# ifdef HAVE___DIVDI3
|
||||
void EXPORT_FUNC (__divdi3) (void);
|
||||
# endif
|
||||
# ifdef HAVE___DIVSI3
|
||||
void EXPORT_FUNC (__divsi3) (void);
|
||||
# endif
|
||||
# ifdef HAVE___MODSI3
|
||||
void EXPORT_FUNC (__modsi3) (void);
|
||||
# endif
|
||||
# ifdef HAVE___CTZDI2
|
||||
void EXPORT_FUNC (__ctzdi2) (void);
|
||||
# endif
|
||||
# ifdef HAVE___CTZSI2
|
||||
void EXPORT_FUNC (__ctzsi2) (void);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# ifdef HAVE___IA64_TRAMPOLINE
|
||||
void EXPORT_FUNC (__ia64_trampoline) (void);
|
||||
# endif
|
||||
|
||||
#ifdef HAVE___TRAMPOLINE_SETUP
|
||||
void EXPORT_FUNC (__trampoline_setup) (void);
|
||||
#endif
|
||||
|
|
|
@ -27,11 +27,30 @@
|
|||
struct grub_list
|
||||
{
|
||||
struct grub_list *next;
|
||||
struct grub_list **prev;
|
||||
};
|
||||
typedef struct grub_list *grub_list_t;
|
||||
|
||||
void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item);
|
||||
void EXPORT_FUNC(grub_list_remove) (grub_list_t *head, grub_list_t item);
|
||||
static inline void
|
||||
grub_list_push (grub_list_t *head, grub_list_t item)
|
||||
{
|
||||
item->prev = head;
|
||||
if (*head)
|
||||
(*head)->prev = &item->next;
|
||||
item->next = *head;
|
||||
*head = item;
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_list_remove (grub_list_t item)
|
||||
{
|
||||
if (item->prev)
|
||||
*item->prev = item->next;
|
||||
if (item->next)
|
||||
item->next->prev = item->prev;
|
||||
item->next = 0;
|
||||
item->prev = 0;
|
||||
}
|
||||
|
||||
#define FOR_LIST_ELEMENTS(var, list) for ((var) = (list); (var); (var) = (var)->next)
|
||||
|
||||
|
@ -53,16 +72,17 @@ grub_bad_type_cast_real (int line, const char *file)
|
|||
((char *) &(ptr)->field == (char *) &((type) (ptr))->field)
|
||||
|
||||
#define GRUB_AS_LIST(ptr) \
|
||||
(GRUB_FIELD_MATCH (ptr, grub_list_t, next) ? \
|
||||
(grub_list_t) ptr : grub_bad_type_cast ())
|
||||
(GRUB_FIELD_MATCH (ptr, grub_list_t, next) && GRUB_FIELD_MATCH (ptr, grub_list_t, prev) ? \
|
||||
(grub_list_t) ptr : (grub_list_t) grub_bad_type_cast ())
|
||||
|
||||
#define GRUB_AS_LIST_P(pptr) \
|
||||
(GRUB_FIELD_MATCH (*pptr, grub_list_t, next) ? \
|
||||
(grub_list_t *) (void *) pptr : grub_bad_type_cast ())
|
||||
(GRUB_FIELD_MATCH (*pptr, grub_list_t, next) && GRUB_FIELD_MATCH (*pptr, grub_list_t, prev) ? \
|
||||
(grub_list_t *) (void *) pptr : (grub_list_t *) grub_bad_type_cast ())
|
||||
|
||||
struct grub_named_list
|
||||
{
|
||||
struct grub_named_list *next;
|
||||
struct grub_named_list **prev;
|
||||
char *name;
|
||||
};
|
||||
typedef struct grub_named_list *grub_named_list_t;
|
||||
|
@ -71,14 +91,16 @@ void * EXPORT_FUNC(grub_named_list_find) (grub_named_list_t head,
|
|||
const char *name);
|
||||
|
||||
#define GRUB_AS_NAMED_LIST(ptr) \
|
||||
((GRUB_FIELD_MATCH (ptr, grub_named_list_t, next) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_named_list_t, name))? \
|
||||
(grub_named_list_t) ptr : grub_bad_type_cast ())
|
||||
((GRUB_FIELD_MATCH (ptr, grub_named_list_t, next) \
|
||||
&& GRUB_FIELD_MATCH (ptr, grub_named_list_t, prev) \
|
||||
&& GRUB_FIELD_MATCH (ptr, grub_named_list_t, name))? \
|
||||
(grub_named_list_t) ptr : (grub_named_list_t) grub_bad_type_cast ())
|
||||
|
||||
#define GRUB_AS_NAMED_LIST_P(pptr) \
|
||||
((GRUB_FIELD_MATCH (*pptr, grub_named_list_t, next) && \
|
||||
GRUB_FIELD_MATCH (*pptr, grub_named_list_t, name))? \
|
||||
(grub_named_list_t *) (void *) pptr : grub_bad_type_cast ())
|
||||
((GRUB_FIELD_MATCH (*pptr, grub_named_list_t, next) \
|
||||
&& GRUB_FIELD_MATCH (*pptr, grub_named_list_t, prev) \
|
||||
&& GRUB_FIELD_MATCH (*pptr, grub_named_list_t, name))? \
|
||||
(grub_named_list_t *) (void *) pptr : (grub_named_list_t *) grub_bad_type_cast ())
|
||||
|
||||
#define GRUB_PRIO_LIST_PRIO_MASK 0xff
|
||||
#define GRUB_PRIO_LIST_FLAG_ACTIVE 0x100
|
||||
|
@ -86,6 +108,7 @@ void * EXPORT_FUNC(grub_named_list_find) (grub_named_list_t head,
|
|||
struct grub_prio_list
|
||||
{
|
||||
struct grub_prio_list *next;
|
||||
struct grub_prio_list **prev;
|
||||
char *name;
|
||||
int prio;
|
||||
};
|
||||
|
@ -95,23 +118,27 @@ void EXPORT_FUNC(grub_prio_list_insert) (grub_prio_list_t *head,
|
|||
grub_prio_list_t item);
|
||||
|
||||
static inline void
|
||||
grub_prio_list_remove (grub_prio_list_t *head, grub_prio_list_t item)
|
||||
grub_prio_list_remove (grub_prio_list_t item)
|
||||
{
|
||||
if ((item->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) && (item->next))
|
||||
item->next->prio |= GRUB_PRIO_LIST_FLAG_ACTIVE;
|
||||
grub_list_remove (GRUB_AS_LIST_P (head), GRUB_AS_LIST (item));
|
||||
grub_list_remove (GRUB_AS_LIST (item));
|
||||
}
|
||||
|
||||
#define GRUB_AS_PRIO_LIST(ptr) \
|
||||
((GRUB_FIELD_MATCH (ptr, grub_prio_list_t, next) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_prio_list_t, name) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_prio_list_t, prio))? \
|
||||
(grub_prio_list_t) ptr : grub_bad_type_cast ())
|
||||
((GRUB_FIELD_MATCH (ptr, grub_prio_list_t, next) \
|
||||
&& GRUB_FIELD_MATCH (ptr, grub_prio_list_t, prev) \
|
||||
&& GRUB_FIELD_MATCH (ptr, grub_prio_list_t, name) \
|
||||
&& GRUB_FIELD_MATCH (ptr, grub_prio_list_t, prio))? \
|
||||
(grub_prio_list_t) ptr \
|
||||
: (grub_prio_list_t) grub_bad_type_cast ())
|
||||
|
||||
#define GRUB_AS_PRIO_LIST_P(pptr) \
|
||||
((GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, next) && \
|
||||
GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, name) && \
|
||||
GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, prio))? \
|
||||
(grub_prio_list_t *) (void *) pptr : grub_bad_type_cast ())
|
||||
((GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, next) \
|
||||
&& GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, prev) \
|
||||
&& GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, name) \
|
||||
&& GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, prio)) ? \
|
||||
(grub_prio_list_t *) (void *) pptr \
|
||||
: (grub_prio_list_t *) grub_bad_type_cast ())
|
||||
|
||||
#endif /* ! GRUB_LIST_HEADER */
|
||||
|
|
|
@ -56,11 +56,13 @@ typedef enum {
|
|||
} grub_loader_preboot_hook_prio_t;
|
||||
|
||||
/* Register a preboot hook. */
|
||||
void *EXPORT_FUNC(grub_loader_register_preboot_hook) (grub_err_t (*preboot_func) (int noret),
|
||||
grub_err_t (*preboot_rest_func) (void),
|
||||
grub_loader_preboot_hook_prio_t prio);
|
||||
struct grub_preboot;
|
||||
|
||||
struct grub_preboot *EXPORT_FUNC(grub_loader_register_preboot_hook) (grub_err_t (*preboot_func) (int noret),
|
||||
grub_err_t (*preboot_rest_func) (void),
|
||||
grub_loader_preboot_hook_prio_t prio);
|
||||
|
||||
/* Unregister given preboot hook. */
|
||||
void grub_loader_unregister_preboot_hook (void *hnd);
|
||||
void EXPORT_FUNC (grub_loader_unregister_preboot_hook) (struct grub_preboot *hnd);
|
||||
|
||||
#endif /* ! GRUB_LOADER_HEADER */
|
||||
|
|
|
@ -21,50 +21,11 @@
|
|||
#define GRUB_LVM_H 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/diskfilter.h>
|
||||
|
||||
/* Length of ID string, excluding terminating zero. */
|
||||
#define GRUB_LVM_ID_STRLEN 38
|
||||
|
||||
struct grub_lvm_vg {
|
||||
char id[GRUB_LVM_ID_STRLEN+1];
|
||||
char *name;
|
||||
int extent_size;
|
||||
struct grub_lvm_pv *pvs;
|
||||
struct grub_lvm_lv *lvs;
|
||||
struct grub_lvm_vg *next;
|
||||
};
|
||||
|
||||
struct grub_lvm_pv {
|
||||
char id[GRUB_LVM_ID_STRLEN+1];
|
||||
char *name;
|
||||
grub_disk_t disk;
|
||||
int start; /* Sector number where the data area starts. */
|
||||
struct grub_lvm_pv *next;
|
||||
};
|
||||
|
||||
struct grub_lvm_lv {
|
||||
char *name;
|
||||
unsigned int number;
|
||||
unsigned int segment_count;
|
||||
grub_uint64_t size;
|
||||
struct grub_lvm_segment *segments; /* Pointer to segment_count segments. */
|
||||
struct grub_lvm_vg *vg;
|
||||
struct grub_lvm_lv *next;
|
||||
};
|
||||
|
||||
struct grub_lvm_segment {
|
||||
unsigned int start_extent;
|
||||
unsigned int extent_count;
|
||||
unsigned int stripe_count;
|
||||
unsigned int stripe_size;
|
||||
struct grub_lvm_stripe *stripes; /* Pointer to stripe_count stripes. */
|
||||
};
|
||||
|
||||
struct grub_lvm_stripe {
|
||||
int start;
|
||||
struct grub_lvm_pv *pv;
|
||||
};
|
||||
|
||||
#define GRUB_LVM_LABEL_SIZE GRUB_DISK_SECTOR_SIZE
|
||||
#define GRUB_LVM_LABEL_SCAN_SECTORS 4L
|
||||
|
||||
|
|
|
@ -94,11 +94,6 @@ typedef struct grub_menu_execute_callback
|
|||
grub_menu_entry_t grub_menu_get_entry (grub_menu_t menu, int no);
|
||||
int grub_menu_get_timeout (void);
|
||||
void grub_menu_set_timeout (int timeout);
|
||||
void grub_menu_execute_entry (grub_menu_entry_t entry);
|
||||
void grub_menu_execute_with_fallback (grub_menu_t menu,
|
||||
grub_menu_entry_t entry,
|
||||
grub_menu_execute_callback_t callback,
|
||||
void *callback_data);
|
||||
void grub_menu_entry_run (grub_menu_entry_t entry);
|
||||
int grub_menu_get_default_entry_index (grub_menu_t menu);
|
||||
|
||||
|
|
2
include/grub/mips/arc/kernel.h
Normal file
2
include/grub/mips/arc/kernel.h
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include <grub/cpu/kernel.h>
|
||||
|
42
include/grub/mips/arc/memory.h
Normal file
42
include/grub/mips/arc/memory.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MEMORY_MACHINE_HEADER
|
||||
#define GRUB_MEMORY_MACHINE_HEADER 1
|
||||
|
||||
#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x8bfffff0
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
static inline grub_err_t
|
||||
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
|
||||
grub_uint64_t size __attribute__ ((unused)),
|
||||
int type __attribute__ ((unused)),
|
||||
int handle __attribute__ ((unused)))
|
||||
{
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
static inline grub_err_t
|
||||
grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
|
||||
{
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
24
include/grub/mips/kernel.h
Normal file
24
include/grub/mips/kernel.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_KERNEL_CPU_HEADER
|
||||
#define GRUB_KERNEL_CPU_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
|
@ -19,11 +19,7 @@
|
|||
#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
|
||||
#include <grub/cpu/mips.h>
|
||||
|
||||
#define GRUB_CPU_LOONGSON_FLASH_START 0xbfc00000
|
||||
#define GRUB_CPU_LOONGSON_FLASH_TLB_REFILL 0xbfc00200
|
||||
|
@ -68,9 +64,9 @@
|
|||
#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_PRID GRUB_CPU_REGISTER_WRAP($15)
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGLO GRUB_CPU_REGISTER_WRAP($28)
|
||||
#define GRUB_CPU_LOONGSON_COP0_CACHE_TAGHI GRUB_CPU_REGISTER_WRAP($29)
|
||||
|
||||
|
@ -85,6 +81,6 @@
|
|||
#define GRUB_CPU_LOONGSON_PCI_HIT1_SEL_HI 0xbfe00154
|
||||
|
||||
#define GRUB_CPU_LOONGSON_GPIOCFG 0xbfe00120
|
||||
#define GRUB_CPU_LOONGSON_SHUTDOWN_GPIO 1
|
||||
#define GRUB_CPU_YEELOONG_SHUTDOWN_GPIO 1
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
#ifndef GRUB_EC_MACHINE_HEADER
|
||||
#define GRUB_EC_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/pci.h>
|
||||
|
||||
#define GRUB_MACHINE_EC_MAGIC_PORT1 0x381
|
||||
#define GRUB_MACHINE_EC_MAGIC_PORT2 0x382
|
||||
#define GRUB_MACHINE_EC_DATA_PORT 0x383
|
|
@ -20,11 +20,15 @@
|
|||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/cpu/kernel.h>
|
||||
|
||||
#define GRUB_ARCH_MACHINE_YEELOONG 0
|
||||
#define GRUB_ARCH_MACHINE_FULOONG2F 1
|
||||
#define GRUB_ARCH_MACHINE_FULOONG2E 2
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
|
||||
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_machine) __attribute__ ((section(".text")));
|
||||
|
||||
#endif
|
||||
|
|
@ -26,36 +26,9 @@
|
|||
#endif
|
||||
|
||||
#define GRUB_MACHINE_MEMORY_STACK_HIGH 0x801ffff0
|
||||
#define GRUB_ARCH_LOWMEMVSTART 0x80000000
|
||||
#define GRUB_ARCH_LOWMEMPSTART 0x00000000
|
||||
#define GRUB_ARCH_LOWMEMMAXSIZE 0x10000000
|
||||
#define GRUB_ARCH_HIGHMEMPSTART 0x10000000
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
typedef grub_addr_t grub_phys_addr_t;
|
||||
|
||||
static inline grub_phys_addr_t
|
||||
grub_vtop (void *a)
|
||||
{
|
||||
return ((grub_phys_addr_t) a) & 0x1fffffff;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
grub_map_memory (grub_phys_addr_t a, grub_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
return (void *) (a | 0x80000000);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_unmap_memory (void *a __attribute__ ((unused)),
|
||||
grub_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
}
|
||||
|
||||
grub_err_t EXPORT_FUNC (grub_machine_mmap_iterate)
|
||||
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
|
||||
|
||||
static inline grub_err_t
|
||||
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
|
||||
grub_uint64_t size __attribute__ ((unused)),
|
||||
|
@ -70,11 +43,8 @@ grub_machine_mmap_unregister (int handle __attribute__ ((unused)))
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_uint64_t grub_mmap_get_lower (void);
|
||||
grub_uint64_t grub_mmap_get_upper (void);
|
||||
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_memsize);
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_highmemsize);
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_memsize) __attribute__ ((section(".text")));
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_highmemsize) __attribute__ ((section(".text")));
|
||||
|
||||
#endif
|
||||
|
|
@ -24,10 +24,8 @@
|
|||
#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_LOONGSON_OHCI_PCIID 0x00351033
|
||||
#define GRUB_LOONGSON_EHCI_PCIID 0x00e01033
|
||||
|
||||
#define GRUB_PCI_NUM_BUS 1
|
||||
#define GRUB_PCI_NUM_DEVICES 16
|
||||
|
@ -66,7 +64,7 @@ grub_pci_read (grub_pci_address_t addr)
|
|||
{
|
||||
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
|
||||
return *(volatile grub_uint32_t *) (GRUB_MACHINE_PCI_CONFSPACE
|
||||
| (addr & 0x03ff));
|
||||
| (addr & 0x07ff));
|
||||
}
|
||||
|
||||
static inline grub_uint16_t
|
||||
|
@ -74,7 +72,7 @@ grub_pci_read_word (grub_pci_address_t addr)
|
|||
{
|
||||
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
|
||||
return *(volatile grub_uint16_t *) (GRUB_MACHINE_PCI_CONFSPACE
|
||||
| (addr & 0x03ff));
|
||||
| (addr & 0x07ff));
|
||||
}
|
||||
|
||||
static inline grub_uint8_t
|
||||
|
@ -82,7 +80,7 @@ grub_pci_read_byte (grub_pci_address_t addr)
|
|||
{
|
||||
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
|
||||
return *(volatile grub_uint8_t *) (GRUB_MACHINE_PCI_CONFSPACE
|
||||
| (addr & 0x03ff));
|
||||
| (addr & 0x07ff));
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -90,7 +88,7 @@ grub_pci_write (grub_pci_address_t addr, grub_uint32_t data)
|
|||
{
|
||||
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
|
||||
*(volatile grub_uint32_t *) (GRUB_MACHINE_PCI_CONFSPACE
|
||||
| (addr & 0x03ff)) = data;
|
||||
| (addr & 0x07ff)) = data;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -98,7 +96,7 @@ grub_pci_write_word (grub_pci_address_t addr, grub_uint16_t data)
|
|||
{
|
||||
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
|
||||
*(volatile grub_uint16_t *) (GRUB_MACHINE_PCI_CONFSPACE
|
||||
| (addr & 0x03ff)) = data;
|
||||
| (addr & 0x07ff)) = data;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -106,7 +104,7 @@ grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
|
|||
{
|
||||
GRUB_MACHINE_PCI_CONF_CTRL_REG = 1 << ((addr >> 11) & 0xf);
|
||||
*(volatile grub_uint8_t *) (GRUB_MACHINE_PCI_CONFSPACE
|
||||
| (addr & 0x03ff)) = data;
|
||||
| (addr & 0x07ff)) = data;
|
||||
}
|
||||
|
||||
volatile void *
|
33
include/grub/mips/loongson/serial.h
Normal file
33
include/grub/mips/loongson/serial.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MACHINE_SERIAL_HEADER
|
||||
#define GRUB_MACHINE_SERIAL_HEADER 1
|
||||
|
||||
#define GRUB_MACHINE_SERIAL_PORT0_DIVISOR_115200 2
|
||||
#define GRUB_MACHINE_SERIAL_PORT2_DIVISOR_115200 1
|
||||
#define GRUB_MACHINE_SERIAL_PORT0 0xbff003f8
|
||||
#define GRUB_MACHINE_SERIAL_PORT1 0xbfd003f8
|
||||
#define GRUB_MACHINE_SERIAL_PORT2 0xbfd002f8
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#define GRUB_MACHINE_SERIAL_PORTS { GRUB_MACHINE_SERIAL_PORT0, GRUB_MACHINE_SERIAL_PORT1, GRUB_MACHINE_SERIAL_PORT2 }
|
||||
#else
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -20,15 +20,8 @@
|
|||
#define KERNEL_MACHINE_TIME_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/cpu/time.h>
|
||||
|
||||
#define GRUB_TICKS_PER_SECOND 1000
|
||||
|
||||
/* Return the real time in ticks. */
|
||||
grub_uint32_t EXPORT_FUNC (grub_get_rtc) (void);
|
||||
|
||||
static inline void
|
||||
grub_cpu_idle(void)
|
||||
{
|
||||
}
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_busclock) __attribute__ ((section(".text")));
|
||||
|
||||
#endif /* ! KERNEL_MACHINE_TIME_HEADER */
|
|
@ -1 +1,60 @@
|
|||
#include <grub/machine/memory.h>
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MEMORY_CPU_HEADER
|
||||
#define GRUB_MEMORY_CPU_HEADER 1
|
||||
|
||||
#ifndef ASM_FILE
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#endif
|
||||
|
||||
#define GRUB_ARCH_LOWMEMVSTART 0x80000000
|
||||
#define GRUB_ARCH_LOWMEMPSTART 0x00000000
|
||||
#define GRUB_ARCH_LOWMEMMAXSIZE 0x10000000
|
||||
#define GRUB_ARCH_HIGHMEMPSTART 0x10000000
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
typedef grub_addr_t grub_phys_addr_t;
|
||||
|
||||
static inline grub_phys_addr_t
|
||||
grub_vtop (void *a)
|
||||
{
|
||||
return ((grub_phys_addr_t) a) & 0x1fffffff;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
grub_map_memory (grub_phys_addr_t a, grub_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
return (void *) (a | 0x80000000);
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_unmap_memory (void *a __attribute__ ((unused)),
|
||||
grub_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
}
|
||||
|
||||
grub_uint64_t grub_mmap_get_lower (void);
|
||||
grub_uint64_t grub_mmap_get_upper (void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
30
include/grub/mips/mips.h
Normal file
30
include/grub/mips/mips.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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_REGISTERS_CPU_HEADER
|
||||
#define GRUB_REGISTERS_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_MIPS_COP0_TIMER_COUNT GRUB_CPU_REGISTER_WRAP($9)
|
||||
|
||||
#endif
|
25
include/grub/mips/qemu_mips/at_keyboard.h
Normal file
25
include/grub/mips/qemu_mips/at_keyboard.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MACHINE_AT_KEYBOARD_HEADER
|
||||
#define GRUB_MACHINE_AT_KEYBOARD_HEADER 1
|
||||
|
||||
#define KEYBOARD_REG_DATA 0xb4000060
|
||||
#define KEYBOARD_REG_STATUS 0xb4000064
|
||||
|
||||
#endif
|
28
include/grub/mips/qemu_mips/cmos.h
Normal file
28
include/grub/mips/qemu_mips/cmos.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_CPU_CMOS_H
|
||||
#define GRUB_CPU_CMOS_H 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/cpu/io.h>
|
||||
|
||||
#define GRUB_CMOS_ADDR_REG 0xb4000070
|
||||
#define GRUB_CMOS_DATA_REG 0xb4000071
|
||||
|
||||
#endif /* GRUB_CPU_CMOS_H */
|
|
@ -20,12 +20,10 @@
|
|||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/cpu/kernel.h>
|
||||
|
||||
#ifndef ASM_FILE
|
||||
|
||||
void EXPORT_FUNC (grub_reboot) (void);
|
||||
void EXPORT_FUNC (grub_halt) (void);
|
||||
void grub_qemu_init_cirrus (void);
|
||||
|
||||
#endif
|
||||
|
0
include/grub/mips/qemu_mips/loader.h
Normal file
0
include/grub/mips/qemu_mips/loader.h
Normal file
|
@ -29,10 +29,8 @@
|
|||
#define GRUB_MACHINE_MEMORY_USABLE 0x81000000
|
||||
|
||||
#ifndef ASM_FILE
|
||||
grub_err_t EXPORT_FUNC (grub_machine_mmap_iterate)
|
||||
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
|
||||
grub_err_t EXPORT_FUNC(grub_machine_mmap_iterate)
|
||||
(int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t));
|
||||
|
||||
extern grub_uint32_t grub_arch_memsize __attribute__ ((section(".text")));
|
||||
|
||||
static inline grub_err_t
|
||||
grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)),
|
|
@ -19,6 +19,6 @@
|
|||
#ifndef GRUB_MACHINE_SERIAL_HEADER
|
||||
#define GRUB_MACHINE_SERIAL_HEADER 1
|
||||
|
||||
#define GRUB_MACHINE_SERIAL_PORTS { 0x140003f8 }
|
||||
#define GRUB_MACHINE_SERIAL_PORTS { 0xb40003f8 }
|
||||
|
||||
#endif
|
|
@ -20,18 +20,6 @@
|
|||
#define KERNEL_MACHINE_TIME_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#define GRUB_TICKS_PER_SECOND (grub_arch_cpuclock / 2)
|
||||
|
||||
/* Return the real time in ticks. */
|
||||
grub_uint64_t EXPORT_FUNC (grub_get_rtc) (void);
|
||||
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_busclock);
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_cpuclock);
|
||||
|
||||
static inline void
|
||||
grub_cpu_idle(void)
|
||||
{
|
||||
}
|
||||
#include <grub/cpu/time.h>
|
||||
|
||||
#endif /* ! KERNEL_MACHINE_TIME_HEADER */
|
|
@ -1,6 +1,37 @@
|
|||
#ifdef GRUB_MACHINE_EMU
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2004,2005,2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KERNEL_CPU_TIME_HEADER
|
||||
#define KERNEL_CPU_TIME_HEADER 1
|
||||
|
||||
#ifndef GRUB_UTIL
|
||||
|
||||
#define GRUB_TICKS_PER_SECOND (grub_arch_cpuclock / 2)
|
||||
|
||||
/* Return the real time in ticks. */
|
||||
grub_uint64_t EXPORT_FUNC (grub_get_rtc) (void);
|
||||
|
||||
extern grub_uint32_t EXPORT_VAR (grub_arch_cpuclock) __attribute__ ((section(".text")));
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
grub_cpu_idle(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -49,14 +49,19 @@
|
|||
#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
|
||||
|
||||
#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(GRUB_FILE, __LINE__, condition, fmt, ## args)
|
||||
/* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */
|
||||
#define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n))
|
||||
|
||||
void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n);
|
||||
char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src);
|
||||
char *EXPORT_FUNC(grub_strncpy) (char *dest, const char *src, int c);
|
||||
char *EXPORT_FUNC(grub_stpcpy) (char *dest, const char *src);
|
||||
|
||||
/* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */
|
||||
static inline void *
|
||||
grub_memcpy (void *dest, const void *src, grub_size_t n)
|
||||
{
|
||||
return grub_memmove (dest, src, n);
|
||||
}
|
||||
|
||||
static inline char *
|
||||
grub_strcat (char *dest, const char *src)
|
||||
{
|
||||
|
@ -82,7 +87,7 @@ grub_strncat (char *dest, const char *src, int c)
|
|||
while (*p)
|
||||
p++;
|
||||
|
||||
while ((*p = *src) != '\0' && c--)
|
||||
while (c-- && (*p = *src) != '\0')
|
||||
{
|
||||
p++;
|
||||
src++;
|
||||
|
@ -108,7 +113,53 @@ int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, grub_size_t n);
|
|||
char *EXPORT_FUNC(grub_strchr) (const char *s, int c);
|
||||
char *EXPORT_FUNC(grub_strrchr) (const char *s, int c);
|
||||
int EXPORT_FUNC(grub_strword) (const char *s, const char *w);
|
||||
char *EXPORT_FUNC(grub_strstr) (const char *haystack, const char *needle);
|
||||
|
||||
/* Copied from gnulib.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2005. */
|
||||
static inline char *
|
||||
grub_strstr (const char *haystack, const char *needle)
|
||||
{
|
||||
/* Be careful not to look at the entire extent of haystack or needle
|
||||
until needed. This is useful because of these two cases:
|
||||
- haystack may be very long, and a match of needle found early,
|
||||
- needle may be very long, and not even a short initial segment of
|
||||
needle may be found in haystack. */
|
||||
if (*needle != '\0')
|
||||
{
|
||||
/* Speed up the following searches of needle by caching its first
|
||||
character. */
|
||||
char b = *needle++;
|
||||
|
||||
for (;; haystack++)
|
||||
{
|
||||
if (*haystack == '\0')
|
||||
/* No match. */
|
||||
return 0;
|
||||
if (*haystack == b)
|
||||
/* The first character matches. */
|
||||
{
|
||||
const char *rhaystack = haystack + 1;
|
||||
const char *rneedle = needle;
|
||||
|
||||
for (;; rhaystack++, rneedle++)
|
||||
{
|
||||
if (*rneedle == '\0')
|
||||
/* Found a match. */
|
||||
return (char *) haystack;
|
||||
if (*rhaystack == '\0')
|
||||
/* No match. */
|
||||
return 0;
|
||||
if (*rhaystack != *rneedle)
|
||||
/* Nothing in this round. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return (char *) haystack;
|
||||
}
|
||||
|
||||
int EXPORT_FUNC(grub_isspace) (int c);
|
||||
int EXPORT_FUNC(grub_isprint) (int c);
|
||||
|
||||
|
@ -124,6 +175,18 @@ grub_isalpha (int c)
|
|||
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_islower (int c)
|
||||
{
|
||||
return (c >= 'a' && c <= 'z');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_isupper (int c)
|
||||
{
|
||||
return (c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_isgraph (int c)
|
||||
{
|
||||
|
@ -136,6 +199,12 @@ grub_isdigit (int c)
|
|||
return (c >= '0' && c <= '9');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_isxdigit (int c)
|
||||
{
|
||||
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_isalnum (int c)
|
||||
{
|
||||
|
@ -193,7 +262,6 @@ grub_strncasecmp (const char *s1, const char *s2, grub_size_t n)
|
|||
return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
|
||||
}
|
||||
|
||||
|
||||
unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, char **end, int base);
|
||||
unsigned long long EXPORT_FUNC(grub_strtoull) (const char *str, char **end, int base);
|
||||
|
||||
|
@ -240,6 +308,26 @@ grub_size_t EXPORT_FUNC(grub_strlen) (const char *s) __attribute__ ((warn_unused
|
|||
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)));
|
||||
|
||||
/* Replace all `ch' characters of `input' with `with' and copy the
|
||||
result into `output'; return EOS address of `output'. */
|
||||
static inline char *
|
||||
grub_strchrsub (char *output, const char *input, char ch, const char *with)
|
||||
{
|
||||
while (*input)
|
||||
{
|
||||
if (*input == ch)
|
||||
{
|
||||
grub_strcpy (output, with);
|
||||
output += grub_strlen (with);
|
||||
input++;
|
||||
continue;
|
||||
}
|
||||
*output++ = *input++;
|
||||
}
|
||||
*output = '\0';
|
||||
return output;
|
||||
}
|
||||
|
||||
extern void (*EXPORT_VAR (grub_xputs)) (const char *str);
|
||||
|
||||
static inline int
|
||||
|
@ -268,7 +356,8 @@ char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args) __attribute__
|
|||
void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
|
||||
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
|
||||
grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
|
||||
grub_uint32_t d, grub_uint32_t *r);
|
||||
grub_uint64_t d,
|
||||
grub_uint64_t *r);
|
||||
|
||||
#if NEED_ENABLE_EXECUTE_STACK && !defined(GRUB_UTIL)
|
||||
void EXPORT_FUNC(__enable_execute_stack) (void *addr);
|
||||
|
@ -281,6 +370,20 @@ void EXPORT_FUNC (__deregister_frame_info) (void);
|
|||
|
||||
/* Inline functions. */
|
||||
|
||||
static inline char *
|
||||
grub_memchr (const void *p, int c, grub_size_t len)
|
||||
{
|
||||
const char *s = p;
|
||||
const char *e = s + len;
|
||||
|
||||
for (; s < e; s++)
|
||||
if (*s == c)
|
||||
return (char *) s;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static inline unsigned int
|
||||
grub_abs (int x)
|
||||
{
|
||||
|
@ -290,24 +393,6 @@ grub_abs (int x)
|
|||
return (unsigned int) x;
|
||||
}
|
||||
|
||||
static inline long
|
||||
grub_min (long x, long y)
|
||||
{
|
||||
if (x < y)
|
||||
return x;
|
||||
else
|
||||
return y;
|
||||
}
|
||||
|
||||
static inline long
|
||||
grub_max (long x, long y)
|
||||
{
|
||||
if (x > y)
|
||||
return x;
|
||||
else
|
||||
return y;
|
||||
}
|
||||
|
||||
/* Rounded-up division */
|
||||
static inline unsigned int
|
||||
grub_div_roundup (unsigned int x, unsigned int y)
|
||||
|
@ -316,12 +401,18 @@ grub_div_roundup (unsigned int x, unsigned int y)
|
|||
}
|
||||
|
||||
/* Reboot the machine. */
|
||||
void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
|
||||
#if defined (GRUB_MACHINE_EMU) || defined (GRUB_MACHINE_QEMU_MIPS)
|
||||
void EXPORT_FUNC(grub_reboot) (void) __attribute__ ((noreturn));
|
||||
#else
|
||||
void grub_reboot (void) __attribute__ ((noreturn));
|
||||
#endif
|
||||
|
||||
#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 grub_halt (int no_apm) __attribute__ ((noreturn));
|
||||
#elif defined (__mips__)
|
||||
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
|
||||
#else
|
||||
void grub_halt (void) __attribute__ ((noreturn));
|
||||
#endif
|
||||
|
|
|
@ -36,7 +36,7 @@ void *EXPORT_FUNC(grub_realloc) (void *ptr, grub_size_t size);
|
|||
void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size);
|
||||
|
||||
void grub_mm_check_real (char *file, int line);
|
||||
#define GRUB_MM_CHECK grub_mm_check_real (__FILE__, __LINE__);
|
||||
#define grub_mm_check() grub_mm_check_real (GRUB_FILE, __LINE__);
|
||||
|
||||
/* For debugging. */
|
||||
#if defined(MM_DEBUG) && !defined(GRUB_UTIL) && !defined (GRUB_MACHINE_EMU)
|
||||
|
@ -72,4 +72,21 @@ void *EXPORT_FUNC(grub_debug_memalign) (const char *file, int line,
|
|||
grub_size_t align, grub_size_t size);
|
||||
#endif /* MM_DEBUG && ! GRUB_UTIL */
|
||||
|
||||
#include <grub/err.h>
|
||||
|
||||
static inline grub_err_t
|
||||
grub_extend_alloc (grub_size_t sz, grub_size_t *allocated, void **ptr)
|
||||
{
|
||||
void *n;
|
||||
if (sz < *allocated)
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
*allocated = 2 * sz;
|
||||
n = grub_realloc (*ptr, *allocated);
|
||||
if (!n)
|
||||
return grub_errno;
|
||||
*ptr = n;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
#endif /* ! GRUB_MM_H */
|
||||
|
|
|
@ -42,9 +42,11 @@
|
|||
#define GRUB_PC_PARTITION_TYPE_FAT32_LBA 0xc
|
||||
#define GRUB_PC_PARTITION_TYPE_FAT16_LBA 0xe
|
||||
#define GRUB_PC_PARTITION_TYPE_WIN95_EXTENDED 0xf
|
||||
#define GRUB_PC_PARTITION_TYPE_PLAN9 0x39
|
||||
#define GRUB_PC_PARTITION_TYPE_EZD 0x55
|
||||
#define GRUB_PC_PARTITION_TYPE_MINIX 0x80
|
||||
#define GRUB_PC_PARTITION_TYPE_LINUX_MINIX 0x81
|
||||
#define GRUB_PC_PARTITION_TYPE_LINUX_SWAP 0x82
|
||||
#define GRUB_PC_PARTITION_TYPE_EXT2FS 0x83
|
||||
#define GRUB_PC_PARTITION_TYPE_LINUX_EXTENDED 0x85
|
||||
#define GRUB_PC_PARTITION_TYPE_VSTAFS 0x9e
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue